https://developer.mbed.org/users/TheoHavercroft/code/nrf51-sdk/
Fork of nRF51822 by
source/btle/btle_security.h@597:bcd5e287c494, 2016-01-11 (annotated)
- Committer:
- vcoubard
- Date:
- Mon Jan 11 10:19:35 2016 +0000
- Revision:
- 597:bcd5e287c494
- Parent:
- 558:c4b56f9d6f3b
- Child:
- 598:814c1ce92947
Synchronized with git rev 0f76db4e
Author: Andres Amaya Garcia
Add helper function to get whitelist from SD bond table
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vcoubard | 558:c4b56f9d6f3b | 1 | /* mbed Microcontroller Library |
vcoubard | 558:c4b56f9d6f3b | 2 | * Copyright (c) 2006-2013 ARM Limited |
vcoubard | 558:c4b56f9d6f3b | 3 | * |
vcoubard | 558:c4b56f9d6f3b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
vcoubard | 558:c4b56f9d6f3b | 5 | * you may not use this file except in compliance with the License. |
vcoubard | 558:c4b56f9d6f3b | 6 | * You may obtain a copy of the License at |
vcoubard | 558:c4b56f9d6f3b | 7 | * |
vcoubard | 558:c4b56f9d6f3b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
vcoubard | 558:c4b56f9d6f3b | 9 | * |
vcoubard | 558:c4b56f9d6f3b | 10 | * Unless required by applicable law or agreed to in writing, software |
vcoubard | 558:c4b56f9d6f3b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
vcoubard | 558:c4b56f9d6f3b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
vcoubard | 558:c4b56f9d6f3b | 13 | * See the License for the specific language governing permissions and |
vcoubard | 558:c4b56f9d6f3b | 14 | * limitations under the License. |
vcoubard | 558:c4b56f9d6f3b | 15 | */ |
vcoubard | 558:c4b56f9d6f3b | 16 | |
vcoubard | 558:c4b56f9d6f3b | 17 | #ifndef _BTLE_SECURITY_H_ |
vcoubard | 558:c4b56f9d6f3b | 18 | #define _BTLE_SECURITY_H_ |
vcoubard | 558:c4b56f9d6f3b | 19 | |
vcoubard | 558:c4b56f9d6f3b | 20 | #include "ble/Gap.h" |
vcoubard | 558:c4b56f9d6f3b | 21 | #include "ble/SecurityManager.h" |
vcoubard | 558:c4b56f9d6f3b | 22 | |
vcoubard | 558:c4b56f9d6f3b | 23 | /** |
vcoubard | 558:c4b56f9d6f3b | 24 | * Enable Nordic's Device Manager, which brings in functionality from the |
vcoubard | 558:c4b56f9d6f3b | 25 | * stack's Security Manager. The Security Manager implements the actual |
vcoubard | 558:c4b56f9d6f3b | 26 | * cryptographic algorithms and protocol exchanges that allow two devices to |
vcoubard | 558:c4b56f9d6f3b | 27 | * securely exchange data and privately detect each other. |
vcoubard | 558:c4b56f9d6f3b | 28 | * |
vcoubard | 558:c4b56f9d6f3b | 29 | * @param[in] enableBonding Allow for bonding. |
vcoubard | 558:c4b56f9d6f3b | 30 | * @param[in] requireMITM Require protection for man-in-the-middle attacks. |
vcoubard | 558:c4b56f9d6f3b | 31 | * @param[in] iocaps To specify IO capabilities of this peripheral, |
vcoubard | 558:c4b56f9d6f3b | 32 | * such as availability of a display or keyboard to |
vcoubard | 558:c4b56f9d6f3b | 33 | * support out-of-band exchanges of security data. |
vcoubard | 558:c4b56f9d6f3b | 34 | * @param[in] passkey To specify a static passkey. |
vcoubard | 558:c4b56f9d6f3b | 35 | * |
vcoubard | 558:c4b56f9d6f3b | 36 | * @return BLE_ERROR_NONE on success. |
vcoubard | 558:c4b56f9d6f3b | 37 | */ |
vcoubard | 558:c4b56f9d6f3b | 38 | ble_error_t btle_initializeSecurity(bool enableBonding = true, |
vcoubard | 558:c4b56f9d6f3b | 39 | bool requireMITM = true, |
vcoubard | 558:c4b56f9d6f3b | 40 | SecurityManager::SecurityIOCapabilities_t iocaps = SecurityManager::IO_CAPS_NONE, |
vcoubard | 558:c4b56f9d6f3b | 41 | const SecurityManager::Passkey_t passkey = NULL); |
vcoubard | 558:c4b56f9d6f3b | 42 | |
vcoubard | 597:bcd5e287c494 | 43 | ble_error_t btle_createWhitelistFromBonds(ble_gap_whitelist_t *p_whitelist); |
vcoubard | 597:bcd5e287c494 | 44 | |
vcoubard | 558:c4b56f9d6f3b | 45 | /** |
vcoubard | 558:c4b56f9d6f3b | 46 | * Get the security status of a link. |
vcoubard | 558:c4b56f9d6f3b | 47 | * |
vcoubard | 558:c4b56f9d6f3b | 48 | * @param[in] connectionHandle |
vcoubard | 558:c4b56f9d6f3b | 49 | * Handle to identify the connection. |
vcoubard | 558:c4b56f9d6f3b | 50 | * @param[out] securityStatusP |
vcoubard | 558:c4b56f9d6f3b | 51 | * security status. |
vcoubard | 558:c4b56f9d6f3b | 52 | * |
vcoubard | 558:c4b56f9d6f3b | 53 | * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure. |
vcoubard | 558:c4b56f9d6f3b | 54 | */ |
vcoubard | 558:c4b56f9d6f3b | 55 | ble_error_t btle_getLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::LinkSecurityStatus_t *securityStatusP); |
vcoubard | 558:c4b56f9d6f3b | 56 | |
vcoubard | 558:c4b56f9d6f3b | 57 | /** |
vcoubard | 558:c4b56f9d6f3b | 58 | * Set the security mode on a connection. Useful for elevating the security mode |
vcoubard | 558:c4b56f9d6f3b | 59 | * once certain conditions are met, e.g., a particular service is found. |
vcoubard | 558:c4b56f9d6f3b | 60 | * |
vcoubard | 558:c4b56f9d6f3b | 61 | * @param[in] connectionHandle |
vcoubard | 558:c4b56f9d6f3b | 62 | * Handle to identify the connection. |
vcoubard | 558:c4b56f9d6f3b | 63 | * @param[in] securityMode |
vcoubard | 558:c4b56f9d6f3b | 64 | * security mode. |
vcoubard | 558:c4b56f9d6f3b | 65 | * |
vcoubard | 558:c4b56f9d6f3b | 66 | * @return BLE_ERROR_NONE Or appropriate error code indicating reason for failure. |
vcoubard | 558:c4b56f9d6f3b | 67 | */ |
vcoubard | 558:c4b56f9d6f3b | 68 | ble_error_t btle_setLinkSecurity(Gap::Handle_t connectionHandle, SecurityManager::SecurityMode_t securityMode); |
vcoubard | 558:c4b56f9d6f3b | 69 | |
vcoubard | 558:c4b56f9d6f3b | 70 | /** |
vcoubard | 558:c4b56f9d6f3b | 71 | * Function for deleting all peer device context and all related bonding |
vcoubard | 558:c4b56f9d6f3b | 72 | * information from the database. |
vcoubard | 558:c4b56f9d6f3b | 73 | * |
vcoubard | 558:c4b56f9d6f3b | 74 | * @retval BLE_ERROR_NONE On success, else an error code indicating reason for failure. |
vcoubard | 558:c4b56f9d6f3b | 75 | * @retval BLE_ERROR_INVALID_STATE If the API is called without module initialization and/or |
vcoubard | 558:c4b56f9d6f3b | 76 | * application registration. |
vcoubard | 558:c4b56f9d6f3b | 77 | */ |
vcoubard | 558:c4b56f9d6f3b | 78 | ble_error_t btle_purgeAllBondingState(void); |
vcoubard | 558:c4b56f9d6f3b | 79 | |
rgrover1 | 134:df7e7964a9c3 | 80 | #endif /* _BTLE_SECURITY_H_ */ |