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
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
|
/* packet-zbee-tlv.c
* Dissector routines for the Zbee TLV (R23+)
* Copyright 2021 DSR Corporation, http://dsr-wireless.com/
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config.h>
#include <epan/expert.h>
#include <epan/packet.h>
#include <epan/proto_data.h>
#include "packet-ieee802154.h"
#include "packet-ieee802154.h"
#include "packet-zbee-tlv.h"
#include "packet-zbee.h"
#include "packet-zbee-nwk.h"
#include "packet-zbee-zdp.h"
#include "packet-zbee-aps.h"
#include "packet-zbee-direct.h"
#include "conversation.h"
/*-------------------------------------
* Dissector Function Prototypes
*-------------------------------------
*/
static int dissect_zbee_tlv_default(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_);
static guint dissect_zdp_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, guint cmd_id);
static guint dissect_aps_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, void *data, guint cmd_id);
static guint dissect_zbd_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, void* data _U_, guint cmd_id);
static guint dissect_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
//Global TLV Dissector Routines
static guint dissect_zbee_tlv_manufacturer_specific(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, guint8 length);
static guint dissect_zbee_tlv_supported_key_negotiation_methods(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_configuration_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_dev_cap_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_panid_conflict_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_next_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_next_channel_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_passphrase(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_router_information(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_fragmentation_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_potential_parents(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
//Local TLV Dissector Routines
static guint dissect_zbee_tlv_selected_key_negotiation_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_public_point(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, guint8 length);
static guint dissect_zbee_tlv_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_clear_all_bindigs_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_requested_auth_token_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_target_ieee_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_device_auth_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbee_tlv_chanmask(proto_tree *tree, tvbuff_t *tvb, guint offset, int hf_page, int hf_channel);
static guint dissect_zbee_tlv_ext_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_short_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_nwk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_dev_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_nwk_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_join_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_tc_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_nwk_upd_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_adm_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_mj_prov_lnk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_mj_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_mj_cmd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_nwk_channel_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_link_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_nwk_status_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_status_code(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_tunneling_npdu_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset, guint8 length);
static guint dissect_zbee_tlv_key_neg_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
static guint dissect_zbee_tlv_mac_tag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, guint8 mac_tag_size);
static guint dissect_zbee_tlv_nwk_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset);
//Dissectors for ZB Direct
static guint dissect_zbd_msg_status_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbd_msg_tunneling_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbd_msg_manage_joiners_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbd_msg_join_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbd_msg_formation_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
static guint dissect_zbd_msg_secur_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset);
void proto_register_zbee_tlv(void);
/* Initialize Protocol and Registered fields */
static int proto_zbee_tlv = -1;
static dissector_handle_t zigbee_aps_handle;
static dissector_handle_t zbee_nwk_handle;
static int hf_zbee_tlv_global_type = -1;
static int hf_zbee_tlv_local_type_key_update_req_rsp = -1;
static int hf_zbee_tlv_local_type_key_negotiation_req_rsp = -1;
static int hf_zbee_tlv_local_type_get_auth_level_rsp = -1;
static int hf_zbee_tlv_local_type_clear_all_bindings_req = -1;
static int hf_zbee_tlv_local_type_req_security_get_auth_token = -1;
static int hf_zbee_tlv_local_type_req_security_get_auth_level = -1;
static int hf_zbee_tlv_local_type_req_security_decommission = -1;
static int hf_zbee_tlv_local_type_req_beacon_survey = -1;
static int hf_zbee_tlv_local_type_rsp_beacon_survey = -1;
static int hf_zbee_tlv_local_type_req_challenge = -1;
static int hf_zbee_tlv_local_type_rsp_challenge = -1;
static int hf_zbee_tlv_local_type_rsp_set_configuration = -1;
static int hf_zbee_tlv_length = -1;
static int hf_zbee_tlv_type = -1;
static int hf_zbee_tlv_value = -1;
static int hf_zbee_tlv_count = -1;
static int hf_zbee_tlv_manufacturer_specific = -1;
static int hf_zbee_tlv_local_status_count = -1;
static int hf_zbee_tlv_local_type_id = -1;
static int hf_zbee_tlv_local_proc_status = -1;
static int hf_zbee_tlv_local_comm_ext_pan_id = -1;
static int hf_zbee_tlv_local_comm_short_pan_id = -1;
static int hf_zbee_tlv_local_comm_channel_mask = -1;
static int hf_zbee_tlv_local_comm_channel_page = -1;
static int hf_zbee_tlv_local_comm_channel_page_count = -1;
static int hf_zbee_tlv_local_comm_nwk_key = -1;
static int hf_zbee_tlv_local_comm_link_key = -1;
static int hf_zbee_tlv_local_comm_link_key_flags = -1;
static int hf_zbee_tlv_local_comm_link_key_flags_unique = -1;
static int hf_zbee_tlv_local_comm_link_key_flags_provisional = -1;
static int hf_zbee_tlv_local_comm_dev_type = -1;
static int hf_zbee_tlv_local_comm_nwk_addr = -1;
static int hf_zbee_tlv_local_comm_join_method = -1;
static int hf_zbee_tlv_local_comm_tc_addr = -1;
static int hf_zbee_tlv_local_comm_network_status_map = -1;
static int hf_zbee_tlv_local_comm_network_status_map_joined_status = -1;
static int hf_zbee_tlv_local_comm_network_status_map_open_status = -1;
static int hf_zbee_tlv_network_status_map_network_type = -1;
static int hf_zbee_tlv_local_comm_nwk_upd_id = -1;
static int hf_zbee_tlv_local_comm_key_seq_num = -1;
static int hf_zbee_tlv_local_comm_adm_key = -1;
static int hf_zbee_tlv_local_comm_status_code_domain = -1;
static int hf_zbee_tlv_local_comm_status_code_value = -1;
static int hf_zbee_tlv_local_comm_mj_prov_lnk_key = -1;
static int hf_zbee_tlv_local_comm_mj_ieee_addr = -1;
static int hf_zbee_tlv_local_comm_mj_cmd = -1;
static int hf_zbee_tlv_local_tunneling_npdu = -1;
static int hf_zbee_tlv_local_tunneling_npdu_flags = -1;
static int hf_zbee_tlv_local_tunneling_npdu_flags_security = -1;
static int hf_zbee_tlv_local_tunneling_npdu_flags_reserved = -1;
static int hf_zbee_tlv_local_tunneling_npdu_length = -1;
static int hf_zbee_tlv_local_selected_key_method = -1;
static int hf_zbee_tlv_local_selected_psk_secret = -1;
static int hf_zbee_tlv_local_nwk_key_seq_num = -1;
static int hf_zbee_tlv_local_mac_tag = -1;
static int hf_zbee_tlv_zbd_comm_tlv = -1;
static int hf_zbee_tlv_zbd_comm_mj_cmd_tlv = -1;
static int hf_zbee_tlv_zbd_secur_tlv = - 1;
static int hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv = -1;
static int hf_zbee_tlv_next_pan_id = -1;
static int hf_zbee_tlv_next_channel_change =-1;
static int hf_zbee_tlv_passphrase = -1;
static int hf_zbee_tlv_configuration_param = -1;
static int hf_zbee_tlv_configuration_param_restricted_mode =-1;
static int hf_zbee_tlv_configuration_param_link_key_enc = -1;
static int hf_zbee_tlv_configuration_param_leave_req_allowed = -1;
static int hf_zbee_tlv_dev_cap_ext_capability_information = -1;
static int hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device = -1;
static int hf_zbee_tlv_challenge_value = -1;
static int hf_zbee_tlv_aps_frame_counter = -1;
static int hf_zbee_tlv_challenge_counter = -1;
static int hf_zbee_tlv_mic64 = -1;
static int hf_zbee_tlv_lqa = -1;
static int hf_zbee_tlv_router_information = -1;
static int hf_zbee_tlv_router_information_hub_connectivity = -1;
static int hf_zbee_tlv_router_information_uptime = -1;
static int hf_zbee_tlv_router_information_pref_parent = -1;
static int hf_zbee_tlv_router_information_battery_backup = -1;
static int hf_zbee_tlv_router_information_enhanced_beacon_request_support = -1;
static int hf_zbee_tlv_router_information_mac_data_poll_keepalive_support = -1;
static int hf_zbee_tlv_router_information_end_device_keepalive_support = -1;
static int hf_zbee_tlv_router_information_power_negotiation_support = -1;
static int hf_zbee_tlv_node_id = -1;
static int hf_zbee_tlv_frag_opt = -1;
static int hf_zbee_tlv_max_reassembled_buf_size = -1;
static int hf_zbee_tlv_supported_key_negotiation_methods = -1;
static int hf_zbee_tlv_supported_key_negotiation_methods_key_request = -1;
static int hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128 = -1;
static int hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256 = -1;
static int hf_zbee_tlv_supported_secrets = -1;
static int hf_zbee_tlv_supported_preshared_secrets_auth_token = -1;
static int hf_zbee_tlv_supported_preshared_secrets_ic = -1;
static int hf_zbee_tlv_supported_preshared_secrets_passcode_pake = -1;
static int hf_zbee_tlv_supported_preshared_secrets_basic_access_key = -1;
static int hf_zbee_tlv_supported_preshared_secrets_admin_access_key = -1;
static int hf_zbee_tlv_panid_conflict_cnt = -1;
static int hf_zbee_tlv_selected_key_negotiation_method = -1;
static int hf_zbee_tlv_selected_pre_shared_secret = -1;
static int hf_zbee_tlv_device_eui64 = -1;
static int hf_zbee_tlv_public_point = -1;
static int hf_zbee_tlv_global_tlv_id = -1;
static int hf_zbee_tlv_local_ieee_addr = -1;
static int hf_zbee_tlv_local_initial_join_method = -1;
static int hf_zbee_tlv_local_active_lk_type = -1;
static int hf_zbee_tlv_relay_msg_type = -1;
static int hf_zbee_tlv_relay_msg_length = -1;
static int hf_zbee_tlv_relay_msg_joiner_ieee = -1;
static gint ett_zbee_aps_tlv = -1;
static gint ett_zbee_aps_relay = -1;
static gint ett_zbee_tlv = -1;
static gint ett_zbee_tlv_supported_key_negotiation_methods = -1;
static gint ett_zbee_tlv_supported_secrets = -1;
static gint ett_zbee_tlv_router_information = -1;
static gint ett_zbee_tlv_configuration_param = -1;
static gint ett_zbee_tlv_capability_information = -1;
static gint ett_zbee_tlv_zbd_tunneling_npdu = -1;
static gint ett_zbee_tlv_zbd_tunneling_npdu_flags = -1;
static gint ett_zbee_tlv_link_key_flags = -1;
static gint ett_zbee_tlv_network_status_map = -1;
static expert_field ei_zbee_tlv_max_recursion_depth_reached;
static const value_string zbee_tlv_local_types_key_method_str[] =
{
{ ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_AESMMO128, "Curve 25519 / AESMMO-128" },
{ ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_25519_HASH_SHA256, "Curve 25519 / SHA-256" },
{ ZBEE_TLV_TYPE_KEY_ECDHE_CURVE_P256_HASH_SHA256, "P-256 / SHA-256" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_psk_secret_str[] =
{
{ ZBEE_TLV_TYPE_PSK_WELL_KNOWN_KEY, "Well known key" },
{ ZBEE_TLV_TYPE_PSK_SECRET_AUTH_TOKEN, "Authorization token" },
{ ZBEE_TLV_TYPE_PSK_SECRET_INSTALL_CODE, "Pre-configured link-ley derived from installation code" },
{ ZBEE_TLV_TYPE_PSK_SECRET_PAKE_PASSCODE, "PAKE passcode" },
{ ZBEE_TLV_TYPE_PSK_SECRET_BASIC_ACCESS_KEY, "Basic Access Key" },
{ ZBEE_TLV_TYPE_PSK_SECRET_ADMINISTRATIVE_ACCESS_KEY, "Administrative Access Key" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_dev_type_str[] =
{
{ ZBEE_TLV_TYPE_DEV_TYPE_ZC, "ZigBee Coordinator" },
{ ZBEE_TLV_TYPE_DEV_TYPE_ZR, "ZigBee Router" },
{ ZBEE_TLV_TYPE_DEV_TYPE_ED, "ZigBee End Device" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_join_method_str[] =
{
{ ZBEE_TLV_TYPE_JOIN_METHOD_MAC_ASS, "MAC association" },
{ ZBEE_TLV_TYPE_JOIN_METHOD_NWK_REJ, "NWK rejoin" },
{ ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITH_CHECK, "Out-of-band commissioning (with check for nearby IEEE 802.15.4 beacons)" },
{ ZBEE_TLV_TYPE_JOIN_METHOD_OOB_WITHOUT_CHECK, "Out-of-band commissioning (without check for nearby IEEE 802.15.4 beacons)" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_status_code_domain_str[] =
{
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_GENERAL, "General domain or unspecific operation" },
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FORM, "Form Network Operation" },
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_JOIN, "Join Network Operation" },
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_PERMIT_JOIN, "Permit Joining Operation" },
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_LEAVE, "Leave Network Operation" },
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_MANAGE_JOINERS, "Manage Joiners Domain" },
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_IDENTIFY, "Identify Operation" },
{ ZBEE_TLV_TYPE_ZBD_STATUS_DOMAIN_FINDING_BINDING, "Finding & Binding Domain" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_joined_status_str[] =
{
{ ZBEE_TLV_TYPE_JOINED_STATUS_NO_NWK, "No network" },
{ ZBEE_TLV_TYPE_JOINED_STATUS_JOINING, "Joining" },
{ ZBEE_TLV_TYPE_JOINED_STATUS_JOINED, "Joined" },
{ ZBEE_TLV_TYPE_JOINED_STATUS_JOINED_NO_PARENT, "Joined (no parent)" },
{ ZBEE_TLV_TYPE_JOINED_STATUS_LEAVING, "Leaving" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_nwk_type_str[] =
{
{ ZBEE_TLV_NWK_TYPE_DISTRIBUTED, "Distributed" },
{ ZBEE_TLV_NWK_TYPE_CENTRALIZED, "Centralized" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_nwk_state_str[] =
{
{ ZBEE_TLV_TYPE_NWK_STATE_CLOSED, "Closed" },
{ ZBEE_TLV_TYPE_NWK_STATE_OPENED, "Opened" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_mj_cmd_str[] =
{
{ ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_DROP, "Drop all joiners' Provisional Link Keys" },
{ ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_ADD, "Add a joiner's Provisional Link Key" },
{ ZBEE_TLV_TYPE_MANAGE_JOINERS_CMD_REMOVE, "Remove a joiner's Provisional Link Key" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_lnk_key_unique_str[] =
{
{ ZBEE_TLV_TYPE_LINK_KEY_FLAG_GLOBAL, "Global" },
{ ZBEE_TLV_TYPE_LINK_KEY_FLAG_UNIQUE, "Unique" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_lnk_key_provisional_str[] =
{
{ ZBEE_TLV_TYPE_LINK_KEY_FLAG_PERMANENT, "Permanent" },
{ ZBEE_TLV_TYPE_LINK_KEY_FLAG_PROVISIONAL, "Provisional" },
{ 0, NULL }
};
static const value_string zbee_tlv_zbd_comm_types[] = {
{ ZBEE_TLV_TYPE_COMM_EXT_PAN_ID, "Extended PAN ID" },
{ ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID, "Short PAN ID" },
{ ZBEE_TLV_TYPE_COMM_NWK_CH, "Network Channel" },
{ ZBEE_TLV_TYPE_COMM_NWK_KEY, "Network Key" },
{ ZBEE_TLV_TYPE_COMM_LNK_KEY, "Link Key" },
{ ZBEE_TLV_TYPE_COMM_DEV_TYPE, "Device Type" },
{ ZBEE_TLV_TYPE_COMM_NWK_ADDR, "NWK Address" },
{ ZBEE_TLV_TYPE_COMM_JOIN_METHOD, "Joining Method" },
{ ZBEE_TLV_TYPE_COMM_IEEE_ADDR, "IEEE Address" },
{ ZBEE_TLV_TYPE_COMM_TC_ADDR, "Trust Center Address" },
{ ZBEE_TLV_TYPE_COMM_NWK_STATUS_MAP, "Network Status Map" },
{ ZBEE_TLV_TYPE_COMM_NWK_UPD_ID, "NWK Update ID" },
{ ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM, "NWK Active Key Seq Number" },
{ ZBEE_TLV_TYPE_COMM_ADMIN_KEY, "Admin Key" },
{ ZBEE_TLV_TYPE_COMM_STATUS_CODE, "Status Code" },
// TODO: Not implemented yet
// { 0x0f, "Extended Status Code" },
{ 0, NULL }
};
static const value_string zbee_tlv_zbd_comm_mj_types[] = {
{ ZBEE_TLV_TYPE_COMM_MJ_PROVISIONAL_LINK_KEY, "Provisional Link" },
{ ZBEE_TLV_TYPE_COMM_MJ_IEEE_ADDR, "IEEE Address" },
{ ZBEE_TLV_TYPE_COMM_MJ_CMD, "Manage Joiners Command" },
// 0x03-0xff - Reserved
{ 0, NULL }
};
static const value_string zbee_tlv_zbd_secur_types[] = {
{ ZBEE_TLV_TYPE_KEY_METHOD, "ZBD Key Negotiation Method TLV" },
{ ZBEE_TLV_TYPE_PUB_POINT_P256, "ZBD Key Negotiation P-256 Public Point TLV" },
{ ZBEE_TLV_TYPE_PUB_POINT_C25519, "ZBD Key Negotiation Curve25519 Public Point TLV" },
{ ZBEE_TLV_TYPE_NWK_KEY_SEQ_NUM, "Network KeySequence Number TLV" },
{ ZBEE_TLV_TYPE_MAC_TAG, "MacTag Tlv" },
{ 0, NULL }
};
static const value_string zbee_aps_relay_tlvs[] = {
{ 0, "Relay Message TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_global_types[] = {
{ ZBEE_TLV_TYPE_MANUFACTURER_SPECIFIC, "Manufacturer Specific Global TLV" },
{ ZBEE_TLV_TYPE_SUPPORTED_KEY_NEGOTIATION_METHODS, "Supported Key Negotiation Methods Global TLV" },
{ ZBEE_TLV_TYPE_PANID_CONFLICT_REPORT, "PAN ID Conflict Report Global TLV"},
{ ZBEE_TLV_TYPE_NEXT_PAN_ID, "Next PAN ID Global TLV" },
{ ZBEE_TLV_TYPE_NEXT_CHANNEL_CHANGE, "Next Channel Change Global TLV" },
{ ZBEE_TLV_TYPE_PASSPHRASE, "Passphrase Global TLV" },
{ ZBEE_TLV_TYPE_ROUTER_INFORMATION, "Router Information Global TLV" },
{ ZBEE_TLV_TYPE_FRAGMENTATION_PARAMETERS, "Fragmentation Parameters Global TLV" },
{ ZBEE_TLV_TYPE_JOINER_ENCAPSULATION_GLOBAL, "Joiner Encapsulation Global TLV" },
{ ZBEE_TLV_TYPE_BEACON_APPENDIX_ENCAPSULATION_GLOBAL, "Beacon Appendix Encapsulation Global TLV" },
{ ZBEE_TLV_TYPE_CONFIGURATION_MODE_PARAMETERS, "Configuration Mode Parameters Global TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_key_update_req_rsp[] = {
{ ZBEE_TLV_TYPE_KEY_UPD_REQ_SELECTED_KEY_NEGOTIATION_METHOD, "Selected Key Negotiations Method Local TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_key_negotiation_req_rsp[] = {
{ ZBEE_TLV_TYPE_KEY_NEG_REQ_CURVE25519_PUBLIC_POINT, "Curve25519 Public Point Local TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_get_auth_level_rsp[] = {
{ ZBEE_TLV_TYPE_GET_AUTH_LEVEL, "Device Authentication Level TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_clear_all_bindings_req[] = {
{ ZBEE_TLV_TYPE_CLEAR_ALL_BINDIGS_REQ_EUI64, "Clear All Bindings Req EUI64 TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_req_security_get_auth_token[] = {
{ ZBEE_TLV_TYPE_REQUESTED_AUTH_TOKEN_ID, "Requested Authentication Token ID TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_req_security_get_auth_level[] = {
{ ZBEE_TLV_TYPE_TARGET_IEEE_ADDRESS, "Target IEEE Address TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_req_security_decommission[] = {
{ ZBEE_TLV_TYPE_EUI64, "EUI64 TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_req_beacon_survey[] = {
{ ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION, "Beacon Survey Configuration TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_req_challenge[] = {
{ 0, "APS Frame Counter Challenge Request TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_rsp_challenge[] = {
{ 0, "APS Frame Counter Challenge Response TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_rsp_set_configuration[] = {
{ 0, "Processing status TLV" },
{ 0, NULL }
};
static const value_string zbee_tlv_local_types_rsp_beacon_survey[] = {
{ ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION, "Beacon Survey Configuration TLV" },
{ ZBEE_TLV_TYPE_BEACON_SURVEY_RESULTS, "Beacon Survey Results TLV" },
{ ZBEE_TLV_TYPE_BEACON_SURVEY_POTENTIAL_PARENTS, "Beacon Survey Potential Parents TLV"},
{ 0, NULL }
};
static const value_string zbee_tlv_selected_key_negotiation_method[] = {
{ ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ZB_30, "Zigbee 3.0" },
{ ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_AES_MMO128, "ECDHE using Curve25519 with Hash AES-MMO-128" },
{ ZBEE_TLV_SELECTED_KEY_NEGOTIATION_METHODS_ECDHE_USING_CURVE25519_SHA256, "ECDHE using Curve25519 with Hash SHA-256" },
{ 0, NULL }
};
static const value_string zbee_tlv_selected_pre_shared_secret[] = {
{ ZBEE_TLV_SELECTED_PRE_SHARED_WELL_KNOWN_KEY, "Well Known Key" },
{ ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_AUTH_TOKEN, "Symmetric Authentication Token" },
{ ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_LINK_KEY_IC, "Pre-configured link-ley derived from installation code" },
{ ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_VLEN_PASSCODE, "Variable-length pass code" },
{ ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_BASIC_ACCESS_KEY, "Basic Access Key" },
{ ZBEE_TLV_SELECTED_PRE_SHARED_SECRET_ADMIN_ACCESS_KEY, "Administrative Access Key" },
{ 0, NULL }
};
static const value_string zbee_initial_join_methods[] = {
{ 0x00, "No authentication" },
{ 0x01, "Install Code Key" },
{ 0x02, "Anonymous key negotiation" },
{ 0x03, "Authentication Key Negotiation" },
{ 0, NULL }
};
static const value_string zbee_active_lk_types[] = {
{ 0x00, "Not Updated" },
{ 0x01, "Key Request Method" },
{ 0x02, "Unauthentication Key Negotiation" },
{ 0x03, "Authentication Key Negotiation" },
{ 0x04, "Application Defined Certificate Based Mutual" },
{ 0, NULL }
};
static guint
dissect_aps_relay_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, void *data)
{
tvbuff_t *relay_tvb;
proto_item *relayed_frame_root;
proto_tree *relayed_frame_tree;
guint8 length;
zbee_nwk_hints_t *nwk_hints;
zigbee_aps_handle = find_dissector("zbee_aps");
proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_type, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset) + 1;
proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_length, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_relay_msg_joiner_ieee, tvb, offset, 8, ENC_LITTLE_ENDIAN);
nwk_hints = (zbee_nwk_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo,
proto_get_id_by_filter_name(ZBEE_PROTOABBREV_NWK), 0);
nwk_hints->joiner_addr64 = tvb_get_letoh64(tvb, offset);
offset += 8;
/* The remainder is a relayed APS frame. */
relay_tvb = tvb_new_subset_remaining(tvb, offset);
relayed_frame_tree = proto_tree_add_subtree_format(tree, tvb, offset, length - 8, ett_zbee_aps_relay, &relayed_frame_root,
"Relayed APS Frame");
call_dissector_with_data(zigbee_aps_handle, relay_tvb, pinfo, relayed_frame_tree, data);
/* Add column info */
col_append_str(pinfo->cinfo, COL_INFO, ", Relay");
return tvb_captured_length(tvb);
}
static guint
dissect_aps_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, void *data, guint cmd_id)
{
switch (cmd_id) {
case ZBEE_APS_CMD_RELAY_MSG_UPSTREAM:
case ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM:
{
zbee_nwk_hints_t *nwk_hints = (zbee_nwk_hints_t *)p_get_proto_data(wmem_file_scope(), pinfo,
proto_get_id_by_filter_name(ZBEE_PROTOABBREV_NWK), 0);
nwk_hints->relay_type = (cmd_id == ZBEE_APS_CMD_RELAY_MSG_DOWNSTREAM ? ZBEE_APS_RELAY_DOWNSTREAM : ZBEE_APS_RELAY_UPSTREAM);
}
offset = dissect_aps_relay_local_tlv(tvb, pinfo, tree, offset, data);
break;
default:
{
offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
break;
}
}
return offset;
}
/*
*Helper dissector for the Security Decommission Request.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_req_security_decommission_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_decommission, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case ZBEE_TLV_TYPE_EUI64:
offset = dissect_zbee_tlv_eui64(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Get Authentication Level Request.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_req_security_get_auth_level_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_get_auth_level, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case ZBEE_TLV_TYPE_TARGET_IEEE_ADDRESS:
offset = dissect_zbee_tlv_target_ieee_address(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Get Authentication Token Request.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_req_security_get_auth_token_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_security_get_auth_token, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case ZBEE_TLV_TYPE_REQUESTED_AUTH_TOKEN_ID:
offset = dissect_zbee_tlv_requested_auth_token_id(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Clear All Bindings Request.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_req_clear_all_bindings_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_clear_all_bindings_req, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case ZBEE_TLV_TYPE_CLEAR_ALL_BINDIGS_REQ_EUI64:
offset = dissect_zbee_tlv_clear_all_bindigs_eui64(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Beacon Survey Request.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_req_beacon_survey_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_beacon_survey, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION:
{
guint8 cnt;
guint8 i;
cnt = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
for (i = 0; i < cnt; i++)
{
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_conf_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
break;
}
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Beacon Survey Response.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_rsp_beacon_survey_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_rsp_beacon_survey, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case ZBEE_TLV_TYPE_BEACON_SURVEY_CONFIGURATION:
{
guint8 cnt;
guint8 i;
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_conf_mask, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
cnt = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask_cnt, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
for (i = 0; i < cnt; i++)
{
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_scan_mask, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
break;
}
case ZBEE_TLV_TYPE_BEACON_SURVEY_RESULTS:
{
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_total, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cur_zbn, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cur_zbn_potent_parents, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_other_zbn, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
break;
}
case ZBEE_TLV_TYPE_BEACON_SURVEY_POTENTIAL_PARENTS:
offset = dissect_zbee_tlv_potential_parents(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Challenge Request.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_req_security_challenge_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_req_challenge, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case 0:
{
proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
proto_tree_add_item(tree, hf_zbee_tlv_challenge_value, tvb, offset, 8, ENC_NA);
offset += 8;
break;
}
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Challenge Response.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_rsp_security_challenge_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_rsp_challenge, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case 0:
{
proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
proto_tree_add_item(tree, hf_zbee_tlv_challenge_value, tvb, offset, 8, ENC_NA);
offset += 8;
proto_tree_add_item(tree, hf_zbee_tlv_aps_frame_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_zbee_tlv_challenge_counter, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_zbee_tlv_mic64, tvb, offset, 8, ENC_NA);
offset += 8;
break;
}
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Challenge Response.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_rsp_security_set_configuration_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_rsp_set_configuration, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case 0:
{
guint8 count;
guint8 i;
count = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_status_count, tvb, offset, 1, ENC_NA);
offset += 1;
for (i = 0; i < count; i++)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_type_id, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_local_proc_status, tvb, offset, 1, ENC_NA);
offset += 1;
}
break;
}
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Start Key Negotiation req/rsp
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_security_start_key_neg_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_key_negotiation_req_rsp, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1; /* actual length */
switch (type) {
case ZBEE_TLV_TYPE_KEY_NEG_REQ_CURVE25519_PUBLIC_POINT:
offset = dissect_zbee_tlv_public_point(tvb, pinfo, tree, offset, length);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Start Key Update req/rsp
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_security_key_upd_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_key_update_req_rsp, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1; /* actual length */
switch (type) {
case ZBEE_TLV_TYPE_KEY_UPD_REQ_SELECTED_KEY_NEGOTIATION_METHOD:
offset = dissect_zbee_tlv_selected_key_negotiation_method(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the Security Get Auth Level Response.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zdp_rsp_security_get_auth_level_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_local_type_get_auth_level_rsp, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type) {
case ZBEE_TLV_TYPE_GET_AUTH_LEVEL:
offset = dissect_zbee_tlv_device_auth_level(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the ZDP commands.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@param cmd_id - ZDP command id .
*@return offset after command dissection.
*/
static guint
dissect_zdp_local_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, guint cmd_id)
{
guint8 total_tlv_length = 2 /*type + len fields*/ + tvb_get_guint8(tvb, offset + 1) + 1;
guint8 tmp_offset = offset;
switch (cmd_id) {
case ZBEE_ZDP_REQ_CLEAR_ALL_BINDINGS:
offset = dissect_zdp_req_clear_all_bindings_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_REQ_SECURITY_START_KEY_UPDATE:
case ZBEE_ZDP_RSP_SECURITY_START_KEY_UPDATE:
case ZBEE_ZDP_RSP_NODE_DESC:
offset = dissect_zdp_security_key_upd_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_REQ_SECURITY_START_KEY_NEGOTIATION:
case ZBEE_ZDP_RSP_SECURITY_START_KEY_NEGOTIATION:
offset = dissect_zdp_security_start_key_neg_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_TOKEN:
offset = dissect_zdp_req_security_get_auth_token_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_REQ_SECURITY_GET_AUTH_LEVEL:
offset = dissect_zdp_req_security_get_auth_level_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_REQ_SECURITY_DECOMMISSION:
offset = dissect_zdp_req_security_decommission_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_RSP_SECURITY_GET_AUTH_LEVEL:
offset = dissect_zdp_rsp_security_get_auth_level_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_REQ_MGMT_NWK_BEACON_SURVEY:
offset = dissect_zdp_req_beacon_survey_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_RSP_MGMT_NWK_BEACON_SURVEY:
offset = dissect_zdp_rsp_beacon_survey_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_REQ_SECURITY_CHALLENGE:
offset = dissect_zdp_req_security_challenge_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_RSP_SECURITY_CHALLENGE:
offset = dissect_zdp_rsp_security_challenge_local_tlv(tvb, pinfo, tree, offset);
break;
case ZBEE_ZDP_RSP_SECURITY_SET_CONFIGURATION:
offset = dissect_zdp_rsp_security_set_configuration_local_tlv(tvb, pinfo, tree, offset);
break;
default:
{
offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
break;
}
}
/* check extra bytes */
if ((offset - tmp_offset) < total_tlv_length)
{
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, total_tlv_length - 2, ENC_NA);
offset = tmp_offset + total_tlv_length;
}
return offset;
}
/**
* Helper dissector for a channel mask.
*
* @param tree pointer to data tree Wireshark uses to display packet.
* @param tvb pointer to buffer containing raw packet.
* @param offset offset into the tvb to find the status value.
* @param hf_page page field index
* @param hf_channel channel field index
* @return mask
*/
static guint
dissect_zbee_tlv_chanmask(proto_tree *tree, tvbuff_t *tvb, guint offset, int hf_page, int hf_channel)
{
gint i;
guint32 mask;
guint8 page;
proto_item *ti;
/* Get and display the channel mask. */
mask = tvb_get_letohl(tvb, offset);
page = (guint8)((mask >> 27) & 0x07);
mask &= 0x07FFFFFFUL;
proto_tree_add_uint(tree, hf_page, tvb, offset, 4, page);
ti = proto_tree_add_uint_format(tree, hf_channel, tvb, offset, 4, mask, "Channels: ");
/* Check if there are any channels to display. */
if (mask == 0)
{
proto_item_append_text(ti, "None");
}
/* Display the first channel #. */
for (i = 0; i < 32; i++)
{
if ((1 << i) & mask)
{
proto_item_append_text(ti, "%d", i++);
break;
}
}
/* Display the rest of the channels. */
for (; i < 32; i++)
{
if (!((1 << i) & mask))
{
/* This channel isn't selected. */
continue;
}
/* If the previous channel wasn't selected,
* then display the channel number.
*/
if (!((1 << (i - 1)) & mask))
{
proto_item_append_text(ti, ", %d", i);
}
/* If the next channel is selected too,
* skip past it and display a range of values instead.
*/
if ((2 << i) & mask)
{
while ((2 << i) & mask) i++;
proto_item_append_text(ti, "-%d", i);
}
}
offset += sizeof(guint32);
return offset;
}
/**
* Dissector Extended PAN ID TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint
dissect_zbee_tlv_ext_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_ext_pan_id, tvb, offset, 8, ENC_NA);
offset += 8;
return offset;
};
/**
* Dissector Short PAN ID TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint
dissect_zbee_tlv_short_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_short_pan_id, tvb, offset, 2, ENC_NA);
offset += 2;
return offset;
};
/**
* Dissector NWK Key TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_nwk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_key, tvb, offset, 16, ENC_NA);
offset += 16;
return offset;
};
/**
* Dissector Device Type TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_dev_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_dev_type, tvb, offset, 1, ENC_NA);
offset += 1;
return offset;
};
/**
* Dissector NWK Address TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_nwk_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_addr, tvb, offset, 2, ENC_NA);
offset += 2;
return offset;
};
/**
* Dissector Joining Method TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_join_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_join_method, tvb, offset, 1, ENC_NA);
offset += 1;
return offset;
};
/**
* Dissector IEEE Address TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_NA);
offset += 8;
return offset;
};
/**
* Dissector Trust Center Address TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_tc_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_tc_addr, tvb, offset, 8, ENC_NA);
offset += 8;
return offset;
};
/**
* Dissector NWK Update ID TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_nwk_upd_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_nwk_upd_id, tvb, offset, 1, ENC_NA);
offset += 1;
return offset;
};
/**
* Dissector NWK Active Key Seq Number TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_key_seq_num, tvb, offset, 1, ENC_NA);
offset += 1;
return offset;
};
/**
* Dissector Admin Key TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_adm_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_adm_key, tvb, offset, 16, ENC_NA);
offset += 16;
return offset;
};
/**
* Dissector (Manager Joiners) Provisional Link Key TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_mj_prov_lnk_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_prov_lnk_key, tvb, offset, 16, ENC_NA);
offset += 16;
return offset;
};
/**
* Dissector (Manager Joiners) IEEE Address TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_mj_ieee_addr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_ieee_addr, tvb, offset, 8, ENC_NA);
offset += 8;
return offset;
};
/**
* Dissector (Manager Joiners) Command TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint dissect_zbee_tlv_mj_cmd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_mj_cmd, tvb, offset, 1, ENC_NA);
offset += 1;
return offset;
};
/**
* Dissector Channel List TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint
dissect_zbee_tlv_nwk_channel_list(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
guint32 count = 0;
proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_comm_channel_page_count, tvb, offset, 1, ENC_LITTLE_ENDIAN, &count);
offset += 1;
for (guint i = 0; i < count; i++)
{
offset = dissect_zbee_tlv_chanmask(tree, tvb, offset, hf_zbee_tlv_local_comm_channel_page, hf_zbee_tlv_local_comm_channel_mask);
}
return offset;
}
/**
* Dissector Link Key TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint
dissect_zbee_tlv_link_key(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
static int * const link_key_flags[] = {
&hf_zbee_tlv_local_comm_link_key_flags_unique,
&hf_zbee_tlv_local_comm_link_key_flags_provisional,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_local_comm_link_key_flags, ett_zbee_tlv_link_key_flags, link_key_flags, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_link_key, tvb, offset, 16, ENC_NA);
offset += 16;
return offset;
}
/**
* Dissector NWK Status Map TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint
dissect_zbee_tlv_nwk_status_map(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
guint8 mask;
guint joined, opened, centralized;
static int * const network_status_map[] = {
&hf_zbee_tlv_local_comm_network_status_map_joined_status,
&hf_zbee_tlv_local_comm_network_status_map_open_status,
&hf_zbee_tlv_network_status_map_network_type,
NULL
};
mask = tvb_get_guint8(tvb, offset);
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_local_comm_network_status_map, ett_zbee_tlv_network_status_map, network_status_map, ENC_LITTLE_ENDIAN);
offset += 1;
joined = (mask & ZBEE_TLV_STATUS_MAP_JOINED_STATUS) >> 0;
opened = (mask & ZBEE_TLV_STATUS_MAP_OPEN_STATUS) >> 3;
centralized = (mask & ZBEE_TLV_STATUS_MAP_NETWORK_TYPE) >> 4;
if (joined == ZB_DIRECT_JOINED_STATUS_JOINED || joined == ZB_DIRECT_JOINED_STATUS_JOINED_NO_PARENT)
{
col_append_fstr(pinfo->cinfo,
COL_INFO,
" (%s, %s, %s)",
zbee_tlv_local_types_joined_status_str[joined].strptr,
opened ? "Opened" : "Closed",
centralized ? "Centralized" : "Distributed");
}
else
{
col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", zbee_tlv_local_types_joined_status_str[joined].strptr);
}
return offset;
}
/**
* Dissector Status Code TLV.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @param offset offset into the tvb to begin dissection
* @return offset after dissection
*/
static guint
dissect_zbee_tlv_status_code(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
guint32 code;
proto_item *code_item;
proto_tree_add_item(tree, hf_zbee_tlv_local_comm_status_code_domain, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
code_item = proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_comm_status_code_value, tvb, offset, 1, ENC_LITTLE_ENDIAN, &code);
offset += 1;
proto_item_append_text(code_item, " (%s)", (code == 0) ? "Success" : "Failure");
return offset;
}
/**
* Helper dissector for Tunneling.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to subtree
* @return offset after dissection
*/
static guint
dissect_zbee_tlv_tunneling_npdu_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, unsigned offset,
guint8 length)
{
guint32 npdu_len = 0;
/* Parse NPDU Message TLV */
{
proto_item *npdu_flags_item = proto_tree_add_item(tree, hf_zbee_tlv_local_tunneling_npdu_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree *npdu_flags_tree = proto_item_add_subtree(npdu_flags_item, ett_zbee_tlv_zbd_tunneling_npdu_flags);
gboolean secur;
proto_tree_add_item_ret_boolean(npdu_flags_tree, hf_zbee_tlv_local_tunneling_npdu_flags_security, tvb, offset, 1, ENC_LITTLE_ENDIAN, &secur);
proto_tree_add_item_ret_uint(tree, hf_zbee_tlv_local_tunneling_npdu_length, tvb, offset + 1, 1, ENC_LITTLE_ENDIAN, &npdu_len);
proto_item_append_text(npdu_flags_item, ", Security: %s", secur ? "True" : "False");
proto_tree_add_item(npdu_flags_tree, hf_zbee_tlv_local_tunneling_npdu_flags_reserved, tvb, offset, 1, ENC_LITTLE_ENDIAN);
}
/* Proceed with NPDU that holds a Zigbee NWK frame */
{
proto_item *npdu_item = proto_tree_add_item(tree, hf_zbee_tlv_local_tunneling_npdu, tvb, offset + 2, npdu_len, ENC_NA);
proto_tree *npdu_tree = proto_item_add_subtree(npdu_item, ett_zbee_tlv_zbd_tunneling_npdu);
ieee802154_packet packet;
memset(&packet, 0, sizeof(packet));
call_dissector_with_data(zbee_nwk_handle,
tvb_new_subset_length(tvb, offset + 2, npdu_len),
pinfo,
npdu_tree,
&packet);
}
offset += length;
return offset;
}
/**
* Checks a curve, that was selected in the method.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to the command subtree
* @param offset offset into the tvb to begin dissection
* @return offset after command dissection
*/
static guint
dissect_zbee_tlv_key_neg_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_selected_key_method, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_local_selected_psk_secret, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
return offset;
}
/**
* Helper dissector for the MAC tag.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to the command subtree
* @param offset offset into the tvb to begin dissection
* @return offset after command dissection
*/
static guint
dissect_zbee_tlv_mac_tag(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset, guint8 mac_tag_size)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_mac_tag, tvb, offset, mac_tag_size, ENC_NA);
offset += mac_tag_size;
return offset;
}
/**
* Helper dissector for the NWK key sequence number.
*
* @param tvb pointer to buffer containing raw packet
* @param pinfo pointer to packet information fields
* @param tree pointer to the command subtree
* @param offset offset into the tvb to begin dissection
* @return offset after command dissection
*/
static guint
dissect_zbee_tlv_nwk_key_seq_num(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_nwk_key_seq_num, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
return offset;
}
/*
*Helper dissector for the ZB Direct Status.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbd_msg_status_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type)
{
case ZBEE_TLV_TYPE_COMM_IEEE_ADDR:
offset = dissect_zbee_tlv_ieee_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_STATUS_MAP:
offset = dissect_zbee_tlv_nwk_status_map(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_TC_ADDR:
offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_CH:
offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_KEY:
offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_DEV_TYPE:
offset = dissect_zbee_tlv_dev_type(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_STATUS_CODE:
offset = dissect_zbee_tlv_status_code(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the ZB Direct Tunneling.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbd_msg_tunneling_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 opcode = tvb_get_guint8(tvb, offset);
guint8 length;
proto_tree_add_item(tree, hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (opcode)
{
case ZBEE_TLV_TYPE_TUNNELING_NPDU_MESSAGE:
{
col_set_fence(pinfo->cinfo, COL_PROTOCOL);
offset = dissect_zbee_tlv_tunneling_npdu_msg(tvb, pinfo, tree, offset, length);
break;
}
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the ZB Direct Manage Joiners.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbd_msg_manage_joiners_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_mj_cmd_tlv, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type)
{
case ZBEE_TLV_TYPE_COMM_MJ_CMD:
offset = dissect_zbee_tlv_mj_cmd(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_MJ_IEEE_ADDR:
offset = dissect_zbee_tlv_mj_ieee_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_MJ_PROVISIONAL_LINK_KEY:
offset = dissect_zbee_tlv_mj_prov_lnk_key(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the ZB Direct Direct Join.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbd_msg_join_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type)
{
case ZBEE_TLV_TYPE_COMM_JOIN_METHOD:
offset = dissect_zbee_tlv_join_method(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_ADMIN_KEY:
offset = dissect_zbee_tlv_adm_key(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_TC_ADDR:
offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_CH:
offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_KEY:
offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_LNK_KEY:
offset = dissect_zbee_tlv_link_key(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the ZB Direct Formation.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbd_msg_formation_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_zbd_comm_tlv, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type)
{
case ZBEE_TLV_TYPE_COMM_ADMIN_KEY:
offset = dissect_zbee_tlv_adm_key(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_TC_ADDR:
offset = dissect_zbee_tlv_tc_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_EXT_PAN_ID:
offset = dissect_zbee_tlv_ext_pan_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_SHORT_PAN_ID:
offset = dissect_zbee_tlv_short_pan_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_CH:
offset = dissect_zbee_tlv_nwk_channel_list(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_KEY:
offset = dissect_zbee_tlv_nwk_key(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_LNK_KEY:
offset = dissect_zbee_tlv_link_key(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_ADDR:
offset = dissect_zbee_tlv_nwk_addr(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_NWK_UPD_ID:
offset = dissect_zbee_tlv_nwk_upd_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_COMM_KEY_SEQ_NUM:
offset = dissect_zbee_tlv_key_seq_num(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the ZB Direct Security Messages.
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbd_msg_secur_local_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_zbd_secur_tlv, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
switch (type)
{
case ZBEE_TLV_TYPE_KEY_METHOD:
offset = dissect_zbee_tlv_key_neg_method(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_PUB_POINT_P256:
case ZBEE_TLV_TYPE_PUB_POINT_C25519:
offset = dissect_zbee_tlv_public_point(tvb, pinfo, tree, offset, length);
break;
case ZBEE_TLV_TYPE_NWK_KEY_SEQ_NUM:
offset = dissect_zbee_tlv_nwk_key_seq_num(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_MAC_TAG:
offset = dissect_zbee_tlv_mac_tag(tvb, pinfo, tree, offset, length);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
return offset;
}
/*
*Helper dissector for the ZD Direct messages.
*
*@param tvb pointer to buffer containing raw packet
*@param pinfo pointer to packet information fields
*@param tree pointer to the command subtree
*@param offset into the tvb to begin dissection
*@param cmd_id - ZB Direct local Message ID
*@return offset after command dissection
*/
static guint
dissect_zbd_local_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, void* data _U_, guint cmd_id)
{
guint8 total_tlv_length = 2 /*type + len fields*/ + tvb_get_guint8(tvb, offset + 1) + 1;
guint8 tmp_offset = offset;
switch (cmd_id)
{
case ZB_DIRECT_MSG_ID_STATUS:
offset = dissect_zbd_msg_status_local_tlv(tvb, pinfo, tree, offset);
break;
case ZB_DIRECT_MSG_ID_TUNNELING:
offset = dissect_zbd_msg_tunneling_local_tlv(tvb, pinfo, tree, offset);
break;
case ZB_DIRECT_MSG_ID_MANAGE_JOINERS:
offset = dissect_zbd_msg_manage_joiners_local_tlv(tvb, pinfo, tree, offset);
break;
case ZB_DIRECT_MSG_ID_JOIN:
offset = dissect_zbd_msg_join_local_tlv(tvb, pinfo, tree, offset);
break;
case ZB_DIRECT_MSG_ID_FORMATION:
offset = dissect_zbd_msg_formation_local_tlv(tvb, pinfo, tree, offset);
break;
case ZB_DIRECT_MSG_ID_SECUR_C25519_AESMMO:
case ZB_DIRECT_MSG_ID_SECUR_C25519_SHA256:
case ZB_DIRECT_MSG_ID_SECUR_P256:
offset = dissect_zbd_msg_secur_local_tlv(tvb, pinfo, tree, offset);
break;
default:
offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
break;
}
/* check extra bytes */
if ((offset - tmp_offset) < total_tlv_length)
{
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, total_tlv_length - 2, ENC_NA);
offset = tmp_offset + total_tlv_length;
}
return offset;
}
/**
* *Dissector for Zigbee Manufacturer Specific Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@param length of TLV data
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_manufacturer_specific(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, guint8 length)
{
proto_tree_add_item(tree, hf_zbee_tlv_manufacturer_specific, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length - 2, ENC_NA);
offset += length - 2;
return offset;
} /* dissect_zbee_tlv_manufacturer_specific */
/**
*Dissector for Zigbee Supported Key Negotiation Methods Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_supported_key_negotiation_methods(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
static int * const supported_key_negotiation_methods[] = {
&hf_zbee_tlv_supported_key_negotiation_methods_key_request,
&hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128,
&hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256,
NULL
};
static int * const supported_secrets[] = {
&hf_zbee_tlv_supported_preshared_secrets_auth_token,
&hf_zbee_tlv_supported_preshared_secrets_ic,
&hf_zbee_tlv_supported_preshared_secrets_passcode_pake,
&hf_zbee_tlv_supported_preshared_secrets_basic_access_key,
&hf_zbee_tlv_supported_preshared_secrets_admin_access_key,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_supported_key_negotiation_methods, ett_zbee_tlv_supported_key_negotiation_methods, supported_key_negotiation_methods, ENC_NA);
offset += 1;
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_supported_secrets, ett_zbee_tlv_supported_secrets, supported_secrets, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
return offset;
} /* dissect_zbee_tlv_supported_key_negotiation_methods */
/**
*Dissector for Zigbee PAN ID conflict report Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_panid_conflict_report(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_panid_conflict_cnt, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
}
/**
* *Dissector for Zigbee Configuration Parameters Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_configuration_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
static int * const bitmask[] = {
&hf_zbee_tlv_configuration_param_restricted_mode,
&hf_zbee_tlv_configuration_param_link_key_enc,
&hf_zbee_tlv_configuration_param_leave_req_allowed,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_configuration_param, ett_zbee_tlv_configuration_param, bitmask, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
} /* dissect_zbee_tlv_configuration_parameters */
/**
* *Dissector for Zigbee Configuration Parameters Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_dev_cap_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
static int * const bitmask[] = {
&hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_dev_cap_ext_capability_information, ett_zbee_tlv_capability_information, bitmask, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
} /* dissect_zbee_tlv_configuration_parameters */
/**
* *Dissector for Zigbee CPotential Parents Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_potential_parents(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 count, i;
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_current_parent, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_zbee_tlv_lqa, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
count = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_cnt_parents, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
for (i = 0; i < count; i++)
{
proto_tree_add_item(tree, hf_zbee_zdp_beacon_survey_parent, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_zbee_tlv_lqa, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
}
return offset;
}
/**
* *Dissector for Zigbee Next PAN ID Change Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_next_pan_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_next_pan_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
} /* dissect_zbee_tlv_next_pan_id */
/**
* *Dissector for Zigbee Next Channel Change Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_next_channel_change(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
/* todo: fix this (do channel mask) */
proto_tree_add_item(tree, hf_zbee_tlv_next_channel_change, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
return offset;
} /* dissect_zbee_tlv_next_channel_change */
/**
* *Dissector for Zigbee Passphrase Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_passphrase(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_passphrase, tvb, offset, 16, ENC_NA);
offset += 16;
return offset;
} /* dissect_zbee_tlv_passphrase */
/**
* *Dissector for Zigbee Router Information Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_router_information(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
static int * const router_information[] = {
&hf_zbee_tlv_router_information_hub_connectivity,
&hf_zbee_tlv_router_information_uptime,
&hf_zbee_tlv_router_information_pref_parent,
&hf_zbee_tlv_router_information_battery_backup,
&hf_zbee_tlv_router_information_enhanced_beacon_request_support,
&hf_zbee_tlv_router_information_mac_data_poll_keepalive_support,
&hf_zbee_tlv_router_information_end_device_keepalive_support,
&hf_zbee_tlv_router_information_power_negotiation_support,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_tlv_router_information, ett_zbee_tlv_router_information, router_information, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
} /* dissect_zbee_tlv_router_information */
/**
* *Dissector for Zigbee Fragmentation Parameters Global TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_fragmentation_parameters(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_node_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_zbee_tlv_frag_opt, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_max_reassembled_buf_size, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
} /* dissect_zbee_tlv_fragmentation_parameters */
/**
*Dissector for Zigbee Selected Key Negotiation Methods TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_selected_key_negotiation_method(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_selected_key_negotiation_method, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_selected_pre_shared_secret, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
return offset;
} /* dissect_zbee_tlv_selected_key_negotiation_methods */
/**
*Dissector for Public Point TLVs
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_public_point(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, guint8 length)
{
guint8 public_point_length = length - 8;
proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
proto_tree_add_item(tree, hf_zbee_tlv_public_point, tvb, offset, public_point_length, ENC_NA);
offset += public_point_length;
return offset;
} /* dissect_zbee_tlv_curve25519_public_point */
/*
*Dissector for Security Decommission Req EUI64 TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 eui64_count;
guint8 i;
eui64_count = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_count, tvb, offset, 1, ENC_NA);
offset += 1;
for (i = 0; i < eui64_count; i++)
{
proto_tree_add_item(tree, hf_zbee_tlv_device_eui64, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
}
return offset;
}
/*
*Dissector for Clear All Bindings Req EUI64 TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_clear_all_bindigs_eui64(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
return dissect_zbee_tlv_eui64(tvb, pinfo, tree, offset);
}
/*
*Dissector for Requested Authentication Token ID TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_requested_auth_token_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_global_tlv_id, tvb, offset, 1, ENC_NA);
offset += 1;
return offset;
}
/*
*Dissector for Target IEEE Address TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_target_ieee_address(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
return offset;
}
/**
* *Dissector for Device Authentication Level TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv_device_auth_level(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
proto_tree_add_item(tree, hf_zbee_tlv_local_ieee_addr, tvb, offset, 8, ENC_LITTLE_ENDIAN);
offset += 8;
proto_tree_add_item(tree, hf_zbee_tlv_local_initial_join_method, tvb, offset, 1, ENC_NA);
offset += 1;
proto_tree_add_item(tree, hf_zbee_tlv_local_active_lk_type, tvb, offset, 1, ENC_NA);
offset += 1;
return offset;
} /* dissect_zbee_tlv_device_auth_level */
/*
* ToDo: descr
*/
static guint
dissect_global_tlv (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 type;
guint8 length;
guint tmp_offset;
type = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_global_type, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1;
tmp_offset = offset;
switch (type) {
case ZBEE_TLV_TYPE_MANUFACTURER_SPECIFIC:
offset = dissect_zbee_tlv_manufacturer_specific(tvb, pinfo, tree, offset, length);
break;
case ZBEE_TLV_TYPE_SUPPORTED_KEY_NEGOTIATION_METHODS:
offset = dissect_zbee_tlv_supported_key_negotiation_methods(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_PANID_CONFLICT_REPORT:
offset = dissect_zbee_tlv_panid_conflict_report(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_NEXT_PAN_ID:
offset = dissect_zbee_tlv_next_pan_id(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_NEXT_CHANNEL_CHANGE:
offset = dissect_zbee_tlv_next_channel_change(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_PASSPHRASE:
offset = dissect_zbee_tlv_passphrase(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_ROUTER_INFORMATION:
offset = dissect_zbee_tlv_router_information(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_FRAGMENTATION_PARAMETERS:
offset = dissect_zbee_tlv_fragmentation_parameters(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_JOINER_ENCAPSULATION_GLOBAL:
offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
break;
case ZBEE_TLV_TYPE_BEACON_APPENDIX_ENCAPSULATION_GLOBAL:
offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, NULL, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
break;
case ZBEE_TLV_TYPE_CONFIGURATION_MODE_PARAMETERS:
offset = dissect_zbee_tlv_configuration_parameters(tvb, pinfo, tree, offset);
break;
case ZBEE_TLV_TYPE_DEVICE_CAPABILITY_EXTENSION:
offset = dissect_zbee_tlv_dev_cap_ext(tvb, pinfo, tree, offset);
break;
default:
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
break;
}
/* check extra bytes */
if ((offset - tmp_offset) < length)
{
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset = tmp_offset + length;
}
return offset;
}
/**
*Dissector for Unknown Zigbee TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_unknown_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset)
{
guint8 length;
proto_tree_add_item(tree, hf_zbee_tlv_type, tvb, offset, 1, ENC_NA);
offset += 1;
length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_zbee_tlv_length, tvb, offset, 1, ENC_NA);
offset += 1;
length += 1; /* length of tlv_val == tlv_len + 1 */
proto_tree_add_item(tree, hf_zbee_tlv_value, tvb, offset, length, ENC_NA);
offset += length;
return offset;
}
/**
*Dissector for Zigbee TLV
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@return offset after command dissection.
*/
static guint
dissect_zbee_tlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, void *data, guint8 source_type, guint cmd_id)
{
guint8 type;
type = tvb_get_guint8(tvb, offset);
if (type >= ZBEE_TLV_GLOBAL_START_NUMBER)
{
offset = dissect_global_tlv (tvb, pinfo, tree, offset);
}
else
{
switch (source_type)
{
case ZBEE_TLV_SRC_TYPE_ZBEE_ZDP:
offset = dissect_zdp_local_tlv(tvb, pinfo, tree, offset, cmd_id);
break;
case ZBEE_TLV_SRC_TYPE_ZBEE_APS:
offset = dissect_aps_local_tlv(tvb, pinfo, tree, offset, data, cmd_id);
break;
case ZBEE_TLV_SRC_TYPE_ZB_DIRECT:
offset = dissect_zbd_local_tlv(tvb, pinfo, tree, offset, data, cmd_id);
break;
default:
offset = dissect_unknown_tlv(tvb, pinfo, tree, offset);
break;
}
}
return offset;
} /* dissect_zbee_tlv */
/**
*Dissector for Zigbee TLVs
*
*@param tvb pointer to buffer containing raw packet.
*@param pinfo pointer to packet information fields
*@param tree pointer to data tree Wireshark uses to display packet.
*@param offset into the tvb to begin dissection.
*@param source_type ToDo:
*@param cmd_id ToDo:
*@return offset after command dissection.
*/
#define ZBEE_TLV_MAX_RECURSION_DEPTH 5 // Arbitrarily chosen
guint
dissect_zbee_tlvs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, void *data, guint8 source_type, guint cmd_id)
{
proto_tree *subtree;
guint8 length;
unsigned recursion_depth = p_get_proto_depth(pinfo, proto_zbee_tlv);
if (++recursion_depth >= ZBEE_TLV_MAX_RECURSION_DEPTH) {
proto_tree_add_expert(tree, pinfo, &ei_zbee_tlv_max_recursion_depth_reached, tvb, 0, 0);
return offset;
}
p_set_proto_depth(pinfo, proto_zbee_tlv, recursion_depth);
while (tvb_bytes_exist(tvb, offset, ZBEE_TLV_HEADER_LENGTH)) {
length = tvb_get_guint8(tvb, offset + 1) + 1;
subtree = proto_tree_add_subtree(tree, tvb, offset, ZBEE_TLV_HEADER_LENGTH + length, ett_zbee_tlv, NULL, "TLV");
offset = dissect_zbee_tlv(tvb, pinfo, subtree, offset, data, source_type, cmd_id);
}
recursion_depth = p_get_proto_depth(pinfo, proto_zbee_tlv);
p_set_proto_depth(pinfo, proto_zbee_tlv, recursion_depth - 1);
return offset;
} /* dissect_zbee_tlvs */
/**
* Dissector for ZBEE TLV.
*
* @param tvb pointer to buffer containing raw packet.
* @param pinfo pointer to packet information fields.
* @param tree pointer to data tree wireshark uses to display packet.
*/
static int
dissect_zbee_tlv_default(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
guint offset = 0;
offset = dissect_zbee_tlvs(tvb, pinfo, tree, offset, data, ZBEE_TLV_SRC_TYPE_DEFAULT, 0);
/* Check for leftover bytes. */
if (offset < tvb_captured_length(tvb)) {
/* Bytes leftover! */
tvbuff_t *leftover_tvb = tvb_new_subset_remaining(tvb, offset);
/* Dump the leftover to the data dissector. */
call_data_dissector(leftover_tvb, pinfo, tree);
}
return tvb_captured_length(tvb);
}
/**
* Proto ZBOSS Network Coprocessor product registration routine
*/
void proto_register_zbee_tlv(void)
{
/* NCP protocol headers */
static hf_register_info hf[] = {
{ &hf_zbee_tlv_relay_msg_type,
{ "Type", "zbee_tlv.relay.type", FT_UINT8, BASE_HEX, VALS(zbee_aps_relay_tlvs), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_relay_msg_length,
{ "Length", "zbee_tlv.relay.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_relay_msg_joiner_ieee,
{ "Joiner IEEE", "zbee_tlv.relay.joiner_ieee", FT_EUI64, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_global_type,
{ "Type", "zbee_tlv.type_global", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_global_types), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_key_update_req_rsp,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_key_update_req_rsp), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_key_negotiation_req_rsp,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_key_negotiation_req_rsp), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_get_auth_level_rsp,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_get_auth_level_rsp), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_clear_all_bindings_req,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_clear_all_bindings_req), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_req_security_get_auth_token,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_req_security_get_auth_token), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_req_security_get_auth_level,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_req_security_get_auth_level), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_req_security_decommission,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_req_security_decommission), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_req_beacon_survey,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_req_beacon_survey), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_rsp_beacon_survey,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_rsp_beacon_survey), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_req_challenge,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_req_challenge), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_rsp_challenge,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_rsp_challenge), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_type_rsp_set_configuration,
{ "Type", "zbee_tlv.type_local", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_rsp_set_configuration), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_type,
{ "Unknown Type", "zbee_tlv.type", FT_UINT8, BASE_HEX,
NULL, 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_length,
{ "Length", "zbee_tlv.length", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_value,
{ "Value", "zbee_tlv.value", FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_count,
{ "Count", "zbee_tlv.count", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_local_status_count,
{ "TLV Status Count", "zbee_tlv.tlv_status_count", FT_UINT8, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_local_type_id,
{ "TLV Type ID", "zbee_tlv.tlv_type_id", FT_UINT8, BASE_HEX, VALS(zbee_tlv_global_types), 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_local_proc_status,
{ "TLV Processing Status", "zbee_tlv.tlv_proc_status", FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_manufacturer_specific,
{ "ZigBee Manufacturer ID", "zbee_tlv.manufacturer_specific", FT_UINT16, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_supported_key_negotiation_methods,
{ "Supported Key Negotiation Methods", "zbee_tlv.supported_key_negotiation_methods", FT_UINT8, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_supported_key_negotiation_methods_key_request,
{ "Key Request (ZigBee 3.0)", "zbee_tlv.supported_key_negotiation_methods.key_request", FT_BOOLEAN, 8, NULL,
ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_KEY_REQUEST, NULL, HFILL }},
{ &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_aes_mmo128,
{ "ECDHE using Curve25519 with Hash AES-MMO-128", "zbee_tlv.supported_key_negotiation_methods.ecdhe_using_curve25519_aes_mmo128", FT_BOOLEAN, 8, NULL,
ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_AES_MMO128, NULL, HFILL }},
{ &hf_zbee_tlv_supported_key_negotiation_methods_ecdhe_using_curve25519_sha256,
{ "ECDHE using Curve25519 with Hash SHA-256", "zbee_tlv.supported_key_negotiation_methods.ecdhe_using_curve25519_sha256", FT_BOOLEAN, 8, NULL,
ZBEE_TLV_SUPPORTED_KEY_NEGOTIATION_METHODS_ANONYMOUS_ECDHE_USING_CURVE25519_SHA256, NULL, HFILL }},
{ &hf_zbee_tlv_supported_secrets,
{ "Supported Pre-shared Secrets Bitmask", "zbee_tlv.supported_secrets", FT_UINT8, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_supported_preshared_secrets_auth_token,
{ "Symmetric Authentication Token", "zbee_tlv.supported_secrets.auth_token", FT_BOOLEAN, 8, NULL,
0x1, NULL, HFILL }},
{ &hf_zbee_tlv_supported_preshared_secrets_ic,
{ "128-bit pre-configured link-key from install code", "zbee_tlv.supported_secrets.ic", FT_BOOLEAN, 8, NULL,
0x2, NULL, HFILL }},
{ &hf_zbee_tlv_supported_preshared_secrets_passcode_pake,
{ "Variable-length pass code for PAKE protocols", "zbee_tlv.supported_secrets.passcode_pake", FT_BOOLEAN, 8, NULL,
0x4, NULL, HFILL }},
{ &hf_zbee_tlv_supported_preshared_secrets_basic_access_key,
{ "Basic Access Key", "zbee_tlv.supported_secrets.basic_key", FT_BOOLEAN, 8, NULL,
0x8, NULL, HFILL }},
{ &hf_zbee_tlv_supported_preshared_secrets_admin_access_key,
{ "Administrative Access Key", "zbee_tlv.supported_secrets.admin_key", FT_BOOLEAN, 8, NULL,
0x10, NULL, HFILL }},
{ &hf_zbee_tlv_panid_conflict_cnt,
{ "PAN ID Conflict Count", "zbee_tlv.panid_conflict_cnt", FT_UINT16, BASE_DEC, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_next_pan_id,
{ "Next PAN ID Change", "zbee_tlv.next_pan_id", FT_UINT16, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_next_channel_change,
{ "Next Channel Change", "zbee_tlv.next_channel", FT_UINT32, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_passphrase,
{ "128-bit Symmetric Passphrase", "zbee_tlv.passphrase", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_challenge_value,
{ "Challenge Value", "zbee_tlv.challenge_val", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_aps_frame_counter,
{ "APS Frame Counter", "zbee_tlv.aps_frame_cnt", FT_UINT32, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_challenge_counter,
{ "Challenge Counter", "zbee_tlv.challenge_cnt", FT_UINT32, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_configuration_param,
{ "Configuration Parameters", "zbee_tlv.configuration_parameters", FT_UINT16, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_configuration_param_restricted_mode,
{ "apsZdoRestrictedMode", "zbee_tlv.conf_param.restricted_mode", FT_UINT16, BASE_DEC, NULL,
0x1, NULL, HFILL }},
{ &hf_zbee_tlv_configuration_param_link_key_enc,
{ "requireLinkKeyEncryptionForApsTransportKey", "zbee_tlv.conf_param.req_link_key_enc", FT_UINT16, BASE_DEC, NULL,
0x2, NULL, HFILL }},
{ &hf_zbee_tlv_configuration_param_leave_req_allowed,
{ "nwkLeaveRequestAllowed", "zbee_tlv.conf_param.leave_req_allowed", FT_UINT16, BASE_DEC, NULL,
0x4, NULL, HFILL }},
{ &hf_zbee_tlv_dev_cap_ext_capability_information,
{ "Capability Information", "zbee_tlv.dev_cap_ext_cap_info", FT_UINT16, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_dev_cap_ext_zbdirect_virt_device,
{ "Zigbee Direct Virtual Device", "zbee_tlv.dev_cap_ext.zbdirect_virt_dev", FT_UINT16, BASE_DEC, NULL,
0x1, NULL, HFILL }},
{ &hf_zbee_tlv_lqa,
{ "LQA", "zbee_tlv.lqa", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_router_information,
{ "Router Information", "zbee_tlv.router_information", FT_UINT16, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_hub_connectivity,
{ "Hub Connectivity", "zbee_tlv.router_information.hub_connectivity", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_HUB_CONNECTIVITY, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_uptime,
{ "Uptime", "zbee_tlv.router_information.uptime", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_UPTIME, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_pref_parent,
{ "Preferred parent", "zbee_tlv.router_information.pref_parent", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_PREF_PARENT, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_battery_backup,
{ "Battery Backup", "zbee_tlv.router_information.battery", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_BATTERY_BACKUP, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_enhanced_beacon_request_support,
{ "Enhanced Beacon Request Support", "zbee_tlv.router_information.enhanced_beacon", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_ENHANCED_BEACON_REQUEST_SUPPORT, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_mac_data_poll_keepalive_support,
{ "MAC Data Poll Keepalive Support", "zbee_tlv.router_information.mac_data_poll_keepalive", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_MAC_DATA_POLL_KEEPALIVE_SUPPORT, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_end_device_keepalive_support,
{ "End Device Keepalive Support", "zbee_tlv.router_information.end_dev_keepalive", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_END_DEVICE_KEEPALIVE_SUPPORT, NULL, HFILL }},
{ &hf_zbee_tlv_router_information_power_negotiation_support,
{ "Power Negotiation Support", "zbee_tlv.router_information.power_negotiation", FT_BOOLEAN, 16, NULL,
ZBEE_TLV_ROUTER_INFORMATION_POWER_NEGOTIATION_SUPPORT, NULL, HFILL }},
{ &hf_zbee_tlv_node_id,
{ "Node ID", "zbee_tlv.node_id", FT_UINT16, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_frag_opt,
{ "Fragmentation Options", "zbee_tlv.frag_opt", FT_UINT8, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_max_reassembled_buf_size,
{ "Maximum Reassembled Input Buffer Size", "zbee_tlv.max_buf_size", FT_UINT16, BASE_HEX, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_selected_key_negotiation_method,
{ "Selected Key Negotiation Method", "zbee_tlv.selected_key_negotiation_method", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_selected_key_negotiation_method), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_selected_pre_shared_secret,
{ "Selected Pre Shared Secret", "zbee_tlv.selected_pre_shared_secret", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_selected_pre_shared_secret), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_device_eui64,
{ "Device EUI64", "zbee_tlv.device_eui64", FT_EUI64, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_public_point,
{ "Public Point", "zbee_tlv.public_point", FT_BYTES, BASE_NONE, NULL,
0x0, NULL, HFILL }},
{ &hf_zbee_tlv_global_tlv_id,
{ "TLV Type ID", "zbee_tlv.global_tlv_id", FT_UINT8, BASE_HEX, VALS(zbee_tlv_global_types), 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_local_ieee_addr,
{ "IEEE Addr", "zbee_tlv.ieee_addr", FT_EUI64, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_mic64,
{ "MIC", "zbee_tlv.mic64", FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
{ &hf_zbee_tlv_local_initial_join_method,
{ "Initial Join Method", "zbee_tlv.init_method", FT_UINT8, BASE_HEX,
VALS(zbee_initial_join_methods), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_active_lk_type,
{ "Active link key type", "zbee_tlv.lk_type", FT_UINT8, BASE_HEX,
VALS(zbee_active_lk_types), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_zbd_comm_tlv,
{ "ZBD Commissioning Service TLV Type ID", "zbee_tlv.zbd.comm_tlv_id", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_zbd_comm_types), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_zbd_comm_mj_cmd_tlv,
{ "ZBD Manage Joiners TLV Type ID", "zbee_tlv.zbd.comm_mj_tlv_id", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_zbd_comm_mj_types), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_zbd_secur_tlv,
{ "ZBD Manage Joiners TLV Type ID", "zbee_tlv.zbd.comm_mj_tlv_id", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_zbd_secur_types), 0x0, NULL, HFILL }},
{ &hf_zbee_tlv_local_tunneling_npdu,
{ "NPDU", "zbee_tlv.zbd.npdu", FT_NONE, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_zbd_tunneling_npdu_msg_tlv,
{ "NPDU Message TLV", "zbee_tlv.zbd.tlv.tunneling.npdu_msg", FT_NONE, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_ext_pan_id,
{ "Extended PAN ID", "zbee_tlv.zbd.comm.ext_pan_id", FT_BYTES, SEP_COLON,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_short_pan_id,
{ "Short PAN ID", "zbee_tlv.zbd.comm.short_pan_id", FT_UINT16, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_channel_mask,
{ "Network Channels", "zbee_tlv.zbd.comm.nwk_channel_mask", FT_UINT32, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_channel_page,
{ "Channel Page", "zbee_tlv.zbd.comm.nwk_channel_page", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_channel_page_count,
{ "Channel Page Count", "zbee_tlv.zbd.comm.nwk_channel_page_count", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_nwk_key,
{ "Network key", "zbee_tlv.zbd.comm.nwk_key", FT_BYTES, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_link_key,
{ "Link key", "zbee_tlv.zbd.comm.link_key", FT_BYTES, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_dev_type,
{ "Device type", "zbee_tlv.zbd.comm.dev_type", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_dev_type_str), 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_nwk_addr,
{ "Network address", "zbee_tlv.zbd.comm.nwk_addr", FT_UINT16, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_join_method,
{ "Join method", "zbee_tlv.zbd.comm.join_method", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_join_method_str), 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_tc_addr,
{ "TC address", "zbee_tlv.zbd.comm.tc_addr", FT_UINT64, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_nwk_upd_id,
{ "Network update ID", "zbee_tlv.zbd.comm.nwk_upd_id", FT_UINT8, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_key_seq_num,
{ "Network active key sequence number", "zbee_tlv.zbd.comm.nwk_key_seq_num", FT_UINT8, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_adm_key,
{ "Admin key", "zbee_tlv.zbd.comm.admin_key", FT_BYTES, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_status_code_domain,
{ "Domain", "zbee_tlv.zbd.comm.status_code_domain", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_status_code_domain_str), 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_status_code_value,
{ "Code", "zbee_tlv.zbd.comm.status_code_value", FT_UINT8, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_mj_prov_lnk_key,
{ "Manage Joiners Provisional Link key", "zbee_tlv.zbd.comm.manage_joiners_prov_lnk_key", FT_BYTES, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_mj_ieee_addr,
{ "Manage Joiners IEEE Address", "zbee_tlv.zbd.comm.manage_joiners_ieee_addr", FT_UINT64, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_mj_cmd,
{ "Manage Joiners command", "zbee_tlv.zbd.comm.manage_joiners_cmd", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_mj_cmd_str), 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_tunneling_npdu_flags,
{ "NPDU Flags", "zbee_tlv.zbd.tunneling.npdu_flags", FT_UINT8, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_tunneling_npdu_flags_security,
{ "Security Enabled", "zbee_tlv.zbd.tunneling.npdu_flags.security", FT_BOOLEAN, 8,
NULL, 0b00000001, NULL, HFILL }
},
{ &hf_zbee_tlv_local_tunneling_npdu_flags_reserved,
{ "Reserved", "zbee_tlv.zbd.tunneling.npdu_flags.reserved", FT_UINT8, BASE_DEC,
NULL, 0b11111110, NULL, HFILL }
},
{ &hf_zbee_tlv_local_tunneling_npdu_length,
{ "NPDU Length", "zbee_tlv.zbd.tunneling.npdu_length", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_selected_key_method,
{ "Selected Key Negotiation Method", "zbee_tlv.zbd.secur.key_method", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_key_method_str), 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_selected_psk_secret,
{ "Selected PSK Secret", "zbee_tlv.zbd.secur.psk_secret", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_psk_secret_str), 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_nwk_key_seq_num,
{ "Network Key Sequence Number", "zbee_tlv.zbd.secur.nwk_key_seq_num", FT_UINT8, BASE_DEC,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_mac_tag,
{ "MAC Tag", "zbee_tlv.zbd.secur.mac_tag", FT_BYTES, BASE_NONE,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_link_key_flags,
{ "Link Key", "zbee_tlv.zbd.comm.join.link_key", FT_UINT8, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_link_key_flags_unique,
{ "Unique", "zbee_tlv.zbd.comm.join.link_key.unique", FT_UINT8, BASE_DEC,
VALS(zbee_tlv_local_types_lnk_key_unique_str), ZBEE_TLV_LINK_KEY_UNIQUE, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_link_key_flags_provisional,
{ "Provisional", "zbee_tlv.zbd.comm.join.link_key.provisional", FT_UINT8, BASE_DEC,
VALS(zbee_tlv_local_types_lnk_key_provisional_str), ZBEE_TLV_LINK_KEY_PROVISIONAL, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_network_status_map,
{ "Network Status Map", "zbee_tlv.zbd.comm.status_map", FT_UINT8, BASE_HEX,
NULL, 0x0, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_network_status_map_joined_status,
{ "Joined", "zbee_tlv.zbd.comm.status_map.joined_status", FT_UINT8, BASE_HEX,
VALS(zbee_tlv_local_types_joined_status_str), ZBEE_TLV_STATUS_MAP_JOINED_STATUS, NULL, HFILL }
},
{ &hf_zbee_tlv_local_comm_network_status_map_open_status,
{ "Open/Closed", "zbee_tlv.zbd.comm.status_map.open_status", FT_UINT8, BASE_DEC,
VALS(zbee_tlv_local_types_nwk_state_str), ZBEE_TLV_STATUS_MAP_OPEN_STATUS, NULL, HFILL }
},
{ &hf_zbee_tlv_network_status_map_network_type,
{ "Network Type", "zbee_tlv.zbd.comm.status_map.network_type", FT_UINT8, BASE_DEC,
VALS(zbee_tlv_local_types_nwk_type_str), ZBEE_TLV_STATUS_MAP_NETWORK_TYPE, NULL, HFILL }
},
};
/* Protocol subtrees */
static gint *ett[] =
{
&ett_zbee_aps_tlv,
&ett_zbee_aps_relay,
&ett_zbee_tlv,
&ett_zbee_tlv_supported_key_negotiation_methods,
&ett_zbee_tlv_supported_secrets,
&ett_zbee_tlv_router_information,
&ett_zbee_tlv_configuration_param,
&ett_zbee_tlv_capability_information,
&ett_zbee_tlv_zbd_tunneling_npdu,
&ett_zbee_tlv_zbd_tunneling_npdu_flags,
&ett_zbee_tlv_link_key_flags,
&ett_zbee_tlv_network_status_map
};
static ei_register_info ei[] = {
{ &ei_zbee_tlv_max_recursion_depth_reached, { "zbee_tlv.max_recursion_depth_reached",
PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached - stop decoding", EXPFILL }}
};
proto_zbee_tlv = proto_register_protocol("Zigbee TLV", "ZB TLV", "zbee_tlv");
proto_register_field_array(proto_zbee_tlv, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_module_t* expert_zbee_tlv = expert_register_protocol(proto_zbee_tlv);
expert_register_field_array(expert_zbee_tlv, ei, array_length(ei));
register_dissector("zbee_tlv", dissect_zbee_tlv_default, proto_zbee_tlv);
zbee_nwk_handle = find_dissector("zbee_nwk");
} /* proto_register_zbee_tlv */
|