summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-uci.c
blob: 42dd2f1aef77ec340f680c8eda16aa709334b3d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
/*
 * Author: Henri Chataing <henrichataing@google.com>
 * Copyright 2022 Google LLC
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 * Specification: Fira Consortium UWB Command Interface Generic Technical
 *                Specification v1.1.0
 */

#include <config.h>

#include <epan/packet.h>
#include <epan/proto.h>
#include <epan/conversation.h>
#include <epan/proto_data.h>
#include "packet-tcp.h"
#include <wiretap/wtap.h>

void proto_reg_handoff_uci(void);
void proto_register_uci(void);

#define UCI_PACKET_HEADER_LEN 4

#define UCI_MT_COMMAND 0x01
#define UCI_MT_RESPONSE 0x02
#define UCI_MT_NOTIFICATION 0x03

#define UCI_GID_CORE 0x00
#define UCI_GID_SESSION_CONFIG 0x01
#define UCI_GID_RANGING_SESSION_CONTROL 0x02
#define UCI_GID_DATA_CONTROL 0x03
#define UCI_GID_TEST 0x0d
#define UCI_GID_VENDOR_PICA 0x09
#define UCI_GID_VENDOR_RESERVED_A 0x0a
#define UCI_GID_VENDOR_RESERVED_B 0x0b
#define UCI_GID_VENDOR_RESERVED_C 0x0c
#define UCI_GID_VENDOR_ANDROID 0x0e
#define UCI_GID_VENDOR_RESERVED_F 0x0f

#define UCI_OID_CORE_DEVICE_RESET 0x00
#define UCI_OID_CORE_DEVICE_STATUS_NTF 0x01
#define UCI_OID_CORE_GET_DEVICE_INFO 0x02
#define UCI_OID_CORE_GET_CAPS_INFO 0x03
#define UCI_OID_CORE_SET_CONFIG 0x04
#define UCI_OID_CORE_GET_CONFIG 0x05
#define UCI_OID_CORE_GENERIC_ERROR_NTF 0x07
#define UCI_OID_SESSION_INIT 0x00
#define UCI_OID_SESSION_DEINIT 0x01
#define UCI_OID_SESSION_STATUS_NTF 0x02
#define UCI_OID_SESSION_SET_APP_CONFIG 0x03
#define UCI_OID_SESSION_GET_APP_CONFIG 0x04
#define UCI_OID_SESSION_GET_COUNT 0x05
#define UCI_OID_SESSION_GET_STATE 0x06
#define UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST 0x07
#define UCI_OID_RANGE_START 0x00
#define UCI_OID_RANGE_DATA 0x00
#define UCI_OID_RANGE_STOP 0x01
#define UCI_OID_RANGE_GET_RANGING_COUNT 0x03

#define UCI_STATUS_OK 0x00
#define UCI_STATUS_REJECTED 0x01
#define UCI_STATUS_FAILED 0x02
#define UCI_STATUS_SYNTAX_ERROR 0x03
#define UCI_STATUS_INVALID_PARAM 0x04
#define UCI_STATUS_INVALID_RANGE 0x05
#define UCI_STATUS_INVALID_MSG_SIZE 0x06
#define UCI_STATUS_UNKNOWN_GID 0x07
#define UCI_STATUS_UNKNOWN_OID 0x08
#define UCI_STATUS_READ_ONLY 0x09
#define UCI_STATUS_COMMAND_RETRY 0x0A
#define UCI_STATUS_SESSSION_NOT_EXIST 0x11
#define UCI_STATUS_SESSSION_DUPLICATE 0x12
#define UCI_STATUS_SESSSION_ACTIVE 0x13
#define UCI_STATUS_MAX_SESSSIONS_EXCEEDED 0x14
#define UCI_STATUS_SESSION_NOT_CONFIGURED 0x15
#define UCI_STATUS_ERROR_ACTIVE_SESSIONS_ONGOING 0x16
#define UCI_STATUS_ERROR_MULTICAST_LIST_FULL 0x17
#define UCI_STATUS_ERROR_ADDRESS_NOT_FOUND 0x18
#define UCI_STATUS_ERROR_ADDRESS_ALREADY_PRESENT 0x19
#define UCI_STATUS_RANGING_TX_FAILED 0x20
#define UCI_STATUS_RANGING_RX_TIMEOUT 0x21
#define UCI_STATUS_RANGING_RX_PHY_DEC_FAILED 0x22
#define UCI_STATUS_RANGING_RX_PHY_TOA_FAILED 0x23
#define UCI_STATUS_RANGING_RX_PHY_STS_FAILED 0x24
#define UCI_STATUS_RANGING_RX_MAC_DEC_FAILED 0x25
#define UCI_STATUS_RANGING_RX_MAC_IE_DEC_FAILED 0x26
#define UCI_STATUS_RANGING_RX_MAC_IE_MISSING 0x27

#define UCI_CAP_SUPPORTED_FIRA_PHY_VERSION_RANGE 0x0
#define UCI_CAP_SUPPORTED_FIRA_MAC_VERSION_RANGE 0x1
#define UCI_CAP_SUPPORTED_DEVICE_ROLES 0x2
#define UCI_CAP_SUPPORTED_RANGING_METHOD 0x3
#define UCI_CAP_SUPPORTED_STS_CONFIG 0x4
#define UCI_CAP_SUPPORTED_MULTI_NODE_MODES 0x5
#define UCI_CAP_SUPPORTED_RANGING_TIME_STRUCT 0x6
#define UCI_CAP_SUPPORTED_SCHEDULED_MODE 0x7
#define UCI_CAP_SUPPORTED_HOPPING_MODE 0x8
#define UCI_CAP_SUPPORTED_BLOCK_STRIDING 0x9
#define UCI_CAP_SUPPORTED_UWB_INITIATION_TIME 0x0A
#define UCI_CAP_SUPPORTED_CHANNELS 0x0B
#define UCI_CAP_SUPPORTED_RFRAME_CONFIG 0x0C
#define UCI_CAP_SUPPORTED_CC_CONSTRAINT_LENGTH 0x0D
#define UCI_CAP_SUPPORTED_BPRF_PARAMETER_SETS 0x0E
#define UCI_CAP_SUPPORTED_HPRF_PARAMETER_SETS 0x0F
#define UCI_CAP_SUPPORTED_AOA 0x10
#define UCI_CAP_SUPPORTED_EXTENDED_MAC_ADDRESS 0x11
#define UCI_CAP_SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING 0xE3
#define UCI_CAP_CCC_SUPPORTED_CHAPS_PER_SLOT 0xA0
#define UCI_CAP_CCC_SUPPORTED_SYNC_CODES 0xA1
#define UCI_CAP_CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES 0xA2
#define UCI_CAP_CCC_SUPPORTED_CHANNELS 0xA3
#define UCI_CAP_CCC_SUPPORTED_VERSIONS 0xA4
#define UCI_CAP_CCC_SUPPORTED_UWB_CONFIGS 0xA5
#define UCI_CAP_CCC_SUPPORTED_PULSE_SHAPE_COMBOS 0xA6
#define UCI_CAP_CCC_SUPPORTED_RAN_MULTIPLIER 0xA7

#define UCI_APP_CONFIG_DEVICE_TYPE 0x00
#define UCI_APP_CONFIG_RANGING_ROUND_USAGE 0x01
#define UCI_APP_CONFIG_STS_CONFIG 0x02
#define UCI_APP_CONFIG_MULTI_NODE_MODE 0x03
#define UCI_APP_CONFIG_CHANNEL_NUMBER 0x04
#define UCI_APP_CONFIG_NO_OF_CONTROLEE 0x05
#define UCI_APP_CONFIG_DEVICE_MAC_ADDRESS 0x06
#define UCI_APP_CONFIG_DST_MAC_ADDRESS 0x07
#define UCI_APP_CONFIG_SLOT_DURATION 0x08
#define UCI_APP_CONFIG_RANGING_INTERVAL 0x09
#define UCI_APP_CONFIG_STS_INDEX 0x0A
#define UCI_APP_CONFIG_MAC_FCS_TYPE 0x0B
#define UCI_APP_CONFIG_RANGING_ROUND_CONTROL 0x0C
#define UCI_APP_CONFIG_AOA_RESULT_REQ 0x0D
#define UCI_APP_CONFIG_RNG_DATA_NTF 0x0E
#define UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_NEAR 0x0F
#define UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_FAR 0x10
#define UCI_APP_CONFIG_DEVICE_ROLE 0x11
#define UCI_APP_CONFIG_RFRAME_CONFIG 0x12
#define UCI_APP_CONFIG_PREAMBLE_CODE_INDEX 0x14
#define UCI_APP_CONFIG_SFD_ID 0x15
#define UCI_APP_CONFIG_PSDU_DATA_RATE 0x16
#define UCI_APP_CONFIG_PREAMBLE_DURATION 0x17
#define UCI_APP_CONFIG_RANGING_TIME_STRUCT 0x1A
#define UCI_APP_CONFIG_SLOTS_PER_RR 0x1B
#define UCI_APP_CONFIG_TX_ADAPTIVE_PAYLOAD_POWER 0x1C
#define UCI_APP_CONFIG_RESPONDER_SLOT_INDEX 0x1E
#define UCI_APP_CONFIG_PRF_MODE 0x1F
#define UCI_APP_CONFIG_SCHEDULED_MODE 0x22
#define UCI_APP_CONFIG_KEY_ROTATION 0x23
#define UCI_APP_CONFIG_KEY_ROTATION_RATE 0x24
#define UCI_APP_CONFIG_SESSION_PRIORITY 0x25
#define UCI_APP_CONFIG_MAC_ADDRESS_MODE 0x26
#define UCI_APP_CONFIG_VENDOR_ID 0x27
#define UCI_APP_CONFIG_STATIC_STS_IV 0x28
#define UCI_APP_CONFIG_NUMBER_OF_STS_SEGMENTS 0x29
#define UCI_APP_CONFIG_MAX_RR_RETRY 0x2A
#define UCI_APP_CONFIG_UWB_INITIATION_TIME 0x2B
#define UCI_APP_CONFIG_HOPPING_MODE 0x2C
#define UCI_APP_CONFIG_BLOCK_STRIDE_LENGTH 0x2D
#define UCI_APP_CONFIG_RESULT_REPORT_CONFIG 0x2E
#define UCI_APP_CONFIG_IN_BAND_TERMINATION_ATTEMPT_COUNT 0x2F
#define UCI_APP_CONFIG_SUB_SESSION_ID 0x30
#define UCI_APP_CONFIG_BPRF_PHR_DATA_RATE 0x31
#define UCI_APP_CONFIG_MAX_NUMBER_OF_MEASUREMENTS 0x32
#define UCI_APP_CONFIG_STS_LENGTH 0x35
#define UCI_APP_CONFIG_CCC_HOP_MODE_KEY 0xA0
#define UCI_APP_CONFIG_CCC_UWB_TIME0 0xA1
#define UCI_APP_CONFIG_CCC_RANGING_PROTOCOL_VER 0xA3
#define UCI_APP_CONFIG_CCC_UWB_CONFIG_ID 0xA4
#define UCI_APP_CONFIG_CCC_PULSESHAPE_COMBO 0xA5
#define UCI_APP_CONFIG_CCC_URSK_TTL 0xA6
#define UCI_APP_CONFIG_NB_OF_RANGE_MEASUREMENTS 0xE3
#define UCI_APP_CONFIG_NB_OF_AZIMUTH_MEASUREMENTS 0xE4
#define UCI_APP_CONFIG_NB_OF_ELEVATION_MEASUREMENTS 0xE5

static gboolean gPREF_TCP_DESEGMENT = TRUE;
static guint gPREF_TCP_PORT = 7000;

static int proto_uci = -1;
static dissector_handle_t handle_uci = NULL;

static int hf_uci_message_type = -1;
static int hf_uci_packet_boundary_flag = -1;
static int hf_uci_group_id = -1;
static int hf_uci_opcode_id = -1;
static int hf_uci_payload_length = -1;
static int hf_uci_status = -1;
static int hf_uci_reset_config = -1;
static int hf_uci_device_state = -1;
static int hf_uci_generic_version = -1;
static int hf_uci_version_major = -1;
static int hf_uci_version_minor = -1;
static int hf_uci_maintenance_number = -1;
static int hf_uci_mac_version = -1;
static int hf_uci_phy_version = -1;
static int hf_uci_test_version = -1;
static int hf_uci_vendor_specific_information_length = -1;
static int hf_uci_vendor_specific_information = -1;
static int hf_uci_capability_parameters_count = -1;
static int hf_uci_capability_parameter_type = -1;
static int hf_uci_capability_parameter_len = -1;
static int hf_uci_capability_parameter_value = -1;
static int hf_uci_parameters_count = -1;
static int hf_uci_parameter_type = -1;
static int hf_uci_parameter_len = -1;
static int hf_uci_parameter_value = -1;
static int hf_uci_parameter_status = -1;
static int hf_uci_session_id = -1;
static int hf_uci_session_type = -1;
static int hf_uci_session_state = -1;
static int hf_uci_session_count = -1;
static int hf_uci_app_config_parameters_count = -1;
static int hf_uci_app_config_parameter_type = -1;
static int hf_uci_app_config_parameter_len = -1;
static int hf_uci_app_config_parameter_value = -1;
static int hf_uci_app_config_parameter_status = -1;
static int hf_uci_update_controller_multicast_list_action = -1;
static int hf_uci_controlees_count = -1;
static int hf_uci_controlee_short_address = -1;
static int hf_uci_controlee_subsession_id = -1;
static int hf_uci_controlee_status = -1;
static int hf_uci_remaining_multicast_list_size = -1;
static int hf_uci_ranging_count = -1;
static int hf_uci_sequence_number = -1;
static int hf_uci_current_ranging_interval = -1;
static int hf_uci_ranging_measurement_type = -1;
static int hf_uci_mac_addressing_mode_indicator = -1;
static int hf_uci_ranging_measurement_count = -1;
static int hf_uci_mac_address = -1;
static int hf_uci_nlos = -1;
static int hf_uci_distance = -1;
static int hf_uci_aoa_azimuth = -1;
static int hf_uci_aoa_azimuth_fom = -1;
static int hf_uci_aoa_elevation = -1;
static int hf_uci_aoa_elevation_fom = -1;
static int hf_uci_aoa_destination_azimuth = -1;
static int hf_uci_aoa_destination_azimuth_fom = -1;
static int hf_uci_aoa_destination_elevation = -1;
static int hf_uci_aoa_destination_elevation_fom = -1;
static int hf_uci_slot_index = -1;

static gint ett_uci = -1;
static gint ett_uci_header = -1;
static gint ett_uci_payload = -1;
static gint ett_uci_capability_parameters = -1;
static gint ett_uci_capability_parameter = -1;
static gint ett_uci_parameters = -1;
static gint ett_uci_parameter = -1;
static gint ett_uci_app_config_parameters = -1;
static gint ett_uci_app_config_parameter = -1;
static gint ett_uci_controlee_list = -1;
static gint ett_uci_controlee = -1;
static gint ett_uci_ranging_measurements = -1;
static gint ett_uci_ranging_measurement = -1;

static const value_string message_type_vals[] = {
    { UCI_MT_COMMAND, "Command" },
    { UCI_MT_RESPONSE, "Response" },
    { UCI_MT_NOTIFICATION, "Notification" },
    { 0, NULL },
};

static const value_string packet_boundary_flag_vals[] = {
    { 0, "The packet contains a complete message, or the Packet contains the "
         "last segment of the segmented message" },
    { 1, "The Packet contains a segment of a Message that is not the last segment" },
    { 0, NULL },
};

static const value_string group_id_vals[] = {
    { UCI_GID_CORE, "Core" },
    { UCI_GID_SESSION_CONFIG, "Session Config" },
    { UCI_GID_RANGING_SESSION_CONTROL, "Ranging Session Control" },
    { UCI_GID_DATA_CONTROL, "Data Control" },
    { UCI_GID_VENDOR_PICA, "Vendor Pica" },
    { UCI_GID_VENDOR_RESERVED_A, "Vendor Reserved A" },
    { UCI_GID_VENDOR_RESERVED_B, "Vendor Reserved B" },
    { UCI_GID_VENDOR_RESERVED_C, "Vendor Reserved C" },
    { UCI_GID_TEST, "Test" },
    { UCI_GID_VENDOR_ANDROID, "Vendor Android" },
    { UCI_GID_VENDOR_RESERVED_F, "Vendor Reserved F" },
    { 0, NULL },
};

static const value_string status_vals[] = {
    { UCI_STATUS_OK, "OK Success" },
    { UCI_STATUS_REJECTED, "Intended operation is not supported in the current state" },
    { UCI_STATUS_FAILED, "Intended operation failed to complete" },
    { UCI_STATUS_SYNTAX_ERROR, "UCI packet structure is not per spec" },
    { UCI_STATUS_INVALID_PARAM, "Config ID is not correct, and it is not present in UWBS" },
    { UCI_STATUS_INVALID_RANGE, "Config ID is correct, and value is not in proper range" },
    { UCI_STATUS_INVALID_MSG_SIZE, "UCI packet payload size is not as per spec" },
    { UCI_STATUS_UNKNOWN_GID, "UCI Group ID is not per spec" },
    { UCI_STATUS_UNKNOWN_OID, "UCI Opcode ID is not per spec" },
    { UCI_STATUS_READ_ONLY, "Config ID is read-only" },
    { UCI_STATUS_COMMAND_RETRY, "UWBS request retransmission from Host" },
    { UCI_STATUS_SESSSION_NOT_EXIST, "Session is not existing or not created" },
    { UCI_STATUS_SESSSION_DUPLICATE, "Session is already created/exist" },
    { UCI_STATUS_SESSSION_ACTIVE, "Session is active" },
    { UCI_STATUS_MAX_SESSSIONS_EXCEEDED, "Max. number of sessions already created" },
    { UCI_STATUS_SESSION_NOT_CONFIGURED, "Session is not configured with required app configurations" },
    { UCI_STATUS_ERROR_ACTIVE_SESSIONS_ONGOING, "Sessions are actively running in UWBS" },
    { UCI_STATUS_ERROR_MULTICAST_LIST_FULL, "Indicates when multicast list is full during one to many ranging" },
    { UCI_STATUS_ERROR_ADDRESS_NOT_FOUND, "Indicates when short address is not available multicast list" },
    { UCI_STATUS_ERROR_ADDRESS_ALREADY_PRESENT, "Indicates when short address is already present" },
    { UCI_STATUS_RANGING_TX_FAILED, "Failed to transmit UWB packet" },
    { UCI_STATUS_RANGING_RX_TIMEOUT, "No UWB packet detected by the receiver" },
    { UCI_STATUS_RANGING_RX_PHY_DEC_FAILED, "UWB packet channel decoding error" },
    { UCI_STATUS_RANGING_RX_PHY_TOA_FAILED, "Failed to detect time of arrival of the UWB packet from CIR samples" },
    { UCI_STATUS_RANGING_RX_PHY_STS_FAILED, "UWB packet STS segment mismatch" },
    { UCI_STATUS_RANGING_RX_MAC_DEC_FAILED, "MAC CRC or syntax error" },
    { UCI_STATUS_RANGING_RX_MAC_IE_DEC_FAILED, "IE syntax error" },
    { UCI_STATUS_RANGING_RX_MAC_IE_MISSING, "Expected IE missing in the packet" },
    { 0, NULL },
};

static const value_string reset_config_vals[] = {
    { 0, "UWBS reset" },
    { 0, NULL },
};

static const value_string device_state_vals[] = {
    { 1, "UWBS is initialized and ready for UWB session" },
    { 2, "UWBS is busy with UWB session" },
    { 0xff, "Error occurred within the UWBS" },
    { 0, NULL },
};

static const value_string capability_parameter_type_vals[] = {
    { UCI_CAP_SUPPORTED_FIRA_PHY_VERSION_RANGE, "Supported Fira PHY version range" },
    { UCI_CAP_SUPPORTED_FIRA_MAC_VERSION_RANGE, "Supported Fira MAC version range" },
    { UCI_CAP_SUPPORTED_DEVICE_ROLES, "Supported device roles" },
    { UCI_CAP_SUPPORTED_RANGING_METHOD, "Supported ranging method" },
    { UCI_CAP_SUPPORTED_STS_CONFIG, "Supported STS config" },
    { UCI_CAP_SUPPORTED_MULTI_NODE_MODES, "Supported multi node modes" },
    { UCI_CAP_SUPPORTED_RANGING_TIME_STRUCT, "Supported ranging time struct" },
    { UCI_CAP_SUPPORTED_SCHEDULED_MODE, "Supported scheduled mode" },
    { UCI_CAP_SUPPORTED_HOPPING_MODE, "Supported hopping mode" },
    { UCI_CAP_SUPPORTED_BLOCK_STRIDING, "Supported block striding" },
    { UCI_CAP_SUPPORTED_UWB_INITIATION_TIME, "Supported UWB initiation time" },
    { UCI_CAP_SUPPORTED_CHANNELS, "Supported channels" },
    { UCI_CAP_SUPPORTED_RFRAME_CONFIG, "Supported rframe config" },
    { UCI_CAP_SUPPORTED_CC_CONSTRAINT_LENGTH, "Supported CC constraint length" },
    { UCI_CAP_SUPPORTED_BPRF_PARAMETER_SETS, "Supported BPRF parameter sets" },
    { UCI_CAP_SUPPORTED_HPRF_PARAMETER_SETS, "Supported HPRF parameter sets" },
    { UCI_CAP_SUPPORTED_AOA, "Supported AOA" },
    { UCI_CAP_SUPPORTED_EXTENDED_MAC_ADDRESS, "Supported extended MAC address" },
    { UCI_CAP_SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING, "Supported AOA result req antenna interleaving" },
    { UCI_CAP_CCC_SUPPORTED_CHAPS_PER_SLOT, "Supported CCC chaps per slot" },
    { UCI_CAP_CCC_SUPPORTED_SYNC_CODES, "Supported CCC sync codes" },
    { UCI_CAP_CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES, "Supported CCC hopping config modes and sequences" },
    { UCI_CAP_CCC_SUPPORTED_CHANNELS, "Supported CCC channels" },
    { UCI_CAP_CCC_SUPPORTED_VERSIONS, "Supported CCC versions" },
    { UCI_CAP_CCC_SUPPORTED_UWB_CONFIGS, "Supported CCC UWB configs" },
    { UCI_CAP_CCC_SUPPORTED_PULSE_SHAPE_COMBOS, "Supported CCC pulse shape combos" },
    { UCI_CAP_CCC_SUPPORTED_RAN_MULTIPLIER, "Supported CCC ran multiplier" },
    { 0, NULL },
};

static const value_string parameter_type_vals[] = {
    { 0, "Device State" },
    { 1, "Low Power Mode" },
    { 0, NULL },
};

static const value_string session_type_vals[] = {
    { 0x00, "Fira Ranging Session" },
    { 0xD0, "Device Test Mode" },
    { 0, NULL },
};

static const value_string session_state_vals[] = {
    { 0, "Session State Init" },
    { 1, "Session State Deinit" },
    { 2, "Session State Active" },
    { 3, "Session State Idle" },
    { 0, NULL },
};

static const value_string app_config_parameter_type_vals[] = {
    { UCI_APP_CONFIG_DEVICE_TYPE, "Device type" },
    { UCI_APP_CONFIG_RANGING_ROUND_USAGE, "Ranging round usage" },
    { UCI_APP_CONFIG_STS_CONFIG, "STS config" },
    { UCI_APP_CONFIG_MULTI_NODE_MODE, "Multi-node mode" },
    { UCI_APP_CONFIG_CHANNEL_NUMBER, "Channel number" },
    { UCI_APP_CONFIG_NO_OF_CONTROLEE, "No of controlee" },
    { UCI_APP_CONFIG_DEVICE_MAC_ADDRESS, "Device mac address" },
    { UCI_APP_CONFIG_DST_MAC_ADDRESS, "Dst mac address" },
    { UCI_APP_CONFIG_SLOT_DURATION, "Slot duration" },
    { UCI_APP_CONFIG_RANGING_INTERVAL, "Ranging interval" },
    { UCI_APP_CONFIG_STS_INDEX, "STS index" },
    { UCI_APP_CONFIG_MAC_FCS_TYPE, "Mac FCS type" },
    { UCI_APP_CONFIG_RANGING_ROUND_CONTROL, "Ranging round control" },
    { UCI_APP_CONFIG_AOA_RESULT_REQ, "AOA result req" },
    { UCI_APP_CONFIG_RNG_DATA_NTF, "Rng data ntf" },
    { UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_NEAR, "Rng data ntf proximity near" },
    { UCI_APP_CONFIG_RNG_DATA_NTF_PROXIMITY_FAR, "Rng data ntf proximity far" },
    { UCI_APP_CONFIG_DEVICE_ROLE, "Device role" },
    { UCI_APP_CONFIG_RFRAME_CONFIG, "Rframe config" },
    { UCI_APP_CONFIG_PREAMBLE_CODE_INDEX, "Preamble code index" },
    { UCI_APP_CONFIG_SFD_ID, "SFD ID" },
    { UCI_APP_CONFIG_PSDU_DATA_RATE, "PSDU data rate" },
    { UCI_APP_CONFIG_PREAMBLE_DURATION, "Preamble duration" },
    { UCI_APP_CONFIG_RANGING_TIME_STRUCT, "Ranging time struct" },
    { UCI_APP_CONFIG_SLOTS_PER_RR, "Slots per ranging round" },
    { UCI_APP_CONFIG_TX_ADAPTIVE_PAYLOAD_POWER, "Tx adaptive payload power" },
    { UCI_APP_CONFIG_RESPONDER_SLOT_INDEX, "Responder slot index" },
    { UCI_APP_CONFIG_PRF_MODE, "PRF mode" },
    { UCI_APP_CONFIG_SCHEDULED_MODE, "Scheduled mode" },
    { UCI_APP_CONFIG_KEY_ROTATION, "Key rotation" },
    { UCI_APP_CONFIG_KEY_ROTATION_RATE, "Key rotation rate" },
    { UCI_APP_CONFIG_SESSION_PRIORITY, "Session priority" },
    { UCI_APP_CONFIG_MAC_ADDRESS_MODE, "Mac address mode" },
    { UCI_APP_CONFIG_VENDOR_ID, "Vendor ID" },
    { UCI_APP_CONFIG_STATIC_STS_IV, "Static STS IV" },
    { UCI_APP_CONFIG_NUMBER_OF_STS_SEGMENTS, "Number of STS segments" },
    { UCI_APP_CONFIG_MAX_RR_RETRY, "Max ranging round retry" },
    { UCI_APP_CONFIG_UWB_INITIATION_TIME, "UWB initiation time" },
    { UCI_APP_CONFIG_HOPPING_MODE, "Hopping mode" },
    { UCI_APP_CONFIG_BLOCK_STRIDE_LENGTH, "Block stride length" },
    { UCI_APP_CONFIG_RESULT_REPORT_CONFIG, "Result report config" },
    { UCI_APP_CONFIG_IN_BAND_TERMINATION_ATTEMPT_COUNT, "In band termination attempt count" },
    { UCI_APP_CONFIG_SUB_SESSION_ID, "Sub session ID" },
    { UCI_APP_CONFIG_BPRF_PHR_DATA_RATE, "BPRF PHR data rate" },
    { UCI_APP_CONFIG_MAX_NUMBER_OF_MEASUREMENTS, "Max number of measurements" },
    { UCI_APP_CONFIG_STS_LENGTH, "STS length" },
    { UCI_APP_CONFIG_CCC_HOP_MODE_KEY, "CCC hop mode key" },
    { UCI_APP_CONFIG_CCC_UWB_TIME0, "CCC UWB time0" },
    { UCI_APP_CONFIG_CCC_RANGING_PROTOCOL_VER, "CCC ranging protocol ver" },
    { UCI_APP_CONFIG_CCC_UWB_CONFIG_ID, "CCC UWB config ID" },
    { UCI_APP_CONFIG_CCC_PULSESHAPE_COMBO, "CCC pulseshape combo" },
    { UCI_APP_CONFIG_CCC_URSK_TTL, "CCC URSK TTL" },
    { UCI_APP_CONFIG_NB_OF_RANGE_MEASUREMENTS, "Nb of range measurements" },
    { UCI_APP_CONFIG_NB_OF_AZIMUTH_MEASUREMENTS, "Nb of azimuth measurements" },
    { UCI_APP_CONFIG_NB_OF_ELEVATION_MEASUREMENTS, "Nb of elevation measurements" },
    { 0, NULL },
};

static const value_string update_controller_multicast_list_action_vals[] = {
    { 0, "Update the multicast list by adding requested controlee short address" },
    { 1, "Delete the requested short address from multicast list" },
    { 0, NULL },
};

static const value_string multicast_update_status_vals[] = {
    { 0, "OK - Multicast list updated" },
    { 1, "Multicast list full" },
    { 2, "Key fecth fail" },
    { 3, "Sub-session ID not found" },
    { 0, NULL },
};

static const value_string ranging_measurement_type_vals[] = {
    { 1, "Two Way Ranging Measurement (SS-TWR, DSTWR)" },
    { 0, NULL },
};

static const value_string mac_addressing_mode_indicator_vals[] = {
    { 0, "2 Octets short MAC address" },
    { 1, "8 Octets extended MAC Address" },
    { 0, NULL },
};

static const value_string nlos_vals[] = {
    { 0, "Line of sight" },
    { 1, "Non-line of sigt" },
    { 0xff, "Unable to determine" },
    { 0, NULL },
};

static guint get_uci_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
    /* Return the payload length added to the packet header length. */
    return tvb_get_guint8(tvb, offset + 3) + UCI_PACKET_HEADER_LEN;
}

static void dissect_core_device_reset_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                         proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Device Reset Cmd");
    proto_tree_add_item(payload_tree, hf_uci_reset_config, tvb, offset, 1, ENC_NA);
}

static void dissect_core_device_reset_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                         proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Device Reset Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
}

static void dissect_core_device_status_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                          proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Device Status Ntf");
    proto_tree_add_item(payload_tree, hf_uci_device_state, tvb, offset, 1, ENC_NA);
}

static void dissect_core_get_device_info_cmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
                                            proto_tree *payload_tree _U_)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Get Device Info Cmd");
}

static void dissect_core_get_device_info_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                            proto_tree *payload_tree)
{
    static int * const version_fields[] = {
        &hf_uci_version_major,
        &hf_uci_version_minor,
        &hf_uci_maintenance_number,
        NULL
    };

    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Get Device Info Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;
    proto_tree_add_bitmask(payload_tree, tvb, offset,
        hf_uci_generic_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
    offset += 2;
    proto_tree_add_bitmask(payload_tree, tvb, offset,
        hf_uci_mac_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
    offset += 2;
    proto_tree_add_bitmask(payload_tree, tvb, offset,
        hf_uci_phy_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
    offset += 2;
    proto_tree_add_bitmask(payload_tree, tvb, offset,
        hf_uci_test_version, ett_uci_payload, version_fields, ENC_LITTLE_ENDIAN);
    offset += 2;

    int vendor_specific_information_len = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_vendor_specific_information_length,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    proto_tree_add_item(payload_tree, hf_uci_vendor_specific_information,
        tvb, offset, vendor_specific_information_len, ENC_NA);
}

static void dissect_core_get_caps_info_cmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
                                          proto_tree *payload_tree _U_)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Get Caps Info Cmd");
}

static void dissect_core_get_caps_info_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                          proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Get Caps Info Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;

    int capability_parameters_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_capability_parameters_count,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    if (capability_parameters_count == 0) {
        return;
    }

    proto_tree *capability_parameters_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_capability_parameters, NULL, "Capability Parameters");

    for (int idx = 0; idx < capability_parameters_count; idx++) {
        int parameter_type = tvb_get_guint8(tvb, offset + 0);
        int parameter_len = tvb_get_guint8(tvb, offset + 1);
        proto_tree *parameter_tree =
            proto_tree_add_subtree(capability_parameters_tree, tvb, offset, 2 + parameter_len,
                ett_uci_capability_parameter, NULL,
                val_to_str(parameter_type, capability_parameter_type_vals, "Unknown (0x%02x)"));

        proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_type, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_len, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(parameter_tree, hf_uci_capability_parameter_value, tvb, offset, parameter_len, ENC_NA);
        offset += parameter_len;
    }
}

static void dissect_core_get_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                       proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Get Config Cmd");

    int parameters_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_parameters_count, tvb, offset, 1, ENC_NA);
    offset += 1;

    if (parameters_count == 0) {
        return;
    }

    proto_tree *parameters_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_parameters, NULL, "Parameter IDs");

    for (int idx = 0; idx < parameters_count; idx++) {
        int parameter_id = tvb_get_guint8(tvb, offset);

        proto_tree *parameter_tree =
            proto_tree_add_subtree(parameters_tree, tvb, offset, 1,
                ett_uci_parameter, NULL,
                val_to_str(parameter_id, parameter_type_vals, "Unknown (0x%02x)"));

        proto_tree_add_item(parameter_tree, hf_uci_parameter_type,
            tvb, offset, 1, ENC_NA);

        offset += 1;
    }
}

static void dissect_parameters(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
                               proto_tree *payload_tree)
{
    int parameters_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_parameters_count, tvb, offset, 1, ENC_NA);
    offset += 1;

    if (parameters_count == 0) {
        return;
    }

    proto_tree *parameters_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_parameters, NULL, "Parameters");

    for (int idx = 0; idx < parameters_count; idx++) {
        int parameter_id = tvb_get_guint8(tvb, offset + 0);
        int parameter_len = tvb_get_guint8(tvb, offset + 1);
        proto_tree *parameter_tree =
            proto_tree_add_subtree(parameters_tree, tvb, offset, 2 + parameter_len,
                ett_uci_parameter, NULL,
                val_to_str(parameter_id, parameter_type_vals, "Unknown (0x%02x)"));

        proto_tree_add_item(parameter_tree, hf_uci_parameter_type, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(parameter_tree, hf_uci_parameter_len, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(parameter_tree, hf_uci_parameter_value, tvb, offset, parameter_len, ENC_NA);
        offset += parameter_len;
    }
}

static void dissect_core_get_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                       proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Get Config Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;

    dissect_parameters(tvb, offset, pinfo, payload_tree);
}

static void dissect_core_set_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                       proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Set Config Cmd");
    dissect_parameters(tvb, offset, pinfo, payload_tree);
}

static void dissect_core_set_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                       proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Set Config Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;

    int parameters_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_parameters_count,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    if (parameters_count == 0) {
        return;
    }

    proto_tree *parameters_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_parameters, NULL, "Parameters");

    for (int idx = 0; idx < parameters_count; idx++) {
        int parameter_type = tvb_get_guint8(tvb, offset + 0);

        proto_tree *parameter_tree =
            proto_tree_add_subtree(parameters_tree, tvb, offset, 2,
                ett_uci_parameter, NULL,
                val_to_str(parameter_type, parameter_type_vals, "Unknown (0x%02x)"));

        proto_tree_add_item(parameter_tree, hf_uci_parameter_type, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(parameter_tree, hf_uci_parameter_status, tvb, offset, 1, ENC_NA);
        offset += 1;
    }
}

static void dissect_core_generic_error_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                          proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Core Generic Error Ntf");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
}

static void dissect_uci_core_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                proto_tree *payload_tree, int message_type, int opcode_id)
{
    if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_CORE_DEVICE_RESET) {
        dissect_core_device_reset_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_CORE_DEVICE_RESET) {
        dissect_core_device_reset_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_NOTIFICATION &&
        opcode_id == UCI_OID_CORE_DEVICE_STATUS_NTF) {
        dissect_core_device_status_ntf(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_CORE_GET_DEVICE_INFO) {
        dissect_core_get_device_info_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_CORE_GET_DEVICE_INFO) {
        dissect_core_get_device_info_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_CORE_GET_CAPS_INFO) {
        dissect_core_get_caps_info_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_CORE_GET_CAPS_INFO) {
        dissect_core_get_caps_info_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_CORE_GET_CONFIG) {
        dissect_core_get_config_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_CORE_GET_CONFIG) {
        dissect_core_get_config_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_CORE_SET_CONFIG) {
        dissect_core_set_config_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_CORE_SET_CONFIG) {
        dissect_core_set_config_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_NOTIFICATION &&
        opcode_id == UCI_OID_CORE_GENERIC_ERROR_NTF) {
        dissect_core_generic_error_ntf(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Cmd (%02x)", opcode_id);
    }
    else if (message_type == UCI_MT_RESPONSE) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Rsp (%02x)", opcode_id);
    }
    else {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Core Ntf (%02x)", opcode_id);
    }
}

static void dissect_session_init_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                    proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Init Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    proto_tree_add_item(payload_tree, hf_uci_session_type, tvb, offset, 1, ENC_NA);
}

static void dissect_session_init_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                    proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Init Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
}

static void dissect_session_deinit_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                      proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Deinit Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
}

static void dissect_session_deinit_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                      proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Deinit Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
}

static void dissect_session_status_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                      proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Status Ntf");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    proto_tree_add_item(payload_tree, hf_uci_session_state, tvb, offset, 1, ENC_NA);
}

static void dissect_app_config_parameters(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
                               proto_tree *payload_tree)
{
    int app_config_parameters_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    if (app_config_parameters_count == 0) {
        return;
    }

    proto_tree *app_config_parameters_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_app_config_parameters, NULL, "App Configurations");

    for (int idx = 0; idx < app_config_parameters_count; idx++) {
        int app_config_parameter_id = tvb_get_guint8(tvb, offset + 0);
        int app_config_parameter_len = tvb_get_guint8(tvb, offset + 1);
        proto_tree *app_config_parameter_tree =
            proto_tree_add_subtree(app_config_parameters_tree, tvb, offset,
                2 + app_config_parameter_len, ett_uci_app_config_parameter, NULL,
                val_to_str(app_config_parameter_id, app_config_parameter_type_vals, "Unknown (0x%02x)"));

        proto_tree_add_item(app_config_parameter_tree,
            hf_uci_app_config_parameter_type, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(app_config_parameter_tree,
            hf_uci_app_config_parameter_len, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(app_config_parameter_tree,
            hf_uci_app_config_parameter_value, tvb, offset,
            app_config_parameter_len, ENC_NA);
        offset += app_config_parameter_len;
    }
}

static void dissect_session_set_app_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                              proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Set App Config Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    dissect_app_config_parameters(tvb, offset, pinfo, payload_tree);
}

static void dissect_session_set_app_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                              proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Set App Config Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;

    int app_config_parameters_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    if (app_config_parameters_count == 0) {
        return;
    }

    proto_tree *app_config_parameters_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_app_config_parameters, NULL, "App Configurations");

    for (int idx = 0; idx < app_config_parameters_count; idx++) {
        int app_config_parameter_type = tvb_get_guint8(tvb, offset + 0);

        proto_tree *app_config_parameter_tree =
            proto_tree_add_subtree(app_config_parameters_tree, tvb, offset, 2,
                ett_uci_app_config_parameter, NULL,
                val_to_str(app_config_parameter_type, app_config_parameter_type_vals, "Unknown (0x%02x)"));

        proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_type, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_status, tvb, offset, 1, ENC_NA);
        offset += 1;
    }
}

static void dissect_session_get_app_config_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                              proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Get App Config Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;

    int app_config_parameters_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_app_config_parameters_count, tvb, offset, 1, ENC_NA);
    offset += 1;

    if (app_config_parameters_count == 0) {
        return;
    }

    proto_tree *app_config_parameters_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_app_config_parameters, NULL, "App Configuration IDs");

    for (int idx = 0; idx < app_config_parameters_count; idx++) {
        int app_config_parameter_id = tvb_get_guint8(tvb, offset);

        proto_tree *app_config_parameter_tree =
            proto_tree_add_subtree(app_config_parameters_tree, tvb, offset, 1,
                ett_uci_app_config_parameter, NULL,
                val_to_str(app_config_parameter_id, app_config_parameter_type_vals, "Unknown (0x%02x)"));

        proto_tree_add_item(app_config_parameter_tree, hf_uci_app_config_parameter_type,
            tvb, offset, 1, ENC_NA);

        offset += 1;
    }
}

static void dissect_session_get_app_config_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                              proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Get App Config Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;
    dissect_app_config_parameters(tvb, offset, pinfo, payload_tree);
}

static void dissect_session_get_count_cmd(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
                                         proto_tree *payload_tree _U_)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Get Count Cmd");
}

static void dissect_session_get_count_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                         proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Get Count Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;
    proto_tree_add_item(payload_tree, hf_uci_session_count, tvb, offset, 1, ENC_NA);
}

static void dissect_session_get_state_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                         proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Get State Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
}

static void dissect_session_get_state_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                         proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Get State Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;
    proto_tree_add_item(payload_tree, hf_uci_session_state, tvb, offset, 1, ENC_NA);
}

static void dissect_session_update_controller_multicast_list_cmd(
    tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    proto_tree_add_item(payload_tree, hf_uci_update_controller_multicast_list_action,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    int controlees_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_controlees_count,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    if (controlees_count == 0) {
        return;
    }

    proto_tree *controlee_list_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_controlee_list, NULL, "Controlee List");

    for (int idx = 0; idx < controlees_count; idx++) {
        proto_tree *controlee_tree =
            proto_tree_add_subtree(controlee_list_tree, tvb, offset, -1,
                ett_uci_controlee, NULL, "Controlee");

        proto_tree_add_item(controlee_tree, hf_uci_controlee_short_address,
            tvb, offset, 2, ENC_LITTLE_ENDIAN);
        offset += 2;
        proto_tree_add_item(controlee_tree, hf_uci_controlee_subsession_id,
            tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;
    }
}

static void dissect_session_update_controller_multicast_list_rsp(
    tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
}

static void dissect_session_update_controller_multicast_list_ntf(
    tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Session Update Controller Multicast List Ntf");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    proto_tree_add_item(payload_tree, hf_uci_remaining_multicast_list_size,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    int controlees_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_controlees_count,
        tvb, offset, 1, ENC_NA);
    offset += 1;

    if (controlees_count == 0) {
        return;
    }

    proto_tree *controlee_list_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_controlee_list, NULL, "Controlee List");

    for (int idx = 0; idx < controlees_count; idx++) {
        proto_tree *controlee_tree =
            proto_tree_add_subtree(controlee_list_tree, tvb, offset, -1,
                ett_uci_controlee, NULL, "Controlee");

        proto_tree_add_item(controlee_tree, hf_uci_controlee_short_address,
            tvb, offset, 2, ENC_LITTLE_ENDIAN);
        offset += 2;
        proto_tree_add_item(controlee_tree, hf_uci_controlee_subsession_id,
            tvb, offset, 4, ENC_LITTLE_ENDIAN);
        offset += 4;
        proto_tree_add_item(controlee_tree, hf_uci_controlee_status,
            tvb, offset, 1, ENC_NA);
        offset += 1;
    }
}

static void dissect_uci_session_config_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                          proto_tree *payload_tree, int message_type, int opcode_id)
{
    if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_SESSION_INIT) {
        dissect_session_init_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_SESSION_INIT) {
        dissect_session_init_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_SESSION_DEINIT) {
        dissect_session_deinit_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_SESSION_DEINIT) {
        dissect_session_deinit_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_NOTIFICATION &&
        opcode_id == UCI_OID_SESSION_STATUS_NTF) {
        dissect_session_status_ntf(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_SESSION_SET_APP_CONFIG) {
        dissect_session_set_app_config_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_SESSION_SET_APP_CONFIG) {
        dissect_session_set_app_config_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_SESSION_GET_APP_CONFIG) {
        dissect_session_get_app_config_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_SESSION_GET_APP_CONFIG) {
        dissect_session_get_app_config_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_SESSION_GET_COUNT) {
        dissect_session_get_count_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_SESSION_GET_COUNT) {
        dissect_session_get_count_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_SESSION_GET_STATE) {
        dissect_session_get_state_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_SESSION_GET_STATE) {
        dissect_session_get_state_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
        dissect_session_update_controller_multicast_list_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
        dissect_session_update_controller_multicast_list_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_NOTIFICATION &&
        opcode_id == UCI_OID_SESSION_UPDATE_CONTROLLER_MULTICAST_LIST) {
        dissect_session_update_controller_multicast_list_ntf(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Cmd (%02x)", opcode_id);
    }
    else if (message_type == UCI_MT_RESPONSE) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Rsp (%02x)", opcode_id);
    }
    else {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Session Config Ntf (%02x)", opcode_id);
    }
}

static void dissect_range_start_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                   proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Range Start Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
}

static void dissect_range_start_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                   proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Range Start Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
}

static void dissect_range_data_ntf(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                  proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Range Data Ntf");
    proto_tree_add_item(payload_tree, hf_uci_sequence_number, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    offset += 1;
    proto_tree_add_item(payload_tree, hf_uci_current_ranging_interval, tvb, offset, 4, ENC_LITTLE_ENDIAN);
    offset += 4;
    proto_tree_add_item(payload_tree, hf_uci_ranging_measurement_type, tvb, offset, 1, ENC_NA);
    offset += 1;
    offset += 1;

    int mac_addressing_mode_indicator = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_mac_addressing_mode_indicator, tvb, offset, 1, ENC_NA);
    offset += 1;
    offset += 8;

    int ranging_measurement_count = tvb_get_guint8(tvb, offset);
    proto_tree_add_item(payload_tree, hf_uci_ranging_measurement_count, tvb, offset, 1, ENC_NA);
    offset += 1;

    if (ranging_measurement_count == 0) {
        return;
    }

    proto_tree *ranging_measurements_tree =
        proto_tree_add_subtree(payload_tree, tvb, offset, -1,
            ett_uci_ranging_measurements, NULL, "Ranging Measurements");

    for (int idx = 0; idx < ranging_measurement_count; idx++) {
        proto_tree *ranging_measurement_tree;
        int padding_len;

        if (mac_addressing_mode_indicator == 0) {
            ranging_measurement_tree = proto_tree_add_subtree_format(
                ranging_measurements_tree, tvb, offset, 31,
                ett_uci_ranging_measurement, NULL,
                "%02x:%02x",
                tvb_get_guint8(tvb, offset + 0),
                tvb_get_guint8(tvb, offset + 1));

            proto_tree_add_item(ranging_measurement_tree,
                hf_uci_mac_address, tvb, offset, 2, ENC_NA);

            offset += 2;
            padding_len = 12;
        } else {
            ranging_measurement_tree = proto_tree_add_subtree_format(
                ranging_measurements_tree, tvb, offset, 31,
                ett_uci_ranging_measurement, NULL,
                "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
                tvb_get_guint8(tvb, offset + 0),
                tvb_get_guint8(tvb, offset + 1),
                tvb_get_guint8(tvb, offset + 2),
                tvb_get_guint8(tvb, offset + 3),
                tvb_get_guint8(tvb, offset + 4),
                tvb_get_guint8(tvb, offset + 5),
                tvb_get_guint8(tvb, offset + 6),
                tvb_get_guint8(tvb, offset + 7));

            proto_tree_add_item(ranging_measurement_tree,
                hf_uci_mac_address, tvb, offset, 8, ENC_NA);

            offset += 8;
            padding_len = 6;
        }

        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_status, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_nlos, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_distance, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        offset += 2;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_azimuth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        offset += 2;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_azimuth_fom, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_elevation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        offset += 2;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_elevation_fom, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_destination_azimuth, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        offset += 2;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_destination_azimuth_fom, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_destination_elevation, tvb, offset, 2, ENC_LITTLE_ENDIAN);
        offset += 2;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_aoa_destination_elevation_fom, tvb, offset, 1, ENC_NA);
        offset += 1;
        proto_tree_add_item(ranging_measurement_tree,
            hf_uci_slot_index, tvb, offset, 1, ENC_NA);
        offset += 1;
        offset += padding_len;
    }
}

static void dissect_range_stop_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                  proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Range Stop Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
}

static void dissect_range_stop_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                  proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Range Stop Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
}

static void dissect_range_get_ranging_count_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                               proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Range Get Ranging Count Cmd");
    proto_tree_add_item(payload_tree, hf_uci_session_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
}

static void dissect_range_get_ranging_count_rsp(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                               proto_tree *payload_tree)
{
    col_add_fstr(pinfo->cinfo, COL_INFO, "Range Get Ranging Count Rsp");
    proto_tree_add_item(payload_tree, hf_uci_status, tvb, offset, 1, ENC_NA);
    offset += 1;
    proto_tree_add_item(payload_tree, hf_uci_ranging_count, tvb, offset, 4, ENC_LITTLE_ENDIAN);
}

static void dissect_uci_ranging_session_control_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                                   proto_tree *payload_tree, int message_type, int opcode_id)
{
    if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_RANGE_START) {
        dissect_range_start_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_RANGE_START) {
        dissect_range_start_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_NOTIFICATION &&
        opcode_id == UCI_OID_RANGE_DATA) {
        dissect_range_data_ntf(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_RANGE_STOP) {
        dissect_range_stop_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_RANGE_STOP) {
        dissect_range_stop_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND &&
        opcode_id == UCI_OID_RANGE_GET_RANGING_COUNT) {
        dissect_range_get_ranging_count_cmd(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_RESPONSE &&
        opcode_id == UCI_OID_RANGE_GET_RANGING_COUNT) {
        dissect_range_get_ranging_count_rsp(tvb, offset, pinfo, payload_tree);
    }
    else if (message_type == UCI_MT_COMMAND) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Cmd (%02x)", opcode_id);
    }
    else if (message_type == UCI_MT_RESPONSE) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Rsp (%02x)", opcode_id);
    }
    else {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Ranging Session Control Ntf (%02x)", opcode_id);
    }
}

static void dissect_uci_data_control_pdu(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
                                         proto_tree *payload_tree _U_, int message_type, int opcode_id)
{
    if (message_type == UCI_MT_COMMAND) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Cmd (%02x)", opcode_id);
    }
    else if (message_type == UCI_MT_RESPONSE) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Rsp (%02x)", opcode_id);
    }
    else {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Data Control Ntf (%02x)", opcode_id);
    }
}

static void dissect_uci_test_pdu(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
                                 proto_tree *payload_tree _U_, int message_type, int opcode_id)
{
    if (message_type == UCI_MT_COMMAND) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Cmd (%02x)", opcode_id);
    }
    else if (message_type == UCI_MT_RESPONSE) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Rsp (%02x)", opcode_id);
    }
    else {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Test Ntf (%02x)", opcode_id);
    }
}

static void dissect_uci_vendor_pdu(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo,
                                   proto_tree *payload_tree _U_, int message_type, int group_id, int opcode_id)
{
    if (message_type == UCI_MT_COMMAND) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Cmd (%02x)", group_id, opcode_id);
    }
    else if (message_type == UCI_MT_RESPONSE) {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Rsp (%02x)", group_id, opcode_id);
    }
    else {
        col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown Vendor_%02X Ntf (%02x)", group_id, opcode_id);
    }
}

static int dissect_uci_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
    proto_item *ti;
    proto_tree *packet_tree;
    proto_tree *header_tree;
    proto_tree *payload_tree;
    int message_type;
    int group_id;
    int opcode_id;
    int payload_len;
    int offset = 0;

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "UCI");
    col_clear(pinfo->cinfo, COL_INFO);

    ti = proto_tree_add_item(tree, proto_uci, tvb, 0, -1, ENC_NA);
    packet_tree = proto_item_add_subtree(ti, ett_uci);
    header_tree = proto_tree_add_subtree(packet_tree, tvb, offset, UCI_PACKET_HEADER_LEN, ett_uci_header, NULL, "UCI Packet Header");

    proto_tree_add_item(header_tree, hf_uci_message_type, tvb, offset + 0, 1, ENC_NA);
    proto_tree_add_item(header_tree, hf_uci_packet_boundary_flag, tvb, offset + 0, 1, ENC_NA);
    proto_tree_add_item(header_tree, hf_uci_group_id, tvb, offset + 0, 1, ENC_NA);
    proto_tree_add_item(header_tree, hf_uci_opcode_id, tvb, offset + 1, 1, ENC_NA);
    proto_tree_add_item(header_tree, hf_uci_payload_length, tvb, offset + 3, 1, ENC_NA);

    message_type = (tvb_get_guint8(tvb, offset + 0) >> 5) & 0x07;
    group_id = (tvb_get_guint8(tvb, offset + 0) >> 0) & 0x0f;
    opcode_id = tvb_get_guint8(tvb, offset + 1) & 0x3f;
    payload_len = tvb_get_guint8(tvb, offset + 3);

    offset += UCI_PACKET_HEADER_LEN;
    payload_tree = proto_tree_add_subtree(packet_tree, tvb, offset, payload_len, ett_uci_payload, NULL, "UCI Packet Payload");

    switch (group_id) {
    case UCI_GID_CORE: dissect_uci_core_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
    case UCI_GID_SESSION_CONFIG: dissect_uci_session_config_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
    case UCI_GID_RANGING_SESSION_CONTROL: dissect_uci_ranging_session_control_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
    case UCI_GID_DATA_CONTROL: dissect_uci_data_control_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
    case UCI_GID_TEST: dissect_uci_test_pdu(tvb, offset, pinfo, payload_tree, message_type, opcode_id); break;
    default: dissect_uci_vendor_pdu(tvb, offset, pinfo, payload_tree, message_type, group_id, opcode_id); break;
    }

    return tvb_reported_length(tvb);
}

static int dissect_uci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    tcp_dissect_pdus(tvb, pinfo, tree, gPREF_TCP_DESEGMENT, UCI_PACKET_HEADER_LEN,
        get_uci_pdu_len, dissect_uci_pdu, data);
    return tvb_reported_length(tvb);
}

void proto_register_uci(void)
{
    static hf_register_info hf[] = {
        { &hf_uci_message_type,
            { "UCI Message Type", "uci.mt",
                FT_UINT8, BASE_DEC,
                VALS(message_type_vals), 0xe0,
                NULL, HFILL }
        },
        { &hf_uci_packet_boundary_flag,
            { "UCI Packet Boundary Flag", "uci.pbf",
                FT_UINT8, BASE_HEX,
                VALS(packet_boundary_flag_vals), 0x10,
                NULL, HFILL }
        },
        { &hf_uci_group_id,
            { "UCI Group Identifier", "uci.gid",
                FT_UINT8, BASE_HEX,
                VALS(group_id_vals), 0x0f,
                NULL, HFILL }
        },
        { &hf_uci_opcode_id,
            { "UCI Opcode Identifier", "uci.oid",
                FT_UINT8, BASE_HEX,
                NULL, 0x3f,
                NULL, HFILL }
        },
        { &hf_uci_payload_length,
            { "UCI Payload Length", "uci.len",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_status,
            { "Status", "uci.status",
                FT_UINT8, BASE_DEC,
                VALS(status_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_reset_config,
            { "Reset Config", "uci.reset_config",
                FT_UINT8, BASE_DEC,
                VALS(reset_config_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_device_state,
            { "Device State", "uci.device_state",
                FT_UINT8, BASE_DEC,
                VALS(device_state_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_version_major,
            { "Major Version", "uci.major_version",
                FT_UINT16, BASE_DEC,
                NULL, 0x00ff,
                NULL, HFILL }
        },
        { &hf_uci_version_minor,
            { "Minor Version", "uci.minor_version",
                FT_UINT16, BASE_DEC,
                NULL, 0xf000,
                NULL, HFILL }
        },
        { &hf_uci_maintenance_number,
            { "Maintenance Number", "uci.maintenance_number",
                FT_UINT16, BASE_DEC,
                NULL, 0x0f00,
                NULL, HFILL }
        },
        { &hf_uci_generic_version,
            { "UCI Generic Version", "uci.generic_version",
                FT_UINT16, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_mac_version,
            { "MAC Version", "uci.mac_version",
                FT_UINT16, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_phy_version,
            { "PHY Version", "uci.phy_version",
                FT_UINT16, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_test_version,
            { "UCI Test Version", "uci.test_version",
                FT_UINT16, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_vendor_specific_information_length,
            { "Vendor Specific Information Length", "uci.vendor_specific_information_len",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_vendor_specific_information,
            { "Vendor Specific Information", "uci.vendor_specific_information",
                FT_BYTES, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_capability_parameters_count,
            { "Number of Capability Parameters", "uci.capability_parameters_count",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_capability_parameter_type,
            { "Type", "uci.capability_parameter.type",
                FT_UINT8, BASE_HEX,
                VALS(capability_parameter_type_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_capability_parameter_len,
            { "Length", "uci.capability_parameter.len",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_capability_parameter_value,
            { "Value", "uci.capability_parameter.value",
                FT_BYTES, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_parameters_count,
            { "Number of Parameters", "uci.parameters_count",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_parameter_type,
            { "Type", "uci.parameter.type",
                FT_UINT8, BASE_DEC,
                VALS(parameter_type_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_parameter_len,
            { "Length", "uci.parameter.len",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_parameter_value,
            { "Value", "uci.parameter.value",
                FT_BYTES, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_parameter_status,
            { "Status", "uci.parameter.status",
                FT_UINT8, BASE_HEX,
                VALS(status_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_session_id,
            { "Session ID", "uci.session_id",
                FT_UINT32, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_session_type,
            { "Session Type", "uci.session_type",
                FT_UINT8, BASE_HEX,
                VALS(session_type_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_session_state,
            { "Session Type", "uci.session_state",
                FT_UINT8, BASE_HEX,
                VALS(session_state_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_session_count,
            { "Session Count", "uci.session_count",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_app_config_parameters_count,
            { "Number of App Configurations", "uci.app_config_parameters_count",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_app_config_parameter_type,
            { "Type", "uci.app_config_parameter.type",
                FT_UINT8, BASE_DEC,
                VALS(app_config_parameter_type_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_app_config_parameter_len,
            { "Length", "uci.app_config_parameter.len",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_app_config_parameter_value,
            { "Value", "uci.app_config_parameter.value",
                FT_BYTES, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_app_config_parameter_status,
            { "Status", "uci.app_config_parameter.status",
                FT_UINT8, BASE_HEX,
                VALS(status_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_update_controller_multicast_list_action,
            { "Action", "uci.update_controller_multicast_list_action",
                FT_UINT8, BASE_HEX,
                VALS(update_controller_multicast_list_action_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_controlees_count,
            { "Number of Controlees", "uci.controlees_count",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_controlee_short_address,
            { "Short Address", "uci.controlee.short_address",
                FT_UINT16, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_controlee_subsession_id,
            { "Sub-Session ID", "uci.controlee.subsession_id",
                FT_UINT32, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_controlee_status,
            { "Status", "uci.controlee.status",
                FT_UINT8, BASE_HEX,
                VALS(multicast_update_status_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_remaining_multicast_list_size,
            { "Remaining Multicast List Size", "uci.remaining_multicast_list_size",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }

        },
        { &hf_uci_ranging_count,
            { "Count", "uci.ranging_count",
                FT_UINT32, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_sequence_number,
            { "Sequence Number", "uci.sequence_number",
                FT_UINT32, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_current_ranging_interval,
            { "Current Ranging Interval", "uci.current_ranging_interval",
                FT_UINT32, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_ranging_measurement_type,
            { "Ranging Measurement Type", "uci.ranging_measurement_type",
                FT_UINT8, BASE_HEX,
                VALS(ranging_measurement_type_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_mac_addressing_mode_indicator,
            { "MAC Addressing Mode Indicator", "uci.mac_addressing_mode_indicator",
                FT_UINT8, BASE_HEX,
                VALS(mac_addressing_mode_indicator_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_ranging_measurement_count,
            { "Number of Ranging Measurements", "uci.ranging_measurement_count",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_mac_address,
            { "MAC Address", "uci.mac_address",
                FT_BYTES, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_nlos,
            { "NLoS", "uci.nlos",
                FT_UINT8, BASE_HEX,
                VALS(nlos_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_uci_distance,
            { "Distance", "uci.distance",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_azimuth,
            { "AoA Azimuth", "uci.aoa_azimuth",
                FT_INT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_azimuth_fom,
            { "AoA Azimuth FOM", "uci.aoa_azimuth_fom",
                FT_INT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_elevation,
            { "AoA Elevation", "uci.aoa_elevation",
                FT_INT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_elevation_fom,
            { "AoA Elevation FOM", "uci.aoa_elevation_fom",
                FT_INT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_destination_azimuth,
            { "AoA Destination Azimuth", "uci.aoa_destination_azimuth",
                FT_INT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_destination_azimuth_fom,
            { "AoA Destination Azimuth FOM", "uci.aoa_destination_azimuth_fom",
                FT_INT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_destination_elevation,
            { "AoA Destination Elevation", "uci.aoa_destination_elevation",
                FT_INT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_aoa_destination_elevation_fom,
            { "AoA Destination Elevation FOM", "uci.aoa_destination_elevation_fom",
                FT_INT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_uci_slot_index,
            { "Slot Index", "uci.slot_index",
                FT_INT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
    };

    static gint *ett[] = {
        &ett_uci,
        &ett_uci_header,
        &ett_uci_payload,
        &ett_uci_capability_parameters,
        &ett_uci_capability_parameter,
        &ett_uci_parameters,
        &ett_uci_parameter,
        &ett_uci_app_config_parameters,
        &ett_uci_app_config_parameter,
        &ett_uci_controlee_list,
        &ett_uci_controlee,
        &ett_uci_ranging_measurements,
        &ett_uci_ranging_measurement,
    };

    module_t *module_uci;

    proto_uci = proto_register_protocol (
        "UWB UCI Protocol", /* name        */
        "UCI",          /* short name  */
        "uci"           /* filter_name */
        );

    proto_register_field_array(proto_uci, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));

    module_uci = prefs_register_protocol(proto_uci,
                                  proto_reg_handoff_uci);
    prefs_register_uint_preference(module_uci, "tcp.port",
        "TCP port",
        "Select preferred TCP port",
        10,
        &gPREF_TCP_PORT);
    prefs_register_bool_preference(module_uci, "tcp.desegment",
        "TCP desegment",
        "Enable desegmentation of UCI packets over TCP",
        &gPREF_TCP_DESEGMENT);

    handle_uci = create_dissector_handle(dissect_uci, proto_uci);
}

void proto_reg_handoff_uci(void)
{
    dissector_add_uint("tcp.port", gPREF_TCP_PORT, handle_uci);
    dissector_add_uint("wtap_encap", WTAP_ENCAP_FIRA_UCI, handle_uci);
}