Coverage Report

Created: 2025-02-15 06:25

/src/wireshark/epan/dissectors/packet-uci.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Author: Henri Chataing <henrichataing@google.com>
3
 * Copyright 2022 Google LLC
4
 *
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.
9
 *
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.
14
 *
15
 * SPDX-License-Identifier: GPL-2.0-or-later
16
 * Specification: Fira Consortium UWB Command Interface Generic Technical
17
 *                Specification v1.1.0
18
 */
19
20
#include <config.h>
21
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>
28
29
void proto_reg_handoff_uci(void);
30
void proto_register_uci(void);
31
32
3.25k
#define UCI_PACKET_HEADER_LEN 4
33
34
7.48k
#define UCI_MT_COMMAND 0x01
35
7.32k
#define UCI_MT_RESPONSE 0x02
36
2.40k
#define UCI_MT_NOTIFICATION 0x03
37
38
498
#define UCI_GID_CORE 0x00
39
90
#define UCI_GID_SESSION_CONFIG 0x01
40
88
#define UCI_GID_RANGING_SESSION_CONTROL 0x02
41
63
#define UCI_GID_DATA_CONTROL 0x03
42
54
#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
49
50
31
#define UCI_OID_CORE_DEVICE_RESET 0x00
51
4
#define UCI_OID_CORE_DEVICE_STATUS_NTF 0x01
52
26
#define UCI_OID_CORE_GET_DEVICE_INFO 0x02
53
23
#define UCI_OID_CORE_GET_CAPS_INFO 0x03
54
19
#define UCI_OID_CORE_SET_CONFIG 0x04
55
20
#define UCI_OID_CORE_GET_CONFIG 0x05
56
4
#define UCI_OID_CORE_GENERIC_ERROR_NTF 0x07
57
34
#define UCI_OID_SESSION_INIT 0x00
58
32
#define UCI_OID_SESSION_DEINIT 0x01
59
13
#define UCI_OID_SESSION_STATUS_NTF 0x02
60
21
#define UCI_OID_SESSION_SET_APP_CONFIG 0x03
61
20
#define UCI_OID_SESSION_GET_APP_CONFIG 0x04
62
15
#define UCI_OID_SESSION_GET_COUNT 0x05
63
14
#define UCI_OID_SESSION_GET_STATE 0x06
64
25
#define UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST 0x07
65
30
#define UCI_OID_RANGE_START 0x00
66
10
#define UCI_OID_RANGE_DATA 0x00
67
27
#define UCI_OID_RANGE_STOP 0x01
68
25
#define UCI_OID_RANGE_GET_RANGING_COUNT 0x03
69
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
98
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
126
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
182
183
static bool gPREF_TCP_DESEGMENT = true;
184
static unsigned gPREF_TCP_PORT = 7000;
185
186
static int proto_uci;
187
static dissector_handle_t handle_uci;
188
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;
248
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;
262
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 },
268
};
269
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 },
275
};
276
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 },
290
};
291
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 },
322
};
323
324
static const value_string reset_config_vals[] = {
325
    { 0, "UWBS reset" },
326
    { 0, NULL },
327
};
328
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 },
334
};
335
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 },
365
};
366
367
static const value_string parameter_type_vals[] = {
368
    { 0, "Device State" },
369
    { 1, "Low Power Mode" },
370
    { 0, NULL },
371
};
372
373
static const value_string session_type_vals[] = {
374
    { 0x00, "Fira Ranging Session" },
375
    { 0xD0, "Device Test Mode" },
376
    { 0, NULL },
377
};
378
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 },
385
};
386
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 },
444
};
445
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 },
450
};
451
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 },
458
};
459
460
static const value_string ranging_measurement_type_vals[] = {
461
    { 1, "Two Way Ranging Measurement (SS-TWR, DSTWR)" },
462
    { 0, NULL },
463
};
464
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 },
469
};
470
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 },
476
};
477
478
static unsigned get_uci_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
479
1.06k
{
480
    /* Return the payload length added to the packet header length. */
481
1.06k
    return tvb_get_uint8(tvb, offset + 3) + UCI_PACKET_HEADER_LEN;
482
1.06k
}
483
484
static void dissect_core_device_reset_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
485
                                         proto_tree *payload_tree)
486
1
{
487
1
    col_set_str(pinfo->cinfo, COL_INFO, "Core Device Reset Cmd");
488
1
    proto_tree_add_item(payload_tree, hf_uci_reset_config, tvb, offset, 1, ENC_NA);
489
1
}
490
491
static void dissect_core_device_reset_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
492
                                         proto_tree *payload_tree)
493
4
{
494
4
    col_set_str(pinfo->cinfo, COL_INFO, "Core Device Reset Rsp");
495
4
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
496
4
}
497
498
static void dissect_core_device_status_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
499
                                          proto_tree *payload_tree)
500
0
{
501
0
    col_set_str(pinfo->cinfo, COL_INFO, "Core Device Status Ntf");
502
0
    proto_tree_add_item(payload_tree, hf_uci_device_state, tvb, offset, 1, ENC_NA);
503
0
}
504
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_)
507
2
{
508
2
    col_set_str(pinfo->cinfo, COL_INFO, "Core Get Device Info Cmd");
509
2
}
510
511
static void dissect_core_get_device_info_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
512
                                            proto_tree *payload_tree)
513
1
{
514
1
    static int * const version_fields[] = {
515
1
        &hf_uci_version_major,
516
1
        &hf_uci_version_minor,
517
1
        &hf_uci_maintenance_number,
518
1
        NULL
519
1
    };
520
521
1
    col_set_str(pinfo->cinfo, COL_INFO, "Core Get Device Info Rsp");
522
1
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
523
1
    offset += 1;
524
1
    proto_tree_add_bitmask(payload_tree, tvb, offset,
525
1
        hf_uci_generic_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
526
1
    offset += 2;
527
1
    proto_tree_add_bitmask(payload_tree, tvb, offset,
528
1
        hf_uci_mac_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
529
1
    offset += 2;
530
1
    proto_tree_add_bitmask(payload_tree, tvb, offset,
531
1
        hf_uci_phy_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
532
1
    offset += 2;
533
1
    proto_tree_add_bitmask(payload_tree, tvb, offset,
534
1
        hf_uci_test_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
535
1
    offset += 2;
536
537
1
    int vendor_specific_information_len = tvb_get_uint8(tvb, offset);
538
1
    proto_tree_add_item(payload_tree, hf_uci_vendor_specific_information_length,
539
1
        tvb, offset, 1, ENC_NA);
540
1
    offset += 1;
541
542
1
    proto_tree_add_item(payload_tree, hf_uci_vendor_specific_information,
543
1
        tvb, offset, vendor_specific_information_len, ENC_NA);
544
1
}
545
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_)
548
3
{
549
3
    col_set_str(pinfo->cinfo, COL_INFO, "Core Get Caps Info Cmd");
550
3
}
551
552
static void dissect_core_get_caps_info_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
553
                                          proto_tree *payload_tree)
554
0
{
555
0
    col_set_str(pinfo->cinfo, COL_INFO, "Core Get Caps Info Rsp");
556
0
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
557
0
    offset += 1;
558
559
0
    int capability_parameters_count = tvb_get_uint8(tvb, offset);
560
0
    proto_tree_add_item(payload_tree, hf_uci_capability_parameters_count,
561
0
        tvb, offset, 1, ENC_NA);
562
0
    offset += 1;
563
564
0
    if (capability_parameters_count == 0) {
565
0
        return;
566
0
    }
567
568
0
    proto_tree *capability_parameters_tree =
569
0
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
570
0
            ett_uci_capability_parameters, NULL, "Capability Parameters");
571
572
0
    for (int idx = 0; idx < capability_parameters_count; idx++) {
573
0
        int parameter_type = tvb_get_uint8(tvb, offset + 0);
574
0
        int parameter_len = tvb_get_uint8(tvb, offset + 1);
575
0
        proto_tree *parameter_tree =
576
0
            proto_tree_add_subtree(capability_parameters_tree, tvb, offset, 2 + parameter_len,
577
0
                ett_uci_capability_parameter, NULL,
578
0
                val_to_str(parameter_type, capability_parameter_type_vals, "Unknown (0x%02x)"));
579
580
0
        proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_type, tvb, offset, 1, ENC_NA);
581
0
        offset += 1;
582
0
        proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_len, tvb, offset, 1, ENC_NA);
583
0
        offset += 1;
584
0
        proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_value, tvb, offset, parameter_len, ENC_NA);
585
0
        offset += parameter_len;
586
0
    }
587
0
}
588
589
static void dissect_core_get_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
590
                                       proto_tree *payload_tree)
591
1
{
592
1
    col_set_str(pinfo->cinfo, COL_INFO, "Core Get Config Cmd");
593
594
1
    int parameters_count = tvb_get_uint8(tvb, offset);
595
1
    proto_tree_add_item(payload_tree, hf_uci_parameters_count, tvb, offset, 1, ENC_NA);
596
1
    offset += 1;
597
598
1
    if (parameters_count == 0) {
599
0
        return;
600
0
    }
601
602
1
    proto_tree *parameters_tree =
603
1
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
604
1
            ett_uci_parameters, NULL, "Parameter IDs");
605
606
70
    for (int idx = 0; idx < parameters_count; idx++) {
607
69
        int parameter_id = tvb_get_uint8(tvb, offset);
608
609
69
        proto_tree *parameter_tree =
610
69
            proto_tree_add_subtree(parameters_tree, tvb, offset, 1,
611
69
                ett_uci_parameter, NULL,
612
69
                val_to_str(parameter_id, parameter_type_vals, "Unknown (0x%02x)"));
613
614
69
        proto_tree_add_item(parameter_tree, hf_uci_parameter_type,
615
69
            tvb, offset, 1, ENC_NA);
616
617
69
        offset += 1;
618
69
    }
619
1
}
620
621
static void dissect_parameters(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
622
                               proto_tree *payload_tree)
623
3
{
624
3
    int parameters_count = tvb_get_uint8(tvb, offset);
625
3
    proto_tree_add_item(payload_tree, hf_uci_parameters_count, tvb, offset, 1, ENC_NA);
626
3
    offset += 1;
627
628
3
    if (parameters_count == 0) {
629
0
        return;
630
0
    }
631
632
3
    proto_tree *parameters_tree =
633
3
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
634
3
            ett_uci_parameters, NULL, "Parameters");
635
636
12
    for (int idx = 0; idx < parameters_count; idx++) {
637
9
        int parameter_id = tvb_get_uint8(tvb, offset + 0);
638
9
        int parameter_len = tvb_get_uint8(tvb, offset + 1);
639
9
        proto_tree *parameter_tree =
640
9
            proto_tree_add_subtree(parameters_tree, tvb, offset, 2 + parameter_len,
641
9
                ett_uci_parameter, NULL,
642
9
                val_to_str(parameter_id, parameter_type_vals, "Unknown (0x%02x)"));
643
644
9
        proto_tree_add_item(parameter_tree, hf_uci_parameter_type, tvb, offset, 1, ENC_NA);
645
9
        offset += 1;
646
9
        proto_tree_add_item(parameter_tree, hf_uci_parameter_len, tvb, offset, 1, ENC_NA);
647
9
        offset += 1;
648
9
        proto_tree_add_item(parameter_tree, hf_uci_parameter_value, tvb, offset, parameter_len, ENC_NA);
649
9
        offset += parameter_len;
650
9
    }
651
3
}
652
653
static void dissect_core_get_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
654
                                       proto_tree *payload_tree)
655
0
{
656
0
    col_set_str(pinfo->cinfo, COL_INFO, "Core Get Config Rsp");
657
0
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
658
0
    offset += 1;
659
660
0
    dissect_parameters(tvb, offset, pinfo, payload_tree);
661
0
}
662
663
static void dissect_core_set_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
664
                                       proto_tree *payload_tree)
665
3
{
666
3
    col_set_str(pinfo->cinfo, COL_INFO, "Core Set Config Cmd");
667
3
    dissect_parameters(tvb, offset, pinfo, payload_tree);
668
3
}
669
670
static void dissect_core_set_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
671
                                       proto_tree *payload_tree)
672
1
{
673
1
    col_set_str(pinfo->cinfo, COL_INFO, "Core Set Config Rsp");
674
1
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
675
1
    offset += 1;
676
677
1
    int parameters_count = tvb_get_uint8(tvb, offset);
678
1
    proto_tree_add_item(payload_tree, hf_uci_parameters_count,
679
1
        tvb, offset, 1, ENC_NA);
680
1
    offset += 1;
681
682
1
    if (parameters_count == 0) {
683
0
        return;
684
0
    }
685
686
1
    proto_tree *parameters_tree =
687
1
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
688
1
            ett_uci_parameters, NULL, "Parameters");
689
690
5
    for (int idx = 0; idx < parameters_count; idx++) {
691
4
        int parameter_type = tvb_get_uint8(tvb, offset + 0);
692
693
4
        proto_tree *parameter_tree =
694
4
            proto_tree_add_subtree(parameters_tree, tvb, offset, 2,
695
4
                ett_uci_parameter, NULL,
696
4
                val_to_str(parameter_type, parameter_type_vals, "Unknown (0x%02x)"));
697
698
4
        proto_tree_add_item(parameter_tree, hf_uci_parameter_type, tvb, offset, 1, ENC_NA);
699
4
        offset += 1;
700
4
        proto_tree_add_item(parameter_tree, hf_uci_parameter_status, tvb, offset, 1, ENC_NA);
701
4
        offset += 1;
702
4
    }
703
1
}
704
705
static void dissect_core_generic_error_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
706
                                          proto_tree *payload_tree)
707
0
{
708
0
    col_set_str(pinfo->cinfo, COL_INFO, "Core Generic Error Ntf");
709
0
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
710
0
}
711
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)
714
498
{
715
498
    if (message_type == UCI_MT_COMMAND &&
716
498
        opcode_id == UCI_OID_CORE_DEVICE_RESET) {
717
1
        dissect_core_device_reset_cmd(tvb, offset, pinfo, payload_tree);
718
1
    }
719
497
    else if (message_type == UCI_MT_RESPONSE &&
720
497
        opcode_id == UCI_OID_CORE_DEVICE_RESET) {
721
4
        dissect_core_device_reset_rsp(tvb, offset, pinfo, payload_tree);
722
4
    }
723
493
    else if (message_type == UCI_MT_NOTIFICATION &&
724
493
        opcode_id == UCI_OID_CORE_DEVICE_STATUS_NTF) {
725
0
        dissect_core_device_status_ntf(tvb, offset, pinfo, payload_tree);
726
0
    }
727
493
    else if (message_type == UCI_MT_COMMAND &&
728
493
        opcode_id == UCI_OID_CORE_GET_DEVICE_INFO) {
729
2
        dissect_core_get_device_info_cmd(tvb, offset, pinfo, payload_tree);
730
2
    }
731
491
    else if (message_type == UCI_MT_RESPONSE &&
732
491
        opcode_id == UCI_OID_CORE_GET_DEVICE_INFO) {
733
1
        dissect_core_get_device_info_rsp(tvb, offset, pinfo, payload_tree);
734
1
    }
735
490
    else if (message_type == UCI_MT_COMMAND &&
736
490
        opcode_id == UCI_OID_CORE_GET_CAPS_INFO) {
737
3
        dissect_core_get_caps_info_cmd(tvb, offset, pinfo, payload_tree);
738
3
    }
739
487
    else if (message_type == UCI_MT_RESPONSE &&
740
487
        opcode_id == UCI_OID_CORE_GET_CAPS_INFO) {
741
0
        dissect_core_get_caps_info_rsp(tvb, offset, pinfo, payload_tree);
742
0
    }
743
487
    else if (message_type == UCI_MT_COMMAND &&
744
487
        opcode_id == UCI_OID_CORE_GET_CONFIG) {
745
1
        dissect_core_get_config_cmd(tvb, offset, pinfo, payload_tree);
746
1
    }
747
486
    else if (message_type == UCI_MT_RESPONSE &&
748
486
        opcode_id == UCI_OID_CORE_GET_CONFIG) {
749
0
        dissect_core_get_config_rsp(tvb, offset, pinfo, payload_tree);
750
0
    }
751
486
    else if (message_type == UCI_MT_COMMAND &&
752
486
        opcode_id == UCI_OID_CORE_SET_CONFIG) {
753
3
        dissect_core_set_config_cmd(tvb, offset, pinfo, payload_tree);
754
3
    }
755
483
    else if (message_type == UCI_MT_RESPONSE &&
756
483
        opcode_id == UCI_OID_CORE_SET_CONFIG) {
757
1
        dissect_core_set_config_rsp(tvb, offset, pinfo, payload_tree);
758
1
    }
759
482
    else if (message_type == UCI_MT_NOTIFICATION &&
760
482
        opcode_id == UCI_OID_CORE_GENERIC_ERROR_NTF) {
761
0
        dissect_core_generic_error_ntf(tvb, offset, pinfo, payload_tree);
762
0
    }
763
482
    else if (message_type == UCI_MT_COMMAND) {
764
11
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Cmd (%02x)", opcode_id);
765
11
    }
766
471
    else if (message_type == UCI_MT_RESPONSE) {
767
4
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Rsp (%02x)", opcode_id);
768
4
    }
769
467
    else {
770
467
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Ntf (%02x)", opcode_id);
771
467
    }
772
498
}
773
774
static void dissect_session_init_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
775
                                    proto_tree *payload_tree)
776
2
{
777
2
    col_set_str(pinfo->cinfo, COL_INFO, "Session Init Cmd");
778
2
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
779
2
    offset += 4;
780
2
    proto_tree_add_item(payload_tree, hf_uci_session_type, tvb, offset, 1, ENC_NA);
781
2
}
782
783
static void dissect_session_init_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
784
                                    proto_tree *payload_tree)
785
0
{
786
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Init Rsp");
787
0
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
788
0
}
789
790
static void dissect_session_deinit_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
791
                                      proto_tree *payload_tree)
792
1
{
793
1
    col_set_str(pinfo->cinfo, COL_INFO, "Session Deinit Cmd");
794
1
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
795
1
}
796
797
static void dissect_session_deinit_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
798
                                      proto_tree *payload_tree)
799
10
{
800
10
    col_set_str(pinfo->cinfo, COL_INFO, "Session Deinit Rsp");
801
10
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
802
10
}
803
804
static void dissect_session_status_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
805
                                      proto_tree *payload_tree)
806
2
{
807
2
    col_set_str(pinfo->cinfo, COL_INFO, "Session Status Ntf");
808
2
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
809
2
    offset += 4;
810
2
    proto_tree_add_item(payload_tree, hf_uci_session_state, tvb, offset, 1, ENC_NA);
811
2
}
812
813
static void dissect_app_config_parameters(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
814
                               proto_tree *payload_tree)
815
5
{
816
5
    int app_config_parameters_count = tvb_get_uint8(tvb, offset);
817
5
    proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count,
818
5
        tvb, offset, 1, ENC_NA);
819
5
    offset += 1;
820
821
5
    if (app_config_parameters_count == 0) {
822
0
        return;
823
0
    }
824
825
5
    proto_tree *app_config_parameters_tree =
826
5
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
827
5
            ett_uci_app_config_parameters, NULL, "App Configurations");
828
829
27
    for (int idx = 0; idx < app_config_parameters_count; idx++) {
830
22
        int app_config_parameter_id = tvb_get_uint8(tvb, offset + 0);
831
22
        int app_config_parameter_len = tvb_get_uint8(tvb, offset + 1);
832
22
        proto_tree *app_config_parameter_tree =
833
22
            proto_tree_add_subtree(app_config_parameters_tree, tvb, offset,
834
22
                2 + app_config_parameter_len, ett_uci_app_config_parameter, NULL,
835
22
                val_to_str(app_config_parameter_id, app_config_parameter_type_vals, "Unknown (0x%02x)"));
836
837
22
        proto_tree_add_item(app_config_parameter_tree,
838
22
            hf_uci_app_config_parameter_type, tvb, offset, 1, ENC_NA);
839
22
        offset += 1;
840
22
        proto_tree_add_item(app_config_parameter_tree,
841
22
            hf_uci_app_config_parameter_len, tvb, offset, 1, ENC_NA);
842
22
        offset += 1;
843
22
        proto_tree_add_item(app_config_parameter_tree,
844
22
            hf_uci_app_config_parameter_value, tvb, offset,
845
22
            app_config_parameter_len, ENC_NA);
846
22
        offset += app_config_parameter_len;
847
22
    }
848
5
}
849
850
static void dissect_session_set_app_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
851
                                              proto_tree *payload_tree)
852
0
{
853
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Set App Config Cmd");
854
0
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
855
0
    offset += 4;
856
0
    dissect_app_config_parameters(tvb, offset, pinfo, payload_tree);
857
0
}
858
859
static void dissect_session_set_app_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
860
                                              proto_tree *payload_tree)
861
1
{
862
1
    col_set_str(pinfo->cinfo, COL_INFO, "Session Set App Config Rsp");
863
1
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
864
1
    offset += 1;
865
866
1
    int app_config_parameters_count = tvb_get_uint8(tvb, offset);
867
1
    proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count,
868
1
        tvb, offset, 1, ENC_NA);
869
1
    offset += 1;
870
871
1
    if (app_config_parameters_count == 0) {
872
0
        return;
873
0
    }
874
875
1
    proto_tree *app_config_parameters_tree =
876
1
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
877
1
            ett_uci_app_config_parameters, NULL, "App Configurations");
878
879
33
    for (int idx = 0; idx < app_config_parameters_count; idx++) {
880
32
        int app_config_parameter_type = tvb_get_uint8(tvb, offset + 0);
881
882
32
        proto_tree *app_config_parameter_tree =
883
32
            proto_tree_add_subtree(app_config_parameters_tree, tvb, offset, 2,
884
32
                ett_uci_app_config_parameter, NULL,
885
32
                val_to_str(app_config_parameter_type, app_config_parameter_type_vals, "Unknown (0x%02x)"));
886
887
32
        proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_type, tvb, offset, 1, ENC_NA);
888
32
        offset += 1;
889
32
        proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_status, tvb, offset, 1, ENC_NA);
890
32
        offset += 1;
891
32
    }
892
1
}
893
894
static void dissect_session_get_app_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
895
                                              proto_tree *payload_tree)
896
0
{
897
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Get App Config Cmd");
898
0
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
899
0
    offset += 4;
900
901
0
    int app_config_parameters_count = tvb_get_uint8(tvb, offset);
902
0
    proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count, tvb, offset, 1, ENC_NA);
903
0
    offset += 1;
904
905
0
    if (app_config_parameters_count == 0) {
906
0
        return;
907
0
    }
908
909
0
    proto_tree *app_config_parameters_tree =
910
0
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
911
0
            ett_uci_app_config_parameters, NULL, "App Configuration IDs");
912
913
0
    for (int idx = 0; idx < app_config_parameters_count; idx++) {
914
0
        int app_config_parameter_id = tvb_get_uint8(tvb, offset);
915
916
0
        proto_tree *app_config_parameter_tree =
917
0
            proto_tree_add_subtree(app_config_parameters_tree, tvb, offset, 1,
918
0
                ett_uci_app_config_parameter, NULL,
919
0
                val_to_str(app_config_parameter_id, app_config_parameter_type_vals, "Unknown (0x%02x)"));
920
921
0
        proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_type,
922
0
            tvb, offset, 1, ENC_NA);
923
924
0
        offset += 1;
925
0
    }
926
0
}
927
928
static void dissect_session_get_app_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
929
                                              proto_tree *payload_tree)
930
5
{
931
5
    col_set_str(pinfo->cinfo, COL_INFO, "Session Get App Config Rsp");
932
5
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
933
5
    offset += 1;
934
5
    dissect_app_config_parameters(tvb, offset, pinfo, payload_tree);
935
5
}
936
937
static void dissect_session_get_count_cmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
938
                                         proto_tree *payload_tree _U_)
939
1
{
940
1
    col_set_str(pinfo->cinfo, COL_INFO, "Session Get Count Cmd");
941
1
}
942
943
static void dissect_session_get_count_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
944
                                         proto_tree *payload_tree)
945
0
{
946
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Get Count Rsp");
947
0
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
948
0
    offset += 1;
949
0
    proto_tree_add_item(payload_tree, hf_uci_session_count, tvb, offset, 1, ENC_NA);
950
0
}
951
952
static void dissect_session_get_state_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
953
                                         proto_tree *payload_tree)
954
0
{
955
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Get State Cmd");
956
0
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
957
0
}
958
959
static void dissect_session_get_state_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
960
                                         proto_tree *payload_tree)
961
0
{
962
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Get State Rsp");
963
0
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
964
0
    offset += 1;
965
0
    proto_tree_add_item(payload_tree, hf_uci_session_state, tvb, offset, 1, ENC_NA);
966
0
}
967
968
static void dissect_session_update_controller_multicast_list_cmd(
969
    tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
970
1
{
971
1
    col_set_str(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Cmd");
972
1
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
973
1
    offset += 4;
974
1
    proto_tree_add_item(payload_tree, hf_uci_update_controller_multicast_list_action,
975
1
        tvb, offset, 1, ENC_NA);
976
1
    offset += 1;
977
978
1
    int controlees_count = tvb_get_uint8(tvb, offset);
979
1
    proto_tree_add_item(payload_tree, hf_uci_controlees_count,
980
1
        tvb, offset, 1, ENC_NA);
981
1
    offset += 1;
982
983
1
    if (controlees_count == 0) {
984
0
        return;
985
0
    }
986
987
1
    proto_tree *controlee_list_tree =
988
1
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
989
1
            ett_uci_controlee_list, NULL, "Controlee List");
990
991
6
    for (int idx = 0; idx < controlees_count; idx++) {
992
5
        proto_tree *controlee_tree =
993
5
            proto_tree_add_subtree(controlee_list_tree, tvb, offset, -1,
994
5
                ett_uci_controlee, NULL, "Controlee");
995
996
5
        proto_tree_add_item(controlee_tree, hf_uci_controlee_short_address,
997
5
            tvb, offset, 2, ENC_LITTLE_ENDIAN);
998
5
        offset += 2;
999
5
        proto_tree_add_item(controlee_tree, hf_uci_controlee_subsession_id,
1000
5
            tvb, offset, 4, ENC_LITTLE_ENDIAN);
1001
5
        offset += 4;
1002
5
    }
1003
1
}
1004
1005
static void dissect_session_update_controller_multicast_list_rsp(
1006
    tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
1007
0
{
1008
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Rsp");
1009
0
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1010
0
}
1011
1012
static void dissect_session_update_controller_multicast_list_ntf(
1013
    tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
1014
0
{
1015
0
    col_set_str(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Ntf");
1016
0
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1017
0
    offset += 4;
1018
0
    proto_tree_add_item(payload_tree, hf_uci_remaining_multicast_list_size,
1019
0
        tvb, offset, 1, ENC_NA);
1020
0
    offset += 1;
1021
1022
0
    int controlees_count = tvb_get_uint8(tvb, offset);
1023
0
    proto_tree_add_item(payload_tree, hf_uci_controlees_count,
1024
0
        tvb, offset, 1, ENC_NA);
1025
0
    offset += 1;
1026
1027
0
    if (controlees_count == 0) {
1028
0
        return;
1029
0
    }
1030
1031
0
    proto_tree *controlee_list_tree =
1032
0
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
1033
0
            ett_uci_controlee_list, NULL, "Controlee List");
1034
1035
0
    for (int idx = 0; idx < controlees_count; idx++) {
1036
0
        proto_tree *controlee_tree =
1037
0
            proto_tree_add_subtree(controlee_list_tree, tvb, offset, -1,
1038
0
                ett_uci_controlee, NULL, "Controlee");
1039
1040
0
        proto_tree_add_item(controlee_tree, hf_uci_controlee_short_address,
1041
0
            tvb, offset, 2, ENC_LITTLE_ENDIAN);
1042
0
        offset += 2;
1043
0
        proto_tree_add_item(controlee_tree, hf_uci_controlee_subsession_id,
1044
0
            tvb, offset, 4, ENC_LITTLE_ENDIAN);
1045
0
        offset += 4;
1046
0
        proto_tree_add_item(controlee_tree, hf_uci_controlee_status,
1047
0
            tvb, offset, 1, ENC_NA);
1048
0
        offset += 1;
1049
0
    }
1050
0
}
1051
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)
1054
90
{
1055
90
    if (message_type == UCI_MT_COMMAND &&
1056
90
        opcode_id == UCI_OID_SESSION_INIT) {
1057
2
        dissect_session_init_cmd(tvb, offset, pinfo, payload_tree);
1058
2
    }
1059
88
    else if (message_type == UCI_MT_RESPONSE &&
1060
88
        opcode_id == UCI_OID_SESSION_INIT) {
1061
0
        dissect_session_init_rsp(tvb, offset, pinfo, payload_tree);
1062
0
    }
1063
88
    else if (message_type == UCI_MT_COMMAND &&
1064
88
        opcode_id == UCI_OID_SESSION_DEINIT) {
1065
1
        dissect_session_deinit_cmd(tvb, offset, pinfo, payload_tree);
1066
1
    }
1067
87
    else if (message_type == UCI_MT_RESPONSE &&
1068
87
        opcode_id == UCI_OID_SESSION_DEINIT) {
1069
10
        dissect_session_deinit_rsp(tvb, offset, pinfo, payload_tree);
1070
10
    }
1071
77
    else if (message_type == UCI_MT_NOTIFICATION &&
1072
77
        opcode_id == UCI_OID_SESSION_STATUS_NTF) {
1073
2
        dissect_session_status_ntf(tvb, offset, pinfo, payload_tree);
1074
2
    }
1075
75
    else if (message_type == UCI_MT_COMMAND &&
1076
75
        opcode_id == UCI_OID_SESSION_SET_APP_CONFIG) {
1077
0
        dissect_session_set_app_config_cmd(tvb, offset, pinfo, payload_tree);
1078
0
    }
1079
75
    else if (message_type == UCI_MT_RESPONSE &&
1080
75
        opcode_id == UCI_OID_SESSION_SET_APP_CONFIG) {
1081
1
        dissect_session_set_app_config_rsp(tvb, offset, pinfo, payload_tree);
1082
1
    }
1083
74
    else if (message_type == UCI_MT_COMMAND &&
1084
74
        opcode_id == UCI_OID_SESSION_GET_APP_CONFIG) {
1085
0
        dissect_session_get_app_config_cmd(tvb, offset, pinfo, payload_tree);
1086
0
    }
1087
74
    else if (message_type == UCI_MT_RESPONSE &&
1088
74
        opcode_id == UCI_OID_SESSION_GET_APP_CONFIG) {
1089
5
        dissect_session_get_app_config_rsp(tvb, offset, pinfo, payload_tree);
1090
5
    }
1091
69
    else if (message_type == UCI_MT_COMMAND &&
1092
69
        opcode_id == UCI_OID_SESSION_GET_COUNT) {
1093
1
        dissect_session_get_count_cmd(tvb, offset, pinfo, payload_tree);
1094
1
    }
1095
68
    else if (message_type == UCI_MT_RESPONSE &&
1096
68
        opcode_id == UCI_OID_SESSION_GET_COUNT) {
1097
0
        dissect_session_get_count_rsp(tvb, offset, pinfo, payload_tree);
1098
0
    }
1099
68
    else if (message_type == UCI_MT_COMMAND &&
1100
68
        opcode_id == UCI_OID_SESSION_GET_STATE) {
1101
0
        dissect_session_get_state_cmd(tvb, offset, pinfo, payload_tree);
1102
0
    }
1103
68
    else if (message_type == UCI_MT_RESPONSE &&
1104
68
        opcode_id == UCI_OID_SESSION_GET_STATE) {
1105
0
        dissect_session_get_state_rsp(tvb, offset, pinfo, payload_tree);
1106
0
    }
1107
68
    else if (message_type == UCI_MT_COMMAND &&
1108
68
        opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
1109
1
        dissect_session_update_controller_multicast_list_cmd(tvb, offset, pinfo, payload_tree);
1110
1
    }
1111
67
    else if (message_type == UCI_MT_RESPONSE &&
1112
67
        opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
1113
0
        dissect_session_update_controller_multicast_list_rsp(tvb, offset, pinfo, payload_tree);
1114
0
    }
1115
67
    else if (message_type == UCI_MT_NOTIFICATION &&
1116
67
        opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
1117
0
        dissect_session_update_controller_multicast_list_ntf(tvb, offset, pinfo, payload_tree);
1118
0
    }
1119
67
    else if (message_type == UCI_MT_COMMAND) {
1120
12
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Cmd (%02x)", opcode_id);
1121
12
    }
1122
55
    else if (message_type == UCI_MT_RESPONSE) {
1123
1
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Rsp (%02x)", opcode_id);
1124
1
    }
1125
54
    else {
1126
54
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Ntf (%02x)", opcode_id);
1127
54
    }
1128
90
}
1129
1130
static void dissect_range_start_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
1131
                                   proto_tree *payload_tree)
1132
2
{
1133
2
    col_set_str(pinfo->cinfo, COL_INFO, "Range Start Cmd");
1134
2
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1135
2
}
1136
1137
static void dissect_range_start_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
1138
                                   proto_tree *payload_tree)
1139
1
{
1140
1
    col_set_str(pinfo->cinfo, COL_INFO, "Range Start Rsp");
1141
1
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1142
1
}
1143
1144
static void dissect_range_data_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
1145
                                  proto_tree *payload_tree)
1146
2
{
1147
2
    col_set_str(pinfo->cinfo, COL_INFO, "Range Data Ntf");
1148
2
    proto_tree_add_item(payload_tree, hf_uci_sequence_number, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1149
2
    offset += 4;
1150
2
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1151
2
    offset += 4;
1152
2
    offset += 1;
1153
2
    proto_tree_add_item(payload_tree, hf_uci_current_ranging_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1154
2
    offset += 4;
1155
2
    proto_tree_add_item(payload_tree, hf_uci_ranging_measurement_type, tvb, offset, 1, ENC_NA);
1156
2
    offset += 1;
1157
2
    offset += 1;
1158
1159
2
    int mac_addressing_mode_indicator = tvb_get_uint8(tvb, offset);
1160
2
    proto_tree_add_item(payload_tree, hf_uci_mac_addressing_mode_indicator, tvb, offset, 1, ENC_NA);
1161
2
    offset += 1;
1162
2
    offset += 8;
1163
1164
2
    int ranging_measurement_count = tvb_get_uint8(tvb, offset);
1165
2
    proto_tree_add_item(payload_tree, hf_uci_ranging_measurement_count, tvb, offset, 1, ENC_NA);
1166
2
    offset += 1;
1167
1168
2
    if (ranging_measurement_count == 0) {
1169
1
        return;
1170
1
    }
1171
1172
1
    proto_tree *ranging_measurements_tree =
1173
1
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
1174
1
            ett_uci_ranging_measurements, NULL, "Ranging Measurements");
1175
1176
1
    for (int idx = 0; idx < ranging_measurement_count; idx++) {
1177
0
        proto_tree *ranging_measurement_tree;
1178
0
        int padding_len;
1179
1180
0
        if (mac_addressing_mode_indicator == 0) {
1181
0
            ranging_measurement_tree = proto_tree_add_subtree_format(
1182
0
                ranging_measurements_tree, tvb, offset, 31,
1183
0
                ett_uci_ranging_measurement, NULL,
1184
0
                "%02x:%02x",
1185
0
                tvb_get_uint8(tvb, offset + 0),
1186
0
                tvb_get_uint8(tvb, offset + 1));
1187
1188
0
            proto_tree_add_item(ranging_measurement_tree,
1189
0
                hf_uci_mac_address, tvb, offset, 2, ENC_NA);
1190
1191
0
            offset += 2;
1192
0
            padding_len = 12;
1193
0
        } else {
1194
0
            ranging_measurement_tree = proto_tree_add_subtree_format(
1195
0
                ranging_measurements_tree, tvb, offset, 31,
1196
0
                ett_uci_ranging_measurement, NULL,
1197
0
                "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
1198
0
                tvb_get_uint8(tvb, offset + 0),
1199
0
                tvb_get_uint8(tvb, offset + 1),
1200
0
                tvb_get_uint8(tvb, offset + 2),
1201
0
                tvb_get_uint8(tvb, offset + 3),
1202
0
                tvb_get_uint8(tvb, offset + 4),
1203
0
                tvb_get_uint8(tvb, offset + 5),
1204
0
                tvb_get_uint8(tvb, offset + 6),
1205
0
                tvb_get_uint8(tvb, offset + 7));
1206
1207
0
            proto_tree_add_item(ranging_measurement_tree,
1208
0
                hf_uci_mac_address, tvb, offset, 8, ENC_NA);
1209
1210
0
            offset += 8;
1211
0
            padding_len = 6;
1212
0
        }
1213
1214
0
        proto_tree_add_item(ranging_measurement_tree,
1215
0
            hf_uci_status, tvb, offset, 1, ENC_NA);
1216
0
        offset += 1;
1217
0
        proto_tree_add_item(ranging_measurement_tree,
1218
0
            hf_uci_nlos, tvb, offset, 1, ENC_NA);
1219
0
        offset += 1;
1220
0
        proto_tree_add_item(ranging_measurement_tree,
1221
0
            hf_uci_distance, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1222
0
        offset += 2;
1223
0
        proto_tree_add_item(ranging_measurement_tree,
1224
0
            hf_uci_aoa_azimuth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1225
0
        offset += 2;
1226
0
        proto_tree_add_item(ranging_measurement_tree,
1227
0
            hf_uci_aoa_azimuth_fom, tvb, offset, 1, ENC_NA);
1228
0
        offset += 1;
1229
0
        proto_tree_add_item(ranging_measurement_tree,
1230
0
            hf_uci_aoa_elevation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1231
0
        offset += 2;
1232
0
        proto_tree_add_item(ranging_measurement_tree,
1233
0
            hf_uci_aoa_elevation_fom, tvb, offset, 1, ENC_NA);
1234
0
        offset += 1;
1235
0
        proto_tree_add_item(ranging_measurement_tree,
1236
0
            hf_uci_aoa_destination_azimuth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1237
0
        offset += 2;
1238
0
        proto_tree_add_item(ranging_measurement_tree,
1239
0
            hf_uci_aoa_destination_azimuth_fom, tvb, offset, 1, ENC_NA);
1240
0
        offset += 1;
1241
0
        proto_tree_add_item(ranging_measurement_tree,
1242
0
            hf_uci_aoa_destination_elevation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1243
0
        offset += 2;
1244
0
        proto_tree_add_item(ranging_measurement_tree,
1245
0
            hf_uci_aoa_destination_elevation_fom, tvb, offset, 1, ENC_NA);
1246
0
        offset += 1;
1247
0
        proto_tree_add_item(ranging_measurement_tree,
1248
0
            hf_uci_slot_index, tvb, offset, 1, ENC_NA);
1249
0
        offset += 1;
1250
0
        offset += padding_len;
1251
0
    }
1252
1
}
1253
1254
static void dissect_range_stop_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
1255
                                  proto_tree *payload_tree)
1256
1
{
1257
1
    col_set_str(pinfo->cinfo, COL_INFO, "Range Stop Cmd");
1258
1
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1259
1
}
1260
1261
static void dissect_range_stop_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
1262
                                  proto_tree *payload_tree)
1263
1
{
1264
1
    col_set_str(pinfo->cinfo, COL_INFO, "Range Stop Rsp");
1265
1
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1266
1
}
1267
1268
static void dissect_range_get_ranging_count_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
1269
                                               proto_tree *payload_tree)
1270
0
{
1271
0
    col_set_str(pinfo->cinfo, COL_INFO, "Range Get Ranging Count Cmd");
1272
0
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1273
0
}
1274
1275
static void dissect_range_get_ranging_count_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
1276
                                               proto_tree *payload_tree)
1277
1
{
1278
1
    col_set_str(pinfo->cinfo, COL_INFO, "Range Get Ranging Count Rsp");
1279
1
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
1280
1
    offset += 1;
1281
1
    proto_tree_add_item(payload_tree, hf_uci_ranging_count, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1282
1
}
1283
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)
1286
88
{
1287
88
    if (message_type == UCI_MT_COMMAND &&
1288
88
        opcode_id == UCI_OID_RANGE_START) {
1289
2
        dissect_range_start_cmd(tvb, offset, pinfo, payload_tree);
1290
2
    }
1291
86
    else if (message_type == UCI_MT_RESPONSE &&
1292
86
        opcode_id == UCI_OID_RANGE_START) {
1293
1
        dissect_range_start_rsp(tvb, offset, pinfo, payload_tree);
1294
1
    }
1295
85
    else if (message_type == UCI_MT_NOTIFICATION &&
1296
85
        opcode_id == UCI_OID_RANGE_DATA) {
1297
2
        dissect_range_data_ntf(tvb, offset, pinfo, payload_tree);
1298
2
    }
1299
83
    else if (message_type == UCI_MT_COMMAND &&
1300
83
        opcode_id == UCI_OID_RANGE_STOP) {
1301
1
        dissect_range_stop_cmd(tvb, offset, pinfo, payload_tree);
1302
1
    }
1303
82
    else if (message_type == UCI_MT_RESPONSE &&
1304
82
        opcode_id == UCI_OID_RANGE_STOP) {
1305
1
        dissect_range_stop_rsp(tvb, offset, pinfo, payload_tree);
1306
1
    }
1307
81
    else if (message_type == UCI_MT_COMMAND &&
1308
81
        opcode_id == UCI_OID_RANGE_GET_RANGING_COUNT) {
1309
0
        dissect_range_get_ranging_count_cmd(tvb, offset, pinfo, payload_tree);
1310
0
    }
1311
81
    else if (message_type == UCI_MT_RESPONSE &&
1312
81
        opcode_id == UCI_OID_RANGE_GET_RANGING_COUNT) {
1313
1
        dissect_range_get_ranging_count_rsp(tvb, offset, pinfo, payload_tree);
1314
1
    }
1315
80
    else if (message_type == UCI_MT_COMMAND) {
1316
21
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Cmd (%02x)", opcode_id);
1317
21
    }
1318
59
    else if (message_type == UCI_MT_RESPONSE) {
1319
3
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Rsp (%02x)", opcode_id);
1320
3
    }
1321
56
    else {
1322
56
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Ntf (%02x)", opcode_id);
1323
56
    }
1324
88
}
1325
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)
1328
63
{
1329
63
    if (message_type == UCI_MT_COMMAND) {
1330
12
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Cmd (%02x)", opcode_id);
1331
12
    }
1332
51
    else if (message_type == UCI_MT_RESPONSE) {
1333
20
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Rsp (%02x)", opcode_id);
1334
20
    }
1335
31
    else {
1336
31
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Ntf (%02x)", opcode_id);
1337
31
    }
1338
63
}
1339
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)
1342
54
{
1343
54
    if (message_type == UCI_MT_COMMAND) {
1344
22
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Cmd (%02x)", opcode_id);
1345
22
    }
1346
32
    else if (message_type == UCI_MT_RESPONSE) {
1347
4
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Rsp (%02x)", opcode_id);
1348
4
    }
1349
28
    else {
1350
28
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Ntf (%02x)", opcode_id);
1351
28
    }
1352
54
}
1353
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)
1356
262
{
1357
262
    if (message_type == UCI_MT_COMMAND) {
1358
43
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Cmd (%02x)", group_id, opcode_id);
1359
43
    }
1360
219
    else if (message_type == UCI_MT_RESPONSE) {
1361
36
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Rsp (%02x)", group_id, opcode_id);
1362
36
    }
1363
183
    else {
1364
183
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Ntf (%02x)", group_id, opcode_id);
1365
183
    }
1366
262
}
1367
1368
static int dissect_uci_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1369
1.05k
{
1370
1.05k
    proto_item *ti;
1371
1.05k
    proto_tree *packet_tree;
1372
1.05k
    proto_tree *header_tree;
1373
1.05k
    proto_tree *payload_tree;
1374
1.05k
    int message_type;
1375
1.05k
    int group_id;
1376
1.05k
    int opcode_id;
1377
1.05k
    int payload_len;
1378
1.05k
    int offset = 0;
1379
1380
1.05k
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "UCI");
1381
1.05k
    col_clear(pinfo->cinfo, COL_INFO);
1382
1383
1.05k
    ti = proto_tree_add_item(tree, proto_uci, tvb, 0, -1, ENC_NA);
1384
1.05k
    packet_tree = proto_item_add_subtree(ti, ett_uci);
1385
1.05k
    header_tree = proto_tree_add_subtree(packet_tree, tvb, offset, UCI_PACKET_HEADER_LEN, ett_uci_header, NULL, "UCI Packet Header");
1386
1387
1.05k
    proto_tree_add_item(header_tree, hf_uci_message_type, tvb, offset + 0, 1, ENC_NA);
1388
1.05k
    proto_tree_add_item(header_tree, hf_uci_packet_boundary_flag, tvb, offset + 0, 1, ENC_NA);
1389
1.05k
    proto_tree_add_item(header_tree, hf_uci_group_id, tvb, offset + 0, 1, ENC_NA);
1390
1.05k
    proto_tree_add_item(header_tree, hf_uci_opcode_id, tvb, offset + 1, 1, ENC_NA);
1391
1.05k
    proto_tree_add_item(header_tree, hf_uci_payload_length, tvb, offset + 3, 1, ENC_NA);
1392
1393
1.05k
    message_type = (tvb_get_uint8(tvb, offset + 0) >> 5) & 0x07;
1394
1.05k
    group_id = (tvb_get_uint8(tvb, offset + 0) >> 0) & 0x0f;
1395
1.05k
    opcode_id = tvb_get_uint8(tvb, offset + 1) & 0x3f;
1396
1.05k
    payload_len = tvb_get_uint8(tvb, offset + 3);
1397
1398
1.05k
    offset += UCI_PACKET_HEADER_LEN;
1399
1.05k
    payload_tree = proto_tree_add_subtree(packet_tree, tvb, offset, payload_len, ett_uci_payload, NULL, "UCI Packet Payload");
1400
1401
1.05k
    switch (group_id) {
1402
498
    case UCI_GID_CORE: dissect_uci_core_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1403
90
    case UCI_GID_SESSION_CONFIG: dissect_uci_session_config_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1404
88
    case UCI_GID_RANGING_SESSION_CONTROL: dissect_uci_ranging_session_control_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1405
63
    case UCI_GID_DATA_CONTROL: dissect_uci_data_control_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1406
54
    case UCI_GID_TEST: dissect_uci_test_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
1407
262
    default: dissect_uci_vendor_pdu(tvb, offset, pinfo, payload_tree, message_type, group_id, opcode_id); break;
1408
1.05k
    }
1409
1410
1.03k
    return tvb_reported_length(tvb);
1411
1.05k
}
1412
1413
static int dissect_uci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1414
83
{
1415
83
    tcp_dissect_pdus(tvb, pinfo, tree, gPREF_TCP_DESEGMENT, UCI_PACKET_HEADER_LEN,
1416
83
        get_uci_pdu_len, dissect_uci_pdu, data);
1417
83
    return tvb_reported_length(tvb);
1418
83
}
1419
1420
void proto_register_uci(void)
1421
14
{
1422
14
    static hf_register_info hf[] = {
1423
14
        { &hf_uci_message_type,
1424
14
            { "UCI Message Type", "uci.mt",
1425
14
                FT_UINT8, BASE_DEC,
1426
14
                VALS(message_type_vals), 0xe0,
1427
14
                NULL, HFILL }
1428
14
        },
1429
14
        { &hf_uci_packet_boundary_flag,
1430
14
            { "UCI Packet Boundary Flag", "uci.pbf",
1431
14
                FT_UINT8, BASE_HEX,
1432
14
                VALS(packet_boundary_flag_vals), 0x10,
1433
14
                NULL, HFILL }
1434
14
        },
1435
14
        { &hf_uci_group_id,
1436
14
            { "UCI Group Identifier", "uci.gid",
1437
14
                FT_UINT8, BASE_HEX,
1438
14
                VALS(group_id_vals), 0x0f,
1439
14
                NULL, HFILL }
1440
14
        },
1441
14
        { &hf_uci_opcode_id,
1442
14
            { "UCI Opcode Identifier", "uci.oid",
1443
14
                FT_UINT8, BASE_HEX,
1444
14
                NULL, 0x3f,
1445
14
                NULL, HFILL }
1446
14
        },
1447
14
        { &hf_uci_payload_length,
1448
14
            { "UCI Payload Length", "uci.len",
1449
14
                FT_UINT8, BASE_DEC,
1450
14
                NULL, 0x0,
1451
14
                NULL, HFILL }
1452
14
        },
1453
14
        { &hf_uci_status,
1454
14
            { "Status", "uci.status",
1455
14
                FT_UINT8, BASE_DEC,
1456
14
                VALS(status_vals), 0x0,
1457
14
                NULL, HFILL }
1458
14
        },
1459
14
        { &hf_uci_reset_config,
1460
14
            { "Reset Config", "uci.reset_config",
1461
14
                FT_UINT8, BASE_DEC,
1462
14
                VALS(reset_config_vals), 0x0,
1463
14
                NULL, HFILL }
1464
14
        },
1465
14
        { &hf_uci_device_state,
1466
14
            { "Device State", "uci.device_state",
1467
14
                FT_UINT8, BASE_DEC,
1468
14
                VALS(device_state_vals), 0x0,
1469
14
                NULL, HFILL }
1470
14
        },
1471
14
        { &hf_uci_version_major,
1472
14
            { "Major Version", "uci.major_version",
1473
14
                FT_UINT16, BASE_DEC,
1474
14
                NULL, 0x00ff,
1475
14
                NULL, HFILL }
1476
14
        },
1477
14
        { &hf_uci_version_minor,
1478
14
            { "Minor Version", "uci.minor_version",
1479
14
                FT_UINT16, BASE_DEC,
1480
14
                NULL, 0xf000,
1481
14
                NULL, HFILL }
1482
14
        },
1483
14
        { &hf_uci_maintenance_number,
1484
14
            { "Maintenance Number", "uci.maintenance_number",
1485
14
                FT_UINT16, BASE_DEC,
1486
14
                NULL, 0x0f00,
1487
14
                NULL, HFILL }
1488
14
        },
1489
14
        { &hf_uci_generic_version,
1490
14
            { "UCI Generic Version", "uci.generic_version",
1491
14
                FT_UINT16, BASE_HEX,
1492
14
                NULL, 0x0,
1493
14
                NULL, HFILL }
1494
14
        },
1495
14
        { &hf_uci_mac_version,
1496
14
            { "MAC Version", "uci.mac_version",
1497
14
                FT_UINT16, BASE_HEX,
1498
14
                NULL, 0x0,
1499
14
                NULL, HFILL }
1500
14
        },
1501
14
        { &hf_uci_phy_version,
1502
14
            { "PHY Version", "uci.phy_version",
1503
14
                FT_UINT16, BASE_HEX,
1504
14
                NULL, 0x0,
1505
14
                NULL, HFILL }
1506
14
        },
1507
14
        { &hf_uci_test_version,
1508
14
            { "UCI Test Version", "uci.test_version",
1509
14
                FT_UINT16, BASE_HEX,
1510
14
                NULL, 0x0,
1511
14
                NULL, HFILL }
1512
14
        },
1513
14
        { &hf_uci_vendor_specific_information_length,
1514
14
            { "Vendor Specific Information Length", "uci.vendor_specific_information_len",
1515
14
                FT_UINT8, BASE_DEC,
1516
14
                NULL, 0x0,
1517
14
                NULL, HFILL }
1518
14
        },
1519
14
        { &hf_uci_vendor_specific_information,
1520
14
            { "Vendor Specific Information", "uci.vendor_specific_information",
1521
14
                FT_BYTES, BASE_NONE,
1522
14
                NULL, 0x0,
1523
14
                NULL, HFILL }
1524
14
        },
1525
14
        { &hf_uci_capability_parameters_count,
1526
14
            { "Number of Capability Parameters", "uci.capability_parameters_count",
1527
14
                FT_UINT8, BASE_DEC,
1528
14
                NULL, 0x0,
1529
14
                NULL, HFILL }
1530
14
        },
1531
14
        { &hf_uci_capability_parameter_type,
1532
14
            { "Type", "uci.capability_parameter.type",
1533
14
                FT_UINT8, BASE_HEX,
1534
14
                VALS(capability_parameter_type_vals), 0x0,
1535
14
                NULL, HFILL }
1536
14
        },
1537
14
        { &hf_uci_capability_parameter_len,
1538
14
            { "Length", "uci.capability_parameter.len",
1539
14
                FT_UINT8, BASE_DEC,
1540
14
                NULL, 0x0,
1541
14
                NULL, HFILL }
1542
14
        },
1543
14
        { &hf_uci_capability_parameter_value,
1544
14
            { "Value", "uci.capability_parameter.value",
1545
14
                FT_BYTES, BASE_NONE,
1546
14
                NULL, 0x0,
1547
14
                NULL, HFILL }
1548
14
        },
1549
14
        { &hf_uci_parameters_count,
1550
14
            { "Number of Parameters", "uci.parameters_count",
1551
14
                FT_UINT8, BASE_DEC,
1552
14
                NULL, 0x0,
1553
14
                NULL, HFILL }
1554
14
        },
1555
14
        { &hf_uci_parameter_type,
1556
14
            { "Type", "uci.parameter.type",
1557
14
                FT_UINT8, BASE_DEC,
1558
14
                VALS(parameter_type_vals), 0x0,
1559
14
                NULL, HFILL }
1560
14
        },
1561
14
        { &hf_uci_parameter_len,
1562
14
            { "Length", "uci.parameter.len",
1563
14
                FT_UINT8, BASE_DEC,
1564
14
                NULL, 0x0,
1565
14
                NULL, HFILL }
1566
14
        },
1567
14
        { &hf_uci_parameter_value,
1568
14
            { "Value", "uci.parameter.value",
1569
14
                FT_BYTES, BASE_NONE,
1570
14
                NULL, 0x0,
1571
14
                NULL, HFILL }
1572
14
        },
1573
14
        { &hf_uci_parameter_status,
1574
14
            { "Status", "uci.parameter.status",
1575
14
                FT_UINT8, BASE_HEX,
1576
14
                VALS(status_vals), 0x0,
1577
14
                NULL, HFILL }
1578
14
        },
1579
14
        { &hf_uci_session_id,
1580
14
            { "Session ID", "uci.session_id",
1581
14
                FT_UINT32, BASE_HEX,
1582
14
                NULL, 0x0,
1583
14
                NULL, HFILL }
1584
14
        },
1585
14
        { &hf_uci_session_type,
1586
14
            { "Session Type", "uci.session_type",
1587
14
                FT_UINT8, BASE_HEX,
1588
14
                VALS(session_type_vals), 0x0,
1589
14
                NULL, HFILL }
1590
14
        },
1591
14
        { &hf_uci_session_state,
1592
14
            { "Session Type", "uci.session_state",
1593
14
                FT_UINT8, BASE_HEX,
1594
14
                VALS(session_state_vals), 0x0,
1595
14
                NULL, HFILL }
1596
14
        },
1597
14
        { &hf_uci_session_count,
1598
14
            { "Session Count", "uci.session_count",
1599
14
                FT_UINT8, BASE_DEC,
1600
14
                NULL, 0x0,
1601
14
                NULL, HFILL }
1602
14
        },
1603
14
        { &hf_uci_app_config_parameters_count,
1604
14
            { "Number of App Configurations", "uci.app_config_parameters_count",
1605
14
                FT_UINT8, BASE_DEC,
1606
14
                NULL, 0x0,
1607
14
                NULL, HFILL }
1608
14
        },
1609
14
        { &hf_uci_app_config_parameter_type,
1610
14
            { "Type", "uci.app_config_parameter.type",
1611
14
                FT_UINT8, BASE_DEC,
1612
14
                VALS(app_config_parameter_type_vals), 0x0,
1613
14
                NULL, HFILL }
1614
14
        },
1615
14
        { &hf_uci_app_config_parameter_len,
1616
14
            { "Length", "uci.app_config_parameter.len",
1617
14
                FT_UINT8, BASE_DEC,
1618
14
                NULL, 0x0,
1619
14
                NULL, HFILL }
1620
14
        },
1621
14
        { &hf_uci_app_config_parameter_value,
1622
14
            { "Value", "uci.app_config_parameter.value",
1623
14
                FT_BYTES, BASE_NONE,
1624
14
                NULL, 0x0,
1625
14
                NULL, HFILL }
1626
14
        },
1627
14
        { &hf_uci_app_config_parameter_status,
1628
14
            { "Status", "uci.app_config_parameter.status",
1629
14
                FT_UINT8, BASE_HEX,
1630
14
                VALS(status_vals), 0x0,
1631
14
                NULL, HFILL }
1632
14
        },
1633
14
        { &hf_uci_update_controller_multicast_list_action,
1634
14
            { "Action", "uci.update_controller_multicast_list_action",
1635
14
                FT_UINT8, BASE_HEX,
1636
14
                VALS(update_controller_multicast_list_action_vals), 0x0,
1637
14
                NULL, HFILL }
1638
14
        },
1639
14
        { &hf_uci_controlees_count,
1640
14
            { "Number of Controlees", "uci.controlees_count",
1641
14
                FT_UINT8, BASE_DEC,
1642
14
                NULL, 0x0,
1643
14
                NULL, HFILL }
1644
14
        },
1645
14
        { &hf_uci_controlee_short_address,
1646
14
            { "Short Address", "uci.controlee.short_address",
1647
14
                FT_UINT16, BASE_HEX,
1648
14
                NULL, 0x0,
1649
14
                NULL, HFILL }
1650
14
        },
1651
14
        { &hf_uci_controlee_subsession_id,
1652
14
            { "Sub-Session ID", "uci.controlee.subsession_id",
1653
14
                FT_UINT32, BASE_HEX,
1654
14
                NULL, 0x0,
1655
14
                NULL, HFILL }
1656
14
        },
1657
14
        { &hf_uci_controlee_status,
1658
14
            { "Status", "uci.controlee.status",
1659
14
                FT_UINT8, BASE_HEX,
1660
14
                VALS(multicast_update_status_vals), 0x0,
1661
14
                NULL, HFILL }
1662
14
        },
1663
14
        { &hf_uci_remaining_multicast_list_size,
1664
14
            { "Remaining Multicast List Size", "uci.remaining_multicast_list_size",
1665
14
                FT_UINT8, BASE_DEC,
1666
14
                NULL, 0x0,
1667
14
                NULL, HFILL }
1668
1669
14
        },
1670
14
        { &hf_uci_ranging_count,
1671
14
            { "Count", "uci.ranging_count",
1672
14
                FT_UINT32, BASE_DEC,
1673
14
                NULL, 0x0,
1674
14
                NULL, HFILL }
1675
14
        },
1676
14
        { &hf_uci_sequence_number,
1677
14
            { "Sequence Number", "uci.sequence_number",
1678
14
                FT_UINT32, BASE_DEC,
1679
14
                NULL, 0x0,
1680
14
                NULL, HFILL }
1681
14
        },
1682
14
        { &hf_uci_current_ranging_interval,
1683
14
            { "Current Ranging Interval", "uci.current_ranging_interval",
1684
14
                FT_UINT32, BASE_DEC,
1685
14
                NULL, 0x0,
1686
14
                NULL, HFILL }
1687
14
        },
1688
14
        { &hf_uci_ranging_measurement_type,
1689
14
            { "Ranging Measurement Type", "uci.ranging_measurement_type",
1690
14
                FT_UINT8, BASE_HEX,
1691
14
                VALS(ranging_measurement_type_vals), 0x0,
1692
14
                NULL, HFILL }
1693
14
        },
1694
14
        { &hf_uci_mac_addressing_mode_indicator,
1695
14
            { "MAC Addressing Mode Indicator", "uci.mac_addressing_mode_indicator",
1696
14
                FT_UINT8, BASE_HEX,
1697
14
                VALS(mac_addressing_mode_indicator_vals), 0x0,
1698
14
                NULL, HFILL }
1699
14
        },
1700
14
        { &hf_uci_ranging_measurement_count,
1701
14
            { "Number of Ranging Measurements", "uci.ranging_measurement_count",
1702
14
                FT_UINT8, BASE_DEC,
1703
14
                NULL, 0x0,
1704
14
                NULL, HFILL }
1705
14
        },
1706
14
        { &hf_uci_mac_address,
1707
14
            { "MAC Address", "uci.mac_address",
1708
14
                FT_BYTES, BASE_NONE,
1709
14
                NULL, 0x0,
1710
14
                NULL, HFILL }
1711
14
        },
1712
14
        { &hf_uci_nlos,
1713
14
            { "NLoS", "uci.nlos",
1714
14
                FT_UINT8, BASE_HEX,
1715
14
                VALS(nlos_vals), 0x0,
1716
14
                NULL, HFILL }
1717
14
        },
1718
14
        { &hf_uci_distance,
1719
14
            { "Distance", "uci.distance",
1720
14
                FT_UINT16, BASE_DEC,
1721
14
                NULL, 0x0,
1722
14
                NULL, HFILL }
1723
14
        },
1724
14
        { &hf_uci_aoa_azimuth,
1725
14
            { "AoA Azimuth", "uci.aoa_azimuth",
1726
14
                FT_INT16, BASE_DEC,
1727
14
                NULL, 0x0,
1728
14
                NULL, HFILL }
1729
14
        },
1730
14
        { &hf_uci_aoa_azimuth_fom,
1731
14
            { "AoA Azimuth FOM", "uci.aoa_azimuth_fom",
1732
14
                FT_INT8, BASE_DEC,
1733
14
                NULL, 0x0,
1734
14
                NULL, HFILL }
1735
14
        },
1736
14
        { &hf_uci_aoa_elevation,
1737
14
            { "AoA Elevation", "uci.aoa_elevation",
1738
14
                FT_INT16, BASE_DEC,
1739
14
                NULL, 0x0,
1740
14
                NULL, HFILL }
1741
14
        },
1742
14
        { &hf_uci_aoa_elevation_fom,
1743
14
            { "AoA Elevation FOM", "uci.aoa_elevation_fom",
1744
14
                FT_INT8, BASE_DEC,
1745
14
                NULL, 0x0,
1746
14
                NULL, HFILL }
1747
14
        },
1748
14
        { &hf_uci_aoa_destination_azimuth,
1749
14
            { "AoA Destination Azimuth", "uci.aoa_destination_azimuth",
1750
14
                FT_INT16, BASE_DEC,
1751
14
                NULL, 0x0,
1752
14
                NULL, HFILL }
1753
14
        },
1754
14
        { &hf_uci_aoa_destination_azimuth_fom,
1755
14
            { "AoA Destination Azimuth FOM", "uci.aoa_destination_azimuth_fom",
1756
14
                FT_INT8, BASE_DEC,
1757
14
                NULL, 0x0,
1758
14
                NULL, HFILL }
1759
14
        },
1760
14
        { &hf_uci_aoa_destination_elevation,
1761
14
            { "AoA Destination Elevation", "uci.aoa_destination_elevation",
1762
14
                FT_INT16, BASE_DEC,
1763
14
                NULL, 0x0,
1764
14
                NULL, HFILL }
1765
14
        },
1766
14
        { &hf_uci_aoa_destination_elevation_fom,
1767
14
            { "AoA Destination Elevation FOM", "uci.aoa_destination_elevation_fom",
1768
14
                FT_INT8, BASE_DEC,
1769
14
                NULL, 0x0,
1770
14
                NULL, HFILL }
1771
14
        },
1772
14
        { &hf_uci_slot_index,
1773
14
            { "Slot Index", "uci.slot_index",
1774
14
                FT_INT8, BASE_DEC,
1775
14
                NULL, 0x0,
1776
14
                NULL, HFILL }
1777
14
        },
1778
14
    };
1779
1780
14
    static int *ett[] = {
1781
14
        &ett_uci,
1782
14
        &ett_uci_header,
1783
14
        &ett_uci_payload,
1784
14
        &ett_uci_capability_parameters,
1785
14
        &ett_uci_capability_parameter,
1786
14
        &ett_uci_parameters,
1787
14
        &ett_uci_parameter,
1788
14
        &ett_uci_app_config_parameters,
1789
14
        &ett_uci_app_config_parameter,
1790
14
        &ett_uci_controlee_list,
1791
14
        &ett_uci_controlee,
1792
14
        &ett_uci_ranging_measurements,
1793
14
        &ett_uci_ranging_measurement,
1794
14
    };
1795
1796
14
    module_t *module_uci;
1797
1798
14
    proto_uci = proto_register_protocol (
1799
14
        "UWB UCI Protocol", /* name        */
1800
14
        "UCI",          /* short name  */
1801
14
        "uci"           /* filter_name */
1802
14
        );
1803
1804
14
    proto_register_field_array(proto_uci, hf, array_length(hf));
1805
14
    proto_register_subtree_array(ett, array_length(ett));
1806
1807
14
    module_uci = prefs_register_protocol(proto_uci,
1808
14
                                  proto_reg_handoff_uci);
1809
14
    prefs_register_uint_preference(module_uci, "tcp.port",
1810
14
        "TCP port",
1811
14
        "Select preferred TCP port",
1812
14
        10,
1813
14
        &gPREF_TCP_PORT);
1814
14
    prefs_register_bool_preference(module_uci, "tcp.desegment",
1815
14
        "TCP desegment",
1816
14
        "Enable desegmentation of UCI packets over TCP",
1817
14
        &gPREF_TCP_DESEGMENT);
1818
1819
14
    handle_uci = create_dissector_handle(dissect_uci, proto_uci);
1820
14
}
1821
1822
void proto_reg_handoff_uci(void)
1823
14
{
1824
14
    dissector_add_uint("tcp.port", gPREF_TCP_PORT, handle_uci);
1825
14
    dissector_add_uint("wtap_encap", WTAP_ENCAP_FIRA_UCI, handle_uci);
1826
14
}