1 /**
2  ****************************************************************************************
3  *
4  * @file smpc_util.h
5  *
6  * @brief Header file for SMPC utilities.
7  *
8  * Copyright (C) RivieraWaves 2009-2016
9  *
10  *
11  ****************************************************************************************
12  */
13 
14 #ifndef SMPC_UTIL_H_
15 #define SMPC_UTIL_H_
16 
17 /**
18  ****************************************************************************************
19  * @addtogroup SMPC_UTIL Utility
20  * @ingroup SMPC
21  * @brief Contains utility functions and macros for SMPC.
22  *
23  * The SMPC Utilities block contains key generating and security related functions
24  * that are useful in accomplishing the task of the security manager protocol
25  * layer of the Bluetooth Low Energy.
26  *
27  * @{
28  ****************************************************************************************
29  */
30 
31 /*
32  * INCLUDE FILES
33  ****************************************************************************************
34  */
35 #include "rwip_config.h"
36 #if (BLE_SMPC)
37 
38 #include "smp_common.h"
39 #include <string.h>
40 
41 #include "l2cc_pdu.h"
42 #include "smpc_int.h"
43 
44 /*
45  * TYPE DEFINITIONS
46  ****************************************************************************************
47  */
48 
49 /// SMPC command PDU construct function pointer type definition
50 typedef void (*smpc_construct_pdu_t)(struct l2cc_pdu *pdu, void *value);
51 
52 /// SMPC command PDU reception functions
53 typedef void (*smpc_recv_pdu_t)(uint8_t idx, struct l2cc_pdu *pdu);
54 
55 /*
56  * GLOBAL VARIABLES DECLARATION
57  ****************************************************************************************
58  */
59 
60 extern const smpc_construct_pdu_t smpc_construct_pdu[L2C_CODE_SECURITY_MAX];
61 extern const smpc_recv_pdu_t smpc_recv_pdu[L2C_CODE_SECURITY_MAX];
62 
63 /*
64  * FUNCTIONS DECLARATION
65  ****************************************************************************************
66  */
67 
68 /**
69  ****************************************************************************************
70  * @brief Parameter checking function of SMP PDU packets.
71  *
72  * @param[in] pdu   Pointer to the data part of the SMP command PDU.
73  *
74  * @return Value of check parameter status, to be reported to host or back to peer.
75  ****************************************************************************************
76  */
77 uint8_t smpc_check_param(struct l2cc_pdu *pdu);
78 
79 #endif //(BLE_SMPC)
80 #endif //(SMPC_UTIL_H_)
81 
82 /// @} SMPC_UTIL
83