David Kester / nRF51822

Dependents:   GonioTrainer

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers btle_security.h Source File

btle_security.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef _BTLE_SECURITY_H_
00018 #define _BTLE_SECURITY_H_
00019 
00020 #include "Gap.h"
00021 
00022 /**
00023  * Enable Nordic's Device Manager, which brings in functionality from the
00024  * stack's Security Manager. The Security Manager implements the actual
00025  * cryptographic algorithms and protocol exchanges that allow two devices to
00026  * securely exchange data and privately detect each other.
00027  *
00028  * @param[in]  enableBonding Allow for bonding.
00029  * @param[in]  requireMITM   Require protection for man-in-the-middle attacks.
00030  * @param[in]  iocaps        To specify IO capabilities of this peripheral,
00031  *                           such as availability of a display or keyboard to
00032  *                           support out-of-band exchanges of security data.
00033  * @param[in]  passkey       To specify a static passkey.
00034  *
00035  * @return BLE_ERROR_NONE on success.
00036  */
00037 ble_error_t btle_initializeSecurity(bool                          enableBonding = true,
00038                                     bool                          requireMITM   = true,
00039                                     Gap::SecurityIOCapabilities_t iocaps        = Gap::IO_CAPS_NONE,
00040                                     const Gap::Passkey_t          passkey       = NULL);
00041 
00042 /**
00043  * Get the security status of a link.
00044  *
00045  * @param[in]  connectionHandle
00046  *               Handle to identify the connection.
00047  * @param[out] securityStatusP
00048  *               security status.
00049  *
00050  * @return BLE_SUCCESS Or appropriate error code indicating reason for failure.
00051  */
00052 ble_error_t btle_getLinkSecurity(Gap::Handle_t connectionHandle, Gap::LinkSecurityStatus_t *securityStatusP);
00053 
00054 /**
00055  * Function for deleting all peer device context and all related bonding
00056  * information from the database.
00057  *
00058  * @retval BLE_ERROR_NONE             On success, else an error code indicating reason for failure.
00059  * @retval BLE_ERROR_INVALID_STATE    If the API is called without module initialization and/or
00060  *                                    application registration.
00061  */
00062 ble_error_t btle_purgeAllBondingState(void);
00063 
00064 #endif /* _BTLE_SECURITY_H_ */