1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef _APP_PRESENT_SEC_H 17 #define _APP_PRESENT_SEC_H 18 19 #include "ble_ip_config.h" 20 21 #if (BLE_APP_SEC) 22 23 #include <stdint.h> 24 25 /* 26 * DEFINES 27 **************************************************************************************** 28 */ 29 30 /* 31 * STRUCTURES DEFINITIONS 32 **************************************************************************************** 33 */ 34 35 struct app_sec_env_tag 36 { 37 // Bond status 38 bool bonded; 39 }; 40 41 /* 42 * GLOBAL VARIABLE DECLARATIONS 43 **************************************************************************************** 44 */ 45 46 /// Application Security Environment 47 extern struct app_sec_env_tag app_sec_env; 48 49 /// Table of message handlers 50 extern const struct app_subtask_handlers app_sec_handlers; 51 52 /* 53 * GLOBAL FUNCTIONS DECLARATIONS 54 **************************************************************************************** 55 */ 56 57 /** 58 **************************************************************************************** 59 * @brief Initialize the Application Security Module 60 **************************************************************************************** 61 */ 62 void app_sec_init(void); 63 64 65 /** 66 **************************************************************************************** 67 * @brief Remove all bond data stored in NVDS 68 **************************************************************************************** 69 */ 70 void app_sec_remove_bond(void); 71 72 /** 73 **************************************************************************************** 74 * @brief Send a security request to the peer device. This function is used to require the 75 * central to start the encryption with a LTK that would have shared during a previous 76 * bond procedure. 77 * 78 * @param[in] - conidx: Connection Index 79 **************************************************************************************** 80 */ 81 void app_sec_send_security_req(uint8_t conidx); 82 83 #endif //(BLE_APP_SEC) 84 85 #endif // _APP_PRESENT_SEC_H 86