1 /******************************************************************************
2  * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
3  * All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************/
18 #ifndef LL_RESOLVLIST_H_
19 #define LL_RESOLVLIST_H_
20 
21 
22 #include <stack/ble/ble_common.h>
23 
24 
25 
26 
27 /**
28  * @brief      This function is used to initialize resolving list && RPA concerned parameters
29  * @param[in]  none
30  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
31  */
32 void			blc_ll_resolvListInit(void);
33 
34 /**
35  * @brief      This function is used to reset resolving list
36  * @param[in]  none
37  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
38  */
39 ble_sts_t		ll_resolvingList_reset(void);
40 
41 
42 /**
43  * @brief      This function is used to add a device to resolving list
44  * @param[in]  peerIdAddrType - device mac address type
45  * @param[in]  peerIdAddr - device mac address
46  * @param[in]  peer_irk - peer IRK pointer
47  * @param[in]  local_irk - local IRK pointer
48  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
49  */
50 ble_sts_t		ll_resolvingList_add(u8 peerIdAddrType, u8 *peerIdAddr, u8 *peer_irk, u8 *local_irk);
51 
52 
53 /**
54  * @brief      This function is used to delete a device from resolving list
55  * @param[in]  peerIdAddrType - device mac address type
56  * @param[in]  peerIdAddr - device mac address
57  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
58  */
59 ble_sts_t		ll_resolvingList_delete(u8 peerIdAddrType, u8 *peerIdAddr);
60 
61 
62 /**
63  * @brief      This function is used to enable resolvinglist resolution
64  * @param[in]  resolutionEn - 1: enable; 0:disable
65  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
66  */
67 ble_sts_t		ll_resolvingList_setAddrResolutionEnable (u8 resolutionEn);
68 
69 
70 /**
71  * @brief      This function is used to get resolving list size
72  * @param[out] pointer to size
73  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
74  */
75 ble_sts_t  		ll_resolvingList_getSize(u8 *Size);
76 
77 
78 /**
79  * @brief	This function is used to get the current peer Resolvable Private
80  * 			Address being used for the corresponding peer Public and Random (static) Identity Address.
81  * @param[in]	peerIdAddrType - Peer Identity Address Type
82  * @param[in]	peerIdAddr - Peer Identity Address
83  * @param[out]  peerResolvableAddr - Peer Resolvable Address
84  * @return	Status - 0x00: command succeeded; 0x01-0xFF: command failed
85  */
86 ble_sts_t  		ll_resolvingList_getPeerResolvableAddr (u8 peerIdAddrType, u8* peerIdAddr, u8* peerResolvableAddr);
87 
88 
89 /**
90  * @brief	This function is used to get the current local Resolvable Private
91  * 			Address being used for the corresponding peer Identity Address.
92  * @param[in]	peerIdAddrType - Peer Identity Address Type
93  * @param[in]	peerIdAddr - Peer Identity Address
94  * @param[out]  LocalResolvableAddr - Local Resolvable Address
95  * @return	Status - 0x00: command succeeded; 0x01-0xFF: command failed
96  */
97 ble_sts_t  		ll_resolvingList_getLocalResolvableAddr(u8 peerIdAddrType, u8* peerIdAddr, u8* LocalResolvableAddr);
98 
99 
100 /**
101  * @brief	This function is used to enable resolution of Resolvable Private Addresses in the Controller.
102  * @param[in]	resolutionEn - Address Resolution Enable/Disable
103  * @return	Status - 0x00: command succeeded; 0x01-0xFF: command failed
104  */
105 ble_sts_t  		ll_resolvingList_setAddrResolutionEnable (u8 resolutionEn);
106 
107 /*
108  * @brief 	This function is used to set the length of time the controller uses a
109  * 			Resolvable Private Address before a new resolvable	private address is
110  * 			generated and starts being used. This timeout applies to all addresses
111  * 			generated by the controller
112 *  @param[in]	timeout_s - RPA_Timeout: RPA_Timeout measured in seconds Range: 0x0001 to 0x0E10, Time range: 1 s to 1 hour
113  * @return	Status - 0x00: command succeeded; 0x01-0xFF: command failed
114  * */
115 ble_sts_t  		ll_resolvingList_setResolvablePrivateAddrTimer (u16 timeout_s);
116 
117 /*
118  * @brief 	This function is used to allow the Host to specify the privacy mode to
119  * 			be used for a given entry on the resolving list.
120  * @param[in]	peerIdAddrType - Peer Identity Address Type
121  * @param[in]	peerIdAddr - Peer Identity Address
122  * @param[in]	privMode - Privacy_Mode: Network/Device Privacy Mode
123  * @return	Status - 0x00: command succeeded; 0x01-0xFF: command failed
124  * */
125 ble_sts_t  		ll_resolvingList_setPrivcyMode(u8 peerIdAddrType, u8* peerIdAddr, u8 privMode);
126 
127 
128 #endif /* LL_RESOLVLIST_H_ */
129