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
|
/* Routines for LTE RLC disassembly
*
* Martin Mathieson
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include <stdio.h>
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/prefs.h>
#include <epan/tap.h>
#include "packet-mac-lte.h"
#include "packet-rlc-lte.h"
#include "packet-pdcp-lte.h"
/* Described in:
* 3GPP TS 36.322 Evolved Universal Terrestial Radio Access (E-UTRA)
* Radio Link Control (RLC) Protocol specification
*/
/* TODO:
- AM re-assembly?
*/
/********************************/
/* Preference settings */
#define SEQUENCE_ANALYSIS_MAC_ONLY 1
#define SEQUENCE_ANALYSIS_RLC_ONLY 2
/* By default don't try to analyse the sequence of messages for AM/UM channels */
static gint global_rlc_lte_am_sequence_analysis = FALSE;
static gint global_rlc_lte_um_sequence_analysis = FALSE;
/* By default don't call PDCP/RRC dissectors for SDU data */
static gboolean global_rlc_lte_call_pdcp = FALSE;
static gboolean global_rlc_lte_call_rrc = FALSE;
/* Preference to expect RLC headers without payloads */
static gboolean global_rlc_lte_headers_expected = FALSE;
/* Heuristic dissection */
static gboolean global_rlc_lte_heur = FALSE;
/**************************************************/
/* Initialize the protocol and registered fields. */
int proto_rlc_lte = -1;
extern int proto_mac_lte;
extern int proto_pdcp_lte;
static int rlc_lte_tap = -1;
/* Decoding context */
static int hf_rlc_lte_context_mode = -1;
static int hf_rlc_lte_context_direction = -1;
static int hf_rlc_lte_context_priority = -1;
static int hf_rlc_lte_context_ueid = -1;
static int hf_rlc_lte_context_channel_type = -1;
static int hf_rlc_lte_context_channel_id = -1;
static int hf_rlc_lte_context_pdu_length = -1;
static int hf_rlc_lte_context_um_sn_length = -1;
/* Transparent mode fields */
static int hf_rlc_lte_tm_data = -1;
/* Unacknowledged mode fields */
static int hf_rlc_lte_um_header = -1;
static int hf_rlc_lte_um_fi = -1;
static int hf_rlc_lte_um_fixed_e = -1;
static int hf_rlc_lte_um_sn = -1;
static int hf_rlc_lte_um_fixed_reserved = -1;
static int hf_rlc_lte_um_data = -1;
static int hf_rlc_lte_extension_part = -1;
/* Extended header (common to UM and AM) */
static int hf_rlc_lte_extension_e = -1;
static int hf_rlc_lte_extension_li = -1;
static int hf_rlc_lte_extension_padding = -1;
/* Acknowledged mode fields */
static int hf_rlc_lte_am_header = -1;
static int hf_rlc_lte_am_data_control = -1;
static int hf_rlc_lte_am_rf = -1;
static int hf_rlc_lte_am_p = -1;
static int hf_rlc_lte_am_fi = -1;
static int hf_rlc_lte_am_fixed_e = -1;
static int hf_rlc_lte_am_fixed_sn = -1;
static int hf_rlc_lte_am_segment_lsf = -1;
static int hf_rlc_lte_am_segment_so = -1;
static int hf_rlc_lte_am_data = -1;
/* Control fields */
static int hf_rlc_lte_am_cpt = -1;
static int hf_rlc_lte_am_ack_sn = -1;
static int hf_rlc_lte_am_e1 = -1;
static int hf_rlc_lte_am_e2 = -1;
static int hf_rlc_lte_am_nack_sn = -1;
static int hf_rlc_lte_am_so_start = -1;
static int hf_rlc_lte_am_so_end = -1;
static int hf_rlc_lte_predefined_pdu = -1;
static int hf_rlc_lte_header_only = -1;
/* Sequence Analysis */
static int hf_rlc_lte_sequence_analysis = -1;
static int hf_rlc_lte_sequence_analysis_ok = -1;
static int hf_rlc_lte_sequence_analysis_previous_frame = -1;
static int hf_rlc_lte_sequence_analysis_expected_sn = -1;
static int hf_rlc_lte_sequence_analysis_framing_info_correct = -1;
static int hf_rlc_lte_sequence_analysis_mac_retx = -1;
static int hf_rlc_lte_sequence_analysis_retx = -1;
static int hf_rlc_lte_sequence_analysis_repeated = -1;
static int hf_rlc_lte_sequence_analysis_skipped = -1;
static int hf_rlc_lte_sequence_analysis_repeated_nack = -1;
/* Subtrees. */
static int ett_rlc_lte = -1;
static int ett_rlc_lte_um_header = -1;
static int ett_rlc_lte_am_header = -1;
static int ett_rlc_lte_extension_part = -1;
static int ett_rlc_lte_sequence_analysis = -1;
/* Value-strings */
static const value_string direction_vals[] =
{
{ DIRECTION_UPLINK, "Uplink"},
{ DIRECTION_DOWNLINK, "Downlink"},
{ 0, NULL }
};
static const value_string rlc_mode_short_vals[] =
{
{ RLC_TM_MODE, "TM"},
{ RLC_UM_MODE, "UM"},
{ RLC_AM_MODE, "AM"},
{ RLC_PREDEF, "PREDEFINED"},
{ 0, NULL }
};
static const value_string rlc_mode_vals[] =
{
{ RLC_TM_MODE, "Transparent Mode"},
{ RLC_UM_MODE, "Unacknowledged Mode"},
{ RLC_AM_MODE, "Acknowledged Mode"},
{ 0, NULL }
};
static const value_string rlc_channel_type_vals[] =
{
{ CHANNEL_TYPE_CCCH, "CCCH"},
{ CHANNEL_TYPE_BCCH, "BCCH"},
{ CHANNEL_TYPE_PCCH, "PCCH"},
{ CHANNEL_TYPE_SRB, "SRB"},
{ CHANNEL_TYPE_DRB, "DRB"},
{ 0, NULL }
};
static const value_string framing_info_vals[] =
{
{ 0, "First byte begins a RLC SDU and last byte ends a RLC SDU"},
{ 1, "First byte begins a RLC SDU and last byte does not end a RLC SDU"},
{ 2, "First byte does not begin a RLC SDU and last byte ends a RLC SDU"},
{ 3, "First byte does not begin a RLC SDU and last byte does not end a RLC SDU"},
{ 0, NULL }
};
static const value_string fixed_extension_vals[] =
{
{ 0, "Data field follows from the octet following the fixed part of the header"},
{ 1, "A set of E field and LI field follows from the octet following the fixed part of the header"},
{ 0, NULL }
};
static const value_string extension_extension_vals[] =
{
{ 0, "Data field follows from the octet following the LI field following this E field"},
{ 1, "A set of E field and LI field follows from the bit following the LI field following this E field"},
{ 0, NULL }
};
static const value_string data_or_control_vals[] =
{
{ 0, "Control PDU"},
{ 1, "Data PDU"},
{ 0, NULL }
};
static const value_string resegmentation_flag_vals[] =
{
{ 0, "AMD PDU"},
{ 1, "AMD PDU segment"},
{ 0, NULL }
};
static const value_string polling_bit_vals[] =
{
{ 0, "Status report not requested"},
{ 1, "Status report is requested"},
{ 0, NULL }
};
static const value_string lsf_vals[] =
{
{ 0, "Last byte of the AMD PDU segment does not correspond to the last byte of an AMD PDU"},
{ 1, "Last byte of the AMD PDU segment corresponds to the last byte of an AMD PDU"},
{ 0, NULL }
};
static const value_string control_pdu_type_vals[] =
{
{ 0, "STATUS PDU"},
{ 0, NULL }
};
static const value_string am_e1_vals[] =
{
{ 0, "A set of NACK_SN, E1 and E2 does not follow"},
{ 1, "A set of NACK_SN, E1 and E2 follows"},
{ 0, NULL }
};
static const value_string am_e2_vals[] =
{
{ 0, "A set of SOstart and SOend does not follow for this NACK_SN"},
{ 1, "A set of SOstart and SOend follows for this NACK_SN"},
{ 0, NULL }
};
static const value_string header_only_vals[] =
{
{ 0, "RLC PDU Headers and body present"},
{ 1, "RLC PDU Headers only"},
{ 0, NULL }
};
/**********************************************************************************/
/* These are for keeping track of UM/AM extension headers, and the lengths found */
/* in them */
guint8 s_number_of_extensions = 0;
#define MAX_RLC_SDUS 64
guint16 s_lengths[MAX_RLC_SDUS];
/*********************************************************************/
/* UM/AM sequence analysis */
/* Types for RLC channel hash table */
/* This table is maintained during initial dissection of RLC */
/* frames, mapping from rlc_channel_hash_key -> rlc_channel_status */
/* Channel key */
typedef struct
{
guint16 ueId;
guint16 channelType;
guint16 channelId;
guint8 direction;
} rlc_channel_hash_key;
/* Conversation-type status for sequence analysis on channel */
typedef struct
{
guint8 rlcMode;
/* For UM, we always expect the SN to keep advancing, and these fields
keep track of this.
For AM, these correspond to new data */
guint16 previousSequenceNumber;
guint32 previousFrameNum;
gboolean previousSegmentIncomplete;
} rlc_channel_sequence_analysis_status;
/* The sequence analysis channel hash table */
static GHashTable *rlc_lte_sequence_analysis_channel_hash = NULL;
/* Types for sequence analysis frame report hash table */
/* This is a table from framenum -> state_report_in_frame */
/* This is necessary because the per-packet info is already being used */
/* for conext information before the dissector is called */
/* Info to attach to frame when first read, recording what to show about sequence */
typedef struct
{
gboolean sequenceExpectedCorrect;
guint16 sequenceExpected;
guint32 previousFrameNum;
gboolean previousSegmentIncomplete;
guint16 firstSN;
guint16 lastSN;
/* AM Only */
enum { SN_OK, SN_Repeated, SN_MAC_Retx, SN_Retx, SN_Missing} amState;
} state_sequence_analysis_report_in_frame;
/* The sequence analysis frame report hash table instance itself */
static GHashTable *rlc_lte_frame_sequence_analysis_report_hash = NULL;
/******************************************************************/
/* Conversation-type status for repeated NACK checking on channel */
typedef struct
{
guint8 noOfNACKs;
guint16 NACKs[MAX_NACKs];
} rlc_channel_repeated_nack_status;
static GHashTable *rlc_lte_repeated_nack_channel_hash = NULL;
typedef struct {
guint8 noOfNACKsRepeated;
guint16 repeatedNACKs[MAX_NACKs];
} rlc_channel_repeated_nack_report_in_frame;
static GHashTable *rlc_lte_frame_repeated_nack_report_hash = NULL;
/********************************************************/
/* Forward declarations & functions */
void proto_reg_handoff_rlc_lte(void);
void dissect_rlc_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
/* Dissect extension headers (common to both UM and AM) */
static int dissect_rlc_lte_extension_header(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree,
int offset)
{
guint8 isOdd;
guint64 extension = 1;
guint64 length;
/* Reset this count */
s_number_of_extensions = 0;
while (extension && (s_number_of_extensions < MAX_RLC_SDUS)) {
proto_tree *extension_part_tree;
proto_item *extension_part_ti;
isOdd = (s_number_of_extensions % 2);
/* Extension part subtree */
extension_part_ti = proto_tree_add_string_format(tree,
hf_rlc_lte_extension_part,
tvb, offset, 2,
"",
"Extension Part");
extension_part_tree = proto_item_add_subtree(extension_part_ti,
ett_rlc_lte_extension_part);
/* Read next extension */
proto_tree_add_bits_ret_val(extension_part_tree, hf_rlc_lte_extension_e, tvb,
(offset*8) + ((isOdd) ? 4 : 0),
1,
&extension, FALSE);
/* Read length field */
proto_tree_add_bits_ret_val(extension_part_tree, hf_rlc_lte_extension_li, tvb,
(offset*8) + ((isOdd) ? 5 : 1),
11,
&length, FALSE);
proto_item_append_text(extension_part_tree, " (length=%u)", (guint16)length);
/* Move on to byte of next extension */
if (isOdd) {
offset += 2;
} else {
offset++;
}
s_lengths[s_number_of_extensions++] = (guint16)length;
}
/* May need to skip padding after last extension part */
isOdd = (s_number_of_extensions % 2);
if (isOdd) {
guint8 padding;
proto_item *ti;
padding = tvb_get_guint8(tvb, offset) & 0x0f;
ti = proto_tree_add_item(tree, hf_rlc_lte_extension_padding,
tvb, offset, 1, FALSE);
if (padding != 0) {
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"Extension Header padding not zero (found 0x%x)", padding);
}
offset++;
}
return offset;
}
/* Show in the info column how many bytes are in the UM/AM PDU, and indicate
whether or not the beginning and end are included in this packet */
static void show_PDU_in_info(packet_info *pinfo,
proto_item *top_ti,
guint16 length,
gboolean first_includes_start,
gboolean last_includes_end)
{
/* Reflect this PDU in the info column */
col_append_fstr(pinfo->cinfo, COL_INFO, " %s%u-byte%s%s",
(first_includes_start) ? "[" : "..",
length,
(length > 1) ? "s" : "",
(last_includes_end) ? "]" : "..");
proto_item_append_text(top_ti, " %s%u-byte%s%s",
(first_includes_start) ? "[" : "..",
length,
(length > 1) ? "s" : "",
(last_includes_end) ? "]" : "..");
}
/* Show an AM PDU. If configured, pass to PDCP dissector */
static void show_AM_PDU_in_tree(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, gint offset, gint length,
rlc_lte_info *rlc_info, gboolean whole_pdu)
{
proto_item *data_ti = proto_tree_add_item(tree, hf_rlc_lte_am_data, tvb, offset, length, FALSE);
/* Decode signalling PDUs as PDCP */
if (global_rlc_lte_call_pdcp && whole_pdu) {
if (rlc_info->channelType == CHANNEL_TYPE_SRB) {
/* Attempt to decode payload using LTE PDCP dissector */
tvbuff_t *pdcp_tvb = tvb_new_subset(tvb, offset, length, length);
volatile dissector_handle_t protocol_handle;
struct pdcp_lte_info *p_pdcp_lte_info;
/* Reuse or allocate struct */
p_pdcp_lte_info = p_get_proto_data(pinfo->fd, proto_pdcp_lte);
if (p_pdcp_lte_info == NULL) {
p_pdcp_lte_info = se_alloc0(sizeof(struct pdcp_lte_info));
/* Store info in packet */
p_add_proto_data(pinfo->fd, proto_pdcp_lte, p_pdcp_lte_info);
}
p_pdcp_lte_info->channelType = Channel_DCCH;
p_pdcp_lte_info->direction = rlc_info->direction;
p_pdcp_lte_info->no_header_pdu = FALSE;
p_pdcp_lte_info->plane = SIGNALING_PLANE;
p_pdcp_lte_info->rohc_compression = FALSE;
/* Get dissector handle */
protocol_handle = find_dissector("pdcp-lte");
TRY {
call_dissector_only(protocol_handle, pdcp_tvb, pinfo, tree);
}
CATCH_ALL {
}
ENDTRY
PROTO_ITEM_SET_HIDDEN(data_ti);
}
}
}
/* Hash table functions for RLC channels */
/* Equal keys */
static gint rlc_channel_equal(gconstpointer v, gconstpointer v2)
{
const rlc_channel_hash_key* val1 = v;
const rlc_channel_hash_key* val2 = v2;
/* All fields must match */
return ((val1->ueId == val2->ueId) &&
(val1->channelType == val2->channelType) &&
(val1->channelId == val2->channelId) &&
(val1->direction == val2->direction));
}
/* Compute a hash value for a given key. */
static guint rlc_channel_hash_func(gconstpointer v)
{
const rlc_channel_hash_key* val1 = v;
/* TODO: check/reduce multipliers */
return ((val1->ueId * 1024) + (val1->channelType*64) + (val1->channelId*2) + val1->direction);
}
/* Hash table functions for frame reports */
/* Equal keys */
static gint rlc_frame_equal(gconstpointer v, gconstpointer v2)
{
return (v == v2);
}
/* Compute a hash value for a given key. */
static guint rlc_frame_hash_func(gconstpointer v)
{
return GPOINTER_TO_UINT(v);
}
/* Add to the tree values associated with sequence analysis for this frame */
static void addChannelSequenceInfo(state_sequence_analysis_report_in_frame *p,
rlc_lte_info *p_rlc_lte_info,
guint16 sequenceNumber,
gboolean newSegmentStarted,
rlc_lte_tap_info *tap_info,
packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb)
{
proto_tree *seqnum_tree;
proto_item *seqnum_ti;
proto_item *ti;
/* Create subtree */
seqnum_ti = proto_tree_add_string_format(tree,
hf_rlc_lte_sequence_analysis,
tvb, 0, 0,
"", "Sequence Analysis");
seqnum_tree = proto_item_add_subtree(seqnum_ti,
ett_rlc_lte_sequence_analysis);
PROTO_ITEM_SET_GENERATED(seqnum_ti);
switch (p_rlc_lte_info->rlcMode) {
case RLC_AM_MODE:
/********************************************/
/* AM */
/********************************************/
switch (p->amState) {
case SN_OK:
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_ok,
tvb, 0, 0, TRUE);
PROTO_ITEM_SET_GENERATED(ti);
proto_item_append_text(seqnum_ti, " - OK");
break;
case SN_MAC_Retx:
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_ok,
tvb, 0, 0, FALSE);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_mac_retx,
tvb, 0, 0, TRUE);
PROTO_ITEM_SET_GENERATED(ti);
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"AM Frame retransmitted for %s on UE %u - due to MAC retx!",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid);
break;
case SN_Retx:
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_ok,
tvb, 0, 0, FALSE);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_retx,
tvb, 0, 0, TRUE);
PROTO_ITEM_SET_GENERATED(ti);
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"AM Frame retransmitted for %s on UE %u - most likely in response to NACK",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid);
proto_item_append_text(seqnum_ti, " - SN %u retransmitted", p->firstSN);
break;
case SN_Repeated:
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_ok,
tvb, 0, 0, FALSE);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_repeated,
tvb, 0, 0, TRUE);
PROTO_ITEM_SET_GENERATED(ti);
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"AM SN Repeated for %s for UE %u - probably because didn't receive Status PDU?",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid);
proto_item_append_text(seqnum_ti, "- SN %u Repeated",
p->sequenceExpected);
break;
case SN_Missing:
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_ok,
tvb, 0, 0, FALSE);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_skipped,
tvb, 0, 0, TRUE);
PROTO_ITEM_SET_GENERATED(ti);
if (p->lastSN != p->firstSN) {
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"AM SNs missing for %s on UE %u (%u to %u)",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid, p->firstSN, p->lastSN);
proto_item_append_text(seqnum_ti, " - SNs missing (%u to %u)",
p->firstSN, p->lastSN);
tap_info->missingSNs = ((p->lastSN - p->firstSN) % 1024) + 1;
}
else {
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"AM SN missing for %s on UE %u (%u)",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid, p->firstSN);
proto_item_append_text(seqnum_ti, " - SN missing (%u)",
p->firstSN);
tap_info->missingSNs = 1;
}
break;
}
break;
case RLC_UM_MODE:
/********************************************/
/* UM */
/********************************************/
/* Previous channel frame */
if (p->previousFrameNum != 0) {
proto_tree_add_uint(seqnum_tree, hf_rlc_lte_sequence_analysis_previous_frame,
tvb, 0, 0, p->previousFrameNum);
}
/* Expected sequence number */
ti = proto_tree_add_uint(seqnum_tree, hf_rlc_lte_sequence_analysis_expected_sn,
tvb, 0, 0, p->sequenceExpected);
PROTO_ITEM_SET_GENERATED(ti);
if (!p->sequenceExpectedCorrect) {
/* Incorrect sequence number */
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"Wrong Sequence Number for %s on UE %u - got %u, expected %u",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid, sequenceNumber, p->sequenceExpected);
}
else {
/* Correct sequence number, so check frame indication bits consistent */
if (p->previousSegmentIncomplete) {
/* Previous segment was incomplete, so this PDU should continue it */
if (newSegmentStarted) {
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_framing_info_correct,
tvb, 0, 0, FALSE);
if (!p->sequenceExpectedCorrect) {
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"Last segment of previous PDU was not continued for UE %u",
p_rlc_lte_info->ueid);
}
}
else {
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_framing_info_correct,
tvb, 0, 0, TRUE);
}
}
else {
/* Previous segment was complete, so this PDU should start a new one */
if (!newSegmentStarted) {
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_framing_info_correct,
tvb, 0, 0, FALSE);
if (!p->sequenceExpectedCorrect) {
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
"Last segment of previous PDU was complete, but new segment was not started");
}
}
else {
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_framing_info_correct,
tvb, 0, 0, TRUE);
}
}
PROTO_ITEM_SET_GENERATED(ti);
}
}
}
/* Update the channel status and set report for this frame */
static void checkChannelSequenceInfo(packet_info *pinfo, tvbuff_t *tvb,
rlc_lte_info *p_rlc_lte_info,
guint16 sequenceNumber,
gboolean first_includes_start, gboolean last_includes_end,
gboolean is_resegmented _U_,
rlc_lte_tap_info *tap_info,
proto_tree *tree)
{
rlc_channel_hash_key channel_key;
rlc_channel_hash_key *p_channel_key;
rlc_channel_sequence_analysis_status *p_channel_status;
state_sequence_analysis_report_in_frame *p_report_in_frame = NULL;
gboolean createdChannel = FALSE;
guint16 expectedSequenceNumber = 0;
/* If find stat_report_in_frame already, use that and get out */
if (pinfo->fd->flags.visited) {
p_report_in_frame = (state_sequence_analysis_report_in_frame*)g_hash_table_lookup(rlc_lte_frame_sequence_analysis_report_hash,
&pinfo->fd->num);
if (p_report_in_frame != NULL) {
addChannelSequenceInfo(p_report_in_frame, p_rlc_lte_info,
sequenceNumber, first_includes_start,
tap_info, pinfo, tree, tvb);
return;
}
else {
/* Give up - we must have tried already... */
return;
}
}
/**************************************************/
/* Create or find an entry for this channel state */
channel_key.ueId = p_rlc_lte_info->ueid;
channel_key.channelType = p_rlc_lte_info->channelType;
channel_key.channelId = p_rlc_lte_info->channelId;
channel_key.direction = p_rlc_lte_info->direction;
/* Do the table lookup */
p_channel_status = (rlc_channel_sequence_analysis_status*)g_hash_table_lookup(rlc_lte_sequence_analysis_channel_hash, &channel_key);
/* Create table entry if necessary */
if (p_channel_status == NULL) {
createdChannel = TRUE;
/* Allocate a new key and value */
p_channel_key = se_alloc(sizeof(rlc_channel_hash_key));
p_channel_status = se_alloc0(sizeof(rlc_channel_sequence_analysis_status));
/* Copy key contents */
memcpy(p_channel_key, &channel_key, sizeof(rlc_channel_hash_key));
/* Set mode */
p_channel_status->rlcMode = p_rlc_lte_info->rlcMode;
/* Add entry */
g_hash_table_insert(rlc_lte_sequence_analysis_channel_hash, p_channel_key, p_channel_status);
}
/* Create space for frame state_report */
p_report_in_frame = se_alloc(sizeof(state_sequence_analysis_report_in_frame));
switch (p_channel_status->rlcMode) {
case RLC_UM_MODE:
/* Work out expected sequence number */
if (!createdChannel) {
guint16 snLimit;
if (p_rlc_lte_info->UMSequenceNumberLength == 5) {
snLimit = 32;
}
else {
snLimit = 1024;
}
expectedSequenceNumber = (p_channel_status->previousSequenceNumber + 1) % snLimit;
}
/* Set report for this frame */
/* For UM, sequence number is always expectedSequence number */
p_report_in_frame->sequenceExpectedCorrect = (sequenceNumber == expectedSequenceNumber);
p_report_in_frame->sequenceExpected = expectedSequenceNumber;
p_report_in_frame->previousFrameNum = p_channel_status->previousFrameNum;
p_report_in_frame->previousSegmentIncomplete = p_channel_status->previousSegmentIncomplete;
/* Update channel status to remember *this* frame */
p_channel_status->previousFrameNum = pinfo->fd->num;
p_channel_status->previousSequenceNumber = sequenceNumber;
p_channel_status->previousSegmentIncomplete = !last_includes_end;
break;
case RLC_AM_MODE:
/* Work out expected sequence number */
if (!createdChannel) {
expectedSequenceNumber = (p_channel_status->previousSequenceNumber + 1) % 1024;
}
/* For AM, may be:
- expected Sequence number OR
- previous frame repeated
- old SN being sent (in response to NACK)
- new SN, but with frames missed out
Assume window whose front is at expectedSequenceNumber */
/* First of all, check to see whether frame is judged to be MAC Retx */
if (is_mac_lte_frame_retx(pinfo, p_rlc_lte_info->direction)) {
/* Just report that this is a MAC Retx */
p_report_in_frame->amState = SN_MAC_Retx;
/* No channel state to update */
}
/* Expected? */
else if (sequenceNumber == expectedSequenceNumber) {
/* Set report for this frame */
p_report_in_frame->sequenceExpectedCorrect = TRUE;
p_report_in_frame->sequenceExpected = expectedSequenceNumber;
p_report_in_frame->previousFrameNum = p_channel_status->previousFrameNum;
p_report_in_frame->previousSegmentIncomplete = p_channel_status->previousSegmentIncomplete;
p_report_in_frame->amState = SN_OK;
/* Update channel status */
p_channel_status->previousSequenceNumber = sequenceNumber;
p_channel_status->previousFrameNum = pinfo->fd->num;
p_channel_status->previousSegmentIncomplete = !last_includes_end;
}
/* Previous subframe repeated? */
else if (((sequenceNumber+1) % 1024) == expectedSequenceNumber) {
p_report_in_frame->amState = SN_Repeated;
/* Set report for this frame */
p_report_in_frame->sequenceExpectedCorrect = FALSE;
p_report_in_frame->sequenceExpected = sequenceNumber;
p_report_in_frame->previousFrameNum = p_channel_status->previousFrameNum;
p_report_in_frame->previousSegmentIncomplete = p_channel_status->previousSegmentIncomplete;
/* Really should be nothing to update... */
p_channel_status->previousSequenceNumber = sequenceNumber;
p_channel_status->previousFrameNum = pinfo->fd->num;
p_channel_status->previousSegmentIncomplete = !last_includes_end;
}
else {
/* Need to work out if new (with skips, or likely a retx (due to NACK)) */
int delta = (1024 + expectedSequenceNumber - sequenceNumber) % 1024;
/* Rx window is 512, so check to see if this is a retx */
if (delta < 512) {
/* Probably a retx due to receiving NACK */
p_report_in_frame->amState = SN_Retx;
p_report_in_frame->firstSN = sequenceNumber;
/* Don't update anything in channel state */
}
else {
/* Ahead of expected SN. Assume frames have been missed */
p_report_in_frame->amState = SN_Missing;
p_report_in_frame->firstSN = expectedSequenceNumber;
p_report_in_frame->lastSN = sequenceNumber-1;
/* Update channel state - forget about missed SNs */
p_report_in_frame->sequenceExpected = expectedSequenceNumber;
p_channel_status->previousSequenceNumber = sequenceNumber;
p_channel_status->previousFrameNum = pinfo->fd->num;
p_channel_status->previousSegmentIncomplete = !last_includes_end;
}
}
break;
default:
/* Shouldn't get here! */
return;
}
/* Associate with this frame number */
g_hash_table_insert(rlc_lte_frame_sequence_analysis_report_hash, &pinfo->fd->num, p_report_in_frame);
/* Add state report for this frame into tree */
addChannelSequenceInfo(p_report_in_frame, p_rlc_lte_info, sequenceNumber,
first_includes_start, tap_info, pinfo, tree, tvb);
}
/* Add to the tree values associated with sequence analysis for this frame */
static void addChannelRepeatedNACKInfo(rlc_channel_repeated_nack_report_in_frame *p,
rlc_lte_info *p_rlc_lte_info _U_,
packet_info *pinfo, proto_tree *tree,
tvbuff_t *tvb)
{
proto_tree *seqnum_tree;
proto_item *seqnum_ti;
proto_item *ti;
gint n;
/* Create subtree */
seqnum_ti = proto_tree_add_string_format(tree,
hf_rlc_lte_sequence_analysis,
tvb, 0, 0,
"", "Sequence Analysis");
seqnum_tree = proto_item_add_subtree(seqnum_ti,
ett_rlc_lte_sequence_analysis);
PROTO_ITEM_SET_GENERATED(seqnum_ti);
/* OK = FALSE */
ti = proto_tree_add_boolean(seqnum_tree, hf_rlc_lte_sequence_analysis_ok,
tvb, 0, 0, FALSE);
PROTO_ITEM_SET_GENERATED(ti);
/* Add each repeated NACK as item & expert info */
for (n=0; n < p->noOfNACKsRepeated; n++) {
ti = proto_tree_add_uint(seqnum_tree, hf_rlc_lte_sequence_analysis_repeated_nack,
tvb, 0, 0, p->repeatedNACKs[n]);
PROTO_ITEM_SET_GENERATED(ti);
expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_ERROR,
"Same SN (%u) NACKd for %s on UE %u in successive Status PDUs",
p->repeatedNACKs[n],
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid);
}
/* Append count to sequence analysis root */
proto_item_append_text(seqnum_ti, " - %u SNs repeated from previous Status PDU",
p->noOfNACKsRepeated);
}
/* Update the channel repeated NACK status and set report for this frame */
static void checkChannelRepeatedNACKInfo(packet_info *pinfo,
rlc_lte_info *p_rlc_lte_info,
rlc_lte_tap_info *tap_info,
proto_tree *tree,
tvbuff_t *tvb)
{
rlc_channel_hash_key channel_key;
rlc_channel_hash_key *p_channel_key;
rlc_channel_repeated_nack_status *p_channel_status;
rlc_channel_repeated_nack_report_in_frame *p_report_in_frame = NULL;
guint8 noOfNACKsRepeated = 0;
guint16 repeatedNACKs[MAX_NACKs];
gint n, i, j;
/* If find state_report_in_frame already, use that and get out */
if (pinfo->fd->flags.visited) {
p_report_in_frame = (rlc_channel_repeated_nack_report_in_frame*)g_hash_table_lookup(rlc_lte_frame_repeated_nack_report_hash,
&pinfo->fd->num);
if (p_report_in_frame != NULL) {
addChannelRepeatedNACKInfo(p_report_in_frame, p_rlc_lte_info,
pinfo, tree, tvb);
return;
}
else {
/* Give up - we must have tried already... */
return;
}
}
/**************************************************/
/* Create or find an entry for this channel state */
channel_key.ueId = p_rlc_lte_info->ueid;
channel_key.channelType = p_rlc_lte_info->channelType;
channel_key.channelId = p_rlc_lte_info->channelId;
channel_key.direction = p_rlc_lte_info->direction;
/* Do the table lookup */
p_channel_status = (rlc_channel_repeated_nack_status*)g_hash_table_lookup(rlc_lte_repeated_nack_channel_hash, &channel_key);
/* Create table entry if necessary */
if (p_channel_status == NULL) {
/* Allocate a new key and value */
p_channel_key = se_alloc(sizeof(rlc_channel_hash_key));
p_channel_status = se_alloc0(sizeof(rlc_channel_repeated_nack_status));
/* Copy key contents */
memcpy(p_channel_key, &channel_key, sizeof(rlc_channel_hash_key));
/* Add entry to table */
g_hash_table_insert(rlc_lte_repeated_nack_channel_hash, p_channel_key, p_channel_status);
}
/* Compare NACKs in status with NACKs in tap_info.
Note any that are repeated */
for (i=0; i < p_channel_status->noOfNACKs; i++) {
for (j=0; j < tap_info->noOfNACKs; j++) {
if (tap_info->NACKs[j] == p_channel_status->NACKs[i]) {
repeatedNACKs[noOfNACKsRepeated++] = p_channel_status->NACKs[i];
}
}
}
/* Copy NACKs from tap_info into channel status for next time! */
p_channel_status->noOfNACKs = tap_info->noOfNACKs;
for (n=0; n < tap_info->noOfNACKs; n++) {
p_channel_status->NACKs[n] = tap_info->NACKs[n];
}
if (noOfNACKsRepeated >= 1) {
gint n;
/* Create space for frame state_report */
p_report_in_frame = se_alloc(sizeof(rlc_channel_repeated_nack_report_in_frame));
/* Copy in found duplicates */
for (n=0; n < tap_info->noOfNACKs; n++) {
p_report_in_frame->repeatedNACKs[n] = repeatedNACKs[n];
}
p_report_in_frame->noOfNACKsRepeated = noOfNACKsRepeated;
/* Associate with this frame number */
g_hash_table_insert(rlc_lte_frame_repeated_nack_report_hash, &pinfo->fd->num, p_report_in_frame);
/* Add state report for this frame into tree */
addChannelRepeatedNACKInfo(p_report_in_frame, p_rlc_lte_info,
pinfo, tree, tvb);
}
}
/***************************************************/
/* Transparent mode PDU. Call RRC if configured to */
static void dissect_rlc_lte_tm(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree,
int offset,
rlc_lte_info *p_rlc_lte_info,
proto_item *top_ti _U_)
{
proto_item *raw_tm_ti;
/* Remaining bytes are all data */
raw_tm_ti = proto_tree_add_item(tree, hf_rlc_lte_tm_data, tvb, offset, -1, FALSE);
if (!global_rlc_lte_call_rrc) {
col_append_fstr(pinfo->cinfo, COL_INFO, " [%u-bytes]",
tvb_length_remaining(tvb, offset));
}
if (global_rlc_lte_call_rrc) {
tvbuff_t *rrc_tvb = tvb_new_subset(tvb, offset, -1, tvb_length_remaining(tvb, offset));
volatile dissector_handle_t protocol_handle = 0;
switch (p_rlc_lte_info->channelType) {
case CHANNEL_TYPE_CCCH:
if (p_rlc_lte_info->direction == DIRECTION_UPLINK) {
protocol_handle = find_dissector("lte-rrc.ul.ccch");
}
else {
protocol_handle = find_dissector("lte-rrc.dl.ccch");
}
break;
case CHANNEL_TYPE_BCCH:
/* TODO: Problem is don't know which transport channel... */
return;
case CHANNEL_TYPE_PCCH:
protocol_handle = find_dissector("lte-rrc.pcch");
break;
case CHANNEL_TYPE_SRB:
case CHANNEL_TYPE_DRB:
default:
/* Shouldn't happen, just return...
TODO: should flag an error? */
return;
}
/* Hide raw view of bytes */
PROTO_ITEM_SET_HIDDEN(raw_tm_ti);
/* Call it (catch exceptions) */
TRY {
call_dissector_only(protocol_handle, rrc_tvb, pinfo, tree);
}
CATCH_ALL {
}
ENDTRY
}
}
/***************************************************/
/* Unacknowledged mode PDU */
static void dissect_rlc_lte_um(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree,
int offset,
rlc_lte_info *p_rlc_lte_info,
proto_item *top_ti,
rlc_lte_tap_info *tap_info)
{
guint64 framing_info;
gboolean first_includes_start;
gboolean last_includes_end;
guint64 fixed_extension;
guint64 sn;
gint start_offset = offset;
proto_tree *um_header_tree;
proto_item *um_header_ti;
gboolean is_truncated;
proto_item *truncated_ti;
/* Add UM header subtree */
um_header_ti = proto_tree_add_string_format(tree,
hf_rlc_lte_um_header,
tvb, offset, 0,
"",
"UM header");
um_header_tree = proto_item_add_subtree(um_header_ti,
ett_rlc_lte_um_header);
/*******************************/
/* Fixed UM header */
if (p_rlc_lte_info->UMSequenceNumberLength == UM_SN_LENGTH_5_BITS) {
/* Framing info (2 bits) */
proto_tree_add_bits_ret_val(um_header_tree, hf_rlc_lte_um_fi,
tvb, offset*8, 2,
&framing_info, FALSE);
/* Extension (1 bit) */
proto_tree_add_bits_ret_val(um_header_tree, hf_rlc_lte_um_fixed_e, tvb,
(offset*8) + 2, 1,
&fixed_extension, FALSE);
/* Sequence Number (5 bit) */
proto_tree_add_bits_ret_val(um_header_tree, hf_rlc_lte_um_sn, tvb,
(offset*8) + 3, 5,
&sn, FALSE);
offset++;
}
else if (p_rlc_lte_info->UMSequenceNumberLength == UM_SN_LENGTH_10_BITS) {
guint8 reserved;
proto_item *ti;
/* Check 3 Reserved bits */
reserved = (tvb_get_guint8(tvb, offset) & 0xe0) >> 5;
ti = proto_tree_add_item(um_header_tree, hf_rlc_lte_um_fixed_reserved, tvb, offset, 1, FALSE);
if (reserved != 0) {
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"RLC UM Fixed header Reserved bits not zero (found 0x%x)", reserved);
}
/* Framing info (2 bits) */
proto_tree_add_bits_ret_val(um_header_tree, hf_rlc_lte_um_fi,
tvb, (offset*8)+3, 2,
&framing_info, FALSE);
/* Extension (1 bit) */
proto_tree_add_bits_ret_val(um_header_tree, hf_rlc_lte_um_fixed_e, tvb,
(offset*8) + 5, 1,
&fixed_extension, FALSE);
/* Sequence Number (10 bits) */
proto_tree_add_bits_ret_val(um_header_tree, hf_rlc_lte_um_sn, tvb,
(offset*8) + 6, 10,
&sn, FALSE);
offset += 2;
}
else {
/* Invalid length of sequence number */
proto_item *ti;
ti = proto_tree_add_text(um_header_tree, tvb, 0, 0, "Invalid sequence number length (%u bits)",
p_rlc_lte_info->UMSequenceNumberLength);
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"Invalid sequence number length (%u bits)",
p_rlc_lte_info->UMSequenceNumberLength);
return;
}
tap_info->sequenceNumber = (guint16)sn;
/* Show SN in info column */
col_append_fstr(pinfo->cinfo, COL_INFO, " SN=%04u", (guint16)sn);
/* Show SN in UM header root */
proto_item_append_text(um_header_ti, " (SN=%u)", (guint16)sn);
proto_item_set_len(um_header_ti, offset-start_offset);
/*************************************/
/* UM header extension */
if (fixed_extension) {
offset = dissect_rlc_lte_extension_header(tvb, pinfo, tree, offset);
}
if (global_rlc_lte_headers_expected) {
/* There might not be any data, if only headers (plus control data) were logged */
is_truncated = (tvb_length_remaining(tvb, offset) == 0);
truncated_ti = proto_tree_add_uint(tree, hf_rlc_lte_header_only, tvb, 0, 0,
is_truncated);
if (is_truncated) {
PROTO_ITEM_SET_GENERATED(truncated_ti);
expert_add_info_format(pinfo, truncated_ti, PI_SEQUENCE, PI_NOTE,
"RLC PDU SDUs have been omitted");
return;
}
else {
PROTO_ITEM_SET_HIDDEN(truncated_ti);
}
}
/* Extract these 2 flags from framing_info */
first_includes_start = ((guint8)framing_info & 0x02) == 0;
last_includes_end = ((guint8)framing_info & 0x01) == 0;
/* Call sequence analysis function now */
if (((global_rlc_lte_um_sequence_analysis == SEQUENCE_ANALYSIS_MAC_ONLY) &&
(p_get_proto_data(pinfo->fd, proto_mac_lte) != NULL)) ||
((global_rlc_lte_um_sequence_analysis == SEQUENCE_ANALYSIS_RLC_ONLY) &&
(p_get_proto_data(pinfo->fd, proto_mac_lte) == NULL))) {
checkChannelSequenceInfo(pinfo, tvb, p_rlc_lte_info,
(guint16)sn, first_includes_start, last_includes_end,
FALSE, /* UM doesn't re-segment */
tap_info, um_header_tree);
}
/*************************************/
/* Data */
if (s_number_of_extensions > 0) {
/* Show each data segment separately */
int n;
for (n=0; n < s_number_of_extensions; n++) {
proto_tree_add_item(tree, hf_rlc_lte_um_data, tvb, offset, s_lengths[n], FALSE);
show_PDU_in_info(pinfo, top_ti, s_lengths[n],
(n==0) ? first_includes_start : TRUE,
TRUE);
tvb_ensure_bytes_exist(tvb, offset, s_lengths[n]);
offset += s_lengths[n];
}
}
/* Final data element */
proto_tree_add_item(tree, hf_rlc_lte_um_data, tvb, offset, -1, FALSE);
show_PDU_in_info(pinfo, top_ti, (guint16)tvb_length_remaining(tvb, offset),
(s_number_of_extensions == 0) ? first_includes_start : TRUE,
last_includes_end);
}
/* Dissect an AM STATUS PDU */
static void dissect_rlc_lte_am_status_pdu(tvbuff_t *tvb,
packet_info *pinfo,
proto_tree *tree,
proto_item *status_ti,
int offset,
proto_item *top_ti,
rlc_lte_info *p_rlc_lte_info,
rlc_lte_tap_info *tap_info)
{
guint8 cpt;
guint64 ack_sn, nack_sn;
guint8 nack_count = 0;
guint64 e1 = 0, e2 = 0;
guint64 so_start, so_end;
int bit_offset = offset * 8;
proto_item *ti;
/****************************************************************/
/* Part of RLC control PDU header */
/* Control PDU Type (CPT) */
cpt = (tvb_get_guint8(tvb, offset) & 0xf0) >> 4;
ti = proto_tree_add_item(tree, hf_rlc_lte_am_cpt, tvb, offset, 1, FALSE);
if (cpt != 0) {
/* Protest and stop - only know about STATUS PDUs */
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR,
"RLC Control frame type %u not handled", cpt);
return;
}
/* The Status PDU itself starts 4 bits into the byte */
bit_offset += 4;
/* ACK SN */
proto_tree_add_bits_ret_val(tree, hf_rlc_lte_am_ack_sn, tvb,
bit_offset, 10, &ack_sn, FALSE);
bit_offset += 10;
col_append_fstr(pinfo->cinfo, COL_INFO, " ACK_SN=%u", (guint16)ack_sn);
proto_item_append_text(top_ti, " ACK_SN=%u", (guint16)ack_sn);
proto_item_append_text(status_ti, " ACK_SN=%u", (guint16)ack_sn);
tap_info->ACKNo = (guint16)ack_sn;
/* E1 */
proto_tree_add_bits_ret_val(tree, hf_rlc_lte_am_e1, tvb,
bit_offset, 1, &e1, FALSE);
/* Skip another bit to byte-align the next bit... */
bit_offset++;
/* Optional, extra fields */
do {
if (e1) {
proto_item *nack_ti;
/****************************/
/* Read NACK_SN, E1, E2 */
/* NACK_SN */
nack_ti = proto_tree_add_bits_ret_val(tree, hf_rlc_lte_am_nack_sn, tvb,
bit_offset, 10, &nack_sn, FALSE);
bit_offset += 10;
col_append_fstr(pinfo->cinfo, COL_INFO, " NACK_SN=%u", (guint16)nack_sn);
proto_item_append_text(top_ti, " NACK_SN=%u", (guint16)nack_sn);
tap_info->NACKs[nack_count++] = (guint16)nack_sn;
/* E1 */
proto_tree_add_bits_ret_val(tree, hf_rlc_lte_am_e1, tvb,
bit_offset, 1, &e1, FALSE);
bit_offset++;
/* E2 */
proto_tree_add_bits_ret_val(tree, hf_rlc_lte_am_e2, tvb,
bit_offset, 1, &e2, FALSE);
/* Report as expert info */
if (e2) {
expert_add_info_format(pinfo, nack_ti, PI_SEQUENCE, PI_WARN,
"Status PDU reports NACK (partial) on %s for UE %u",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid);
}
else {
expert_add_info_format(pinfo, nack_ti, PI_SEQUENCE, PI_WARN,
"Status PDU reports NACK on %s for UE %u",
val_to_str(p_rlc_lte_info->direction, direction_vals, "Unknown"),
p_rlc_lte_info->ueid);
}
bit_offset++;
}
if (e2) {
/* Read SOstart, SOend */
proto_tree_add_bits_ret_val(tree, hf_rlc_lte_am_so_start, tvb,
bit_offset, 15, &so_start, FALSE);
bit_offset += 15;
proto_tree_add_bits_ret_val(tree, hf_rlc_lte_am_so_end, tvb,
bit_offset, 15, &so_end, FALSE);
bit_offset += 15;
if ((guint16)so_end == 0x7fff) {
col_append_fstr(pinfo->cinfo, COL_INFO, " (SOstart=%u SOend=<END-OF_PDU>)",
(guint16)so_start);
}
else {
col_append_fstr(pinfo->cinfo, COL_INFO, " (SOstart=%u SOend=%u)",
(guint16)so_start, (guint16)so_end);
}
/* Reset this flag here */
e2 = 0;
}
} while (e1 || e2);
if (nack_count > 0) {
proto_item_append_text(status_ti, " (%u NACKs)", nack_count);
tap_info->noOfNACKs = nack_count;
}
/* Check that we've reached the end of the PDU. If not, show malformed */
offset = (bit_offset+7) / 8;
if (tvb_length_remaining(tvb, offset) > 0) {
expert_add_info_format(pinfo, status_ti, PI_MALFORMED, PI_ERROR,
"%u bytes remaining after Status PDU complete",
tvb_length_remaining(tvb, offset));
}
/* Set selected length of control tree */
proto_item_set_len(status_ti, offset);
/* Repeated NACK analysis */
if (((global_rlc_lte_am_sequence_analysis == SEQUENCE_ANALYSIS_MAC_ONLY) &&
(p_get_proto_data(pinfo->fd, proto_mac_lte) != NULL)) ||
((global_rlc_lte_am_sequence_analysis == SEQUENCE_ANALYSIS_RLC_ONLY) &&
(p_get_proto_data(pinfo->fd, proto_mac_lte) == NULL))) {
if (!is_mac_lte_frame_retx(pinfo, p_rlc_lte_info->direction)) {
checkChannelRepeatedNACKInfo(pinfo, p_rlc_lte_info, tap_info, tree, tvb);
}
}
}
/***************************************************/
/* Acknowledged mode PDU */
static void dissect_rlc_lte_am(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree,
int offset,
rlc_lte_info *p_rlc_lte_info,
proto_item *top_ti,
rlc_lte_tap_info *tap_info)
{
guint8 is_data;
guint8 is_resegmented;
guint8 polling;
guint8 fixed_extension;
guint8 framing_info;
gboolean first_includes_start;
gboolean last_includes_end;
proto_tree *am_header_tree;
proto_item *am_header_ti;
gint start_offset = offset;
guint16 sn;
gboolean is_truncated;
proto_item *truncated_ti;
/* Add AM header subtree */
am_header_ti = proto_tree_add_string_format(tree,
hf_rlc_lte_am_header,
tvb, offset, 0,
"",
"AM header");
am_header_tree = proto_item_add_subtree(am_header_ti,
ett_rlc_lte_am_header);
/* First bit is Data/Control flag */
is_data = (tvb_get_guint8(tvb, offset) & 0x80) >> 7;
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_data_control, tvb, offset, 1, FALSE);
tap_info->isControlPDU = !is_data;
if (!is_data) {
/**********************/
/* Status PDU */
col_append_str(pinfo->cinfo, COL_INFO, " [CONTROL]");
proto_item_append_text(top_ti, " [CONTROL]");
/* Control PDUs are a completely separate format */
dissect_rlc_lte_am_status_pdu(tvb, pinfo, am_header_tree, am_header_ti,
offset, top_ti,
p_rlc_lte_info, tap_info);
return;
}
/******************************/
/* Data PDU fixed header */
/* Re-segmentation Flag (RF) field */
is_resegmented = (tvb_get_guint8(tvb, offset) & 0x40) >> 6;
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_rf, tvb, offset, 1, FALSE);
tap_info->isResegmented = is_resegmented;
col_append_str(pinfo->cinfo, COL_INFO, (is_resegmented) ? " [DATA-SEGMENT]" : " [DATA]");
proto_item_append_text(top_ti, (is_resegmented) ? " [DATA-SEGMENT]" : " [DATA]");
/* Polling bit */
polling = (tvb_get_guint8(tvb, offset) & 0x20) >> 5;
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_p, tvb, offset, 1, FALSE);
col_append_str(pinfo->cinfo, COL_INFO, (polling) ? " (P) " : " ");
proto_item_append_text(top_ti, (polling) ? " (P) " : " ");
if (polling) {
proto_item_append_text(am_header_ti, " (P)");
}
/* Framing Info */
framing_info = (tvb_get_guint8(tvb, offset) & 0x18) >> 3;
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_fi, tvb, offset, 1, FALSE);
/* Extension bit */
fixed_extension = (tvb_get_guint8(tvb, offset) & 0x04) >> 2;
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_fixed_e, tvb, offset, 1, FALSE);
/* Sequence Number */
sn = tvb_get_ntohs(tvb, offset) & 0x03ff;
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_fixed_sn, tvb, offset, 2, FALSE);
offset += 2;
tap_info->sequenceNumber = sn;
col_append_fstr(pinfo->cinfo, COL_INFO, "sn=%u", sn);
proto_item_append_text(top_ti, " (SN=%u)", sn);
/* Show SN in AM header root */
proto_item_append_text(am_header_ti, " (SN=%u)", sn);
/***************************************/
/* Dissect extra segment header fields */
if (is_resegmented) {
guint16 segmentOffset;
/* Last Segment Field (LSF) */
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_segment_lsf, tvb, offset, 1, FALSE);
/* SO */
segmentOffset = tvb_get_ntohs(tvb, offset) & 0x7fff;
proto_tree_add_item(am_header_tree, hf_rlc_lte_am_segment_so, tvb, offset, 2, FALSE);
col_append_fstr(pinfo->cinfo, COL_INFO, " SO=%u ", segmentOffset);
proto_item_append_text(top_ti, " SO=%u ", segmentOffset);
offset += 2;
}
/*************************************/
/* AM header extension */
if (fixed_extension) {
offset = dissect_rlc_lte_extension_header(tvb, pinfo, tree, offset);
}
/* There might not be any data, if only headers (plus control data) were logged */
if (global_rlc_lte_headers_expected) {
is_truncated = (tvb_length_remaining(tvb, offset) == 0);
truncated_ti = proto_tree_add_uint(tree, hf_rlc_lte_header_only, tvb, 0, 0,
is_truncated);
if (is_truncated) {
PROTO_ITEM_SET_GENERATED(truncated_ti);
expert_add_info_format(pinfo, truncated_ti, PI_SEQUENCE, PI_NOTE,
"RLC PDU SDUs have been omitted");
return;
}
else {
PROTO_ITEM_SET_HIDDEN(truncated_ti);
}
}
/* Head is now complete */
proto_item_set_len(am_header_ti, offset-start_offset);
/* Extract these 2 flags from framing_info */
first_includes_start = (framing_info & 0x02) == 0;
last_includes_end = (framing_info & 0x01) == 0;
/* Call sequence analysis function now */
if (((global_rlc_lte_am_sequence_analysis == SEQUENCE_ANALYSIS_MAC_ONLY) &&
(p_get_proto_data(pinfo->fd, proto_mac_lte) != NULL)) ||
((global_rlc_lte_am_sequence_analysis == SEQUENCE_ANALYSIS_RLC_ONLY) &&
(p_get_proto_data(pinfo->fd, proto_mac_lte) == NULL))) {
checkChannelSequenceInfo(pinfo, tvb, p_rlc_lte_info, (guint16)sn,
first_includes_start, last_includes_end,
is_resegmented, tap_info, tree);
}
/*************************************/
/* Data */
if (s_number_of_extensions > 0) {
/* Show each data segment separately */
int n;
for (n=0; n < s_number_of_extensions; n++) {
show_AM_PDU_in_tree(pinfo, tree, tvb, offset, s_lengths[n], p_rlc_lte_info,
first_includes_start && last_includes_end);
show_PDU_in_info(pinfo, top_ti, s_lengths[n],
(n==0) ? first_includes_start : TRUE,
TRUE);
tvb_ensure_bytes_exist(tvb, offset, s_lengths[n]);
offset += s_lengths[n];
}
}
/* Final data element */
if (tvb_length_remaining(tvb, offset) > 0) {
show_AM_PDU_in_tree(pinfo, tree, tvb, offset, -1, p_rlc_lte_info,
first_includes_start && last_includes_end);
show_PDU_in_info(pinfo, top_ti, (guint16)tvb_length_remaining(tvb, offset),
(s_number_of_extensions == 0) ? first_includes_start : TRUE,
last_includes_end);
}
else {
/* Report that expected data was missing (unless we know it might happen) */
if (!global_rlc_lte_headers_expected) {
if (s_number_of_extensions > 0) {
expert_add_info_format(pinfo, am_header_ti, PI_MALFORMED, PI_ERROR,
"AM data PDU doesn't contain any data beyond extensions");
}
else {
expert_add_info_format(pinfo, am_header_ti, PI_MALFORMED, PI_ERROR,
"AM data PDU doesn't contain any data");
}
}
}
}
/* Heuristic dissector looks for supported framing protocol (see wiki page) */
static gboolean dissect_rlc_lte_heur(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree)
{
gint offset = 0;
struct rlc_lte_info *p_rlc_lte_info;
tvbuff_t *rlc_tvb;
guint8 tag = 0;
gboolean infoAlreadySet = FALSE;
gboolean umSeqNumLengthTagPresent = FALSE;
/* 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 (!global_rlc_lte_heur) {
return FALSE;
}
/* If redissecting, use previous info struct (if available) */
p_rlc_lte_info = p_get_proto_data(pinfo->fd, proto_rlc_lte);
if (p_rlc_lte_info == NULL) {
/* Allocate new info struct for this frame */
p_rlc_lte_info = se_alloc0(sizeof(struct rlc_lte_info));
infoAlreadySet = FALSE;
}
else {
infoAlreadySet = TRUE;
}
/* Do this again on re-dissection to re-discover offset of actual PDU */
/* Needs to be at least as long as:
- the signature string
- fixed header bytes
- tag for data
- at least one byte of RLC PDU payload */
if ((size_t)tvb_length_remaining(tvb, offset) < (strlen(RLC_LTE_START_STRING)+1+2)) {
return FALSE;
}
/* OK, compare with signature string */
if (tvb_strneql(tvb, offset, RLC_LTE_START_STRING, (gint)strlen(RLC_LTE_START_STRING)) != 0) {
return FALSE;
}
offset += (gint)strlen(RLC_LTE_START_STRING);
/* Read fixed fields */
p_rlc_lte_info->rlcMode = tvb_get_guint8(tvb, offset++);
/* Read optional fields */
while (tag != RLC_LTE_PAYLOAD_TAG) {
/* Process next tag */
tag = tvb_get_guint8(tvb, offset++);
switch (tag) {
case RLC_LTE_UM_SN_LENGTH_TAG:
p_rlc_lte_info->UMSequenceNumberLength = tvb_get_guint8(tvb, offset);
offset++;
umSeqNumLengthTagPresent = TRUE;
break;
case RLC_LTE_DIRECTION_TAG:
p_rlc_lte_info->direction = tvb_get_guint8(tvb, offset);
offset++;
break;
case RLC_LTE_PRIORITY_TAG:
p_rlc_lte_info->priority = tvb_get_guint8(tvb, offset);
offset++;
break;
case RLC_LTE_UEID_TAG:
p_rlc_lte_info->ueid = tvb_get_ntohs(tvb, offset);
offset += 2;
break;
case RLC_LTE_CHANNEL_TYPE_TAG:
p_rlc_lte_info->channelType = tvb_get_ntohs(tvb, offset);
offset += 2;
break;
case RLC_LTE_CHANNEL_ID_TAG:
p_rlc_lte_info->channelId = tvb_get_ntohs(tvb, offset);
offset += 2;
break;
case RLC_LTE_PAYLOAD_TAG:
/* Have reached data, so set payload length and get out of loop */
p_rlc_lte_info->pduLength= tvb_length_remaining(tvb, offset);
continue;
default:
/* It must be a recognised tag */
return FALSE;
}
}
if ((p_rlc_lte_info->rlcMode == RLC_UM_MODE) && (umSeqNumLengthTagPresent == FALSE)) {
/* Conditional field is not present */
return FALSE;
}
if (!infoAlreadySet) {
/* Store info in packet */
p_add_proto_data(pinfo->fd, proto_rlc_lte, p_rlc_lte_info);
}
/**************************************/
/* OK, now dissect as RLC LTE */
/* Create tvb that starts at actual RLC PDU */
rlc_tvb = tvb_new_subset(tvb, offset, -1, tvb_reported_length(tvb)-offset);
dissect_rlc_lte(rlc_tvb, pinfo, tree);
return TRUE;
}
/*****************************/
/* Main dissection function. */
/*****************************/
void dissect_rlc_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *rlc_lte_tree;
proto_item *top_ti;
proto_item *ti;
proto_item *mode_ti;
gint offset = 0;
struct rlc_lte_info *p_rlc_lte_info = NULL;
/* Zero out tap */
static rlc_lte_tap_info tap_info;
memset(&tap_info, 0, sizeof(rlc_lte_tap_info));
/* Set protocol name */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC-LTE");
/* Create protocol tree. */
top_ti = proto_tree_add_item(tree, proto_rlc_lte, tvb, offset, -1, FALSE);
rlc_lte_tree = proto_item_add_subtree(top_ti, ett_rlc_lte);
/* Look for packet info! */
p_rlc_lte_info = p_get_proto_data(pinfo->fd, proto_rlc_lte);
/* Can't dissect anything without it... */
if (p_rlc_lte_info == NULL) {
ti = proto_tree_add_text(rlc_lte_tree, tvb, offset, -1,
"Can't dissect LTE RLC frame because no per-frame info was attached!");
PROTO_ITEM_SET_GENERATED(ti);
return;
}
/*****************************************/
/* Show context information */
ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_direction,
tvb, 0, 0, p_rlc_lte_info->direction);
PROTO_ITEM_SET_GENERATED(ti);
mode_ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_mode,
tvb, 0, 0, p_rlc_lte_info->rlcMode);
PROTO_ITEM_SET_GENERATED(mode_ti);
if (p_rlc_lte_info->ueid != 0) {
ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_ueid,
tvb, 0, 0, p_rlc_lte_info->ueid);
PROTO_ITEM_SET_GENERATED(ti);
}
ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_priority,
tvb, 0, 0, p_rlc_lte_info->priority);
PROTO_ITEM_SET_GENERATED(ti);
ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_channel_type,
tvb, 0, 0, p_rlc_lte_info->channelType);
PROTO_ITEM_SET_GENERATED(ti);
if ((p_rlc_lte_info->channelType == CHANNEL_TYPE_SRB) ||
(p_rlc_lte_info->channelType == CHANNEL_TYPE_DRB)) {
ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_channel_id,
tvb, 0, 0, p_rlc_lte_info->channelId);
PROTO_ITEM_SET_GENERATED(ti);
}
ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_pdu_length,
tvb, 0, 0, p_rlc_lte_info->pduLength);
PROTO_ITEM_SET_GENERATED(ti);
if (p_rlc_lte_info->rlcMode == RLC_UM_MODE) {
ti = proto_tree_add_uint(rlc_lte_tree, hf_rlc_lte_context_um_sn_length,
tvb, 0, 0, p_rlc_lte_info->UMSequenceNumberLength);
PROTO_ITEM_SET_GENERATED(ti);
}
/* Append highlights to top-level item */
if (p_rlc_lte_info->ueid != 0) {
proto_item_append_text(top_ti, " UEId=%u", p_rlc_lte_info->ueid);
}
if (p_rlc_lte_info->channelId == 0) {
proto_item_append_text(top_ti, " (%s) ",
val_to_str(p_rlc_lte_info->channelType, rlc_channel_type_vals, "Unknown"));
}
else {
proto_item_append_text(top_ti, " (%s:%u) ",
val_to_str(p_rlc_lte_info->channelType, rlc_channel_type_vals, "Unknown"),
p_rlc_lte_info->channelId);
}
proto_item_append_text(top_ti, "[%s] ",
val_to_str(p_rlc_lte_info->rlcMode, rlc_mode_short_vals, "Unknown"));
/* Append context highlights to info column */
col_add_fstr(pinfo->cinfo, COL_INFO,
"[%s] [%s] ",
(p_rlc_lte_info->direction == 0) ? "UL" : "DL",
val_to_str(p_rlc_lte_info->rlcMode, rlc_mode_short_vals, "Unknown"));
if (p_rlc_lte_info->ueid != 0) {
col_append_fstr(pinfo->cinfo, COL_INFO, "UEId=%u ", p_rlc_lte_info->ueid);
}
if (p_rlc_lte_info->channelId == 0) {
col_append_fstr(pinfo->cinfo, COL_INFO, "%s",
val_to_str(p_rlc_lte_info->channelType, rlc_channel_type_vals, "Unknown"));
}
else {
col_append_fstr(pinfo->cinfo, COL_INFO, "%s:%u",
val_to_str(p_rlc_lte_info->channelType, rlc_channel_type_vals, "Unknown"),
p_rlc_lte_info->channelId);
}
/* Set context-info parts of tap struct */
tap_info.rlcMode = p_rlc_lte_info->rlcMode;
tap_info.direction = p_rlc_lte_info->direction;
tap_info.priority = p_rlc_lte_info->priority;
tap_info.ueid = p_rlc_lte_info->ueid;
tap_info.channelType = p_rlc_lte_info->channelType;
tap_info.channelId = p_rlc_lte_info->channelId;
tap_info.pduLength = p_rlc_lte_info->pduLength;
tap_info.UMSequenceNumberLength = p_rlc_lte_info->UMSequenceNumberLength;
tap_info.loggedInMACFrame = (p_get_proto_data(pinfo->fd, proto_mac_lte) != NULL);
/* Reset this count */
s_number_of_extensions = 0;
/* Dissect the RLC PDU itself. Format depends upon mode... */
switch (p_rlc_lte_info->rlcMode) {
case RLC_TM_MODE:
dissect_rlc_lte_tm(tvb, pinfo, rlc_lte_tree, offset, p_rlc_lte_info, top_ti);
break;
case RLC_UM_MODE:
dissect_rlc_lte_um(tvb, pinfo, rlc_lte_tree, offset, p_rlc_lte_info, top_ti,
&tap_info);
break;
case RLC_AM_MODE:
dissect_rlc_lte_am(tvb, pinfo, rlc_lte_tree, offset, p_rlc_lte_info, top_ti,
&tap_info);
break;
case RLC_PREDEF:
/* Predefined data (i.e. not containing a valid RLC header */
proto_tree_add_item(rlc_lte_tree, hf_rlc_lte_predefined_pdu, tvb, offset, -1, FALSE);
col_append_fstr(pinfo->cinfo, COL_INFO, " [%u-bytes]",
tvb_length_remaining(tvb, offset));
break;
default:
/* Error - unrecognised mode */
expert_add_info_format(pinfo, mode_ti, PI_MALFORMED, PI_ERROR,
"Unrecognised RLC Mode set (%u)", p_rlc_lte_info->rlcMode);
break;
}
/* Queue tap info */
if (!pinfo->in_error_pkt) {
tap_queue_packet(rlc_lte_tap, pinfo, &tap_info);
}
}
/* Initializes the hash table and the mem_chunk area each time a new
* file is loaded or re-loaded in wireshark */
static void
rlc_lte_init_protocol(void)
{
/* Destroy any existing hashes. */
if (rlc_lte_sequence_analysis_channel_hash) {
g_hash_table_destroy(rlc_lte_sequence_analysis_channel_hash);
}
if (rlc_lte_frame_sequence_analysis_report_hash) {
g_hash_table_destroy(rlc_lte_frame_sequence_analysis_report_hash);
}
if (rlc_lte_repeated_nack_channel_hash) {
g_hash_table_destroy(rlc_lte_repeated_nack_channel_hash);
}
if (rlc_lte_frame_repeated_nack_report_hash) {
g_hash_table_destroy(rlc_lte_frame_repeated_nack_report_hash);
}
/* Now create them over */
rlc_lte_sequence_analysis_channel_hash = g_hash_table_new(rlc_channel_hash_func, rlc_channel_equal);
rlc_lte_frame_sequence_analysis_report_hash = g_hash_table_new(rlc_frame_hash_func, rlc_frame_equal);
rlc_lte_repeated_nack_channel_hash = g_hash_table_new(rlc_channel_hash_func, rlc_channel_equal);
rlc_lte_frame_repeated_nack_report_hash = g_hash_table_new(rlc_frame_hash_func, rlc_frame_equal);
}
void proto_register_rlc_lte(void)
{
static hf_register_info hf[] =
{
/**********************************/
/* Items for decoding context */
{ &hf_rlc_lte_context_mode,
{ "RLC Mode",
"rlc-lte.mode", FT_UINT8, BASE_DEC, VALS(rlc_mode_vals), 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_context_direction,
{ "Direction",
"rlc-lte.direction", FT_UINT8, BASE_DEC, VALS(direction_vals), 0x0,
"Direction of message", HFILL
}
},
{ &hf_rlc_lte_context_priority,
{ "Priority",
"rlc-lte.priority", FT_UINT8, BASE_DEC, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_context_ueid,
{ "UEId",
"rlc-lte.ueid", FT_UINT16, BASE_DEC, 0, 0x0,
"User Equipment Identifier associated with message", HFILL
}
},
{ &hf_rlc_lte_context_channel_type,
{ "Channel Type",
"rlc-lte.channel-type", FT_UINT16, BASE_DEC, VALS(rlc_channel_type_vals), 0x0,
"Channel Type associated with message", HFILL
}
},
{ &hf_rlc_lte_context_channel_id,
{ "Channel ID",
"rlc-lte.channel-id", FT_UINT16, BASE_DEC, 0, 0x0,
"Channel ID associated with message", HFILL
}
},
{ &hf_rlc_lte_context_pdu_length,
{ "PDU Length",
"rlc-lte.pdu_length", FT_UINT16, BASE_DEC, 0, 0x0,
"Length of PDU (in bytes)", HFILL
}
},
{ &hf_rlc_lte_context_um_sn_length,
{ "UM Sequence number length",
"rlc-lte.um-seqnum-length", FT_UINT8, BASE_DEC, 0, 0x0,
"Length of UM sequence number in bits", HFILL
}
},
/* Transparent mode fields */
{ &hf_rlc_lte_tm_data,
{ "TM Data",
"rlc-lte.tm.data", FT_BYTES, BASE_NONE, 0, 0x0,
"Transparent Mode Data", HFILL
}
},
/* Unacknowledged mode fields */
{ &hf_rlc_lte_um_header,
{ "UM Header",
"rlc-lte.um.header", FT_STRING, BASE_NONE, NULL, 0x0,
"Unackowledged Mode Header", HFILL
}
},
{ &hf_rlc_lte_um_fi,
{ "Framing Info",
"rlc-lte.um.fi", FT_UINT8, BASE_HEX, VALS(framing_info_vals), 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_um_fixed_e,
{ "Extension",
"rlc-lte.um.fixed.e", FT_UINT8, BASE_HEX, VALS(fixed_extension_vals), 0x0,
"Extension in fixed part of UM header", HFILL
}
},
{ &hf_rlc_lte_um_sn,
{ "Sequence number",
"rlc-lte.um.sn", FT_UINT8, BASE_DEC, 0, 0x0,
"Unacknowledged Mode Sequence Number", HFILL
}
},
{ &hf_rlc_lte_um_fixed_reserved,
{ "Reserved",
"rlc-lte.um.reserved", FT_UINT8, BASE_DEC, 0, 0xe0,
"Unacknowledged Mode Fixed header reserved bits", HFILL
}
},
{ &hf_rlc_lte_um_data,
{ "UM Data",
"rlc-lte.um.data", FT_BYTES, BASE_NONE, 0, 0x0,
"Unacknowledged Mode Data", HFILL
}
},
{ &hf_rlc_lte_extension_part,
{ "Extension Part",
"rlc-lte.extension-part", FT_STRING, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_extension_e,
{ "Extension",
"rlc-lte.extension.e", FT_UINT8, BASE_HEX, VALS(extension_extension_vals), 0x0,
"Extension in extended part of the header", HFILL
}
},
{ &hf_rlc_lte_extension_li,
{ "Length Indicator",
"rlc-lte.extension.li", FT_UINT16, BASE_DEC, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_extension_padding,
{ "Padding",
"rlc-lte.extension.padding", FT_UINT8, BASE_HEX, 0, 0x0f,
"Extension header padding", HFILL
}
},
{ &hf_rlc_lte_am_header,
{ "AM Header",
"rlc-lte.am.header", FT_STRING, BASE_NONE, NULL, 0x0,
"Ackowledged Mode Header", HFILL
}
},
{ &hf_rlc_lte_am_data_control,
{ "Frame type",
"rlc-lte.am.frame_type", FT_UINT8, BASE_HEX, VALS(data_or_control_vals), 0x80,
"AM Frame Type (Control or Data)", HFILL
}
},
{ &hf_rlc_lte_am_rf,
{ "Re-segmentation Flag",
"rlc-lte.am.rf", FT_UINT8, BASE_HEX, VALS(resegmentation_flag_vals), 0x40,
"AM Re-segmentation Flag", HFILL
}
},
{ &hf_rlc_lte_am_p,
{ "Polling Bit",
"rlc-lte.am.p", FT_UINT8, BASE_HEX, VALS(polling_bit_vals), 0x20,
NULL, HFILL
}
},
{ &hf_rlc_lte_am_fi,
{ "Framing Info",
"rlc-lte.am.fi", FT_UINT8, BASE_HEX, VALS(framing_info_vals), 0x18,
"AM Framing Info", HFILL
}
},
{ &hf_rlc_lte_am_fixed_e,
{ "Extension",
"rlc-lte.am.fixed.e", FT_UINT8, BASE_HEX, VALS(fixed_extension_vals), 0x04,
"Fixed Extension Bit", HFILL
}
},
{ &hf_rlc_lte_am_fixed_sn,
{ "Sequence Number",
"rlc-lte.am.fixed.sn", FT_UINT16, BASE_DEC, 0, 0x03ff,
"AM Fixed Sequence Number", HFILL
}
},
{ &hf_rlc_lte_am_segment_lsf,
{ "Last Segment Flag",
"rlc-lte.am.segment.lsf", FT_UINT8, BASE_HEX, VALS(lsf_vals), 0x80,
NULL, HFILL
}
},
{ &hf_rlc_lte_am_segment_so,
{ "Segment Offset",
"rlc-lte.am.segment.offset", FT_UINT16, BASE_DEC, 0, 0x7fff,
NULL, HFILL
}
},
{ &hf_rlc_lte_am_data,
{ "AM Data",
"rlc-lte.am.data", FT_BYTES, BASE_NONE, 0, 0x0,
"Acknowledged Mode Data", HFILL
}
},
{ &hf_rlc_lte_am_cpt,
{ "Control PDU Type",
"rlc-lte.am.cpt", FT_UINT8, BASE_HEX, VALS(control_pdu_type_vals), 0x70,
"AM Control PDU Type", HFILL
}
},
{ &hf_rlc_lte_am_ack_sn,
{ "ACK Sequence Number",
"rlc-lte.am.ack-sn", FT_UINT16, BASE_DEC, 0, 0x0,
"Sequence Number we're next expecting to receive", HFILL
}
},
{ &hf_rlc_lte_am_e1,
{ "Extension bit 1",
"rlc-lte.am.e1", FT_UINT8, BASE_HEX, VALS(am_e1_vals), 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_am_e2,
{ "Extension bit 2",
"rlc-lte.am.e2", FT_UINT8, BASE_HEX, VALS(am_e2_vals), 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_am_nack_sn,
{ "NACK Sequence Number",
"rlc-lte.am.nack-sn", FT_UINT16, BASE_DEC, 0, 0x0,
"Negative Acknowledgement Sequence Number", HFILL
}
},
{ &hf_rlc_lte_am_so_start,
{ "SO Start",
"rlc-lte.am.so-start", FT_UINT16, BASE_DEC, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_am_so_end,
{ "SO End",
"rlc-lte.am.so-end", FT_UINT16, BASE_DEC, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_predefined_pdu,
{ "Predefined data",
"rlc-lte.predefined-data", FT_BYTES, BASE_NONE, 0, 0x0,
"Predefined test data", HFILL
}
},
{ &hf_rlc_lte_sequence_analysis,
{ "Sequence Analysis",
"rlc-lte.sequence-analysis", FT_STRING, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_ok,
{ "OK",
"rlc-lte.sequence-analysis.ok", FT_BOOLEAN, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_previous_frame,
{ "Previous frame for channel",
"rlc-lte.sequence-analysis.previous-frame", FT_FRAMENUM, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_expected_sn,
{ "Expected SN",
"rlc-lte.sequence-analysis.expected-sn", FT_UINT16, BASE_DEC, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_framing_info_correct,
{ "Frame info continued correctly",
"rlc-lte.sequence-analysis.framing-info-correct", FT_BOOLEAN, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_mac_retx,
{ "Frame retransmitted by MAC",
"rlc-lte.sequence-analysis.mac-retx", FT_BOOLEAN, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_retx,
{ "Retransmitted frame",
"rlc-lte.sequence-analysis.retx", FT_BOOLEAN, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_skipped,
{ "Skipped frames",
"rlc-lte.sequence-analysis.skipped-frames", FT_BOOLEAN, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_repeated,
{ "Repeated frame",
"rlc-lte.sequence-analysis.repeated-frame", FT_BOOLEAN, BASE_NONE, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_sequence_analysis_repeated_nack,
{ "Repeated NACK",
"rlc-lte.sequence-analysis.repeated-nack", FT_UINT16, BASE_DEC, 0, 0x0,
NULL, HFILL
}
},
{ &hf_rlc_lte_header_only,
{ "RLC PDU Header only",
"rlc-lte.header-only", FT_UINT8, BASE_DEC, VALS(header_only_vals), 0x0,
NULL, HFILL
}
},
};
static gint *ett[] =
{
&ett_rlc_lte,
&ett_rlc_lte_um_header,
&ett_rlc_lte_am_header,
&ett_rlc_lte_extension_part,
&ett_rlc_lte_sequence_analysis
};
static enum_val_t sequence_analysis_vals[] = {
{"no-analysis", "No-Analysis", FALSE},
{"mac-only", "Only-MAC-frames", SEQUENCE_ANALYSIS_MAC_ONLY},
{"rlc-only", "Only-RLC-frames", SEQUENCE_ANALYSIS_RLC_ONLY},
{NULL, NULL, -1}
};
module_t *rlc_lte_module;
/* Register protocol. */
proto_rlc_lte = proto_register_protocol("RLC-LTE", "RLC-LTE", "rlc-lte");
proto_register_field_array(proto_rlc_lte, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* Allow other dissectors to find this one by name. */
register_dissector("rlc-lte", dissect_rlc_lte, proto_rlc_lte);
/* Register the tap name */
rlc_lte_tap = register_tap("rlc-lte");
/* Preferences */
rlc_lte_module = prefs_register_protocol(proto_rlc_lte, NULL);
prefs_register_enum_preference(rlc_lte_module, "do_sequence_analysis_am",
"Do sequence analysis for AM channels",
"Attempt to keep track of PDUs for AM channels, and point out problems",
&global_rlc_lte_am_sequence_analysis, sequence_analysis_vals, FALSE);
prefs_register_enum_preference(rlc_lte_module, "do_sequence_analysis",
"Do sequence analysis for UM channels",
"Attempt to keep track of PDUs for UM channels, and point out problems",
&global_rlc_lte_um_sequence_analysis, sequence_analysis_vals, FALSE);
prefs_register_bool_preference(rlc_lte_module, "call_pdcp_for_srb",
"Call PDCP dissector for SRB PDUs",
"Call PDCP dissector for signalling PDUs. Note that without reassembly, it can"
"only be called for complete PDus (i.e. not segmented over RLC)",
&global_rlc_lte_call_pdcp);
prefs_register_bool_preference(rlc_lte_module, "call_rrc_for_ccch",
"Call RRC dissector for CCCH PDUs",
"Call RRC dissector for CCCH PDUs",
&global_rlc_lte_call_rrc);
prefs_register_bool_preference(rlc_lte_module, "heuristic_rlc_lte_over_udp",
"Try Heuristic LTE-RLC over UDP framing",
"When enabled, use heuristic dissector to find RLC-LTE frames sent with "
"UDP framing",
&global_rlc_lte_heur);
prefs_register_bool_preference(rlc_lte_module, "header_only_mode",
"May see RLC headers only",
"When enabled, if data is not present, don't report as an error, but instead "
"add expert info to indicate that headers were ommitted",
&global_rlc_lte_headers_expected);
register_init_routine(&rlc_lte_init_protocol);
}
void
proto_reg_handoff_rlc_lte(void)
{
static dissector_handle_t rlc_lte_handle;
if (!rlc_lte_handle) {
rlc_lte_handle = find_dissector("rlc-lte");
/* Add as a heuristic UDP dissector */
heur_dissector_add("udp", dissect_rlc_lte_heur, proto_rlc_lte);
}
}
|