1 /*
2  * Copyright (c) 2020 Nordic Semiconductor ASA
3  * Copyright (c) 2020 Demant
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 void helper_pdu_encode_ping_req(struct pdu_data *pdu, void *param);
9 void helper_pdu_encode_ping_rsp(struct pdu_data *pdu, void *param);
10 
11 void helper_pdu_encode_feature_req(struct pdu_data *pdu, void *param);
12 void helper_pdu_encode_peripheral_feature_req(struct pdu_data *pdu, void *param);
13 void helper_pdu_encode_feature_rsp(struct pdu_data *pdu, void *param);
14 
15 void helper_pdu_encode_min_used_chans_ind(struct pdu_data *pdu, void *param);
16 
17 void helper_pdu_encode_version_ind(struct pdu_data *pdu, void *param);
18 
19 void helper_pdu_encode_enc_req(struct pdu_data *pdu, void *param);
20 
21 void helper_pdu_encode_enc_rsp(struct pdu_data *pdu, void *param);
22 
23 void helper_pdu_encode_start_enc_req(struct pdu_data *pdu, void *param);
24 
25 void helper_pdu_encode_start_enc_rsp(struct pdu_data *pdu, void *param);
26 
27 void helper_pdu_encode_pause_enc_req(struct pdu_data *pdu, void *param);
28 
29 void helper_pdu_encode_pause_enc_rsp(struct pdu_data *pdu, void *param);
30 
31 void helper_pdu_encode_reject_ext_ind(struct pdu_data *pdu, void *param);
32 
33 void helper_pdu_encode_reject_ind(struct pdu_data *pdu, void *param);
34 
35 void helper_pdu_encode_phy_req(struct pdu_data *pdu, void *param);
36 void helper_pdu_encode_phy_rsp(struct pdu_data *pdu, void *param);
37 void helper_pdu_encode_phy_update_ind(struct pdu_data *pdu, void *param);
38 void helper_pdu_encode_unknown_rsp(struct pdu_data *pdu, void *param);
39 
40 void helper_pdu_encode_conn_param_req(struct pdu_data *pdu, void *param);
41 void helper_pdu_encode_conn_param_rsp(struct pdu_data *pdu, void *param);
42 void helper_pdu_encode_conn_update_ind(struct pdu_data *pdu, void *param);
43 
44 void helper_pdu_encode_terminate_ind(struct pdu_data *pdu, void *param);
45 
46 void helper_pdu_encode_channel_map_update_ind(struct pdu_data *pdu, void *param);
47 
48 void helper_pdu_encode_length_req(struct pdu_data *pdu, void *param);
49 void helper_pdu_encode_length_rsp(struct pdu_data *pdu, void *param);
50 
51 void helper_pdu_encode_cte_req(struct pdu_data *pdu, void *param);
52 void helper_pdu_encode_cte_rsp(struct pdu_data *pdu, void *param);
53 void helper_node_encode_cte_rsp(struct node_rx_pdu *rx, void *param);
54 
55 void helper_pdu_encode_zero(struct pdu_data *pdu, void *param);
56 
57 void helper_pdu_encode_cis_req(struct pdu_data *pdu, void *param);
58 void helper_pdu_encode_cis_rsp(struct pdu_data *pdu, void *param);
59 void helper_pdu_encode_cis_ind(struct pdu_data *pdu, void *param);
60 void helper_pdu_encode_cis_terminate_ind(struct pdu_data *pdu, void *param);
61 
62 void helper_pdu_encode_sca_req(struct pdu_data *pdu, void *param);
63 void helper_pdu_encode_sca_rsp(struct pdu_data *pdu, void *param);
64 
65 void helper_pdu_verify_ping_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
66 void helper_pdu_verify_ping_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
67 
68 void helper_pdu_verify_feature_req(const char *file, uint32_t line, struct pdu_data *pdu,
69 				   void *param);
70 void helper_pdu_verify_peripheral_feature_req(const char *file, uint32_t line, struct pdu_data *pdu,
71 					      void *param);
72 void helper_pdu_verify_feature_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
73 				   void *param);
74 
75 void helper_pdu_verify_min_used_chans_ind(const char *file, uint32_t line, struct pdu_data *pdu,
76 					  void *param);
77 
78 void helper_pdu_verify_version_ind(const char *file, uint32_t line, struct pdu_data *pdu,
79 				   void *param);
80 
81 void helper_pdu_verify_enc_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
82 
83 void helper_pdu_ntf_verify_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
84 				   void *param);
85 
86 void helper_pdu_verify_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
87 
88 void helper_pdu_verify_start_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
89 				     void *param);
90 
91 void helper_pdu_verify_start_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
92 				     void *param);
93 
94 void helper_pdu_verify_pause_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
95 				     void *param);
96 
97 void helper_pdu_verify_pause_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
98 				     void *param);
99 
100 void helper_node_verify_enc_refresh(const char *file, uint32_t line, struct node_rx_pdu *rx,
101 				    void *param);
102 
103 void helper_pdu_verify_reject_ind(const char *file, uint32_t line, struct pdu_data *pdu,
104 				  void *param);
105 
106 void helper_pdu_verify_reject_ext_ind(const char *file, uint32_t line, struct pdu_data *pdu,
107 				      void *param);
108 
109 void helper_pdu_verify_phy_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
110 void helper_pdu_verify_phy_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
111 void helper_pdu_verify_phy_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
112 				      void *param);
113 void helper_pdu_verify_unknown_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
114 				   void *param);
115 
116 void helper_pdu_verify_terminate_ind(const char *file, uint32_t line, struct pdu_data *pdu,
117 				     void *param);
118 
119 void helper_pdu_verify_channel_map_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
120 					      void *param);
121 
122 void helper_node_verify_phy_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
123 				   void *param);
124 void helper_pdu_verify_conn_param_req(const char *file, uint32_t line, struct pdu_data *pdu,
125 				      void *param);
126 void helper_pdu_verify_conn_param_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
127 				      void *param);
128 void helper_pdu_verify_conn_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
129 				       void *param);
130 void helper_node_verify_conn_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
131 				    void *param);
132 
133 void helper_pdu_verify_length_req(const char *file, uint32_t line, struct pdu_data *pdu,
134 				  void *param);
135 void helper_pdu_verify_length_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
136 				  void *param);
137 
138 void helper_pdu_verify_cte_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
139 void helper_pdu_verify_cte_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
140 void helper_node_verify_cte_rsp(const char *file, uint32_t line, struct node_rx_pdu *rx,
141 				void *param);
142 void helper_pdu_ntf_verify_cte_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
143 				   void *param);
144 
145 void helper_node_verify_cis_request(const char *file, uint32_t line, struct node_rx_pdu *rx,
146 				void *param);
147 void helper_node_verify_cis_established(const char *file, uint32_t line, struct node_rx_pdu *rx,
148 				void *param);
149 void helper_pdu_verify_cis_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
150 void helper_pdu_verify_cis_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
151 void helper_pdu_verify_cis_ind(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
152 void helper_pdu_verify_cis_terminate_ind(const char *file, uint32_t line, struct pdu_data *pdu,
153 				     void *param);
154 
155 void helper_pdu_verify_sca_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
156 void helper_pdu_verify_sca_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
157 
158 void helper_node_verify_peer_sca_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
159 				   void *param);
160 
161 enum helper_pdu_opcode {
162 	LL_VERSION_IND,
163 	LL_LE_PING_REQ,
164 	LL_LE_PING_RSP,
165 	LL_FEATURE_REQ,
166 	LL_PERIPH_FEAT_XCHG,
167 	LL_FEATURE_RSP,
168 	LL_MIN_USED_CHANS_IND,
169 	LL_REJECT_IND,
170 	LL_REJECT_EXT_IND,
171 	LL_ENC_REQ,
172 	LL_ENC_RSP,
173 	LL_START_ENC_REQ,
174 	LL_START_ENC_RSP,
175 	LL_PAUSE_ENC_REQ,
176 	LL_PAUSE_ENC_RSP,
177 	LL_PHY_REQ,
178 	LL_PHY_RSP,
179 	LL_PHY_UPDATE_IND,
180 	LL_UNKNOWN_RSP,
181 	LL_CONNECTION_UPDATE_IND,
182 	LL_CONNECTION_PARAM_REQ,
183 	LL_CONNECTION_PARAM_RSP,
184 	LL_TERMINATE_IND,
185 	LL_CHAN_MAP_UPDATE_IND,
186 	LL_LENGTH_REQ,
187 	LL_LENGTH_RSP,
188 	LL_CTE_REQ,
189 	LL_CTE_RSP,
190 	LL_CLOCK_ACCURACY_REQ,
191 	LL_CLOCK_ACCURACY_RSP,
192 	LL_CIS_REQ,
193 	LL_CIS_RSP,
194 	LL_CIS_IND,
195 	LL_CIS_TERMINATE_IND,
196 	LL_ZERO,
197 };
198 
199 enum helper_node_opcode {
200 	NODE_PHY_UPDATE,
201 	NODE_CONN_UPDATE,
202 	NODE_ENC_REFRESH,
203 	NODE_CTE_RSP,
204 	NODE_CIS_REQUEST,
205 	NODE_CIS_ESTABLISHED,
206 	NODE_PEER_SCA_UPDATE,
207 };
208 
209 typedef void(helper_pdu_encode_func_t)(struct pdu_data *data, void *param);
210 typedef void(helper_pdu_verify_func_t)(const char *file, uint32_t line, struct pdu_data *data,
211 				       void *param);
212 typedef void(helper_pdu_ntf_verify_func_t)(const char *file, uint32_t line, struct pdu_data *data,
213 					   void *param);
214 typedef void(helper_node_encode_func_t)(struct node_rx_pdu *rx, void *param);
215 typedef void(helper_node_verify_func_t)(const char *file, uint32_t line, struct node_rx_pdu *rx,
216 					void *param);
217