aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-acdr.c
blob: 8b2e4c39ce0609184e17aacec31968770a70c50e (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
/* packet-acdr.c
 * Routines for acdr packet dissection
 * Copyright 2019, AudioCodes Ltd
 *   @author: Alex Rodikov <alex.rodikov@audiocodes.com>
 *   @author: Beni Bloch <beni.bloch@audiocodes.com>
 *   @author: Orgad Shaneh <orgad.shaneh@audiocodes.com>
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "config.h"

#include <epan/packet.h>
#include <epan/exceptions.h>
#include <epan/ipproto.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/proto_data.h>
#include <epan/to_str.h>
#include "packet-acdr.h"

#define ACDR_VERSION_MAJOR 0
#define ACDR_VERSION_MINOR 9
#define PORT_AC_DR 925

// acdr header definitions

//  1 B        6 B           2 B        2B        1 B          1 B           1 B             1 B                     0-14 B
//------------------------------------------------------------------------------------------------------------------------------------------
//Version |  TimeStamp  | Source ID | Dest ID | Reserved  |  Trace Point | Media Type | Payload Header Length |  Payload Header  |   Payload
//------------------------------------------------------------------------------------------------------------------------------------------

// From version #4:

//  1 B        4 B       2 B        4 B        4 B       1 B          1 B           1 B             1 B                     0-14 B
//------------------------------------------------------------------------------------------------------------------------------------------
//Version | TimeStamp | SeqNum | Source ID | Dest ID | Reserved  |  Trace Point | Media Type | Payload Header Length |  Payload Header  |   Payload
//------------------------------------------------------------------------------------------------------------------------------------------

#define MII_HEADER_BYTE_LENGTH 4
#define AC5X_ANALYSIS_PACKET_HEADER 16
#define AC5X_HPI_PACKET_HEADER 4

// ACDR extension header macros:
#define EXT_HEADER_IPV4_ADDRESS_BYTE_COUNT 4
#define EXT_HEADER_IPV6_ADDRESS_BYTE_COUNT 16
#define EXT_HEADER_UDP_PORT_BYTE_COUNT 2
#define EXT_HEADER_IP_TOS_BYTE_COUNT 1
#define EXT_HEADER_C5_CONTROL_FLAFS_COUNT 1

// Signaling Packet Macros:
#define HEADER_FIELD_SIG_OPCODE_BYTE_NO 0
#define HEADER_FIELD_SIG_OPCODE_BYTE_COUNT 2
#define HEADER_FIELD_SIG_SIZE_BYTE_NO 2
#define HEADER_FIELD_SIG_SIZE_BYTE_COUNT 2
#define HEADER_FIELD_SIG_TIME_BYTE_NO 2
#define HEADER_FIELD_SIG_TIME_BYTE_COUNT 4
#define HEADER_FIELD_SIG_MESSAGE_BYTE_NO 6


// masks for the former reserved byte (data byte)
// Must be same as in file DebugTarget.h
#define MEDIUM_MASK 0x1
#define IPV6_MASK 0x2
#define FRAGMENTED_MASK 0x4
#define HEADERADDED_MASK 0x8
#define ENCRYPTED_MASK 0x10
#define MTCE_MASK 0x20
#define LI_MASK 0x40

#define FAVORITE_MASK 0x10

void proto_register_acdr(void);
void proto_reg_handoff_acdr(void);

enum Direction
{
    DIR_TX = 0,
    DIR_RX = 1
};

// Array that is used to check missed ACDR packets
#define AC_SEQ_NUM_AR_SIZE 255
struct SeqNumIpSeq
{
    guint ip;
    guint seq;
};

static const value_string acdr_trace_pt_vals[] = {
    {Net2Dsp,          "Network -> Dsp"                              }, //  0
    {Dsp2Net,          "Dsp -> Network"                              }, //  1
    {Dsp2Host,         "Dsp -> Host"                                 }, //  2
    {Host2Dsp,         "Host -> Dsp"                                 }, //  3
    {Net2Host,         "Network -> Host"                             }, //  4
    {Host2Net,         "Host -> Network"                             }, //  5
    {System,           "System"                                      }, //  6
    {Dsp2Dsp,          "Dsp -> Dsp (Media Loopback)"                 }, //  7
    {Net2Net,          "Network -> Network (Mediation)"              }, //  8
    {Dsp2Tdm,          "Dsp -> Tdm"                                  }, //  9
    {Tdm2Dsp,          "Tdm -> Dsp"                                  }, // 10
    {Np2Dsp,           "Network Processor(C5) -> Dsp"                }, // 11
    {Dsp2Np,           "Dsp -> Network Processor(C5)"                }, // 12
    {Host2Np,          "Host -> Network Processor(C5)"               }, // 13
    {Np2Host,          "Network Processor(C5) -> Host"               }, // 14
    {acUnknown,        "Unknown"                                     }, // 15 (Internal Only - not in Wireshark)
    {Net,              "Network Only"                                }, // 16
    {P2P,              "Dsp -> Dsp (P2P)"                            }, // 17
    {DspDecoder,       "Host -> DSP (before DSP Decoder)"            }, // 18
    {DspEncoder,       "Dsp -> Host (before DSP Encoder)"            }, // 19
    {VoipDecoder,      "Media Network Incoming (before Voip Decoder)"}, // 20
    {VoipEncoder,      "Media Voip Outgoing (before Voip Encoder)"   }, // 21
    {NetEncoder,       "Media Network Outgoing (before Net Encoder)" }, // 22
    {P2PDecoder,       "Dsp Internal <- DSP (after Native Decoder)"  }, // 23
    {P2PEncoder,       "Dsp Internal -> DSP (before Native Encoder)" }, // 24
    {Host2Pstn,        "Host -> Pstn"                                }, // 25
    {Pstn2Host,        "Pstn -> Host"                                }, // 26
    {Net2DspPing,      "Srtp Ping: Network -> Dsp"                   }, // 27
    {Dsp2NetPing,      "Srtp Ping: Dsp -> Network"                   }, // 28
    {Src2Dest,         "Src -> Dst"                                  }, // 29 (Internal Only - not in Wireshark)
    {Addr2Addr,        "Addr -> Addr"                                }, // 30 (Internal Only - not in Wireshark)
    {GeneralSystem,    "General System"                              }, // 31 (Internal Only - not in Wireshark)
    {AllMedia,         "All Media"                                   }, // 32 (Internal Only - not in Wireshark)
    {DspIncoming,      "Dsp Internal <- Host (DSP Incoming)"         }, // 33
    {DspOutgoing,      "Dsp Internal -> Host (DSP Outgoing)"         }, // 34
    {AfterSrtpDecoder, "Media Network Incoming (After Srtp Decoder)" }, // 35
    {0,                NULL                                          }
};

static const value_string acdr_media_type_vals[] = {
    {ACDR_DSP_AC49X,        "DSP 49x Packet"     },
    {ACDR_RTP,              "RTP Packet"         },
    {ACDR_RTCP,             "RTCP Packet"        },
    {ACDR_T38,              "T38 Packet"         },
    {ACDR_Event,            "HostEvent"          },
    {ACDR_Info,             "System Info"        },
    {ACDR_VoiceAI,          "Voice AI Packet"    },
    {ACDR_NotUse1,          "Not Use 1"          },
    {ACDR_NotUse2,          "Not Use 2"          },
    {ACDR_NotUse3,          "Not Use 3"          },
    {ACDR_SIP,              "SIP Packet"         },
    {ACDR_MEGACO,           "Megaco Packet"      },
    {ACDR_MGCP,             "MGCP Packet"        },
    {ACDR_TPNCP,            "TPNCP Packet"       },
    {ACDR_Control,          "Control Packet"     },
    {ACDR_PCM,              "PCM"                },
    {ACDR_NP_CONTROL,       "C5 Control packet"  },
    {ACDR_NP_DATA,          "C5 Data packet"     },
    {ACDR_DSP_AC45X,        "DSP 64x Packet"     },
    {ACDR_DSP_AC48X,        "DSP 48x Packet"     },
    {ACDR_HA,               "HA trace"           },
    {ACDR_CAS,              "CAS"                },
    {ACDR_NET_BRICKS,       "Net Bricks trace"   },
    {ACDR_COMMAND,          "TPNCP Command"      },
    {ACDR_VIDEORTP,         "Video RTP"          },
    {ACDR_VIDEORTCP,        "Video RTCP"         },
    {ACDR_PCIIF_COMMAND,    "PCIIF Command"      },
    {ACDR_GWAPPSYSLOG,      "GWApp syslog"       },
    {ACDR_V1501,            "V150.1 - Data relay"},
    {ACDR_DSP_AC5X,         "DSP 5x Packet"      },
    {ACDR_TLS,              "TLS Data"           },
    {ACDR_TLSPeek,          "TLS Peek Date"      },
    {ACDR_DSP_AC5X_MII,     "DSP 5x MII Packet"  },
    {ACDR_NATIVE,           "P2P - NATIVE"       },
    {ACDR_SIGNALING,        "Signaling"          },
    {ACDR_FRAGMENTED,       "Fragmented"         },
    {ACDR_QOE_CDR,          "QOE CDR"            },
    {ACDR_QOE_MDR,          "QOE MDR"            },
    {ACDR_QOE_EVENT,        "QOE Event"          },
    {ACDR_DSP_TDM_PLAYBACK, "DSP Tdm Playback"   },
    {ACDR_DSP_NET_PLAYBACK, "DSP Net Playback"   },
    {ACDR_DSP_DATA_RELAY,   "DSP Data Relay"     },
    {ACDR_DSP_SNIFFER,      "DSP Sniffer"        },
    {ACDR_RTP_AMR,          "RTP AMR"            },
    {ACDR_RTP_EVRC,         "RTP EVRC"           },
    {ACDR_RTP_RFC2198,      "RTP Rfc2198"        },
    {ACDR_RTP_RFC2833,      "RTP Rfc2833"        },
    {ACDR_T38_OVER_RTP,     "T38 over RTP"       },
    {ACDR_RTP_FEC,          "RTP FEC"            },
    {ACDR_RTP_FAX_BYPASS,   "RTP Fax Bypass"     },
    {ACDR_RTP_MODEM_BYPASS, "RTP Modem Bypass"   },
    {ACDR_RTP_NSE,          "RTP NSE"            },
    {ACDR_RTP_NO_OP,        "RTP NoOp"           },
    {ACDR_DTLS,             "DTLS Data"          },
    {0,                NULL                 }
};

static const value_string acdr_media_type_dummy_vals[] = {
    {ACDR_DSP_AC49X,     ""             },
    {ACDR_RTP,           ""             },
    {ACDR_RTCP,          ""             },
    {ACDR_T38,           ""             },
    {ACDR_Event,         ""             },
    {ACDR_Info,          ""             },
    {ACDR_VoiceAI,       ""             },
    {ACDR_NotUse1,       ""             },
    {ACDR_NotUse2,       ""             },
    {ACDR_NotUse3,       ""             },
    {ACDR_SIP,           ""             },
    {ACDR_MEGACO,        ""             },
    {ACDR_MGCP,          ""             },
    {ACDR_TPNCP,         ""             },
    {ACDR_Control,       ""             },
    {ACDR_PCM,           ""             },
    {ACDR_NP_CONTROL,    ""             },
    {ACDR_NP_DATA,       ""             },
    {ACDR_DSP_AC45X,     ""             },
    {ACDR_DSP_AC48X,     ""             },
    {ACDR_HA,            ""             },
    {ACDR_CAS,           ""             },
    {ACDR_NET_BRICKS,    ""             },
    {ACDR_COMMAND,       ""             },
    {ACDR_VIDEORTP,      ""             },
    {ACDR_VIDEORTCP,     ""             },
    {ACDR_PCIIF_COMMAND, ""             },
    {ACDR_GWAPPSYSLOG,   ""             },
    {ACDR_V1501,         ""             },
    {ACDR_DSP_AC5X,      ""             },
    {ACDR_TLS,           ""             },
    {ACDR_TLSPeek,       ""             },
    {ACDR_DSP_AC5X_MII,  "DSP 5x Packet"},
    {0,             NULL           }
};

enum AcdrAc5xProtocolType
{
    ACDR_AC5X_PROTOCOL_TYPE__REGULAR,
    ACDR_AC5X_PROTOCOL_TYPE__TDM_PLAYBACK,
    ACDR_AC5X_PROTOCOL_TYPE__NET_PLAYBACK
};

struct AcdrAc5xPrivateData
{
    guint packet_direction;
    enum AcdrAc5xProtocolType protocol_type;
    guint mii_header_exist;
};

typedef struct AcdrTlsPacketInfo
{
    guint16 source_port;
    guint16 dest_port;
    guint8  application;
} AcdrTlsPacketInfo;


static const value_string hf_acdr_ext_tls_application_vals[] = {
    {0, "UNKNWN"},
    {1, "HTTP"  },
    {2, "TR069" },
    {3, "SIP"   },
    {4, "LDAP"  },
    {5, "XML"   },
    {6, "TCP"   },
    {7, "TELNET"},
    {8, "FTP"   },
    {9, "TPNCP" },
    {0, NULL    },
};

static const value_string hf_acdr_ext_direction_vals[] = {
    {1, "Outgoing"},
    {0, "Incoming"},
    {0, NULL      }
};

static int proto_acdr = -1;
static int proto_ac5xmii = -1;
static int proto_ac5x = -1;
static int proto_ac48x = -1;
static int proto_ac49x = -1;

// Define headers for acdr
static int hf_acdr_seq_num = -1;
static int hf_acdr_timestamp = -1;
static int hf_acdr_sourceid = -1;
static int hf_acdr_destid = -1;
static int hf_acdr_version = -1;
static int hf_acdr_trace_pt = -1;
static int hf_acdr_media_type = -1;
static int hf_acdr_media_type_dsp_ac5x = -1;
static int hf_acdr_pl_offset_type = -1;
static int hf_acdr_header_ext_len_type = -1;
static int hf_acdr_data = -1;
static int hf_acdr_data_mii = -1;
static int hf_acdr_data_ipv6 = -1;
static int hf_acdr_data_fragmented = -1;
static int hf_acdr_data_headeradded = -1;
static int hf_acdr_data_encrypted = -1;
static int hf_acdr_data_mtce = -1;
static int hf_acdr_data_li = -1;

static int hf_acdr_session_id = -1;
static int hf_acdr_session_id_board_id = -1;
static int hf_acdr_session_id_reset_counter = -1;
static int hf_acdr_session_id_session_number = -1;
static int hf_acdr_session_id_long_session_number = -1;

static int hf_acdr_ext_c5_control_favorite = -1;

static int hf_acdr_payload_header = -1;
static int hf_acdr_mii_header = -1;

// header extension
static int hf_acdr_ext_srcudp = -1;
static int hf_acdr_ext_dstudp = -1;
static int hf_acdr_ext_srcip = -1;
static int hf_acdr_ext_srcipv6 = -1;
static int hf_acdr_ext_dstip = -1;
static int hf_acdr_ext_dstipv6 = -1;
static int hf_acdr_ext_protocol = -1;
static int hf_acdr_ext_tls_application = -1;
static int hf_acdr_ext_direction = -1;
static int hf_acdr_ext_iptos = -1;
static int hf_acdr_ext_c5_control_flags = -1;

static int hf_acdr_unknown_packet = -1;
static int hf_acdr_ext_pstn_trace_seq_num = -1;
static int hf_acdr_header_extension = -1;
static int hf_acdr_ext_dsp_core = -1;
static int hf_acdr_ext_dsp_channel = -1;
static int hf_acdr_ext_event_id = -1;
static int hf_acdr_ext_event_source = -1;

// Mii header extension
static int hf_acdr_mii_sequence = -1;
static int hf_acdr_mii_packet_size = -1;
static int hf_acdr_5x_analysis_packet_header = -1;
static int hf_5x_analysis_version = -1;
static int hf_5x_analysis_direction = -1;
static int hf_5x_analysis_sub_version = -1;
static int hf_5x_analysis_device = -1;
static int hf_5x_analysis_sequence = -1;
static int hf_5x_analysis_spare1 = -1;
static int hf_5x_analysis_timestamp = -1;
static int hf_5x_analysis_spare2 = -1;

static int hf_acdr_5x_hpi_packet_header = -1;
static int hf_5x_hpi_sync5 = -1;
static int hf_5x_hpi_udp_checksum = -1;
static int hf_5x_hpi_resource_id = -1;
static int hf_5x_hpi_favorite = -1;
static int hf_5x_hpi_protocol = -1;

static int hf_ac45x_packet = -1;
static int hf_ac48x_packet = -1;
static int hf_ac49x_packet = -1;
static int hf_ac5x_packet = -1;

static int hf_signaling_packet = -1;
static int hf_acdr_signaling_opcode = -1;
static int hf_acdr_signaling_size = -1;
static int hf_acdr_signaling_timestamp = -1;


// Define the trees for acdr
static int ett_acdr = -1;
static int ett_extension = -1;
static int ett_ac49x_packet = -1;
static int ett_ac48x_packet = -1;
static int ett_ac45x_packet = -1;
static int ett_ac5x_packet = -1;
static int ett_ac5x_mii_packet = -1;
static int ett_mii_header = -1;
static int ett_signaling_packet = -1;
static int ett_extra_data = -1;
static int ett_c5_cntrl_flags = -1;
static int ett_5x_analysis_packet_header = -1;
static int ett_5x_hpi_packet_header = -1;
static int ett_session_id = -1;

static expert_field ei_acdr_version_not_supported = EI_INIT;

static int proto_rtp;

static dissector_table_t media_type_table;
static dissector_table_t tls_application_table;
static dissector_table_t tls_application_port_table;

static dissector_handle_t acdr_dissector_handle;
static dissector_handle_t rtp_dissector_handle;
static dissector_handle_t udp_stun_dissector_handle = NULL;
static dissector_handle_t rtp_events_handle;
static dissector_handle_t rtp_rfc2198_handle;
static dissector_handle_t amr_handle;
static dissector_handle_t evrc_handle;
static dissector_table_t rtp_dissector_table;
static dissector_handle_t rtcp_dissector_handle;
static dissector_handle_t ip_dissector_handle;
static dissector_handle_t json_dissector_handle;
static dissector_handle_t megaco_dissector_handle;
static dissector_handle_t mgcp_dissector_handle;
static dissector_handle_t sip_dissector_handle;
static dissector_handle_t dsp_49x_dissector_handle;
static dissector_handle_t dsp_48x_dissector_handle;
static dissector_handle_t dsp_45x_dissector_handle;
static dissector_handle_t dsp_5x_dissector_handle;
static dissector_handle_t dsp_5x_MII_dissector_handle;
static dissector_handle_t udp_dissector_handle;
static dissector_handle_t xml_dissector_handle;
static dissector_handle_t lix2x3_dissector_handle;

static void dissect_rtp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                               guint8 media_type, guint16 payload_type);
static void create_5x_analysis_packet_header_subtree(proto_tree *tree, tvbuff_t *tvb);
static void create_5x_hpi_packet_header_subtree(proto_tree *tree, tvbuff_t *tvb);

static int
create_full_session_id_subtree(proto_tree *tree, tvbuff_t *tvb, int offset, guint8 ver)
{
    guint64 full_session_id = tvb_get_letoh64(tvb, offset);
    proto_item *packet_item = NULL;
    proto_item *packet_tree = NULL;
    guint64 session_int = 0;
    gint session_id_length;

    // SessionID
    const char *str = "N/A";

    if (full_session_id != 0) {
        const char *session_ext = "";
        guint32 board_id = tvb_get_ntoh24(tvb, offset);
        guint8 reset_counter = tvb_get_guint8(tvb, offset + 3);

        if ((ver & 0xF) == 7)
            session_int = tvb_get_ntohl(tvb, offset + 4);
        else
            session_int = tvb_get_ntoh40(tvb, offset + 4);

        if (session_int != 0)
            session_ext = wmem_strdup_printf(wmem_packet_scope(), ":%" PRIu64, session_int);
        str = wmem_strdup_printf(wmem_packet_scope(), "%x:%d%s", board_id, reset_counter, session_ext);
    }

    if ((ver & 0xF) == 7) {
        session_id_length = 8;
        packet_item = proto_tree_add_string(tree, hf_acdr_session_id, tvb, offset, session_id_length, str);
    } else {
        session_id_length = 9;
        packet_item = proto_tree_add_string(tree, hf_acdr_session_id, tvb, offset, session_id_length, str);
    }
    if (full_session_id == 0)
        return offset + session_id_length;

    packet_tree = proto_item_add_subtree(packet_item, ett_session_id);

    // SessionID.boardid
    proto_tree_add_item(packet_tree, hf_acdr_session_id_board_id, tvb, offset, 3, ENC_BIG_ENDIAN);
    offset += 3;

    // SessionID.resetcounter
    proto_tree_add_item(packet_tree, hf_acdr_session_id_reset_counter, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    // SessionID.sessionnumber
    if ((ver & 0xF) == 7) {
        proto_tree_add_item(packet_tree, hf_acdr_session_id_session_number, tvb,
                            offset, 4, ENC_BIG_ENDIAN);
        offset += 4;
    } else {
        proto_tree_add_item(packet_tree, hf_acdr_session_id_long_session_number, tvb,
                            offset, 5, ENC_BIG_ENDIAN);
        offset += 5;
    }

    return offset;
}

static void
create_header_extension_subtree(proto_tree *tree, tvbuff_t *tvb, gint offset, guint8 extension_length,
                                guint32 ver, guint8 media_type, guint8 trace_point, guint8 extra_data,
                                AcdrTlsPacketInfo *tls_packet_info)
{
    proto_tree *extension_tree;
    gboolean ipv6 = ((IPV6_MASK & extra_data) == IPV6_MASK);

    // parse the header extension
    proto_item *ti = proto_tree_add_item(tree, hf_acdr_header_extension, tvb, offset,
                                         extension_length, ENC_NA);

    extension_tree = proto_item_add_subtree(ti, ett_extension);

    if (media_type == ACDR_TLS || media_type == ACDR_TLSPeek) {
        tls_packet_info->source_port = tvb_get_ntohs(tvb, offset);
        tls_packet_info->dest_port = tvb_get_ntohs(tvb, offset + 2);
        tls_packet_info->application = tvb_get_guint8(tvb, offset + 12);
    }

    //further processing only involves adding fields
    if (tree == NULL)
        return;

    switch (trace_point) {
    case DspIncoming:
    case DspOutgoing:

        // Gen5 only - special case of recorded packets from DSP
        proto_tree_add_item(extension_tree, hf_acdr_ext_dsp_core, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;

        proto_tree_add_item(extension_tree, hf_acdr_ext_dsp_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
        return;
    }

    switch (media_type) {
    case ACDR_CAS:
    case ACDR_NET_BRICKS:
        if (extension_length > 0) {
            proto_tree_add_item(extension_tree, hf_acdr_ext_pstn_trace_seq_num, tvb,
                                offset, 4, ENC_BIG_ENDIAN);
        }
        break;
    case ACDR_Event:
        proto_tree_add_item(extension_tree, hf_acdr_ext_event_id, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;

        proto_tree_add_item(extension_tree, hf_acdr_ext_event_source, tvb, offset, 1, ENC_BIG_ENDIAN);
        break;
    case ACDR_DSP_AC49X:
    case ACDR_DSP_AC48X:
    case ACDR_DSP_AC45X:
    case ACDR_DSP_AC5X:
    case ACDR_DSP_AC5X_MII:
    case ACDR_DSP_SNIFFER:
        proto_tree_add_item(extension_tree, hf_acdr_ext_dsp_core, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;

        proto_tree_add_item(extension_tree, hf_acdr_ext_dsp_channel, tvb, offset, 1, ENC_BIG_ENDIAN);
        break;
    case ACDR_RTP:
    case ACDR_RTP_AMR:
    case ACDR_RTP_EVRC:
    case ACDR_RTP_RFC2198:
    case ACDR_RTP_RFC2833:
    case ACDR_T38_OVER_RTP:
    case ACDR_RTP_FEC:
    case ACDR_RTP_FAX_BYPASS:
    case ACDR_RTP_MODEM_BYPASS:
    case ACDR_RTP_NSE:
    case ACDR_RTP_NO_OP:
    case ACDR_T38:
    case ACDR_RTCP:
    case ACDR_VIDEORTP:
    case ACDR_VIDEORTCP:
    case ACDR_NATIVE:
    case ACDR_DTLS:
    {
        switch (trace_point) {
        case Net2Dsp:
        case Net2Host:
        case DspDecoder:
        case VoipDecoder:
        case Net2DspPing:
        case AfterSrtpDecoder:
            if (((ver & 0xF) >= 3) && ipv6) {
                proto_tree_add_item(extension_tree, hf_acdr_ext_srcipv6, tvb, offset, 16, ENC_NA);
                offset += 16;
            } else {
                proto_tree_add_item(extension_tree, hf_acdr_ext_srcip, tvb, offset, 4, ENC_BIG_ENDIAN);
                offset += 4;
            }

            // Gen3 only: we put the UDP header in the last 8 bytes of the header extension.
            // So, we have only IP address into the real header extension
            if ((media_type == ACDR_T38) && (trace_point == Net2Dsp) && (extension_length == 4))
                break;

            proto_tree_add_item(extension_tree, hf_acdr_ext_srcudp, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;

            proto_tree_add_item(extension_tree, hf_acdr_ext_dstudp, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;

            proto_tree_add_item(extension_tree, hf_acdr_ext_iptos, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;

            if ((trace_point == Net2Dsp) && (extension_length == 10)) {
                // Gen3 only: we should add one byte of C5 Control Flags
                // C5 Control Flags

                static int * const c5_cntrl_flags[] = {
                    &hf_acdr_ext_c5_control_favorite,
                    NULL
                };

                proto_tree_add_bitmask(extension_tree, tvb, offset, hf_acdr_ext_c5_control_flags,
                                       ett_c5_cntrl_flags, c5_cntrl_flags, ENC_BIG_ENDIAN);
            }
            break;
        case Dsp2Net:
        case Host2Net:
        case P2P:
        case P2PDecoder:
        case P2PEncoder:
        case NetEncoder:
        case VoipEncoder:
        case DspEncoder:
        case Dsp2NetPing:
            if (((ver & 0xF) >= 3) && ipv6) {
                proto_tree_add_item(extension_tree, hf_acdr_ext_dstipv6, tvb, offset, 16, ENC_NA);
                offset += 16;
            } else {
                proto_tree_add_item(extension_tree, hf_acdr_ext_dstip, tvb, offset, 4, ENC_BIG_ENDIAN);
                offset += 4;
            }

            // Gen3 only: we put the UDP header in the last 8 bytes of the header extension.
            // So, we have only IP address into the real header extension
            if ((media_type == ACDR_T38) && (trace_point == Dsp2Net) && (extension_length == 4))
                break;

            proto_tree_add_item(extension_tree, hf_acdr_ext_dstudp, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;

            proto_tree_add_item(extension_tree, hf_acdr_ext_srcudp, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;

            proto_tree_add_item(extension_tree, hf_acdr_ext_iptos, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
            break;

        default:
            proto_tree_add_item(extension_tree, hf_acdr_payload_header, tvb, offset,
                                extension_length, ENC_NA);
            break;
        }
        break;
    }

    case ACDR_VoiceAI:
    case ACDR_SIP:
    case ACDR_MEGACO:
    case ACDR_MGCP:
    case ACDR_TPNCP:
    case ACDR_Control:
        if (trace_point == System) {
            proto_tree_add_item(extension_tree, hf_acdr_ext_srcip, tvb, offset, 4, ENC_BIG_ENDIAN);
            offset += 4;

            proto_tree_add_item(extension_tree, hf_acdr_ext_dstip, tvb, offset, 4, ENC_BIG_ENDIAN);
            offset += 4;

            proto_tree_add_item(extension_tree, hf_acdr_ext_srcudp, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;

            proto_tree_add_item(extension_tree, hf_acdr_ext_dstudp, tvb, offset, 2, ENC_BIG_ENDIAN);
            offset += 2;

            proto_tree_add_item(extension_tree, hf_acdr_ext_protocol, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;

            proto_tree_add_item(extension_tree, hf_acdr_ext_direction, tvb, offset, 1, ENC_BIG_ENDIAN);
            offset++;
        } else {
            proto_tree_add_item(extension_tree, hf_acdr_payload_header, tvb, offset,
                                extension_length, ENC_NA);
        }
        break;
    case ACDR_TLS:
    case ACDR_TLSPeek:
        proto_tree_add_item(extension_tree, hf_acdr_ext_srcudp, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 2;

        proto_tree_add_item(extension_tree, hf_acdr_ext_dstudp, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 2;

        proto_tree_add_item(extension_tree, hf_acdr_ext_srcip, tvb, offset, 4, ENC_BIG_ENDIAN);
        offset += 4;

        proto_tree_add_item(extension_tree, hf_acdr_ext_dstip, tvb, offset, 4, ENC_BIG_ENDIAN);
        offset += 4;

        proto_tree_add_item(extension_tree, hf_acdr_ext_tls_application, tvb, offset, 1, ENC_BIG_ENDIAN);
        break;

    default:

        // Payload Header - only show it if exists
        proto_tree_add_item(extension_tree, hf_acdr_payload_header, tvb, offset, extension_length,
                            ENC_NA);
    }
}

static void
create_mii_header_subtree(proto_tree *tree, tvbuff_t *tvb, int offset, guint8 media_type)
{
    proto_tree *mii_header_tree;

    // parse the header extension
    proto_item *ti = proto_tree_add_item(tree, hf_acdr_mii_header, tvb,
                                         offset, MII_HEADER_BYTE_LENGTH, ENC_NA);

    mii_header_tree = proto_item_add_subtree(ti, ett_mii_header);

    switch (media_type) {
    case ACDR_DSP_AC5X_MII:
    case ACDR_RTP:
    case ACDR_RTP_AMR:
    case ACDR_RTP_EVRC:
    case ACDR_RTP_RFC2198:
    case ACDR_RTP_RFC2833:
    case ACDR_T38_OVER_RTP:
    case ACDR_RTP_FEC:
    case ACDR_RTP_FAX_BYPASS:
    case ACDR_RTP_MODEM_BYPASS:
    case ACDR_RTP_NSE:
    case ACDR_RTP_NO_OP:
    case ACDR_T38:
    case ACDR_RTCP:
    case ACDR_VIDEORTP:
    case ACDR_VIDEORTCP:
    case ACDR_NATIVE:
        proto_tree_add_item(mii_header_tree, hf_acdr_mii_sequence, tvb, offset, 2, ENC_BIG_ENDIAN);
        offset += 2;

        proto_tree_add_item(mii_header_tree, hf_acdr_mii_packet_size, tvb, offset, 2, ENC_BIG_ENDIAN);
        break;
    }
}

static void
create_5x_analysis_packet_header_subtree(proto_tree *tree, tvbuff_t *tvb)
{
    proto_tree *ac5x_analysis_packet_header;

    // parse the header extension
    proto_item *ti = proto_tree_add_item(tree, hf_acdr_5x_analysis_packet_header, tvb,
                                         AC5X_ANALYSIS_PACKET_HEADER, -1, ENC_NA);

    ac5x_analysis_packet_header = proto_item_add_subtree(ti, ett_5x_analysis_packet_header);

    if (tree) {
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_version, tvb, 0, 2,
                            ENC_BIG_ENDIAN);
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_direction, tvb, 2, 1,
                            ENC_BIG_ENDIAN);
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_sub_version, tvb, 2, 1,
                            ENC_BIG_ENDIAN);
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_device, tvb, 3, 1,
                            ENC_BIG_ENDIAN);
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_sequence, tvb, 4, 2,
                            ENC_BIG_ENDIAN);
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_spare1, tvb, 6, 2,
                            ENC_BIG_ENDIAN);
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_timestamp, tvb, 8, 4,
                            ENC_BIG_ENDIAN);
        proto_tree_add_item(ac5x_analysis_packet_header, hf_5x_analysis_spare2, tvb, 12, 4,
                            ENC_BIG_ENDIAN);
    }
}

static void
create_5x_hpi_packet_header_subtree(proto_tree *tree, tvbuff_t *tvb)
{
    proto_tree *ac5x_hpi_packet_header;

    // parse the header extension
    proto_item *ti = proto_tree_add_item(tree, hf_acdr_5x_hpi_packet_header, tvb, 0,
                                         AC5X_HPI_PACKET_HEADER, ENC_NA);

    ac5x_hpi_packet_header = proto_item_add_subtree(ti, ett_5x_hpi_packet_header);

    if (!tree)
        return;
    proto_tree_add_item(ac5x_hpi_packet_header, hf_5x_hpi_sync5, tvb, 0, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(ac5x_hpi_packet_header, hf_5x_hpi_udp_checksum, tvb, 0, 1,
                        ENC_BIG_ENDIAN);
    proto_tree_add_item(ac5x_hpi_packet_header, hf_5x_hpi_resource_id, tvb, 1, 1,
                        ENC_BIG_ENDIAN);
    proto_tree_add_item(ac5x_hpi_packet_header, hf_5x_hpi_favorite, tvb, 2, 1, ENC_BIG_ENDIAN);
    proto_tree_add_item(ac5x_hpi_packet_header, hf_5x_hpi_protocol, tvb, 3, 1, ENC_BIG_ENDIAN);
}

static void
acdr_payload_handler(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
                     acdr_dissector_data_t *data, const char *proto_name)
{
    if (data->header_added && data->media_type != ACDR_Control) {
        dissector_handle_t dissector = ip_dissector_handle;
        if (data->media_type == ACDR_DTLS || data->media_type == ACDR_T38)
            dissector = udp_dissector_handle;
        if (dissector)
            call_dissector(dissector, tvb, pinfo, tree);
        else
            call_data_dissector(tvb, pinfo, tree);
        if (proto_name)
            col_set_str(pinfo->cinfo, COL_PROTOCOL, proto_name);
        return;
    }
    if (data->li_packet && !data->header_added && lix2x3_dissector_handle)
    {
        if (call_dissector_only(lix2x3_dissector_handle, tvb, pinfo, tree, data))
            return;
    }
    // check registered media types
    if (dissector_try_uint_new(media_type_table, data->media_type, tvb, pinfo, tree, FALSE, data))
        return;
    proto_tree_add_item(tree, hf_acdr_unknown_packet, tvb, 0, 0, ENC_NA);
}

static void
dissect_rtp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 media_type,
                   guint16 payload_type)
{
    proto_tree *rtp_data_tree;
    dissector_handle_t old_dissector_handle = NULL;

    int bytes_dissected = 0;

    if ((tvb_get_guint8(tvb, 0) & 0xC0) == 0) {
        // RTP Version = 0
        if (tvb_get_ntohl(tvb, 4) == 0x2112a442) {
            // This is STUN RFC 5389 packet
            if (udp_stun_dissector_handle) {
                bytes_dissected = call_dissector(udp_stun_dissector_handle, tvb, pinfo, tree);
                if (bytes_dissected > 0)
                    return;
            }
        }
    }

    if (payload_type != 0) {
        switch (media_type) {
        case ACDR_RTP_AMR:
            if (amr_handle) {
                old_dissector_handle = dissector_get_uint_handle(rtp_dissector_table, payload_type);
                if (old_dissector_handle != amr_handle)
                    dissector_add_uint("rtp.pt", payload_type, amr_handle);
            }
            break;
        case ACDR_RTP_EVRC:
            if (evrc_handle) {
                old_dissector_handle = dissector_get_uint_handle(rtp_dissector_table, payload_type);
                if (old_dissector_handle != evrc_handle)
                    dissector_add_uint("rtp.pt", payload_type, evrc_handle);
            }
            break;
        case ACDR_RTP_RFC2198:
            if (rtp_rfc2198_handle) {
                old_dissector_handle = dissector_get_uint_handle(rtp_dissector_table, payload_type);
                if (old_dissector_handle != rtp_rfc2198_handle)
                    dissector_add_uint("rtp.pt", payload_type, rtp_rfc2198_handle);
            }
            break;
        case ACDR_RTP_RFC2833:
            if (rtp_events_handle) {
                old_dissector_handle = dissector_get_uint_handle(rtp_dissector_table, payload_type);
                if (old_dissector_handle != rtp_events_handle)
                    dissector_add_uint("rtp.pt", payload_type, rtp_events_handle);
            }
            break;
        case ACDR_RTP_FEC:
            if (rtp_rfc2198_handle) {
                old_dissector_handle = dissector_get_uint_handle(rtp_dissector_table, payload_type);
                if (old_dissector_handle != rtp_rfc2198_handle)
                    dissector_add_uint("rtp.pt", payload_type, rtp_rfc2198_handle);
            }
            break;
        }
    }

    call_dissector(rtp_dissector_handle, tvb, pinfo, tree);

    // see that the bottom protocol is indeed RTP and not some other protocol on top RTP
    if (tree && tree->last_child) {
        if (tree->last_child->finfo->hfinfo->id == proto_rtp) {
            // add the length & offset fields to the RTP payload
            rtp_data_tree = tree->last_child->last_child; // the rtp subtree->the payload field

            if (rtp_data_tree) {
                proto_item_set_text(rtp_data_tree, "RTP Data (%d bytes, offset %d)",
                                    rtp_data_tree->finfo->length, rtp_data_tree->finfo->start);
            }
        }
    }

    switch (media_type) {
    case ACDR_RTP_AMR:
        if (old_dissector_handle && (old_dissector_handle != amr_handle))
            dissector_add_uint("rtp.pt", payload_type, old_dissector_handle);
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP AMR");
        break;
    case ACDR_RTP_EVRC:
        if (old_dissector_handle && (old_dissector_handle != evrc_handle))
            dissector_add_uint("rtp.pt", payload_type, old_dissector_handle);
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP Evrc");
        break;
    case ACDR_RTP_RFC2198:
        if (old_dissector_handle && (old_dissector_handle != rtp_rfc2198_handle))
            dissector_add_uint("rtp.pt", payload_type, old_dissector_handle);
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP Rfc2198");
        break;
    case ACDR_RTP_RFC2833:
        if (old_dissector_handle && (old_dissector_handle != rtp_events_handle))
            dissector_add_uint("rtp.pt", payload_type, old_dissector_handle);
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP Rfc2833");
        break;
    case ACDR_T38_OVER_RTP:
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "T38 over RTP");
        break;
    case ACDR_RTP_FEC:
        if (old_dissector_handle && (old_dissector_handle != rtp_rfc2198_handle))
            dissector_add_uint("rtp.pt", payload_type, old_dissector_handle);
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP FEC");
        break;
    case ACDR_RTP_FAX_BYPASS:
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP Fax Bypass");
        break;
    case ACDR_RTP_MODEM_BYPASS:
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP Modem Bypass");
        break;
    case ACDR_RTP_NSE:
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP NSE");
        break;
    case ACDR_RTP_NO_OP:
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP NoOp");
        break;
    case ACDR_VIDEORTP:
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTP Video");
        break;
    }
}

static int
dissect_signaling_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 trace_point)
{
    tvbuff_t *next_tvb = NULL;
    gint32 offset = 0;
    gint remaining;
    const gboolean is_incoming = trace_point == Host2Pstn || trace_point == DspIncoming;

    proto_tree_add_item(tree, hf_acdr_signaling_opcode, tvb, HEADER_FIELD_SIG_OPCODE_BYTE_NO,
                        HEADER_FIELD_SIG_OPCODE_BYTE_COUNT, ENC_BIG_ENDIAN);
    offset += HEADER_FIELD_SIG_OPCODE_BYTE_COUNT;
    if (is_incoming) {
        proto_tree_add_item(tree, hf_acdr_signaling_size, tvb, HEADER_FIELD_SIG_SIZE_BYTE_NO,
                            HEADER_FIELD_SIG_SIZE_BYTE_COUNT, ENC_BIG_ENDIAN);
        offset += HEADER_FIELD_SIG_SIZE_BYTE_COUNT;
    } else {
        const guint32 timestamp = tvb_get_ntohl(tvb, HEADER_FIELD_SIG_TIME_BYTE_NO);
        nstime_t sig_time = {timestamp / 1000000, (timestamp % 1000000) * 1000};
        proto_tree_add_time_format_value(
                    tree, hf_acdr_signaling_timestamp, tvb, HEADER_FIELD_SIG_TIME_BYTE_NO,
                    HEADER_FIELD_SIG_TIME_BYTE_COUNT, &sig_time, "%f sec", timestamp / 1000000.0f);
        offset += HEADER_FIELD_SIG_TIME_BYTE_COUNT;
    }

    remaining = tvb_reported_length_remaining(tvb, offset);
    if (remaining == 0)
        return tvb_reported_length(tvb);
    next_tvb = tvb_new_subset_length_caplen(tvb, offset, remaining, -1);

    return call_data_dissector(next_tvb, pinfo, tree);
}

static gint32
add_cid(proto_tree *tree, tvbuff_t *tvb, gint offset, gint cid_byte_length, int hf)
{
    gint32 cid = 0;
    if (cid_byte_length == 2) {
        cid = tvb_get_ntohs(tvb, offset);
    } else {
        cid = tvb_get_ntohl(tvb, offset);
    }
    if (cid_byte_length == 2 && cid == 0xFFFF)
        cid = -1;
    proto_tree_add_int_format_value(tree, hf, tvb, offset, cid_byte_length, cid, "%d", cid);
    return cid;
}

static void
create_acdr_tree(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb)
{
    proto_item *header_ti = NULL;
    proto_tree *acdr_tree;
    tvbuff_t *next_tvb = NULL;
    gint offset = 0;
    gint header_byte_length = 15;
    gint cid_byte_length = 2;
    guint32 sequence_num = 0;
    guint32 version, trace_point, header_extension_len = 0;
    guint8 media_type, extra_data;
    gboolean medium_mii = 0;
    gint64 timestamp;
    nstime_t acdr_time = NSTIME_INIT_ZERO;
    gint time_size = 0;
    int acdr_header_length;
    gboolean header_added;
    gboolean li_packet;
    guint16 payload_type = 0;
    AcdrTlsPacketInfo tls_packet_info = {0xFFFF, 0xFFFF, TLS_APP_UNKNWN};
    const char *proto_name = NULL;

    header_ti = proto_tree_add_item(tree, proto_acdr, tvb, 0, -1, ENC_NA);
    acdr_tree = proto_item_add_subtree(header_ti, ett_acdr);

    // Version
    proto_tree_add_item_ret_uint(acdr_tree, hf_acdr_version, tvb, offset, 1, ENC_BIG_ENDIAN, &version);
    offset++;

    if ((version & 0xF) < 5) {
        header_byte_length = 15;
        cid_byte_length = 2;
    } else if ((version & 0xF) < 7) {
        header_byte_length = 19;
        cid_byte_length = 2;
    } else if ((version & 0xF) == 7) {
        header_byte_length = 23;
        cid_byte_length = 2;
    } else if ((version & 0xF) == 8) {
        header_byte_length = 24;
        cid_byte_length = 2;
    } else {
        header_byte_length = 28;
        cid_byte_length = 4;
    }

    if (((version & 0xF) > ACDR_VERSION_MINOR) || (((version >> 4) & 0xF) != ACDR_VERSION_MAJOR)) {
        // version not supported
        expert_add_info_format(pinfo, header_ti, &ei_acdr_version_not_supported,
                               "ACDR version %d not supported", version);
        return;
    }

    // Timestamp
    if ((version & 0xF) <= 3) {
        timestamp = (tvb_get_ntohl(tvb, offset) << 16) | tvb_get_ntohs(tvb, offset + 4);
        time_size = 6;
    } else {
        timestamp = tvb_get_ntohl(tvb, offset);
        time_size = 4;
    }
    acdr_time.secs = timestamp / 1000000;
    acdr_time.nsecs = (timestamp % 1000000) * 1000;
    proto_tree_add_time_format_value(acdr_tree, hf_acdr_timestamp, tvb, offset, time_size, &acdr_time,
                                     "%f sec", timestamp / 1000000.0f);
    offset += time_size;

    // Sequence Number
    if ((version & 0xF) >= 4) {
        proto_tree_add_item_ret_uint(acdr_tree, hf_acdr_seq_num, tvb, offset, 2, ENC_BIG_ENDIAN,
                                     &sequence_num);
        offset += 2;
    }

    add_cid(acdr_tree, tvb, offset, cid_byte_length, hf_acdr_sourceid);
    offset += cid_byte_length;
    add_cid(acdr_tree, tvb, offset, cid_byte_length, hf_acdr_destid);
    offset += cid_byte_length;

    // Extra Data
    extra_data = tvb_get_guint8(tvb, offset);
    if ((extra_data == 0) ||

        // Backward Compatible:  in old versions we always set the extra_data with 0xAA value
        ((extra_data == 0xAA) && ((version & 0xF) <= 3))) {
        proto_tree_add_item(acdr_tree, hf_acdr_data, tvb, offset, 1, ENC_BIG_ENDIAN);
    } else {
        static int * const extra_data_bits[] = {
            &hf_acdr_data_li,
            &hf_acdr_data_mtce,
            &hf_acdr_data_encrypted,
            &hf_acdr_data_headeradded,
            &hf_acdr_data_fragmented,
            &hf_acdr_data_ipv6,
            &hf_acdr_data_mii,
            NULL
        };

        proto_tree_add_bitmask(acdr_tree, tvb, offset, hf_acdr_data, ett_extra_data,
                               extra_data_bits, ENC_BIG_ENDIAN);
    }
    offset++;

    if (((version & 0xF) >= 3) && ((MEDIUM_MASK & extra_data) == MEDIUM_MASK))
        medium_mii = 1;

    header_added = ((HEADERADDED_MASK & extra_data) == HEADERADDED_MASK) && (extra_data != 0xAA);
    li_packet = (LI_MASK & extra_data) == LI_MASK;

    // Trace Point Type
    proto_tree_add_item_ret_uint(acdr_tree, hf_acdr_trace_pt, tvb, offset, 1, ENC_BIG_ENDIAN,
                                 &trace_point);
    offset++;

    // Media Type
    media_type = tvb_get_guint8(tvb, offset);
    if ((media_type == ACDR_DSP_AC5X_MII) && (medium_mii == 0))
        proto_tree_add_item(acdr_tree, hf_acdr_media_type_dsp_ac5x, tvb, offset, 1, ENC_BIG_ENDIAN);
    else
        proto_tree_add_item(acdr_tree, hf_acdr_media_type, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    if ((version & 0xF) < 5) {
        // Payload Offset
        proto_tree_add_item(acdr_tree, hf_acdr_pl_offset_type, tvb, offset, 1, ENC_BIG_ENDIAN);
    } else {
        // Header Extension Length
        proto_tree_add_item_ret_uint(acdr_tree, hf_acdr_header_ext_len_type, tvb, offset, 1,
                                     ENC_BIG_ENDIAN, &header_extension_len);
    }
    offset++;

    // calculate the header length
    acdr_header_length = header_byte_length + header_extension_len;
    if (medium_mii)
        acdr_header_length += MII_HEADER_BYTE_LENGTH;

    if ((version & 0xF) >= 5) {
        if ((version & 0xF) < 7) {
            // Simple SessionID (not include BoardID)
            proto_tree_add_item(acdr_tree, hf_acdr_session_id_session_number, tvb,
                                offset, 4, ENC_BIG_ENDIAN);
        } else {
            // Full SessionID (include also BoardID)
            create_full_session_id_subtree(acdr_tree, tvb, offset, version);
        }
    }

    proto_item_set_len(header_ti, acdr_header_length);
    if (header_added) {
        p_add_proto_data(pinfo->pool, pinfo, proto_acdr, 0, GUINT_TO_POINTER(media_type));
        if (media_type == ACDR_VoiceAI)
            proto_name = "VoiceAI";
        else if (media_type == ACDR_DTLS)
            proto_name = "DTLS data";
    }

    // Header extension
    if (header_extension_len > 0) {
        switch (media_type) {
        case ACDR_T38:
            if (header_added) {
                // Gen3 only: we put the UDP header in the last 8 bytes of the header extension.
                // So, we have only IP address into the real header extension
                if (header_extension_len == 12)
                    header_extension_len = 4;
            }
            break;

        case ACDR_RTP_AMR:
        case ACDR_RTP_EVRC:
        case ACDR_RTP_RFC2198:
        case ACDR_RTP_RFC2833:
        case ACDR_RTP_FEC:
            payload_type = (tvb_get_guint8(tvb, acdr_header_length + 1) & 0x7F);
            break;
        }

        create_header_extension_subtree(acdr_tree, tvb, header_byte_length, header_extension_len,
                                        version, media_type, trace_point, extra_data, &tls_packet_info);
    }

    if (medium_mii)
        create_mii_header_subtree(acdr_tree, tvb, header_byte_length + header_extension_len, media_type);

    // create a new tvbuff for the next dissector
    next_tvb = tvb_new_subset_remaining(tvb, header_byte_length + header_extension_len);

    if ((trace_point == DspIncoming) || (trace_point == DspOutgoing)) {
        // Gen5 only - special case of recorded packets from DSP
        create_5x_analysis_packet_header_subtree(tree, next_tvb);

        next_tvb = tvb_new_subset_remaining(tvb, header_byte_length + header_extension_len +
                                            AC5X_ANALYSIS_PACKET_HEADER);
        create_5x_hpi_packet_header_subtree(tree, next_tvb);

        next_tvb = tvb_new_subset_remaining(tvb, header_byte_length + header_extension_len +
                                            AC5X_ANALYSIS_PACKET_HEADER + AC5X_HPI_PACKET_HEADER);
    }

    acdr_dissector_data_t data;

    data.header_added = header_added;
    data.version = version;
    data.tls_source_port = tls_packet_info.source_port;
    data.tls_dest_port = tls_packet_info.dest_port;
    data.tls_application = tls_packet_info.application;
    data.media_type = media_type;
    data.payload_type = payload_type;
    data.trace_point = trace_point;
    data.medium_mii = medium_mii;
    data.li_packet = li_packet;
    acdr_payload_handler(tree, pinfo, next_tvb, &data, proto_name);
}

static int
dissect_acdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    pinfo->current_proto = "acdr";

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "AC DR");
    col_add_fstr(pinfo->cinfo, COL_INFO, "AC DEBUG Packet");

    create_acdr_tree(tree, pinfo, tvb);

    return tvb_captured_length(tvb);
}

static int
dissect_acdr_voiceai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
	/*
	 * I guess this is just a blob of JSON.
	 *
	 * Do *NOT* pass data to the JSON dissector; it's expecting
	 * an http_message_info_t *, and that's *NOT* what we hand
	 * subdissectors.  Hilarity ensures; see
	 *
	 *    https://gitlab.com/wireshark/wireshark/-/issues/16622
	 */
	call_dissector(json_dissector_handle, tvb, pinfo, tree);
	return tvb_captured_length(tvb);
}

static int
dissect_acdr_tls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;
    int dissected;

    if (acdr_data == NULL)
        return 0;

    if (acdr_data->tls_application == TLS_APP_TCP) {
        dissected = dissector_try_uint(tls_application_port_table, acdr_data->tls_source_port, tvb,
                                       pinfo, tree);
        if (dissected != 0)
            return dissected;

        dissected = dissector_try_uint(tls_application_port_table, acdr_data->tls_dest_port, tvb,
                                       pinfo, tree);
        if (dissected != 0)
            return dissected;
    } else {
        dissected = dissector_try_uint(tls_application_table, acdr_data->tls_application, tvb,
                                       pinfo, tree);
        if (dissected != 0)
            return dissected;
    }

    //dissector wasn't found
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "TLS");
    col_clear(pinfo->cinfo, COL_INFO);
    col_add_fstr(pinfo->cinfo, COL_INFO, "TLS raw data");
    call_data_dissector(tvb, pinfo, tree);

    return tvb_captured_length(tvb);
}

static int
dissect_acdr_ip_or_other(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data,
                         dissector_handle_t other_dissector_handle)
{
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;

    if (acdr_data == NULL)
        return 0;

    if (acdr_data->header_added && ip_dissector_handle) {
        call_dissector(ip_dissector_handle, tvb, pinfo, tree);
    } else if (other_dissector_handle) {
        call_dissector(other_dissector_handle, tvb, pinfo, tree);
    } else {
        call_data_dissector(tvb, pinfo, tree);
    }

    return tvb_captured_length(tvb);
}

static int
dissect_acdr_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    return dissect_acdr_ip_or_other(tvb, pinfo, tree, data, sip_dissector_handle);
}

static int
dissect_acdr_megaco(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    return dissect_acdr_ip_or_other(tvb, pinfo, tree, data, megaco_dissector_handle);
}

static int
dissect_acdr_mgcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    return dissect_acdr_ip_or_other(tvb, pinfo, tree, data, mgcp_dissector_handle);
}

static int
dissect_acdr_rtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;

    if (acdr_data == NULL)
        return 0;

    dissect_rtp_packet(tvb, pinfo, tree, acdr_data->media_type, acdr_data->payload_type);

    return tvb_captured_length(tvb);
}

static int
dissect_acdr_rtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;

    if (acdr_data == NULL)
        return 0;

    int bytes_dissected = 0;
    if ((tvb_get_guint8(tvb, 0) & 0xC0) == 0) {
        // RTCP Version = 0
        if (tvb_get_ntohl(tvb, 4) == 0x2112a442) {
            // This is STUN RFC 5389 packet
            if (udp_stun_dissector_handle) {
                bytes_dissected = call_dissector(udp_stun_dissector_handle, tvb, pinfo, tree);
                if (bytes_dissected > 0)
                    return bytes_dissected;
            }
        }
    }

    if (rtcp_dissector_handle)
        return call_dissector(rtcp_dissector_handle, tvb, pinfo, tree);

    return tvb_captured_length(tvb);
}

static int
dissect_acdr_video_rtcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    int res = dissect_acdr_rtcp(tvb, pinfo, tree, data);

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTCP Video");
    return res;
}

static int
dissect_acdr_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
    const char *name;
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;
    if (acdr_data == NULL)
        return 0;

    name = val_to_str_const(acdr_data->media_type, acdr_media_type_vals, "Unknown");
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACDR");
    col_set_str(pinfo->cinfo, COL_INFO, name);

    return call_dissector(xml_dissector_handle, tvb, pinfo, tree);
}

void
proto_register_acdr(void)
{
    static hf_register_info hf[] = {
        { &hf_acdr_unknown_packet,
            { "Unknown packet Type", "acdr.unknown_packet",
                FT_NONE, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_timestamp,
            { "Time Stamp", "acdr.timestamp",
                FT_RELATIVE_TIME, BASE_NONE,
                NULL, 0x0,
                "timestamp in us resolution", HFILL }
        },
        { &hf_acdr_seq_num,
            { "Sequence Number", "acdr.seq",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_sourceid,
            { "Source ID", "acdr.src_id",
                FT_INT32, BASE_DEC,
                NULL, 0x0,
                "source EP ID (CID)", HFILL }
        },
        { &hf_acdr_destid,
            { "Dest ID", "acdr.dst_id",
                FT_INT32, BASE_DEC,
                NULL, 0x0,
                "dest EP ID (CID)", HFILL }
        },
        { &hf_acdr_version,
            { "Version", "acdr.ver",
                FT_UINT8, BASE_HEX,
                NULL, 0x0,
                "DR Protocol version (Major.Minor)", HFILL }
        },
        { &hf_acdr_trace_pt,
            { "Trace Point", "acdr.trace_pt",
                FT_UINT8, BASE_DEC,
                VALS(acdr_trace_pt_vals), 0x0,
                "AC Debug trace point", HFILL }
        },
        { &hf_acdr_media_type,
            { "Media Type", "acdr.media_type",
                FT_UINT8, BASE_DEC,
                VALS(acdr_media_type_vals), 0x0,
                "AC Debug layer 2 packet type", HFILL }
        },
        { &hf_acdr_media_type_dsp_ac5x,
            { "Media Type", "acdr.media_type",
                FT_UINT8, BASE_DEC,
                VALS(acdr_media_type_dummy_vals), 0x0,
                "AC Debug layer 2 packet type", HFILL }
        },
        { &hf_acdr_pl_offset_type,
            { "Payload offset", "acdr.payload_offset",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                "Offset to packet Payload", HFILL }
        },
        { &hf_acdr_header_ext_len_type,
            { "Header Extension Len", "acdr.header_ext_len",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                "Header extension length", HFILL }
        },
        { &hf_acdr_data,
            { "Extra Data", "acdr.extra_data",
                FT_UINT8, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_data_li,
            { "LI", "acdr.extra_data.li",
                FT_UINT8, BASE_HEX,
                NULL, LI_MASK,
                "Packet LI (with X2 or X3 header)", HFILL }
        },
        { &hf_acdr_data_mtce,
            { "Mtce", "acdr.extra_data.mtce",
                FT_UINT8, BASE_HEX,
                NULL, MTCE_MASK,
                "Packet of Mtce", HFILL }
        },
        { &hf_acdr_data_encrypted,
            { "Encrypted", "acdr.extra_data.encrypted",
                FT_UINT8, BASE_HEX,
                NULL, ENCRYPTED_MASK,
                "Packet is Encrypted", HFILL }
        },
        { &hf_acdr_data_headeradded,
            { "header_added", "acdr.extra_data.headeradded",
                FT_UINT8, BASE_HEX,
                NULL, HEADERADDED_MASK,
                "Header Added", HFILL }
        },
        { &hf_acdr_data_fragmented,
            { "Fragmented", "acdr.extra_data.fragmented",
                FT_UINT8, BASE_HEX,
                NULL, FRAGMENTED_MASK,
                "Fragmented Data", HFILL }
        },
        { &hf_acdr_data_ipv6,
            { "IPV6", "acdr.extra_data.ipv6",
                FT_UINT8, BASE_HEX,
                NULL, IPV6_MASK,
                NULL, HFILL }
        },
        { &hf_acdr_data_mii,
            { "MII", "acdr.extra_data.mii",
                FT_UINT8, BASE_HEX,
                NULL, MEDIUM_MASK,
                NULL, HFILL }
        },
        { &hf_acdr_session_id,
            { "Full Session ID", "acdr.full_session_id",
                FT_STRING, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_session_id_board_id,
            { "Board ID", "acdr.board_id",
                FT_UINT24, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_session_id_reset_counter,
            { "Reset Counter", "acdr.reset_counter",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_session_id_session_number,
            { "Session ID", "acdr.session_id",
                FT_UINT32, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_session_id_long_session_number,
            { "Session ID", "acdr.long_session_id",
                FT_UINT40, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_payload_header,
            { "Payload Header", "acdr.payload_header",
                FT_BYTES, BASE_NONE,
                NULL, 0x0,
                "Payload header bytes", HFILL }
        },
        { &hf_acdr_ext_srcudp,
            { "Packet source UDP port", "acdr.ext.src_port",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_dstudp,
            { "Packet destination UDP port", "acdr.ext.dst_port",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_srcip,
            { "Packet source IP address", "acdr.ext.src_ip",
                FT_IPv4, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_srcipv6,
            { "Packet source IPv6 address", "acdr.ext.src_ip_v6",
                FT_IPv6, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        {
            &hf_acdr_ext_dstip,
            { "Packet destination IP address", "acdr.ext.dst_ip",
                FT_IPv4, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_dstipv6,
            { "Packet destination IPv6 address", "acdr.ext.dst_ip_v6",
                FT_IPv6, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_protocol,
            { "IP protocol type", "acdr.ext.protocol",
                FT_UINT8, BASE_DEC | BASE_EXT_STRING,
                &ipproto_val_ext, 0x0,
                "IP protocol type (as defined by IANA)", HFILL }
        },
        { &hf_acdr_ext_tls_application,
            { "TLS Application", "acdr.ext.application",
                FT_UINT8, BASE_DEC,
                VALS(hf_acdr_ext_tls_application_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_direction,
            { "Packet Direction", "acdr.ext.direction",
                FT_UINT8, BASE_DEC,
                VALS(hf_acdr_ext_direction_vals), 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_iptos,
            { "IP type of service", "acdr.ext.iptos",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                "IP Type Of Service (IP TOS)", HFILL }
        },
        { &hf_acdr_ext_c5_control_flags,
            { "C5 Control Flags", "acdr.c5_control_flags",
                FT_UINT8, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_c5_control_favorite,
            { "Favorite flag", "acdr.c5_control.favorite",
                FT_UINT8, BASE_HEX,
                NULL, FAVORITE_MASK,
                NULL, HFILL }
        },
        { &hf_acdr_ext_pstn_trace_seq_num,
            { "PSTN Trace Seq Num", "acdr.ext.pstn_trace_seq_num",
                FT_UINT32, BASE_DEC,
                NULL, 0x0,
                "acdr.ext.pstn_trace_seq_num", HFILL }
        },
        { &hf_acdr_header_extension,
            { "Header Extension", "acdr.ext.header_extension",
                FT_NONE, BASE_NONE,
                NULL, 0x0,
                "acdr.ext.header_extension", HFILL }
        },
        { &hf_acdr_ext_dsp_core,
            { "DSP Core", "acdr.ext.dsp_core",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                "DSP core number", HFILL }
        },
        { &hf_acdr_ext_dsp_channel,
            { "DSP Channel", "acdr.ext.dsp_ch",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                "DSP Channel number", HFILL }
        },
        { &hf_acdr_ext_event_id,
            { "Event ID", "acdr.ext.event_id",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_ext_event_source,
            { "Event source module", "acdr.ext.event_src",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_mii_header,
            { "MII Header", "acdr.mii_header",
                FT_NONE, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_mii_sequence,
            { "MII sequence number", "acdr.mii_sequence_num",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_mii_packet_size,
            { "MII packet size", "acdr.mii_packet_size",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_5x_analysis_packet_header,
            { "5x Analysis Packet Header", "acdr.5x_analysis_packet_header",
                FT_NONE, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_5x_analysis_version,
            { "Version", "acdr.analysis_version",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                "5x Analysis Version", HFILL }
        },
        { &hf_5x_analysis_direction,
            { "Direction", "acdr.analysis_direction",
                FT_UINT8, BASE_HEX,
                NULL, 0x80,
                "5x Analysis Direction", HFILL }
        },
        { &hf_5x_analysis_sub_version,
            { "SubVersion", "acdr.analysis_subversion",
                FT_UINT8, BASE_DEC,
                NULL, 0x7F,
                "5x Analysis SubVersion", HFILL }
        },
        { &hf_5x_analysis_device,
            { "Device", "acdr.analysis_device",
                FT_UINT8, BASE_DEC,
                NULL, 0x0,
                "5x Analysis Device", HFILL }
        },
        { &hf_5x_analysis_sequence,
            { "Sequence", "acdr.analysis_sequence",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                "5x Analysis Sequence", HFILL }
        },
        { &hf_5x_analysis_spare1,
            { "Spare1", "acdr.analysis_spare1",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                "5x Analysis spare1", HFILL }
        },
        { &hf_5x_analysis_timestamp,
            { "Timestamp", "acdr.analysis_timestamp",
                FT_UINT32, BASE_DEC,
                NULL, 0x0,
                "5x Analysis Timestamp", HFILL }
        },
        { &hf_5x_analysis_spare2,
            { "Spare2", "acdr.analysis_spare2",
                FT_UINT32, BASE_DEC,
                NULL, 0x0,
                "5x Analysis Spare2", HFILL }
        },
        { &hf_acdr_5x_hpi_packet_header,
            { "5x HPI Packet Header", "acdr.5x_hpi_packet_header",
                FT_NONE, BASE_NONE,
                NULL, 0x0,
                "acdr.5x_hpi_packet_header", HFILL }
        },
        { &hf_5x_hpi_sync5,
            { "Sync5", "acdr.5x.HpiHeader.Sync5",
                FT_UINT8, BASE_HEX,
                NULL, 0xE0,
                "DSP Sync const 0x5", HFILL }
        },
        { &hf_5x_hpi_udp_checksum,
            { "UDP Checksum Included", "acdr.5x.HpiHeader.UdpChecksum",
                FT_UINT8, BASE_HEX,
                NULL, 0x10,
                "5x HpiHeader UdpChecksum", HFILL }
        },
        { &hf_5x_hpi_resource_id,
            { "Resource ID", "acdr.5x.HpiHeader.ResourceId",
                FT_UINT8, BASE_DEC,
                NULL, 0xFF,
                "Resource ID into core", HFILL }
        },
        { &hf_5x_hpi_favorite,
            { "Favorite Stream", "acdr.5x.HpiHeader.Favorite",
                FT_UINT8, BASE_DEC,
                NULL, 0x80,
                NULL, HFILL }
        },
        { &hf_5x_hpi_protocol,
            { "Protocol", "acdr.5x.HpiHeader.Protocol",
                FT_UINT8, BASE_DEC,
                NULL, 0x3F,
                "Protocol Proprietary", HFILL }
        },
        { &hf_signaling_packet,
            { "Signaling Packet", "acdr.signaling_packet",
                FT_NONE, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_ac45x_packet,
            { "45x DSP packet", "acdr.45x_dsp_packet",
                FT_NONE, BASE_NONE,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_ac48x_packet,
          { "48x DSP packet", "acdr.48x_dsp_packet",
            FT_NONE, BASE_NONE,
            NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_ac49x_packet,
          { "49x DSP packet", "acdr.49x_dsp_packet",
            FT_NONE, BASE_NONE,
            NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_ac5x_packet,
          { "5x DSP packet", "acdr.5x_dsp_packet",
            FT_NONE, BASE_NONE,
            NULL, 0x0,
            NULL, HFILL }
        },
        { &hf_acdr_signaling_opcode,
            { "OpCode", "acdr.signaling_opcode",
                FT_UINT16, BASE_HEX,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_signaling_size,
            { "Size", "acdr.signaling_size",
                FT_UINT16, BASE_DEC,
                NULL, 0x0,
                NULL, HFILL }
        },
        { &hf_acdr_signaling_timestamp,
            { "Timestamp", "acdr.signaling_timestamp",
                FT_RELATIVE_TIME, BASE_NONE,
                NULL, 0x0,
                "Timestamp in us resolution", HFILL }
        }
    };

    static gint *ett[] = {
        &ett_acdr,
        &ett_extension,
        &ett_ac45x_packet,
        &ett_ac48x_packet,
        &ett_ac49x_packet,
        &ett_ac5x_packet,
        &ett_ac5x_mii_packet,
        &ett_mii_header,
        &ett_signaling_packet,
        &ett_extra_data,
        &ett_c5_cntrl_flags,
        &ett_5x_analysis_packet_header,
        &ett_5x_hpi_packet_header,
        &ett_session_id
    };

    static ei_register_info ei[] = {
        { &ei_acdr_version_not_supported, { "acdr.version_not_supported", PI_UNDECODED, PI_WARN, "Version not supported", EXPFILL } },
    };

    expert_module_t *expert_acdr;

    proto_acdr = proto_register_protocol("AUDIOCODES DEBUG RECORDING", "AC DR", "acdr");
    proto_register_field_array(proto_acdr, hf, array_length(hf));
    proto_register_subtree_array(ett, array_length(ett));

    expert_acdr = expert_register_protocol(proto_acdr);
    expert_register_field_array(expert_acdr, ei, array_length(ei));

    media_type_table = register_dissector_table("acdr.media_type", "AC DR Media Type", proto_acdr,
                                                FT_UINT32, BASE_HEX);
    tls_application_table = register_dissector_table("acdr.tls_application",
                                                     "AC DR TLS Application Type", proto_acdr,
                                                     FT_UINT32, BASE_HEX);

    //For backwards compatibility
    tls_application_port_table = register_dissector_table("acdr.tls_application_port",
                                                          "AC DR TLS Application Port", proto_acdr,
                                                          FT_UINT32, BASE_HEX);
}

static int
dissect_acdr_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data,
                 int hf, int ett, const char *name, dissector_handle_t dissector)
{
    guint packet_direction;
    proto_item *packet_item;
    proto_tree *packet_tree;
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;

    if (!dissector)
        return call_data_dissector(tvb, pinfo, parent_tree);
    packet_item = proto_tree_add_item(parent_tree, hf, tvb, 0, -1, ENC_NA);
    packet_tree = proto_item_add_subtree(packet_item, ett);

    col_clear(pinfo->cinfo, COL_INFO);

    col_set_str(pinfo->cinfo, COL_PROTOCOL, name);

    if (acdr_data->trace_point == Dsp2Host)
        packet_direction = DIR_RX;
    else
        packet_direction = DIR_TX;

    return call_dissector_with_data(dissector, tvb, pinfo, packet_tree, &packet_direction);
}

static int
dissect_acdr_ac45x(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data)
{
    return dissect_acdr_dsp(tvb, pinfo, parent_tree, data, hf_ac45x_packet, ett_ac45x_packet,
                            "AC45X", dsp_45x_dissector_handle);
}

static int
dissect_acdr_ac48x(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data)
{
    return dissect_acdr_dsp(tvb, pinfo, parent_tree, data, hf_ac48x_packet, ett_ac48x_packet,
                            "AC48X", dsp_48x_dissector_handle);
}

static int
dissect_acdr_ac49x(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data)
{
    return dissect_acdr_dsp(tvb, pinfo, parent_tree, data, hf_ac49x_packet, ett_ac49x_packet,
                            "AC49X", dsp_49x_dissector_handle);
}

static int
dissect_acdr_ac5x(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data)
{
    return dissect_acdr_dsp(tvb, pinfo, parent_tree, data, hf_ac5x_packet, ett_ac5x_packet,
                            "AC5X", dsp_5x_dissector_handle);
}

static int
dissect_acdr_mii(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    proto_item *packet_item = NULL;
    proto_item *packet_tree = NULL;
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;
    struct AcdrAc5xPrivateData private_data;

    if (!dsp_5x_MII_dissector_handle)
        return call_data_dissector(tvb, pinfo, packet_tree);

    if (acdr_data->media_type == ACDR_DSP_TDM_PLAYBACK) {
        private_data.protocol_type = ACDR_AC5X_PROTOCOL_TYPE__TDM_PLAYBACK;
        private_data.mii_header_exist = 1;
    } else if (acdr_data->media_type == ACDR_DSP_NET_PLAYBACK) {
        private_data.protocol_type = ACDR_AC5X_PROTOCOL_TYPE__NET_PLAYBACK;
        private_data.mii_header_exist = 1;
    } else {
        private_data.protocol_type = ACDR_AC5X_PROTOCOL_TYPE__REGULAR;
        private_data.mii_header_exist = acdr_data->medium_mii;
    }

    packet_item = proto_tree_add_item(tree, proto_ac5xmii, tvb, 0, -1, FALSE);
    packet_tree = proto_item_add_subtree(packet_item, ett_ac5x_mii_packet);

    col_clear(pinfo->cinfo, COL_INFO);
    if (acdr_data->media_type == ACDR_DSP_AC5X_MII) {
        if (acdr_data->medium_mii)
            col_set_str(pinfo->cinfo, COL_PROTOCOL, "AC5x_MII");
        else
            col_set_str(pinfo->cinfo, COL_PROTOCOL, "AC5x");
    } else {
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "AC5x_MII");
    }

    if ((acdr_data->trace_point == Dsp2Host) || (acdr_data->trace_point == DspOutgoing))
        private_data.packet_direction = DIR_RX;
    else
        private_data.packet_direction = DIR_TX;

    return call_dissector_with_data(dsp_5x_MII_dissector_handle, tvb, pinfo, packet_tree, &private_data);
}

static int
dissect_acdr_v1501(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "V150.1");
    return call_data_dissector(tvb, pinfo, tree);
}

static int
dissect_acdr_signaling(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    acdr_dissector_data_t *acdr_data = (acdr_dissector_data_t *) data;
    proto_item *packet_item = proto_tree_add_item(tree, hf_signaling_packet, tvb, 0, -1, ENC_NA);
    proto_tree *packet_tree = proto_item_add_subtree(packet_item, ett_signaling_packet);

    int res = dissect_signaling_packet(tvb, pinfo, packet_tree, acdr_data->trace_point);

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "Signaling");
    col_clear(pinfo->cinfo, COL_INFO);
    switch (acdr_data->trace_point) {
    case Host2Pstn:
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "HOST --> PSTN");
        break;
    case Pstn2Host:
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "PSTN --> HOST");
        break;
    case DspIncoming:
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "DSP Incoming:  HOST --> PSTN");
        break;
    case DspOutgoing:
        col_prepend_fstr(pinfo->cinfo, COL_INFO, "DSP Outgoing:  PSTN --> HOST");
        break;
    }
    return res;
}

static int
dissect_acdr_fragmented(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "Fragmented");
    col_set_str(pinfo->cinfo, COL_INFO, "fragment of previous ACDR packet");
    return call_data_dissector(tvb, pinfo, tree);
}

static int
dissect_acdr_dsp_data_relay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "DSP Data Relay");
    return call_data_dissector(tvb, pinfo, tree);
}

void
proto_reg_handoff_acdr(void)
{
    dissector_handle_t acdr_mii_dissector_handle;
    dissector_handle_t acdr_rtp_dissector_handle;
    dissector_handle_t acdr_xml_dissector_handle;

    acdr_dissector_handle = create_dissector_handle(dissect_acdr, proto_acdr);

    register_dissector("acdr", dissect_acdr, proto_acdr);

    rtp_dissector_handle = find_dissector("rtp");
    rtp_dissector_table = find_dissector_table("rtp.pt");
    rtp_events_handle = find_dissector("rtpevent");
    rtp_rfc2198_handle = find_dissector("rtp.rfc2198");
    amr_handle = find_dissector("amr");
    evrc_handle = find_dissector("EVRC");
    ip_dissector_handle = find_dissector("ip");
    rtcp_dissector_handle = find_dissector("rtcp");
    json_dissector_handle = find_dissector("json");
    megaco_dissector_handle = find_dissector("megaco");

    mgcp_dissector_handle = find_dissector("mgcp");
    sip_dissector_handle = find_dissector("sip");
    udp_dissector_handle = find_dissector("udp");
    lix2x3_dissector_handle = find_dissector("lix2x3");

    dsp_49x_dissector_handle = find_dissector("ac49x");
    proto_ac49x = proto_get_id_by_filter_name("ac49x");
    dsp_48x_dissector_handle = find_dissector("ac48x");
    proto_ac48x = proto_get_id_by_filter_name("ac48x");
    dsp_45x_dissector_handle = find_dissector("AC45x");
    dsp_5x_dissector_handle = find_dissector("ac5x");
    proto_ac5x = proto_get_id_by_filter_name("ac5x");
    dsp_5x_MII_dissector_handle = find_dissector("ac5xmii");
    proto_ac5xmii = proto_get_id_by_filter_name("ac5xmii");

    proto_rtp = proto_get_id_by_filter_name("rtp");

    udp_stun_dissector_handle = find_dissector("stun-udp");
    xml_dissector_handle = find_dissector("xml");

    acdr_mii_dissector_handle = create_dissector_handle(dissect_acdr_mii, proto_acdr);
    acdr_rtp_dissector_handle = create_dissector_handle(dissect_acdr_rtp, proto_acdr);
    acdr_xml_dissector_handle = create_dissector_handle(dissect_acdr_xml, proto_acdr);

    // register our port number to the underlying TCP/UDP layers so our
    // dissector gets called for the appropriate port
    dissector_add_uint_with_preference("udp.port", PORT_AC_DR, acdr_dissector_handle);
    dissector_add_uint_with_preference("tcp.port", PORT_AC_DR, acdr_dissector_handle);

    // Register "local" media types
    dissector_add_uint("acdr.media_type", ACDR_VoiceAI, create_dissector_handle(dissect_acdr_voiceai, -1));
    dissector_add_uint("acdr.media_type", ACDR_TLS, create_dissector_handle(dissect_acdr_tls, -1));
    dissector_add_uint("acdr.media_type", ACDR_TLSPeek, create_dissector_handle(dissect_acdr_tls, -1));
    dissector_add_uint("acdr.media_type", ACDR_SIP, create_dissector_handle(dissect_acdr_sip, -1));
    dissector_add_uint("acdr.media_type", ACDR_MEGACO, create_dissector_handle(dissect_acdr_megaco, -1));
    dissector_add_uint("acdr.media_type", ACDR_MGCP, create_dissector_handle(dissect_acdr_mgcp, -1));

    dissector_add_uint("acdr.media_type", ACDR_RTP, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_AMR, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_EVRC, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_RFC2198, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_RFC2833, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_T38_OVER_RTP, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_FEC, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_FAX_BYPASS, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_MODEM_BYPASS, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_NSE, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTP_NO_OP, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_PCM, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_NATIVE, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_VIDEORTP, acdr_rtp_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_RTCP, create_dissector_handle(dissect_acdr_rtcp, -1));
    dissector_add_uint("acdr.media_type", ACDR_VIDEORTCP, create_dissector_handle(dissect_acdr_video_rtcp, -1));
    dissector_add_uint("acdr.media_type", ACDR_DSP_AC45X, create_dissector_handle(dissect_acdr_ac45x, proto_acdr));
    dissector_add_uint("acdr.media_type", ACDR_DSP_AC48X, create_dissector_handle(dissect_acdr_ac48x, proto_acdr));
    dissector_add_uint("acdr.media_type", ACDR_DSP_AC49X, create_dissector_handle(dissect_acdr_ac49x, proto_acdr));
    dissector_add_uint("acdr.media_type", ACDR_DSP_AC5X, create_dissector_handle(dissect_acdr_ac5x, proto_acdr));
    dissector_add_uint("acdr.media_type", ACDR_DSP_AC5X_MII, acdr_mii_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_DSP_TDM_PLAYBACK, acdr_mii_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_DSP_NET_PLAYBACK, acdr_mii_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_V1501, create_dissector_handle(dissect_acdr_v1501, -1));
    dissector_add_uint("acdr.media_type", ACDR_SIGNALING, create_dissector_handle(dissect_acdr_signaling, -1));
    dissector_add_uint("acdr.media_type", ACDR_FRAGMENTED, create_dissector_handle(dissect_acdr_fragmented, -1));
    dissector_add_uint("acdr.media_type", ACDR_DSP_DATA_RELAY,
                       create_dissector_handle(dissect_acdr_dsp_data_relay, -1));
    dissector_add_uint("acdr.media_type", ACDR_QOE_CDR, acdr_xml_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_QOE_MDR, acdr_xml_dissector_handle);
    dissector_add_uint("acdr.media_type", ACDR_QOE_EVENT, acdr_xml_dissector_handle);
}

/*
 * 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:
 */