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

/* TODO:
 *    - work on conversations
 *
 */

#include "config.h"

#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/conversation.h>
#include <epan/expert.h>
#include "packet-sprt.h"

void proto_register_sprt(void);
void proto_reg_handoff_sprt(void);

/* for some "range_string"s, there's only one value in the range  */
#define SPRT_VALUE_RANGE(a) a,a

/* TODO - conversation states */
#define SPRT_STATE_XXX_TODO 0

#define SPRT_CONV_MAX_SETUP_METHOD_SIZE 12

/* is DLCI field present in I_OCTET message?  See "DLCI enabled" in CONNECT message */
typedef enum {
    DLCI_UNKNOWN,
    DLCI_PRESENT,
    DLCI_ABSENT
} i_octet_dlci_status_t;


/* Keep conversation info for one side of an SPRT conversation
 * TODO - this needs to be bidirectional
 */
struct _sprt_conversation_info
{
    gchar    method[SPRT_CONV_MAX_SETUP_METHOD_SIZE + 1];
    gboolean stream_started;
    guint32  frame_number;         /* the frame where this conversation is started */

    /* sequence numbers for each channel: */
    guint32 seqnum[4];

    /* are we using the DLCI field in I_OCTET messages?  See CONNECT message ("DLCI enabled") */
    i_octet_dlci_status_t i_octet_dlci_status;
    guint32 connect_frame_number; /* the CONNECT frame that tells us if the DLCI is enabled */

    /* TODO - maintain state */

};

/* SPRT Message IDs: */
#define SPRT_MODEM_RELAY_MSG_ID_NULL              0
#define SPRT_MODEM_RELAY_MSG_ID_INIT              1
#define SPRT_MODEM_RELAY_MSG_ID_XID_XCHG          2
#define SPRT_MODEM_RELAY_MSG_ID_JM_INFO           3
#define SPRT_MODEM_RELAY_MSG_ID_START_JM          4
#define SPRT_MODEM_RELAY_MSG_ID_CONNECT           5
#define SPRT_MODEM_RELAY_MSG_ID_BREAK             6
#define SPRT_MODEM_RELAY_MSG_ID_BREAK_ACK         7
#define SPRT_MODEM_RELAY_MSG_ID_MR_EVENT          8
#define SPRT_MODEM_RELAY_MSG_ID_CLEARDOWN         9
#define SPRT_MODEM_RELAY_MSG_ID_PROF_XCHG        10
/* 11 -15 Reserved */
#define SPRT_MODEM_RELAY_MSG_ID_RESERVED1_START  11
#define SPRT_MODEM_RELAY_MSG_ID_RESERVED1_END    15
/* Data */
#define SPRT_MODEM_RELAY_MSG_ID_I_RAW_OCTET      16
#define SPRT_MODEM_RELAY_MSG_ID_I_RAW_BIT        17
#define SPRT_MODEM_RELAY_MSG_ID_I_OCTET          18
#define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT      19
#define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN       20
#define SPRT_MODEM_RELAY_MSG_ID_I_FRAME          21
#define SPRT_MODEM_RELAY_MSG_ID_I_OCTET_CS       22
#define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT_CS   23
#define SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN_CS    24
/* 25 - 99 Reserved */
#define SPRT_MODEM_RELAY_MSG_ID_RESERVED2_START  25
#define SPRT_MODEM_RELAY_MSG_ID_RESERVED2_END    99
/* 100 - 127 Vendor-specific */
#define SPRT_MODEM_RELAY_MSG_ID_VENDOR_START    100
#define SPRT_MODEM_RELAY_MSG_ID_VENDOR_END      127


/* error correcting protocol in XID_XCHG message: */
#define SPRT_ECP_NO_LINK_LAYER_PROTO     0
#define SPRT_ECP_V42_LAPM                1
#define SPRT_ECP_ANNEX_AV42_1996         2
/* 3 - 25 Reserved for ITU-T */
#define SPRT_ECP_RESERVED_START          3
#define SPRT_ECP_RESERVED_END           25


/* category ID used in JM_INFO message: */
#define SPRT_JM_INFO_CAT_ID_CALL_FUNCT          0x8
#define SPRT_JM_INFO_CAT_ID_MOD_MODES           0xA
#define SPRT_JM_INFO_CAT_ID_PROTOCOLS           0x5
#define SPRT_JM_INFO_CAT_ID_PSTN_ACCESS         0xB
#define SPRT_JM_INFO_CAT_ID_PCM_MODEM_AVAIL     0xE
#define SPRT_JM_INFO_CAT_ID_CATEGORY_EXTENSION  0x0


#define SPRT_JMINFO_TBC_CALL_FUNCT_PSTN_MULTIMEDIA_TERM     0x4
#define SPRT_JMINFO_TBC_CALL_FUNCT_TEXTPHONE_ITU_T_REC_V18  0x2
#define SPRT_JMINFO_TBC_CALL_FUNCT_VIDEOTEXT_ITU_T_REC_T101 0x6
#define SPRT_JMINFO_TBC_CALL_FUNCT_TRANS_FAX_ITU_T_REC_T30  0x1
#define SPRT_JMINFO_TBC_CALL_FUNCT_RECV_FAX_ITU_T_REC_T30   0x5
#define SPRT_JMINFO_TBC_CALL_FUNCT_DATA_V_SERIES_MODEM_REC  0x3


#define SPRT_JMINFO_TBC_PROTOCOL_LAPM_ITU_T_REC_V42     0x4


/* selected modulations in CONNECT message: */
#define SPRT_SELMOD_NULL             0
#define SPRT_SELMOD_V92              1
#define SPRT_SELMOD_V91              2
#define SPRT_SELMOD_V90              3
#define SPRT_SELMOD_V34              4
#define SPRT_SELMOD_V32_BIS          5
#define SPRT_SELMOD_V32              6
#define SPRT_SELMOD_V22_BIS          7
#define SPRT_SELMOD_V22              8
#define SPRT_SELMOD_V17              9
#define SPRT_SELMOD_V29             10
#define SPRT_SELMOD_V27_TER         11
#define SPRT_SELMOD_V26_TER         12
#define SPRT_SELMOD_V26_BIS         13
#define SPRT_SELMOD_V23             14
#define SPRT_SELMOD_V21             15
#define SPRT_SELMOD_BELL_212        16
#define SPRT_SELMOD_BELL_103        17
/* 18 - 30 Vendor-specific modulations */
#define SPRT_SELMOD_VENDOR_START    18
#define SPRT_SELMOD_VENDOR_END      30
/* 31 - 63 Reserved for ITU-T */
#define SPRT_SELMOD_RESERVED_START  31
#define SPRT_SELMOD_RESERVED_END    63


/* Compression direction in CONNECT message: */
#define SPRT_COMPR_DIR_NO_COMPRESSION   0
#define SPRT_COMPR_DIR_TRANSMIT         1
#define SPRT_COMPR_DIR_RECEIVE          2
#define SPRT_COMPR_DIR_BIDIRECTIONAL    3


/* Selected compression modes in CONNECT message: */
#define SPRT_SELECTED_COMPR_NONE             0
#define SPRT_SELECTED_COMPR_V42_BIS          1
#define SPRT_SELECTED_COMPR_V44              2
#define SPRT_SELECTED_COMPR_MNP5             3
/* 4 - 15 Reserved by ITU-T */
#define SPRT_SELECTED_COMPR_RESERVED_START   4
#define SPRT_SELECTED_COMPR_RESERVED_END    15


/* Selected error correction modes in CONNECT message: */
#define SPRT_SELECTED_ERR_CORR_V14_OR_NONE       0
#define SPRT_SELECTED_ERR_CORR_V42_LAPM          1
#define SPRT_SELECTED_ERR_CORR_ANNEX_AV42        2
/* 3 - 15 Reserved for ITU-T */
#define SPRT_SELECTED_ERR_CORR_RESERVED_START    3
#define SPRT_SELECTED_ERR_CORR_RESERVED_END     15


/* Break source protocol in BREAK message: */
#define SPRT_BREAK_SRC_PROTO_V42_LAPM            0
#define SPRT_BREAK_SRC_PROTO_ANNEX_AV42_1996     1
#define SPRT_BREAK_SRC_PROTO_V14                 2
/* 3 - 15 Reserved for ITU-T */
#define SPRT_BREAK_SRC_PROTO_RESERVED_START      3
#define SPRT_BREAK_SRC_PROTO_RESERVED_END       15


#define SPRT_BREAK_TYPE_NOT_APPLICABLE                   0
#define SPRT_BREAK_TYPE_DESTRUCTIVE_AND_EXPEDITED        1
#define SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_EXPEDITED     2
#define SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_NONEXPEDITED  3
/* 4 - 15 Reserved for ITU-T */
#define SPRT_BREAK_TYPE_RESERVED_START                   4
#define SPRT_BREAK_TYPE_RESERVED_END                    15


/* Modem relay info in MR_EVENT messages: */
#define SPRT_MREVT_EVENT_ID_NULL                  0
#define SPRT_MREVT_EVENT_ID_RATE_RENEGOTIATION    1
#define SPRT_MREVT_EVENT_ID_RETRAIN               2
#define SPRT_MREVT_EVENT_ID_PHYSUP                3
/* 4 - 255 Reserved for ITU-T */
#define SPRT_MREVT_EVENT_ID_RESERVED_START        4
#define SPRT_MREVT_EVENT_ID_RESERVED_END        255


#define SPRT_MREVT_REASON_CODE_NULL               0
#define SPRT_MREVT_REASON_CODE_INIT               1
#define SPRT_MREVT_REASON_CODE_RESPONDING         2
/* 3 - 255 Undefined */
#define SPRT_MREVT_REASON_CODE_RESERVED_START     3
#define SPRT_MREVT_REASON_CODE_RESERVED_END     255


#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_NULL                0
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_600                 1
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1200                2
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1600                3
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2400                4
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2743                5
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3000                6
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3200                7
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3429                8
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_8000                9
/* 10 - 254 Reserved for ITU-T */
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_START     10
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_END      254
#define SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_UNSPECIFIED       255


/* Cleardown reason codes: */
#define SPRT_CLEARDOWN_RIC_UNKNOWN                     0
#define SPRT_CLEARDOWN_RIC_PHYSICAL_LAYER_RELEASE      1
#define SPRT_CLEARDOWN_RIC_LINK_LAYER_DISCONNECT       2
#define SPRT_CLEARDOWN_RIC_DATA_COMPRESSION_DISCONNECT 3
#define SPRT_CLEARDOWN_RIC_ABORT                       4
#define SPRT_CLEARDOWN_RIC_ON_HOOK                     5
#define SPRT_CLEARDOWN_RIC_NETWORK_LAYER_TERMINATION   6
#define SPRT_CLEARDOWN_RIC_ADMINISTRATIVE              7


/* PROF_XCHG messages (XID profile exchange for MR1): */
#define SPRT_PROF_XCHG_SUPPORT_NO       0
#define SPRT_PROF_XCHG_SUPPORT_YES      1
#define SPRT_PROF_XCHG_SUPPORT_UNKNOWN  2


/* DLCI field in I_OCTET: */
#define SPRT_PAYLOAD_DLCI1_DTE2DTE                0
#define SPRT_PAYLOAD_DLCI1_RESERVED_START         1
#define SPRT_PAYLOAD_DLCI1_RESERVED_END          31
#define SPRT_PAYLOAD_DLCI1_NOT_RESERVED_START    32
#define SPRT_PAYLOAD_DLCI1_NOT_RESERVED_END      62
#define SPRT_PAYLOAD_DLCI1_CTRLFN2CTRLFN         63

#define SPRT_PAYLOAD_DLCI2_START                  0
#define SPRT_PAYLOAD_DLCI2_END                  127

/* Payload fields for I_CHAR_STAT_CS, etc.: */
/* # of data bits */
#define SPRT_PAYLOAD_D_0        0
#define SPRT_PAYLOAD_D_1        1
#define SPRT_PAYLOAD_D_2        2
#define SPRT_PAYLOAD_D_3        3


/* parity */
#define SPRT_PAYLOAD_P_0    0
#define SPRT_PAYLOAD_P_1    1
#define SPRT_PAYLOAD_P_2    2
#define SPRT_PAYLOAD_P_3    3
#define SPRT_PAYLOAD_P_4    4
#define SPRT_PAYLOAD_P_5    5
#define SPRT_PAYLOAD_P_6    6
#define SPRT_PAYLOAD_P_7    7


/* # of stop bits */
#define SPRT_PAYLOAD_S_0    0
#define SPRT_PAYLOAD_S_1    1
#define SPRT_PAYLOAD_S_2    2
#define SPRT_PAYLOAD_S_3    3


/* data frame state */
#define SPRT_PAYLOAD_FR_0   0
#define SPRT_PAYLOAD_FR_1   1
#define SPRT_PAYLOAD_FR_2   2
#define SPRT_PAYLOAD_FR_3   3


/* Initialize the protocol & registered fields */
static int proto_sprt =                         -1;

static int hf_sprt_setup =                      -1;
static int hf_sprt_setup_frame =                -1;
static int hf_sprt_setup_method =               -1;

static int hf_sprt_header_extension_bit =       -1;
static int hf_sprt_subsession_id =              -1;
static int hf_sprt_reserved_bit =               -1;
static int hf_sprt_payload_type =               -1;
static int hf_sprt_transport_channel_id =       -1;
static int hf_sprt_sequence_number =            -1;
static int hf_sprt_number_of_ack_fields =       -1;
static int hf_sprt_base_sequence_number =       -1;
static int hf_sprt_ack_field_items =            -1;
static int hf_sprt_transport_channel_item =     -1;
static int hf_sprt_sequence_item =              -1;

static int hf_sprt_payload_length =             -1;
static int hf_sprt_payload_no_data =            -1;
static int hf_sprt_payload_reserved_bit =       -1;
static int hf_sprt_payload_message_id =         -1;

static int hf_sprt_payload_data =               -1; /* stuff after msgid */
/* INIT msg: */
static int hf_sprt_payload_msg_init_all_fields =                    -1;
static int hf_sprt_payload_msg_init_necrxch =                       -1;
static int hf_sprt_payload_msg_init_ecrxch =                        -1;
static int hf_sprt_payload_msg_init_xid_prof_exch =                 -1;
static int hf_sprt_payload_msg_init_assym_data_types =              -1;
static int hf_sprt_payload_msg_init_opt_moip_types_i_raw_bit =      -1;
static int hf_sprt_payload_msg_init_opt_moip_types_i_frame =        -1;
static int hf_sprt_payload_msg_init_opt_moip_types_i_char_stat =    -1;
static int hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn =     -1;
static int hf_sprt_payload_msg_init_opt_moip_types_i_octet_cs =     -1;
static int hf_sprt_payload_msg_init_opt_moip_types_i_char_stat_cs = -1;
static int hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn_cs =  -1;
static int hf_sprt_payload_msg_init_opt_moip_types_reserved =       -1;
/* XID_XCHG message: */
static int hf_sprt_payload_msg_xidxchg_ecp =                                    -1;
static int hf_sprt_payload_msg_xidxchg_xidlr1_v42bis =                          -1;
static int hf_sprt_payload_msg_xidxchg_xidlr1_v44 =                             -1;
static int hf_sprt_payload_msg_xidxchg_xidlr1_mnp5 =                            -1;
static int hf_sprt_payload_msg_xidxchg_xidlr1_reserved =                        -1;
static int hf_sprt_payload_msg_xidxchg_xidlr2_v42bis_compr_req =                -1;
static int hf_sprt_payload_msg_xidxchg_xidlr3and4_v42bis_num_codewords =        -1;
static int hf_sprt_payload_msg_xidxchg_xidlr5_v42bis_max_strlen =               -1;
static int hf_sprt_payload_msg_xidxchg_xidlr6_v44_capability =                  -1;
static int hf_sprt_payload_msg_xidxchg_xidlr7_v44_compr_req =                   -1;
static int hf_sprt_payload_msg_xidxchg_xidlr8and9_v44_num_codewords_trans =     -1;
static int hf_sprt_payload_msg_xidxchg_xidlr10and11_v44_num_codewords_recv =    -1;
static int hf_sprt_payload_msg_xidxchg_xidlr12_v44_max_strlen_trans =           -1;
static int hf_sprt_payload_msg_xidxchg_xidlr13_v44_max_strlen_recv =            -1;
static int hf_sprt_payload_msg_xidxchg_xidlr14and15_v44_history_len_trans =     -1;
static int hf_sprt_payload_msg_xidxchg_xidlr16and17_v44_history_len_recv =      -1;
/* V.8 JM_INFO msg: */
static int hf_sprt_payload_msg_jminfo_category_data =           -1;
static int hf_sprt_payload_msg_jminfo_category_id =             -1;
static int hf_sprt_payload_msg_jminfo_category_ext_info =       -1;
static int hf_sprt_payload_msg_jminfo_unk_category_info =       -1;
static int hf_sprt_payload_msg_jminfo_category_leftover_bits =  -1;
static int hf_sprt_payload_msg_jminfo_call_function =           -1;
static int hf_sprt_payload_msg_jminfo_mod_v34_duplex =          -1;
static int hf_sprt_payload_msg_jminfo_mod_v34_half_duplex =     -1;
static int hf_sprt_payload_msg_jminfo_mod_v32bis_v32 =          -1;
static int hf_sprt_payload_msg_jminfo_mod_v22bis_v22 =          -1;
static int hf_sprt_payload_msg_jminfo_mod_v17 =                 -1;
static int hf_sprt_payload_msg_jminfo_mod_v29_half_duplex =     -1;
static int hf_sprt_payload_msg_jminfo_mod_v27ter =              -1;
static int hf_sprt_payload_msg_jminfo_mod_v26ter =              -1;
static int hf_sprt_payload_msg_jminfo_mod_v26bis =              -1;
static int hf_sprt_payload_msg_jminfo_mod_v23_duplex =          -1;
static int hf_sprt_payload_msg_jminfo_mod_v23_half_duplex =     -1;
static int hf_sprt_payload_msg_jminfo_mod_v21 =                 -1;
static int hf_sprt_payload_msg_jminfo_protocols =               -1;
static int hf_sprt_payload_msg_jminfo_pstn_access_call_dce_cell =       -1;
static int hf_sprt_payload_msg_jminfo_pstn_access_answ_dce_cell =       -1;
static int hf_sprt_payload_msg_jminfo_pstn_access_dce_on_digital_net =  -1;
static int hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_analog =  -1;
static int hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_digital = -1;
static int hf_sprt_payload_msg_jminfo_pcm_modem_avail_v91 =             -1;
/* CONNECT msg: */
static int hf_sprt_payload_msg_connect_selmod =                         -1;
static int hf_sprt_payload_msg_connect_compr_dir =                      -1;
static int hf_sprt_payload_msg_connect_selected_compr =                 -1;
static int hf_sprt_payload_msg_connect_selected_err_corr =              -1;
static int hf_sprt_payload_msg_connect_tdsr =                           -1;
static int hf_sprt_payload_msg_connect_rdsr =                           -1;
static int hf_sprt_payload_msg_connect_dlci_enabled =                   -1;
static int hf_sprt_payload_msg_connect_avail_data_types =               -1;
static int hf_sprt_payload_msg_connect_adt_octet_no_format_no_dlci =    -1;
static int hf_sprt_payload_msg_connect_adt_i_raw_bit =                  -1;
static int hf_sprt_payload_msg_connect_adt_i_frame =                    -1;
static int hf_sprt_payload_msg_connect_adt_i_char_stat =                -1;
static int hf_sprt_payload_msg_connect_adt_i_char_dyn =                 -1;
static int hf_sprt_payload_msg_connect_adt_i_octet_cs =                 -1;
static int hf_sprt_payload_msg_connect_adt_i_char_stat_cs =             -1;
static int hf_sprt_payload_msg_connect_adt_i_char_dyn_cs =              -1;
static int hf_sprt_payload_msg_connect_adt_reserved =                   -1;
static int hf_sprt_payload_msg_connect_compr_trans_dict_sz =            -1;
static int hf_sprt_payload_msg_connect_compr_recv_dict_sz =             -1;
static int hf_sprt_payload_msg_connect_compr_trans_str_len =            -1;
static int hf_sprt_payload_msg_connect_compr_recv_str_len =             -1;
static int hf_sprt_payload_msg_connect_compr_trans_hist_sz =            -1;
static int hf_sprt_payload_msg_connect_compr_recv_hist_sz =             -1;
/* BREAK msg: */
static int hf_sprt_payload_msg_break_source_proto =     -1;
static int hf_sprt_payload_msg_break_type =             -1;
static int hf_sprt_payload_msg_break_length =           -1;
/* MR_EVENT msg: */
static int hf_sprt_payload_msg_mr_event_id =            -1;
static int hf_sprt_payload_msg_mr_evt_reason_code =     -1;
static int hf_sprt_payload_msg_mr_evt_selmod =          -1;
static int hf_sprt_payload_msg_mr_evt_txsen =           -1;
static int hf_sprt_payload_msg_mr_evt_rxsen =           -1;
static int hf_sprt_payload_msg_mr_evt_tdsr =            -1;
static int hf_sprt_payload_msg_mr_evt_rdsr =            -1;
static int hf_sprt_payload_msg_mr_evt_txsr =            -1;
static int hf_sprt_payload_msg_mr_evt_rxsr =            -1;
/* CLEARDOWN msg: */
static int hf_sprt_payload_msg_cleardown_reason_code =  -1;
static int hf_sprt_payload_msg_cleardown_vendor_tag =   -1;
static int hf_sprt_payload_msg_cleardown_vendor_info =  -1;
/* PROF_XCHG msg: */
static int hf_sprt_payload_msg_profxchg_v42_lapm =                              -1;
static int hf_sprt_payload_msg_profxchg_annex_av42 =                            -1;
static int hf_sprt_payload_msg_profxchg_v44_compr =                             -1;
static int hf_sprt_payload_msg_profxchg_v42bis_compr =                          -1;
static int hf_sprt_payload_msg_profxchg_mnp5_compr =                            -1;
static int hf_sprt_payload_msg_profxchg_reserved =                              -1;
static int hf_sprt_payload_msg_profxchg_xidlr2_v42bis_compr_req =               -1;
static int hf_sprt_payload_msg_profxchg_xidlr3and4_v42bis_num_codewords =       -1;
static int hf_sprt_payload_msg_profxchg_xidlr5_v42bis_max_strlen =              -1;
static int hf_sprt_payload_msg_profxchg_xidlr6_v44_capability =                 -1;
static int hf_sprt_payload_msg_profxchg_xidlr7_v44_compr_req =                  -1;
static int hf_sprt_payload_msg_profxchg_xidlr8and9_v44_num_codewords_trans =    -1;
static int hf_sprt_payload_msg_profxchg_xidlr10and11_v44_num_codewords_recv =   -1;
static int hf_sprt_payload_msg_profxchg_xidlr12_v44_max_strlen_trans =          -1;
static int hf_sprt_payload_msg_profxchg_xidlr13_v44_max_strlen_recv =           -1;
static int hf_sprt_payload_msg_profxchg_xidlr14and15_v44_history_len_trans =    -1;
static int hf_sprt_payload_msg_profxchg_xidlr16and17_v44_history_len_recv =     -1;
/* I_OCTET */
static int hf_sprt_payload_i_octet_no_dlci =                                    -1;
static int hf_sprt_payload_i_octet_dlci_presence_unknown =                      -1;
static int hf_sprt_payload_i_octet_dlci1 =                                      -1;
static int hf_sprt_payload_i_octet_cr =                                         -1;
static int hf_sprt_payload_i_octet_ea =                                         -1;
static int hf_sprt_payload_i_octet_dlci2 =                                      -1;
static int hf_sprt_payload_i_octet_dlci_setup_by_connect_frame =                -1;

/* I_OCTET_CS, I_CHAR_STAT_CS, I_CHAR_DYN_CS msgs: */
static int hf_sprt_payload_data_cs =                                            -1;
static int hf_sprt_payload_data_reserved_bit =                                  -1;
static int hf_sprt_payload_data_num_data_bits =                                 -1;
static int hf_sprt_payload_data_parity_type =                                   -1;
static int hf_sprt_payload_num_stop_bits =                                      -1;
static int hf_sprt_payload_frame_reserved_bits =                                -1;
static int hf_sprt_payload_frame_state =                                        -1;
static int hf_sprt_payload_rawoctet_n_field_present =                           -1;
static int hf_sprt_payload_rawoctet_l =                                         -1;
static int hf_sprt_payload_rawoctet_n =                                         -1;
static int hf_sprt_payload_rawbit_included_fields_l =                           -1;
static int hf_sprt_payload_rawbit_included_fields_lp =                          -1;
static int hf_sprt_payload_rawbit_included_fields_lpn =                         -1;
static int hf_sprt_payload_rawbit_len_a =                                       -1;
static int hf_sprt_payload_rawbit_len_b =                                       -1;
static int hf_sprt_payload_rawbit_len_c =                                       -1;
static int hf_sprt_payload_rawbit_p =                                           -1;
static int hf_sprt_payload_rawbit_n =                                           -1;

/* Preferences  */
static gboolean global_sprt_show_setup_info = TRUE; /* show how this SPRT stream got started */
static gboolean global_sprt_show_dlci_info  = TRUE; /* show DLCI in I_OCTET messages, including setup frame (if we can) */


/* dissector handle */
static dissector_handle_t sprt_handle;


/* initialize the subtree pointers */
static gint ett_sprt =                  -1;
static gint ett_sprt_setup =            -1;
static gint ett_sprt_ack_fields =       -1;
static gint ett_payload =               -1;
static gint ett_init_msg_all_fields =   -1;
static gint ett_jminfo_msg_cat_data =   -1;
static gint ett_connect_msg_adt =       -1;

static expert_field ei_sprt_sequence_number_0 = EI_INIT;

/* value strings & range strings */
static const value_string sprt_transport_channel_characteristics[] = {
    { 0, "Unreliable, unsequenced" },
    { 1, "Reliable, sequenced" },
    { 2, "Expedited, reliable, sequenced" },
    { 3, "Unreliable, sequenced" },
    { 0, NULL}
};

static const range_string sprt_modem_relay_msg_id_name[] = {
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_NULL),                                 "NULL reserved for ITU-T" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_INIT),                                 "INIT" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_XID_XCHG),                             "XID_XCHG" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_JM_INFO),                              "JM_INFO" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_START_JM),                             "START_JM" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_CONNECT),                              "CONNECT" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_BREAK),                                "BREAK" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_BREAK_ACK),                            "BREAK_ACK" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_MR_EVENT),                             "MR_EVENT" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_CLEARDOWN),                            "CLEARDOWN" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_PROF_XCHG),                            "PROF_XCHG" },
    { SPRT_MODEM_RELAY_MSG_ID_RESERVED1_START, SPRT_MODEM_RELAY_MSG_ID_RESERVED1_END, "Reserved for ITU-T" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_RAW_OCTET),                          "I_RAW-OCTET" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_RAW_BIT),                            "I_RAW-BIT" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_OCTET),                              "I_OCTET" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT),                          "I_CHAR-STAT" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN),                           "I_CHAR-DYN" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_FRAME),                              "I_FRAME" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_OCTET_CS),                           "I_OCTET-CS" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT_CS),                       "I_CHAR-STAT-CS" },
    { SPRT_VALUE_RANGE(SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN_CS),                        "I_CHAR-DYN-CS" },
    { SPRT_MODEM_RELAY_MSG_ID_RESERVED2_START, SPRT_MODEM_RELAY_MSG_ID_RESERVED2_END, "Reserved for ITU-T" },
    { SPRT_MODEM_RELAY_MSG_ID_VENDOR_START, SPRT_MODEM_RELAY_MSG_ID_VENDOR_END,       "Vendor-specific message" },
    { 0, 0, NULL }
};

static const range_string sprt_ecp_name[] = {
    { SPRT_VALUE_RANGE(SPRT_ECP_NO_LINK_LAYER_PROTO),   "No link layer protocol" },
    { SPRT_VALUE_RANGE(SPRT_ECP_V42_LAPM),              "V.42/LAPM" },
    { SPRT_VALUE_RANGE(SPRT_ECP_ANNEX_AV42_1996),       "Annex A/V.42(1996)" },
    { SPRT_ECP_RESERVED_START, SPRT_ECP_RESERVED_END,   "Reserved for ITU-T" },
    { 0, 0, NULL }
};

static const value_string sprt_jm_info_cat_id_name[] = {
    { SPRT_JM_INFO_CAT_ID_CALL_FUNCT,           "Call function" },
    { SPRT_JM_INFO_CAT_ID_MOD_MODES,            "Modulation modes" },
    { SPRT_JM_INFO_CAT_ID_PROTOCOLS,            "Protocols" },
    { SPRT_JM_INFO_CAT_ID_PSTN_ACCESS,          "PSTN access" },
    { SPRT_JM_INFO_CAT_ID_PCM_MODEM_AVAIL,      "PCM modem availability" },
    { SPRT_JM_INFO_CAT_ID_CATEGORY_EXTENSION,   "Extension of current category" },
    { 0, NULL }
};

static const value_string sprt_jminfo_tbc_call_funct_name[] = {
    { SPRT_JMINFO_TBC_CALL_FUNCT_PSTN_MULTIMEDIA_TERM,      "PSTN Multimedia terminal (ITU-T Rec. H.324)" },
    { SPRT_JMINFO_TBC_CALL_FUNCT_TEXTPHONE_ITU_T_REC_V18,   "Textphone (ITU-T Rec. V.18)" },
    { SPRT_JMINFO_TBC_CALL_FUNCT_VIDEOTEXT_ITU_T_REC_T101,  "Videotext (ITU-T Rec. T.101)" },
    { SPRT_JMINFO_TBC_CALL_FUNCT_TRANS_FAX_ITU_T_REC_T30,   "Transmit facsimile from call terminal (ITU-T Rec. T.30)" },
    { SPRT_JMINFO_TBC_CALL_FUNCT_RECV_FAX_ITU_T_REC_T30,    "Receive facsimile at call terminal (ITU-T Rec. T.30)" },
    { SPRT_JMINFO_TBC_CALL_FUNCT_DATA_V_SERIES_MODEM_REC,   "Data (V-series modem Recommendations)" },
    { 0, NULL }
};

static const range_string sprt_jminfo_tbc_protocol_name[] = {
    { SPRT_VALUE_RANGE(SPRT_JMINFO_TBC_PROTOCOL_LAPM_ITU_T_REC_V42),    "LAPM protocol according to ITU-T Rec. V.42" },
    { 0, 0, NULL }
};

static const range_string sprt_selmod_name[] = {
    { SPRT_VALUE_RANGE(SPRT_SELMOD_NULL),                   "NULL" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V92),                    "V.92" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V91),                    "V.91" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V90),                    "V.90" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V34),                    "V.34" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V32_BIS),                "V.32bis" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V32),                    "V.32" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V22_BIS),                "V.22bis" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V22),                    "V.22" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V17),                    "V.17" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V29),                    "V.29" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V27_TER),                "V.27ter" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V26_TER),                "V.26ter" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V26_BIS),                "V.26bis" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V23),                    "V.23" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_V21),                    "V.21" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_BELL_212),               "Bell 212" },
    { SPRT_VALUE_RANGE(SPRT_SELMOD_BELL_103),               "Bell 103" },
    { SPRT_SELMOD_VENDOR_START, SPRT_SELMOD_VENDOR_END,     "Vendor-specific modulation" },
    { SPRT_SELMOD_RESERVED_START, SPRT_SELMOD_RESERVED_END, "Reserved for ITU-T" },
    { 0, 0, NULL }
};

static const value_string sprt_comp_direction[] = {
    { SPRT_COMPR_DIR_NO_COMPRESSION,    "None" },
    { SPRT_COMPR_DIR_TRANSMIT,          "Transmit" },
    { SPRT_COMPR_DIR_RECEIVE,           "Receive" },
    { SPRT_COMPR_DIR_BIDIRECTIONAL,     "Bidirectional" },
    { 0, NULL }
};

static const range_string sprt_selected_compr_name[] = {
    { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_NONE),       "None" },
    { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_V42_BIS),    "V.42bis" },
    { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_V44),        "V.44" },
    { SPRT_VALUE_RANGE(SPRT_SELECTED_COMPR_MNP5),       "MNP5" },
    { SPRT_SELECTED_COMPR_RESERVED_START, SPRT_SELECTED_COMPR_RESERVED_END, "Reserved by ITU-T" },
    { 0, 0, NULL }
};

static const range_string sprt_selected_err_corr_name[] = {
    { SPRT_VALUE_RANGE(SPRT_SELECTED_ERR_CORR_V14_OR_NONE),     "V.14 or no error correction protocol" },
    { SPRT_VALUE_RANGE(SPRT_SELECTED_ERR_CORR_V42_LAPM),        "V.42/LAPM" },
    { SPRT_VALUE_RANGE(SPRT_SELECTED_ERR_CORR_ANNEX_AV42),      "Annex A/V.42" },
    { SPRT_SELECTED_ERR_CORR_RESERVED_START, SPRT_SELECTED_ERR_CORR_RESERVED_END,   "Reserved for ITU-T" },
    { 0, 0, NULL }
};

static const range_string sprt_break_src_proto_name[] = {
    { SPRT_VALUE_RANGE(SPRT_BREAK_SRC_PROTO_V42_LAPM),          "V.42/LAPM" },
    { SPRT_VALUE_RANGE(SPRT_BREAK_SRC_PROTO_ANNEX_AV42_1996),   "Annex A/V.42(1996)" },
    { SPRT_VALUE_RANGE(SPRT_BREAK_SRC_PROTO_V14),               "V.14" },
    { SPRT_BREAK_SRC_PROTO_RESERVED_START, SPRT_BREAK_SRC_PROTO_RESERVED_END,   "Reserved for ITU-T" },
    { 0, 0, NULL }
};

static const range_string sprt_break_type_name[] = {
    { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_NOT_APPLICABLE),                     "Not applicable" },
    { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_DESTRUCTIVE_AND_EXPEDITED),          "Destructive and expedited" },
    { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_EXPEDITED),       "Non-destructive and expedited" },
    { SPRT_VALUE_RANGE(SPRT_BREAK_TYPE_NONDESTRUCTIVE_AND_NONEXPEDITED),    "Non-destructive and non-expedited" },
    { SPRT_BREAK_TYPE_RESERVED_START, SPRT_BREAK_TYPE_RESERVED_END,         "Reserved for ITU-T" },
    { 0, 0, NULL }
};

static const range_string sprt_mrevent_id_name[] = {
    { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_NULL),               "NULL" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_RATE_RENEGOTIATION), "Rate renegotiation" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_RETRAIN),            "Retrain" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_EVENT_ID_PHYSUP),             "Physical layer ready" }, /* reason code should be 0 */
    { SPRT_MREVT_EVENT_ID_RESERVED_START, SPRT_MREVT_EVENT_ID_RESERVED_END, "Reserved for ITU-T" },
    { 0, 0, NULL }
};

static const range_string sprt_mrevent_reason_code_name[] = {
    { SPRT_VALUE_RANGE(SPRT_MREVT_REASON_CODE_NULL),                "Null/not applicable" }, /* for eventid = PHYSUP */
    { SPRT_VALUE_RANGE(SPRT_MREVT_REASON_CODE_INIT),                "Initiation" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_REASON_CODE_RESPONDING),          "Responding" },
    { SPRT_MREVT_REASON_CODE_RESERVED_START, SPRT_MREVT_REASON_CODE_RESERVED_END,   "Reserved for ITU-T" },
    { 0, 0, NULL }
};

static const range_string sprt_mrevent_phys_layer_symbol_rate[] = {
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_NULL),             "Null/not applicable" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_600),              "600" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1200),             "1200" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_1600),             "1600" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2400),             "2400" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_2743),             "2743" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3000),             "3000" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3200),             "3200" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_3429),             "3249" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_8000),             "8000" },
    { SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_START, SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_RESERVED_END, "Reserved for ITU-T" },
    { SPRT_VALUE_RANGE(SPRT_MREVT_PHYS_LAYER_SYMBOL_RATE_UNSPECIFIED),  "Unspecified" },
    { 0, 0, NULL }
};

static const value_string sprt_cleardown_reason[] = {
    { SPRT_CLEARDOWN_RIC_UNKNOWN,                     "Unknown/unspecified" },
    { SPRT_CLEARDOWN_RIC_PHYSICAL_LAYER_RELEASE,      "Physical layer release" },
    { SPRT_CLEARDOWN_RIC_LINK_LAYER_DISCONNECT,       "Link layer disconnect" },
    { SPRT_CLEARDOWN_RIC_DATA_COMPRESSION_DISCONNECT, "Data compression disconnect" },
    { SPRT_CLEARDOWN_RIC_ABORT,                       "Abort" },
    { SPRT_CLEARDOWN_RIC_ON_HOOK,                     "On hook" },
    { SPRT_CLEARDOWN_RIC_NETWORK_LAYER_TERMINATION,   "Network layer termination" },
    { SPRT_CLEARDOWN_RIC_ADMINISTRATIVE,              "Administrative" },
    { 0, NULL }
};

static const value_string sprt_prof_xchg_support[] = {
    { SPRT_PROF_XCHG_SUPPORT_NO,        "No" },
    { SPRT_PROF_XCHG_SUPPORT_YES,       "Yes" },
    { SPRT_PROF_XCHG_SUPPORT_UNKNOWN,   "Unknown" },
    { 0, NULL }
};

static const range_string sprt_payload_dlci1[] = {
    { SPRT_VALUE_RANGE(SPRT_PAYLOAD_DLCI1_DTE2DTE),                               "DTE-to-DTE (V.24 interfaces) data" },
    { SPRT_PAYLOAD_DLCI1_RESERVED_START,     SPRT_PAYLOAD_DLCI1_RESERVED_END,     "Reserved for ITU-T" },
    { SPRT_PAYLOAD_DLCI1_NOT_RESERVED_START, SPRT_PAYLOAD_DLCI1_NOT_RESERVED_END, "Not reserved for ITU-T" },
    { SPRT_VALUE_RANGE(SPRT_PAYLOAD_DLCI1_CTRLFN2CTRLFN),                         "Control-function to control-function information" },
    { 0, 0, NULL }
};

static const true_false_string sprt_payload_ea_bit = {
    "Last octet of address field", "Another octet of address field follows"
};

static const range_string sprt_payload_dlci2[] = {
    { SPRT_PAYLOAD_DLCI2_START, SPRT_PAYLOAD_DLCI2_END,     "Reserved by ITU-T for further study" },
    { 0, 0, NULL }
};

static const value_string sprt_payload_data_bits[] = {
    { SPRT_PAYLOAD_D_0,     "5 bits" },
    { SPRT_PAYLOAD_D_1,     "6 bits" },
    { SPRT_PAYLOAD_D_2,     "7 bits" },
    { SPRT_PAYLOAD_D_3,     "8 bits" },
    { 0, NULL }
};

static const value_string sprt_payload_parity[] = {
    { SPRT_PAYLOAD_P_0,     "Unknown" },
    { SPRT_PAYLOAD_P_1,     "None" },
    { SPRT_PAYLOAD_P_2,     "Even parity" },
    { SPRT_PAYLOAD_P_3,     "Odd parity" },
    { SPRT_PAYLOAD_P_4,     "Space parity" },
    { SPRT_PAYLOAD_P_5,     "Mark parity" },
    { SPRT_PAYLOAD_P_6,     "Reserved" },
    { SPRT_PAYLOAD_P_7,     "Reserved" },
    { 0, NULL }
};

static const value_string sprt_payload_stop_bits[] = {
    { SPRT_PAYLOAD_S_0,     "1 stop bit" },
    { SPRT_PAYLOAD_S_1,     "2 stop bits" },
    { SPRT_PAYLOAD_S_2,     "Reserved" },
    { SPRT_PAYLOAD_S_3,     "Reserved" },
    { 0, NULL }
};

static const value_string sprt_payload_frame_state[] = {
    { SPRT_PAYLOAD_FR_0,    "Data frame without termination" },
    { SPRT_PAYLOAD_FR_1,    "Data frame with termination" },
    { SPRT_PAYLOAD_FR_2,    "Data frame with abort termination" },
    { SPRT_PAYLOAD_FR_3,    "Undefined" },
    { 0, NULL }
};



/* look for a conversation & return the associated data */
static struct _sprt_conversation_info* find_sprt_conversation_data(packet_info *pinfo)
{
    conversation_t *p_conv = NULL;
    struct _sprt_conversation_info *p_conv_data = NULL;
    /* Use existing packet info if available */
    p_conv = find_conversation_pinfo(pinfo, NO_ADDR_B|NO_PORT_B);
    if (p_conv)
    {
        p_conv_data = (struct _sprt_conversation_info*)conversation_get_proto_data(p_conv, proto_sprt);
    }
    return p_conv_data;
}



/* set up SPRT conversation */
void sprt_add_address(packet_info *pinfo,
                      address *addr, int port,
                      int other_port,
                      const gchar *setup_method,
                      guint32 setup_frame_number)
{
    address null_addr;
    conversation_t* p_conv;
    struct _sprt_conversation_info *p_conv_data = NULL;

    /*
     * If this isn't the first time this packet has been processed,
     * we've already done this work, so we don't need to do it
     * again.
     */
    if (pinfo->fd->visited)
    {
        return;
    }

    clear_address(&null_addr);

    /*
     * Check if the ip address and port combination is not
     * already registered as a conversation.
     */
    p_conv = find_conversation(setup_frame_number, addr, &null_addr, CONVERSATION_UDP, port, other_port,
                                NO_ADDR_B | (!other_port ? NO_PORT_B : 0));

    /*
     * If not, create a new conversation.
     */
    if (!p_conv || p_conv->setup_frame != setup_frame_number) {
        p_conv = conversation_new(setup_frame_number, addr, &null_addr, CONVERSATION_UDP,
                                    (guint32)port, (guint32)other_port,
                                    NO_ADDR2 | (!other_port ? NO_PORT2 : 0));
    }

    /* Set dissector */
    conversation_set_dissector(p_conv, sprt_handle);

    /*
     * Check if the conversation has data associated with it.
     */
    p_conv_data = (struct _sprt_conversation_info *)conversation_get_proto_data(p_conv, proto_sprt);

    /*
     * If not, add a new data item.
     */
    if (!p_conv_data) {
        /* Create conversation data */
        p_conv_data = wmem_new(wmem_file_scope(), struct _sprt_conversation_info);
        p_conv_data->stream_started = FALSE;
        p_conv_data->seqnum[0] = 0;
        p_conv_data->seqnum[1] = 0;
        p_conv_data->seqnum[2] = 0;
        p_conv_data->seqnum[3] = 0;
        p_conv_data->i_octet_dlci_status = DLCI_UNKNOWN;
        p_conv_data->connect_frame_number = 0;
        conversation_add_proto_data(p_conv, proto_sprt, p_conv_data);
    }

    /* Update the conversation data. */
    (void) g_strlcpy(p_conv_data->method, setup_method, SPRT_CONV_MAX_SETUP_METHOD_SIZE);
    p_conv_data->frame_number = setup_frame_number;
}



/* Display setup info */
static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    struct _sprt_conversation_info *p_conv_data;
    proto_tree *sprt_setup_tree;
    proto_item *ti;

    /* look up the conversation & get the data */
    p_conv_data = find_sprt_conversation_data(pinfo);

    if (!p_conv_data)
    {
        proto_tree_add_string_format(tree, hf_sprt_setup, tvb, 0, 0, "", "No setup info found");
        return;
    }

    /* Create setup info subtree with summary info. */
    ti =  proto_tree_add_string_format(tree, hf_sprt_setup, tvb, 0, 0,
                                        "",
                                        "Stream setup by %s (frame %u)",
                                        p_conv_data->method,
                                        p_conv_data->frame_number);
    proto_item_set_generated(ti);
    sprt_setup_tree = proto_item_add_subtree(ti, ett_sprt_setup);
    if (sprt_setup_tree)
    {
        /* Add details into subtree */
        proto_item* item = proto_tree_add_uint(sprt_setup_tree, hf_sprt_setup_frame,
                                                tvb, 0, 0, p_conv_data->frame_number);
        proto_item_set_generated(item);
        item = proto_tree_add_string(sprt_setup_tree, hf_sprt_setup_method,
                                        tvb, 0, 0, p_conv_data->method);
        proto_item_set_generated(item);
    }
}


/* code to actually dissect the packet payload data */
static int
dissect_sprt_data(tvbuff_t *tvb,
                  packet_info *pinfo,
                  struct _sprt_conversation_info *p_conv_data,
                  proto_tree *sprt_tree,
                  unsigned int offset,
                  guint payload_length)
{
    proto_item *ti;
    proto_tree *sprt_payload_tree, *field_subtree;
    guint8 octet, payload_msgid, category_id;
    guint8 selcompr, mr_event_id;
    guint16 word, category_count;

    if (payload_length > 0)
    {
        ti = proto_tree_add_uint(sprt_tree, hf_sprt_payload_length, tvb, offset, 1, payload_length);
        proto_item_set_len(ti, payload_length);

        sprt_payload_tree = proto_item_add_subtree(ti, ett_payload);

        payload_msgid = tvb_get_guint8(tvb, offset) & 0x7F;

        proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
        proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_message_id, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;
        payload_length--;

        /* what kind of message is this? */
        col_append_fstr(pinfo->cinfo, COL_INFO, ", %s(%d)",
                        rval_to_str_const(payload_msgid, sprt_modem_relay_msg_id_name, "Unknown"),
                        payload_msgid);

        /* now parse payload stuff after ext. bit & msgid */
        switch(payload_msgid)
        {
        case SPRT_MODEM_RELAY_MSG_ID_INIT:
            /* make subtree */
            ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_init_all_fields, tvb, offset, 2, ENC_BIG_ENDIAN);
            field_subtree = proto_item_add_subtree(ti, ett_init_msg_all_fields);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_necrxch, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_ecrxch, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_xid_prof_exch, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_assym_data_types, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_raw_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_frame, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_stat, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn, tvb, offset, 2, ENC_BIG_ENDIAN);
            /* from V.150.1 amendment 2 (5-2006): */
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_octet_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_stat_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_init_opt_moip_types_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            break;
        case SPRT_MODEM_RELAY_MSG_ID_XID_XCHG:
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_ecp, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_v42bis, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_v44, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_mnp5, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr1_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr2_v42bis_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr3and4_v42bis_num_codewords, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr5_v42bis_max_strlen, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr6_v44_capability, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr7_v44_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr8and9_v44_num_codewords_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr10and11_v44_num_codewords_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr12_v44_max_strlen_trans, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr13_v44_max_strlen_recv, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr14and15_v44_history_len_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_xidxchg_xidlr16and17_v44_history_len_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            break;
        case SPRT_MODEM_RELAY_MSG_ID_JM_INFO:
            category_count = 1;
            do /* there may be multiple categories */
            {
                word = tvb_get_ntohs(tvb, offset);
                category_id = (word >> 12);

                ti = proto_tree_add_uint_format_value(sprt_payload_tree, hf_sprt_payload_msg_jminfo_category_data, tvb, offset, 2, word,
                    "Item #%d: %s (0x%04x)", category_count, val_to_str_const(category_id, sprt_jm_info_cat_id_name, "Unknown"), category_id);
                category_count++;
                field_subtree = proto_item_add_subtree(ti, ett_jminfo_msg_cat_data);
                proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_id, tvb, offset, 2, ENC_BIG_ENDIAN);

                switch(category_id)
                {
                case SPRT_JM_INFO_CAT_ID_CALL_FUNCT: /* 0x8 */
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_call_function, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
                    break;
                case SPRT_JM_INFO_CAT_ID_MOD_MODES: /* 0xA */
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v34_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v34_half_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v32bis_v32, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v22bis_v22, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v17, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v29_half_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v27ter, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v26ter, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v26bis, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v23_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v23_half_duplex, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_mod_v21, tvb, offset, 2, ENC_BIG_ENDIAN);
                    break;
                case SPRT_JM_INFO_CAT_ID_PROTOCOLS: /* 0x5 */
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_protocols, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
                    break;
                case SPRT_JM_INFO_CAT_ID_PSTN_ACCESS: /* 0xB */
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pstn_access_call_dce_cell, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pstn_access_answ_dce_cell, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pstn_access_dce_on_digital_net, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
                    break;
                case SPRT_JM_INFO_CAT_ID_PCM_MODEM_AVAIL: /* 0xE */
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_analog, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_digital, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_pcm_modem_avail_v91, tvb, offset, 2, ENC_BIG_ENDIAN);
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_leftover_bits, tvb, offset, 2, ENC_BIG_ENDIAN);
                    break;
                case SPRT_JM_INFO_CAT_ID_CATEGORY_EXTENSION: /* 0x0 */
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_category_ext_info, tvb, offset, 2, ENC_BIG_ENDIAN);
                    break;
                default: /* unknown category ID */
                    proto_tree_add_item(field_subtree, hf_sprt_payload_msg_jminfo_unk_category_info, tvb, offset, 2, ENC_BIG_ENDIAN);
                    break;
                }
                offset += 2;
            } while (tvb_reported_length_remaining(tvb, offset) >= 2);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_START_JM:
            /* No additional content */
            break;
        case SPRT_MODEM_RELAY_MSG_ID_CONNECT: /***/
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_selmod, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_dir, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            selcompr = (tvb_get_guint8(tvb, offset) & 0xF0) >> 4;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_selected_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_selected_err_corr, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_tdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_rdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            word = tvb_get_ntohs(tvb, offset);
            /* is DLCI enabled (used w/I_OCTET messages)? */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_dlci_enabled, tvb, offset, 2, ENC_BIG_ENDIAN);
            /* have we previously seen a CONNECT msg in this conversation (i.e., do we know if DLCI is used w/I_OCTET?) */
            if (p_conv_data->connect_frame_number == 0)
            {
                p_conv_data->connect_frame_number = pinfo->num;
                if (word & 0x8000)
                {
                    p_conv_data->i_octet_dlci_status = DLCI_PRESENT;
                } else {
                    p_conv_data->i_octet_dlci_status = DLCI_ABSENT;
                }
            }

            /* do subtree for available data types */
            ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_avail_data_types, tvb, offset, 2, ENC_BIG_ENDIAN);
            field_subtree = proto_item_add_subtree(ti, ett_connect_msg_adt);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_octet_no_format_no_dlci, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_raw_bit, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_frame, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_stat, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_dyn, tvb, offset, 2, ENC_BIG_ENDIAN);
            /* from V.150.1 amendment 2 (5-2006): */
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_octet_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_stat_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_i_char_dyn_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(field_subtree, hf_sprt_payload_msg_connect_adt_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            if (selcompr != SPRT_SELECTED_COMPR_NONE &&
               selcompr != SPRT_SELECTED_COMPR_MNP5)
            {
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_trans_dict_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
                offset += 2;
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_recv_dict_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
                offset += 2;
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_trans_str_len, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_recv_str_len, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
            }
            if (selcompr != SPRT_SELECTED_COMPR_NONE &&
               selcompr != SPRT_SELECTED_COMPR_MNP5 &&
               selcompr != SPRT_SELECTED_COMPR_V42_BIS)
            {
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_trans_hist_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
                offset += 2;
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_connect_compr_recv_hist_sz, tvb, offset, 2, ENC_BIG_ENDIAN);
                offset += 2;
            }
            break;
        case SPRT_MODEM_RELAY_MSG_ID_BREAK: /* no additional info */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_break_source_proto, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_break_type, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_break_length, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            break;
        case SPRT_MODEM_RELAY_MSG_ID_BREAK_ACK:
            /* No additional content */
            break;
        case SPRT_MODEM_RELAY_MSG_ID_MR_EVENT:
            mr_event_id = tvb_get_guint8(tvb, offset);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_reason_code, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            if (mr_event_id == SPRT_MREVT_EVENT_ID_PHYSUP)
            {
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_selmod, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_txsen, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_rxsen, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_tdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
                offset += 2;
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_rdsr, tvb, offset, 2, ENC_BIG_ENDIAN);
                offset += 2;
                /* The next two fields are "optional"
                 * they should only appear w/PHYSUP (MR_EVENT id = 3) messages, when TxSR and RxSR are true
                 */
                if (tvb_reported_length_remaining(tvb, offset) >= 2)
                {
                    proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_txsr, tvb, offset, 1, ENC_BIG_ENDIAN);
                    offset++;
                    proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_mr_evt_rxsr, tvb, offset, 1, ENC_BIG_ENDIAN);
                    offset++;
                }
            }
            break;
        case SPRT_MODEM_RELAY_MSG_ID_CLEARDOWN:
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_cleardown_reason_code, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_cleardown_vendor_tag, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_cleardown_vendor_info, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            break;
        case SPRT_MODEM_RELAY_MSG_ID_PROF_XCHG:
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_v42_lapm, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_annex_av42, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_v44_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_v42bis_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_mnp5_compr, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr2_v42bis_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr3and4_v42bis_num_codewords, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr5_v42bis_max_strlen, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr6_v44_capability, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr7_v44_compr_req, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr8and9_v44_num_codewords_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr10and11_v44_num_codewords_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr12_v44_max_strlen_trans, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr13_v44_max_strlen_recv, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr14and15_v44_history_len_trans, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_msg_profxchg_xidlr16and17_v44_history_len_recv, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_RAW_OCTET: /* data */
            octet = tvb_get_guint8(tvb, offset);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawoctet_n_field_present, tvb, offset, 1, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawoctet_l, tvb, offset, 1, ENC_BIG_ENDIAN);
            if (octet & 0x80) /* is N field present? */
            {
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawoctet_n, tvb, offset, 1, ENC_BIG_ENDIAN);
            }
            offset++;
            payload_length--;
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_RAW_BIT: /* data */
            /*
             * L, P, N fields need to be parsed
             */
            switch((tvb_get_guint8(tvb, offset) & 0xC0) >> 6)
            {
            case 0x0: /* 00: get L (6 bits) */
                /* display leading "00" bits, followed by L */
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_included_fields_l, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_len_a, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
                payload_length--;
                break;
            case 0x1: /* 01: get L (3 bits) & P (3 bits) */
                /* display leading "01" bits, followed by L,P */
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_included_fields_lp, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_len_b, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_p, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
                payload_length--;
                break;
            default: /* 10, 11: get L (4 bits), P (3 bits), N (8 bits) */
                /* display leading "1" bit, followed by L,P,N */
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_included_fields_lpn, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_len_c, tvb, offset, 1, ENC_BIG_ENDIAN);
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_p, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
                payload_length--;
                proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_rawbit_n, tvb, offset, 1, ENC_BIG_ENDIAN);
                offset++;
                payload_length--;
                break;
            }
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_OCTET: /* data */
            if (global_sprt_show_dlci_info)
            {
                /* DLCI field may be 0, 1, or 2 bytes, depending on CONNECT message (see "DLCI enabled")...
                 * or UNKNOWN if we don't see the CONNECT message
                 */
                switch(p_conv_data->i_octet_dlci_status)
                {
                case DLCI_PRESENT:
                    octet = tvb_get_guint8(tvb, offset);
                    proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_dlci1, tvb, offset, 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_cr, tvb, offset, 1, ENC_BIG_ENDIAN);
                    proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_ea, tvb, offset, 1, ENC_BIG_ENDIAN);
                    offset++;
                    payload_length--;
                    /* check address extension... if ea bit == 0, then DLCI has another octet (see ITU-T V42 spec for more info) */
                    if (!(octet & 0x01))
                    {
                        proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_dlci2, tvb, offset, 1, ENC_BIG_ENDIAN);
                        proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_ea, tvb, offset, 1, ENC_BIG_ENDIAN);
                        offset++;
                        payload_length--;
                    }
                    ti = proto_tree_add_uint(sprt_payload_tree, hf_sprt_payload_i_octet_dlci_setup_by_connect_frame, tvb, 0, 0, p_conv_data->connect_frame_number);
                    proto_item_set_generated(ti);
                    break;
                case DLCI_ABSENT:
                    ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_no_dlci, tvb, 0, 0, ENC_NA);
                    proto_item_set_generated(ti);
                    ti = proto_tree_add_uint(sprt_payload_tree, hf_sprt_payload_i_octet_dlci_setup_by_connect_frame, tvb, 0, 0, p_conv_data->connect_frame_number);
                    proto_item_set_generated(ti);
                    break;
                case DLCI_UNKNOWN: /* e.g., we didn't see the CONNECT msg so we don't know if there is a DLCI */
                default:
                    ti = proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_i_octet_dlci_presence_unknown, tvb, 0, 0, ENC_NA);
                    proto_item_set_generated(ti);
                    break;
                }
            }
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT: /* data */
            /* r: 1-bit reserved */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* D: 2-bit field indicating # of data bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* P: 3-bit field for parity type */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* S: 2-bit field indicating # of stop bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            payload_length--;
            /* octets */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN: /* data */
            /* r: 1-bit reserved */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* D: 2-bit field indicating # of data bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* P: 3-bit field for parity type */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* S: 2-bit field indicating # of stop bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            payload_length--;
            /* octets */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_FRAME: /* data */
            /* R: 6 reserved bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_frame_reserved_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* Fr: data frame state */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_frame_state, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            payload_length--;
            /* octets */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_OCTET_CS: /* data */
            /* CS: 2-byte character sequence number */
            /* TODO - does this msg type ever have a DLCI? */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            payload_length -= 2;
            /* octets */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_STAT_CS: /* data */
            /* r: 1-bit reserved */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* D: 2-bit field indicating # of data bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* P: 3-bit field for parity type */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* S: 2-bit field indicating # of stop bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            payload_length--;
            /* CS: 2-byte character sequence number */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            payload_length -= 2;
            /* octets */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        case SPRT_MODEM_RELAY_MSG_ID_I_CHAR_DYN_CS: /* data */
            /* r: 1-bit reserved */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* D: 2-bit field indicating # of data bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_num_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* P: 3-bit field for parity type */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_parity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
            /* S: 2-bit field indicating # of stop bits */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_num_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            payload_length--;
            /* CS: 2-byte character sequence number */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data_cs, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
            payload_length -= 2;
            /* octets */
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        default:
            proto_tree_add_item(sprt_payload_tree, hf_sprt_payload_data, tvb, offset, payload_length, ENC_NA);
            break;
        }
    } else {
        proto_tree_add_item(sprt_tree, hf_sprt_payload_no_data, tvb, offset, 0, ENC_NA);
        col_append_str(pinfo->cinfo, COL_INFO, ", No Payload");
    }

    return offset;
}

static int
dissect_sprt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    /* Set up structures needed to add the protocol subtree and manage it */
    proto_item *ti;
    proto_tree *sprt_tree = NULL;
    proto_tree *sprt_ack_field_tree;
    guint16 word1;
    unsigned int offset = 0;
    guint payload_length;
    struct _sprt_conversation_info *p_conv_data = NULL;
    int i;

    guint16 tc;
    guint16 seqnum; /* 0 if TC = 0 or if no payload */
    guint16 noa;
    /* ack fields */
    /*guint16 tcn;*/
    /*guint16 sqn;*/

    /* Get conversation data, or create it if not found */
    p_conv_data = find_sprt_conversation_data(pinfo);
    if (!p_conv_data)
    {
        sprt_add_address(pinfo,
            &pinfo->src, pinfo->srcport,
            0,
            "SPRT stream",
            pinfo->num);
        p_conv_data = find_sprt_conversation_data(pinfo);
        if (!p_conv_data) {
            // This shouldn't happen; likely a new RTP conversation was set up
            // after this frame but with a setup frame before this one.
            return 0;
        }
    }

    /* Make entries in Protocol column and Info column on summary display */
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPRT");
    col_clear(pinfo->cinfo, COL_INFO);

    if (tree)
    {
        /* create the trees */
        ti = proto_tree_add_item(tree, proto_sprt, tvb, 0, -1, ENC_NA);
        sprt_tree = proto_item_add_subtree(ti, ett_sprt);

        /* show conversation setup info */
        if (global_sprt_show_setup_info)
        {
            show_setup_info(tvb, pinfo, sprt_tree);
        }
    }

    /*SPRT header packet format
    +------+-------+-------+-------+-------+-------+---------+-------+
    |0     |1      |2      |3      |4      |5      |6          |7    |
    +------+-------+-------+-------+-------+-------+---------+-------+
    | X    |             SSID                                        |
    +----------------------------------------------------------------+
    | R    |             PT                                          |
    +--------------+-------------------------------------------------+
    | TC           |   Sequence Number                               |
    +--------------+-------------------------------------------------+
    |            Sequence Number                                     |
    +----------------------------------------------------------------+
    | NOA          |   Base Sequence Number                          |
    +--------------+-------------------------------------------------+
    |            Base Sequence Number                                |
    +----------------------------------------------------------------+
    | TCN          |   SQN                                           |
    +--------------+-------------------------------------------------+
    |            SQN                                                 |
    +----------------------------------------------------------------+
    | TCN          |   SQN                                           |
    +--------------+-------------------------------------------------+
    |            SQN                                                 |
    +----------------------------------------------------------------+
    | TCN          |   SQN                                           |
    +--------------+-------------------------------------------------+
    |            SQN                                                 |
    +----------------------------------------------------------------+
    */

    /* Get fields needed for further dissection */
    word1 = tvb_get_ntohs(tvb, offset + 2);
    tc = (word1 & 0xC000) >> 14;
    seqnum = word1 & 0x3FFF;

    noa = (tvb_get_ntohs(tvb, offset + 4) & 0xC000) >> 14;

    proto_tree_add_item(sprt_tree, hf_sprt_header_extension_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sprt_tree, hf_sprt_subsession_id, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item(sprt_tree, hf_sprt_reserved_bit, tvb, offset, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(sprt_tree, hf_sprt_payload_type, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    proto_tree_add_item(sprt_tree, hf_sprt_transport_channel_id, tvb, offset, 2, ENC_BIG_ENDIAN);
    ti = proto_tree_add_item(sprt_tree, hf_sprt_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN);
    if (tc == 0 && seqnum != 0)
        expert_add_info(pinfo, ti, &ei_sprt_sequence_number_0);

    p_conv_data->seqnum[tc] = seqnum; /* keep track of seqnum values */
    offset+=2;

    proto_tree_add_item(sprt_tree, hf_sprt_number_of_ack_fields, tvb, offset, 2, ENC_BIG_ENDIAN);
    proto_tree_add_item(sprt_tree, hf_sprt_base_sequence_number, tvb, offset, 2, ENC_BIG_ENDIAN);
    offset+=2;

    if (noa) /* parse ack fields? There can be 0 - 3 */
    {
        ti = proto_tree_add_item(sprt_tree, hf_sprt_ack_field_items, tvb, offset, 2, ENC_BIG_ENDIAN);
        sprt_ack_field_tree = proto_item_add_subtree(ti, ett_sprt_ack_fields);

        for(i = 0; i < noa; i++)
        {
            proto_tree_add_item(sprt_ack_field_tree, hf_sprt_transport_channel_item, tvb, offset, 2, ENC_BIG_ENDIAN);
            proto_tree_add_item(sprt_ack_field_tree, hf_sprt_sequence_item, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;
        }
    }

    /* put details in the info column */
    col_append_fstr(pinfo->cinfo, COL_INFO, "TC=%u", tc);
    if (tc != 0)
        col_append_fstr(pinfo->cinfo, COL_INFO, ", Seq=%u", seqnum);

    /* dissect the payload, if any */
    payload_length = tvb_captured_length(tvb) - (6 + noa * 2); /* total sprt length - header stuff */
    dissect_sprt_data(tvb, pinfo, p_conv_data, sprt_tree, offset, payload_length);

    if (noa)
        col_append_str(pinfo->cinfo, COL_INFO, " (ACK fields present)");

    return tvb_captured_length(tvb);
}

/* heuristic dissector */
static gboolean
dissect_sprt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    guint8 octet, extension_bit, reserved_bit, payload_type;
    guint16 word, tc, seqnum;
    unsigned int offset = 0;

    /* This is a heuristic dissector, which means we get all the UDP
     * traffic not sent to a known dissector and not claimed by
     * a heuristic dissector called before us!
     */

    if (tvb_captured_length(tvb) < 6)
        return FALSE; /* packet is waay to short */

    /* Get the fields in the first two octets */
    extension_bit = tvb_get_guint8(tvb, offset) & 0x7F;
    if (extension_bit != 0) /* must be 0 */
        return FALSE;

    octet = tvb_get_guint8(tvb, offset + 1);
    reserved_bit = octet & 80;
    payload_type = octet & 0x7F;
    if (reserved_bit != 0) /* must be 0 */
        return FALSE;
    if (payload_type < 96 || payload_type > 128) /* value within RTP dynamic payload type range */
        return FALSE;

    word = tvb_get_ntohs(tvb, offset + 2);
    tc = word >> 14;
    seqnum = word & 0x3F;
    if ((tc == 0 || tc == 3) && (seqnum != 0)) /* seqnum only applies if tc is 1 or 2 */
        return FALSE;

    dissect_sprt(tvb, pinfo, tree, NULL);
    return TRUE;
}

/* register the protocol with Wireshark */
void
proto_register_sprt(void)
{
    module_t *sprt_module;
    expert_module_t* expert_sprt;

    static hf_register_info hf[] =
    {
        /* set up fields */
        {
            &hf_sprt_setup,
            {
                "Stream setup",
                "sprt.setup",
                FT_STRING,
                BASE_NONE,
                NULL,
                0x0,
                "Stream setup, method and frame number", HFILL
            }
        },
        {
            &hf_sprt_setup_frame,
            {
                "Setup frame",
                "sprt.setup-frame",
                FT_FRAMENUM,
                BASE_NONE,
                NULL,
                0x0,
                "Frame that set up this stream", HFILL
            }
        },
        {
            &hf_sprt_setup_method,
            {
                "Setup Method",
                "sprt.setup-method",
                FT_STRING,
                BASE_NONE,
                NULL,
                0x0,
                "Method used to set up this stream", HFILL
            }
        },
        /* SPRT header fields: */
        {
            &hf_sprt_header_extension_bit,
            {
                "Header extension bit",
                "sprt.x",
                FT_BOOLEAN,
                8,
                TFS(&tfs_set_notset),
                0x80,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_subsession_id,
            {
                "Sub session ID",
                "sprt.ssid",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x7F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_reserved_bit,
            {
                "Reserved bit",
                "sprt.reserved",
                FT_BOOLEAN,
                8,
                TFS(&tfs_set_notset),
                0x80,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_type,
            {
                "Payload type",
                "sprt.pt",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x7F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_transport_channel_id,
            {
                "Transport channel ID",
                "sprt.tc",
                FT_UINT16,
                BASE_DEC,
                VALS(sprt_transport_channel_characteristics),
                0xC000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_sequence_number,
            {
                "Sequence number",
                "sprt.seq",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x3FFF,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_number_of_ack_fields,
            {
                "Number of ACK fields",
                "sprt.noa",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0xC000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_base_sequence_number,
            {
                "Base sequence number",
                "sprt.bsqn",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x3FFF,
                NULL, HFILL
            }
        },
        /* ACK fields, if any: */
        {
            &hf_sprt_ack_field_items, /* 0 to 3 items (TCN + SQN) */
            {
                "ACK fields",
                "sprt.ack.field",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0xC000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_transport_channel_item,
            {
                "Transport control channel",
                "sprt.tcn",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0xC000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_sequence_item,
            {
                "Sequence number",
                "sprt.sqn",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x3FFF,
                NULL, HFILL
            }
        },
        /* SPRT payload, if any: */
        {
            &hf_sprt_payload_length,
            {
                "Payload (in bytes)",
                "sprt.payload.length",
                FT_UINT32,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_no_data,
            {
                "No payload",
                "sprt.payload",
                FT_NONE,
                BASE_NONE,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_reserved_bit,
            {
                "Reserved bit",
                "sprt.payload.reserved_bit",
                FT_BOOLEAN,
                8,
                TFS(&tfs_set_notset),
                0x80,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_message_id,
            {
                "Payload message ID",
                "sprt.payload.msgid",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_modem_relay_msg_id_name),
                0x7F,
                NULL, HFILL
            }
        },
        /* SPRT payload fields, if any (depend on payload msgid): */
        /* INIT message */
        {
            &hf_sprt_payload_msg_init_all_fields,
            {
                "Init message fields",
                "sprt.payload.msg_init.all_fields",
                FT_UINT16,
                BASE_HEX,
                NULL,
                0xFFFF, /* 0x0 */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_necrxch,
            {
                "NECRxCH",
                "sprt.payload.msg_init.NECRxCH",
                FT_BOOLEAN,
                16,
                NULL,
                0x8000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_ecrxch,
            {
                "ECRxCH",
                "sprt.payload.msg_init.ECRxCH",
                FT_BOOLEAN,
                16,
                NULL,
                0x4000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_xid_prof_exch,
            {
                "XID profile exchange",
                "sprt.payload.msg_init.XID_profile_exch",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x2000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_assym_data_types,
            {
                "Asymmetrical data types",
                "sprt.payload.msg_init.assym_data_types",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x1000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_i_raw_bit,
            {
                "I_RAW-BIT",
                "sprt.payload.msg_init.opt_moip_types_i_raw_bit",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x0800,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_i_frame,
            {
                "I_FRAME",
                "sprt.payload.msg_init.opt_moip_types_i_frame",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x0400,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_i_char_stat,
            {
                "I_CHAR-STAT",
                "sprt.payload.msg_init.opt_moip_types_i_char_stat",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x0200,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn,
            {
                "I_CHAR-DYN",
                "sprt.payload.msg_init.opt_moip_types_i_char_dyn",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x0100,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_i_octet_cs,
            {
                "I_OCTET-CS",
                "sprt.payload.msg_init.opt_moip_types_i_octet_cs",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x0080,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_i_char_stat_cs,
            {
                "I_CHAR-STAT-CS",
                "sprt.payload.msg_init.opt_moip_types_i_char_stat_cs",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x0040,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_i_char_dyn_cs,
            {
                "I_CHAR-DYN-CS",
                "sprt.payload.msg_init.opt_moip_types_i_char_dyn_cs",
                FT_BOOLEAN,
                16,
                TFS(&tfs_supported_not_supported),
                0x0020,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_init_opt_moip_types_reserved,
            {
                "Reserved for ITU-T",
                "sprt.payload.msg_init.opt_moip_types_reserved",
                FT_UINT16,
                BASE_HEX,
                NULL,
                0x001F,
                NULL, HFILL
            }
        },
        /* XID_XCHG message */
        {
            &hf_sprt_payload_msg_xidxchg_ecp,
            {
                "Error correcting protocol",
                "sprt.payload.msg_xidxchg.ecp",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_ecp_name),
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr1_v42bis,
            {
                "V.42 bis",
                "sprt.payload.msg_xidxchg.xidlr1_v42bis",
                FT_BOOLEAN,
                8,
                TFS(&tfs_supported_not_supported),
                0x80,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr1_v44,
            {
                "V.44",
                "sprt.payload.msg_xidxchg.xidlr1_v44",
                FT_BOOLEAN,
                8,
                TFS(&tfs_supported_not_supported),
                0x40,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr1_mnp5,
            {
                "MNP5",
                "sprt.payload.msg_xidxchg.xidlr1_mnp5",
                FT_BOOLEAN,
                8,
                TFS(&tfs_supported_not_supported),
                0x20,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr1_reserved,
            {
                "Reserved for ITU-T",
                "sprt.payload.msg_xidxchg.xidlr1_reserved",
                FT_UINT8,
                BASE_HEX,
                NULL,
                0x1F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr2_v42bis_compr_req,
            {
                "V.42bis data compression request",
                "sprt.payload.msg_xidxchg.xidlr2_v42bis_compr_req",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr3and4_v42bis_num_codewords,
            {
                "V.42bis number of codewords",
                "sprt.payload.msg_xidxchg.xidlr3and4_v42bis_num_codewords",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr5_v42bis_max_strlen,
            {
                "V.42bis maximum string length",
                "sprt.payload.msg_xidxchg.xidlr5_v42bis_max_strlen",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr6_v44_capability,
            {
                "V.44 capability",
                "sprt.payload.msg_xidxchg.xidlr6_v44_capability",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr7_v44_compr_req,
            {
                "V.44 data compression request",
                "sprt.payload.msg_xidxchg.xidlr7_v44_compr_req",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr8and9_v44_num_codewords_trans,
            {
                "V.44 number of codewords in transmit direction",
                "sprt.payload.msg_xidxchg.xidlr8and9_v44_num_codewords_trans",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr10and11_v44_num_codewords_recv,
            {
                "V.44 number of codewords in receive direction",
                "sprt.payload.msg_xidxchg.xidlr10and11_v44_num_codewords_recv",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr12_v44_max_strlen_trans,
            {
                "V.44 maximum string length in transmit direction",
                "sprt.payload.msg_xidxchg.xidlr12_v44_max_strlen_trans",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr13_v44_max_strlen_recv,
            {
                "V.44 maximum string length in receive direction",
                "sprt.payload.msg_xidxchg.xidlr13_v44_max_strlen_recv",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr14and15_v44_history_len_trans,
            {
                "V.44 length of history in transmit direction",
                "sprt.payload.msg_xidxchg.xidlr14and15_v44_history_len_trans",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_xidxchg_xidlr16and17_v44_history_len_recv,
            {
                "V.44 length of history in receive direction",
                "sprt.payload.msg_xidxchg.xidlr16and17_v44_history_len_recv",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        /* JM_INFO message */
        {
            &hf_sprt_payload_msg_jminfo_category_data,
            {
                "Category data",
                "sprt.payload.msg_jminfo.category_data",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0xFFFF,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_category_id,
            {
                "Category ID",
                "sprt.payload.msg_jminfo.category_id",
                FT_UINT16,
                BASE_HEX,
                VALS(sprt_jm_info_cat_id_name),
                0xF000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_category_ext_info,
            {
                "Unrecognized category data",
                "sprt.payload.msg_jminfo.category_ext_info",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0FFF,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_unk_category_info,
            {
                "Category extension data",
                "sprt.payload.msg_jminfo.unk_category_info",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0FFF,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_category_leftover_bits,
            {
                "Leftover bits", /* "Category info leftover bits", */
                "sprt.payload.msg_jminfo.category_leftover_bits",
                FT_UINT16,
                BASE_HEX,
                NULL,
                0x01FF,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_call_function,
            {
                "Call function",
                "sprt.payload.msg_jminfo.call_function",
                FT_UINT16,
                BASE_DEC,
                VALS(sprt_jminfo_tbc_call_funct_name),
                0x0E00,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v34_duplex,
            {
                "V.34 duplex",
                "sprt.payload.msg_jminfo.mod_v34_duplex",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0800,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v34_half_duplex,
            {
                "V.34 half-duplex",
                "sprt.payload.msg_jminfo.mod_v34_half_duplex",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0400,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v32bis_v32,
            {
                "V.32bis/V.32",
                "sprt.payload.msg_jminfo.mod_v32bis_v32",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0200,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v22bis_v22,
            {
                "V.22bis/V.22",
                "sprt.payload.msg_jminfo.mod_v22bis_v22",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0100,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v17,
            {
                "V.17",
                "sprt.payload.msg_jminfo.mod_v17",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0080,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v29_half_duplex,
            {
                "V.29 half-duplex",
                "sprt.payload.msg_jminfo.mod_v29_half_duplex",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0040,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v27ter,
            {
                "V.27ter",
                "sprt.payload.msg_jminfo.mod_v27ter",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0020,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v26ter,
            {
                "V.26ter",
                "sprt.payload.msg_jminfo.mod_v26ter",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0010,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v26bis,
            {
                "V.26bis",
                "sprt.payload.msg_jminfo.mod_v26bis",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0008,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v23_duplex,
            {
                "V.23 duplex",
                "sprt.payload.msg_jminfo.mod_v23_duplex",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0004,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v23_half_duplex,
            {
                "V.23 half-duplex",
                "sprt.payload.msg_jminfo.mod_v23_half_duplex",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0002,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_mod_v21,
            {
                "V.21",
                "sprt.payload.msg_jminfo.mod_v21",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0001,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_protocols,
            {
                "Protocols",
                "sprt.payload.msg_jminfo.protocols",
                FT_UINT16,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_jminfo_tbc_protocol_name),
                0x0E00,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_pstn_access_call_dce_cell,
            {
                "Call DCE is on a cellular connection",
                "sprt.payload.msg_jminfo.pstn_access_call_dce_cell",
                FT_BOOLEAN,
                16,
                NULL,
                0x0800,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_pstn_access_answ_dce_cell,
            {
                "Answer DCE is on a cellular connection",
                "sprt.payload.msg_jminfo.pstn_access_answ_dce_cell",
                FT_BOOLEAN,
                16,
                NULL,
                0x0400,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_pstn_access_dce_on_digital_net,
            {
                "DCE is on a digital network connection",
                "sprt.payload.msg_jminfo.pstn_access_dce_on_digital_net",
                FT_BOOLEAN,
                16,
                NULL,
                0x0200,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_analog,
            {
                "V.90 or V.92 analog modem availability",
                "sprt.payload.msg_jminfo.pcm_modem_avail_v90_v92_analog",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0800,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_pcm_modem_avail_v90_v92_digital,
            {
                "V.90 or V.92 digital modem availability",
                "sprt.payload.msg_jminfo.pcm_modem_avail_v90_v92_digital",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0400,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_jminfo_pcm_modem_avail_v91,
            {
                "V.91 modem availability",
                "sprt.payload.msg_jminfo.pcm_modem_avail_v91",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0200,
                NULL, HFILL
            }
        },
        /* START_JM message has no additional fields */
        /* CONNECT message */
        {
            &hf_sprt_payload_msg_connect_selmod,
            {
                "Selected modulation",
                "sprt.payload.msg_connect.selmod",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_selmod_name),
                0xFC,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_compr_dir,
            {
                "Compression direction",
                "sprt.payload.msg_connect.compr_dir",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_comp_direction),
                0x03,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_selected_compr,
            {
                "Selected compression",
                "sprt.payload.msg_connect.selected_compr",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_selected_compr_name),
                0xF0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_selected_err_corr,
            {
                "Selected error correction",
                "sprt.payload.msg_connect.selected_err_corr",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_selected_err_corr_name),
                0x0F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_tdsr,
            {
                "Transmit data signalling rate (bits/sec)",
                "sprt.payload.msg_connect.tdsr",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_rdsr,
            {
                "Receive data signalling rate (bits/sec)",
                "sprt.payload.msg_connect.rdsr",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_dlci_enabled,
            {
                "DLCI",
                "sprt.payload.msg_connect.dlci_enabled",
                FT_BOOLEAN,
                16,
                TFS(&tfs_enabled_disabled),
                0x8000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_avail_data_types,
            {
                "Available data types",
                "sprt.payload.msg_connect.avail_data_types",
                FT_UINT16,
                BASE_HEX,
                NULL,
                0x7FFF,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_adt_octet_no_format_no_dlci,
            {
                "Octet w/o formatting with no DLCI",
                "sprt.payload.msg_connect.adt_octet_no_format_no_dlci",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x4000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_adt_i_raw_bit,
            {
                "I_RAW-BIT",
                "sprt.payload.msg_connect.adt_i_raw_bit",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x2000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_adt_i_frame,
            {
                "I_FRAME",
                "sprt.payload.msg_connect.adt_i_frame",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x1000,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_adt_i_char_stat,
            {
                "I_CHAR-STAT",
                "sprt.payload.msg_connect.adt_i_char_stat",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0800,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_adt_i_char_dyn,
            {
                "I_CHAR-DYN",
                "sprt.payload.msg_connect.adt_i_char_dyn",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0400,
                NULL, HFILL
            }
        },
        { /* from V.150.1 amendment 2 (5-2006): */
            &hf_sprt_payload_msg_connect_adt_i_octet_cs,
            {
                "I_OCTET-CS",
                "sprt.payload.msg_connect.adt_i_octet_cs",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0200,
                NULL, HFILL
            }
        },
        { /* from V.150.1 amendment 2 (5-2006): */
            &hf_sprt_payload_msg_connect_adt_i_char_stat_cs,
            {
                "I_CHAR-STAT-CS",
                "sprt.payload.msg_connect.adt_i_char_stat_cs",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0100,
                NULL, HFILL
            }
        },
        { /* from V.150.1 amendment 2 (5-2006): */
            &hf_sprt_payload_msg_connect_adt_i_char_dyn_cs,
            {
                "I_CHAR-DYN-CS",
                "sprt.payload.msg_connect.adt_i_char_dyn_cs",
                FT_BOOLEAN,
                16,
                TFS(&tfs_available_not_available),
                0x0080,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_adt_reserved,
            {
                "Reserved for ITU-T",
                "sprt.payload.msg_connect.adt_reserved",
                FT_UINT16,
                BASE_HEX,
                NULL,
                0x007F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_compr_trans_dict_sz,
            {
                "Compression transmit dictionary size",
                "sprt.payload.msg_connect.compr_trans_dict_sz",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_compr_recv_dict_sz,
            {
                "Compression receive dictionary size",
                "sprt.payload.msg_connect.compr_recv_dict_sz",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_compr_trans_str_len,
            {
                "Compression transmit string length",
                "sprt.payload.msg_connect.compr_trans_str_len",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_compr_recv_str_len,
            {
                "Compression receive string length",
                "sprt.payload.msg_connect.compr_recv_str_len",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_compr_trans_hist_sz,
            {
                "Compression transmit history size",
                "sprt.payload.msg_connect.compr_trans_hist_sz",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_connect_compr_recv_hist_sz,
            {
                "Compression receive history size",
                "sprt.payload.msg_connect.compr_recv_hist_sz",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        /* BREAK message */
        {
            &hf_sprt_payload_msg_break_source_proto,
            {
                "Break source protocol",
                "sprt.payload.msg_break.source_proto",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_break_src_proto_name),
                0xF0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_break_type,
            {
                "Break type",
                "sprt.payload.msg_break.type",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_break_type_name),
                0x0F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_break_length,
            {
                "Break length (x10 msec)",
                "sprt.payload.msg_break.length",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        /* BREAK_ACK message has no additional fields */
        /* MR_EVENT message */
        {
            &hf_sprt_payload_msg_mr_event_id,
            {
                "Modem relay event ID",
                "sprt.payload.msg_mr_event.id",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_mrevent_id_name),
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_reason_code,
            {
                "Reason code",
                "sprt.payload.msg_mr_event.reason_code",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_mrevent_reason_code_name),
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_selmod,
            {
                "Selected modulation",
                "sprt.payload.msg_mr_event.selmod",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_selmod_name),
                0xFC,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_txsen,
            {
                "TxSEN",
                "sprt.payload.msg_mr_event.txsen",
                FT_BOOLEAN,
                8,
                TFS(&tfs_enabled_disabled),
                0x02,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_rxsen,
            {
                "RxSEN",
                "sprt.payload.msg_mr_event.rxsen",
                FT_BOOLEAN,
                8,
                TFS(&tfs_enabled_disabled),
                0x01,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_tdsr,
            {
                "Transmit data signalling rate (bits/sec)",
                "sprt.payload.msg_mr_event.tdsr",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_rdsr,
            {
                "Receive data signalling rate (bits/sec)",
                "sprt.payload.msg_mr_event.rdsr",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_txsr,
            {
                "Physical layer transmitter symbol rate (TxSR)",
                "sprt.payload.msg_mr_event.txsr",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_mrevent_phys_layer_symbol_rate),
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_mr_evt_rxsr,
            {
                "Physical layer receiver symbol rate (RxSR)",
                "sprt.payload.msg_mr_event.rxsr",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_mrevent_phys_layer_symbol_rate),
                0x0,
                NULL, HFILL
            }
        },
        /* CLEARDOWN message */
        {
            &hf_sprt_payload_msg_cleardown_reason_code,
            {
                "Reason code",
                "sprt.payload.msg_cleardown.reason_code",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_cleardown_reason),
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_cleardown_vendor_tag,
            {
                "Vendor tag",
                "sprt.payload.msg_cleardown.vendor_tag",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_cleardown_vendor_info,
            {
                "Vendor info",
                "sprt.payload.msg_cleardown.vendor_info",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        /* PROF_XCHG message */
        {
            &hf_sprt_payload_msg_profxchg_v42_lapm,
            {
                "V.42/LAPM protocol support",
                "sprt.payload.msg_profxchg.v42_lapm",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_prof_xchg_support),
                0xC0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_annex_av42,
            {
                "Annex A/V.42(1996) protocol support",
                "sprt.payload.msg_profxchg.annex_av42",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_prof_xchg_support),
                0x30,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_v44_compr,
            {
                "V.44 compression support",
                "sprt.payload.msg_profxchg.v44_compr",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_prof_xchg_support),
                0x0C,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_v42bis_compr,
            {
                "V.42bis compression support",
                "sprt.payload.msg_profxchg.v42bis_compr",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_prof_xchg_support),
                0x03,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_mnp5_compr,
            {
                "MNP5 compression support",
                "sprt.payload.msg_profxchg.mnp5_compr",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_prof_xchg_support),
                0xC0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_reserved,
            {
                "Reserved for ITU-T",
                "sprt.payload.msg_profxchg.reserved",
                FT_UINT8,
                BASE_HEX,
                NULL,
                0x3F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr2_v42bis_compr_req,
            {
                "V.42bis data compression request",
                "sprt.payload.msg_profxchg.xidlr2_v42bis_compr_req",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr3and4_v42bis_num_codewords,
            {
                "V.42bis number of codewords",
                "sprt.payload.msg_profxchg.xidlr3and4_v42bis_num_codewords",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr5_v42bis_max_strlen,
            {
                "V.42bis maximum string length",
                "sprt.payload.msg_profxchg.xidlr5_v42bis_max_strlen",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr6_v44_capability,
            {
                "V.44 capability",
                "sprt.payload.msg_profxchg.xidlr6_v44_capability",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr7_v44_compr_req,
            {
                "V.44 data compression request",
                "sprt.payload.msg_profxchg.xidlr7_v44_compr_req",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr8and9_v44_num_codewords_trans,
            {
                "V.44 number of codewords in transmit direction",
                "sprt.payload.msg_profxchg.xidlr8and9_v44_num_codewords_trans",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr10and11_v44_num_codewords_recv,
            {
                "V.44 number of codewords in receive direction",
                "sprt.payload.msg_profxchg.xidlr10and11_v44_num_codewords_recv",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr12_v44_max_strlen_trans,
            {
                "V.44 maximum string length in transmit direction",
                "sprt.payload.msg_profxchg.xidlr12_v44_max_strlen_trans",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr13_v44_max_strlen_recv,
            {
                "V.44 maximum string length in receive direction",
                "sprt.payload.msg_profxchg.xidlr13_v44_max_strlen_recv",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr14and15_v44_history_len_trans,
            {
                "V.44 length of history in transmit direction",
                "sprt.payload.msg_profxchg.xidlr14and15_v44_history_len_trans",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_msg_profxchg_xidlr16and17_v44_history_len_recv,
            {
                "V.44 length of history in receive direction",
                "sprt.payload.msg_profxchg.xidlr16and17_v44_history_len_recv",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        /* User data messages... */
        /* I_OCTET message: need to use DLCI field (8 or 16 bits) if indicated by CONNECT message */
        {
            &hf_sprt_payload_i_octet_no_dlci,
            {
                "No DLCI field",
                "sprt.payload.i_octet_no_dlci",
                FT_NONE,
                BASE_NONE,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_i_octet_dlci_presence_unknown,
            {
                "Not known if DLCI field is present",
                "sprt.payload.i_octet_dlci_presence_unknown",
                FT_NONE,
                BASE_NONE,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_i_octet_dlci1,
            {
                "DLCI #1",
                "sprt.payload.i_octet_dlci1",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_payload_dlci1),
                0xFC,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_i_octet_cr,
            {
                "Command/response bit",
                "sprt.payload.i_octet_cr",
                FT_BOOLEAN,
                8,
                NULL,
                0x02,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_i_octet_ea,
            {
                "Address field extension bit",
                "sprt.payload.i_octet_ea",
                FT_BOOLEAN,
                8,
                TFS(&sprt_payload_ea_bit),
                0x01,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_i_octet_dlci2,
            {
                "DLCI #2",
                "sprt.payload.i_octet_dlci2",
                FT_UINT8,
                BASE_DEC | BASE_RANGE_STRING,
                RVALS(sprt_payload_dlci2),
                0xFE,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_i_octet_dlci_setup_by_connect_frame,
            {
                "DLCI setup by CONNECT message at frame",
                "sprt.payload.i_octet_dlci_setup_by_connect_frame",
                FT_FRAMENUM,
                BASE_NONE,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        /* fields for I_RAW_OCTET message (L; L,N) */
        {
            &hf_sprt_payload_rawoctet_n_field_present,
            {
                "N field",
                "sprt.payload.rawoctet_n_field_present",
                FT_BOOLEAN,
                8,
                TFS(&tfs_present_absent),
                0x80,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawoctet_l,
            {
                "L: # of octets in segment minus one",
                "sprt.payload.rawoctet_l",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x7F,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawoctet_n,
            {
                "N: # of times octets appear in data minus 2",
                "sprt.payload.rawoctet_n",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0xFF,
                NULL, HFILL
            }
        },
        /* fields for I_RAW_BIT (L; L,P; L,P,N) */
        {
            &hf_sprt_payload_rawbit_included_fields_l,
            {
                "Include field L only",
                "sprt.payload.rawbit_included_fields_l",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0xC0, /* top two bits: 00 */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawbit_included_fields_lp,
            {
                "Include fields L, P",
                "sprt.payload.rawbit_field_format_lp",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0xC0, /* top two bits: 01 */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawbit_included_fields_lpn,
            {
                "Include fields L, P, N",
                "sprt.payload.rawbit_included_fields_lpn",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x80, /* top bit: 1 */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawbit_len_a,
            {
                "L: # of octets in segment",
                "sprt.payload.rawbit_len_a",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x3F, /* six bits */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawbit_len_b,
            {
                "L: # of octets in segment",
                "sprt.payload.rawbit_len_b",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x38, /* three bits */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawbit_len_c,
            {
                "L: # of octets in segment",
                "sprt.payload.rawbit_len_c",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x78, /* four bits */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawbit_p,
            {
                "P: # of low-order bits in last octet that are not in segment",
                "sprt.payload.rawbit_p",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0x7, /* three bits */
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_rawbit_n,
            {
                "N: # of times octets appear in data minus 2",
                "sprt.payload.rawbit_n",
                FT_UINT8,
                BASE_DEC,
                NULL,
                0xFF, /* eight bits */
                NULL, HFILL
            }
        },
        /* fields in I_CHAR_STAT & I_CHAR_DYN messages */
        {
            &hf_sprt_payload_data_reserved_bit,
            {
                "Reserved bit",
                "sprt.payload.reserved_bit",
                FT_BOOLEAN,
                8,
                TFS(&tfs_set_notset),
                0x80,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_data_num_data_bits,
            {
                "D: Number of data bits",
                "sprt.payload.num_data_bits",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_payload_data_bits),
                0x60,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_data_parity_type,
            {
                "P: Parity type",
                "sprt.payload.parity_type",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_payload_parity),
                0x1C,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_num_stop_bits,
            {
                "S: Number stop bits",
                "sprt.payload.num_stop_bits",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_payload_stop_bits),
                0x03,
                NULL, HFILL
            }
        },
        /* sequence field in I_OCTET_CS, I_CHAR_STAT_CS, & I_CHAR_DYN_CS messages */
        {
            &hf_sprt_payload_data_cs,
            {
                "Character sequence number",
                "sprt.payload.cs",
                FT_UINT16,
                BASE_DEC,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
        /* fields for I_FRAME: */
        {
            &hf_sprt_payload_frame_reserved_bits,
            {
                "Reserved bits",
                "sprt.payload.frame_reserved_bits",
                FT_UINT8,
                BASE_HEX,
                NULL,
                0xFC,
                NULL, HFILL
            }
        },
        {
            &hf_sprt_payload_frame_state,
            {
                "Frame state",
                "sprt.payload.frame_state",
                FT_UINT8,
                BASE_DEC,
                VALS(sprt_payload_frame_state),
                0x03,
                NULL, HFILL
            }
        },
        /* just dump remaining payload data: */
        {
            &hf_sprt_payload_data,
            {
                "Payload data",
                "sprt.payload.data",
                FT_BYTES,
                BASE_NONE,
                NULL,
                0x0,
                NULL, HFILL
            }
        },
    }; /* hf_register_info hf[] */

    /* setup protocol subtree array */
    static gint *ett[] = {
        &ett_sprt,
        &ett_sprt_setup,
        &ett_sprt_ack_fields,
        &ett_payload,
        &ett_init_msg_all_fields,
        &ett_jminfo_msg_cat_data,
        &ett_connect_msg_adt
    };

    static ei_register_info ei[] = {
        { &ei_sprt_sequence_number_0, { "sprt.sequence_number_0", PI_PROTOCOL, PI_WARN, "Should be 0 for transport channel 0", EXPFILL }},
    };

    /* register protocol name & description */
    proto_sprt = proto_register_protocol("Simple Packet Relay Transport", "SPRT", "sprt");

    /* required function calls to register the header fields and subtrees used */
    proto_register_field_array(proto_sprt, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));
    expert_sprt = expert_register_protocol(proto_sprt);
    expert_register_field_array(expert_sprt, ei, array_length(ei));

    /* register the dissector */
    sprt_handle = register_dissector("sprt", dissect_sprt, proto_sprt);

    sprt_module = prefs_register_protocol(proto_sprt, NULL);

    /* preferences */
    prefs_register_bool_preference(sprt_module, "show_setup_info",
                                    "Show stream setup information",
                                    "Where available, show which protocol and frame caused "
                                    "this SPRT stream to be created",
                                    &global_sprt_show_setup_info);
    prefs_register_bool_preference(sprt_module, "show_dlci_info",
                                    "Show DLCI in I_OCTET messages",
                                    "Show the DLCI field in I_OCTET messages as well as the frame that "
                                    "enabled/disabled the DLCI",
                                    &global_sprt_show_dlci_info);

}

void
proto_reg_handoff_sprt(void)
{
    dissector_add_for_decode_as_with_preference("udp.port", sprt_handle);

    heur_dissector_add( "udp", dissect_sprt_heur, "SPRT over UDP", "sprt_udp", proto_sprt, HEURISTIC_ENABLE);
}

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 4
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=4 tabstop=8 expandtab:
 * :indentSize=4:tabSize=8:noTabs=true:
 */