dcerpc-netlogon: maintain netlogon_auth_vars for NetrServerAuthenticateKerberos
[wireshark-sm.git] / epan / dissectors / packet-uci.c
blob2152e807165fc8a3795f8b51891364b4025c1fed
1 /*
2 * Author: Henri Chataing <henrichataing@google.com>
3 * Copyright 2022 Google LLC
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * SPDX-License-Identifier: GPL-2.0-or-later
16 * Specification: Fira Consortium UWB Command Interface Generic Technical
17 * Specification v1.1.0
20 #include <config.h>
22 #include <epan/packet.h>
23 #include <epan/proto.h>
24 #include <epan/conversation.h>
25 #include <epan/proto_data.h>
26 #include "packet-tcp.h"
27 #include <wiretap/wtap.h>
29 void proto_reg_handoff_uci(void);
30 void proto_register_uci(void);
32 #define UCI_PACKET_HEADER_LEN 4
34 #define UCI_MT_COMMAND 0x01
35 #define UCI_MT_RESPONSE 0x02
36 #define UCI_MT_NOTIFICATION 0x03
38 #define UCI_GID_CORE 0x00
39 #define UCI_GID_SESSION_CONFIG 0x01
40 #define UCI_GID_RANGING_SESSION_CONTROL 0x02
41 #define UCI_GID_DATA_CONTROL 0x03
42 #define UCI_GID_TEST 0x0d
43 #define UCI_GID_VENDOR_PICA 0x09
44 #define UCI_GID_VENDOR_RESERVED_A 0x0a
45 #define UCI_GID_VENDOR_RESERVED_B 0x0b
46 #define UCI_GID_VENDOR_RESERVED_C 0x0c
47 #define UCI_GID_VENDOR_ANDROID 0x0e
48 #define UCI_GID_VENDOR_RESERVED_F 0x0f
50 #define UCI_OID_CORE_DEVICE_RESET 0x00
51 #define UCI_OID_CORE_DEVICE_STATUS_NTF 0x01
52 #define UCI_OID_CORE_GET_DEVICE_INFO 0x02
53 #define UCI_OID_CORE_GET_CAPS_INFO 0x03
54 #define UCI_OID_CORE_SET_CONFIG 0x04
55 #define UCI_OID_CORE_GET_CONFIG 0x05
56 #define UCI_OID_CORE_GENERIC_ERROR_NTF 0x07
57 #define UCI_OID_SESSION_INIT 0x00
58 #define UCI_OID_SESSION_DEINIT 0x01
59 #define UCI_OID_SESSION_STATUS_NTF 0x02
60 #define UCI_OID_SESSION_SET_APP_CONFIG 0x03
61 #define UCI_OID_SESSION_GET_APP_CONFIG 0x04
62 #define UCI_OID_SESSION_GET_COUNT 0x05
63 #define UCI_OID_SESSION_GET_STATE 0x06
64 #define UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST 0x07
65 #define UCI_OID_RANGE_START 0x00
66 #define UCI_OID_RANGE_DATA 0x00
67 #define UCI_OID_RANGE_STOP 0x01
68 #define UCI_OID_RANGE_GET_RANGING_COUNT 0x03
70 #define UCI_STATUS_OK 0x00
71 #define UCI_STATUS_REJECTED 0x01
72 #define UCI_STATUS_FAILED 0x02
73 #define UCI_STATUS_SYNTAX_ERROR 0x03
74 #define UCI_STATUS_INVALID_PARAM 0x04
75 #define UCI_STATUS_INVALID_RANGE 0x05
76 #define UCI_STATUS_INVALID_MSG_SIZE 0x06
77 #define UCI_STATUS_UNKNOWN_GID 0x07
78 #define UCI_STATUS_UNKNOWN_OID 0x08
79 #define UCI_STATUS_READ_ONLY 0x09
80 #define UCI_STATUS_COMMAND_RETRY 0x0A
81 #define UCI_STATUS_SESSSION_NOT_EXIST 0x11
82 #define UCI_STATUS_SESSSION_DUPLICATE 0x12
83 #define UCI_STATUS_SESSSION_ACTIVE 0x13
84 #define UCI_STATUS_MAX_SESSSIONS_EXCEEDED 0x14
85 #define UCI_STATUS_SESSION_NOT_CONFIGURED 0x15
86 #define UCI_STATUS_ERROR_ACTIVE_SESSIONS_ONGOING 0x16
87 #define UCI_STATUS_ERROR_MULTICAST_LIST_FULL 0x17
88 #define UCI_STATUS_ERROR_ADDRESS_NOT_FOUND 0x18
89 #define UCI_STATUS_ERROR_ADDRESS_ALREADY_PRESENT 0x19
90 #define UCI_STATUS_RANGING_TX_FAILED 0x20
91 #define UCI_STATUS_RANGING_RX_TIMEOUT 0x21
92 #define UCI_STATUS_RANGING_RX_PHY_DEC_FAILED 0x22
93 #define UCI_STATUS_RANGING_RX_PHY_TOA_FAILED 0x23
94 #define UCI_STATUS_RANGING_RX_PHY_STS_FAILED 0x24
95 #define UCI_STATUS_RANGING_RX_MAC_DEC_FAILED 0x25
96 #define UCI_STATUS_RANGING_RX_MAC_IE_DEC_FAILED 0x26
97 #define UCI_STATUS_RANGING_RX_MAC_IE_MISSING 0x27
99 #define UCI_CAP_SUPPORTED_FIRA_PHY_VERSION_RANGE 0x0
100 #define UCI_CAP_SUPPORTED_FIRA_MAC_VERSION_RANGE 0x1
101 #define UCI_CAP_SUPPORTED_DEVICE_ROLES 0x2
102 #define UCI_CAP_SUPPORTED_RANGING_METHOD 0x3
103 #define UCI_CAP_SUPPORTED_STS_CONFIG 0x4
104 #define UCI_CAP_SUPPORTED_MULTI_NODE_MODES 0x5
105 #define UCI_CAP_SUPPORTED_RANGING_TIME_STRUCT 0x6
106 #define UCI_CAP_SUPPORTED_SCHEDULED_MODE 0x7
107 #define UCI_CAP_SUPPORTED_HOPPING_MODE 0x8
108 #define UCI_CAP_SUPPORTED_BLOCK_STRIDING 0x9
109 #define UCI_CAP_SUPPORTED_UWB_INITIATION_TIME 0x0A
110 #define UCI_CAP_SUPPORTED_CHANNELS 0x0B
111 #define UCI_CAP_SUPPORTED_RFRAME_CONFIG 0x0C
112 #define UCI_CAP_SUPPORTED_CC_CONSTRAINT_LENGTH 0x0D
113 #define UCI_CAP_SUPPORTED_BPRF_PARAMETER_SETS 0x0E
114 #define UCI_CAP_SUPPORTED_HPRF_PARAMETER_SETS 0x0F
115 #define UCI_CAP_SUPPORTED_AOA 0x10
116 #define UCI_CAP_SUPPORTED_EXTENDED_MAC_ADDRESS 0x11
117 #define UCI_CAP_SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING 0xE3
118 #define UCI_CAP_CCC_SUPPORTED_CHAPS_PER_SLOT 0xA0
119 #define UCI_CAP_CCC_SUPPORTED_SYNC_CODES 0xA1
120 #define UCI_CAP_CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES 0xA2
121 #define UCI_CAP_CCC_SUPPORTED_CHANNELS 0xA3
122 #define UCI_CAP_CCC_SUPPORTED_VERSIONS 0xA4
123 #define UCI_CAP_CCC_SUPPORTED_UWB_CONFIGS 0xA5
124 #define UCI_CAP_CCC_SUPPORTED_PULSE_SHAPE_COMBOS 0xA6
125 #define UCI_CAP_CCC_SUPPORTED_RAN_MULTIPLIER 0xA7
127 #define UCI_APP_CONFIG_DEVICE_TYPE 0x00
128 #define UCI_APP_CONFIG_RANGING_ROUND_USAGE 0x01
129 #define UCI_APP_CONFIG_STS_CONFIG 0x02
130 #define UCI_APP_CONFIG_MULTI_NODE_MODE 0x03
131 #define UCI_APP_CONFIG_CHANNEL_NUMBER 0x04
132 #define UCI_APP_CONFIG_NO_OF_CONTROLEE 0x05
133 #define UCI_APP_CONFIG_DEVICE_MAC_ADDRESS 0x06
134 #define UCI_APP_CONFIG_DST_MAC_ADDRESS 0x07
135 #define UCI_APP_CONFIG_SLOT_DURATION 0x08
136 #define UCI_APP_CONFIG_RANGING_INTERVAL 0x09
137 #define UCI_APP_CONFIG_STS_INDEX 0x0A
138 #define UCI_APP_CONFIG_MAC_FCS_TYPE 0x0B
139 #define UCI_APP_CONFIG_RANGING_ROUND_CONTROL 0x0C
140 #define UCI_APP_CONFIG_AOA_RESULT_REQ 0x0D
141 #define UCI_APP_CONFIG_RNG_DATA_NTF 0x0E
142 #define UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_NEAR 0x0F
143 #define UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_FAR 0x10
144 #define UCI_APP_CONFIG_DEVICE_ROLE 0x11
145 #define UCI_APP_CONFIG_RFRAME_CONFIG 0x12
146 #define UCI_APP_CONFIG_PREAMBLE_CODE_INDEX 0x14
147 #define UCI_APP_CONFIG_SFD_ID 0x15
148 #define UCI_APP_CONFIG_PSDU_DATA_RATE 0x16
149 #define UCI_APP_CONFIG_PREAMBLE_DURATION 0x17
150 #define UCI_APP_CONFIG_RANGING_TIME_STRUCT 0x1A
151 #define UCI_APP_CONFIG_SLOTS_PER_RR 0x1B
152 #define UCI_APP_CONFIG_TX_ADAPTIVE_PAYLOAD_POWER 0x1C
153 #define UCI_APP_CONFIG_RESPONDER_SLOT_INDEX 0x1E
154 #define UCI_APP_CONFIG_PRF_MODE 0x1F
155 #define UCI_APP_CONFIG_SCHEDULED_MODE 0x22
156 #define UCI_APP_CONFIG_KEY_ROTATION 0x23
157 #define UCI_APP_CONFIG_KEY_ROTATION_RATE 0x24
158 #define UCI_APP_CONFIG_SESSION_PRIORITY 0x25
159 #define UCI_APP_CONFIG_MAC_ADDRESS_MODE 0x26
160 #define UCI_APP_CONFIG_VENDOR_ID 0x27
161 #define UCI_APP_CONFIG_STATIC_STS_IV 0x28
162 #define UCI_APP_CONFIG_NUMBER_OF_STS_SEGMENTS 0x29
163 #define UCI_APP_CONFIG_MAX_RR_RETRY 0x2A
164 #define UCI_APP_CONFIG_UWB_INITIATION_TIME 0x2B
165 #define UCI_APP_CONFIG_HOPPING_MODE 0x2C
166 #define UCI_APP_CONFIG_BLOCK_STRIDE_LENGTH 0x2D
167 #define UCI_APP_CONFIG_RESULT_REPORT_CONFIG 0x2E
168 #define UCI_APP_CONFIG_IN_BAND_TERMINATION_ATTEMPT_COUNT 0x2F
169 #define UCI_APP_CONFIG_SUB_SESSION_ID 0x30
170 #define UCI_APP_CONFIG_BPRF_PHR_DATA_RATE 0x31
171 #define UCI_APP_CONFIG_MAX_NUMBER_OF_MEASUREMENTS 0x32
172 #define UCI_APP_CONFIG_STS_LENGTH 0x35
173 #define UCI_APP_CONFIG_CCC_HOP_MODE_KEY 0xA0
174 #define UCI_APP_CONFIG_CCC_UWB_TIME0 0xA1
175 #define UCI_APP_CONFIG_CCC_RANGING_PROTOCOL_VER 0xA3
176 #define UCI_APP_CONFIG_CCC_UWB_CONFIG_ID 0xA4
177 #define UCI_APP_CONFIG_CCC_PULSESHAPE_COMBO 0xA5
178 #define UCI_APP_CONFIG_CCC_URSK_TTL 0xA6
179 #define UCI_APP_CONFIG_NB_OF_RANGE_MEASUREMENTS 0xE3
180 #define UCI_APP_CONFIG_NB_OF_AZIMUTH_MEASUREMENTS 0xE4
181 #define UCI_APP_CONFIG_NB_OF_ELEVATION_MEASUREMENTS 0xE5
183 static bool gPREF_TCP_DESEGMENT = true;
184 static unsigned gPREF_TCP_PORT = 7000;
186 static int proto_uci;
187 static dissector_handle_t handle_uci;
189 static int hf_uci_message_type;
190 static int hf_uci_packet_boundary_flag;
191 static int hf_uci_group_id;
192 static int hf_uci_opcode_id;
193 static int hf_uci_payload_length;
194 static int hf_uci_status;
195 static int hf_uci_reset_config;
196 static int hf_uci_device_state;
197 static int hf_uci_generic_version;
198 static int hf_uci_version_major;
199 static int hf_uci_version_minor;
200 static int hf_uci_maintenance_number;
201 static int hf_uci_mac_version;
202 static int hf_uci_phy_version;
203 static int hf_uci_test_version;
204 static int hf_uci_vendor_specific_information_length;
205 static int hf_uci_vendor_specific_information;
206 static int hf_uci_capability_parameters_count;
207 static int hf_uci_capability_parameter_type;
208 static int hf_uci_capability_parameter_len;
209 static int hf_uci_capability_parameter_value;
210 static int hf_uci_parameters_count;
211 static int hf_uci_parameter_type;
212 static int hf_uci_parameter_len;
213 static int hf_uci_parameter_value;
214 static int hf_uci_parameter_status;
215 static int hf_uci_session_id;
216 static int hf_uci_session_type;
217 static int hf_uci_session_state;
218 static int hf_uci_session_count;
219 static int hf_uci_app_config_parameters_count;
220 static int hf_uci_app_config_parameter_type;
221 static int hf_uci_app_config_parameter_len;
222 static int hf_uci_app_config_parameter_value;
223 static int hf_uci_app_config_parameter_status;
224 static int hf_uci_update_controller_multicast_list_action;
225 static int hf_uci_controlees_count;
226 static int hf_uci_controlee_short_address;
227 static int hf_uci_controlee_subsession_id;
228 static int hf_uci_controlee_status;
229 static int hf_uci_remaining_multicast_list_size;
230 static int hf_uci_ranging_count;
231 static int hf_uci_sequence_number;
232 static int hf_uci_current_ranging_interval;
233 static int hf_uci_ranging_measurement_type;
234 static int hf_uci_mac_addressing_mode_indicator;
235 static int hf_uci_ranging_measurement_count;
236 static int hf_uci_mac_address;
237 static int hf_uci_nlos;
238 static int hf_uci_distance;
239 static int hf_uci_aoa_azimuth;
240 static int hf_uci_aoa_azimuth_fom;
241 static int hf_uci_aoa_elevation;
242 static int hf_uci_aoa_elevation_fom;
243 static int hf_uci_aoa_destination_azimuth;
244 static int hf_uci_aoa_destination_azimuth_fom;
245 static int hf_uci_aoa_destination_elevation;
246 static int hf_uci_aoa_destination_elevation_fom;
247 static int hf_uci_slot_index;
249 static int ett_uci;
250 static int ett_uci_header;
251 static int ett_uci_payload;
252 static int ett_uci_capability_parameters;
253 static int ett_uci_capability_parameter;
254 static int ett_uci_parameters;
255 static int ett_uci_parameter;
256 static int ett_uci_app_config_parameters;
257 static int ett_uci_app_config_parameter;
258 static int ett_uci_controlee_list;
259 static int ett_uci_controlee;
260 static int ett_uci_ranging_measurements;
261 static int ett_uci_ranging_measurement;
263 static const value_string message_type_vals[] = {
264 { UCI_MT_COMMAND, "Command" },
265 { UCI_MT_RESPONSE, "Response" },
266 { UCI_MT_NOTIFICATION, "Notification" },
267 { 0, NULL },
270 static const value_string packet_boundary_flag_vals[] = {
271 { 0, "The packet contains a complete message, or the Packet contains the "
272 "last segment of the segmented message" },
273 { 1, "The Packet contains a segment of a Message that is not the last segment" },
274 { 0, NULL },
277 static const value_string group_id_vals[] = {
278 { UCI_GID_CORE, "Core" },
279 { UCI_GID_SESSION_CONFIG, "Session Config" },
280 { UCI_GID_RANGING_SESSION_CONTROL, "Ranging Session Control" },
281 { UCI_GID_DATA_CONTROL, "Data Control" },
282 { UCI_GID_VENDOR_PICA, "Vendor Pica" },
283 { UCI_GID_VENDOR_RESERVED_A, "Vendor Reserved A" },
284 { UCI_GID_VENDOR_RESERVED_B, "Vendor Reserved B" },
285 { UCI_GID_VENDOR_RESERVED_C, "Vendor Reserved C" },
286 { UCI_GID_TEST, "Test" },
287 { UCI_GID_VENDOR_ANDROID, "Vendor Android" },
288 { UCI_GID_VENDOR_RESERVED_F, "Vendor Reserved F" },
289 { 0, NULL },
292 static const value_string status_vals[] = {
293 { UCI_STATUS_OK, "OK Success" },
294 { UCI_STATUS_REJECTED, "Intended operation is not supported in the current state" },
295 { UCI_STATUS_FAILED, "Intended operation failed to complete" },
296 { UCI_STATUS_SYNTAX_ERROR, "UCI packet structure is not per spec" },
297 { UCI_STATUS_INVALID_PARAM, "Config ID is not correct, and it is not present in UWBS" },
298 { UCI_STATUS_INVALID_RANGE, "Config ID is correct, and value is not in proper range" },
299 { UCI_STATUS_INVALID_MSG_SIZE, "UCI packet payload size is not as per spec" },
300 { UCI_STATUS_UNKNOWN_GID, "UCI Group ID is not per spec" },
301 { UCI_STATUS_UNKNOWN_OID, "UCI Opcode ID is not per spec" },
302 { UCI_STATUS_READ_ONLY, "Config ID is read-only" },
303 { UCI_STATUS_COMMAND_RETRY, "UWBS request retransmission from Host" },
304 { UCI_STATUS_SESSSION_NOT_EXIST, "Session is not existing or not created" },
305 { UCI_STATUS_SESSSION_DUPLICATE, "Session is already created/exist" },
306 { UCI_STATUS_SESSSION_ACTIVE, "Session is active" },
307 { UCI_STATUS_MAX_SESSSIONS_EXCEEDED, "Max. number of sessions already created" },
308 { UCI_STATUS_SESSION_NOT_CONFIGURED, "Session is not configured with required app configurations" },
309 { UCI_STATUS_ERROR_ACTIVE_SESSIONS_ONGOING, "Sessions are actively running in UWBS" },
310 { UCI_STATUS_ERROR_MULTICAST_LIST_FULL, "Indicates when multicast list is full during one to many ranging" },
311 { UCI_STATUS_ERROR_ADDRESS_NOT_FOUND, "Indicates when short address is not available multicast list" },
312 { UCI_STATUS_ERROR_ADDRESS_ALREADY_PRESENT, "Indicates when short address is already present" },
313 { UCI_STATUS_RANGING_TX_FAILED, "Failed to transmit UWB packet" },
314 { UCI_STATUS_RANGING_RX_TIMEOUT, "No UWB packet detected by the receiver" },
315 { UCI_STATUS_RANGING_RX_PHY_DEC_FAILED, "UWB packet channel decoding error" },
316 { UCI_STATUS_RANGING_RX_PHY_TOA_FAILED, "Failed to detect time of arrival of the UWB packet from CIR samples" },
317 { UCI_STATUS_RANGING_RX_PHY_STS_FAILED, "UWB packet STS segment mismatch" },
318 { UCI_STATUS_RANGING_RX_MAC_DEC_FAILED, "MAC CRC or syntax error" },
319 { UCI_STATUS_RANGING_RX_MAC_IE_DEC_FAILED, "IE syntax error" },
320 { UCI_STATUS_RANGING_RX_MAC_IE_MISSING, "Expected IE missing in the packet" },
321 { 0, NULL },
324 static const value_string reset_config_vals[] = {
325 { 0, "UWBS reset" },
326 { 0, NULL },
329 static const value_string device_state_vals[] = {
330 { 1, "UWBS is initialized and ready for UWB session" },
331 { 2, "UWBS is busy with UWB session" },
332 { 0xff, "Error occurred within the UWBS" },
333 { 0, NULL },
336 static const value_string capability_parameter_type_vals[] = {
337 { UCI_CAP_SUPPORTED_FIRA_PHY_VERSION_RANGE, "Supported Fira PHY version range" },
338 { UCI_CAP_SUPPORTED_FIRA_MAC_VERSION_RANGE, "Supported Fira MAC version range" },
339 { UCI_CAP_SUPPORTED_DEVICE_ROLES, "Supported device roles" },
340 { UCI_CAP_SUPPORTED_RANGING_METHOD, "Supported ranging method" },
341 { UCI_CAP_SUPPORTED_STS_CONFIG, "Supported STS config" },
342 { UCI_CAP_SUPPORTED_MULTI_NODE_MODES, "Supported multi node modes" },
343 { UCI_CAP_SUPPORTED_RANGING_TIME_STRUCT, "Supported ranging time struct" },
344 { UCI_CAP_SUPPORTED_SCHEDULED_MODE, "Supported scheduled mode" },
345 { UCI_CAP_SUPPORTED_HOPPING_MODE, "Supported hopping mode" },
346 { UCI_CAP_SUPPORTED_BLOCK_STRIDING, "Supported block striding" },
347 { UCI_CAP_SUPPORTED_UWB_INITIATION_TIME, "Supported UWB initiation time" },
348 { UCI_CAP_SUPPORTED_CHANNELS, "Supported channels" },
349 { UCI_CAP_SUPPORTED_RFRAME_CONFIG, "Supported rframe config" },
350 { UCI_CAP_SUPPORTED_CC_CONSTRAINT_LENGTH, "Supported CC constraint length" },
351 { UCI_CAP_SUPPORTED_BPRF_PARAMETER_SETS, "Supported BPRF parameter sets" },
352 { UCI_CAP_SUPPORTED_HPRF_PARAMETER_SETS, "Supported HPRF parameter sets" },
353 { UCI_CAP_SUPPORTED_AOA, "Supported AOA" },
354 { UCI_CAP_SUPPORTED_EXTENDED_MAC_ADDRESS, "Supported extended MAC address" },
355 { UCI_CAP_SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING, "Supported AOA result req antenna interleaving" },
356 { UCI_CAP_CCC_SUPPORTED_CHAPS_PER_SLOT, "Supported CCC chaps per slot" },
357 { UCI_CAP_CCC_SUPPORTED_SYNC_CODES, "Supported CCC sync codes" },
358 { UCI_CAP_CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES, "Supported CCC hopping config modes and sequences" },
359 { UCI_CAP_CCC_SUPPORTED_CHANNELS, "Supported CCC channels" },
360 { UCI_CAP_CCC_SUPPORTED_VERSIONS, "Supported CCC versions" },
361 { UCI_CAP_CCC_SUPPORTED_UWB_CONFIGS, "Supported CCC UWB configs" },
362 { UCI_CAP_CCC_SUPPORTED_PULSE_SHAPE_COMBOS, "Supported CCC pulse shape combos" },
363 { UCI_CAP_CCC_SUPPORTED_RAN_MULTIPLIER, "Supported CCC ran multiplier" },
364 { 0, NULL },
367 static const value_string parameter_type_vals[] = {
368 { 0, "Device State" },
369 { 1, "Low Power Mode" },
370 { 0, NULL },
373 static const value_string session_type_vals[] = {
374 { 0x00, "Fira Ranging Session" },
375 { 0xD0, "Device Test Mode" },
376 { 0, NULL },
379 static const value_string session_state_vals[] = {
380 { 0, "Session State Init" },
381 { 1, "Session State Deinit" },
382 { 2, "Session State Active" },
383 { 3, "Session State Idle" },
384 { 0, NULL },
387 static const value_string app_config_parameter_type_vals[] = {
388 { UCI_APP_CONFIG_DEVICE_TYPE, "Device type" },
389 { UCI_APP_CONFIG_RANGING_ROUND_USAGE, "Ranging round usage" },
390 { UCI_APP_CONFIG_STS_CONFIG, "STS config" },
391 { UCI_APP_CONFIG_MULTI_NODE_MODE, "Multi-node mode" },
392 { UCI_APP_CONFIG_CHANNEL_NUMBER, "Channel number" },
393 { UCI_APP_CONFIG_NO_OF_CONTROLEE, "No of controlee" },
394 { UCI_APP_CONFIG_DEVICE_MAC_ADDRESS, "Device mac address" },
395 { UCI_APP_CONFIG_DST_MAC_ADDRESS, "Dst mac address" },
396 { UCI_APP_CONFIG_SLOT_DURATION, "Slot duration" },
397 { UCI_APP_CONFIG_RANGING_INTERVAL, "Ranging interval" },
398 { UCI_APP_CONFIG_STS_INDEX, "STS index" },
399 { UCI_APP_CONFIG_MAC_FCS_TYPE, "Mac FCS type" },
400 { UCI_APP_CONFIG_RANGING_ROUND_CONTROL, "Ranging round control" },
401 { UCI_APP_CONFIG_AOA_RESULT_REQ, "AOA result req" },
402 { UCI_APP_CONFIG_RNG_DATA_NTF, "Rng data ntf" },
403 { UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_NEAR, "Rng data ntf proximity near" },
404 { UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_FAR, "Rng data ntf proximity far" },
405 { UCI_APP_CONFIG_DEVICE_ROLE, "Device role" },
406 { UCI_APP_CONFIG_RFRAME_CONFIG, "Rframe config" },
407 { UCI_APP_CONFIG_PREAMBLE_CODE_INDEX, "Preamble code index" },
408 { UCI_APP_CONFIG_SFD_ID, "SFD ID" },
409 { UCI_APP_CONFIG_PSDU_DATA_RATE, "PSDU data rate" },
410 { UCI_APP_CONFIG_PREAMBLE_DURATION, "Preamble duration" },
411 { UCI_APP_CONFIG_RANGING_TIME_STRUCT, "Ranging time struct" },
412 { UCI_APP_CONFIG_SLOTS_PER_RR, "Slots per ranging round" },
413 { UCI_APP_CONFIG_TX_ADAPTIVE_PAYLOAD_POWER, "Tx adaptive payload power" },
414 { UCI_APP_CONFIG_RESPONDER_SLOT_INDEX, "Responder slot index" },
415 { UCI_APP_CONFIG_PRF_MODE, "PRF mode" },
416 { UCI_APP_CONFIG_SCHEDULED_MODE, "Scheduled mode" },
417 { UCI_APP_CONFIG_KEY_ROTATION, "Key rotation" },
418 { UCI_APP_CONFIG_KEY_ROTATION_RATE, "Key rotation rate" },
419 { UCI_APP_CONFIG_SESSION_PRIORITY, "Session priority" },
420 { UCI_APP_CONFIG_MAC_ADDRESS_MODE, "Mac address mode" },
421 { UCI_APP_CONFIG_VENDOR_ID, "Vendor ID" },
422 { UCI_APP_CONFIG_STATIC_STS_IV, "Static STS IV" },
423 { UCI_APP_CONFIG_NUMBER_OF_STS_SEGMENTS, "Number of STS segments" },
424 { UCI_APP_CONFIG_MAX_RR_RETRY, "Max ranging round retry" },
425 { UCI_APP_CONFIG_UWB_INITIATION_TIME, "UWB initiation time" },
426 { UCI_APP_CONFIG_HOPPING_MODE, "Hopping mode" },
427 { UCI_APP_CONFIG_BLOCK_STRIDE_LENGTH, "Block stride length" },
428 { UCI_APP_CONFIG_RESULT_REPORT_CONFIG, "Result report config" },
429 { UCI_APP_CONFIG_IN_BAND_TERMINATION_ATTEMPT_COUNT, "In band termination attempt count" },
430 { UCI_APP_CONFIG_SUB_SESSION_ID, "Sub session ID" },
431 { UCI_APP_CONFIG_BPRF_PHR_DATA_RATE, "BPRF PHR data rate" },
432 { UCI_APP_CONFIG_MAX_NUMBER_OF_MEASUREMENTS, "Max number of measurements" },
433 { UCI_APP_CONFIG_STS_LENGTH, "STS length" },
434 { UCI_APP_CONFIG_CCC_HOP_MODE_KEY, "CCC hop mode key" },
435 { UCI_APP_CONFIG_CCC_UWB_TIME0, "CCC UWB time0" },
436 { UCI_APP_CONFIG_CCC_RANGING_PROTOCOL_VER, "CCC ranging protocol ver" },
437 { UCI_APP_CONFIG_CCC_UWB_CONFIG_ID, "CCC UWB config ID" },
438 { UCI_APP_CONFIG_CCC_PULSESHAPE_COMBO, "CCC pulseshape combo" },
439 { UCI_APP_CONFIG_CCC_URSK_TTL, "CCC URSK TTL" },
440 { UCI_APP_CONFIG_NB_OF_RANGE_MEASUREMENTS, "Nb of range measurements" },
441 { UCI_APP_CONFIG_NB_OF_AZIMUTH_MEASUREMENTS, "Nb of azimuth measurements" },
442 { UCI_APP_CONFIG_NB_OF_ELEVATION_MEASUREMENTS, "Nb of elevation measurements" },
443 { 0, NULL },
446 static const value_string update_controller_multicast_list_action_vals[] = {
447 { 0, "Update the multicast list by adding requested controlee short address" },
448 { 1, "Delete the requested short address from multicast list" },
449 { 0, NULL },
452 static const value_string multicast_update_status_vals[] = {
453 { 0, "OK - Multicast list updated" },
454 { 1, "Multicast list full" },
455 { 2, "Key fecth fail" },
456 { 3, "Sub-session ID not found" },
457 { 0, NULL },
460 static const value_string ranging_measurement_type_vals[] = {
461 { 1, "Two Way Ranging Measurement (SS-TWR, DSTWR)" },
462 { 0, NULL },
465 static const value_string mac_addressing_mode_indicator_vals[] = {
466 { 0, "2 Octets short MAC address" },
467 { 1, "8 Octets extended MAC Address" },
468 { 0, NULL },
471 static const value_string nlos_vals[] = {
472 { 0, "Line of sight" },
473 { 1, "Non-line of sigt" },
474 { 0xff, "Unable to determine" },
475 { 0, NULL },
478 static unsigned get_uci_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
480 /* Return the payload length added to the packet header length. */
481 return tvb_get_uint8(tvb, offset + 3) + UCI_PACKET_HEADER_LEN;
484 static void dissect_core_device_reset_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
485 proto_tree *payload_tree)
487 col_set_str(pinfo->cinfo, COL_INFO, "Core Device Reset Cmd");
488 proto_tree_add_item(payload_tree, hf_uci_reset_config, tvb, offset, 1, ENC_NA);
491 static void dissect_core_device_reset_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
492 proto_tree *payload_tree)
494 col_set_str(pinfo->cinfo, COL_INFO, "Core Device Reset Rsp");
495 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
498 static void dissect_core_device_status_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
499 proto_tree *payload_tree)
501 col_set_str(pinfo->cinfo, COL_INFO, "Core Device Status Ntf");
502 proto_tree_add_item(payload_tree, hf_uci_device_state, tvb, offset, 1, ENC_NA);
505 static void dissect_core_get_device_info_cmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
506 proto_tree *payload_tree _U_)
508 col_set_str(pinfo->cinfo, COL_INFO, "Core Get Device Info Cmd");
511 static void dissect_core_get_device_info_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
512 proto_tree *payload_tree)
514 static int * const version_fields[] = {
515 &hf_uci_version_major,
516 &hf_uci_version_minor,
517 &hf_uci_maintenance_number,
518 NULL
521 col_set_str(pinfo->cinfo, COL_INFO, "Core Get Device Info Rsp");
522 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
523 offset += 1;
524 proto_tree_add_bitmask(payload_tree, tvb, offset,
525 hf_uci_generic_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
526 offset += 2;
527 proto_tree_add_bitmask(payload_tree, tvb, offset,
528 hf_uci_mac_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
529 offset += 2;
530 proto_tree_add_bitmask(payload_tree, tvb, offset,
531 hf_uci_phy_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
532 offset += 2;
533 proto_tree_add_bitmask(payload_tree, tvb, offset,
534 hf_uci_test_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
535 offset += 2;
537 int vendor_specific_information_len = tvb_get_uint8(tvb, offset);
538 proto_tree_add_item(payload_tree, hf_uci_vendor_specific_information_length,
539 tvb, offset, 1, ENC_NA);
540 offset += 1;
542 proto_tree_add_item(payload_tree, hf_uci_vendor_specific_information,
543 tvb, offset, vendor_specific_information_len, ENC_NA);
546 static void dissect_core_get_caps_info_cmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
547 proto_tree *payload_tree _U_)
549 col_set_str(pinfo->cinfo, COL_INFO, "Core Get Caps Info Cmd");
552 static void dissect_core_get_caps_info_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
553 proto_tree *payload_tree)
555 col_set_str(pinfo->cinfo, COL_INFO, "Core Get Caps Info Rsp");
556 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
557 offset += 1;
559 int capability_parameters_count = tvb_get_uint8(tvb, offset);
560 proto_tree_add_item(payload_tree, hf_uci_capability_parameters_count,
561 tvb, offset, 1, ENC_NA);
562 offset += 1;
564 if (capability_parameters_count == 0) {
565 return;
568 proto_tree *capability_parameters_tree =
569 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
570 ett_uci_capability_parameters, NULL, "Capability Parameters");
572 for (int idx = 0; idx < capability_parameters_count; idx++) {
573 int parameter_type = tvb_get_uint8(tvb, offset + 0);
574 int parameter_len = tvb_get_uint8(tvb, offset + 1);
575 proto_tree *parameter_tree =
576 proto_tree_add_subtree(capability_parameters_tree, tvb, offset, 2 + parameter_len,
577 ett_uci_capability_parameter, NULL,
578 val_to_str(parameter_type, capability_parameter_type_vals, "Unknown (0x%02x)"));
580 proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_type, tvb, offset, 1, ENC_NA);
581 offset += 1;
582 proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_len, tvb, offset, 1, ENC_NA);
583 offset += 1;
584 proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_value, tvb, offset, parameter_len, ENC_NA);
585 offset += parameter_len;
589 static void dissect_core_get_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
590 proto_tree *payload_tree)
592 col_set_str(pinfo->cinfo, COL_INFO, "Core Get Config Cmd");
594 int parameters_count = tvb_get_uint8(tvb, offset);
595 proto_tree_add_item(payload_tree, hf_uci_parameters_count, tvb, offset, 1, ENC_NA);
596 offset += 1;
598 if (parameters_count == 0) {
599 return;
602 proto_tree *parameters_tree =
603 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
604 ett_uci_parameters, NULL, "Parameter IDs");
606 for (int idx = 0; idx < parameters_count; idx++) {
607 int parameter_id = tvb_get_uint8(tvb, offset);
609 proto_tree *parameter_tree =
610 proto_tree_add_subtree(parameters_tree, tvb, offset, 1,
611 ett_uci_parameter, NULL,
612 val_to_str(parameter_id, parameter_type_vals, "Unknown (0x%02x)"));
614 proto_tree_add_item(parameter_tree, hf_uci_parameter_type,
615 tvb, offset, 1, ENC_NA);
617 offset += 1;
621 static void dissect_parameters(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
622 proto_tree *payload_tree)
624 int parameters_count = tvb_get_uint8(tvb, offset);
625 proto_tree_add_item(payload_tree, hf_uci_parameters_count, tvb, offset, 1, ENC_NA);
626 offset += 1;
628 if (parameters_count == 0) {
629 return;
632 proto_tree *parameters_tree =
633 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
634 ett_uci_parameters, NULL, "Parameters");
636 for (int idx = 0; idx < parameters_count; idx++) {
637 int parameter_id = tvb_get_uint8(tvb, offset + 0);
638 int parameter_len = tvb_get_uint8(tvb, offset + 1);
639 proto_tree *parameter_tree =
640 proto_tree_add_subtree(parameters_tree, tvb, offset, 2 + parameter_len,
641 ett_uci_parameter, NULL,
642 val_to_str(parameter_id, parameter_type_vals, "Unknown (0x%02x)"));
644 proto_tree_add_item(parameter_tree, hf_uci_parameter_type, tvb, offset, 1, ENC_NA);
645 offset += 1;
646 proto_tree_add_item(parameter_tree, hf_uci_parameter_len, tvb, offset, 1, ENC_NA);
647 offset += 1;
648 proto_tree_add_item(parameter_tree, hf_uci_parameter_value, tvb, offset, parameter_len, ENC_NA);
649 offset += parameter_len;
653 static void dissect_core_get_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
654 proto_tree *payload_tree)
656 col_set_str(pinfo->cinfo, COL_INFO, "Core Get Config Rsp");
657 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
658 offset += 1;
660 dissect_parameters(tvb, offset, pinfo, payload_tree);
663 static void dissect_core_set_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
664 proto_tree *payload_tree)
666 col_set_str(pinfo->cinfo, COL_INFO, "Core Set Config Cmd");
667 dissect_parameters(tvb, offset, pinfo, payload_tree);
670 static void dissect_core_set_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
671 proto_tree *payload_tree)
673 col_set_str(pinfo->cinfo, COL_INFO, "Core Set Config Rsp");
674 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
675 offset += 1;
677 int parameters_count = tvb_get_uint8(tvb, offset);
678 proto_tree_add_item(payload_tree, hf_uci_parameters_count,
679 tvb, offset, 1, ENC_NA);
680 offset += 1;
682 if (parameters_count == 0) {
683 return;
686 proto_tree *parameters_tree =
687 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
688 ett_uci_parameters, NULL, "Parameters");
690 for (int idx = 0; idx < parameters_count; idx++) {
691 int parameter_type = tvb_get_uint8(tvb, offset + 0);
693 proto_tree *parameter_tree =
694 proto_tree_add_subtree(parameters_tree, tvb, offset, 2,
695 ett_uci_parameter, NULL,
696 val_to_str(parameter_type, parameter_type_vals, "Unknown (0x%02x)"));
698 proto_tree_add_item(parameter_tree, hf_uci_parameter_type, tvb, offset, 1, ENC_NA);
699 offset += 1;
700 proto_tree_add_item(parameter_tree, hf_uci_parameter_status, tvb, offset, 1, ENC_NA);
701 offset += 1;
705 static void dissect_core_generic_error_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
706 proto_tree *payload_tree)
708 col_set_str(pinfo->cinfo, COL_INFO, "Core Generic Error Ntf");
709 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
712 static void dissect_uci_core_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
713 proto_tree *payload_tree, int message_type, int opcode_id)
715 if (message_type == UCI_MT_COMMAND &&
716 opcode_id == UCI_OID_CORE_DEVICE_RESET) {
717 dissect_core_device_reset_cmd(tvb, offset, pinfo, payload_tree);
719 else if (message_type == UCI_MT_RESPONSE &&
720 opcode_id == UCI_OID_CORE_DEVICE_RESET) {
721 dissect_core_device_reset_rsp(tvb, offset, pinfo, payload_tree);
723 else if (message_type == UCI_MT_NOTIFICATION &&
724 opcode_id == UCI_OID_CORE_DEVICE_STATUS_NTF) {
725 dissect_core_device_status_ntf(tvb, offset, pinfo, payload_tree);
727 else if (message_type == UCI_MT_COMMAND &&
728 opcode_id == UCI_OID_CORE_GET_DEVICE_INFO) {
729 dissect_core_get_device_info_cmd(tvb, offset, pinfo, payload_tree);
731 else if (message_type == UCI_MT_RESPONSE &&
732 opcode_id == UCI_OID_CORE_GET_DEVICE_INFO) {
733 dissect_core_get_device_info_rsp(tvb, offset, pinfo, payload_tree);
735 else if (message_type == UCI_MT_COMMAND &&
736 opcode_id == UCI_OID_CORE_GET_CAPS_INFO) {
737 dissect_core_get_caps_info_cmd(tvb, offset, pinfo, payload_tree);
739 else if (message_type == UCI_MT_RESPONSE &&
740 opcode_id == UCI_OID_CORE_GET_CAPS_INFO) {
741 dissect_core_get_caps_info_rsp(tvb, offset, pinfo, payload_tree);
743 else if (message_type == UCI_MT_COMMAND &&
744 opcode_id == UCI_OID_CORE_GET_CONFIG) {
745 dissect_core_get_config_cmd(tvb, offset, pinfo, payload_tree);
747 else if (message_type == UCI_MT_RESPONSE &&
748 opcode_id == UCI_OID_CORE_GET_CONFIG) {
749 dissect_core_get_config_rsp(tvb, offset, pinfo, payload_tree);
751 else if (message_type == UCI_MT_COMMAND &&
752 opcode_id == UCI_OID_CORE_SET_CONFIG) {
753 dissect_core_set_config_cmd(tvb, offset, pinfo, payload_tree);
755 else if (message_type == UCI_MT_RESPONSE &&
756 opcode_id == UCI_OID_CORE_SET_CONFIG) {
757 dissect_core_set_config_rsp(tvb, offset, pinfo, payload_tree);
759 else if (message_type == UCI_MT_NOTIFICATION &&
760 opcode_id == UCI_OID_CORE_GENERIC_ERROR_NTF) {
761 dissect_core_generic_error_ntf(tvb, offset, pinfo, payload_tree);
763 else if (message_type == UCI_MT_COMMAND) {
764 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Cmd (%02x)", opcode_id);
766 else if (message_type == UCI_MT_RESPONSE) {
767 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Rsp (%02x)", opcode_id);
769 else {
770 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Ntf (%02x)", opcode_id);
774 static void dissect_session_init_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
775 proto_tree *payload_tree)
777 col_set_str(pinfo->cinfo, COL_INFO, "Session Init Cmd");
778 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
779 offset += 4;
780 proto_tree_add_item(payload_tree, hf_uci_session_type, tvb, offset, 1, ENC_NA);
783 static void dissect_session_init_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
784 proto_tree *payload_tree)
786 col_set_str(pinfo->cinfo, COL_INFO, "Session Init Rsp");
787 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
790 static void dissect_session_deinit_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
791 proto_tree *payload_tree)
793 col_set_str(pinfo->cinfo, COL_INFO, "Session Deinit Cmd");
794 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
797 static void dissect_session_deinit_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
798 proto_tree *payload_tree)
800 col_set_str(pinfo->cinfo, COL_INFO, "Session Deinit Rsp");
801 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
804 static void dissect_session_status_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
805 proto_tree *payload_tree)
807 col_set_str(pinfo->cinfo, COL_INFO, "Session Status Ntf");
808 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
809 offset += 4;
810 proto_tree_add_item(payload_tree, hf_uci_session_state, tvb, offset, 1, ENC_NA);
813 static void dissect_app_config_parameters(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
814 proto_tree *payload_tree)
816 int app_config_parameters_count = tvb_get_uint8(tvb, offset);
817 proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count,
818 tvb, offset, 1, ENC_NA);
819 offset += 1;
821 if (app_config_parameters_count == 0) {
822 return;
825 proto_tree *app_config_parameters_tree =
826 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
827 ett_uci_app_config_parameters, NULL, "App Configurations");
829 for (int idx = 0; idx < app_config_parameters_count; idx++) {
830 int app_config_parameter_id = tvb_get_uint8(tvb, offset + 0);
831 int app_config_parameter_len = tvb_get_uint8(tvb, offset + 1);
832 proto_tree *app_config_parameter_tree =
833 proto_tree_add_subtree(app_config_parameters_tree, tvb, offset,
834 2 + app_config_parameter_len, ett_uci_app_config_parameter, NULL,
835 val_to_str(app_config_parameter_id, app_config_parameter_type_vals, "Unknown (0x%02x)"));
837 proto_tree_add_item(app_config_parameter_tree,
838 hf_uci_app_config_parameter_type, tvb, offset, 1, ENC_NA);
839 offset += 1;
840 proto_tree_add_item(app_config_parameter_tree,
841 hf_uci_app_config_parameter_len, tvb, offset, 1, ENC_NA);
842 offset += 1;
843 proto_tree_add_item(app_config_parameter_tree,
844 hf_uci_app_config_parameter_value, tvb, offset,
845 app_config_parameter_len, ENC_NA);
846 offset += app_config_parameter_len;
850 static void dissect_session_set_app_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
851 proto_tree *payload_tree)
853 col_set_str(pinfo->cinfo, COL_INFO, "Session Set App Config Cmd");
854 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
855 offset += 4;
856 dissect_app_config_parameters(tvb, offset, pinfo, payload_tree);
859 static void dissect_session_set_app_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
860 proto_tree *payload_tree)
862 col_set_str(pinfo->cinfo, COL_INFO, "Session Set App Config Rsp");
863 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
864 offset += 1;
866 int app_config_parameters_count = tvb_get_uint8(tvb, offset);
867 proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count,
868 tvb, offset, 1, ENC_NA);
869 offset += 1;
871 if (app_config_parameters_count == 0) {
872 return;
875 proto_tree *app_config_parameters_tree =
876 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
877 ett_uci_app_config_parameters, NULL, "App Configurations");
879 for (int idx = 0; idx < app_config_parameters_count; idx++) {
880 int app_config_parameter_type = tvb_get_uint8(tvb, offset + 0);
882 proto_tree *app_config_parameter_tree =
883 proto_tree_add_subtree(app_config_parameters_tree, tvb, offset, 2,
884 ett_uci_app_config_parameter, NULL,
885 val_to_str(app_config_parameter_type, app_config_parameter_type_vals, "Unknown (0x%02x)"));
887 proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_type, tvb, offset, 1, ENC_NA);
888 offset += 1;
889 proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_status, tvb, offset, 1, ENC_NA);
890 offset += 1;
894 static void dissect_session_get_app_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
895 proto_tree *payload_tree)
897 col_set_str(pinfo->cinfo, COL_INFO, "Session Get App Config Cmd");
898 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
899 offset += 4;
901 int app_config_parameters_count = tvb_get_uint8(tvb, offset);
902 proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count, tvb, offset, 1, ENC_NA);
903 offset += 1;
905 if (app_config_parameters_count == 0) {
906 return;
909 proto_tree *app_config_parameters_tree =
910 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
911 ett_uci_app_config_parameters, NULL, "App Configuration IDs");
913 for (int idx = 0; idx < app_config_parameters_count; idx++) {
914 int app_config_parameter_id = tvb_get_uint8(tvb, offset);
916 proto_tree *app_config_parameter_tree =
917 proto_tree_add_subtree(app_config_parameters_tree, tvb, offset, 1,
918 ett_uci_app_config_parameter, NULL,
919 val_to_str(app_config_parameter_id, app_config_parameter_type_vals, "Unknown (0x%02x)"));
921 proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_type,
922 tvb, offset, 1, ENC_NA);
924 offset += 1;
928 static void dissect_session_get_app_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
929 proto_tree *payload_tree)
931 col_set_str(pinfo->cinfo, COL_INFO, "Session Get App Config Rsp");
932 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
933 offset += 1;
934 dissect_app_config_parameters(tvb, offset, pinfo, payload_tree);
937 static void dissect_session_get_count_cmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
938 proto_tree *payload_tree _U_)
940 col_set_str(pinfo->cinfo, COL_INFO, "Session Get Count Cmd");
943 static void dissect_session_get_count_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
944 proto_tree *payload_tree)
946 col_set_str(pinfo->cinfo, COL_INFO, "Session Get Count Rsp");
947 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
948 offset += 1;
949 proto_tree_add_item(payload_tree, hf_uci_session_count, tvb, offset, 1, ENC_NA);
952 static void dissect_session_get_state_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
953 proto_tree *payload_tree)
955 col_set_str(pinfo->cinfo, COL_INFO, "Session Get State Cmd");
956 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
959 static void dissect_session_get_state_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
960 proto_tree *payload_tree)
962 col_set_str(pinfo->cinfo, COL_INFO, "Session Get State Rsp");
963 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
964 offset += 1;
965 proto_tree_add_item(payload_tree, hf_uci_session_state, tvb, offset, 1, ENC_NA);
968 static void dissect_session_update_controller_multicast_list_cmd(
969 tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
971 col_set_str(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Cmd");
972 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
973 offset += 4;
974 proto_tree_add_item(payload_tree, hf_uci_update_controller_multicast_list_action,
975 tvb, offset, 1, ENC_NA);
976 offset += 1;
978 int controlees_count = tvb_get_uint8(tvb, offset);
979 proto_tree_add_item(payload_tree, hf_uci_controlees_count,
980 tvb, offset, 1, ENC_NA);
981 offset += 1;
983 if (controlees_count == 0) {
984 return;
987 proto_tree *controlee_list_tree =
988 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
989 ett_uci_controlee_list, NULL, "Controlee List");
991 for (int idx = 0; idx < controlees_count; idx++) {
992 proto_tree *controlee_tree =
993 proto_tree_add_subtree(controlee_list_tree, tvb, offset, -1,
994 ett_uci_controlee, NULL, "Controlee");
996 proto_tree_add_item(controlee_tree, hf_uci_controlee_short_address,
997 tvb, offset, 2, ENC_LITTLE_ENDIAN);
998 offset += 2;
999 proto_tree_add_item(controlee_tree, hf_uci_controlee_subsession_id,
1000 tvb, offset, 4, ENC_LITTLE_ENDIAN);
1001 offset += 4;
1005 static void dissect_session_update_controller_multicast_list_rsp(
1006 tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
1008 col_set_str(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Rsp");
1009 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1012 static void dissect_session_update_controller_multicast_list_ntf(
1013 tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
1015 col_set_str(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Ntf");
1016 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1017 offset += 4;
1018 proto_tree_add_item(payload_tree, hf_uci_remaining_multicast_list_size,
1019 tvb, offset, 1, ENC_NA);
1020 offset += 1;
1022 int controlees_count = tvb_get_uint8(tvb, offset);
1023 proto_tree_add_item(payload_tree, hf_uci_controlees_count,
1024 tvb, offset, 1, ENC_NA);
1025 offset += 1;
1027 if (controlees_count == 0) {
1028 return;
1031 proto_tree *controlee_list_tree =
1032 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
1033 ett_uci_controlee_list, NULL, "Controlee List");
1035 for (int idx = 0; idx < controlees_count; idx++) {
1036 proto_tree *controlee_tree =
1037 proto_tree_add_subtree(controlee_list_tree, tvb, offset, -1,
1038 ett_uci_controlee, NULL, "Controlee");
1040 proto_tree_add_item(controlee_tree, hf_uci_controlee_short_address,
1041 tvb, offset, 2, ENC_LITTLE_ENDIAN);
1042 offset += 2;
1043 proto_tree_add_item(controlee_tree, hf_uci_controlee_subsession_id,
1044 tvb, offset, 4, ENC_LITTLE_ENDIAN);
1045 offset += 4;
1046 proto_tree_add_item(controlee_tree, hf_uci_controlee_status,
1047 tvb, offset, 1, ENC_NA);
1048 offset += 1;
1052 static void dissect_uci_session_config_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
1053 proto_tree *payload_tree, int message_type, int opcode_id)
1055 if (message_type == UCI_MT_COMMAND &&
1056 opcode_id == UCI_OID_SESSION_INIT) {
1057 dissect_session_init_cmd(tvb, offset, pinfo, payload_tree);
1059 else if (message_type == UCI_MT_RESPONSE &&
1060 opcode_id == UCI_OID_SESSION_INIT) {
1061 dissect_session_init_rsp(tvb, offset, pinfo, payload_tree);
1063 else if (message_type == UCI_MT_COMMAND &&
1064 opcode_id == UCI_OID_SESSION_DEINIT) {
1065 dissect_session_deinit_cmd(tvb, offset, pinfo, payload_tree);
1067 else if (message_type == UCI_MT_RESPONSE &&
1068 opcode_id == UCI_OID_SESSION_DEINIT) {
1069 dissect_session_deinit_rsp(tvb, offset, pinfo, payload_tree);
1071 else if (message_type == UCI_MT_NOTIFICATION &&
1072 opcode_id == UCI_OID_SESSION_STATUS_NTF) {
1073 dissect_session_status_ntf(tvb, offset, pinfo, payload_tree);
1075 else if (message_type == UCI_MT_COMMAND &&
1076 opcode_id == UCI_OID_SESSION_SET_APP_CONFIG) {
1077 dissect_session_set_app_config_cmd(tvb, offset, pinfo, payload_tree);
1079 else if (message_type == UCI_MT_RESPONSE &&
1080 opcode_id == UCI_OID_SESSION_SET_APP_CONFIG) {
1081 dissect_session_set_app_config_rsp(tvb, offset, pinfo, payload_tree);
1083 else if (message_type == UCI_MT_COMMAND &&
1084 opcode_id == UCI_OID_SESSION_GET_APP_CONFIG) {
1085 dissect_session_get_app_config_cmd(tvb, offset, pinfo, payload_tree);
1087 else if (message_type == UCI_MT_RESPONSE &&
1088 opcode_id == UCI_OID_SESSION_GET_APP_CONFIG) {
1089 dissect_session_get_app_config_rsp(tvb, offset, pinfo, payload_tree);
1091 else if (message_type == UCI_MT_COMMAND &&
1092 opcode_id == UCI_OID_SESSION_GET_COUNT) {
1093 dissect_session_get_count_cmd(tvb, offset, pinfo, payload_tree);
1095 else if (message_type == UCI_MT_RESPONSE &&
1096 opcode_id == UCI_OID_SESSION_GET_COUNT) {
1097 dissect_session_get_count_rsp(tvb, offset, pinfo, payload_tree);
1099 else if (message_type == UCI_MT_COMMAND &&
1100 opcode_id == UCI_OID_SESSION_GET_STATE) {
1101 dissect_session_get_state_cmd(tvb, offset, pinfo, payload_tree);
1103 else if (message_type == UCI_MT_RESPONSE &&
1104 opcode_id == UCI_OID_SESSION_GET_STATE) {
1105 dissect_session_get_state_rsp(tvb, offset, pinfo, payload_tree);
1107 else if (message_type == UCI_MT_COMMAND &&
1108 opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
1109 dissect_session_update_controller_multicast_list_cmd(tvb, offset, pinfo, payload_tree);
1111 else if (message_type == UCI_MT_RESPONSE &&
1112 opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
1113 dissect_session_update_controller_multicast_list_rsp(tvb, offset, pinfo, payload_tree);
1115 else if (message_type == UCI_MT_NOTIFICATION &&
1116 opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
1117 dissect_session_update_controller_multicast_list_ntf(tvb, offset, pinfo, payload_tree);
1119 else if (message_type == UCI_MT_COMMAND) {
1120 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Cmd (%02x)", opcode_id);
1122 else if (message_type == UCI_MT_RESPONSE) {
1123 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Rsp (%02x)", opcode_id);
1125 else {
1126 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Ntf (%02x)", opcode_id);
1130 static void dissect_range_start_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
1131 proto_tree *payload_tree)
1133 col_set_str(pinfo->cinfo, COL_INFO, "Range Start Cmd");
1134 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1137 static void dissect_range_start_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
1138 proto_tree *payload_tree)
1140 col_set_str(pinfo->cinfo, COL_INFO, "Range Start Rsp");
1141 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1144 static void dissect_range_data_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
1145 proto_tree *payload_tree)
1147 col_set_str(pinfo->cinfo, COL_INFO, "Range Data Ntf");
1148 proto_tree_add_item(payload_tree, hf_uci_sequence_number, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1149 offset += 4;
1150 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1151 offset += 4;
1152 offset += 1;
1153 proto_tree_add_item(payload_tree, hf_uci_current_ranging_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1154 offset += 4;
1155 proto_tree_add_item(payload_tree, hf_uci_ranging_measurement_type, tvb, offset, 1, ENC_NA);
1156 offset += 1;
1157 offset += 1;
1159 int mac_addressing_mode_indicator = tvb_get_uint8(tvb, offset);
1160 proto_tree_add_item(payload_tree, hf_uci_mac_addressing_mode_indicator, tvb, offset, 1, ENC_NA);
1161 offset += 1;
1162 offset += 8;
1164 int ranging_measurement_count = tvb_get_uint8(tvb, offset);
1165 proto_tree_add_item(payload_tree, hf_uci_ranging_measurement_count, tvb, offset, 1, ENC_NA);
1166 offset += 1;
1168 if (ranging_measurement_count == 0) {
1169 return;
1172 proto_tree *ranging_measurements_tree =
1173 proto_tree_add_subtree(payload_tree, tvb, offset, -1,
1174 ett_uci_ranging_measurements, NULL, "Ranging Measurements");
1176 for (int idx = 0; idx < ranging_measurement_count; idx++) {
1177 proto_tree *ranging_measurement_tree;
1178 int padding_len;
1180 if (mac_addressing_mode_indicator == 0) {
1181 ranging_measurement_tree = proto_tree_add_subtree_format(
1182 ranging_measurements_tree, tvb, offset, 31,
1183 ett_uci_ranging_measurement, NULL,
1184 "%02x:%02x",
1185 tvb_get_uint8(tvb, offset + 0),
1186 tvb_get_uint8(tvb, offset + 1));
1188 proto_tree_add_item(ranging_measurement_tree,
1189 hf_uci_mac_address, tvb, offset, 2, ENC_NA);
1191 offset += 2;
1192 padding_len = 12;
1193 } else {
1194 ranging_measurement_tree = proto_tree_add_subtree_format(
1195 ranging_measurements_tree, tvb, offset, 31,
1196 ett_uci_ranging_measurement, NULL,
1197 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
1198 tvb_get_uint8(tvb, offset + 0),
1199 tvb_get_uint8(tvb, offset + 1),
1200 tvb_get_uint8(tvb, offset + 2),
1201 tvb_get_uint8(tvb, offset + 3),
1202 tvb_get_uint8(tvb, offset + 4),
1203 tvb_get_uint8(tvb, offset + 5),
1204 tvb_get_uint8(tvb, offset + 6),
1205 tvb_get_uint8(tvb, offset + 7));
1207 proto_tree_add_item(ranging_measurement_tree,
1208 hf_uci_mac_address, tvb, offset, 8, ENC_NA);
1210 offset += 8;
1211 padding_len = 6;
1214 proto_tree_add_item(ranging_measurement_tree,
1215 hf_uci_status, tvb, offset, 1, ENC_NA);
1216 offset += 1;
1217 proto_tree_add_item(ranging_measurement_tree,
1218 hf_uci_nlos, tvb, offset, 1, ENC_NA);
1219 offset += 1;
1220 proto_tree_add_item(ranging_measurement_tree,
1221 hf_uci_distance, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1222 offset += 2;
1223 proto_tree_add_item(ranging_measurement_tree,
1224 hf_uci_aoa_azimuth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1225 offset += 2;
1226 proto_tree_add_item(ranging_measurement_tree,
1227 hf_uci_aoa_azimuth_fom, tvb, offset, 1, ENC_NA);
1228 offset += 1;
1229 proto_tree_add_item(ranging_measurement_tree,
1230 hf_uci_aoa_elevation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1231 offset += 2;
1232 proto_tree_add_item(ranging_measurement_tree,
1233 hf_uci_aoa_elevation_fom, tvb, offset, 1, ENC_NA);
1234 offset += 1;
1235 proto_tree_add_item(ranging_measurement_tree,
1236 hf_uci_aoa_destination_azimuth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1237 offset += 2;
1238 proto_tree_add_item(ranging_measurement_tree,
1239 hf_uci_aoa_destination_azimuth_fom, tvb, offset, 1, ENC_NA);
1240 offset += 1;
1241 proto_tree_add_item(ranging_measurement_tree,
1242 hf_uci_aoa_destination_elevation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1243 offset += 2;
1244 proto_tree_add_item(ranging_measurement_tree,
1245 hf_uci_aoa_destination_elevation_fom, tvb, offset, 1, ENC_NA);
1246 offset += 1;
1247 proto_tree_add_item(ranging_measurement_tree,
1248 hf_uci_slot_index, tvb, offset, 1, ENC_NA);
1249 offset += 1;
1250 offset += padding_len;
1254 static void dissect_range_stop_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
1255 proto_tree *payload_tree)
1257 col_set_str(pinfo->cinfo, COL_INFO, "Range Stop Cmd");
1258 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1261 static void dissect_range_stop_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
1262 proto_tree *payload_tree)
1264 col_set_str(pinfo->cinfo, COL_INFO, "Range Stop Rsp");
1265 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1268 static void dissect_range_get_ranging_count_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
1269 proto_tree *payload_tree)
1271 col_set_str(pinfo->cinfo, COL_INFO, "Range Get Ranging Count Cmd");
1272 proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1275 static void dissect_range_get_ranging_count_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
1276 proto_tree *payload_tree)
1278 col_set_str(pinfo->cinfo, COL_INFO, "Range Get Ranging Count Rsp");
1279 proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1280 offset += 1;
1281 proto_tree_add_item(payload_tree, hf_uci_ranging_count, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1284 static void dissect_uci_ranging_session_control_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
1285 proto_tree *payload_tree, int message_type, int opcode_id)
1287 if (message_type == UCI_MT_COMMAND &&
1288 opcode_id == UCI_OID_RANGE_START) {
1289 dissect_range_start_cmd(tvb, offset, pinfo, payload_tree);
1291 else if (message_type == UCI_MT_RESPONSE &&
1292 opcode_id == UCI_OID_RANGE_START) {
1293 dissect_range_start_rsp(tvb, offset, pinfo, payload_tree);
1295 else if (message_type == UCI_MT_NOTIFICATION &&
1296 opcode_id == UCI_OID_RANGE_DATA) {
1297 dissect_range_data_ntf(tvb, offset, pinfo, payload_tree);
1299 else if (message_type == UCI_MT_COMMAND &&
1300 opcode_id == UCI_OID_RANGE_STOP) {
1301 dissect_range_stop_cmd(tvb, offset, pinfo, payload_tree);
1303 else if (message_type == UCI_MT_RESPONSE &&
1304 opcode_id == UCI_OID_RANGE_STOP) {
1305 dissect_range_stop_rsp(tvb, offset, pinfo, payload_tree);
1307 else if (message_type == UCI_MT_COMMAND &&
1308 opcode_id == UCI_OID_RANGE_GET_RANGING_COUNT) {
1309 dissect_range_get_ranging_count_cmd(tvb, offset, pinfo, payload_tree);
1311 else if (message_type == UCI_MT_RESPONSE &&
1312 opcode_id == UCI_OID_RANGE_GET_RANGING_COUNT) {
1313 dissect_range_get_ranging_count_rsp(tvb, offset, pinfo, payload_tree);
1315 else if (message_type == UCI_MT_COMMAND) {
1316 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Cmd (%02x)", opcode_id);
1318 else if (message_type == UCI_MT_RESPONSE) {
1319 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Rsp (%02x)", opcode_id);
1321 else {
1322 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Ntf (%02x)", opcode_id);
1326 static void dissect_uci_data_control_pdu(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
1327 proto_tree *payload_tree _U_, int message_type, int opcode_id)
1329 if (message_type == UCI_MT_COMMAND) {
1330 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Cmd (%02x)", opcode_id);
1332 else if (message_type == UCI_MT_RESPONSE) {
1333 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Rsp (%02x)", opcode_id);
1335 else {
1336 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Ntf (%02x)", opcode_id);
1340 static void dissect_uci_test_pdu(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
1341 proto_tree *payload_tree _U_, int message_type, int opcode_id)
1343 if (message_type == UCI_MT_COMMAND) {
1344 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Cmd (%02x)", opcode_id);
1346 else if (message_type == UCI_MT_RESPONSE) {
1347 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Rsp (%02x)", opcode_id);
1349 else {
1350 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Ntf (%02x)", opcode_id);
1354 static void dissect_uci_vendor_pdu(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
1355 proto_tree *payload_tree _U_, int message_type, int group_id, int opcode_id)
1357 if (message_type == UCI_MT_COMMAND) {
1358 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Cmd (%02x)", group_id, opcode_id);
1360 else if (message_type == UCI_MT_RESPONSE) {
1361 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Rsp (%02x)", group_id, opcode_id);
1363 else {
1364 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Ntf (%02x)", group_id, opcode_id);
1368 static int dissect_uci_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1370 proto_item *ti;
1371 proto_tree *packet_tree;
1372 proto_tree *header_tree;
1373 proto_tree *payload_tree;
1374 int message_type;
1375 int group_id;
1376 int opcode_id;
1377 int payload_len;
1378 int offset = 0;
1380 col_set_str(pinfo->cinfo, COL_PROTOCOL, "UCI");
1381 col_clear(pinfo->cinfo, COL_INFO);
1383 ti = proto_tree_add_item(tree, proto_uci, tvb, 0, -1, ENC_NA);
1384 packet_tree = proto_item_add_subtree(ti, ett_uci);
1385 header_tree = proto_tree_add_subtree(packet_tree, tvb, offset, UCI_PACKET_HEADER_LEN, ett_uci_header, NULL, "UCI Packet Header");
1387 proto_tree_add_item(header_tree, hf_uci_message_type, tvb, offset + 0, 1, ENC_NA);
1388 proto_tree_add_item(header_tree, hf_uci_packet_boundary_flag, tvb, offset + 0, 1, ENC_NA);
1389 proto_tree_add_item(header_tree, hf_uci_group_id, tvb, offset + 0, 1, ENC_NA);
1390 proto_tree_add_item(header_tree, hf_uci_opcode_id, tvb, offset + 1, 1, ENC_NA);
1391 proto_tree_add_item(header_tree, hf_uci_payload_length, tvb, offset + 3, 1, ENC_NA);
1393 message_type = (tvb_get_uint8(tvb, offset + 0) >> 5) & 0x07;
1394 group_id = (tvb_get_uint8(tvb, offset + 0) >> 0) & 0x0f;
1395 opcode_id = tvb_get_uint8(tvb, offset + 1) & 0x3f;
1396 payload_len = tvb_get_uint8(tvb, offset + 3);
1398 offset += UCI_PACKET_HEADER_LEN;
1399 payload_tree = proto_tree_add_subtree(packet_tree, tvb, offset, payload_len, ett_uci_payload, NULL, "UCI Packet Payload");
1401 switch (group_id) {
1402 case UCI_GID_CORE: dissect_uci_core_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1403 case UCI_GID_SESSION_CONFIG: dissect_uci_session_config_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1404 case UCI_GID_RANGING_SESSION_CONTROL: dissect_uci_ranging_session_control_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1405 case UCI_GID_DATA_CONTROL: dissect_uci_data_control_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1406 case UCI_GID_TEST: dissect_uci_test_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1407 default: dissect_uci_vendor_pdu(tvb, offset, pinfo, payload_tree, message_type, group_id, opcode_id); break;
1410 return tvb_reported_length(tvb);
1413 static int dissect_uci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1415 tcp_dissect_pdus(tvb, pinfo, tree, gPREF_TCP_DESEGMENT, UCI_PACKET_HEADER_LEN,
1416 get_uci_pdu_len, dissect_uci_pdu, data);
1417 return tvb_reported_length(tvb);
1420 void proto_register_uci(void)
1422 static hf_register_info hf[] = {
1423 { &hf_uci_message_type,
1424 { "UCI Message Type", "uci.mt",
1425 FT_UINT8, BASE_DEC,
1426 VALS(message_type_vals), 0xe0,
1427 NULL, HFILL }
1429 { &hf_uci_packet_boundary_flag,
1430 { "UCI Packet Boundary Flag", "uci.pbf",
1431 FT_UINT8, BASE_HEX,
1432 VALS(packet_boundary_flag_vals), 0x10,
1433 NULL, HFILL }
1435 { &hf_uci_group_id,
1436 { "UCI Group Identifier", "uci.gid",
1437 FT_UINT8, BASE_HEX,
1438 VALS(group_id_vals), 0x0f,
1439 NULL, HFILL }
1441 { &hf_uci_opcode_id,
1442 { "UCI Opcode Identifier", "uci.oid",
1443 FT_UINT8, BASE_HEX,
1444 NULL, 0x3f,
1445 NULL, HFILL }
1447 { &hf_uci_payload_length,
1448 { "UCI Payload Length", "uci.len",
1449 FT_UINT8, BASE_DEC,
1450 NULL, 0x0,
1451 NULL, HFILL }
1453 { &hf_uci_status,
1454 { "Status", "uci.status",
1455 FT_UINT8, BASE_DEC,
1456 VALS(status_vals), 0x0,
1457 NULL, HFILL }
1459 { &hf_uci_reset_config,
1460 { "Reset Config", "uci.reset_config",
1461 FT_UINT8, BASE_DEC,
1462 VALS(reset_config_vals), 0x0,
1463 NULL, HFILL }
1465 { &hf_uci_device_state,
1466 { "Device State", "uci.device_state",
1467 FT_UINT8, BASE_DEC,
1468 VALS(device_state_vals), 0x0,
1469 NULL, HFILL }
1471 { &hf_uci_version_major,
1472 { "Major Version", "uci.major_version",
1473 FT_UINT16, BASE_DEC,
1474 NULL, 0x00ff,
1475 NULL, HFILL }
1477 { &hf_uci_version_minor,
1478 { "Minor Version", "uci.minor_version",
1479 FT_UINT16, BASE_DEC,
1480 NULL, 0xf000,
1481 NULL, HFILL }
1483 { &hf_uci_maintenance_number,
1484 { "Maintenance Number", "uci.maintenance_number",
1485 FT_UINT16, BASE_DEC,
1486 NULL, 0x0f00,
1487 NULL, HFILL }
1489 { &hf_uci_generic_version,
1490 { "UCI Generic Version", "uci.generic_version",
1491 FT_UINT16, BASE_HEX,
1492 NULL, 0x0,
1493 NULL, HFILL }
1495 { &hf_uci_mac_version,
1496 { "MAC Version", "uci.mac_version",
1497 FT_UINT16, BASE_HEX,
1498 NULL, 0x0,
1499 NULL, HFILL }
1501 { &hf_uci_phy_version,
1502 { "PHY Version", "uci.phy_version",
1503 FT_UINT16, BASE_HEX,
1504 NULL, 0x0,
1505 NULL, HFILL }
1507 { &hf_uci_test_version,
1508 { "UCI Test Version", "uci.test_version",
1509 FT_UINT16, BASE_HEX,
1510 NULL, 0x0,
1511 NULL, HFILL }
1513 { &hf_uci_vendor_specific_information_length,
1514 { "Vendor Specific Information Length", "uci.vendor_specific_information_len",
1515 FT_UINT8, BASE_DEC,
1516 NULL, 0x0,
1517 NULL, HFILL }
1519 { &hf_uci_vendor_specific_information,
1520 { "Vendor Specific Information", "uci.vendor_specific_information",
1521 FT_BYTES, BASE_NONE,
1522 NULL, 0x0,
1523 NULL, HFILL }
1525 { &hf_uci_capability_parameters_count,
1526 { "Number of Capability Parameters", "uci.capability_parameters_count",
1527 FT_UINT8, BASE_DEC,
1528 NULL, 0x0,
1529 NULL, HFILL }
1531 { &hf_uci_capability_parameter_type,
1532 { "Type", "uci.capability_parameter.type",
1533 FT_UINT8, BASE_HEX,
1534 VALS(capability_parameter_type_vals), 0x0,
1535 NULL, HFILL }
1537 { &hf_uci_capability_parameter_len,
1538 { "Length", "uci.capability_parameter.len",
1539 FT_UINT8, BASE_DEC,
1540 NULL, 0x0,
1541 NULL, HFILL }
1543 { &hf_uci_capability_parameter_value,
1544 { "Value", "uci.capability_parameter.value",
1545 FT_BYTES, BASE_NONE,
1546 NULL, 0x0,
1547 NULL, HFILL }
1549 { &hf_uci_parameters_count,
1550 { "Number of Parameters", "uci.parameters_count",
1551 FT_UINT8, BASE_DEC,
1552 NULL, 0x0,
1553 NULL, HFILL }
1555 { &hf_uci_parameter_type,
1556 { "Type", "uci.parameter.type",
1557 FT_UINT8, BASE_DEC,
1558 VALS(parameter_type_vals), 0x0,
1559 NULL, HFILL }
1561 { &hf_uci_parameter_len,
1562 { "Length", "uci.parameter.len",
1563 FT_UINT8, BASE_DEC,
1564 NULL, 0x0,
1565 NULL, HFILL }
1567 { &hf_uci_parameter_value,
1568 { "Value", "uci.parameter.value",
1569 FT_BYTES, BASE_NONE,
1570 NULL, 0x0,
1571 NULL, HFILL }
1573 { &hf_uci_parameter_status,
1574 { "Status", "uci.parameter.status",
1575 FT_UINT8, BASE_HEX,
1576 VALS(status_vals), 0x0,
1577 NULL, HFILL }
1579 { &hf_uci_session_id,
1580 { "Session ID", "uci.session_id",
1581 FT_UINT32, BASE_HEX,
1582 NULL, 0x0,
1583 NULL, HFILL }
1585 { &hf_uci_session_type,
1586 { "Session Type", "uci.session_type",
1587 FT_UINT8, BASE_HEX,
1588 VALS(session_type_vals), 0x0,
1589 NULL, HFILL }
1591 { &hf_uci_session_state,
1592 { "Session Type", "uci.session_state",
1593 FT_UINT8, BASE_HEX,
1594 VALS(session_state_vals), 0x0,
1595 NULL, HFILL }
1597 { &hf_uci_session_count,
1598 { "Session Count", "uci.session_count",
1599 FT_UINT8, BASE_DEC,
1600 NULL, 0x0,
1601 NULL, HFILL }
1603 { &hf_uci_app_config_parameters_count,
1604 { "Number of App Configurations", "uci.app_config_parameters_count",
1605 FT_UINT8, BASE_DEC,
1606 NULL, 0x0,
1607 NULL, HFILL }
1609 { &hf_uci_app_config_parameter_type,
1610 { "Type", "uci.app_config_parameter.type",
1611 FT_UINT8, BASE_DEC,
1612 VALS(app_config_parameter_type_vals), 0x0,
1613 NULL, HFILL }
1615 { &hf_uci_app_config_parameter_len,
1616 { "Length", "uci.app_config_parameter.len",
1617 FT_UINT8, BASE_DEC,
1618 NULL, 0x0,
1619 NULL, HFILL }
1621 { &hf_uci_app_config_parameter_value,
1622 { "Value", "uci.app_config_parameter.value",
1623 FT_BYTES, BASE_NONE,
1624 NULL, 0x0,
1625 NULL, HFILL }
1627 { &hf_uci_app_config_parameter_status,
1628 { "Status", "uci.app_config_parameter.status",
1629 FT_UINT8, BASE_HEX,
1630 VALS(status_vals), 0x0,
1631 NULL, HFILL }
1633 { &hf_uci_update_controller_multicast_list_action,
1634 { "Action", "uci.update_controller_multicast_list_action",
1635 FT_UINT8, BASE_HEX,
1636 VALS(update_controller_multicast_list_action_vals), 0x0,
1637 NULL, HFILL }
1639 { &hf_uci_controlees_count,
1640 { "Number of Controlees", "uci.controlees_count",
1641 FT_UINT8, BASE_DEC,
1642 NULL, 0x0,
1643 NULL, HFILL }
1645 { &hf_uci_controlee_short_address,
1646 { "Short Address", "uci.controlee.short_address",
1647 FT_UINT16, BASE_HEX,
1648 NULL, 0x0,
1649 NULL, HFILL }
1651 { &hf_uci_controlee_subsession_id,
1652 { "Sub-Session ID", "uci.controlee.subsession_id",
1653 FT_UINT32, BASE_HEX,
1654 NULL, 0x0,
1655 NULL, HFILL }
1657 { &hf_uci_controlee_status,
1658 { "Status", "uci.controlee.status",
1659 FT_UINT8, BASE_HEX,
1660 VALS(multicast_update_status_vals), 0x0,
1661 NULL, HFILL }
1663 { &hf_uci_remaining_multicast_list_size,
1664 { "Remaining Multicast List Size", "uci.remaining_multicast_list_size",
1665 FT_UINT8, BASE_DEC,
1666 NULL, 0x0,
1667 NULL, HFILL }
1670 { &hf_uci_ranging_count,
1671 { "Count", "uci.ranging_count",
1672 FT_UINT32, BASE_DEC,
1673 NULL, 0x0,
1674 NULL, HFILL }
1676 { &hf_uci_sequence_number,
1677 { "Sequence Number", "uci.sequence_number",
1678 FT_UINT32, BASE_DEC,
1679 NULL, 0x0,
1680 NULL, HFILL }
1682 { &hf_uci_current_ranging_interval,
1683 { "Current Ranging Interval", "uci.current_ranging_interval",
1684 FT_UINT32, BASE_DEC,
1685 NULL, 0x0,
1686 NULL, HFILL }
1688 { &hf_uci_ranging_measurement_type,
1689 { "Ranging Measurement Type", "uci.ranging_measurement_type",
1690 FT_UINT8, BASE_HEX,
1691 VALS(ranging_measurement_type_vals), 0x0,
1692 NULL, HFILL }
1694 { &hf_uci_mac_addressing_mode_indicator,
1695 { "MAC Addressing Mode Indicator", "uci.mac_addressing_mode_indicator",
1696 FT_UINT8, BASE_HEX,
1697 VALS(mac_addressing_mode_indicator_vals), 0x0,
1698 NULL, HFILL }
1700 { &hf_uci_ranging_measurement_count,
1701 { "Number of Ranging Measurements", "uci.ranging_measurement_count",
1702 FT_UINT8, BASE_DEC,
1703 NULL, 0x0,
1704 NULL, HFILL }
1706 { &hf_uci_mac_address,
1707 { "MAC Address", "uci.mac_address",
1708 FT_BYTES, BASE_NONE,
1709 NULL, 0x0,
1710 NULL, HFILL }
1712 { &hf_uci_nlos,
1713 { "NLoS", "uci.nlos",
1714 FT_UINT8, BASE_HEX,
1715 VALS(nlos_vals), 0x0,
1716 NULL, HFILL }
1718 { &hf_uci_distance,
1719 { "Distance", "uci.distance",
1720 FT_UINT16, BASE_DEC,
1721 NULL, 0x0,
1722 NULL, HFILL }
1724 { &hf_uci_aoa_azimuth,
1725 { "AoA Azimuth", "uci.aoa_azimuth",
1726 FT_INT16, BASE_DEC,
1727 NULL, 0x0,
1728 NULL, HFILL }
1730 { &hf_uci_aoa_azimuth_fom,
1731 { "AoA Azimuth FOM", "uci.aoa_azimuth_fom",
1732 FT_INT8, BASE_DEC,
1733 NULL, 0x0,
1734 NULL, HFILL }
1736 { &hf_uci_aoa_elevation,
1737 { "AoA Elevation", "uci.aoa_elevation",
1738 FT_INT16, BASE_DEC,
1739 NULL, 0x0,
1740 NULL, HFILL }
1742 { &hf_uci_aoa_elevation_fom,
1743 { "AoA Elevation FOM", "uci.aoa_elevation_fom",
1744 FT_INT8, BASE_DEC,
1745 NULL, 0x0,
1746 NULL, HFILL }
1748 { &hf_uci_aoa_destination_azimuth,
1749 { "AoA Destination Azimuth", "uci.aoa_destination_azimuth",
1750 FT_INT16, BASE_DEC,
1751 NULL, 0x0,
1752 NULL, HFILL }
1754 { &hf_uci_aoa_destination_azimuth_fom,
1755 { "AoA Destination Azimuth FOM", "uci.aoa_destination_azimuth_fom",
1756 FT_INT8, BASE_DEC,
1757 NULL, 0x0,
1758 NULL, HFILL }
1760 { &hf_uci_aoa_destination_elevation,
1761 { "AoA Destination Elevation", "uci.aoa_destination_elevation",
1762 FT_INT16, BASE_DEC,
1763 NULL, 0x0,
1764 NULL, HFILL }
1766 { &hf_uci_aoa_destination_elevation_fom,
1767 { "AoA Destination Elevation FOM", "uci.aoa_destination_elevation_fom",
1768 FT_INT8, BASE_DEC,
1769 NULL, 0x0,
1770 NULL, HFILL }
1772 { &hf_uci_slot_index,
1773 { "Slot Index", "uci.slot_index",
1774 FT_INT8, BASE_DEC,
1775 NULL, 0x0,
1776 NULL, HFILL }
1780 static int *ett[] = {
1781 &ett_uci,
1782 &ett_uci_header,
1783 &ett_uci_payload,
1784 &ett_uci_capability_parameters,
1785 &ett_uci_capability_parameter,
1786 &ett_uci_parameters,
1787 &ett_uci_parameter,
1788 &ett_uci_app_config_parameters,
1789 &ett_uci_app_config_parameter,
1790 &ett_uci_controlee_list,
1791 &ett_uci_controlee,
1792 &ett_uci_ranging_measurements,
1793 &ett_uci_ranging_measurement,
1796 module_t *module_uci;
1798 proto_uci = proto_register_protocol (
1799 "UWB UCI Protocol", /* name */
1800 "UCI", /* short name */
1801 "uci" /* filter_name */
1804 proto_register_field_array(proto_uci, hf, array_length(hf));
1805 proto_register_subtree_array(ett, array_length(ett));
1807 module_uci = prefs_register_protocol(proto_uci,
1808 proto_reg_handoff_uci);
1809 prefs_register_uint_preference(module_uci, "tcp.port",
1810 "TCP port",
1811 "Select preferred TCP port",
1813 &gPREF_TCP_PORT);
1814 prefs_register_bool_preference(module_uci, "tcp.desegment",
1815 "TCP desegment",
1816 "Enable desegmentation of UCI packets over TCP",
1817 &gPREF_TCP_DESEGMENT);
1819 handle_uci = create_dissector_handle(dissect_uci, proto_uci);
1822 void proto_reg_handoff_uci(void)
1824 dissector_add_uint("tcp.port", gPREF_TCP_PORT, handle_uci);
1825 dissector_add_uint("wtap_encap", WTAP_ENCAP_FIRA_UCI, handle_uci);