aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rsl.c
blob: 10d66b181d570766047baf1a0c2870e9b27175b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
/* packet-rsl.c
 * Routines for Radio Signalling Link (RSL) dissection.
 *
 * Copyright 2007, Anders Broman <anders.broman@ericsson.com>
 *
 * $Id$
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * Copied from packet-cops.c
 *
 * 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.
 *
 * REF: 3GPP TS 48.058 version 6.1.0 Release 6
 * http://www.3gpp.org/ftp/Specs/html-info/48058.htm
 *
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include <epan/packet.h>
#include <epan/proto.h>
#include <epan/lapd_sapi.h>

#include "packet-gsm_a.h"

/* Initialize the protocol and registered fields */
static int proto_rsl		= -1;

static int hf_rsl_msg_type			= -1;
static int hf_rsl_T_bit				= -1;
static int hf_rsl_msg_dsc			= -1;
static int hf_rsl_ie_id				= -1;
static int hf_rsl_ie_length			= -1;
static int hf_rsl_ch_no_Cbits		= -1;
static int hf_rsl_ch_no_TN			= -1;

static int hf_rsl_acc_delay			= -1;
static int hf_rsl_rach_slot_cnt		= -1;
static int hf_rsl_rach_busy_cnt		= -1;
static int hf_rsl_rach_acc_cnt		= -1;
static int hf_rsl_req_ref_ra		= -1;
static int hf_rsl_req_ref_T1prim	= -1;
static int hf_rsl_req_ref_T3		= -1;
static int hf_rsl_req_ref_T2		= -1;
static int hf_rsl_timing_adv		= -1;
static int hf_rsl_ho_ref			= -1;
static int hf_rsl_ms_power_lev		= -1;
static int hf_rsl_ms_fpc			= -1;
static int hf_rsl_act_timing_adv	= -1;
static int hf_rsl_power_lev			= -1;
static int hf_rsl_phy_ctx			= -1;
static int hf_rsl_na				= -1;
static int hf_rsl_ch_type			= -1;
static int hf_rsl_prio				= -1;
static int hf_rsl_sapi				= -1;
static int hf_rsl_rbit				= -1;
static int hf_rsl_a3a2				= -1;
static int hf_rsl_a1_0				= -1;
static int hf_rsl_a1_1				= -1;
static int hf_rsl_a1_2				= -1;
static int hf_rsl_epc_mode			= -1;
static int hf_rsl_bs_fpc_epc_mode	= -1;
static int hf_rsl_bs_power			= -1;
static int hf_rsl_cm_dtxd			= -1;
static int hf_rsl_cm_dtxu			= -1;
static int hf_rsl_alg_id			= -1;
static int hf_rsl_key				= -1;
static int hf_rsl_cause				= -1;
static int hf_rsl_rel_mode			= -1;
static int hf_rsl_interf_band		= -1;
static int hf_rsl_meas_res_no		= -1;
static int hf_rsl_extension_bit		= -1;
static int hf_rsl_dtxd				= -1;
static int hf_rsl_rxlev_full_up		= -1;
static int hf_rsl_rxlev_sub_up		= -1;
static int hf_rsl_rxqual_full_up	= -1;
static int hf_rsl_rxqual_sub_up		= -1;
static int hf_rsl_class				= -1;
static int hf_rsl_paging_grp		= -1;
static int hf_rsl_paging_load		= -1;
static int hf_rsl_sys_info_type		= -1;
static int hf_rsl_timing_offset		= -1;
static int hf_rsl_ch_needed			= -1;
static int hf_rsl_emlpp_prio		= -1;

/* Initialize the subtree pointers */
static int ett_rsl = -1;
static int ett_ie_link_id = -1;
static int ett_ie_act_type = -1;
static int ett_ie_bs_power = -1;
static int ett_ie_ch_id = -1;
static int ett_ie_ch_mode = -1;
static int ett_ie_enc_inf = -1;
static int ett_ie_ch_no = -1;
static int ett_ie_frame_no = -1;
static int ett_ie_ho_ref = -1;
static int ett_ie_l1_inf = -1;
static int ett_ie_L3_inf = -1;
static int ett_ie_ms_id = -1;
static int ett_ie_ms_pow = -1;
static int ett_ie_phy_ctx = -1;
static int ett_ie_paging_grp = -1;
static int ett_ie_paging_load = -1;
static int ett_ie_access_delay = -1;
static int ett_ie_rach_load = -1;
static int ett_ie_req_ref = -1;
static int ett_ie_rel_mode = -1;
static int ett_ie_resource_inf = -1;
static int ett_ie_rlm_cause	=-1;
static int ett_ie_staring_time = -1;
static int ett_ie_timing_adv = -1;
static int ett_ie_uplik_meas = -1;
static int ett_ie_full_imm_ass_inf = -1;
static int ett_ie_ms_timing_offset = -1;
static int ett_ie_err_msg = -1;
static int ett_ie_full_bcch_inf = -1;
static int ett_ie_ch_needed = -1;
static int ett_ie_emlpp_prio = -1;
static int ett_ie_main_ch_ref = -1;
static int ett_ie_multirate_conf = -1;
static int ett_ie_cause = -1;
static int ett_ie_meas_res_no = -1;
static int ett_ie_message_id = -1;
static int ett_ie_sys_info_type = -1;

proto_tree *top_tree;
dissector_handle_t gsm_a_ccch_handle = NULL;
dissector_handle_t gsm_a_dtap_handle = NULL;

/* Forward declarations */
static int dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);

static const true_false_string rsl_t_bit_vals = {
  "Considered transparent by BTS",
  "Not considered transparent by BTS"
};

static const true_false_string rsl_na_vals = {
  "Not Applicable",
  "Applicable"
};

static const true_false_string rsl_extension_bit_value = {
  "Extension",
  "No Extension"
};

/*
 * 9.1 Message discriminator
 */
static const value_string rsl_msg_disc_vals[] = {
	{  0x00,		"Reserved" },
	{  0x01,		"Radio Link Layer Management messages" },
	{  0x04,		"Dedicated Channel Management messages" },
	{  0x06,		"Common Channel Management messages" },
	{  0x08,		"TRX Management messages" },
	{  0x16,		"Location Services messages" },
	{ 0,			NULL }
};
/*
 * 9.2 MESSAGE TYPE
 */
#define RSL_MSG_TYPE_DATA_REQ		1
#define RSL_MSG_TYPE_DATA_IND		2
#define RSL_MSG_TYPE_ERROR_IND		3
#define RSL_MSG_TYPE_EST_REQ		4
#define RSL_MSG_TYPE_EST_CONF		5
#define RSL_MSG_EST_IND				6
#define RSL_MSG_REL_REQ				7
#define RSL_MSG_REL_CONF			8
#define RSL_MSG_REL_IND				9
#define RSL_MSG_UNIT_DATA_REQ		10
/* Common Channel Management/TRX Management messages */
#define RSL_MSG_BCCH_INFO			17
#define RSL_MSG_CCCH_LOAD_IND		18
#define RSL_MSG_CHANRQD				19
#define RSL_MSG_DELETE_IND			20
#define RSL_MSG_PAGING_CMD			21
#define RSL_MSG_IMM_ASS_CMD			22
#define RSL_MSG_SMS_BC_REQ			23	/* 8.5.7 */
#define RSL_MSG_RF_RES_IND			25	/* 8.6.1 */
#define RSL_MSG_SACCH_FILL			26	/* 8.6.2 */

#define RSL_MSG_OVERLOAD			27	/* 8.6.3 */
#define RSL_MSG_ERROR_REPORT		28	/* 8.6.4 */
#define RSL_MSG_SMS_BC_CMD			29	/* 8.5.8 */
#define RSL_MSG_CBCH_LOAD_IND		30	/* 8.5.9 */
#define RSL_MSG_NOT_CMD				31	/* 8.5.10 */

/* 0 0 1 - - - - - Dedicated Channel Management messages: */
#define RSL_MSG_CHAN_ACTIV			33
#define RSL_MSG_CHAN_ACTIV_ACK		34
#define RSL_MSG_CHAN_ACTIV_N_ACK	35
#define RSL_MSG_CONN_FAIL			36
#define RSL_MSG_DEACTIVATE_SACCH	37
 
#define RSL_MSG_ENCR_CMD				38	/* 8.4.6 */
#define RSL_MSG_HANDODET				39	/* 8.4.7 */
#define RSL_MSG_MEAS_RES				40	/* 8.4.8 */
#define RSL_MSG_MODE_MODIFY_REQ			41	/* 8.4.9 */
#define RSL_MSG_MODE_MODIFY_ACK			42	/* 8.4.10 */
#define RSL_MSG_MODE_MODIFY_NACK		43	/* 8.4.11 */
#define RSL_MSG_PHY_CONTEXT_REQ			44	/* 8.4.12 */
#define RSL_MSG_PHY_CONTEXT_CONF		45	/* 8.4.13 */
#define RSL_MSG_RF_CHAN_REL				46	/* 8.4.14 */
#define RSL_MSG_MS_POWER_CONTROL		47	/* 8.4.15 */
#define RSL_MSG_BS_POWER_CONTROL		48	/* 8.4.16 */
#define RSL_MSG_PREPROC_CONFIG			49	/* 8.4.17 */
#define RSL_MSG_PREPROC_MEAS_RES		50	/* 8.4.18 */
#define RSL_MSG_RF_CHAN_REL_ACK			51	/* 8.4.19 */
#define RSL_MSG_SACCH_INFO_MODIFY		52	/* 8.4.20 */
#define RSL_MSG_TALKER_DET				53	/* 8.4.21 */
#define RSL_MSG_LISTENER_DET			54	/* 8.4.22 */
#define RSL_MSG_REMOTE_CODEC_CONF_REP	55	/* 8.4.23 */
#define RSL_MSG_R_T_D_REP				56	/* 8.4.24 */
#define RSL_MSG_PRE_HANDO_NOTIF			57	/* 8.4.25 */
#define RSL_MSG_MR_CODEC_MOD_REQ		58	/* 8.4.26 */
#define RSL_MSG_MR_CODEC_MOD_ACK		59	/* 8.4.27 */
#define RSL_MSG_MR_CODEC_MOD_NACK		60	/* 8.4.28 */
#define RSL_MSG_MR_CODEC_MOD_PER		61	/* 8.4.29 */
#define RSL_MSG_TFO_REP					62	/* 8.4.30 */
#define RSL_MSG_TFO_MOD_REQ				63	/* 8.4.31 */
	/* 	0 1 - - - - - - Location Services messages: */
#define RSL_MSG_LOC_INF					65	/* 8.7.1 */


static const value_string rsl_msg_type_vals[] = {
	  /* 	0 0 0 0 - - - - Radio Link Layer Management messages: */
	{  0x01,	"DATA REQuest" },								/* 8.3.1 */
	{  0x02,	"DATA INDication" },							/* 8.3.2 */
	{  0x03,	"ERROR INDication" },							/* 8.3.3 */
	{  0x04,	"ESTablish REQuest" },							/* 8.3.4 */
	{  0x05,	"ESTablish CONFirm" },							/* 8.3.5 */
	{  0x06,	"ESTablish INDication" },						/* 8.3.6 */
	{  0x07,	"RELease REQuest" },							/* 8.3.7 */
	{  0x08,	"RELease CONFirm" },							/* 8.3.8 */
	{  0x09,	"RELease INDication" },							/* 8.3.9 */
	{  0x0a,	"UNIT DATA REQuest" },							/* 8.3.10 */
	/* 0 0 0 1 - - - - Common Channel Management/TRX Management messages: */
	{  0x11,	"BCCH INFOrmation" },							/* 8.5.1 */
	{  0x12,	"CCCH LOAD INDication" },						/* 8.5.2 */
	{  0x13,	"CHANnel ReQuireD" },							/* 8.5.3 */
	{  0x14,	"DELETE INDication" },							/* 8.5.4 */
	{  0x15,	"PAGING CoMmanD" },								/* 8.5.5 */
	{  0x16,	"IMMEDIATE ASSIGN COMMAND" },					/* 8.5.6 */
	{  0x17,	"SMS BroadCast REQuest" },						/* 8.5.7 */
	{  0x19,	"RF RESource INDication" },						/* 8.6.1 */
	{  0x1a,	"SACCH FILLing" },								/* 8.6.2 */
	{  0x1b,	"OVERLOAD" },									/* 8.6.3 */
	{  0x1c,	"ERROR REPORT" },								/* 8.6.4 */
	{  0x1d,	"SMS BroadCast CoMmanD" },						/* 8.5.8 */
	{  0x1e,	"CBCH LOAD INDication" },						/* 8.5.9 */
	{  0x1f,	"NOTification CoMmanD" },						/* 8.5.10 */
	/* 0 0 1 - - - - - Dedicated Channel Management messages: */
	{  0x21,	"CHANnel ACTIVation" },							/* 8.4.1 */
	{  0x22,	"CHANnel ACTIVation ACKnowledge" },				/* 8.4.2 */
	{  0x23,	"CHANnel ACTIVation Negative ACK" },			/* 8.4.3 */
	{  0x24,	"CONNection FAILure" },							/* 8.4.4 */
	{  0x25,	"DEACTIVATE SACCH" },							/* 8.4.5 */
	{  0x26,	"ENCRyption CoMmanD" },							/* 8.4.6 */
	{  0x27,	"HANDOver DETection" },							/* 8.4.7 */
	{  0x28,	"MEASurement RESult" },							/* 8.4.8 */
	{  0x29,	"MODE MODIFY REQuest" },						/* 8.4.9 */
	{  0x2a,	"MODE MODIFY ACKnowledge" },					/* 8.4.10 */
	{  0x2b,	"MODE MODIFY Negative ACKnowledge" },			/* 8.4.11 */
	{  0x2c,	"PHYsical CONTEXT REQuest" },					/* 8.4.12 */
	{  0x2d,	"PHYsical CONTEXT CONFirm" },					/* 8.4.13 */
	{  0x2e,	"RF CHANnel RELease" },							/* 8.4.14 */
	{  0x2f,	"MS POWER CONTROL" },							/* 8.4.15 */
	{  0x30,	"BS POWER CONTROL" },							/* 8.4.16 */
	{  0x31,	"PREPROCess CONFIGure" },						/* 8.4.17 */
	{  0x32,	"PREPROCessed MEASurement RESult" },			/* 8.4.18 */
	{  0x33,	"RF CHANnel RELease ACKnowledge" },				/* 8.4.19 */
	{  0x34,	"SACCH INFO MODIFY" },							/* 8.4.20 */
	{  0x35,	"TALKER DETection" },							/* 8.4.21 */
	{  0x36,	"LISTENER DETection" },							/* 8.4.22 */
	{  0x37,	"REMOTE CODEC CONFiguration REPort" },			/* 8.4.23 */
	{  0x38,	"Round Trip Delay REPort" },					/* 8.4.24 */
	{  0x39,	"PRE-HANDOver NOTIFication" },					/* 8.4.25 */
	{  0x3a,	"MultiRate CODEC MODification REQest" },		/* 8.4.26 */
	{  0x3b,	"MultiRate CODEC MOD ACKnowledge" },			/* 8.4.27 */
	{  0x3c,	"MultiRate CODEC MOD Negative ACKnowledge" },	/* 8.4.28 */
	{  0x3d,	"MultiRate CODEC MOD PERformed" },				/* 8.4.29 */
	{  0x3e,	"TFO REPort" },									/* 8.4.30 */
	{  0x3f,	"TFO MODification REQuest" },					/* 8.4.31 */
	/* 	0 1 - - - - - - Location Services messages: */
	{  0x41,	"Location Information" },						/* 8.7.1 */
	{ 0,		NULL }
};

#define RSL_IE_CH_NO			1
#define RSL_IE_LINK_ID			2
#define RSL_IE_ACT_TYPE			3
#define RSL_IE_BS_POW			4
#define RSL_IE_CH_ID			5
#define RSL_IE_CH_MODE			6
#define RSL_IE_ENC_INF			7
#define RSL_IE_FRAME_NO			8
#define RSL_IE_HO_REF			9
#define RSL_IE_L1_INF			10
#define RSL_IE_L3_INF			11
#define RSL_IE_MS_ID			12
#define RSL_IE_MS_POW			13
#define RSL_IE_PAGING_GRP		14
#define RSL_IE_PAGING_LOAD		15
#define RSL_IE_PHY_CTX			16
#define RSL_IE_ACCESS_DELAY		17
#define RSL_IE_RACH_LOAD		18
#define RSL_IE_REQ_REF			19
#define RSL_IE_REL_MODE			20
#define RSL_IE_RESOURCE_INF		21
#define RSL_IE_RLM_CAUSE		22
#define RSL_IE_STARTING_TIME	23
#define RSL_IE_TIMING_ADV		24
#define RSL_IE_UPLINK_MEAS		25
#define RSL_IE_CAUSE			26
#define RSL_IE_MEAS_RES_NO		27
#define RSL_IE_MESSAGE_ID		28

#define RSL_IE_SYS_INFO_TYPE	30




#define RSL_IE_FULL_IMM_ASS_INF			35

#define RSL_IE_FULL_MS_TIMING_OFFSET	37
#define RSL_IE_ERR_MSG					38
#define RSL_IE_FULL_BCCH_INF			39
#define RSL_IE_CH_NEEDED				40


#define RSL_IE_EMLPP_PRIO				51
#define RSL_IE_MAIN_CH_REF				53
#define RSL_IE_MULTIRATE_CONF			54
	
static const value_string rsl_ie_type_vals[] = {
	{  0x01,	"Channel Number" },				/*  9.3.1 */
	{  0x02,	"Link Identifier" },			/*  9.3.2 */
	{  0x03,	"Activation Type" },			/*  9.3.3 */
	{  0x04,	"BS Power" },					/*  9.3.4 */
	{  0x05,	"Channel Identification" },		/*  9.3.5 */
	{  0x06,	"Channel Mode" },				/*  9.3.6 */
	{  0x07,	"Encryption Information" },		/*  9.3.7 */
	{  0x08,	"Frame Number" },				/*  9.3.8 */
	{  0x09,	"Handover Reference" },			/*  9.3.9 */
	{  0x0a,	"L1 Information" },				/*  9.3.10 */
	{  0x0b,	"L3 Information" },				/*  9.3.11 */
	{  0x0c,	"MS Identity" },				/*  9.3.12 */
	{  0x0d,	"MS Power" },					/*  9.3.13 */
	{  0x0e,	"Paging Group" },				/*  9.3.14 */
	{  0x0f,	"Paging Load" },				/*  9.3.15 */
	{  0x10,	"Physical Context" },			/*  9.3.16 */
	{  0x11,	"Access Delay" },				/*  9.3.17 */
	{  0x12,	"RACH Load" },					/*  9.3.18 */
	{  0x13,	"Request Reference" },			/*  9.3.19 */
	{  0x14,	"Release Mode" },				/*  9.3.20 */
	{  0x15,	"Resource Information" },		/*  9.3.21 */
	{  0x16,	"RLM Cause" },					/*  9.3.22 */
	{  0x17,	"Starting Time" },				/*  9.3.23 */
	{  0x18,	"Timing Advance" },				/*  9.3.24 */
	{  0x19,	"Uplink Measurements" },		/*  9.3.25 */
	{  0x1a,	"Cause" },						/*  9.3.26 */
	{  0x1b,	"Measurement result number" },	/*  9.3.27 */
	{  0x1c,	"Message Identifier" },			/*  9.3.28 */
	{  0x1d,	"reserved" },					/*  */
	{  0x1e,	"System Info Type" },			/*  9.3.30 */
	{  0x1f,	"MS Power Parameters" },		/*  9.3.31 */
	{  0x20,	"BS Power Parameters" },		/*  9.3.32 */
	{  0x21,	"Pre-processing Parameters" },	/*  9.3.33 */
	{  0x22,	"Pre-processed Measurements" },	/*  9.3.34 */
	{  0x23,	"reserved" },					/*  */
	{  0x24,	"SMSCB Information" },			/*  9.3.36 */
	{  0x25,	"MS Timing Offset" },			/*  9.3.37 */
	{  0x26,	"Erroneous Message" },			/*  9.3.38 */
	{  0x27,	"Full BCCH Information" },		/*  9.3.39 */
	{  0x28,	"Channel Needed" },				/*  9.3.40 */
	{  0x29,	"CB Command type" },			/*  9.3.41 */
	{  0x2a,	"SMSCB message" },				/*  9.3.42 */
	{  0x2b,	"Full Immediate Assign Info" },	/*  9.3.35 */
	{  0x2c,	"SACCH Information" },			/*  9.3.29 */
	{  0x2d,	"CBCH Load Information" },		/*  9.3.43 */
	{  0x2e,	"SMSCB Channel Indicator" },	/*  9.3.44 */
	{  0x2f,	"Group call reference" },		/*  9.3.45 */
	{  0x30,	"Channel description" },		/*  9.3.46 */
	{  0x31,	"NCH DRX information" },		/*  9.3.47 */
	{  0x32,	"Command indicator" },			/*  9.3.48 */
	{  0x33,	"eMLPP Priority" },				/*  9.3.49 */
	{  0x34,	"UIC" },						/*  9.3.50 */
	{  0x35,	"Main channel reference" },		/*  9.3.51 */
	{  0x36,	"MultiRate configuration" },	/*  9.3.52 */
	{  0x37,	"MultiRate Control" },			/*  9.3.53 */
	{  0x38,	"Supported Codec Types" },		/*  9.3.54 */
	{  0x39,	"Codec Configuration" },		/*  9.3.55 */
	{  0x3a,	"Round Trip Delay" },			/*  9.3.56 */
	{  0x3b,	"TFO Status" },					/*  9.3.57 */
	{  0x3c,	"LLP APDU" },					/*  9.3.58 */
	{  0x3d,	"TFO transparent container" },	/*  9.3.59 */
	/*
			0 0 1 1 1 1 1 0
			to
			1 1 1 0 1 1 1 1
			Reserved for future use

			1 1 1 1 0 0 0 0
			to
			1 1 1 1 1 1 1 1
			Not used

	*/
	{ 0,			NULL }
};


/*
C5	C4	C3	C2	C1
0	0	0	0	1	Bm + ACCH's
0	0	0	1	T	Lm + ACCH's
0	0	1	T	T	SDCCH/4 + ACCH
0	1	T	T	T	SDCCH/8 + ACCH
1	0	0	0	0	BCCH
1	0	0	0	1	Uplink CCCH (RACH)
1	0	0	1	0	Downlink CCCH (PCH + AGCH)
*/
static const value_string rsl_ch_no_Cbits_vals[] = {
	{  0x01,	"Bm + ACCH's" },
	{  0x03,	"Lm + ACCH's" },
	{  0x03,	"Lm + ACCH's" },
	{  0x04,	"SDCCH/4 + ACCH" },
	{  0x05,	"SDCCH/4 + ACCH" },
	{  0x06,	"SDCCH/4 + ACCH" },
	{  0x07,	"SDCCH/4 + ACCH" },
	{  0x08,	"SDCCH/8 + ACCH" },
	{  0x09,	"SDCCH/8 + ACCH" },
	{  0x0a,	"SDCCH/8 + ACCH" },
	{  0x0b,	"SDCCH/8 + ACCH" },
	{  0x0c,	"SDCCH/8 + ACCH" },
	{  0x0d,	"SDCCH/8 + ACCH" },
	{  0x0e,	"SDCCH/8 + ACCH" },
	{  0x0f,	"SDCCH/8 + ACCH" },
	{  0x10,	"BCCH" },
	{  0x11,	"Uplink CCCH (RACH)" },
	{  0x12,	"Downlink CCCH (PCH + AGCH)" },
	{ 0,			NULL }
};

/* 9.3.1 Channel number			9.3.1	M TV 2 */
static int
dissect_rsl_ie_ch_no(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_CH_NO)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"Channel number IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ch_no);


	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* C-bits */
	proto_tree_add_item(ie_tree, hf_rsl_ch_no_Cbits, tvb, offset, 1, FALSE);
	/* TN is time slot number, binary represented as in 3GPP TS 45.002.
	 * 3 Bits
	 */
	proto_tree_add_item(ie_tree, hf_rsl_ch_no_TN, tvb, offset, 1, FALSE);
	offset++;
	return offset;
}

static const value_string rsl_ch_type_vals[] = {
	{  0x00,	"Main signalling channel (FACCH or SDCCH)" },
	{  0x01,	"SACCH" },
	{ 0,			NULL }
};

static const value_string rsl_prio_vals[] = {
	{  0x00,	"Normal Priority" },
	{  0x01,	"High Priority" },
	{  0x02,	"Low Priority" },
	{ 0,			NULL }
};

/*
 * 9.3.2 Link Identifier M TV 2
 */
static int
dissect_rsl_ie_link_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 octet;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_LINK_ID)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"Link Identifier IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_link_id);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	octet = tvb_get_guint8(tvb,offset);

	if((octet&0x20) == 0x20){
		/* Not applicable */
		proto_tree_add_item(ie_tree, hf_rsl_na, tvb, offset, 1, FALSE);
		return offset++;
	}
	/* channel type */
	proto_tree_add_item(ie_tree, hf_rsl_ch_type, tvb, offset, 1, FALSE);
	/* NA - Not applicable */
	proto_tree_add_item(ie_tree, hf_rsl_na, tvb, offset, 1, FALSE);
	/* Priority */
	proto_tree_add_item(ie_tree, hf_rsl_prio, tvb, offset, 1, FALSE);
	/* SAPI
	 * The SAPI field contains the SAPI value as defined in 3GPP TS 44.005.
	 */
	proto_tree_add_item(ie_tree, hf_rsl_sapi, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/*
 * 9.3.3 Activation Type
 */
static const true_false_string rsl_rbit_vals = {
  "Reactivation",
  "Initial activation"
};

static const value_string rsl_a3a2_vals[] = {
	{  0x00,	"Activation related to intra-cell channel change" },
	{  0x01,	"Activation related to inter-cell channel change (handover)" },
	{  0x02,	"Activation related to secondary channels" },
	{ 0,			NULL }
};

static const true_false_string rsl_a1_0_vals = {
  "related to normal assignment procedure",
  "related to immediate assignment procedure"
};

static const true_false_string rsl_a1_1_vals = {
  "related to synchronous handover procedure",
  "related to asynchronous handover procedure"
};

static const true_false_string rsl_a1_2_vals = {
  "related to multislot configuration",
  "related to additional assignment procedure"
};

static int
dissect_rsl_ie_act_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;
	guint	octet;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_ACT_TYPE)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"Activation Type IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_act_type);


	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* The R bit indicates if the procedure is an initial activation or a reactivation. */
	proto_tree_add_item(ie_tree, hf_rsl_rbit, tvb, offset, 1, FALSE);

	/* The A-bits indicate the type of activation, which defines the access procedure 
	 * and the operation of the data link layer
	 */
	octet = (tvb_get_guint8(tvb,offset) & 0x06)>>1;
	proto_tree_add_item(ie_tree, hf_rsl_a3a2, tvb, offset, 1, FALSE);
	switch(octet){
	case 0:
		/* Activation related to intra-cell channel change */
		proto_tree_add_item(ie_tree, hf_rsl_a1_0, tvb, offset, 1, FALSE);
		break;
	case 1:
		/* Activation related to inter-cell channel change (handover) */
		proto_tree_add_item(ie_tree, hf_rsl_a1_1, tvb, offset, 1, FALSE);
		break;
	case 2:
		/* Activation related to secondary channels */
		proto_tree_add_item(ie_tree, hf_rsl_a1_2, tvb, offset, 1, FALSE);
		break;
	default:
		break;
	}
	offset++;

	return offset;
}
/*
 * 9.3.4 BS Power
 */

static const true_false_string rsl_epc_mode_vals = {
  "Channel in EPC mode",
  "Channel not in EPC mode"
};

static const true_false_string rsl_fpc_epc_mode_vals = {
  "Fast Power Control in use",
  "Fast Power Control not in use"
};

static const value_string rsl_rlm_bs_power_vals[] = {
	{  0x00,	"Pn" },
	{  0x01,	"Pn - 2 dB" },
	{  0x02,	"Pn - 4 dB" },
	{  0x03,	"Pn - 6 dB" },
	{  0x04,	"Pn - 8 dB" },
	{  0x05,	"Pn - 10 dB" },
	{  0x06,	"Pn - 12 dB" },
	{  0x07,	"Pn - 14 dB" },
	{  0x08,	"Pn - 16 dB" },
	{  0x09,	"Pn - 18 dB" },
	{  0x0a,	"Pn - 20 dB" },
	{  0x0b,	"Pn - 22 dB" },
	{  0x0c,	"Pn - 24 dB" },
	{  0x0d,	"Pn - 26 dB" },
	{  0x0e,	"Pn - 28 dB" },
	{  0x0f,	"Pn - 30 dB" },
	{ 0,			NULL }
};

static int
dissect_rsl_ie_bs_power(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_BS_POW)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"BS Power IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_bs_power);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* EPC mode */
	proto_tree_add_item(ie_tree, hf_rsl_epc_mode, tvb, offset, 1, FALSE);
	/* FPC_EPC mode */
	proto_tree_add_item(ie_tree, hf_rsl_bs_fpc_epc_mode, tvb, offset, 1, FALSE);

	/* The Power Level field (octet 2) indicates the number of 2 dB steps by 
	 * which the power shall be reduced from its nominal value, Pn, 
	 * set by the network operator to adjust the coverage. 
	 * Thus the Power Level values correspond to the following powers (relative to Pn):
	 */
	proto_tree_add_item(ie_tree, hf_rsl_bs_power, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}
/*
 * 9.3.5 Channel Identification
 */
static int
dissect_rsl_ie_ch_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 length;
	int ie_offset;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_CH_ID)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Channel Identification IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ch_id);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb, offset);
	proto_item_set_len(ti, length+2);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
 	offset++;

	ie_offset = offset;

	/* 3GPP TS 44.018 "Channel Description" */
	de_rr_ch_dsc(tvb, ie_tree, offset, length, NULL, 0);
	/*
	 * The 3GPP TS 24.008 "Mobile Allocation" shall for compatibility reasons be
	 * included but empty, i.e. the length shall be zero.
	 */
	return ie_offset + length;
}
/*
 * 9.3.6 Channel Mode
 */

static const true_false_string rsl_dtx_vals = {
  "DTX is applied",
  "DTX is not applied"
};

static int
dissect_rsl_ie_ch_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 length;
	int ie_offset;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_CH_MODE)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Channel Mode IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ch_mode);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb, offset);
	proto_item_set_len(ti, length+2);
	offset++;
	ie_offset = offset;
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
 	offset++;

	/* The DTX bits of octet 3 indicate whether DTX is applied
	 * DTXd indicates use of DTX in the downlink direction (BTS to MS) and 
	 * DTXu indicates use of DTX in the uplink direction (MS to BTS).
	 */
	proto_tree_add_item(ie_tree, hf_rsl_cm_dtxd, tvb, offset, 1, FALSE);
	proto_tree_add_item(ie_tree, hf_rsl_cm_dtxu, tvb, offset, 1, FALSE);
	offset++;
	/* The "Speech or data indicator" field (octet 4) */

	return ie_offset + length;

}

/*
 * 9.3.7 Encryption information
 */

/* The Algorithm Identifier field (octet 3) indicates the relevant ciphering algorithm. It is coded as: */
static const value_string rsl_algorithm_id_vals[] = {
	{  0x00,	"Pn" },
	{  0x00,	"Reserved" },
	{  0x01,	"No encryption shall be used" },
	{  0x02,	"GSM encryption algorithm version 1 (A5/1)" },
	{  0x03,	"GSM A5/2" },
	{  0x04,	"GSM A5/3" },
	{  0x05,	"GSM A5/4" },
	{  0x06,	"GSM A5/5" },
	{  0x07,	"GSM A5/6" },
	{  0x08,	"GSM A5/7" },
	{ 0,			NULL }
};

static int
dissect_rsl_ie_enc_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 length;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_ENC_INF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Encryption information IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_enc_inf);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb, offset);
	proto_item_set_len(ti, length+2);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
 	offset++;

	/* Algorithm Identifier field (octet 3) */

	proto_tree_add_item(ie_tree, hf_rsl_alg_id, tvb, offset, 1, FALSE);

	/* key */
	proto_tree_add_item(ie_tree, hf_rsl_key, tvb, offset+1, length -1, FALSE);

	return offset + length;

}
/*
 * 9.3.8 Frame Number
 */
static int
dissect_rsl_ie_frame_no(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_FRAME_NO)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,3,"Frame Number IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_frame_no);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T1prim, tvb, offset, 1, FALSE);
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T3, tvb, offset, 2, FALSE);
	offset++;
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T2, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/*
 * 9.3.9 Handover reference
 */
static int
dissect_rsl_ie_ho_ref(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_HO_REF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"Handover reference IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ho_ref);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	
	/* Hand-over reference */
	proto_tree_add_item(ie_tree, hf_rsl_ho_ref, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/*
 * 9.3.10 L1 Information
 */

static int
dissect_rsl_ie_l1_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_L1_INF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset, 3,"L1 Information IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_l1_inf);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* Octets 2-3 contain the L1 header information of SACCH blocks.
	 * The information fields and codings are as defined in 3GPP TS 44.004.
	 */
	/* Power level */
	proto_tree_add_item(ie_tree, hf_rsl_ms_power_lev, tvb, offset, 1, FALSE);
	/* FPC */
	proto_tree_add_item(ie_tree, hf_rsl_ms_fpc, tvb, offset, 1, FALSE);
	offset++;
	/* Actual Timing Advance */
	proto_tree_add_item(ie_tree, hf_rsl_act_timing_adv, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/*
 * 9.3.11 L3 Information			9.3.11	M TLV >=3
 *
 * This element contains a link layer service data unit (L3 message).
 * It is used to forward a complete L3 message as specified in
 * 3GPP TS 24.008 or 3GPP TS 44.018 between BTS and BSC.
 */
static int
dissect_rsl_ie_L3_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	tvbuff_t	*next_tvb;
	guint16 length;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_L3_INF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"L3 Information IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_L3_inf);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_ntohs(tvb, offset);
	proto_item_set_len(ti, length+3);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 2, FALSE);
 	offset= offset +2;

	/* Link Layer Service Data Unit (i.e. a layer 3 message
	 * as defined in 3GPP TS 24.008 or 3GPP TS 44.018)
	 */

	proto_tree_add_text(ie_tree, tvb,offset,length,"Link Layer Service Data Unit ( L3 Message)");
	next_tvb = tvb_new_subset(tvb, offset, length, length);
	call_dissector(gsm_a_dtap_handle, next_tvb, pinfo, top_tree);

	offset = offset + length;

	return offset;
 }

/*
 * 9.3.12 MS Identity
 */
static int
dissect_rsl_ie_ms_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint length;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_MS_ID)
			return offset;
	}
	ti = proto_tree_add_text(tree, tvb,offset,0,"MS Identity IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ms_id);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;

	de_mid(tvb, ie_tree, offset, length, NULL, 0);

	offset = offset + length;

	return offset;
}

static const true_false_string rsl_ms_fpc_epc_mode_vals = {
  "In use",
  "Not in use"
};
/*
 * 9.3.13 MS Power
 */
static int
dissect_rsl_ie_ms_pow(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_MS_POW)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset, 2,"MS Power IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ms_pow);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* MS power level */
	proto_tree_add_item(ie_tree, hf_rsl_ms_power_lev, tvb, offset, 1, FALSE);
	/* FPC */
	proto_tree_add_item(ie_tree, hf_rsl_ms_fpc, tvb, offset, 1, FALSE);
	/* Reserved */
	offset++;

	return offset;
}

/*
 * 9.3.14 Paging Group M TV 2 2
 */
static int
dissect_rsl_ie_paging_grp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_PAGING_GRP)
			return offset;
	}
	ti = proto_tree_add_text(tree, tvb,offset,2,"Paging Group IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_paging_grp);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* The Paging Group field (octet 2) contains the binary representation of the paging 
	 * group as defined in 3GPP TS 45.002.
	 */
	proto_tree_add_item(ie_tree, hf_rsl_paging_grp, tvb, offset, 1, FALSE);
	offset++;

	return offset;

}

/*
 * 9.3.15 Paging Load
 */
static int
dissect_rsl_ie_paging_load(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_PAGING_LOAD)
			return offset;
	}
	ti = proto_tree_add_text(tree, tvb,offset,3,"Paging Load IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_paging_load);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* 
	 * Paging Buffer Space.
	 */
	proto_tree_add_item(ie_tree, hf_rsl_paging_load, tvb, offset, 2, FALSE);
	offset = offset + 2;

	return offset;

}
/*
 * 9.3.16 Physical Context TLV
 */
static int
dissect_rsl_ie_phy_ctx(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint length;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_PHY_CTX)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Physical Context IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_phy_ctx);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;

	/*
	 * Physical Context Information:
	 *	The Physical Context Information field is not specified.
	 *	This information should not be analysed by BSC, but merely
	 *	forwarded from one TRX/channel to another.
	 */
	proto_tree_add_item(ie_tree, hf_rsl_phy_ctx, tvb, offset, length, FALSE);
	offset = offset + length;

	return offset;
}
/*
 * 9.3.17 Access Delay M TV 2
 */
static int
dissect_rsl_ie_access_delay(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_ACCESS_DELAY)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"Access Delay IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_access_delay);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	proto_tree_add_item(ie_tree, hf_rsl_acc_delay, tvb, offset, 1, FALSE);
	offset++;
	return offset;
}

/*
 * 9.3.18 RACH Load
 */

static int
dissect_rsl_ie_rach_load(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint length;
	guint8 ie_id;
	int ie_offset;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_RACH_LOAD)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"RACH Load IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_rach_load);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;
	ie_offset = offset;

	/*
	 * This element is used to carry information on the load of the RACH (Random Access Channel)
	 * associated with this CCCH timeslot. It is of variable length.
	 */
	/* 	RACH Slot Count */
	proto_tree_add_item(ie_tree, hf_rsl_rach_slot_cnt, tvb, offset, 2, FALSE);
	offset = offset +2;
	length = length -2;
	/* RACH Busy Count */
	proto_tree_add_item(ie_tree, hf_rsl_rach_busy_cnt, tvb, offset, 2, FALSE);
	offset = offset +2;
	length = length -2;

	/* RACH Access Count */
	proto_tree_add_item(ie_tree, hf_rsl_rach_acc_cnt, tvb, offset, 2, FALSE);
	offset = offset +2;
	length = length -2;

	/* Supplementary Information */
	if( length > 0){
		proto_tree_add_text(ie_tree, tvb, offset,length ,"Supplementary Information");
	}
	offset = ie_offset + length;

	return offset;
}

/*
 * 9.3.19 Request Reference M TV 4
 */
static int
dissect_rsl_ie_req_ref(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_REQ_REF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,4,"Request Reference IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_req_ref);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_ra, tvb, offset, 1, FALSE);
	offset++;
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T1prim, tvb, offset, 1, FALSE);
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T3, tvb, offset, 2, FALSE);
	offset++;
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T2, tvb, offset, 1, FALSE);
	offset++;
	return offset;
}

static const value_string rel_mode_vals[] = {
	{  0x00,	"Normal Release" },
	{  0x01,	"Local End Release" },
	{ 0,			NULL }
};

/*
 * 9.3.20 Release Mode				9.3.20	M TV 2
 */
static int
dissect_rsl_ie_rel_mode(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_REL_MODE)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,4,"Release Mode IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_rel_mode);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* 	The M bit is coded as follows:
	 * 0 normal release
	 * 1 local end release
	 */
	proto_tree_add_item(ie_tree, hf_rsl_rel_mode, tvb, offset, 1, FALSE);

	offset++;
	return offset;
}

static const value_string rsl_rlm_cause_vals[] = {
	{  0x00,	"reserved" },
	{  0x01,	"timer T200 expired (N200+1) times" },
	{  0x02,	"re-establishment request" },
	{  0x03,	"unsolicited UA response" },
	{  0x04,	"unsolicited DM response" },
	{  0x05,	"unsolicated DM response, multiple frame established state" },
	{  0x06,	"unsolicited supervisory response" },
	{  0x07,	"sequence error" },
	{  0x08,	"U-frame with incorrect parameters" },
	{  0x09,	"S-frame with incorrect parameters" },
	{  0x0a,	"I-frame with incorrect use of M bit" },
	{  0x0b,	"I-frame with incorrect length" },
	{  0x0c,	"frame not implemented" },
	{  0x0d,	"SABM command, multiple frame established state" },
	{  0x0e,	"SABM frame with information not allowed in this state" },
	{ 0,			NULL }
};

/*
 * 9.3.21 Resource Information
 */
static int
dissect_rsl_ie_resource_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;
	guint		length;
	int ie_offset;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_RESOURCE_INF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Resource Information IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_resource_inf);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);

	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;

	ie_offset = offset;

	while (length > 0){
		proto_tree_add_item(ie_tree, hf_rsl_ch_no_Cbits, tvb, offset, 1, FALSE);
		/* TN is time slot number, binary represented as in 3GPP TS 45.002.
		 * 3 Bits
		 */
		proto_tree_add_item(ie_tree, hf_rsl_ch_no_TN, tvb, offset, 1, FALSE);
		offset++;

		/* Interference level (1) */
		/* Interf Band */
		proto_tree_add_item(ie_tree, hf_rsl_interf_band, tvb, offset, 1, FALSE);
		offset++;
		length = length - 2;
	}
	return ie_offset + length;
}

/*
 * 9.3.22 RLM Cause				9.3.22	M TLV 2-4
 */
static int
dissect_rsl_ie_rlm_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;

	guint		length;
	guint8		octet;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_RLM_CAUSE)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"RLM Cause IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_rlm_cause);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);

	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;

	/* The Cause Value is a one octet field if the extension bit is set to 0.
	 * If the extension bit is set to 1, the Cause Value is a two octet field.
	 */
	octet = tvb_get_guint8(tvb,offset);
	proto_tree_add_item(tree, hf_rsl_extension_bit, tvb, offset, 1, FALSE);
	proto_tree_add_item(ie_tree, hf_rsl_cause, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/*
 * 9.3.23 Starting Time
 */
static int
dissect_rsl_ie_staring_time(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_STARTING_TIME)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,3,"Starting Time IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_staring_time);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T1prim, tvb, offset, 1, FALSE);
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T3, tvb, offset, 2, FALSE);
	offset++;
	proto_tree_add_item(ie_tree, hf_rsl_req_ref_T2, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/* 
 * 9.3.24 Timing Advance
 */
static int
dissect_rsl_ie_timing_adv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_TIMING_ADV)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"Timing Advance IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_timing_adv);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	proto_tree_add_item(ie_tree, hf_rsl_timing_adv, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/*
 * 9.3.25 Uplink Measurements
 */
static const true_false_string rsl_dtxd_vals = {
  "Employed",
  "Not employed"
};

static int
dissect_rsl_ie_uplik_meas(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint		length;
	int			ie_offset;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_UPLINK_MEAS)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Uplink Measurements IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_uplik_meas);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);

	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;
	ie_offset = offset;

	/* Octet 3
	 * 8	7	 6	5	4	3	2	1
	 * rfu	DTXd | RXLEV.FULL.up
	 */
	proto_tree_add_item(ie_tree, hf_rsl_dtxd, tvb, offset, 1, FALSE);
	proto_tree_add_item(ie_tree, hf_rsl_rxlev_full_up, tvb, offset, 1, FALSE);
	offset++;

	/* Octet4
	 * 8	7	6	5	4	3	2	1
	 * Reserved |  RXLEV.SUB.up 4
	 */
	proto_tree_add_item(ie_tree, hf_rsl_rxlev_sub_up, tvb, offset, 1, FALSE);
	offset++;
	/* Octet 5 
	 * 8	7	 6	5	4		  3	2	1
	 * Reserved | RXQUAL.FULL.up | RXQUAL.SUB.up
	 */
	proto_tree_add_item(ie_tree, hf_rsl_rxqual_full_up, tvb, offset, 1, FALSE);
	proto_tree_add_item(ie_tree, hf_rsl_rxqual_sub_up, tvb, offset, 1, FALSE);
	 offset++;
	/* Octet 6 - N
	 * Supplementary Measurement Information
	 */
	return ie_offset+length;
}


static const value_string rsl_class_vals[] = {
	{  0x00,	"Normal event" },
	{  0x01,	"Normal event" },
	{  0x02,	"Resource unavailable" },
	{  0x03,	"Service or option not available" },
	{  0x04,	"Service or option not implemented" },
	{  0x05,	"Invalid message (e.g. parameter out of range)" },
	{  0x06,	"Protocol error" },
	{  0x07,	"Interworking" },
	{ 0,			NULL }
};
	
 /*
  * 9.3.26 Cause
  */
static int
dissect_rsl_ie_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint		length;
	guint8		octet;
	int			ie_offset;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_CAUSE)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Cause IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_cause);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;
	ie_offset = offset;
	
	/* Cause Value */
	octet = tvb_get_guint8(tvb,offset);
	proto_tree_add_item(tree, hf_rsl_extension_bit, tvb, offset, 1, FALSE);
	proto_tree_add_item(tree, hf_rsl_class, tvb, offset, 1, FALSE);
	if ((octet & 0x80) == 80)
		offset++;
	
	/* Cause Extension*/
	/* Diagnostic(s) if any */
	return ie_offset+length;
}
/*
 * 9.3.27 Measurement result number
 */

static int
dissect_rsl_ie_meas_res_no(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_MEAS_RES_NO)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"Measurement result number IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_meas_res_no);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* Measurement result number */
	proto_tree_add_item(ie_tree, hf_rsl_meas_res_no, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}
/*
 * 9.3.28 Message Identifier
 */
static int
dissect_rsl_ie_message_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_MESSAGE_ID)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Message Identifier IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_message_id);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Message Type */
	proto_tree_add_item(tree, hf_rsl_msg_type, tvb, offset, 1, FALSE);
	offset++;
	return offset;
}
/*
 * 9.3.30 System Info Type
 */
static const value_string rsl_sys_info_type_vals[] = {
	{  0x00,	"SYSTEM INFORMATION 8" },
	{  0x01,	"SYSTEM INFORMATION 1" },
	{  0x02,	"SYSTEM INFORMATION 2" },
	{  0x03,	"SYSTEM INFORMATION 3" },
	{  0x04,	"SYSTEM INFORMATION 4" },
	{  0x05,	"SYSTEM INFORMATION 5" },
	{  0x06,	"SYSTEM INFORMATION 6" },
	{  0x07,	"SYSTEM INFORMATION 7" },
	{  0x08,	"SYSTEM INFORMATION 16" },
	{  0x09,	"SYSTEM INFORMATION 17" },
	{  0x0a,	"SYSTEM INFORMATION 2bis" },
	{  0x0b,	"SYSTEM INFORMATION 2ter" },
	{  0x0d,	"SYSTEM INFORMATION 5bis" },
	{  0x0e,	"SYSTEM INFORMATION 5ter" },
	{  0x0f,	"SYSTEM INFORMATION 10" },
	{  0x47,	"EXTENDED MEASUREMENT ORDER" },
	{  0x48,	"MEASUREMENT INFORMATION" },
	{  0x28,	"SYSTEM INFORMATION 13" },
	{  0x29,	"SYSTEM INFORMATION 2quater" },
	{  0x2a,	"SYSTEM INFORMATION 9" },
	{  0x2b,	"SYSTEM INFORMATION 18" },
	{  0x2c,	"SYSTEM INFORMATION 19" },
	{  0x2d,	"SYSTEM INFORMATION 20" },
	{ 0,			NULL }
};


static int
dissect_rsl_ie_sys_info_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_SYS_INFO_TYPE)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,2,"System Info Type IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_sys_info_type);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Message Type */
	proto_tree_add_item(tree, hf_rsl_sys_info_type, tvb, offset, 1, FALSE);
	offset++;
	return offset;
}
/*
 * 9.3.35 Full Immediate Assign Info TLV 25
 */
static int
dissect_rsl_ie_full_imm_ass_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;

	guint		length;
	tvbuff_t	*next_tvb;
	guint8		ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_FULL_IMM_ASS_INF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Full Immediate Assign Info IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_full_imm_ass_inf);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);

	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;
	/*	The Full Immediate Assign Info field (octets 3-25)
	 * contains a complete immediate assign message (IMMEDIATE ASSIGNMENT or
	 * IMMEDIATE ASSIGNMENT EXTENDED or IMMEDIATE ASSIGNMENT REJECT)
	 * as defined in 3GPP TS 44.018.
	 */
	proto_tree_add_text(ie_tree, tvb,offset,length,"Full Immediate Assign Info field");
	next_tvb = tvb_new_subset(tvb, offset, length, length);
	call_dissector(gsm_a_ccch_handle, next_tvb, pinfo, top_tree);

	offset = offset + length;

	return offset;
}

/*
 * 9.3.37 MS Timing Offset
 */

static int
dissect_rsl_ie_ms_timing_offset(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8		ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_FULL_MS_TIMING_OFFSET)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"MS Timing Offset IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ms_timing_offset);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* Timing Offset 
	 * The meaning of the MS Timing Offset is as defined in 3GPP TS 45.010. 
	 * The value of MS Timing Offset is the binary value of the 8-bit Timing Offset field (octet 2) - 63.
	 * The range of MS Timing Offset is therefore -63 to 192.
	 */
	proto_tree_add_item(ie_tree, hf_rsl_timing_offset, tvb, offset, 1, FALSE);
	offset++;
	
	return offset;
}

/*
 * 9.3.38 Erroneous Message
 * This information element is used to carry a complete A-bis interface message
 * which was considered erroneous at reception.
 */
static int
dissect_rsl_ie_err_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;

	guint		length;
	guint8		ie_id;
	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_ERR_MSG)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Erroneous Message IE ");
	ie_tree = proto_item_add_subtree(ti, ett_ie_err_msg);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);

	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;

	/* Received Message */
	offset = dissct_rsl_msg(tvb, pinfo, ie_tree, offset);

	return offset;
}
#if 0
/*
 * 9.3.39 Full BCCH Information (message name)
 */
static int
dissect_rsl_ie_full_bcch_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	tvbuff_t	*next_tvb;
	guint16 length;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_FULL_BCCH_INF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Full BCCH Information IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_full_bcch_inf);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_ntohs(tvb, offset);
	proto_item_set_len(ti, length+3);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 2, FALSE);
 	offset= offset +2;

	/* 
	 * Octets 3-25 contain the complete L3 message as defined in 3GPP TS 44.018.
	 */

	proto_tree_add_text(ie_tree, tvb,offset,length,"Layer 3 message");
	next_tvb = tvb_new_subset(tvb, offset, length, length);
	/* call_dissector(gsm_a_dtap_handle, next_tvb, pinfo, top_tree);*/

	offset = offset + length;

	return offset;
 }
#endif
/*
 * 9.3.40 Channel Needed
 */
static const value_string rsl_ch_needed_vals[] = {
	{  0x00,	"Any Channel" },
	{  0x01,	"SDCCH" },
	{  0x02,	"TCH/F (Full rate)" },
	{  0x03,	"TCH/F or TCH/H (Dual rate)" },
	{ 0,		NULL }
};

static int
dissect_rsl_ie_ch_needed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8		ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_CH_NEEDED)
			return offset;
	}


	ti = proto_tree_add_text(tree, tvb,offset,0,"Channel Needed IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_ch_needed);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* Channel */
	proto_tree_add_item(ie_tree, hf_rsl_ch_needed, tvb, offset, 1, FALSE);
	offset++;
	
	return offset;
}

/*
 * 9.3.49 eMLPP Priority
 */
static const value_string rsl_emlpp_prio_vals[] = {
	{  0x00,	"no priority applied" },
	{  0x01,	"call priority level 4" },
	{  0x02,	"call priority level 3" },
	{  0x03,	"call priority level 2" },
	{  0x04,	"call priority level 1" },
	{  0x05,	"call priority level 0" },
	{  0x06,	"call priority level B" },
	{  0x07,	"call priority level A" },
	{ 0,			NULL }
};

static int
dissect_rsl_ie_emlpp_prio(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8		ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_EMLPP_PRIO)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"eMLPP Priority IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_emlpp_prio);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* The call priority field (bit 3 to 1 of octet 2) is coded in the same way
	 * as the call priority field (bit 3 to 1 of octet 5) in the 
	 * Descriptive group or broadcast call reference information element
	 * as defined in 3GPP TS 24.008. 
	 */
	proto_tree_add_item(ie_tree, hf_rsl_emlpp_prio, tvb, offset, 1, FALSE);
	offset++;

	return offset;
}

/*
 * 9.3.51 Main channel reference
 */

static int
dissect_rsl_ie_main_ch_ref(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint8		ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_MAIN_CH_REF)
			return offset;
	}

	ti = proto_tree_add_text(tree, tvb,offset,0,"Main channel reference IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_main_ch_ref);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;

	/* TN is time slot number, binary represented as in 3GPP TS 45.002.
	 * 3 Bits
	 */
	proto_tree_add_item(ie_tree, hf_rsl_ch_no_TN, tvb, offset, 1, FALSE);
	offset++;
	return offset;
}

/*
 * 9.3.52 MultiRate configuration
 */

static int
dissect_rsl_ie_multirate_conf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{
	proto_item *ti;
	proto_tree *ie_tree;
	guint length;
	guint8 ie_id;

	if(is_mandatory == FALSE){
		ie_id = tvb_get_guint8(tvb,offset);
		if (ie_id != RSL_IE_MULTIRATE_CONF)
			return offset;
	}
	ti = proto_tree_add_text(tree, tvb,offset,0,"MultiRate configuration IE");
	ie_tree = proto_item_add_subtree(ti, ett_ie_multirate_conf);

	/* Element identifier */
	proto_tree_add_item(ie_tree, hf_rsl_ie_id, tvb, offset, 1, FALSE);
	offset++;
	/* Length */
	length = tvb_get_guint8(tvb,offset);
	proto_item_set_len(ti, length+2);
	proto_tree_add_item(ie_tree, hf_rsl_ie_length, tvb, offset, 1, FALSE);
	offset++;

	/* Rest of element coded as in 3GPP TS 44.018 not including
	 * 3GPP TS 44.018 element identifier or 3GPP TS 44.018 octet length value
	 */

	de_rr_multirate_conf(tvb, ie_tree, offset, length, NULL, 0);

	offset = offset + length;

	return offset;
}

/*
 * 9.3.58 LLP APDU
 */

/* The rest of the information element contains the embedded message
 * that contains a Facility Information Element as defined in
 * 3GPP TS 44.071 excluding the Facility IEI and length of Facility IEI
 * octets defined in 3GPP TS 44.071.
 */

static int
dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
	guint8	msg_type;

	msg_type = tvb_get_guint8(tvb,offset)&0x7f;
	proto_tree_add_item(tree, hf_rsl_msg_type, tvb, offset, 1, FALSE);
	offset++;

	switch (msg_type){
/* Radio Link Layer Management messages */
	/* 8.3.1 DATA REQUEST */
	case RSL_MSG_TYPE_DATA_REQ:
		/* Channel number			9.3.1	M TV 2		*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Link Identifier			9.3.2	M TV 2		*/
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* L3 Information			9.3.11	M TLV >=3	*/
		offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.2 DATA INDICATION */
	case RSL_MSG_TYPE_DATA_IND:
		/* Channel number			9.3.1	M TV 2		*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Link Identifier			9.3.2	M TV 2		*/
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* L3 Information			9.3.11	M TLV >=3	*/
		offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.3 ERROR INDICATION */
	case RSL_MSG_TYPE_ERROR_IND:
		/* Channel number			9.3.1	M TV 2		*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Link Identifier			9.3.2	M TV 2		*/
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* RLM Cause				9.3.22	M TLV 2-4	*/
		offset = dissect_rsl_ie_rlm_cause(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.4 ESTABLISH REQUEST */
	case RSL_MSG_TYPE_EST_REQ:
		/* Channel number			9.3.1	M TV 2		*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Link Identifier			9.3.2	M TV 2		*/
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.5 ESTABLISH CONFIRM */
	case RSL_MSG_TYPE_EST_CONF:
		/* Channel number			9.3.1	M TV 2		*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Link Identifier			9.3.2	M TV 2		*/
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.6 */
	case RSL_MSG_EST_IND:
		/* 	Channel number			9.3.1	M TV 2				 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* 	Link Identifier			9.3.2	M TV 2				 */
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* 	L3 Information			9.3.11	O (note 1) TLV 3-23	 */
		if(tvb_length_remaining(tvb,offset) >1)
			offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.3.7 RELEASE REQUEST */
	case RSL_MSG_REL_REQ:
		/* 	Channel number			9.3.1	M TV 2				 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* 	Link Identifier			9.3.2	M TV 2				 */
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* Release Mode				9.3.20	M TV 2				*/
		offset = dissect_rsl_ie_rel_mode(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.8 RELEASE CONFIRM */
	case RSL_MSG_REL_CONF:
		/* 	Channel number			9.3.1	M TV 2				 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* 	Link Identifier			9.3.2	M TV 2				 */
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.9 RELEASE INDICATION */
	case RSL_MSG_REL_IND:
		/* 	Channel number			9.3.1	M TV 2				 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* 	Link Identifier			9.3.2	M TV 2				 */
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.3.10 UNIT DATA REQUEST 10 */
	case RSL_MSG_UNIT_DATA_REQ:
		/* 	Channel number			9.3.1	M TV 2				 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* 	Link Identifier			9.3.2	M TV 2				 */
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* 	L3 Information			9.3.11	O (note 1) TLV 3-23	 */
		offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE);
		break;
/* Common Channel Management/TRX Management messages */
	/* 8.5.1 BCCH INFORMATION 17*/
	case RSL_MSG_BCCH_INFO:
		/* 	Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* 	System Info Type		9.3.30	M TV 2 */
		offset = dissect_rsl_ie_sys_info_type(tvb, pinfo, tree, offset, TRUE);
		/* 	Full BCCH Info (SYS INFO) 9.3.39 O 1) TLV 25 */
		/* 	Starting Time			9.3.23	O 2) TV 3 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_staring_time(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.5.2 CCCH LOAD INDICATION 18*/	
	case RSL_MSG_CCCH_LOAD_IND:
		/* 	Channel number (note)	9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Either RACH Load or Paging Load present */
		/* 	RACH Load				9.3.18	C 1) TLV >=8 */
		offset = dissect_rsl_ie_rach_load(tvb, pinfo, tree, offset, FALSE);
		/* 	Paging Load				9.3.15	C 2) TV 3 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_paging_load(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.5.3 */
	case RSL_MSG_CHANRQD: /* 19 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Request Reference		9.3.19	M TV 4 */
		offset = dissect_rsl_ie_req_ref(tvb, pinfo, tree, offset, TRUE);
		/* Access Delay				9.3.17	M TV 2 */
		offset = dissect_rsl_ie_access_delay(tvb, pinfo, tree, offset, TRUE);
		/* Physical Context			9.3.16	O 1) TLV >=2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_phy_ctx(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.5.4 DELETE INDICATION */
	case RSL_MSG_DELETE_IND: /* 20 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Full Imm. Assign Info	9.3.35	M TLV 25 */
		offset = dissect_rsl_ie_full_imm_ass_inf(tvb, pinfo, tree, offset, TRUE);
		break;
	case RSL_MSG_PAGING_CMD:	/* 21 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Paging Group				9.3.14	M TV 2 2 */
		offset = dissect_rsl_ie_paging_grp(tvb, pinfo, tree, offset, TRUE);
		/* MS Identity				9.3.12	M TLV 2-10 2 */
		offset = dissect_rsl_ie_ms_id(tvb, pinfo, tree, offset, TRUE);
		/* Channel Needed			9.3.40	O 1) TV 2 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_ch_needed(tvb, pinfo, tree, offset, FALSE);
		/* eMLPP Priority			9.3.49	O 2) TV 2 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_emlpp_prio(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.5.6 IMMEDIATE ASSIGN COMMAND */
	case RSL_MSG_IMM_ASS_CMD:	/* 22 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Full Imm. Assign Info	9.3.35	M TLV 25 */
		offset = dissect_rsl_ie_full_imm_ass_inf(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.5.7 SMS BROADCAST REQUEST */
	case RSL_MSG_SMS_BC_REQ:	/*	23	 8.5.7 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* SMSCB Information		9.3.36	M TV 24 */
		/* SMSCB Channel Indicator	9.3.44	O 1) TV 2 */
		break;
/* 8.6 TRX MANAGEMENT MESSAGES */
	/* 8.6.1 RF RESOURCE INDICATION */
	case RSL_MSG_RF_RES_IND:	/*	24	 8.6.1 */
		/* Resource Information		9.3.21	M TLV >=2 */
		offset = dissect_rsl_ie_resource_inf(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.6.2 SACCH FILLING */
	case RSL_MSG_SACCH_FILL:	/*	25	 8.6.2 */
		/* System Info Type			9.3.30	M TV 2 */
		offset = dissect_rsl_ie_sys_info_type(tvb, pinfo, tree, offset, TRUE);
		/* L3 Info (SYS INFO)		9.3.11 O 1) TLV 22 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE);
		/* Starting Time			9.3.23 O 2) TV 3 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_staring_time(tvb, pinfo, tree, offset, FALSE);
		break;
	case RSL_MSG_OVERLOAD:		/*	27	 8.6.3 */
		/* Cause					9.3.26	M TLV >=3 */
		offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE);
		break;
	case RSL_MSG_ERROR_REPORT:	/*	28	 8.6.4 */
		/* Cause					9.3.26	M TLV >=3 */
		offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE);
		/* Message Identifier		9.3.28	O 1) TV 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_message_id(tvb, pinfo, tree, offset, FALSE);
		/* Channel Number			9.3.1	O 2) TV 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Link identifier			9.3.2	O 3) TV 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* Erroneous Message		9.3.38	O 4) TLV >=3 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_err_msg(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.5.8 SMS BROADCAST COMMAND */
	case RSL_MSG_SMS_BC_CMD:	/*	29	 8.5.8 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* CB Command type			9.3.41	M TV 2 */
		/* SMSCB message			9.3.42	M TLV 2-90 */
		/* SMSCB Channel Indicator	9.3.44	O 1) TV 2 */
		break;
	case RSL_MSG_CBCH_LOAD_IND:	/*	30	 8.5.9 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* CBCH Load Information	9.3.43	M TV 2 */
		/* SMSCB Channel Indicator	9.3.44 O 1) TV 2 */
		break;
	case RSL_MSG_NOT_CMD:		/*	31	 8.5.10 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Command indicator		9.3.48 M 1) TLV 3-4 */
		/* Group call reference		9.3.45 O TLV 7 */
		/* Channel Description		9.3.46 O TLV 3-n */
		/* NCH DRX information		9.3.47 O TLV 3 */
		break;

/* Dedicated Channel Management messages: */
	/* 8.4.1 CHANNEL ACTIVATION 33*/
	case RSL_MSG_CHAN_ACTIV:
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Activation Type			9.3.3	M TV 2			*/
		offset = dissect_rsl_ie_act_type(tvb, pinfo, tree, offset, TRUE);
		/* Channel Mode				9.3.6	M TLV 8-9		*/
		offset = dissect_rsl_ie_ch_mode(tvb, pinfo, tree, offset, TRUE);
		/* Channel Identification	9.3.5	O 7) TLV 8		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_ch_id(tvb, pinfo, tree, offset, FALSE);
		/* Encryption information	9.3.7	O 1) TLV >=3	*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_enc_inf(tvb, pinfo, tree, offset, FALSE);
		/* Handover Reference		9.3.9	C 2) TV 2		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_ho_ref(tvb, pinfo, tree, offset, FALSE);
		/* BS Power					9.3.4	O 3) TV 2		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_bs_power(tvb, pinfo, tree, offset, FALSE); 
		/* MS Power					9.3.13	O 3) TV 2		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_ms_pow(tvb, pinfo, tree, offset, FALSE);
		/* Timing Advance			9.3.24	C 3) 4) TV 2	*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_timing_adv(tvb, pinfo, tree, offset, FALSE);
		/* BS Power Parameters		9.3.32	O 5) TLV >=2	*/
		/* MS Power Parameters		9.3.31	O 5) TLV >=2	*/
		/* Physical Context			9.3.16	O 6) TLV >=2	*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_phy_ctx(tvb, pinfo, tree, offset, FALSE);
		/* SACCH Information		9.3.29	O 8) TLV >=3	*/
		/* UIC						9.3.50	O 9) TLV 3		*/
		/* Main channel reference	9.3.51	O 10) TV 2		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_main_ch_ref(tvb, pinfo, tree, offset, FALSE);
		/* MultiRate configuration	9.3.52	O 11) TLV >=4	*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE);
		/* MultiRate Control		9.3.53	O 12) TV 2		*/
		/* Supported Codec Types	9.3.54	O 12) TLV >=5	*/
		/* TFO transparent container 9.3.59 O 12) TLV >=3	*/
		break;

	/* 8.4.2 CHANNEL ACTIVATION ACKNOWLEDGE	34*/
	case RSL_MSG_CHAN_ACTIV_ACK:
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Frame number				9.3.8	M TV 3			*/
		offset = dissect_rsl_ie_frame_no(tvb, pinfo, tree, offset, TRUE);
		break;
	case RSL_MSG_CHAN_ACTIV_N_ACK:
	/* 8.4.3 CHANNEL ACTIVATION NEGATIVE ACKNOWLEDGE */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Cause					9.3.26	M TLV >=3		*/
		offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.4 CONNECTION FAILURE INDICATION */
	case RSL_MSG_CONN_FAIL:
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Cause					9.3.26	M TLV >=3		*/
		offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.5 DEACTIVATE SACCH */
	case RSL_MSG_DEACTIVATE_SACCH:
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.6 ENCRYPTION COMMAND */
	case RSL_MSG_ENCR_CMD:			/*	38	 8.4.6 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Encryption information	9.3.7	M TLV >=3		*/
		offset = dissect_rsl_ie_enc_inf(tvb, pinfo, tree, offset, TRUE);
		/* Link Identifier			9.3.2	M TV 2			*/
		offset = dissect_rsl_ie_link_id(tvb, pinfo, tree, offset, TRUE);
		/* L3 Info (CIPH MOD CMD)	9.3.11	M TLV 6			*/
		offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, TRUE); 
		break;
	/* 8.4.7 HANDOVER DETECTION */
	case RSL_MSG_HANDODET:			/*	39	 8.4.7 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Access Delay				9.3.17 O 1) TV 2		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_access_delay(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.4.8 MEASUREMENT RESULT 40 */
	case RSL_MSG_MEAS_RES:
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Measurement result number 9.3.27 M TV 2			*/
		offset = dissect_rsl_ie_meas_res_no(tvb, pinfo, tree, offset, TRUE);
		/* Uplink Measurements		9.3.25	M TLV >=5		*/
		offset = dissect_rsl_ie_uplik_meas(tvb, pinfo, tree, offset, TRUE);
		/* BS Power					9.3.4	M TV 2			*/
		offset = dissect_rsl_ie_bs_power(tvb, pinfo, tree, offset, TRUE);
		/* L1 Information			9.3.10 O 1) TV 3		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_l1_inf(tvb, pinfo, tree, offset, FALSE);
		/* L3 Info (MEAS REP, EXT MEAS REP or ENH MEAS REP) 9.3.11 O 1) TLV 21 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE); 
		/* MS Timing Offset			9.3.37 O 2) TV 2		*/
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_ms_timing_offset(tvb, pinfo, tree, offset, FALSE); 
		break;
	/* 8.4.9 MODE MODIFY */
	case RSL_MSG_MODE_MODIFY_REQ:	/*	41	8.4.9 */
		/* Channel number			9.3.1 M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Channel Mode				9.3.6 M TLV 8-9 */
		offset = dissect_rsl_ie_ch_mode(tvb, pinfo, tree, offset, TRUE);
		/* Encryption information	9.3.7 O 1) TLV >=3 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_enc_inf(tvb, pinfo, tree, offset, FALSE); 
		/* Main channel reference	9.3.45 O 2) TV 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_main_ch_ref(tvb, pinfo, tree, offset, FALSE);
		/* MultiRate configuration	9.3.52 O 3) TLV >=3 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE);
		/* Multirate Control		9.3.53 O 4) TV 2 */
		/* Supported Codec Types	9.3.54 O 4) TLV >=5 */
		/* TFO transparent container 9.3.59 O 4) TLV */
		break;
	/* 8.4.10 MODE MODIFY ACKNOWLEDGE */
	case RSL_MSG_MODE_MODIFY_ACK:	/*	42	8.4.10 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.11 MODE MODIFY NEGATIVE ACKNOWLEDGE */
	case RSL_MSG_MODE_MODIFY_NACK:	/*	43	8.4.11 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Cause					9.3.26	M TLV >=3		*/
		offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.12 PHYSICAL CONTEXT REQUEST */
	case RSL_MSG_PHY_CONTEXT_REQ:	/*	44	8.4.12 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.13 PHYSICAL CONTEXT CONFIRM */
	case RSL_MSG_PHY_CONTEXT_CONF:	/*	45	8.4.13 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* BS Power					9.3.4	M TV 2 */
		offset = dissect_rsl_ie_bs_power(tvb, pinfo, tree, offset, TRUE);
		/* MS Power					9.3.13	M TV 2 */
		offset = dissect_rsl_ie_ms_pow(tvb, pinfo, tree, offset, TRUE);
		/* Timing Advance			9.3.24	M TV 2 */
		offset = dissect_rsl_ie_timing_adv(tvb, pinfo, tree, offset, TRUE);
		/* Physical Context			9.3.16	O 1) TLV */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_phy_ctx(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.4.14 RF CHANNEL RELEASE */
	case RSL_MSG_RF_CHAN_REL:		/*	46	8.4.14 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.15 MS POWER CONTROL */
	case RSL_MSG_MS_POWER_CONTROL:	/*	47	8.4.15 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* MS Power					9.3.13	M TV 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_ms_pow(tvb, pinfo, tree, offset, FALSE);
		/* MS Power Parameters		9.3.31	O 1) TLV >=2 */
		break;
	/* 8.4.16 BS POWER CONTROL */
	case RSL_MSG_BS_POWER_CONTROL:	/*	48	8.4.16 */
		/* Channel number			9.3.1 M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* BS Power					9.3.4 M TV 2 */
		offset = dissect_rsl_ie_bs_power(tvb, pinfo, tree, offset, TRUE);
		/* BS Power Parameters		9.3.32 O 1) TLV >=2 */
		break;
	/* 8.4.17 PREPROCESS CONFIGURE */
	case RSL_MSG_PREPROC_CONFIG:		/*	49	8.4.17 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Preproc. Parameters		9.3.33	M TLV >=3 */
		break;
	/* 8.4.18 PREPROCESSED MEASUREMENT RESULT */
	case RSL_MSG_PREPROC_MEAS_RES:	/*	50	8.4.18 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Preproc. Measurements	9.3.34	M TLV >=2 */
		break;
	/* 8.4.19 RF CHANNEL RELEASE ACKNOWLEDGE */
	case RSL_MSG_RF_CHAN_REL_ACK:		/*	51	8.4.19 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.20 SACCH INFO MODIFY */
	case RSL_MSG_SACCH_INFO_MODIFY:	/*	52	8.4.20 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* System Info Type			9.3.30	M TV 2 */
		offset = dissect_rsl_ie_sys_info_type(tvb, pinfo, tree, offset, TRUE);
		/* L3 Info					9.3.11	O 1) TLV 22 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_L3_inf(tvb, pinfo, tree, offset, FALSE);
		/* Starting Time			9.3.23	O 2) TV 3 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_staring_time(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.4.21 TALKER DETECTION */
	case RSL_MSG_TALKER_DET:			/*	53	8.4.21 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Access Delay				9.3.17	O 1) TV 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
				offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.22 LISTENER DETECTION */
	case RSL_MSG_LISTENER_DET:		/*	54	8.4.22 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Access Delay				9.3.17	O 1) TV 2 */
		if(tvb_length_remaining(tvb,offset) > 0)
				offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.23 REMOTE CODEC CONFIGURATION REPORT */
	case RSL_MSG_REMOTE_CODEC_CONF_REP:/*	55	8.4.23 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Codec Configuration		9.3.55	M TLV >=3 */
		/* Supported Codec Types	9.3.54	M TLV >=5 */
		/* TFO transparent container 9.3.59 O 4) TLV >=3 */
		break;
	/* 8.4.24 ROUND TRIP DELAY REPORT */
	case RSL_MSG_R_T_D_REP:			/*	56	8.4.24 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Round Trip Delay			9.3.56	M TV 2 */
		break;
	/* 8.4.25 PRE-HANDOVER NOTIFICATION */
	case RSL_MSG_PRE_HANDO_NOTIF:		/*	57	8.4.25 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* MultiRateControl			9.3.53	M TV 2 */
		/* Codec Configuration		9.3.55	M TLV >=3 */
		/* TFO transparent container 9.3.59 O 4) TLV >=3 */
		break;
	/* 8.4.26 MULTIRATE CODEC MODIFICATION REQUEST */
	case RSL_MSG_MR_CODEC_MOD_REQ:	/*	58	8.4.26 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* MultiRate Configuration	9.3.52	O 1) TLV >=4 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE);
		break;
	/*  8.4.27 MULTIRATE CODEC MODIFICATION ACKNOWLEDGE */
	case RSL_MSG_MR_CODEC_MOD_ACK:	/*	59	8.4.27 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* MultiRate Configuration	9.3.52	O 1) TLV >=4 */
		if(tvb_length_remaining(tvb,offset) > 0)
			offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, FALSE);
		break;
	/* 8.4.28 MULTIRATE CODEC MODIFICATION NEGATIVE ACKNOWLEDGE */
	case RSL_MSG_MR_CODEC_MOD_NACK:	/*	60	8.4.28 */
		/* Channel number			9.3.1	M TV 2			*/
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* Cause					9.3.26	M TLV >=3		*/
		offset = dissect_rsl_ie_cause(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.29 MULTIRATE CODEC MODIFICATION PERFORMED */
	case RSL_MSG_MR_CODEC_MOD_PER:	/*	61	8.4.29 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* MultiRate Configuration	9.3.52	M TLV >=4 */
		offset = dissect_rsl_ie_multirate_conf(tvb, pinfo, tree, offset, TRUE);
		break;
	/* 8.4.30 TFO REPORT */
	case RSL_MSG_TFO_REP:				/*	62	8.4.30 */
		/* Channel number			9.3.1	M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* TFO Status				9.3.57	M TV 1 */
		break;
	/* 8.4.31 TFO MODIFICATION REQUEST */
	case RSL_MSG_TFO_MOD_REQ:			/*	63	8.4.31 */
		/* Channel number			9.3.1 M TV 2 */
		offset = dissect_rsl_ie_ch_no(tvb, pinfo, tree, offset, TRUE);
		/* MultiRateControl			9.3.53 M TV 2 */
		/* Supported Codec Type		9.3.54 O 1) TLV >=5 */
		/* TFO transparent container 9.3.59 O 4) TLV >=3 */
		break;
	/* 	0 1 - - - - - - Location Services messages: */
	/* 8.7.1 LOCATION INFORMATION */
	case RSL_MSG_LOC_INF:				/*	65	8.7.1 */
		/* LLP APDU 9.3.58 M LV 2-N */
		break;
	default:
		break;
	}

	return offset;

}
static void
dissect_rsl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	proto_item *ti;
	proto_tree *rsl_tree;
	guint8	msg_type;


	int offset = 0;

	if (check_col(pinfo->cinfo, COL_PROTOCOL))
		col_set_str(pinfo->cinfo, COL_PROTOCOL, "RSL");
	if (check_col(pinfo->cinfo, COL_INFO))
		col_clear(pinfo->cinfo, COL_INFO);

	msg_type = tvb_get_guint8(tvb,offset+1)&0x7f;

	if (check_col(pinfo->cinfo, COL_INFO)){
		col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",val_to_str(msg_type, rsl_msg_type_vals,"unknown %u"));
	}

	top_tree = tree;
	if (tree) {
		ti = proto_tree_add_item(tree, proto_rsl, tvb, 0, -1, FALSE);
		rsl_tree = proto_item_add_subtree(ti, ett_rsl);

		/* 9.1 Message discriminator */
		proto_tree_add_item(rsl_tree, hf_rsl_msg_dsc, tvb, offset, 1, FALSE);
		proto_tree_add_item(rsl_tree, hf_rsl_T_bit, tvb, offset, 1, FALSE);
		offset++;

		offset = dissct_rsl_msg(tvb, pinfo, rsl_tree, offset);

	}

}

void
proto_reg_handoff_rsl(void)
{
	dissector_handle_t rsl_handle;

	rsl_handle = create_dissector_handle(dissect_rsl, proto_rsl);
	dissector_add("lapd.gsm.sapi", LAPD_GSM_SAPI_RA_SIG_PROC, rsl_handle);

	gsm_a_ccch_handle = find_dissector("gsm_a_ccch");
	gsm_a_dtap_handle = find_dissector("gsm_a_dtap");
}

/* Register the protocol with Wireshark */
void proto_register_rsl(void)
{

	/* Setup list of header fields */
	static hf_register_info hf[] = {
		{ &hf_rsl_msg_dsc,
			{ "Message discriminator",           "rsl.msg_dsc",
			FT_UINT8, BASE_DEC, VALS(rsl_msg_disc_vals), 0xfe,
			"Message discriminator", HFILL }
		},
		{ &hf_rsl_T_bit,
			{ "T bit",           "rsl.T_bit",
			FT_BOOLEAN, 8, TFS(&rsl_t_bit_vals), 0x01,
			"T bit", HFILL }
		},
		{ &hf_rsl_msg_type,
			{ "Message type",           "rsl.msg_type",
			FT_UINT8, BASE_HEX_DEC, VALS(rsl_msg_type_vals), 0x7f,
			"Message type", HFILL }
		},
		{ &hf_rsl_ie_id,
			{ "Element identifier",           "rsl.ie_id",
			FT_UINT8, BASE_HEX_DEC, VALS(rsl_ie_type_vals), 0x0,
			"Element identifier", HFILL }
		},
		{ &hf_rsl_ie_length,
			{ "Length",           "rsl.ie_length",
			FT_UINT16, BASE_DEC, NULL, 0x0,
			"Length", HFILL }
		},
		{ &hf_rsl_ch_no_Cbits,
			{ "C-bits",           "rsl.ch_no_Cbits",
			FT_UINT8, BASE_DEC, VALS(rsl_ch_no_Cbits_vals), 0xf8,
			"C-bits", HFILL }
		},
		{ &hf_rsl_ch_no_TN,
			{ "Time slot number (TN)",  "rsl.ch_no_TN",
			FT_UINT8, BASE_DEC, NULL, 0x07,
			"Time slot number (TN)", HFILL }
		},
		{ &hf_rsl_req_ref_ra,
			{ "Random Access Information (RA)", "rsl.req_ref_ra",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Random Access Information (RA)", HFILL }
		},
		{ &hf_rsl_req_ref_T1prim,
			{ "T1'",           "rsl.req_ref_T1prim",
			FT_UINT8, BASE_DEC, NULL, 0xf8,
			"T1'", HFILL }
		},
		{ &hf_rsl_req_ref_T3,
			{ "T3",           "rsl.req_ref_T3",
			FT_UINT16, BASE_DEC, NULL, 0x07e0,
			"T3", HFILL }
		},
		{ &hf_rsl_req_ref_T2,
			{ "T2",           "rsl.req_ref_T2",
			FT_UINT8, BASE_DEC, NULL, 0x1f,
			"T2", HFILL }
		},
		{ &hf_rsl_timing_adv,
			{ "Timing Advance",           "rsl.timing_adv",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Timing Advance", HFILL }
		},
		{ &hf_rsl_ho_ref,
			{ "Hand-over reference",           "rsl.ho_ref",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Hand-over reference", HFILL }
		},
		{ &hf_rsl_ms_power_lev,
			{ "MS power level",           "rsl.ms_power_lev",
			FT_UINT8, BASE_DEC, NULL, 0xf8,
			"MS power level", HFILL }
		},
		{ &hf_rsl_ms_fpc,
			{ "FPC/EPC",           "rsl.ms_fpc",
			FT_BOOLEAN, 8, TFS(&rsl_ms_fpc_epc_mode_vals), 0x04,
			"FPC/EPC", HFILL }
		},
		{ &hf_rsl_act_timing_adv,
			{ "Actual Timing Advance",           "rsl.act_timing_adv",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Actual Timing Advance", HFILL }
		},
		{ &hf_rsl_power_lev,
			{ "Power level",           "rsl.power_lev",
			FT_UINT8, BASE_DEC, NULL, 0x1f,
			"Power level", HFILL }
		},

		{ &hf_rsl_dtxd,
			{ "DTXd",           "rsl.dtxd",
			FT_BOOLEAN, 8, TFS(&rsl_dtxd_vals), 0x40,
			"DTXd", HFILL }
		},
		{ &hf_rsl_rxlev_full_up,
			{ "RXLEV.FULL.up",           "rsl.rxlev_full_up",
			FT_UINT8, BASE_DEC, NULL, 0x3f,
			"RXLEV.FULL.up", HFILL }
		},
		{ &hf_rsl_rxlev_sub_up,
			{ "RXLEV.SUB.up",           "rsl.rxlev_sub_up",
			FT_UINT8, BASE_DEC, NULL, 0x3f,
			"RXLEV.SUB.up", HFILL }
		},
		{ &hf_rsl_rxqual_full_up,
			{ "RXQUAL.FULL.up",           "rsl.rxqual_full_up",
			FT_UINT8, BASE_DEC, NULL, 0x38,
			"RXQUAL.FULL.up", HFILL }
		},
		{ &hf_rsl_rxqual_sub_up,
			{ "RXQUAL.SUB.up",           "rsl.rxqual_sub_up",
			FT_UINT8, BASE_DEC, NULL, 0x07,
			"RXQUAL.SUB.up", HFILL }
		},
		{ &hf_rsl_acc_delay,
			{ "Access Delay",           "rsl.acc_del",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Access Delay", HFILL }
		},
		{ &hf_rsl_rach_slot_cnt,
			{ "RACH Slot Count",           "rsl.rach_slot_cnt",
			FT_UINT16, BASE_DEC, NULL, 0x0,
			"RACH Slot Count", HFILL }
		},
		{ &hf_rsl_rach_busy_cnt,
			{ "RACH Busy Count",           "rsl.rach_busy_cnt",
			FT_UINT16, BASE_DEC, NULL, 0x0,
			"RACH Busy Count", HFILL }
		},
		{ &hf_rsl_rach_acc_cnt,
			{ "RACH Access Count",           "rsl.rach_acc_cnt",
			FT_UINT16, BASE_DEC, NULL, 0x0,
			"RACH Access Count", HFILL }
		},
		{ &hf_rsl_phy_ctx,
			{ "Physical Context",           "rsl.phy_ctx",
			FT_BYTES, BASE_NONE, NULL, 0x0,
			"Physical Context", HFILL }
		},
		{ &hf_rsl_na,
			{ "Not applicable (NA)",           "rsl.na",
			FT_BOOLEAN, 8, TFS(&rsl_na_vals), 0x20,
			"Not applicable (NA)", HFILL }
		},
		{ &hf_rsl_ch_type,
			{ "channel type",           "rsl.ch_type",
			FT_UINT8, BASE_DEC, VALS(rsl_ch_type_vals), 0xc0,
			"channel type", HFILL }
		},
		{ &hf_rsl_prio,
			{ "Priority",           "rsl.prio",
			FT_UINT8, BASE_DEC, VALS(rsl_prio_vals), 0x18,
			"Priority", HFILL }
		},
		{ &hf_rsl_sapi,
			{ "SAPI",           "rsl.sapi",
			FT_UINT8, BASE_DEC, NULL, 0x07,
			"SAPI", HFILL }
		},
		{ &hf_rsl_rbit,
			{ "R",           "rsl.rbit",
			FT_BOOLEAN, 8, TFS(&rsl_rbit_vals), 0x80,
			"R", HFILL }
		},
		{ &hf_rsl_a3a2,
			{ "A3A2",           "rsl.a3a2",
			FT_UINT8, BASE_DEC, VALS(rsl_a3a2_vals), 0x06,
			"A3A2", HFILL }
		},
		{ &hf_rsl_a1_0,
			{ "A1",           "rsl.a1_0",
			FT_BOOLEAN, 8, TFS(&rsl_a1_0_vals), 0x01,
			"A1", HFILL }
		},
		{ &hf_rsl_a1_1,
			{ "A1",           "rsl.a1_1",
			FT_BOOLEAN, 8, TFS(&rsl_a1_1_vals), 0x01,
			"A1", HFILL }
		},
		{ &hf_rsl_a1_2,
			{ "A1",           "rsl.a2_0",
			FT_BOOLEAN, 8, TFS(&rsl_a1_2_vals), 0x01,
			"A1", HFILL }
		},
		{ &hf_rsl_epc_mode,
			{ "EPC mode", "rsl.epc_mode",
			FT_BOOLEAN, 8, TFS(&rsl_epc_mode_vals), 0x20,
			"EPC mode", HFILL }
		},
		{ &hf_rsl_bs_fpc_epc_mode,
			{ "FPC-EPC mode", "rsl.fpc_epc_mode",
			FT_BOOLEAN, 8, TFS(&rsl_fpc_epc_mode_vals), 0x10,
			"FPC-EPC mode", HFILL }
		},
		{ &hf_rsl_bs_power,
			{ "Power Level",           "rsl.bs_power",
			FT_UINT8, BASE_DEC, VALS(rsl_rlm_bs_power_vals), 0x0f,
			"Power Level", HFILL }
		},
		{ &hf_rsl_cm_dtxd,
			{ "DTXd", "rsl.cm_dtxd",
			FT_BOOLEAN, 8, TFS(&rsl_dtx_vals), 0x02,
			"DTXd", HFILL }
		},
		{ &hf_rsl_cm_dtxu,
			{ "DTXu", "rsl.cm_dtxu",
			FT_BOOLEAN, 8, TFS(&rsl_dtx_vals), 0x01,
			"DTXu", HFILL }
		},
		{ &hf_rsl_alg_id,
			{ "Algorithm Identifier",           "rsl.alg_id",
			FT_UINT8, BASE_DEC, VALS(rsl_algorithm_id_vals), 0x0,
			"Algorithm Identifier", HFILL }
		},
		{ &hf_rsl_key,
			{ "KEY",           "rsl.key",
			FT_BYTES, BASE_NONE, NULL, 0x0,
			"KEY", HFILL }
		},
		{ &hf_rsl_cause,
			{ "Cause",           "rsl.cause",
			FT_UINT8, BASE_DEC, VALS(rsl_rlm_cause_vals), 0x7f,
			"Cause", HFILL }
		},
		{ &hf_rsl_rel_mode,
			{ "Release Mode",           "rsl.rel_mode",
			FT_UINT8, BASE_DEC, VALS(rel_mode_vals), 0x01,
			"Relese Mode", HFILL }
		},
		{ &hf_rsl_interf_band,
			{ "Interf Band",           "rsl.interf_band",
			FT_UINT8, BASE_DEC, NULL, 0xe0,
			"Relese Mode", HFILL }
		},
		{ &hf_rsl_meas_res_no,
			{ "Measurement result number",           "rsl.meas_res_no",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Measurement result number", HFILL }
		},
		{ &hf_rsl_extension_bit,
			{ "Extension", "rsl.extension_bit",
			FT_BOOLEAN, 8, TFS(&rsl_extension_bit_value), 0x80,
			"Extension", HFILL }},
		{ &hf_rsl_class,
			{ "Class",           "rsl.class",
			FT_UINT8, BASE_DEC, VALS(rsl_class_vals), 0x70,
			"Class", HFILL }
		},
		{ &hf_rsl_paging_grp,
			{ "Paging Group",           "rsl.paging_grp",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Paging Group", HFILL }
		},
		{ &hf_rsl_paging_load,
			{ "Paging Buffer Space",           "rsl.paging_load",
			FT_UINT16, BASE_DEC, NULL, 0x0,
			"Paging Buffer Space", HFILL }
		},
		{ &hf_rsl_sys_info_type,
			{ "System Info Type",           "rsl.sys_info_type",
			FT_UINT8, BASE_DEC, VALS(rsl_sys_info_type_vals), 0x0,
			"System Info Type", HFILL }
		},
		{ &hf_rsl_timing_offset,
			{ "Timing Offset",           "rsl.timing_offset",
			FT_UINT8, BASE_DEC, NULL, 0x0,
			"Timing Offset", HFILL }
		},
		{ &hf_rsl_ch_needed,
			{ "Channel Needed",           "rsl.ch_needed",
			FT_UINT8, BASE_DEC, VALS(rsl_ch_needed_vals), 0x03,
			"Channel Needed", HFILL }
		},
		{ &hf_rsl_emlpp_prio,
			{ "eMLPP Priority",           "rsl.emlpp_prio",
			FT_UINT8, BASE_DEC, VALS(rsl_emlpp_prio_vals), 0x03,
			"eMLPP Priority", HFILL }
		},
	};
	static gint *ett[] = {
		&ett_rsl,
		&ett_ie_link_id,
		&ett_ie_act_type,
		&ett_ie_bs_power,
		&ett_ie_ch_id,
		&ett_ie_ch_mode,
		&ett_ie_enc_inf,
		&ett_ie_ch_no,
		&ett_ie_frame_no,
		&ett_ie_ho_ref,
		&ett_ie_l1_inf,
		&ett_ie_L3_inf,
		&ett_ie_ms_id,
		&ett_ie_ms_pow,
		&ett_ie_phy_ctx,
		&ett_ie_paging_grp,
		&ett_ie_paging_load,
		&ett_ie_access_delay,
		&ett_ie_rach_load,
		&ett_ie_req_ref,
		&ett_ie_rel_mode,
		&ett_ie_resource_inf,
		&ett_ie_rlm_cause,
		&ett_ie_staring_time,
		&ett_ie_timing_adv,
		&ett_ie_uplik_meas,
		&ett_ie_full_imm_ass_inf,
		&ett_ie_ms_timing_offset,
		&ett_ie_err_msg,
		&ett_ie_full_bcch_inf,
		&ett_ie_ch_needed,
		&ett_ie_emlpp_prio,
		&ett_ie_main_ch_ref,
		&ett_ie_multirate_conf,
		&ett_ie_cause,
		&ett_ie_meas_res_no,
		&ett_ie_message_id,
		&ett_ie_sys_info_type,
	};

	/* Register the protocol name and description */
	proto_rsl = proto_register_protocol("Radio Signalling Link (RSL)",
	                                    "RSL", "rsl");

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


}