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_encode_periodic_sync_ind(struct pdu_data *pdu, void *param);
66 
67 void helper_pdu_verify_ping_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
68 void helper_pdu_verify_ping_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
69 
70 void helper_pdu_verify_feature_req(const char *file, uint32_t line, struct pdu_data *pdu,
71 				   void *param);
72 void helper_pdu_verify_peripheral_feature_req(const char *file, uint32_t line, struct pdu_data *pdu,
73 					      void *param);
74 void helper_pdu_verify_feature_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
75 				   void *param);
76 
77 void helper_pdu_verify_min_used_chans_ind(const char *file, uint32_t line, struct pdu_data *pdu,
78 					  void *param);
79 
80 void helper_pdu_verify_version_ind(const char *file, uint32_t line, struct pdu_data *pdu,
81 				   void *param);
82 
83 void helper_pdu_verify_enc_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
84 
85 void helper_pdu_ntf_verify_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
86 				   void *param);
87 
88 void helper_pdu_verify_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
89 
90 void helper_pdu_verify_start_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
91 				     void *param);
92 
93 void helper_pdu_verify_start_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
94 				     void *param);
95 
96 void helper_pdu_verify_pause_enc_req(const char *file, uint32_t line, struct pdu_data *pdu,
97 				     void *param);
98 
99 void helper_pdu_verify_pause_enc_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
100 				     void *param);
101 
102 void helper_node_verify_enc_refresh(const char *file, uint32_t line, struct node_rx_pdu *rx,
103 				    void *param);
104 
105 void helper_pdu_verify_reject_ind(const char *file, uint32_t line, struct pdu_data *pdu,
106 				  void *param);
107 
108 void helper_pdu_verify_reject_ext_ind(const char *file, uint32_t line, struct pdu_data *pdu,
109 				      void *param);
110 
111 void helper_pdu_verify_phy_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
112 void helper_pdu_verify_phy_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
113 void helper_pdu_verify_phy_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
114 				      void *param);
115 void helper_pdu_verify_unknown_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
116 				   void *param);
117 
118 void helper_pdu_verify_terminate_ind(const char *file, uint32_t line, struct pdu_data *pdu,
119 				     void *param);
120 
121 void helper_pdu_verify_channel_map_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
122 					      void *param);
123 
124 void helper_node_verify_phy_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
125 				   void *param);
126 void helper_pdu_verify_conn_param_req(const char *file, uint32_t line, struct pdu_data *pdu,
127 				      void *param);
128 void helper_pdu_verify_conn_param_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
129 				      void *param);
130 void helper_pdu_verify_conn_update_ind(const char *file, uint32_t line, struct pdu_data *pdu,
131 				       void *param);
132 void helper_node_verify_conn_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
133 				    void *param);
134 
135 void helper_pdu_verify_length_req(const char *file, uint32_t line, struct pdu_data *pdu,
136 				  void *param);
137 void helper_pdu_verify_length_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
138 				  void *param);
139 
140 void helper_pdu_verify_cte_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
141 void helper_pdu_verify_cte_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
142 void helper_node_verify_cte_rsp(const char *file, uint32_t line, struct node_rx_pdu *rx,
143 				void *param);
144 void helper_pdu_ntf_verify_cte_rsp(const char *file, uint32_t line, struct pdu_data *pdu,
145 				   void *param);
146 
147 void helper_node_verify_cis_request(const char *file, uint32_t line, struct node_rx_pdu *rx,
148 				void *param);
149 void helper_node_verify_cis_established(const char *file, uint32_t line, struct node_rx_pdu *rx,
150 				void *param);
151 void helper_pdu_verify_cis_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
152 void helper_pdu_verify_cis_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
153 void helper_pdu_verify_cis_ind(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
154 void helper_pdu_verify_cis_terminate_ind(const char *file, uint32_t line, struct pdu_data *pdu,
155 				     void *param);
156 
157 void helper_pdu_verify_sca_req(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
158 void helper_pdu_verify_sca_rsp(const char *file, uint32_t line, struct pdu_data *pdu, void *param);
159 
160 void helper_pdu_verify_periodic_sync_ind(const char *file, uint32_t line, struct pdu_data *pdu,
161 					 void *param);
162 
163 void helper_node_verify_peer_sca_update(const char *file, uint32_t line, struct node_rx_pdu *rx,
164 				   void *param);
165 
166 enum helper_pdu_opcode {
167 	LL_VERSION_IND,
168 	LL_LE_PING_REQ,
169 	LL_LE_PING_RSP,
170 	LL_FEATURE_REQ,
171 	LL_PERIPH_FEAT_XCHG,
172 	LL_FEATURE_RSP,
173 	LL_MIN_USED_CHANS_IND,
174 	LL_REJECT_IND,
175 	LL_REJECT_EXT_IND,
176 	LL_ENC_REQ,
177 	LL_ENC_RSP,
178 	LL_START_ENC_REQ,
179 	LL_START_ENC_RSP,
180 	LL_PAUSE_ENC_REQ,
181 	LL_PAUSE_ENC_RSP,
182 	LL_PHY_REQ,
183 	LL_PHY_RSP,
184 	LL_PHY_UPDATE_IND,
185 	LL_UNKNOWN_RSP,
186 	LL_CONNECTION_UPDATE_IND,
187 	LL_CONNECTION_PARAM_REQ,
188 	LL_CONNECTION_PARAM_RSP,
189 	LL_TERMINATE_IND,
190 	LL_CHAN_MAP_UPDATE_IND,
191 	LL_LENGTH_REQ,
192 	LL_LENGTH_RSP,
193 	LL_CTE_REQ,
194 	LL_CTE_RSP,
195 	LL_CLOCK_ACCURACY_REQ,
196 	LL_CLOCK_ACCURACY_RSP,
197 	LL_CIS_REQ,
198 	LL_CIS_RSP,
199 	LL_CIS_IND,
200 	LL_CIS_TERMINATE_IND,
201 	LL_PERIODIC_SYNC_IND,
202 	LL_ZERO,
203 };
204 
205 enum helper_node_opcode {
206 	NODE_PHY_UPDATE,
207 	NODE_CONN_UPDATE,
208 	NODE_ENC_REFRESH,
209 	NODE_CTE_RSP,
210 	NODE_CIS_REQUEST,
211 	NODE_CIS_ESTABLISHED,
212 	NODE_PEER_SCA_UPDATE,
213 };
214 
215 typedef void(helper_pdu_encode_func_t)(struct pdu_data *data, void *param);
216 typedef void(helper_pdu_verify_func_t)(const char *file, uint32_t line, struct pdu_data *data,
217 				       void *param);
218 typedef void(helper_pdu_ntf_verify_func_t)(const char *file, uint32_t line, struct pdu_data *data,
219 					   void *param);
220 typedef void(helper_node_encode_func_t)(struct node_rx_pdu *rx, void *param);
221 typedef void(helper_node_verify_func_t)(const char *file, uint32_t line, struct node_rx_pdu *rx,
222 					void *param);
223