Coverage Report

Created: 2026-09-28 06:52

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