1 /**
2  ****************************************************************************************
3  *
4  * @file app_sec.h
5  *
6  * @brief Application Security Entry Point
7  *
8  * Copyright (C) RivieraWaves 2009-2015
9  *
10  *
11  ****************************************************************************************
12  */
13 
14 /**
15  ****************************************************************************************
16  * @addtogroup APP_SEC
17  * @{
18  ****************************************************************************************
19  */
20 
21 #ifndef APP_SEC_H_
22 #define APP_SEC_H_
23 
24 /*
25  * INCLUDE FILES
26  ****************************************************************************************
27  */
28 #include "stdbool.h"
29 #include "rwip_config.h"
30 
31 #if (BLE_APP_SEC)
32 
33 #include <stdint.h>          // Standard Integer Definition
34 
35 /*
36  * DEFINES
37  ****************************************************************************************
38  */
39 
40 /*
41  * STRUCTURES DEFINITIONS
42  ****************************************************************************************
43  */
44 
45 struct app_sec_env_tag
46 {
47     // Bond status
48     bool bonded;
49     uint8_t device_num;
50 };
51 
52 /*
53  * GLOBAL VARIABLE DECLARATIONS
54  ****************************************************************************************
55  */
56 
57 /// Application Security Environment
58 extern struct app_sec_env_tag app_sec_env;
59 
60 /// Table of message handlers
61 extern const struct ke_state_handler app_sec_table_handler;
62 
63 /*
64  * GLOBAL FUNCTIONS DECLARATIONS
65  ****************************************************************************************
66  */
67 
68 /**
69  ****************************************************************************************
70  * @brief Initialize the Application Security Module
71  ****************************************************************************************
72  */
73 void app_sec_init(void);
74 
75 
76 #if (NVDS_SUPPORT)
77 /**
78  ****************************************************************************************
79  * @brief Remove all bond data stored in NVDS
80  ****************************************************************************************
81  */
82 void app_sec_remove_bond(void);
83 #endif //(NVDS_SUPPORT)
84 
85 /**
86  ****************************************************************************************
87  * @brief Send a security request to the peer device. This function is used to require the
88  * central to start the encryption with a LTK that would have shared during a previous
89  * bond procedure.
90  *
91  * @param[in]   - conidx: Connection Index
92  ****************************************************************************************
93  */
94 void app_sec_send_security_req(uint8_t conidx);
95 
96 #endif //(BLE_APP_SEC)
97 
98 #endif // APP_SEC_H_
99 
100 /// @} APP_SEC
101