summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gsm_rlcmac.h
blob: f96431beff8bb41c1a8e4636adf52252c0c7adec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
/* packet-gsm_rlcmac.h
 * Definitions for GSM RLC MAC control plane message dissection in wireshark.
 * TS 44.060 and 24.008
 * By Vincent Helfre, based on original code by Jari Sassi
 * with the gracious authorization of STE
 * Copyright (c) 2011 ST-Ericsson
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef __PACKET_GSM_RLCMAC_H__
#define __PACKET_GSM_RLCMAC_H__

#ifndef PRE_PACKED
#define PRE_PACKED
#endif

#ifndef POST_PACKED
#define POST_PACKED
#endif

#define GSM_RLC_MAC_MAGIC_NUMBER  0x67707273

typedef uint8_t TFI_t;

typedef uint8_t N32_t;
typedef uint8_t N51_t;
typedef uint8_t N26_t;

/*  Starting Time IE as specified in 04.08 */
typedef struct
{
  N32_t N32;  /* 04.08 refers to T1' := (FN div 1326) mod 32 */
  N51_t N51;  /* 04.08 refers to T3 := FN mod 51 */
  N26_t N26;  /* 04.08 refers to T2 := FN mod 26 */
} StartingTime_t;

typedef struct
{
  uint8_t UnionType;/* UnionType is index */
  union
  {
    uint8_t UPLINK_TFI;
    uint8_t DOWNLINK_TFI;
  } u;
} Global_TFI_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    StartingTime_t StartingTime;
    uint16_t k;
  } u;
} Starting_Frame_Number_t;

typedef struct
{
  uint8_t FINAL_ACK_INDICATION;
  uint8_t STARTING_SEQUENCE_NUMBER;
  uint8_t RECEIVED_BLOCK_BITMAP[64/8];
} Ack_Nack_Description_t;


typedef struct
{
  uint8_t Exist_TIMING_ADVANCE_VALUE;
  uint8_t TIMING_ADVANCE_VALUE;

  uint8_t Exist_IndexAndtimeSlot;
  uint8_t TIMING_ADVANCE_INDEX;
  uint8_t TIMING_ADVANCE_TIMESLOT_NUMBER;
} Packet_Timing_Advance_t;

typedef struct
{
  uint8_t ALPHA;

  struct
  {
    uint8_t Exist;
    uint8_t GAMMA_TN;
  } Slot[8];
} Power_Control_Parameters_t;

typedef struct
{
  uint8_t ALPHA;
  uint8_t T_AVG_W;
  uint8_t T_AVG_T;
  uint8_t Pb;
  uint8_t PC_MEAS_CHAN;
  uint8_t INT_MEAS_CHANNEL_LIST_AVAIL;
  uint8_t N_AVG_I;
} Global_Power_Control_Parameters_t;

typedef struct
{
  uint8_t Exist_TIMING_ADVANCE_VALUE;
  uint8_t TIMING_ADVANCE_VALUE;

  uint8_t Exist_UPLINK_TIMING_ADVANCE;
  uint8_t UPLINK_TIMING_ADVANCE_INDEX;
  uint8_t UPLINK_TIMING_ADVANCE_TIMESLOT_NUMBER;

  uint8_t Exist_DOWNLINK_TIMING_ADVANCE;
  uint8_t DOWNLINK_TIMING_ADVANCE_INDEX;
  uint8_t DOWNLINK_TIMING_ADVANCE_TIMESLOT_NUMBER;
} Global_Packet_Timing_Advance_t;


typedef struct
{
  uint8_t C_VALUE;
  uint8_t RXQUAL;
  uint8_t SIGN_VAR;

  struct
  {
    uint8_t Exist;
    uint8_t I_LEVEL_TN;
  } Slot[8];
} Channel_Quality_Report_t;

typedef enum
{
  RLC_MODE_ACKNOWLEDGED = 0,
  RLC_MODE_UNACKNOWLEDGED = 1
} RLC_MODE_t;

typedef struct
{
  uint8_t PEAK_THROUGHPUT_CLASS;
  uint8_t RADIO_PRIORITY;
  RLC_MODE_t RLC_MODE;
  uint8_t LLC_PDU_TYPE;
  uint16_t RLC_OCTET_COUNT;
} Channel_Request_Description_t;

typedef struct
{
  uint16_t RANDOM_ACCESS_INFORMATION;
  uint8_t FRAME_NUMBER[2];
} Packet_Request_Reference_t;

typedef PRE_PACKED struct
{
  uint8_t nsapi;
  uint8_t value;
} Receive_N_PDU_Number_t POST_PACKED;

typedef PRE_PACKED struct
{
  uint8_t IEI;
  uint8_t Length;

  uint8_t Count_Receive_N_PDU_Number;
  Receive_N_PDU_Number_t Receive_N_PDU_Number[11];
} Receive_N_PDU_Number_list_t POST_PACKED;

/** IMSI length */
#define IMSI_LEN  9

/** TMSI length */
#define TMSI_LEN  4

typedef  struct
{
  uint8_t MCC1;
  uint8_t MCC2;
  uint8_t MCC3;
  uint8_t MNC3;
  uint8_t MNC1;
  uint8_t MNC2;
} PLMN_t;


/** This type is used to describe LAI codes */
typedef PRE_PACKED struct
{
  PLMN_t  PLMN;
  uint16_t LAC;
} LAI_t POST_PACKED;


/** Length of LAI */
#define LAI_LEN  (sizeof(LAI_t))

typedef struct
{
  uint8_t      TMSI[TMSI_LEN];
} TMSI_t;

typedef uint16_t CellId_t;


#define CKSN_NOT_VALID                7

#define IMEI_LEN                      9

#define IMEISV_LEN                    10

#define MAX_ELEMENTS_IN_EQPLMN_LIST   16


typedef struct
{
  uint8_t NUMBER_CELLS;
  uint8_t CCN_SUPPORTED[16];  /* bit (1), max size: 16 x 8 => 128 bits */
} CCN_Support_Description_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    uint8_t LSA_ID;
    uint8_t ShortLSA_ID;
  } u;
} LSA_ID_Info_Element_t;

#define LSA_ID_INFO_ELEMENTS_MAX (16)

typedef struct
{
  uint8_t Count_LSA_ID_Info_Element;
  LSA_ID_Info_Element_t LSA_ID_Info_Elements[LSA_ID_INFO_ELEMENTS_MAX];
} LSA_ID_Info_t;

#define NR_OF_FREQ_OR_CELLS_MAX (32)

typedef struct
{
  uint8_t NR_OF_FREQ_OR_CELLS;
  LSA_ID_Info_t LSA_ID_Info[NR_OF_FREQ_OR_CELLS_MAX];
} LSA_Parameters_t;

#define MAX_REPORT_PRIORITY_CELLS (16)

typedef struct
{
  uint8_t NUMBER_CELLS;
  uint8_t REPORT_PRIORITY[MAX_REPORT_PRIORITY_CELLS];
} ReportPriority_t;

typedef ReportPriority_t GPRSReportPriority_t;

typedef struct
{
  uint8_t REPORTING_OFFSET;
  uint8_t REPORTING_THRESHOLD;
} OffsetThreshold_t;


typedef struct
{
  uint8_t            Exist_MULTI_BAND_REPORTING;
  uint8_t            MULTI_BAND_REPORTING;

  uint8_t            Exist_SERVING_BAND_REPORTING;
  uint8_t            SERVING_BAND_REPORTING;

  /* Warning:
   *
   * SI2quater, MI, PMO, and PCCO always specify Scale Ord.  There is no
   * "exist SCALE_ORD" bit in the CSN.1 descriptions for these messages.
   * However, this struct is shared with the PSI5 message which may or may
   * not specify SCALE_ORD, thus necessitating the inclusion of member
   * Exist_SCALE_ORD in the struct.  This member is never set for SI2quater, MI,
   * PMO, and PCCO so to check it (in these cases) would be erroneous.
   */
  uint8_t            Exist_SCALE_ORD;
  uint8_t            SCALE_ORD;

  uint8_t            Exist_OffsetThreshold900;
  OffsetThreshold_t OffsetThreshold900;

  uint8_t            Exist_OffsetThreshold1800;
  OffsetThreshold_t OffsetThreshold1800;

  uint8_t            Exist_OffsetThreshold400;
  OffsetThreshold_t OffsetThreshold400;

  uint8_t            Exist_OffsetThreshold1900;
  OffsetThreshold_t OffsetThreshold1900;

  uint8_t            Exist_OffsetThreshold850;
  OffsetThreshold_t OffsetThreshold850;

} MeasurementParams_t;

typedef struct
{
  uint8_t Exist_FDD_REPORTING_THRESHOLD_2;
  uint8_t FDD_REPORTING_THRESHOLD_2;
} GPRS_AdditionalMeasurementParams3G_t;


typedef struct
{
  uint8_t NETWORK_CONTROL_ORDER;

  uint8_t Exist_NC;
  uint8_t NC_NON_DRX_PERIOD;
  uint8_t NC_REPORTING_PERIOD_I;
  uint8_t NC_REPORTING_PERIOD_T;
} NC_Measurement_Parameters_t;


/*
**========================================================================
**  Global types
**========================================================================
*/

struct MobileId     /* Mobile id, -> TMSI, IMEI or IMSI */
{
  uint8_t Length;
  uint8_t IdType;
  uint8_t OddEven;
  uint8_t Dig1;
  union
  {
    unsigned char TMSI[TMSI_LEN];
    unsigned char IMEI[IMEI_LEN - 2];
    unsigned char IMSI[IMEI_LEN - 2];
    unsigned char IMEISV[IMEISV_LEN - 2];
  } Id;
};

#if 0
struct OV_MobileId    /* Struct for optional mobile identity */
{
  unsigned char   IEI;
  struct MobileId MV;
};

#define LAC_INVALID 0xFEFF

typedef enum
{
  LAI_PRIORITY_AVAILABLE,
  LAI_PRIORITY_FORBIDDEN,
  LAI_PRIORITY_FORCED
} LAI_Priority_t;

typedef enum
{
  NOM_I,
  NOM_II,
  NOM_III,
  NOM_GSM,
  NOM_PS_ONLY,
  NOM_UNKNOWN
} NMO_t;

typedef enum
{
  COMBINED,
  NOT_COMBINED,
  SAME_AS_BEFORE
} ProcedureMode_t;

typedef struct
{
  uint8_t              Cause;
  LAI_t               LAI;
  struct OV_MobileId  MobileId;
} CombinedResult_t;

typedef enum
{
  R97,
  R99
} MSCR_t, SGSNR_t;

typedef struct
{
  uint8_t   NbrOfElements;
  PLMN_t   Element[MAX_ELEMENTS_IN_EQPLMN_LIST];
} EqPLMN_List_t;
#endif

#define MAX_PCCCH                       16
#define MAX_RFL_LENGTH                  16 /* length of RFL in PSI2 */
#define MAX_RFLS                         4 /* Max number of RFLs */
#define MAX_MA_LISTS_IN_PSI2             8 /* MAX MA lists = 8 */
#define MAX_ALLOCATION_BITMAP_LENGTH   128 /* max length of Fixed Allocation bitmap in BITS (2^7) */
#define MAX_VAR_LENGTH_BITMAP_LENGTH   176 /* max length ever possible for variable length fixed allocation bitmap */


typedef struct
{
  uint8_t MA_LENGTH;/* =(MA_BitLength +7) MA_BitLength_ converted to bytes */
  uint8_t MA_BITMAP[(63+1)/8];/* : bit (val (MA_LENGTH) + 1) > */
  /* The above should not change order! */
  uint8_t MA_BitLength;
} MobileAllocation_t;

typedef struct
{
  uint8_t ElementsOf_ARFCN_INDEX;
  uint8_t ARFCN_INDEX[16];
} ARFCN_index_list_t;

typedef struct
{
  uint8_t HSN;

  uint8_t ElementsOf_RFL_NUMBER;
  uint8_t RFL_NUMBER[4];

  uint8_t UnionType;
  union
  {
    MobileAllocation_t MA;
    ARFCN_index_list_t ARFCN_index_list;
  } u;
} GPRS_Mobile_Allocation_t;

/* < EGPRS Ack/Nack Description >
 * CRBB - Compressed Received Blocks Bitmap
 * URBB - Uncompressed Received Blocks Bitmap
 */
#define EGPRS_ACK_NACK_MAX_BITS 0x0FF /* 255 bits/32 bytes */
#define CRBB_MAX_BITS           0x07F /* 127 bits/16 bytes */
#define URBB_MAX_BITS           0x150 /* 336 bits/42 bytes */

typedef struct
{
  uint8_t  FINAL_ACK_INDICATION;
  uint8_t  BEGINNING_OF_WINDOW;
  uint8_t  END_OF_WINDOW;
  uint16_t STARTING_SEQUENCE_NUMBER;

  bool Exist_CRBB;
  uint8_t  CRBB_LENGTH;
  uint8_t  CRBB_STARTING_COLOR_CODE;
  uint8_t  CRBB[CRBB_MAX_BITS/8 + 1];

  uint16_t URBB_LENGTH;
  uint8_t  URBB[URBB_MAX_BITS/8];
} EGPRS_AckNack_Desc_t;

typedef struct
{
  uint8_t  UnionType;
  EGPRS_AckNack_Desc_t Desc;
} EGPRS_AckNack_t;

typedef struct
{
  uint8_t  LENGTH;
  EGPRS_AckNack_Desc_t Desc;
} EGPRS_AckNack_w_len_t;


/* <P1 Rest Octets>
 * <P2 Rest Octets>
 */
#if 0
#define  SF_VBS  0   /* VBS (broadcast call reference) */
#define  SF_VGCS  1  /* VGCS (group call reference) */

#define  AF_AckIsNotRequired  0  /* acknowledgement is not required */
#define  AF_AckIsRequired     1  /* acknowledgement is required */
#endif

typedef struct
{
  uint32_t value;
  uint8_t SF;
  uint8_t AF;
  uint8_t call_priority;
  uint8_t Ciphering_information;
} Group_Call_Reference_t;

/* Mobile allocation is coded differently but uses the same type! */
typedef struct
{
  uint8_t Length;
  uint8_t MA[8];
} MobileAllocationIE_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    MobileAllocationIE_t MA;
    uint8_t Frequency_Short_List[64/8];
  } u;
} MobileAllocation_or_Frequency_Short_List_t;

typedef struct
{
  uint8_t spare;
  uint16_t ARFCN;
} SingleRFChannel_t;

typedef struct
{
  uint8_t MAIO;
  uint8_t HSN;
} RFHoppingChannel_t;

typedef struct
{
  uint8_t Channel_type_and_TDMA_offset;
  uint8_t TN;
  uint8_t TSC;

  uint8_t UnionType;
  union
  {
    SingleRFChannel_t SingleRFChannel;
    RFHoppingChannel_t RFHoppingChannel;
  } u;
} Channel_Description_t;

typedef struct
{
  Channel_Description_t Channel_Description;

  uint8_t Exist_Hopping;
  MobileAllocation_or_Frequency_Short_List_t MA_or_Frequency_Short_List;

} Group_Channel_Description_t;

typedef struct
{
  Group_Call_Reference_t Group_Call_Reference;

  uint8_t Exist_Group_Channel_Description;
  Group_Channel_Description_t Group_Channel_Description;
} Group_Call_information_t;

typedef struct
{
  uint8_t Exist_NLN_PCH_and_NLN_status;
  uint8_t NLN_PCH;
  uint8_t NLN_status;

  uint8_t Exist_Priority1;
  uint8_t Priority1;

  uint8_t Exist_Priority2;
  uint8_t Priority2;

  uint8_t Exist_Group_Call_information;
  Group_Call_information_t Group_Call_information;

  uint8_t Packet_Page_Indication_1;
  uint8_t Packet_Page_Indication_2;
} P1_Rest_Octets_t;

typedef struct
{
  uint8_t Exist_CN3;
  uint8_t CN3;

  uint8_t Exist_NLN_and_status;
  uint8_t NLN;
  uint8_t NLN_status;

  uint8_t Exist_Priority1;
  uint8_t Priority1;

  uint8_t Exist_Priority2;
  uint8_t Priority2;

  uint8_t Exist_Priority3;
  uint8_t Priority3;

  uint8_t Packet_Page_Indication_3;
} P2_Rest_Octets_t;

/* <IA Rest Octets> incl additions for R99 and EGPRS */

typedef struct
{
  uint8_t USF;
  uint8_t USF_GRANULARITY;

  uint8_t Exist_P0_PR_MODE;
  uint8_t P0;
  uint8_t PR_MODE;
} DynamicAllocation_t;

typedef struct
{
  bool Exist_ALPHA;
  uint8_t  ALPHA;

  uint8_t  GAMMA;
  StartingTime_t TBF_STARTING_TIME;
  uint8_t  NR_OF_RADIO_BLOCKS_ALLOCATED;

  bool Exist_P0_BTS_PWR_CTRL_PR_MODE;
  uint8_t  P0;
  uint8_t  BTS_PWR_CTRL_MODE;
  uint8_t  PR_MODE;
} EGPRS_TwoPhaseAccess_t;

typedef struct
{
  uint8_t TFI_ASSIGNMENT;
  uint8_t POLLING;

  uint8_t UnionType;
  union
  {
    DynamicAllocation_t DynamicAllocation;
    uint8_t              FixedAllocationDummy;   /* Fixed Allocation was removed */
  } Allocation;

  uint8_t  EGPRS_CHANNEL_CODING_COMMAND;
  uint8_t  TLLI_BLOCK_CHANNEL_CODING;

  bool Exist_BEP_PERIOD2;
  uint8_t  BEP_PERIOD2;

  uint8_t  RESEGMENT;
  uint8_t  EGPRS_WindowSize;

  bool Exist_ALPHA;
  uint8_t  ALPHA;

  uint8_t  GAMMA;

  bool Exist_TIMING_ADVANCE_INDEX;
  uint8_t  TIMING_ADVANCE_INDEX;

  bool                Exist_TBF_STARTING_TIME;
  StartingTime_t TBF_STARTING_TIME;
} EGPRS_OnePhaseAccess_t;

#define MAX_ACCESS_TECHOLOGY_TYPES 12

typedef struct
{
  uint8_t ExtendedRA;

  uint8_t NrOfAccessTechnologies;
  uint8_t AccessTechnologyType[MAX_ACCESS_TECHOLOGY_TYPES];

  uint8_t UnionType;
  union
  {
    EGPRS_TwoPhaseAccess_t TwoPhaseAccess; /* 04.18/10.5.2.16 Multiblock allocation */
    EGPRS_OnePhaseAccess_t OnePhaseAccess; /* 04.60/10.5.2.16 TFI using Dynamic or Fixed Allocation */
  } Access;
} IA_EGPRS_00_t;

typedef struct
{
  uint8_t          UnionType;
  union
  {
    IA_EGPRS_00_t IA_EGPRS_PUA; /* 00 < EGPRS Packet Uplink Assignment >*/
    uint8_t        IA_EGPRS_01;  /* 01 reserved for future use */
    uint8_t        IA_EGPRS_1;   /* 1  reserved for future use */
  } u;
} IA_EGPRS_t;

typedef struct
{
  uint8_t Length;
  uint8_t MAIO;
  uint8_t MobileAllocation[62];
} IA_FreqParamsBeforeTime_t;

typedef struct
{
  bool Exist_ALPHA;
  uint8_t  ALPHA;

  uint8_t  GAMMA;
  uint8_t  R97_CompatibilityBits;
  StartingTime_t TBF_STARTING_TIME;

  bool Exist_P0_BTS_PWR_CTRL_PR_MODE;
  uint8_t  P0;
  uint8_t  BTS_PWR_CTRL_MODE;
  uint8_t  PR_MODE;
} GPRS_SingleBlockAllocation_t;

typedef struct
{
  uint8_t TFI_ASSIGNMENT;
  uint8_t POLLING;

  uint8_t UnionType;
  union
  {
    DynamicAllocation_t DynamicAllocation;
    uint8_t              FixedAllocationDummy;
  } Allocation;

  uint8_t             CHANNEL_CODING_COMMAND;
  uint8_t             TLLI_BLOCK_CHANNEL_CODING;

  uint8_t             Exist_ALPHA;
  uint8_t             ALPHA;

  uint8_t             GAMMA;

  uint8_t             Exist_TIMING_ADVANCE_INDEX;
  uint8_t             TIMING_ADVANCE_INDEX;

  uint8_t             Exist_TBF_STARTING_TIME;
  StartingTime_t TBF_STARTING_TIME;
} GPRS_DynamicOrFixedAllocation_t;

typedef struct
{
  bool Exist_ExtendedRA;
  uint8_t  ExtendedRA;
} PU_IA_AdditionsR99_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    GPRS_SingleBlockAllocation_t    SingleBlockAllocation;
    GPRS_DynamicOrFixedAllocation_t DynamicOrFixedAllocation;
  } Access;

  bool                   Exist_AdditionsR99;
  PU_IA_AdditionsR99_t  AdditionsR99;
} Packet_Uplink_ImmAssignment_t;

typedef struct
{
  uint8_t  EGPRS_WindowSize;
  uint8_t  LINK_QUALITY_MEASUREMENT_MODE;

  bool Exist_BEP_PERIOD2;
  uint8_t  BEP_PERIOD2;
} PD_IA_AdditionsR99_t;

typedef struct
{
  uint32_t              TLLI;

  uint8_t               Exist_TFI_to_TA_VALID;
  uint8_t               TFI_ASSIGNMENT;
  uint8_t               RLC_MODE;
  uint8_t               Exist_ALPHA;
  uint8_t               ALPHA;
  uint8_t               GAMMA;
  uint8_t               POLLING;
  uint8_t               TA_VALID;

  uint8_t               Exist_TIMING_ADVANCE_INDEX;
  uint8_t               TIMING_ADVANCE_INDEX;

  uint8_t               Exist_TBF_STARTING_TIME;
  StartingTime_t       TBF_STARTING_TIME;

  uint8_t               Exist_P0_PR_MODE;
  uint8_t               P0;
  uint8_t               BTS_PWR_CTRL_MODE;
  uint8_t               PR_MODE;

  bool                  Exist_AdditionsR99;
  PD_IA_AdditionsR99_t AdditionsR99;
} Packet_Downlink_ImmAssignment_t;

typedef struct
{
  bool Exist_SecondPart;

  bool Exist_ExtendedRA;
  uint8_t  ExtendedRA;
} Second_Part_Packet_Assignment_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Packet_Uplink_ImmAssignment_t   Packet_Uplink_ImmAssignment;
    Packet_Downlink_ImmAssignment_t Packet_Downlink_ImmAssignment;
  } ul_dl;
} IA_PacketAssignment_UL_DL_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    IA_PacketAssignment_UL_DL_t     UplinkDownlinkAssignment;
    Second_Part_Packet_Assignment_t Second_Part_Packet_Assignment;
  } u;
} IA_PacketAssignment_t;

#if 0
typedef struct
{
  uint8_t UnionType;
  union
  {
    IA_FreqParamsBeforeTime_t IA_FrequencyParams;
    IA_PacketAssignment_t     IA_PacketAssignment;
  } u;
} IA_GPRS_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    IA_EGPRS_t IA_EGPRS_Struct;
    IA_GPRS_t  IA_GPRS_Struct;
  } u;
} IA_t;


/* <IAR Rest Octets> ref: 04.18/10.5.2.17 */
typedef struct
{
  uint8_t Exist_ExtendedRA;
  uint8_t ExtendedRA;
} ExtendedRA_Info_t;

typedef ExtendedRA_Info_t ExtendedRA_Info_Array_t[4];

typedef struct
{
  ExtendedRA_Info_Array_t ExtendedRA_Info;
} IAR_t;
#endif

/* Packet Polling Request */
typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_TFI_t Global_TFI;
    uint32_t TLLI;
    uint16_t TQI;
  } u;
} PacketPollingID_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;
  PacketPollingID_t ID;
  uint8_t TYPE_OF_ACK;
} Packet_Polling_Request_t;

/* < SI 13 Rest Octets > */
#define MAX_EXTENSION_LENGTH_IN_BYTES (8) /* max value = 64 (coded on 6 bits) */

typedef struct
{
  uint8_t extension_length;
  uint8_t Extension_Info[MAX_EXTENSION_LENGTH_IN_BYTES];/* ( val (extension length)+1 ) 04.60/12.26 */
} Extension_Bits_t;

#if 0
typedef struct
{
  uint8_t DTM_SUPPORT                  : 1;
  uint8_t PFC_FEATURE_MODE             : 1;
  uint8_t BEP_PERIOD                   : 4;
  uint8_t EGPRS_PACKET_CHANNEL_REQUEST : 1;
  uint8_t EGPRS_Support                  : 1;

  uint8_t NotUsed                        : 3;
  uint8_t EXT_UTBF_NODATA              : 1;
  uint8_t MULTIPLE_TBF_CAPABILITY      : 1;
  uint8_t NW_EXT_UTBF                  : 1;
  uint8_t CCN_ACTIVE                   : 1;
  uint8_t BSS_PAGING_COORDINATION      : 1;
} GPRS_ExtensionInfoWithEGPRS_t;

typedef struct
{
  uint8_t EXT_UTBF_NODATA         : 1;
  uint8_t MULTIPLE_TBF_CAPABILITY : 1;
  uint8_t NW_EXT_UTBF             : 1;
  uint8_t CCN_ACTIVE              : 1;
  uint8_t BSS_PAGING_COORDINATION : 1;
  uint8_t DTM_SUPPORT             : 1;
  uint8_t PFC_FEATURE_MODE        : 1;
  uint8_t EGPRS_Support             : 1;
} GPRS_ExtensionInfoWithoutEGPRS_t;

typedef struct
{
  uint8_t NotUsed                   : 7;
  uint8_t EGPRS_Support             : 1;
} EGPRS_Support_t;

typedef struct
{
  uint8_t ECSC    : 1;
  uint8_t ECSR_3G : 1;
} NonGPRS_ExtensionInfo_t;

typedef struct
{
  uint8_t Extension_Length;
  union
  {
    EGPRS_Support_t                  EGPRS_Support;
    GPRS_ExtensionInfoWithEGPRS_t    GPRS_ExtensionInfoWithEGPRS;
    GPRS_ExtensionInfoWithoutEGPRS_t GPRS_ExtensionInfoWithoutEGPRS;
    NonGPRS_ExtensionInfo_t          NonGPRS_ExtensionInfo;
    uint8_t                          Extension_Information[MAX_EXTENSION_LENGTH_IN_BYTES];
  } u;
} Optional_Extension_Information_t;

typedef struct
{
  bool EGPRS_Support;
  uint8_t  BEP_PERIOD;
  bool EGPRS_PACKET_CHANNEL_REQUEST;
} EGPRS_OptionalExtensionInformation_t;
#endif

typedef struct
{
  uint8_t NMO;
  uint8_t T3168;
  uint8_t T3192;
  uint8_t DRX_TIMER_MAX;
  uint8_t ACCESS_BURST_TYPE;
  uint8_t CONTROL_ACK_TYPE;
  uint8_t BS_CV_MAX;

  uint8_t Exist_PAN;
  uint8_t PAN_DEC;
  uint8_t PAN_INC;
  uint8_t PAN_MAX;

  uint8_t Exist_Extension_Bits;
  Extension_Bits_t Extension_Bits;
} GPRS_Cell_Options_t;

typedef struct
{
  uint8_t ALPHA;
  uint8_t T_AVG_W;
  uint8_t T_AVG_T;
  uint8_t PC_MEAS_CHAN;
  uint8_t N_AVG_I;
} GPRS_Power_Control_Parameters_t;

typedef struct
{
  uint8_t RAC;
  uint8_t SPGC_CCCH_SUP;
  uint8_t PRIORITY_ACCESS_THR;
  uint8_t NETWORK_CONTROL_ORDER;
  GPRS_Cell_Options_t GPRS_Cell_Options;
  GPRS_Power_Control_Parameters_t GPRS_Power_Control_Parameters;
} PBCCH_Not_present_t;

typedef struct
{
  uint8_t Pb;
  uint8_t TSC;
  uint8_t TN;

  uint8_t UnionType;
  union
  {
    uint8_t dummy;
    uint16_t ARFCN;
    uint8_t MAIO;
  } u;
} PBCCH_Description_t;

typedef struct
{
  uint8_t PSI1_REPEAT_PERIOD;
  PBCCH_Description_t PBCCH_Description;
} PBCCH_present_t;



/* < Packet TBF Release message content > */
typedef uint8_t TBF_RELEASE_CAUSE_t;
#if 0
#define  TBF_RELEASE_CAUSE_NORMAL (0x00)
#define  TBF_RELEASE_CAUSE_ABNORMAL (0x02)
#endif

typedef struct
{
  uint8_t              MESSAGE_TYPE;
  uint8_t              PAGE_MODE;
  Global_TFI_t         Global_TFI;
  uint8_t              UPLINK_RELEASE;
  uint8_t              DOWNLINK_RELEASE;
  TBF_RELEASE_CAUSE_t TBF_RELEASE_CAUSE;
} Packet_TBF_Release_t;

/* < Packet Control Acknowledgement message content > */
typedef struct
{
  uint8_t Exist_CTRL_ACK_Extension;
  uint16_t CTRL_ACK_Extension;
} Packet_Control_Acknowledgement_AdditionsR6_t;

typedef struct
{
  uint8_t Exist_TN_RRBP;
  uint8_t TN_RRBP;
  uint8_t Exist_G_RNTI_Extension;
  uint8_t G_RNTI_Extension;
  bool Exist_AdditionsR6;
  Packet_Control_Acknowledgement_AdditionsR6_t AdditionsR6;
} Packet_Control_Acknowledgement_AdditionsR5_t;

typedef struct
{  /* Mac header */
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  uint32_t TLLI;
  uint8_t CTRL_ACK;
  bool Exist_AdditionsR5;
  Packet_Control_Acknowledgement_AdditionsR5_t AdditionsR5;
} Packet_Control_Acknowledgement_t;

typedef Packet_Control_Acknowledgement_t Packet_Ctrl_Ack_t;

#if 0
typedef struct
{
  uint8_t CTRL_ACK;
} Packet_Control_Acknowledgement_11_bit_t, Packet_Control_Acknowledgement_8_bit_t;
#endif

/* < Packet Downlink Dummy Control Block message content > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  uint8_t Exist_PERSISTENCE_LEVEL;
  uint8_t PERSISTENCE_LEVEL[4];
} Packet_Downlink_Dummy_Control_Block_t;

/* < Packet Uplink Dummy Control Block message content > */
typedef struct
{ /* Mac header */
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  uint32_t TLLI;
} Packet_Uplink_Dummy_Control_Block_t;

/* MS Radio Access capability IE >
 * 24.008 (10.5.5.12a)
 */
typedef uint8_t A5_bits_t;/* <A5 bits> ::= < A5/1 : bit> <A5/2 : bit> <A5/3 : bit> <A5/4 : bit> <A5/5 : bit> <A5/6 : bit> <A5/7 : bit>; -- bits for circuit mode ciphering algorithms */

typedef struct
{
  uint8_t Exist_DTM_EGPRS_multislot_class;
  uint8_t DTM_EGPRS_multislot_class;
} DTM_EGPRS_t;

typedef struct
{
  uint8_t Exist_DTM_EGPRS_HighMultislotClass;
  uint8_t DTM_EGPRS_HighMultislotClass;
} DTM_EGPRS_HighMultislotClass_t;

typedef struct
{
  uint8_t MultislotCapabilityReductionForDL_DualCarrier;
  uint8_t DL_DualCarrierForDTM;
} DownlinkDualCarrierCapability_r7_t;

typedef struct
{
  uint8_t Exist_HSCSD_multislot_class;
  uint8_t HSCSD_multislot_class;

  uint8_t Exist_GPRS_multislot_class;
  uint8_t GPRS_multislot_class;
  uint8_t GPRS_Extended_Dynamic_Allocation_Capability;

  uint8_t Exist_SM;
  uint8_t SMS_VALUE;
  uint8_t SM_VALUE;

/*-------- Rel 99 additions */
  uint8_t Exist_ECSD_multislot_class;
  uint8_t ECSD_multislot_class;

  uint8_t Exist_EGPRS_multislot_class;
  uint8_t EGPRS_multislot_class;
  uint8_t EGPRS_Extended_Dynamic_Allocation_Capability;

  uint8_t Exist_DTM_GPRS_multislot_class;
  uint8_t DTM_GPRS_multislot_class;
  uint8_t Single_Slot_DTM;
  DTM_EGPRS_t DTM_EGPRS_Params;
} Multislot_capability_t;

typedef struct
{
  uint8_t RF_Power_Capability;

  uint8_t Exist_A5_bits;
  A5_bits_t A5_bits;
  /*-- zero means that the same values apply for parameters as in the immediately preceding Access capabilities field within this IE
  *-- The presence of the A5 bits is mandatory in the 1st Access capabilies struct within this IE.
  */

  uint8_t ES_IND;
  uint8_t PS;
  uint8_t VGCS;
  uint8_t VBS;

  uint8_t Exist_Multislot_capability;
  Multislot_capability_t Multislot_capability;
  /* -- zero means that the same values apply for multislot parameters as in the immediately preceding Access capabilities field within this IE.
   * -- The presence of the Multislot capability struct is mandatory in the 1st Access capabilites struct within this IE.
   */
  /* -------- Rel 99 additions */
  uint8_t Exist_Eight_PSK_Power_Capability;
  uint8_t Eight_PSK_Power_Capability;

  uint8_t COMPACT_Interference_Measurement_Capability;
  uint8_t Revision_Level_Indicator;
  uint8_t UMTS_FDD_Radio_Access_Technology_Capability;
  uint8_t UMTS_384_TDD_Radio_Access_Technology_Capability;
  uint8_t CDMA2000_Radio_Access_Technology_Capability;

  /* -------- R4 additions */
  uint8_t UMTS_128_TDD_Radio_Access_Technology_Capability;
  uint8_t GERAN_Feature_Package_1;

  uint8_t Exist_Extended_DTM_multislot_class;
  uint8_t Extended_DTM_GPRS_multislot_class;
  uint8_t Extended_DTM_EGPRS_multislot_class;

  uint8_t Modulation_based_multislot_class_support;

  /* -------- R5 additions */
  uint8_t Exist_HighMultislotCapability;
  uint8_t HighMultislotCapability;

  uint8_t Exist_GERAN_lu_ModeCapability;
  uint8_t GERAN_lu_ModeCapability;

  uint8_t GMSK_MultislotPowerProfile;
  uint8_t EightPSK_MultislotProfile;

  /* -------- R6 additions */
  uint8_t MultipleTBF_Capability;
  uint8_t DownlinkAdvancedReceiverPerformance;
  uint8_t ExtendedRLC_MAC_ControlMessageSegmentionsCapability;
  uint8_t DTM_EnhancementsCapability;

  uint8_t Exist_DTM_GPRS_HighMultislotClass;
  uint8_t DTM_GPRS_HighMultislotClass;
  DTM_EGPRS_HighMultislotClass_t DTM_EGPRS_HighMultislotClass;
  uint8_t PS_HandoverCapability;

  /* -------- R7 additions */
  uint8_t DTM_Handover_Capability;
  uint8_t Exist_DownlinkDualCarrierCapability_r7;
  DownlinkDualCarrierCapability_r7_t DownlinkDualCarrierCapability_r7;

  uint8_t FlexibleTimeslotAssignment;
  uint8_t GAN_PS_HandoverCapability;
  uint8_t RLC_Non_persistentMode;
  uint8_t ReducedLatencyCapability;
  uint8_t UplinkEGPRS2;
  uint8_t DownlinkEGPRS2;

  /* -------- R8 additions */
  uint8_t EUTRA_FDD_Support;
  uint8_t EUTRA_TDD_Support;
  uint8_t GERAN_To_EUTRAN_supportInGERAN_PTM;
  uint8_t PriorityBasedReselectionSupport;

} Content_t;

typedef enum
{/* See TS 24.008 table 10.5.146 */
  AccTech_GSMP     = 0x0,
  AccTech_GSME     = 0x1,
  AccTech_GSMR     = 0x2,
  AccTech_GSM1800  = 0x3,
  AccTech_GSM1900  = 0x4,
  AccTech_GSM450   = 0x5,
  AccTech_GSM480   = 0x6,
  AccTech_GSM850   = 0x7,
  AccTech_GSM750   = 0x8,
  AccTech_GSMT830  = 0x9,
  AccTech_GSMT410  = 0xa,
  AccTech_GSMT900  = 0xb,
  AccTech_GSM710   = 0xc,
  AccTech_GSMT810  = 0xd,
  AccTech_GSMOther = 0xf
} AccessTechnology_t;

/* Maximum entries in one message, Enum above, applying restrictions from section
   12.30 "MS Radio Access Capability 2": */
#define MAX_ACCESS_TECHNOLOGIES_COUNT 11

typedef struct
{
  AccessTechnology_t Access_Technology_Type;
  uint8_t             GMSK_Power_class;
  uint8_t             Eight_PSK_Power_class;
} Additional_access_technologies_struct_t;

typedef struct
{
  uint8_t Count_additional_access_technologies;
  /* The value 0xf cannot be set for the first ATT, therefore we can only have
     ABSOLUTE_MAX_BANDS-1 additional access technologies. */
  Additional_access_technologies_struct_t Additional_access_technologies[MAX_ACCESS_TECHNOLOGIES_COUNT-1];
} Additional_access_technologies_t;

typedef struct
{
  uint8_t IndexOfAccTech; /* Position in AccessTechnology_t */
  union
  {
    /* Long Form */
    Content_t                        Content;
    /* Short Form */
    Additional_access_technologies_t Additional_access_technologies;
  } u;
} MS_RA_capability_value_t;

typedef struct
{
  uint8_t Count_MS_RA_capability_value; /* Recursive */
  MS_RA_capability_value_t MS_RA_capability_value[MAX_ACCESS_TECHNOLOGIES_COUNT];
} MS_Radio_Access_capability_t;


typedef struct
{
  uint8_t  ExistEDGE_RF_PwrCap1;
  uint8_t  EDGE_RF_PwrCap1;
  uint8_t  ExistEDGE_RF_PwrCap2;
  uint8_t  EDGE_RF_PwrCap2;
} EDGE_RF_Pwr_t;

typedef struct
{
  uint8_t A5_Bits;
  uint8_t Arc2_Spare;
  uint8_t Arc1;
} ARC_t;

typedef struct
{
  uint8_t  Multiband;
  union
  {
    uint8_t A5_Bits;
    ARC_t ARC;
  } u;
} Multiband_t;

typedef struct              /* MS classmark 3 R99 */
{
  uint8_t        Spare1;
  Multiband_t   Multiband;

  uint8_t        Exist_R_Support;
  uint8_t        R_GSM_Arc;

  uint8_t        Exist_MultiSlotCapability;
  uint8_t        MultiSlotClass;

  uint8_t        UCS2;
  uint8_t        ExtendedMeasurementCapability;

  uint8_t        Exist_MS_MeasurementCapability;
  uint8_t        SMS_VALUE;
  uint8_t        SM_VALUE;

  uint8_t        Exist_MS_PositioningMethodCapability;
  uint8_t        MS_PositioningMethod;

  uint8_t        Exist_EDGE_MultiSlotCapability;
  uint8_t        EDGE_MultiSlotClass;

  uint8_t        Exist_EDGE_Struct;
  uint8_t        ModulationCapability;
  EDGE_RF_Pwr_t EDGE_RF_PwrCaps;

  uint8_t        Exist_GSM400_Info;
  uint8_t        GSM400_Bands;
  uint8_t        GSM400_Arc;

  uint8_t        Exist_GSM850_Arc;
  uint8_t        GSM850_Arc;

  uint8_t        Exist_PCS1900_Arc;
  uint8_t        PCS1900_Arc;

  uint8_t        UMTS_FDD_Radio_Access_Technology_Capability;
  uint8_t        UMTS_384_TDD_Radio_Access_Technology_Capability;
  uint8_t        CDMA2000_Radio_Access_Technology_Capability;

  uint8_t        Exist_DTM_GPRS_multislot_class;
  uint8_t        DTM_GPRS_multislot_class;
  uint8_t        Single_Slot_DTM;
  DTM_EGPRS_t   DTM_EGPRS_Params;

  /* -------- R4 additions */
  uint8_t        Exist_SingleBandSupport;
  uint8_t        GSM_Band;

  uint8_t        Exist_GSM_700_Associated_Radio_Capability;
  uint8_t        GSM_700_Associated_Radio_Capability;

  uint8_t        UMTS_128_TDD_Radio_Access_Technology_Capability;
  uint8_t        GERAN_Feature_Package_1;

  uint8_t        Exist_Extended_DTM_multislot_class;
  uint8_t        Extended_DTM_GPRS_multislot_class;
  uint8_t        Extended_DTM_EGPRS_multislot_class;

  /* -------- R5 additions */
  uint8_t        Exist_HighMultislotCapability;
  uint8_t        HighMultislotCapability;

  uint8_t        Exist_GERAN_lu_ModeCapability;
  uint8_t        GERAN_lu_ModeCapability;

  uint8_t        GERAN_FeaturePackage_2;

  uint8_t        GMSK_MultislotPowerProfile;
  uint8_t        EightPSK_MultislotProfile;

  /* -------- R6 additions */
  uint8_t        Exist_TGSM_400_Bands;
  uint8_t        TGSM_400_BandsSupported;
  uint8_t        TGSM_400_AssociatedRadioCapability;

  uint8_t        Exist_TGSM_900_AssociatedRadioCapability;
  uint8_t        TGSM_900_AssociatedRadioCapability;

  uint8_t        DownlinkAdvancedReceiverPerformance;
  uint8_t        DTM_EnhancementsCapability;

  uint8_t        Exist_DTM_GPRS_HighMultislotClass;
  uint8_t        DTM_GPRS_HighMultislotClass;
  uint8_t        OffsetRequired;
  DTM_EGPRS_HighMultislotClass_t   DTM_EGPRS_HighMultislotClass;
  uint8_t        RepeatedSACCH_Capability;

  uint8_t        Spare2;
} MS_Class3_Unpacked_t;


/* < Packet Resource Request message content > */
typedef struct
{
  bool Exist;
  uint8_t  UnionType;
  union
  {
    uint8_t MEAN_BEP_GMSK;
    uint8_t MEAN_BEP_8PSK;
  } u;
} BEP_MeasurementReport_t;

typedef struct
{
  bool Exist;
  uint8_t  I_LEVEL;
} InterferenceMeasurementReport_t;

typedef struct
{
  bool                     Exist_BEP_MEASUREMENTS;
  BEP_MeasurementReport_t BEP_MEASUREMENTS[8];

  bool                             Exist_INTERFERENCE_MEASUREMENTS;
  InterferenceMeasurementReport_t INTERFERENCE_MEASUREMENTS[8];
} EGPRS_TimeslotLinkQualityMeasurements_t;

typedef struct
{
  bool Exist_MEAN_CV_BEP_GMSK;
  uint8_t  MEAN_BEP_GMSK;
  uint8_t  CV_BEP_GMSK;

  bool Exist_MEAN_CV_BEP_8PSK;
  uint8_t  MEAN_BEP_8PSK;
  uint8_t  CV_BEP_8PSK;
} EGPRS_BEP_LinkQualityMeasurements_t;

typedef struct{
uint8_t RB_ID;
uint8_t RADIO_PRIORITY;

bool      Exist_RLC_BLOCK_COUNT;
uint8_t  RLC_BLOCK_COUNT;

bool      Exist_Iu_Mode_ChRequestDesk;
//IU_Mode_Channel_Request_Desk_t IU_Mode_Channel_Request_Desk1;

}IU_Mode_Channel_Request_Desk_t;

typedef struct{
    bool       Exist_G_RNTI_Extension;
    uint8_t   G_RNTI_Extension;
    IU_Mode_Channel_Request_Desk_t  IU_Mode_Channel_Request_Desk;

}IU_Mode_Channel_Request_Desk_RNTI_t;

typedef struct{
    uint8_t PFI;
    uint8_t RADIO_PRIORITY;
    uint8_t RLC_Mode;

    bool      Exist_LCC_PDU;
    uint8_t LCC_PDU;

    bool Exist_Ext_Channel_Request_desc;

}Ext_Channel_Request_desc_t;


typedef struct{
    bool Exist_GMSK_MEAN_BEP;
    uint8_t GMSK_MEAN_BEP;
    uint8_t GMSK_CV_BEP;

    bool Exist_8PSK_MEAN_BEP;
    uint8_t p8PSK_MEAN_BEP;
    uint8_t p8PSK_CV_BEP;

    bool Exist_QPSK_MEAN_BEP;
    uint8_t QPSK_MEAN_BEP;
    uint8_t QPSK_CV_BEP;

    bool Exist_16QAM_NSR_MEAN_BEP;
    uint8_t p16QAM_NSR_MEAN_BEP;
    uint8_t p16QAM_NSR_CV_BEP;

    bool Exist_32QAM_NSR_MEAN_BEP;
    uint8_t p32QAM_NSR_MEAN_BEP;
    uint8_t p32QAM_NSR_CV_BEP;

    bool Exist_16QAM_HSR_MEAN_BEP;
    uint8_t p16QAM_HSR_MEAN_BEP;
    uint8_t p16QAM_HSR_CV_BEP;

    bool Exist_32QAM_HSR_MEAN_BEP;
    uint8_t p32QAM_HSR_MEAN_BEP;
    uint8_t p32QAM_HSR_CV_BEP;

    }EGPRS_BEP_LinkQualityMeasurements_type2_t;

typedef struct
{
    bool Exist;
    uint8_t REPORTED_MODULATION;
    uint8_t MEAN_BEP_TN;

}BEP_MeasurementReport_type2_t;

typedef struct
{
    bool Exist;
    uint8_t I_LEVEL;
}InterferenceMeasurementReport_type2_t;

typedef struct
{
    bool Exist_BEP_MEASUREMENTS;
    BEP_MeasurementReport_type2_t BEP_MEASUREMENTS[8];

    bool Exist_INTERFERENCE_MEASUREMENTS;
    InterferenceMeasurementReport_type2_t INTERFERENCE_MEASUREMENTS[8];

}EGPRS_TimeslotLinkQualityMeasurements_type2_t;


typedef struct
{
    bool Exist_Downlink_eTFI;
    uint8_t DOWNLINK_ETFI;

}PRR_AdditionsR12_t;

typedef struct
{
    uint8_t LOW_ACCESS_PRIORITY_SIGNALLING;

    bool Exist_AdditionsR12;
    PRR_AdditionsR12_t  AdditionsR12;

}PRR_AdditionsR10_t;

typedef struct
{
    uint8_t EARLY_TBF_ESTABLISHMENT;

    bool Exist_EGPRS_BEP_LinkQualityMeasurements_type2;
    EGPRS_BEP_LinkQualityMeasurements_type2_t EGPRS_BEP_LinkQualityMeasurements_type2;

    bool Exist_EGPRS_TimeslotLinkQualityMeasurements_type2;
    EGPRS_TimeslotLinkQualityMeasurements_type2_t EGPRS_TimeslotLinkQualityMeasurements_type2;

    bool Exist_AdditionsR10;
    PRR_AdditionsR10_t AdditionsR10;

}PRR_AdditionsR7_t;

typedef struct
{
    bool Exist_Ext_Channel_Request_desc;
    Ext_Channel_Request_desc_t  Ext_Channel_Request_desc;

    uint8_t Exist_AdditionsR7;
    PRR_AdditionsR7_t  AdditionsR7;

} PRR_AdditionsR6_t;

typedef struct
{
    uint8_t Exist_Iu_Mode_ChRequestDesk;
    IU_Mode_Channel_Request_Desk_RNTI_t  IU_Mode_Channel_Request_Desk_RNTI;

    uint8_t Exist_HFN_LSB;
    uint8_t   HFN_LSb;

    uint8_t Exist_AdditionsR6;
    PRR_AdditionsR6_t AdditionsR6;

}PRR_AdditionsR5_t;

typedef struct
{
  bool                                     Exist_EGPRS_BEP_LinkQualityMeasurements;
  EGPRS_BEP_LinkQualityMeasurements_t     EGPRS_BEP_LinkQualityMeasurements;

  bool                                     Exist_EGPRS_TimeslotLinkQualityMeasurements;
  EGPRS_TimeslotLinkQualityMeasurements_t EGPRS_TimeslotLinkQualityMeasurements;

  bool                                     Exist_PFI;
  uint8_t                                  PFI;

  uint8_t                                  MS_RAC_AdditionalInformationAvailable;
  uint8_t                                  RetransmissionOfPRR;

  uint8_t                                  Exist_AdditionsR5;
  PRR_AdditionsR5_t                        AdditionsR5;
} PRR_AdditionsR99_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_TFI_t Global_TFI;
    uint32_t TLLI;
  } u;
} PacketResourceRequestID_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  uint8_t Exist_ACCESS_TYPE;
  uint8_t ACCESS_TYPE;

  PacketResourceRequestID_t ID;

  uint8_t Exist_MS_Radio_Access_capability2;
  MS_Radio_Access_capability_t MS_Radio_Access_capability2;

  Channel_Request_Description_t Channel_Request_Description;

  uint8_t Exist_CHANGE_MARK;
  uint8_t CHANGE_MARK;

  uint8_t C_VALUE;

  uint8_t Exist_SIGN_VAR;
  uint8_t SIGN_VAR;

  InterferenceMeasurementReport_t  I_LEVEL_TN[8];

  uint8_t                           Exist_AdditionsR99;
  PRR_AdditionsR99_t               AdditionsR99;
} Packet_Resource_Request_t;

/* < Packet Mobile TBF Status message content >*/
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  Global_TFI_t Global_TFI;
  uint8_t TBF_CAUSE;

  uint8_t Exist_STATUS_MESSAGE_TYPE;
  uint8_t STATUS_MESSAGE_TYPE;
} Packet_Mobile_TBF_Status_t;

/* < Packet PSI Status message content >*/
typedef struct
{
  uint8_t PSI_MESSAGE_TYPE;
  uint8_t PSIX_CHANGE_MARK;
  uint8_t Exist_PSIX_COUNT_and_Instance_Bitmap;
} PSI_Message_t;

typedef struct
{
  uint8_t Count_PSI_Message;
  PSI_Message_t PSI_Message[10];

  uint8_t ADDITIONAL_MSG_TYPE;
} PSI_Message_List_t;

typedef struct
{
  uint8_t ADDITIONAL_MSG_TYPE;
} Unknown_PSI_Message_List_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  Global_TFI_t Global_TFI;
  uint8_t PBCCH_CHANGE_MARK;

  PSI_Message_List_t PSI_Message_List;
  Unknown_PSI_Message_List_t Unknown_PSI_Message_List;
} Packet_PSI_Status_t;

/* < Packet SI Status message content > */
typedef struct
{
  uint8_t SI_MESSAGE_TYPE;
  uint8_t MESS_REC;
  uint8_t SIX_CHANGE_MARK;

  uint8_t SIX_COUNT;
  uint8_t Instance_bitmap[2];
} SI_Message_t;

typedef struct
{
  uint8_t Count_SI_Message;
  SI_Message_t SI_Message[10];

  uint8_t ADDITIONAL_MSG_TYPE;
} SI_Message_List_t;

typedef struct
{
  uint8_t ADDITIONAL_MSG_TYPE;
} Unknown_SI_Message_List_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  Global_TFI_t Global_TFI;
  uint8_t BCCH_CHANGE_MARK;

  SI_Message_List_t SI_Message_List;
  Unknown_SI_Message_List_t Unknown_SI_Message_List;
} Packet_SI_Status_t;

typedef struct
{
  uint16_t FDD_ARFCN;
  uint8_t DIVERSITY;
  uint8_t Exist_Bandwith_FDD;
  uint8_t BANDWITH_FDD;
  uint16_t SCRAMBLING_CODE;
} FDD_Target_Cell_t;

typedef struct
{
  uint16_t TDD_ARFCN;
  uint8_t DIVERSITY_TDD;
  uint8_t Exist_Bandwith_TDD;
  uint8_t BANDWITH_TDD;
  uint16_t CELL_PARAMETER;
  uint8_t Sync_Case_TSTD;
} TDD_Target_Cell_t;

typedef struct
{
  uint16_t EARFCN;
  uint8_t Exist_Measurement_Bandwidth;
  uint8_t Measurement_Bandwidth;
  uint16_t Physical_Layer_Cell_Identity;
} EUTRAN_Target_Cell_t;

typedef struct
{
  uint32_t UTRAN_CI;
  uint8_t Exist_PLMN_ID;
  PLMN_t  PLMN_ID;
} UTRAN_CSG_Target_Cell_t;

typedef struct
{
  uint32_t EUTRAN_CI;
  uint16_t Tracking_Area_Code;
  uint8_t Exist_PLMN_ID;
  PLMN_t  PLMN_ID;
} EUTRAN_CSG_Target_Cell_t;

typedef struct
{
  uint8_t Exist_UTRAN_CSG_Target_Cell;
  UTRAN_CSG_Target_Cell_t UTRAN_CSG_Target_Cell;
  uint8_t Exist_EUTRAN_CSG_Target_Cell;
  EUTRAN_CSG_Target_Cell_t EUTRAN_CSG_Target_Cell;
} PCCF_AdditionsR9_t;

typedef struct
{
  uint8_t Exist_EUTRAN_Target_Cell;
  EUTRAN_Target_Cell_t EUTRAN_Target_Cell;
  uint8_t Exist_AdditionsR9;
  PCCF_AdditionsR9_t AdditionsR9;
} PCCF_AdditionsR8_t;

typedef struct
{
  uint8_t Exist_G_RNTI_extention;
  uint8_t G_RNTI_extention;
  uint8_t Exist_AdditionsR8;
  PCCF_AdditionsR8_t AdditionsR8;
} PCCF_AdditionsR5_t;

typedef struct
{
  uint8_t Exist_FDD_Description;
  FDD_Target_Cell_t FDD_Target_Cell;
  uint8_t Exist_TDD_Description;
  TDD_Target_Cell_t TDD_Target_Cell;
  uint8_t Exist_AdditionsR5;
  PCCF_AdditionsR5_t AdditionsR5;
} PCCF_AdditionsR99_t;

/* < Packet Cell Change Failure message content > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  uint32_t TLLI;
  uint16_t ARFCN;
  uint8_t BSIC;
  uint8_t CAUSE;
  bool Exist_AdditionsR99;
  PCCF_AdditionsR99_t AdditionsR99;
} Packet_Cell_Change_Failure_t;

/* < Packet Downlink Ack/Nack message content > */
typedef struct
{
  bool Exist_PFI;
  uint8_t  PFI;
} PD_AckNack_AdditionsR99_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  uint8_t DOWNLINK_TFI;
  Ack_Nack_Description_t Ack_Nack_Description;

  uint8_t Exist_Channel_Request_Description;
  Channel_Request_Description_t Channel_Request_Description;

  Channel_Quality_Report_t Channel_Quality_Report;

  bool                           Exist_AdditionsR99;
  PD_AckNack_AdditionsR99_t     AdditionsR99;
} Packet_Downlink_Ack_Nack_t;

/* < EGPRS Packet Downlink Ack/Nack message content > */
typedef struct
{
  EGPRS_BEP_LinkQualityMeasurements_t     EGPRS_BEP_LinkQualityMeasurements;
  uint8_t                                  C_VALUE;
  EGPRS_TimeslotLinkQualityMeasurements_t EGPRS_TimeslotLinkQualityMeasurements;
} EGPRS_ChannelQualityReport_t;

typedef struct
{
  uint8_t  MESSAGE_TYPE;
  uint8_t  PayloadType;
  uint8_t  spare;
  uint8_t  R;

  uint8_t  DOWNLINK_TFI;
  uint8_t  MS_OUT_OF_MEMORY;

  bool                           Exist_EGPRS_ChannelQualityReport;
  EGPRS_ChannelQualityReport_t  EGPRS_ChannelQualityReport;

  bool                           Exist_ChannelRequestDescription;
  Channel_Request_Description_t ChannelRequestDescription;

  bool Exist_PFI;
  uint8_t  PFI;

  bool              Exist_ExtensionBits;
  Extension_Bits_t ExtensionBits;

  EGPRS_AckNack_t  EGPRS_AckNack;
} EGPRS_PD_AckNack_t;

/* < Packet Uplink Ack/Nack message content  04.60 sec.11.2.28 > */

typedef struct
{
  uint8_t                     Exist_CONTENTION_RESOLUTION_TLLI;
  uint32_t                    CONTENTION_RESOLUTION_TLLI;

  uint8_t                     Exist_Packet_Timing_Advance;
  Packet_Timing_Advance_t    Packet_Timing_Advance;

  uint8_t                     Exist_Extension_Bits;
  Extension_Bits_t           Extension_Bits;

  uint8_t                     Exist_Power_Control_Parameters;
  Power_Control_Parameters_t Power_Control_Parameters;
} Common_Uplink_Ack_Nack_Data_t;

typedef struct
{
  bool Exist_PacketExtendedTimingAdvance;
  uint8_t  PacketExtendedTimingAdvance;
  uint8_t  TBF_EST;
} PU_AckNack_GPRS_AdditionsR99_t;

/* Table 11.2.28.1: PACKET UPLINK ACK/NACK information elements */
typedef struct
{
    uint8_t Error;
    /* Fixed Allocation Parameters was removed from specs.
     * TODO: implement for old versions of spec.
     */
} Fixed_Allocation_Parameters_t;

typedef struct
{
  uint8_t                 CHANNEL_CODING_COMMAND;
  Ack_Nack_Description_t Ack_Nack_Description;

  bool                            Exist_Fixed_Allocation_Parameters;
  Fixed_Allocation_Parameters_t   Fixed_Allocation_Parameters;

  bool                            Exist_AdditionsR99;
  PU_AckNack_GPRS_AdditionsR99_t AdditionsR99;

  Common_Uplink_Ack_Nack_Data_t Common_Uplink_Ack_Nack_Data;
} PU_AckNack_GPRS_t;

typedef struct
{
  uint8_t  EGPRS_ChannelCodingCommand;
  uint8_t  RESEGMENT;
  uint8_t  PRE_EMPTIVE_TRANSMISSION;
  uint8_t  PRR_RETRANSMISSION_REQUEST;
  uint8_t  ARAC_RETRANSMISSION_REQUEST;

  uint8_t  TBF_EST;

  bool Exist_Packet_Extended_Timing_Advance;
  uint8_t  Packet_Extended_Timing_Advance;

  EGPRS_AckNack_t  EGPRS_AckNack;


  Common_Uplink_Ack_Nack_Data_t Common_Uplink_Ack_Nack_Data;
} PU_AckNack_EGPRS_00_t;

typedef struct
{
  uint8_t  UnionType;
  union
  {
    PU_AckNack_EGPRS_00_t PU_AckNack_EGPRS_00;
    uint8_t                extension_01;
    uint8_t                extension_10;
    uint8_t                extension_11;
  } u;
} PU_AckNack_EGPRS_t;

#if 0
enum PUAN_Type
{
  PUAN_GPRS,
  PUAN_EGPRS
};
#endif

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;
  uint8_t UPLINK_TFI;

  uint8_t UnionType;
  union
  {
    PU_AckNack_GPRS_t  PU_AckNack_GPRS_Struct;
    PU_AckNack_EGPRS_t PU_AckNack_EGPRS_Struct;
  } u;
} Packet_Uplink_Ack_Nack_t;

/* < Packet Uplink Assignment message content > */
typedef struct
{
  uint8_t CHANGE_MARK_1;
  uint8_t Exist_CHANGE_MARK_2;
  uint8_t CHANGE_MARK_2;
} CHANGE_MARK_t;

typedef struct
{
  uint8_t MAIO;
  uint8_t MA_NUMBER;

  uint8_t Exist_CHANGE_MARK;
  CHANGE_MARK_t CHANGE_MARK;
} Indirect_encoding_t;

typedef struct
{
  uint8_t MAIO;
  GPRS_Mobile_Allocation_t GPRS_Mobile_Allocation;
} Direct_encoding_1_t;

typedef struct
{
  uint8_t MAIO;
  uint8_t HSN;
  uint8_t Length_of_MA_Frequency_List;
  uint8_t MA_Frequency_List[15+3];
} Direct_encoding_2_t;

typedef struct
{
  uint8_t TSC;
  uint8_t UnionType;
  union
  {
    uint16_t ARFCN;
    Indirect_encoding_t Indirect_encoding;
    Direct_encoding_1_t Direct_encoding_1;
    Direct_encoding_2_t Direct_encoding_2;
  } u;
} Frequency_Parameters_t;

typedef struct
{
  uint8_t Exist;
  uint8_t USF_TN;
} Timeslot_Allocation_t;

typedef struct
{
  uint8_t ALPHA;

  struct
  {
    uint8_t Exist;
    uint8_t USF_TN;
    uint8_t GAMMA_TN;
  } Slot[8];
} Timeslot_Allocation_Power_Ctrl_Param_t;

typedef struct
{
  uint8_t Extended_Dynamic_Allocation;

  uint8_t Exist_P0;
  uint8_t P0;
  uint8_t PR_MODE;

  uint8_t USF_GRANULARITY;

  uint8_t Exist_UPLINK_TFI_ASSIGNMENT;
  uint8_t UPLINK_TFI_ASSIGNMENT;

  uint8_t Exist_RLC_DATA_BLOCKS_GRANTED;
  uint8_t RLC_DATA_BLOCKS_GRANTED;

  uint8_t Exist_TBF_Starting_Time;
  Starting_Frame_Number_t TBF_Starting_Time;

  uint8_t UnionType;
  union
  {
    Timeslot_Allocation_t                  Timeslot_Allocation[8];
    Timeslot_Allocation_Power_Ctrl_Param_t Timeslot_Allocation_Power_Ctrl_Param;
  } u;
} Dynamic_Allocation_t;

typedef struct
{
  uint8_t Extended_Dynamic_Allocation;

  uint8_t Exist_P0;
  uint8_t P0;
  uint8_t PR_MODE;

  uint8_t USF_GRANULARITY;

  uint8_t Exist_UPLINK_TFI_ASSIGNMENT;
  uint8_t UPLINK_TFI_ASSIGNMENT;

  uint8_t Exist_RLC_DATA_BLOCKS_GRANTED;
  uint8_t RLC_DATA_BLOCKS_GRANTED;

  uint8_t UnionType;
  union
  {
    Timeslot_Allocation_t Timeslot_Allocation[8];
    Timeslot_Allocation_Power_Ctrl_Param_t Timeslot_Allocation_Power_Ctrl_Param;
  } u;
} DTM_Dynamic_Allocation_t;

typedef struct
{
  uint8_t TIMESLOT_NUMBER;

  uint8_t Exist_ALPHA_and_GAMMA_TN;
  uint8_t ALPHA;
  uint8_t GAMMA_TN;

  uint8_t Exist_P0;
  uint8_t P0;
  uint8_t BTS_PWR_CTRL_MODE;
  uint8_t PR_MODE;

  Starting_Frame_Number_t TBF_Starting_Time;
} Single_Block_Allocation_t;

typedef struct
{
  uint8_t TIMESLOT_NUMBER;

  uint8_t Exist_ALPHA_and_GAMMA_TN;
  uint8_t ALPHA;
  uint8_t GAMMA_TN;

  uint8_t Exist_P0;
  uint8_t P0;
  uint8_t BTS_PWR_CTRL_MODE;
  uint8_t PR_MODE;

} DTM_Single_Block_Allocation_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_TFI_t Global_TFI;
    uint32_t TLLI;
    uint16_t TQI;
    Packet_Request_Reference_t Packet_Request_Reference;
  } u;
} PacketUplinkID_t;

typedef struct
{
  bool Exist_Packet_Extended_Timing_Advance;
  uint8_t  Packet_Extended_Timing_Advance;
} PUA_GPRS_AdditionsR99_t;

typedef struct
{
  uint8_t                      CHANNEL_CODING_COMMAND;
  uint8_t                      TLLI_BLOCK_CHANNEL_CODING;
  Packet_Timing_Advance_t     Packet_Timing_Advance;

  uint8_t                      Exist_Frequency_Parameters;
  Frequency_Parameters_t      Frequency_Parameters;

  uint8_t                      UnionType;
  union
  {
    uint8_t                    extension;
    Dynamic_Allocation_t      Dynamic_Allocation;
    Single_Block_Allocation_t Single_Block_Allocation;
    uint8_t                    FixedAllocationDummy;
  } u;

  bool                         Exist_AdditionsR99;
  PUA_GPRS_AdditionsR99_t     AdditionsR99;
} PUA_GPRS_t;

typedef struct
{
  uint8_t  BitmapLength;
  uint8_t  ReducedMA_Bitmap[127 / 8 + 1];

  bool Exist_MAIO_2;
  uint8_t  MAIO_2;
} COMPACT_ReducedMA_t;

typedef struct
{
  uint8_t                  TIMESLOT_NUMBER;

  bool                     Exist_ALPHA_GAMMA_TN;
  uint8_t                  ALPHA;
  uint8_t                  GAMMA_TN;

  bool                     Exist_P0_BTS_PWR_CTRL_PR_MODE;
  uint8_t                  P0;
  uint8_t                  BTS_PWR_CTRL_MODE;
  uint8_t                  PR_MODE;

  Starting_Frame_Number_t TBF_Starting_Time;
  uint8_t                  NUMBER_OF_RADIO_BLOCKS_ALLOCATED;
} MultiBlock_Allocation_t;

typedef struct
{
  bool                         Exist_CONTENTION_RESOLUTION_TLLI;
  uint32_t                     CONTENTION_RESOLUTION_TLLI;

  bool                         Exist_COMPACT_ReducedMA;
  COMPACT_ReducedMA_t         COMPACT_ReducedMA;

  uint8_t                      EGPRS_CHANNEL_CODING_COMMAND;
  uint8_t                      RESEGMENT;
  uint8_t                      EGPRS_WindowSize;

  uint8_t                      NrOfAccessTechnologies;  /* will hold the number of list elements */
  uint8_t                      AccessTechnologyType[MAX_ACCESS_TECHOLOGY_TYPES]; /* for max size of array see 24.008/Table 10.5.146 */

  uint8_t                      ARAC_RETRANSMISSION_REQUEST;
  uint8_t                      TLLI_BLOCK_CHANNEL_CODING;

  bool                         Exist_BEP_PERIOD2;
  uint8_t                      BEP_PERIOD2;

  Packet_Timing_Advance_t     PacketTimingAdvance;

  bool                         Exist_Packet_Extended_Timing_Advance;
  uint8_t                      Packet_Extended_Timing_Advance;

  bool                         Exist_Frequency_Parameters;
  Frequency_Parameters_t      Frequency_Parameters;

  uint8_t                      UnionType;
  union
  {
    uint8_t                    extension;
    Dynamic_Allocation_t      Dynamic_Allocation;
    MultiBlock_Allocation_t   MultiBlock_Allocation;
    uint8_t                    FixedAllocationDummy;/* Fixed Allocation is not used */
  } u;
} PUA_EGPRS_00_t;

typedef struct
{
  uint8_t           UnionType;
  union
  {
    PUA_EGPRS_00_t PUA_EGPRS_00;
    uint8_t         PUA_EGPRS_01;
    uint8_t         PUA_EGPRS_10;
    uint8_t         PUA_EGPRS_11;
  } u;
} PUA_EGPRS_t;

#if 0
enum PUA_Type
{
  PUA_GPRS,
  PUA_EGPRS
};
#endif

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  uint8_t Exist_PERSISTENCE_LEVEL;
  uint8_t PERSISTENCE_LEVEL[4];

  PacketUplinkID_t ID;

  uint8_t UnionType;
  union
  {
    PUA_GPRS_t  PUA_GPRS_Struct;
    PUA_EGPRS_t PUA_EGPRS_Struct;
  } u;
} Packet_Uplink_Assignment_t;


/* < DTM Packet Uplink Assignment message content > */
typedef struct
{
  uint8_t CHANNEL_CODING_COMMAND;
  uint8_t TLLI_BLOCK_CHANNEL_CODING;
  Packet_Timing_Advance_t Packet_Timing_Advance;

  uint8_t UnionType;
  union
  {
    uint8_t extension;
    DTM_Dynamic_Allocation_t DTM_Dynamic_Allocation;
    DTM_Single_Block_Allocation_t DTM_Single_Block_Allocation;
  } u;
  bool Exist_EGPRS_Parameters;
  uint8_t EGPRS_CHANNEL_CODING_COMMAND;
  uint8_t RESEGMENT;
  uint8_t EGPRS_WindowSize;
  bool Exist_Packet_Extended_Timing_Advance;
  uint8_t Packet_Extended_Timing_Advance;
} DTM_Packet_Uplink_Assignment_t;

typedef struct
{
  DTM_Packet_Uplink_Assignment_t DTM_Packet_Uplink_Assignment;
} DTM_UL_t;

/* < DTM Packet Channel Request message content > */
typedef struct
{
  uint8_t DTM_Pkt_Est_Cause;
  Channel_Request_Description_t Channel_Request_Description;
  bool                                     Exist_PFI;
  uint8_t                                  PFI;
} DTM_Channel_Request_Description_t;

/* < Packet Downlink Assignment message content > */
typedef struct
{
  Starting_Frame_Number_t Measurement_Starting_Time;
  uint8_t MEASUREMENT_INTERVAL;
  uint8_t MEASUREMENT_BITMAP;
} Measurement_Mapping_struct_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_TFI_t Global_TFI;
    uint32_t TLLI;
  } u;
} PacketDownlinkID_t;

typedef struct
{
  bool Exist_EGPRS_Params; /* if Exist_EGPRS_Params == false then none of the following 4 vars exist */
  uint8_t  EGPRS_WindowSize;
  uint8_t  LINK_QUALITY_MEASUREMENT_MODE;
  bool Exist_BEP_PERIOD2;
  uint8_t  BEP_PERIOD2;

  bool Exist_Packet_Extended_Timing_Advance;
  uint8_t  Packet_Extended_Timing_Advance;

  bool                 Exist_COMPACT_ReducedMA;
  COMPACT_ReducedMA_t COMPACT_ReducedMA;
} PDA_AdditionsR99_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       PAGE_MODE;

  bool                          Exist_PERSISTENCE_LEVEL;
  uint8_t                       PERSISTENCE_LEVEL[4];

  PacketDownlinkID_t           ID;

  uint8_t                       MAC_MODE;
  uint8_t                       RLC_MODE;
  uint8_t                       CONTROL_ACK;
  uint8_t                       TIMESLOT_ALLOCATION;
  Packet_Timing_Advance_t      Packet_Timing_Advance;

  bool                          Exist_P0_and_BTS_PWR_CTRL_MODE;
  uint8_t                       P0;
  uint8_t                       BTS_PWR_CTRL_MODE;
  uint8_t                       PR_MODE;

  bool                          Exist_Frequency_Parameters;
  Frequency_Parameters_t       Frequency_Parameters;

  bool                          Exist_DOWNLINK_TFI_ASSIGNMENT;
  uint8_t                       DOWNLINK_TFI_ASSIGNMENT;

  bool                          Exist_Power_Control_Parameters;
  Power_Control_Parameters_t   Power_Control_Parameters;

  bool                          Exist_TBF_Starting_Time;
  Starting_Frame_Number_t      TBF_Starting_Time;

  uint8_t                       Exist_Measurement_Mapping;
  Measurement_Mapping_struct_t Measurement_Mapping;

  bool                          Exist_AdditionsR99;
  PDA_AdditionsR99_t           AdditionsR99;
} Packet_Downlink_Assignment_t;

/* < DTM Packet Downlink Assignment message content > */
typedef struct
{
  uint8_t MAC_MODE;
  uint8_t RLC_MODE;
  uint8_t TIMESLOT_ALLOCATION;
  Packet_Timing_Advance_t Packet_Timing_Advance;

  uint8_t Exist_P0_and_BTS_PWR_CTRL_MODE;
  uint8_t P0;
  uint8_t BTS_PWR_CTRL_MODE;
  uint8_t PR_MODE;

  uint8_t Exist_Power_Control_Parameters;
  Power_Control_Parameters_t Power_Control_Parameters;

  uint8_t Exist_DOWNLINK_TFI_ASSIGNMENT;
  uint8_t DOWNLINK_TFI_ASSIGNMENT;

  uint8_t Exist_Measurement_Mapping;
  Measurement_Mapping_struct_t Measurement_Mapping;
  bool EGPRS_Mode;
  uint8_t EGPRS_WindowSize;
  uint8_t LINK_QUALITY_MEASUREMENT_MODE;
  bool Exist_Packet_Extended_Timing_Advance;
  uint8_t  Packet_Extended_Timing_Advance;
} DTM_Packet_Downlink_Assignment_t;

typedef struct
{
  DTM_Packet_Downlink_Assignment_t DTM_Packet_Downlink_Assignment;
} DTM_DL_t;

typedef struct
{
  GPRS_Cell_Options_t GPRS_Cell_Options;
  GPRS_Power_Control_Parameters_t GPRS_Power_Control_Parameters;
} DTM_GPRS_Broadcast_Information_t;

typedef struct
{
  DTM_GPRS_Broadcast_Information_t DTM_GPRS_Broadcast_Information;
} DTM_GPRS_B_t;

/* < Packet Paging Request message content > */
typedef struct
{
  uint8_t UnionType;
  union
  {
    TMSI_t PTMSI;
    struct MobileId Mobile_Identity;
  } u;
} Page_request_for_TBF_establishment_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    TMSI_t TMSI;
    struct MobileId Mobile_Identity;
  } u;

  uint8_t CHANNEL_NEEDED;

  uint8_t Exist_eMLPP_PRIORITY;
  uint8_t eMLPP_PRIORITY;
} Page_request_for_RR_conn_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Page_request_for_TBF_establishment_t Page_req_TBF;
    Page_request_for_RR_conn_t Page_req_RR;
  } u;
} Repeated_Page_info_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  uint8_t Exist_PERSISTENCE_LEVEL;
  uint8_t PERSISTENCE_LEVEL[4];

  uint8_t Exist_NLN;
  uint8_t NLN;

  uint8_t Count_Repeated_Page_info;
  Repeated_Page_info_t Repeated_Page_info[5];
} Packet_Paging_Request_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  uint8_t TIMESLOTS_AVAILABLE;
} Packet_PDCH_Release_t;

/* < Packet Power Control/Timing Advance message content > */
typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_TFI_t Global_TFI;
    uint16_t TQI;
    Packet_Request_Reference_t Packet_Request_Reference;
  } u;
} PacketPowerControlTimingAdvanceID_t;

typedef struct
{
  Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance;
  Power_Control_Parameters_t Power_Control_Parameters;
} GlobalTimingAndPower_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance;
    Power_Control_Parameters_t Power_Control_Parameters;
  } u;
} GlobalTimingOrPower_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  PacketPowerControlTimingAdvanceID_t ID;

  /* -- Message escape */
  uint8_t Exist_Global_Power_Control_Parameters;
  Global_Power_Control_Parameters_t Global_Power_Control_Parameters;

  uint8_t UnionType;
  union
  {
    GlobalTimingAndPower_t GlobalTimingAndPower;
    GlobalTimingOrPower_t GlobalTimingOrPower;
  } u;
} Packet_Power_Control_Timing_Advance_t;

/* < Packet Queueing Notification message content > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  /* 111 Fixed */
  Packet_Request_Reference_t Packet_Request_Reference;
  uint16_t TQI;
} Packet_Queueing_Notification_t;

/* < Packet Timeslot Reconfigure message content 04.60 sec. 11.2.31> */

typedef Dynamic_Allocation_t TRDynamic_Allocation_t;

typedef struct
{
  Global_Packet_Timing_Advance_t Global_Packet_Timing_Advance;

  uint8_t                         DOWNLINK_RLC_MODE;
  uint8_t                         CONTROL_ACK;

  uint8_t                         Exist_DOWNLINK_TFI_ASSIGNMENT;
  uint8_t                         DOWNLINK_TFI_ASSIGNMENT;

  uint8_t                         Exist_UPLINK_TFI_ASSIGNMENT;
  uint8_t                         UPLINK_TFI_ASSIGNMENT;

  uint8_t                         DOWNLINK_TIMESLOT_ALLOCATION;

  uint8_t                         Exist_Frequency_Parameters;
  Frequency_Parameters_t         Frequency_Parameters;
} Common_Timeslot_Reconfigure_t;

typedef struct
{
  bool Exist_Packet_Extended_Timing_Advance;
  uint8_t  Packet_Extended_Timing_Advance;
} PTR_GPRS_AdditionsR99_t;

typedef struct
{
  uint8_t                         CHANNEL_CODING_COMMAND;

  Common_Timeslot_Reconfigure_t  Common_Timeslot_Reconfigure_Data;

  uint8_t UnionType;
  union
  {
    TRDynamic_Allocation_t       Dynamic_Allocation;
    uint8_t                       Fixed_AllocationDummy;
  } u;

   bool                           Exist_AdditionsR99;
   PTR_GPRS_AdditionsR99_t       AdditionsR99;
} PTR_GPRS_t;

typedef struct
{
  bool                            Exist_COMPACT_ReducedMA;
  COMPACT_ReducedMA_t            COMPACT_ReducedMA;

  uint8_t                         EGPRS_ChannelCodingCommand;
  uint8_t                         RESEGMENT;

  bool                            Exist_DOWNLINK_EGPRS_WindowSize;
  uint8_t                         DOWNLINK_EGPRS_WindowSize;

  bool                            Exist_UPLINK_EGPRS_WindowSize;
  uint8_t                         UPLINK_EGPRS_WindowSize;

  uint8_t                         LINK_QUALITY_MEASUREMENT_MODE;

  bool                            Exist_Packet_Extended_Timing_Advance;
  uint8_t                         Packet_Extended_Timing_Advance;

  Common_Timeslot_Reconfigure_t  Common_Timeslot_Reconfigure_Data;

  uint8_t                         UnionType;
  union
  {
    TRDynamic_Allocation_t       Dynamic_Allocation;
    uint8_t                       FixedAllocationDummy;
  } u;
} PTR_EGPRS_00_t;

typedef struct
{
  uint8_t           UnionType;
  union
  {
    PTR_EGPRS_00_t PTR_EGPRS_00;
    uint8_t         extension_01;
    uint8_t         extension_10;
    uint8_t         extension_11;
  } u;
} PTR_EGPRS_t;

#if 0
enum PTR_Type
{
  PTR_GPRS,
  PTR_EGPRS
};
#endif

typedef struct
{
  uint8_t         MESSAGE_TYPE;
  uint8_t         PAGE_MODE;

  Global_TFI_t   Global_TFI;

   uint8_t        UnionType;
   union
   {
     PTR_GPRS_t  PTR_GPRS_Struct;
     PTR_EGPRS_t PTR_EGPRS_Struct;
   } u;
} Packet_Timeslot_Reconfigure_t;


/* < PSI1 message content > */
typedef struct
{
  uint8_t ACC_CONTR_CLASS[2];
  uint8_t MAX_RETRANS[4];
  uint8_t S;
  uint8_t TX_INT;

  uint8_t Exist_PERSISTENCE_LEVEL;
  uint8_t PERSISTENCE_LEVEL[4];
} PRACH_Control_t;

typedef struct
{
  uint8_t BS_PCC_REL;
  uint8_t BS_PBCCH_BLKS;
  uint8_t BS_PAG_BLKS_RES;
  uint8_t BS_PRACH_BLKS;
} PCCCH_Organization_t;

typedef struct
{
  uint8_t LB_MS_TXPWR_MAX_CCH;
} PSI1_AdditionsR6_t;

typedef struct
{
  uint8_t            MSCR;
  uint8_t            SGSNR;
  uint8_t            BandIndicator;
  bool               Exist_AdditionsR6;
  PSI1_AdditionsR6_t AdditionsR6;
} PSI1_AdditionsR99_t;

typedef struct
{
  uint8_t                           MESSAGE_TYPE;

  uint8_t                           PAGE_MODE;
  uint8_t                           PBCCH_CHANGE_MARK;
  uint8_t                           PSI_CHANGE_FIELD;
  uint8_t                           PSI1_REPEAT_PERIOD;
  uint8_t                           PSI_COUNT_LR;

  uint8_t                           Exist_PSI_COUNT_HR;
  uint8_t                           PSI_COUNT_HR;

  uint8_t                           MEASUREMENT_ORDER;
  GPRS_Cell_Options_t               GPRS_Cell_Options;
  PRACH_Control_t                   PRACH_Control;
  PCCCH_Organization_t              PCCCH_Organization;
  Global_Power_Control_Parameters_t Global_Power_Control_Parameters;
  uint8_t                           PSI_STATUS_IND;

  bool                              Exist_AdditionsR99;
  PSI1_AdditionsR99_t               AdditionsR99;
} PSI1_t;

/* < PSI2 message content > */
typedef struct
{
  uint8_t NUMBER;

  uint8_t Length;
  uint8_t Contents[15 + 3];/* octet (val(Length of RFL contents) + 3) */
} Reference_Frequency_t;

typedef struct
{
  uint8_t NoOfRFLs;
  uint8_t RFL_Number[MAX_RFLS];
} Cell_Allocation_t;

typedef struct
{
  uint8_t NUMBER;
  GPRS_Mobile_Allocation_t Mobile_Allocation;
} PSI2_MA_t;

typedef struct
{
  uint16_t ARFCN;
  uint8_t TIMESLOT_ALLOCATION;
} Non_Hopping_PCCCH_Carriers_t;

typedef struct
{
  uint8_t Count_Carriers;
  Non_Hopping_PCCCH_Carriers_t Carriers[7];
} NonHoppingPCCCH_t;

typedef struct
{
  uint8_t MAIO;
  uint8_t TIMESLOT_ALLOCATION;
} Hopping_PCCCH_Carriers_t;

typedef struct
{
  uint8_t MA_NUMBER;

  uint8_t Count_Carriers;
  Hopping_PCCCH_Carriers_t Carriers[10];/* MAX_PCCCH but 10 is theoretical max. */
} HoppingPCCCH_t;

typedef struct
{
  uint8_t TSC;

  uint8_t UnionType;
  union
  {
    NonHoppingPCCCH_t NonHopping;
    HoppingPCCCH_t Hopping;
  } u;
} PCCCH_Description_t;

typedef struct
{
  LAI_t LAI;
  uint8_t RAC;
  CellId_t Cell_Identity;
} Cell_Identification_t;

typedef struct
{
  uint8_t ATT;

  uint8_t Exist_T3212;
  uint8_t T3212;

  uint8_t NECI;
  uint8_t PWRC;
  uint8_t DTX;
  uint8_t RADIO_LINK_TIMEOUT;
  uint8_t BS_AG_BLKS_RES;
  uint8_t CCCH_CONF;
  uint8_t BS_PA_MFRMS;
  uint8_t MAX_RETRANS;
  uint8_t TX_INTEGER;
  uint8_t EC;
  uint8_t MS_TXPWR_MAX_CCCH;

  uint8_t Exist_Extension_Bits;
  Extension_Bits_t Extension_Bits;
} Non_GPRS_Cell_Options_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;
  uint8_t CHANGE_MARK;
  uint8_t INDEX;
  uint8_t COUNT;

  uint8_t Exist_Cell_Identification;
  Cell_Identification_t Cell_Identification;

  uint8_t Exist_Non_GPRS_Cell_Options;
  Non_GPRS_Cell_Options_t Non_GPRS_Cell_Options;

  uint8_t Count_Reference_Frequency;
  Reference_Frequency_t Reference_Frequency[MAX_RFLS];

  Cell_Allocation_t Cell_Allocation;

  uint8_t Count_GPRS_MA;
  PSI2_MA_t GPRS_MA[MAX_MA_LISTS_IN_PSI2];

  uint8_t Count_PCCCH_Description;
  PCCCH_Description_t PCCCH_Description[7];/* MAX_PCCCH but it is impossible that more than 7 can be decoded */
} PSI2_t;

/* < PSI3 message content > */
typedef struct
{
  uint8_t PRIORITY_CLASS;
  uint8_t HCS_THR;
} HCS_t;

typedef struct
{
  uint8_t CELL_BAR_ACCESS_2;
  uint8_t EXC_ACC;
  uint8_t GPRS_RXLEV_ACCESS_MIN;
  uint8_t GPRS_MS_TXPWR_MAX_CCH;

  uint8_t Exist_HCS;
  HCS_t HCS;
  uint8_t MULTIBAND_REPORTING;
} Serving_Cell_params_t;

typedef struct
{
  uint8_t GPRS_CELL_RESELECT_HYSTERESIS;
  uint8_t C31_HYST;
  uint8_t C32_QUAL;
  uint8_t RANDOM_ACCESS_RETRY;

  uint8_t Exist_T_RESEL;
  uint8_t T_RESEL;

  uint8_t Exist_RA_RESELECT_HYSTERESIS;
  uint8_t RA_RESELECT_HYSTERESIS;
} Gen_Cell_Sel_t;

typedef struct
{
  uint8_t PBCCH_LOCATION;
  uint8_t PSI1_REPEAT_PERIOD;
} Location_Repeat_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    uint8_t SI13_LOCATION;
    Location_Repeat_t lr;
  } u;
} SI13_PBCCH_Location_t;

typedef struct
{
  uint8_t BSIC;
  uint8_t CELL_BAR_ACCESS_2;
  uint8_t EXC_ACC;
  uint8_t SAME_RA_AS_SERVING_CELL;

  uint8_t Exist_RXLEV_and_TXPWR;
  uint8_t GPRS_RXLEV_ACCESS_MIN;
  uint8_t GPRS_MS_TXPWR_MAX_CCH;

  uint8_t Exist_OFFSET_and_TIME;
  uint8_t GPRS_TEMPORARY_OFFSET;
  uint8_t GPRS_PENALTY_TIME;

  uint8_t Exist_GPRS_RESELECT_OFFSET;
  uint8_t GPRS_RESELECT_OFFSET;

  uint8_t Exist_HCS;
  HCS_t HCS;

  uint8_t Exist_SI13_PBCCH_Location;
  SI13_PBCCH_Location_t SI13_PBCCH_Location;
} Cell_Selection_t;

/* Neighbour cell list as used in PSI3 and PSI3bis */
typedef struct
{
  uint8_t FREQ_DIFF_LENGTH;
  uint8_t FREQUENCY_DIFF;

  Cell_Selection_t Cell_SelectionParams;
} Cell_Selection_Params_With_FreqDiff_t;

typedef struct
{
  uint16_t START_FREQUENCY;
  Cell_Selection_t Cell_Selection;
  uint8_t NR_OF_REMAINING_CELLS;
  uint8_t FREQ_DIFF_LENGTH;

  Cell_Selection_Params_With_FreqDiff_t Cell_Selection_Params_With_FreqDiff[16];
} NeighbourCellParameters_t;

typedef struct
{
  uint8_t Count;
  NeighbourCellParameters_t Parameters[32];
} NeighbourCellList_t;

/* < PSI3 message content > */

typedef struct
{
  uint8_t bsic;
  uint8_t CELL_BAR_ACCESS_2;
  uint8_t EXC_ACC;
  uint8_t SAME_RA_AS_SERVING_CELL;
  uint8_t Exist_GPRS_RXLEV_ACCESS_MIN;
  uint8_t GPRS_RXLEV_ACCESS_MIN;
  uint8_t GPRS_MS_TXPWR_MAX_CCH;
  uint8_t Exist_GPRS_TEMPORARY_OFFSET;
  uint8_t GPRS_TEMPORARY_OFFSET;
  uint8_t GPRS_PENALTY_TIME;
  uint8_t Exist_GPRS_RESELECT_OFFSET;
  uint8_t GPRS_RESELECT_OFFSET;
  uint8_t Exist_Hcs_Parm;
  HCS_t   HCS_Param;
  uint8_t Exist_TIME_GROUP;
  uint8_t TIME_GROUP;
  uint8_t Exist_GUAR_CONSTANT_PWR_BLKS;
  uint8_t GUAR_CONSTANT_PWR_BLKS;
} COMPACT_Cell_Sel_t;

typedef struct
{
  uint8_t FREQ_DIFF_LENGTH;
  uint16_t FREQUENCY_DIFF;
  COMPACT_Cell_Sel_t  COMPACT_Cell_Sel_Remain_Cells;
} COMPACT_Neighbour_Cell_Param_Remaining_t;

typedef struct
{
  uint16_t START_FREQUENCY;
  COMPACT_Cell_Sel_t COMPACT_Cell_Sel;
  uint8_t NR_OF_REMAINING_CELLS;
  uint8_t FREQ_DIFF_LENGTH;
  COMPACT_Neighbour_Cell_Param_Remaining_t  COMPACT_Neighbour_Cell_Param_Remaining[16];
} COMPACT_Neighbour_Cell_Param_t;

typedef struct
{
  Cell_Identification_t Cell_Identification;
  uint8_t COMPACT_Neighbour_Cell_Param_Count;
  COMPACT_Neighbour_Cell_Param_t COMPACT_Neighbour_Cell_Param[8];
} COMPACT_Info_t;

typedef struct
{
  uint8_t Exist_CCN_Support_Desc;
  CCN_Support_Description_t CCN_Support_Desc;
} PSI3_AdditionR4_t;

typedef struct
{
  uint8_t Exist_COMPACT_Info;
  COMPACT_Info_t COMPACT_Info;
  uint8_t Exist_AdditionR4;
  PSI3_AdditionR4_t AdditionR4;
} PSI3_AdditionR99_t;

typedef struct
{
  LSA_ID_Info_t Scell_LSA_ID_Info;
  uint8_t Exist_LSA_Parameters;
  LSA_Parameters_t LSA_Parameters;
  uint8_t Exist_AdditionR99;
  PSI3_AdditionR99_t AdditionR99;
} PSI3_AdditionR98_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;
  uint8_t CHANGE_MARK;
  uint8_t BIS_COUNT;

  Serving_Cell_params_t Serving_Cell_params;

  Gen_Cell_Sel_t General_Cell_Selection;
  NeighbourCellList_t NeighbourCellList;

  uint8_t Exist_AdditionR98;
  PSI3_AdditionR98_t AdditionR98;
} PSI3_t;

/* < PSI3_BIS message content > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;
  uint8_t CHANGE_MARK;
  uint8_t BIS_INDEX;
  uint8_t BIS_COUNT;

  NeighbourCellList_t NeighbourCellList;
} PSI3_BIS_t;

/* < PSI4 message content > */
typedef struct
{
  uint8_t MA_NUMBER;
  uint8_t MAIO;
} h_CG_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    uint16_t ARFCN;
    h_CG_t h_CG;
  } u;

  uint8_t TIMESLOT_ALLOCATION;
} Channel_Group_t;

typedef struct
{
  /* Channel_Group_t Channel_Group
   * At least one
   * the first one is unpacked in the index
   */
  uint8_t Count_Channel_Group;
  Channel_Group_t Channel_Group[8];
} Channel_List_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;

  uint8_t PAGE_MODE;
  uint8_t CHANGE_MARK;
  uint8_t INDEX;
  uint8_t COUNT;

  Channel_List_t Channel_List;

} PSI4_t;


/* < PSI5 message content > */
typedef struct
{
  uint8_t existRepParamsFDD;
  uint8_t RepQuantFDD;
  uint8_t MultiratReportingFDD;

  uint8_t existReportingParamsFDD;
  uint8_t ReportingOffsetFDD;
  uint8_t ReportingThresholdFDD;

  uint8_t existMultiratReportingTDD;
  uint8_t MultiratReportingTDD;

  uint8_t existOffsetThresholdTDD;
  uint8_t ReportingOffsetTDD;
  uint8_t ReportingThresholdTDD;
} GPRSMeasurementParams3G_PSI5_t;

typedef struct
{
  uint8_t  REPORT_TYPE;
  uint8_t  REPORTING_RATE;
  uint8_t  INVALID_BSIC_REPORTING;
  uint8_t Exist_NCC_PERMITTED;
  uint8_t  NCC_PERMITTED;

  bool Exist_GPRSMeasurementParams;
  MeasurementParams_t   GPRSMeasurementParams;
  bool Exist_GPRSMeasurementParams3G;
  GPRSMeasurementParams3G_PSI5_t  GPRSMeasurementParams3G;
} ENH_Reporting_Parameters_t;

typedef struct
{
  uint8_t Exist_OffsetThreshold_700;
  OffsetThreshold_t OffsetThreshold_700;
  uint8_t Exist_OffsetThreshold_810;
  OffsetThreshold_t OffsetThreshold_810;
} PSI5_AdditionsR7;

typedef struct
{
  uint8_t Exist_GPRS_AdditionalMeasurementParams3G;
  GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G;
  uint8_t Exist_AdditionsR7;
  PSI5_AdditionsR7 AdditionsR7;
} PSI5_AdditionsR5;

typedef struct
{
  uint8_t Exist_ENH_Reporting_Param;
  ENH_Reporting_Parameters_t ENH_Reporting_Param;
  uint8_t Exist_AdditionsR5;
  PSI5_AdditionsR5 AdditionisR5;
} PSI5_AdditionsR99;

typedef struct
{
  uint8_t MESSAGE_TYPE;

  uint8_t PAGE_MODE;
  uint8_t CHANGE_MARK;
  uint8_t INDEX;
  uint8_t COUNT;

  uint8_t Eixst_NC_Meas_Param;
  NC_Measurement_Parameters_t NC_Meas_Param;
  uint8_t Exist_AdditionsR99;
  PSI5_AdditionsR99 AdditionsR99;
} PSI5_t;




/* < PSI13 message content >
 * Combined with SI13
 */
typedef struct
{
  uint8_t Exist_LB_MS_TXPWR_MAX_CCH;
  uint8_t LB_MS_TXPWR_MAX_CCH;
  uint8_t SI2n_SUPPORT;
}PSI13_AdditionsR6;

typedef PSI13_AdditionsR6 SI13_AdditionsR6;

typedef struct
{
  uint8_t               SI_STATUS_IND;
  uint8_t               Exist_AdditionsR6;
  PSI13_AdditionsR6     AdditionsR6;
}PSI13_AdditionsR4;

typedef PSI13_AdditionsR4 SI13_AdditionsR4;

typedef struct
{
  uint8_t               SGSNR;
  bool                  Exist_AdditionsR4;
  PSI13_AdditionsR4     AdditionsR4;
}PSI13_AdditionR99;

typedef PSI13_AdditionR99 SI13_AdditionR99;

typedef struct
{
  uint8_t Exist;
  uint8_t MESSAGE_TYPE;

  uint8_t PAGE_MODE;
  uint8_t BCCH_CHANGE_MARK;
  uint8_t SI_CHANGE_FIELD;

  uint8_t Exist_MA;
  uint8_t SI13_CHANGE_MARK;
  GPRS_Mobile_Allocation_t GPRS_Mobile_Allocation;

  uint8_t UnionType;
  union
  {
    PBCCH_Not_present_t PBCCH_Not_present;
    PBCCH_present_t PBCCH_present;
  } u;

  bool                  Exist_AdditionsR99;
  PSI13_AdditionR99     AdditionsR99;
} PSI13_t;

/* SI_13_t is combined in the PSI13 structure */
typedef PSI13_t SI_13_t;

/* < Packet PRACH Parameters message content > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;


  PRACH_Control_t PRACH_Control;
} Packet_PRACH_Parameters_t;

/* < Packet Access Reject message content > */
typedef struct
{
  uint8_t UnionType;
  union
  {
    uint32_t TLLI;
    Packet_Request_Reference_t Packet_Request_Reference;
    Global_TFI_t Global_TFI;
  } u;
} RejectID_t;

typedef struct
{
  RejectID_t ID;

  uint8_t Exist_Wait;
  uint8_t WAIT_INDICATION;
  uint8_t WAIT_INDICATION_SIZE;
} Reject_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  uint8_t IndexToOur;
  uint8_t Count_Reject;
  Reject_t Reject[5];
} Packet_Access_Reject_t;

/* < Packet Cell Change Order message content > */
typedef struct
{
  uint8_t CELL_BAR_ACCESS_2;
  uint8_t EXC_ACC;
  uint8_t SAME_RA_AS_SERVING_CELL;

  uint8_t Exist_RXLEV_and_TXPWR;
  uint8_t GPRS_RXLEV_ACCESS_MIN;
  uint8_t GPRS_MS_TXPWR_MAX_CCH;

  uint8_t Exist_OFFSET_and_TIME;
  uint8_t GPRS_TEMPORARY_OFFSET;
  uint8_t GPRS_PENALTY_TIME;

  uint8_t Exist_GPRS_RESELECT_OFFSET;
  uint8_t GPRS_RESELECT_OFFSET;

  uint8_t Exist_HCS;
  HCS_t HCS;

  uint8_t Exist_SI13_PBCCH_Location;
  SI13_PBCCH_Location_t SI13_PBCCH_Location;
} Cell_Selection_2_t;

typedef struct
{
  uint8_t FREQUENCY_DIFF;
  uint8_t BSIC;
  Cell_Selection_t Cell_Selection;
} h_FreqBsicCell_t;

typedef struct
{
  uint8_t FREQ_DIFF_LENGTH;
  uint8_t FREQUENCY_DIFF;
  uint8_t BSIC;

  bool Exist_CellSelectionParams;
  Cell_Selection_2_t CellSelectionParams;
} CellSelectionParamsWithFreqDiff_t;

typedef struct
{
  uint16_t START_FREQUENCY;
  uint8_t BSIC;

  uint8_t Exist_Cell_Selection;
  Cell_Selection_2_t Cell_Selection;

  uint8_t NR_OF_FREQUENCIES;
  uint8_t FREQ_DIFF_LENGTH;


  CellSelectionParamsWithFreqDiff_t CellSelectionParamsWithFreqDiff[32];
} Add_Frequency_list_t;

typedef struct
{
  uint8_t REMOVED_FREQ_INDEX;
} Removed_Freq_Index_t;

typedef struct
{
  uint8_t Exist_REMOVED_FREQ;
  uint8_t NR_OF_REMOVED_FREQ;
  Removed_Freq_Index_t Removed_Freq_Index[32];

  uint8_t Count_Add_Frequency;
  Add_Frequency_list_t Add_Frequency[32];
} NC_Frequency_list_t;


typedef struct
{
  uint8_t NETWORK_CONTROL_ORDER;

  uint8_t Exist_NC;
  uint8_t NC_NON_DRX_PERIOD;
  uint8_t NC_REPORTING_PERIOD_I;
  uint8_t NC_REPORTING_PERIOD_T;

  uint8_t Exist_NC_FREQUENCY_LIST;
  NC_Frequency_list_t NC_Frequency_list;
} NC_Measurement_Parameters_with_Frequency_List_t;


typedef struct
{
  uint8_t BA_IND;
  uint8_t BA_IND_3G;
} BA_IND_t;

typedef struct
{
  uint8_t BA_USED;
  uint8_t BA_USED_3G;
} BA_USED_t;

typedef struct
{
  uint8_t RXLEV_SERVING_CELL;
} Serving_Cell_Data_t;

typedef struct
{
  uint8_t FREQUENCY_N;
  uint8_t Exist_BSIC_N;
  uint8_t BSIC_N;
  uint8_t RXLEV_N;
} NC_Measurements_t;

typedef struct
{
  uint8_t BCCH_FREQ_N;
  uint8_t BSIC_N;
  uint8_t RXLEV_N;
} RepeatedInvalid_BSIC_Info_t;

typedef struct
{
  uint8_t Exist_REPORTING_QUANTITY;
  uint8_t REPORTING_QUANTITY;
} REPORTING_QUANTITY_Instance_t;

typedef struct
{
  uint8_t NC_MODE;
  Serving_Cell_Data_t Serving_Cell_Data;

  uint8_t NUMBER_OF_NC_MEASUREMENTS;
  NC_Measurements_t NC_Measurements[6];  /* NC_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS))
                                           Max 7 NC Measurements in one PACKET MEASUREMENT REPORT,
                                           but only 6 cells are updated in PACKET IDLE. */
} NC_Measurement_Report_t;

typedef struct
{
  uint8_t EXT_REPORTING_TYPE;

  uint8_t Exist_I_LEVEL;
  struct
  {
    uint8_t Exist;
    uint8_t I_LEVEL;
  } Slot[8];

  uint8_t NUMBER_OF_EXT_MEASUREMENTS;
  NC_Measurements_t EXT_Measurements[9];  /* EXT_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS))
                                            Max 9 Ext Measurements in one PACKET MEASUREMENT REPORT */
} EXT_Measurement_Report_t;

typedef struct
{
  uint8_t CELL_LIST_INDEX_3G;
  uint8_t REPORTING_QUANTITY;
} Measurements_3G_t;

typedef struct
{
  uint32_t UTRAN_CGI;
  uint8_t Exist_PLMN_ID;
  PLMN_t   Plmn_ID;
  uint32_t CSG_ID;
  bool Access_Mode;
  uint8_t  REPORTING_QUANTITY;
} UTRAN_CSG_Measurement_Report_t;

typedef struct
{
  uint32_t EUTRAN_CGI;
  uint16_t Tracking_Area_Code;
  uint8_t Exist_PLMN_ID;
  PLMN_t   Plmn_ID;
  uint32_t CSG_ID;
  bool Access_Mode;
  uint8_t  REPORTING_QUANTITY;
} EUTRAN_CSG_Measurement_Report_t;

typedef struct
{
  bool      Exist_UTRAN_CSG_Meas_Rpt;
  UTRAN_CSG_Measurement_Report_t  UTRAN_CSG_Meas_Rpt;
  bool      Exist_EUTRAN_CSG_Meas_Rpt;
  EUTRAN_CSG_Measurement_Report_t  EUTRAN_CSG_Meas_Rpt;
} PMR_AdditionsR9_t;

typedef struct
{
  uint8_t EUTRAN_FREQUENCY_INDEX;
  uint16_t CELL_IDENTITY;
  uint8_t REPORTING_QUANTITY;
} EUTRAN_Measurement_Report_Body_t;

typedef struct
{
  uint8_t N_EUTRAN;
  EUTRAN_Measurement_Report_Body_t Report[4];
} EUTRAN_Measurement_Report_t;

typedef struct
{
  bool       Exist_EUTRAN_Meas_Rpt;
  EUTRAN_Measurement_Report_t  EUTRAN_Meas_Rpt;
  bool       Exist_AdditionsR9;
  PMR_AdditionsR9_t  AdditionsR9;
} PMR_AdditionsR8_t;

typedef struct
{
  bool         Exist_GRNTI;
  uint8_t       GRNTI;
  bool         Exist_AdditionsR8;
  PMR_AdditionsR8_t  AdditionsR8;
} PMR_AdditionsR5_t;

typedef struct
{
  bool         Exist_Info3G;
  uint8_t      UnionType;
  union
  {
    BA_USED_t BA_USED;
    uint8_t    PSI3_CHANGE_MARK;
  } u;
  uint8_t      PMO_USED;

  /* N_3G        bit(3): max value 7
   * Report part  (csn): {<3G_CELL_LIST_INDEX:bit(7)><REPORTING_QUANTITY:bit(6)>}*(val(N_3G + 1))
   * Max 6 3G measurement structs in one PMR
   */
  bool         Exist_MeasurementReport3G;
  uint8_t      N_3G;
  Measurements_3G_t Measurements_3G[6];

  bool         Exist_AdditionsR5;
  PMR_AdditionsR5_t  AdditionsR5;
} PMR_AdditionsR99_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  uint32_t TLLI;
  uint8_t Exist_PSI5_CHANGE_MARK;
  uint8_t PSI5_CHANGE_MARK;

  uint8_t UnionType;
  union
  {
    NC_Measurement_Report_t NC_Measurement_Report;
    EXT_Measurement_Report_t EXT_Measurement_Report;
  } u;

  bool Exist_AdditionsR99;
  PMR_AdditionsR99_t AdditionsR99;
} Packet_Measurement_Report_t;

#define INV_BSIC_LIST_LEN (16)

#define REPORT_QUANTITY_LIST_LEN (96) /* Specification specified up to 96 */

typedef struct
{
  uint8_t NC_MODE;
  uint8_t UnionType;
  union
  {
    BA_USED_t BA_USED;
    uint8_t PSI3_CHANGE_MARK;
  } u;

  uint8_t PMO_USED;
  uint8_t BSIC_Seen;
  uint8_t SCALE;

  uint8_t Exist_Serving_Cell_Data;
  Serving_Cell_Data_t Serving_Cell_Data;

  uint8_t Count_RepeatedInvalid_BSIC_Info;
  RepeatedInvalid_BSIC_Info_t RepeatedInvalid_BSIC_Info[INV_BSIC_LIST_LEN];

  uint8_t Exist_ReportBitmap;
  uint8_t Count_REPORTING_QUANTITY_Instances;
  REPORTING_QUANTITY_Instance_t REPORTING_QUANTITY_Instances[REPORT_QUANTITY_LIST_LEN];

} ENH_NC_Measurement_Report_t;

typedef struct
{
  uint8_t Exist_UTRAN_CSG_Target_Cell;
  UTRAN_CSG_Target_Cell_t UTRAN_CSG_Target_Cell;
  uint8_t Exist_EUTRAN_CSG_Target_Cell;
  EUTRAN_CSG_Target_Cell_t EUTRAN_CSG_Target_Cell;
} PEMR_AdditionsR9_t;

typedef struct
{
  bool      Exist_REPORTING_QUANTITY;
  uint8_t    REPORTING_QUANTITY;
} Bitmap_Report_Quantity_t;

typedef struct
{
  uint8_t BITMAP_LENGTH;
  Bitmap_Report_Quantity_t  Bitmap_Report_Quantity[128];
  bool      Exist_EUTRAN_Meas_Rpt;
  EUTRAN_Measurement_Report_t EUTRAN_Meas_Rpt;
  bool       Exist_AdditionsR9;
  PEMR_AdditionsR9_t AdditionsR9;
} PEMR_AdditionsR8_t;

typedef struct
{
  bool      Exist_GRNTI_Ext;
  uint8_t    GRNTI_Ext;
  bool      Exist_AdditionsR8;
  PEMR_AdditionsR8_t  AdditionsR8;
} PEMR_AdditionsR5_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  uint32_t TLLI;

  ENH_NC_Measurement_Report_t Measurements;

  bool      Exist_AdditionsR5;
  PEMR_AdditionsR5_t  AdditionsR5;
} Packet_Enh_Measurement_Report_t;

typedef struct
{
  uint8_t RXLEV_SERVING_CELL;

  uint8_t NUMBER_OF_NC_MEASUREMENTS;
  NC_Measurements_t NC_Measurements[6];  /* NC_Measurements * (val(NUMBER_OF_NC_MEASUREMENTS))
                                           Max 7 NC Measurements in one PACKET MEASUREMENT REPORT,
                                           but only 6 cells are updated in PACKET IDLE. */
} CCN_Measurement_Report_t;

typedef struct
{
  uint16_t ARFCN;
  uint8_t BSIC;
} Target_Cell_GSM_Notif_t;

typedef struct
{
  uint16_t FDD_ARFCN;
  uint8_t Exist_Bandwith_FDD;
  uint8_t BANDWITH_FDD;
  uint16_t SCRAMBLING_CODE;
} FDD_Target_Cell_Notif_t;

typedef struct
{
  uint16_t TDD_ARFCN;
  uint8_t Exist_Bandwith_TDD;
  uint8_t BANDWITH_TDD;
  uint8_t CELL_PARAMETER;
  uint8_t Sync_Case_TSTD;
} TDD_Target_Cell_Notif_t;

typedef struct
{
  uint8_t Exist_FDD_Description;
  FDD_Target_Cell_Notif_t FDD_Target_Cell_Notif;
  uint8_t Exist_TDD_Description;
  TDD_Target_Cell_Notif_t TDD_Target_Cell;
  uint8_t REPORTING_QUANTITY;
} Target_Cell_3G_Notif_t;

typedef struct
{
  uint16_t EARFCN;
  uint8_t Exist_Measurement_Bandwidth;
  uint8_t Measurement_Bandwidth;
  uint16_t Physical_Layer_Cell_Identity;
  uint8_t Reporting_Quantity;
} Target_EUTRAN_Cell_Notif_t;

typedef struct
{
  uint8_t EUTRAN_FREQUENCY_INDEX;
  uint16_t CELL_IDENTITY;
  uint8_t REPORTING_QUANTITY;
} Eutran_Ccn_Measurement_Report_Cell_t;

typedef struct
{
  bool      ThreeG_BA_USED;
  uint8_t   N_EUTRAN;
  Eutran_Ccn_Measurement_Report_Cell_t Eutran_Ccn_Measurement_Report_Cell[4];
} Eutran_Ccn_Measurement_Report_t;

typedef struct
{
  uint8_t Exist_Arfcn;
  uint16_t Arfcn;
  uint8_t bsic;
  uint8_t Exist_3G_Target_Cell;
  Target_Cell_3G_Notif_t Target_Cell_3G_Notif;
  uint8_t Exist_Eutran_Target_Cell;
  Target_EUTRAN_Cell_Notif_t Target_EUTRAN_Cell;
  uint8_t Exist_Eutran_Ccn_Measurement_Report;
  Eutran_Ccn_Measurement_Report_t Eutran_Ccn_Measurement_Report;
} Target_Cell_4G_Notif_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    UTRAN_CSG_Measurement_Report_t UTRAN_CSG_Measurement_Report;
    EUTRAN_CSG_Measurement_Report_t EUTRAN_CSG_Measurement_Report;
  } u;
  uint8_t Exist_Eutran_Ccn_Measurement_Report;
  Eutran_Ccn_Measurement_Report_t Eutran_Ccn_Measurement_Report;
} Target_Cell_CSG_Notif_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Target_Cell_4G_Notif_t Target_Cell_4G_Notif;
    Target_Cell_CSG_Notif_t Target_Cell_CSG_Notif;
  } u;
} Target_Other_RAT_2_Notif_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Target_Cell_3G_Notif_t Target_Cell_3G_Notif;
    Target_Other_RAT_2_Notif_t Target_Other_RAT_2_Notif;
  } u;
} Target_Other_RAT_Notif_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Target_Cell_GSM_Notif_t Target_Cell_GSM_Notif;
    Target_Other_RAT_Notif_t Target_Other_RAT_Notif;
  } u;
} Target_Cell_t;

typedef struct
{
  uint8_t Exist_BA_USED_3G;
  uint8_t BA_USED_3G;

  uint8_t N_3G;
  Measurements_3G_t Measurements_3G[6];
} PCCN_AdditionsR6_t;

/* < Packet Cell Change Notification message contents > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  Global_TFI_t Global_TFI;

  Target_Cell_t Target_Cell;

  uint8_t UnionType;
  union
  {
    uint8_t BA_IND;
    uint8_t PSI3_CHANGE_MARK;
  } u;
  uint8_t PMO_USED;
  uint8_t PCCN_SENDING;
  CCN_Measurement_Report_t CCN_Measurement_Report;

  bool Exist_AdditionsR6;
  PCCN_AdditionsR6_t AdditionsR6;
} Packet_Cell_Change_Notification_t;

/* < Packet Cell Change Order message contents > */


typedef struct
{
  uint8_t  FrequencyScrolling;
  uint8_t  BSIC;
} BSICDesc_t;


#define MAX_BSIC_DESCS (19) /* Due to message size (23 bytes) and header etc,
                             * there cannot be more than 19 DESCS.
                             */

typedef struct
{
  bool         Exist_IndexStartBA;
  uint8_t      IndexStartBA;
  uint8_t      BSIC;
  uint8_t      NumRemainingBSICs;
  BSICDesc_t  BSICDesc[MAX_BSIC_DESCS];
} BSICList_t;

typedef BSICList_t GPRSBSICList_t;

#define MAX_RTD_VALUES (6)

typedef struct
{
  uint8_t NumRTDValues;
  uint16_t RTD[MAX_RTD_VALUES];
} RTDValues_t;

typedef struct
{
  bool Exist_StartValue;
  uint8_t  StartValue;
} BAIndexStartRTD_t;

#define MAX_RTD_FREQS (32)

typedef struct
{
  BAIndexStartRTD_t BAIndexStart;
  uint8_t NumFreqs;
  RTDValues_t RTD_s[MAX_RTD_FREQS];
} RTDList_t;

typedef struct
{
  bool       Exist_ListRTD6;
  RTDList_t ListRTD6;

  bool       Exist_ListRTD12;
  RTDList_t ListRTD12;
} RealTimeDiffs_t;


typedef MeasurementParams_t GPRSMeasurementParams_PMO_PCCO_t;

typedef struct {
  bool               existMultiratReporting;
  uint8_t            MultiratReporting;

  bool               existOffsetThreshold;
  OffsetThreshold_t OffsetThreshold;
} MultiratParams3G_t;

typedef struct
{
  uint8_t             Qsearch_P;
  uint8_t             SearchPrio3G;

  bool                existRepParamsFDD;
  uint8_t             RepQuantFDD;
  uint8_t             MultiratReportingFDD;

  bool                existOffsetThreshold;
  OffsetThreshold_t  OffsetThreshold;

  MultiratParams3G_t ParamsTDD;
  MultiratParams3G_t ParamsCDMA2000;
} ENH_GPRSMeasurementParams3G_PMO_t;


typedef struct
{
  uint8_t             Qsearch_P;
  uint8_t             SearchPrio3G;

  bool                existRepParamsFDD;
  uint8_t             RepQuantFDD;
  uint8_t             MultiratReportingFDD;

  bool                existOffsetThreshold;
  OffsetThreshold_t  OffsetThreshold;

  MultiratParams3G_t ParamsTDD;
} ENH_GPRSMeasurementParams3G_PCCO_t;


typedef struct
{
  uint8_t Qsearch_p;
  uint8_t SearchPrio3G;

  uint8_t existRepParamsFDD;
  uint8_t RepQuantFDD;
  uint8_t MultiratReportingFDD;

  uint8_t existReportingParamsFDD;
  uint8_t ReportingOffsetFDD;
  uint8_t ReportingThresholdFDD;

  uint8_t existMultiratReportingTDD;
  uint8_t MultiratReportingTDD;

  uint8_t existOffsetThresholdTDD;
  uint8_t ReportingOffsetTDD;
  uint8_t ReportingThresholdTDD;
} GPRSMeasurementParams3G_t;

typedef struct
{
  uint8_t REMOVED_3GCELL_INDEX;
  uint8_t CELL_DIFF_LENGTH_3G;
  uint8_t CELL_DIFF_3G;
} N2_t;

typedef struct
{
  uint8_t N2_Count;
  N2_t N2s[32];
} N1_t;

typedef struct
{
  uint8_t N1_Count;
  N1_t N1s[4];
} Removed3GCellDescription_t;

typedef struct
{
  uint8_t Complete_This;
} CDMA2000_Description_t;

typedef struct {
  uint8_t ZERO;
  uint16_t UARFCN;
  uint8_t Indic0;
  uint8_t NrOfCells;
  uint8_t BitsInCellInfo;
  uint8_t CellInfo[16]; /* bitmap compressed according to "Range 1024" algorithm (04.18/9.1.54) */
} UTRAN_FDD_NeighbourCells_t;

typedef struct {
  bool                            existBandwidth;
  uint8_t                         Bandwidth;
  uint8_t                         NrOfFrequencies;
  UTRAN_FDD_NeighbourCells_t     CellParams[8];
} UTRAN_FDD_Description_t;

typedef struct {
  uint8_t ZERO;
  uint16_t UARFCN;
  uint8_t Indic0;
  uint8_t NrOfCells;
  uint8_t BitsInCellInfo;
  uint8_t CellInfo[16]; /* bitmap compressed according to "Range 512" algorithm */
} UTRAN_TDD_NeighbourCells_t;

typedef struct {
  bool                            existBandwidth;
  uint8_t                         Bandwidth;
  uint8_t                         NrOfFrequencies;
  UTRAN_TDD_NeighbourCells_t    CellParams[8];
} UTRAN_TDD_Description_t;

typedef struct
{
  uint8_t Exist_Index_Start_3G;
  uint8_t Index_Start_3G;
  uint8_t Exist_Absolute_Index_Start_EMR;
  uint8_t Absolute_Index_Start_EMR;
  uint8_t Exist_UTRAN_FDD_Description;
  UTRAN_FDD_Description_t UTRAN_FDD_Description;
  uint8_t Exist_UTRAN_TDD_Description;
  UTRAN_TDD_Description_t UTRAN_TDD_Description;
  uint8_t Exist_CDMA2000_Description;
  CDMA2000_Description_t CDMA2000_Description;
  uint8_t Exist_Removed3GCellDescription;
  Removed3GCellDescription_t Removed3GCellDescription;
} NeighbourCellDescription3G_PMO_t;

typedef struct
{
  uint8_t Exist_Index_Start_3G;
  uint8_t Index_Start_3G;
  uint8_t Exist_Absolute_Index_Start_EMR;
  uint8_t Absolute_Index_Start_EMR;
  uint8_t Exist_UTRAN_FDD_Description;
  UTRAN_FDD_Description_t UTRAN_FDD_Description;
  uint8_t Exist_UTRAN_TDD_Description;
  UTRAN_TDD_Description_t UTRAN_TDD_Description;
  uint8_t Exist_Removed3GCellDescription;
  Removed3GCellDescription_t Removed3GCellDescription;
} NeighbourCellDescription3G_PCCO_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    BA_IND_t BA_IND;
    uint8_t PSI3_CHANGE_MARK;
  } u;

  uint8_t  PMO_IND;

  uint8_t  REPORT_TYPE;
  uint8_t  REPORTING_RATE;
  uint8_t  INVALID_BSIC_REPORTING;

  bool Exist_NeighbourCellDescription3G;
  NeighbourCellDescription3G_PMO_t NeighbourCellDescription3G;

  bool Exist_GPRSReportPriority;
  GPRSReportPriority_t GPRSReportPriority;

  bool Exist_GPRSMeasurementParams;
  GPRSMeasurementParams_PMO_PCCO_t GPRSMeasurementParams;
  bool Exist_GPRSMeasurementParams3G;
  ENH_GPRSMeasurementParams3G_PMO_t GPRSMeasurementParams3G;
} ENH_Measurement_Parameters_PMO_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    BA_IND_t BA_IND;
    uint8_t PSI3_CHANGE_MARK;
  } u;

  uint8_t  PMO_IND;

  uint8_t  REPORT_TYPE;
  uint8_t  REPORTING_RATE;
  uint8_t  INVALID_BSIC_REPORTING;

  bool Exist_NeighbourCellDescription3G;
  NeighbourCellDescription3G_PCCO_t NeighbourCellDescription3G;

  bool Exist_GPRSReportPriority;
  GPRSReportPriority_t GPRSReportPriority;

  bool Exist_GPRSMeasurementParams;
  GPRSMeasurementParams_PMO_PCCO_t GPRSMeasurementParams;
  bool Exist_GPRSMeasurementParams3G;
  ENH_GPRSMeasurementParams3G_PCCO_t GPRSMeasurementParams3G;
} ENH_Measurement_Parameters_PCCO_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_TFI_t Global_TFI;
    uint32_t TLLI;
  } u;
} PacketCellChangeOrderID_t;

typedef struct
{
  uint8_t CELL_BAR_QUALIFY_3;
  uint8_t Exist_SI13_Alt_PBCCH_Location;
  SI13_PBCCH_Location_t SI13_Alt_PBCCH_Location;
} lu_ModeCellSelectionParameters_t;

typedef struct
{
  uint8_t Exist_lu_ModeCellSelectionParams;
  lu_ModeCellSelectionParameters_t lu_ModeCellSelectionParameters;
} lu_ModeCellSelectionParams_t;

typedef struct
{
  lu_ModeCellSelectionParams_t lu_ModeCellSelectionParameters;
  uint8_t NR_OF_FREQUENCIES;
  lu_ModeCellSelectionParams_t lu_ModeCellSelectionParams[32];
} lu_ModeNeighbourCellParams_t;

typedef struct
{
  uint8_t CELL_BAR_QUALIFY_3;
  uint8_t SAME_RA_AS_SERVING_CELL;

  uint8_t Exist_RXLEV_and_TXPWR;
  uint8_t GPRS_RXLEV_ACCESS_MIN;
  uint8_t GPRS_MS_TXPWR_MAX_CCH;

  uint8_t Exist_OFFSET_and_TIME;
  uint8_t GPRS_TEMPORARY_OFFSET;
  uint8_t GPRS_PENALTY_TIME;

  uint8_t Exist_GPRS_RESELECT_OFFSET;
  uint8_t GPRS_RESELECT_OFFSET;

  uint8_t Exist_HCS;
  HCS_t HCS;

  uint8_t Exist_SI13_Alt_PBCCH_Location;
  SI13_PBCCH_Location_t SI13_Alt_PBCCH_Location;
} lu_ModeOnlyCellSelection_t;

typedef struct
{
  uint8_t FREQ_DIFF_LENGTH;
  uint8_t FREQUENCY_DIFF;
  uint8_t BSIC;

  bool Exist_lu_ModeOnlyCellSelectionParams;
  lu_ModeOnlyCellSelection_t lu_ModeOnlyCellSelectionParams;
} lu_ModeOnlyCellSelectionParamsWithFreqDiff_t;

typedef struct
{
  uint16_t START_FREQUENCY;
  uint8_t BSIC;

  uint8_t Exist_lu_ModeCellSelection;
  lu_ModeOnlyCellSelection_t lu_ModeOnlyCellSelection;

  uint8_t NR_OF_FREQUENCIES;
  uint8_t FREQ_DIFF_LENGTH;

  lu_ModeOnlyCellSelectionParamsWithFreqDiff_t lu_ModeOnlyCellSelectionParamsWithFreqDiff[32];
} Add_lu_ModeOnlyFrequencyList_t;

typedef struct
{
  uint8_t Count_Add_lu_ModeOnlyFrequencyList;
  Add_lu_ModeOnlyFrequencyList_t Add_lu_ModeOnlyFrequencyList[32];
} NC_lu_ModeOnlyCapableCellList_t;


typedef struct
{
  uint8_t                  NumberOfFrequencyIndexes;
  uint8_t                  UTRAN_FREQUENCY_INDEX_a[18];

  bool                     existUTRAN_PRIORITY;
  uint8_t                  UTRAN_PRIORITY;

  uint8_t                  THRESH_UTRAN_high;

  bool                     existTHRESH_UTRAN_low;
  uint8_t                  THRESH_UTRAN_low;

  bool                     existUTRAN_QRXLEVMIN;
  uint8_t                  UTRAN_QRXLEVMIN;
} RepeatedUTRAN_PriorityParameters_t;

typedef struct
{
  bool                                existDEFAULT_UTRAN_Parameters;
  uint8_t                             DEFAULT_UTRAN_PRIORITY;
  uint8_t                             DEFAULT_THRESH_UTRAN;
  uint8_t                             DEFAULT_UTRAN_QRXLEVMIN;

  uint8_t                             NumberOfPriorityParameters;
  RepeatedUTRAN_PriorityParameters_t  RepeatedUTRAN_PriorityParameters_a[8];
} PriorityParametersDescription3G_PMO_t;

typedef struct
{
  bool existEUTRAN_FDD_REPORTING_THRESHOLD_OFFSET;
  uint8_t  EUTRAN_FDD_REPORTING_THRESHOLD;
  bool existEUTRAN_FDD_REPORTING_THRESHOLD_2;
  uint8_t  EUTRAN_FDD_REPORTING_THRESHOLD_2;
  bool existEUTRAN_FDD_REPORTING_OFFSET;
  uint8_t  EUTRAN_FDD_REPORTING_OFFSET;

  bool existEUTRAN_TDD_REPORTING_THRESHOLD_OFFSET;
  uint8_t  EUTRAN_TDD_REPORTING_THRESHOLD;
  bool existEUTRAN_TDD_REPORTING_THRESHOLD_2;
  uint8_t  EUTRAN_TDD_REPORTING_THRESHOLD_2;
  bool existEUTRAN_TDD_REPORTING_OFFSET;
  uint8_t  EUTRAN_TDD_REPORTING_OFFSET;
} EUTRAN_REPORTING_THRESHOLD_OFFSET_t;

typedef struct
{
  uint8_t                              Qsearch_P_EUTRAN;
  uint8_t                              EUTRAN_REP_QUANT;
  uint8_t                              EUTRAN_MULTIRAT_REPORTING;
  EUTRAN_REPORTING_THRESHOLD_OFFSET_t EUTRAN_REPORTING_THRESHOLD_OFFSET;
} GPRS_EUTRAN_MeasurementParametersDescription_t;

typedef struct
{
  uint16_t EARFCN;
  bool existMeasurementBandwidth;
  uint8_t  MeasurementBandwidth;
} RepeatedEUTRAN_Cells_t;

typedef struct
{
  uint8_t                  nbrOfEUTRAN_Cells;
  RepeatedEUTRAN_Cells_t  EUTRAN_Cells_a[6];

  bool                     existEUTRAN_PRIORITY;
  uint8_t                  EUTRAN_PRIORITY;

  uint8_t                  THRESH_EUTRAN_high;

  bool                     existTHRESH_EUTRAN_low;
  uint8_t                  THRESH_EUTRAN_low;

  bool                     existEUTRAN_QRXLEVMIN;
  uint8_t                  EUTRAN_QRXLEVMIN;
} RepeatedEUTRAN_NeighbourCells_t;

typedef struct
{
  uint16_t PCID;
} PCID_t;

typedef struct
{
  uint8_t PCID_Pattern_length;
  uint8_t PCID_Pattern;
  uint8_t PCID_Pattern_sense;
} PCID_Pattern_t;

typedef struct
{
  uint8_t         NumberOfPCIDs;
  uint16_t        PCID_a[11];

  bool            existPCID_BITMAP_GROUP;
  uint8_t         PCID_BITMAP_GROUP;

  uint8_t         NumberOfPCID_Patterns;
  PCID_Pattern_t PCID_Pattern_a[19];
} PCID_Group_IE_t;

typedef struct
{
  uint8_t EUTRAN_FREQUENCY_INDEX;
} EUTRAN_FREQUENCY_INDEX_t;

typedef struct
{
  PCID_Group_IE_t          NotAllowedCells;
  uint8_t                   NumberOfFrequencyIndexes;
  EUTRAN_FREQUENCY_INDEX_t EUTRAN_FREQUENCY_INDEX_a[28];
} RepeatedEUTRAN_NotAllowedCells_t;

typedef struct
{
  uint8_t                   NumberOfMappings;
  PCID_Group_IE_t          PCID_ToTA_Mapping_a[14];

  uint8_t                   NumberOfFrequencyIndexes;
  EUTRAN_FREQUENCY_INDEX_t EUTRAN_FREQUENCY_INDEX_a[28];
} RepeatedEUTRAN_PCID_to_TA_mapping_t;

typedef struct
{
  uint8_t EUTRAN_CCN_ACTIVE;

  bool                                           existGPRS_EUTRAN_MeasurementParametersDescription;
  GPRS_EUTRAN_MeasurementParametersDescription_t GPRS_EUTRAN_MeasurementParametersDescription;

  uint8_t                                        nbrOfRepeatedEUTRAN_NeighbourCellsStructs;
  RepeatedEUTRAN_NeighbourCells_t                RepeatedEUTRAN_NeighbourCells_a[4];

  uint8_t                                        NumberOfNotAllowedCells;
  RepeatedEUTRAN_NotAllowedCells_t               RepeatedEUTRAN_NotAllowedCells_a[14];

  uint8_t                                        NumberOfMappings;
  RepeatedEUTRAN_PCID_to_TA_mapping_t            RepeatedEUTRAN_PCID_to_TA_mapping_a[19];
} EUTRAN_ParametersDescription_PMO_t;

typedef struct
{
  uint8_t GERAN_PRIORITY;
  uint8_t THRESH_Priority_Search;
  uint8_t THRESH_GSM_low;
  uint8_t H_PRIO;
  uint8_t T_Reselection;
} ServingCellPriorityParametersDescription_t;

typedef struct
{
  bool                                       existServingCellPriorityParametersDescription;
  ServingCellPriorityParametersDescription_t ServingCellPriorityParametersDescription;

  bool                                       existPriorityParametersDescription3G_PMO;
  PriorityParametersDescription3G_PMO_t      PriorityParametersDescription3G_PMO;

  bool                                       existEUTRAN_ParametersDescription_PMO;
  EUTRAN_ParametersDescription_PMO_t         EUTRAN_ParametersDescription_PMO;
} PriorityAndEUTRAN_ParametersDescription_PMO_t;

typedef struct
{
  uint8_t PSC_Pattern_length;
  uint8_t PSC_Pattern;
  bool PSC_Pattern_sense;
} PSC_Pattern_t;

typedef struct
{
  uint8_t PSC_Count;
  uint16_t PSC[32];
  uint8_t PSC_Pattern_Count;
  PSC_Pattern_t PSC_Pattern[32];
} PSC_Group_t;

typedef struct
{
  PSC_Group_t CSG_PSC_SPLIT;
  uint8_t     Count;
  uint8_t     UTRAN_FREQUENCY_INDEX[32];
} ThreeG_CSG_Description_Body_t;

typedef struct
{
  uint8_t Count;
  ThreeG_CSG_Description_Body_t  ThreeG_CSG_Description_Body[32];
} ThreeG_CSG_Description_t;

typedef struct
{
  PSC_Group_t CSG_PCI_SPLIT;
  uint8_t Count;
  uint8_t EUTRAN_FREQUENCY_INDEX[32];
} EUTRAN_CSG_Description_Body_t;

typedef struct
{
  uint8_t Count;
  EUTRAN_CSG_Description_Body_t EUTRAN_CSG_Description_Body[32];
} EUTRAN_CSG_Description_t;

typedef struct
{
  bool      existMeasurement_Control_EUTRAN;
  bool      Measurement_Control_EUTRAN;
  uint8_t   EUTRAN_FREQUENCY_INDEX_top;
  uint8_t   Count_EUTRAN_FREQUENCY_INDEX;
  uint8_t   EUTRAN_FREQUENCY_INDEX[32];

  bool      existMeasurement_Control_UTRAN;
  bool      Measurement_Control_UTRAN;
  uint8_t   UTRAN_FREQUENCY_INDEX_top;
  uint8_t   Count_UTRAN_FREQUENCY_INDEX;
  uint8_t   UTRAN_FREQUENCY_INDEX[32];
} Meas_Ctrl_Param_Desp_t;

typedef struct
{
  uint8_t   THRESH_EUTRAN_high_Q;
  bool existTHRESH_EUTRAN_low_Q;
  uint8_t   THRESH_EUTRAN_low_Q;
  bool existEUTRAN_QQUALMIN;
  uint8_t   EUTRAN_QQUALMIN;
  bool existEUTRAN_RSRPmin;
  uint8_t   EUTRAN_RSRPmin;
} Reselection_Based_On_RSRQ_t;

typedef struct
{
  uint8_t Count_EUTRAN_FREQUENCY_INDEX;
  uint8_t EUTRAN_FREQUENCY_INDEX[32];
  uint8_t UnionType;
  union
  {
    uint8_t          EUTRAN_Qmin;
    Reselection_Based_On_RSRQ_t Reselection_Based_On_RSRQ;
  } u;
} Rept_EUTRAN_Enh_Cell_Resel_Param_t;

typedef struct
{
  uint8_t                            Count;
  Rept_EUTRAN_Enh_Cell_Resel_Param_t  Repeated_EUTRAN_Enhanced_Cell_Reselection_Parameters[32];
} Enh_Cell_Reselect_Param_Desp_t;

typedef struct
{
  bool      existUTRAN_CSG_FDD_REPORTING_THRESHOLD;
  uint8_t    UTRAN_CSG_FDD_REPORTING_THRESHOLD;
  uint8_t    UTRAN_CSG_FDD_REPORTING_THRESHOLD_2;
  bool      existUTRAN_CSG_TDD_REPORTING_THRESHOLD;
  uint8_t    UTRAN_CSG_TDD_REPORTING_THRESHOLD;
} UTRAN_CSG_Cells_Reporting_Desp_t;

typedef struct
{
  bool      existEUTRAN_CSG_FDD_REPORTING_THRESHOLD;
  uint8_t    EUTRAN_CSG_FDD_REPORTING_THRESHOLD;
  uint8_t    EUTRAN_CSG_FDD_REPORTING_THRESHOLD_2;
  bool      existEUTRAN_CSG_TDD_REPORTING_THRESHOLD;
  uint8_t    EUTRAN_CSG_TDD_REPORTING_THRESHOLD;
  uint8_t    EUTRAN_CSG_TDD_REPORTING_THRESHOLD_2;
} EUTRAN_CSG_Cells_Reporting_Desp_t;

typedef struct
{
  bool                              existUTRAN_CSG_Cells_Reporting_Description;
  UTRAN_CSG_Cells_Reporting_Desp_t   UTRAN_CSG_Cells_Reporting_Description;
  bool                              existEUTRAN_CSG_Cells_Reporting_Description;
  EUTRAN_CSG_Cells_Reporting_Desp_t  EUTRAN_CSG_Cells_Reporting_Description;
} CSG_Cells_Reporting_Desp_t;

typedef struct
{
  bool                           existEnhanced_Cell_Reselection_Parameters_Description;
  Enh_Cell_Reselect_Param_Desp_t  Enhanced_Cell_Reselection_Parameters_Description;

  bool                           existCSG_Cells_Reporting_Description;
  CSG_Cells_Reporting_Desp_t      CSG_Cells_Reporting_Description;
} PMO_AdditionsR9_t;

typedef struct
{
  uint8_t dummy;
} Delete_All_Stored_Individual_Priorities_t;

typedef struct
{
  uint8_t Count;
  uint16_t FDD_ARFCN[32];
} Individual_UTRAN_Priority_FDD_t;

typedef struct
{
  uint8_t Count;
  uint16_t TDD_ARFCN[32];
} Individual_UTRAN_Priority_TDD_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Individual_UTRAN_Priority_FDD_t Individual_UTRAN_Priority_FDD;
    Individual_UTRAN_Priority_TDD_t Individual_UTRAN_Priority_TDD;
  } u;
  uint8_t UTRAN_PRIORITY;
} Repeated_Individual_UTRAN_Priority_Parameters_t;

typedef struct
{
  uint8_t Exist_DEFAULT_UTRAN_PRIORITY;
  uint8_t DEFAULT_UTRAN_PRIORITY;
  uint8_t Repeated_Individual_UTRAN_Priority_Parameters_Count;
  Repeated_Individual_UTRAN_Priority_Parameters_t Repeated_Individual_UTRAN_Priority_Parameters[32];
} ThreeG_Individual_Priority_Parameters_Description_t;

typedef struct
{
  uint8_t Count;
  uint16_t EARFCN[32];
  uint8_t EUTRAN_PRIORITY;
} Repeated_Individual_EUTRAN_Priority_Parameters_t;

typedef struct
{
  uint8_t Exist_DEFAULT_EUTRAN_PRIORITY;
  uint8_t DEFAULT_EUTRAN_PRIORITY;
  uint8_t Count;
  Repeated_Individual_EUTRAN_Priority_Parameters_t Repeated_Individual_EUTRAN_Priority_Parameters[32];
} EUTRAN_Individual_Priority_Parameters_Description_t;

typedef struct
{
  uint8_t GERAN_PRIORITY;
  uint8_t Exist_3G_Individual_Priority_Parameters_Description;
  ThreeG_Individual_Priority_Parameters_Description_t ThreeG_Individual_Priority_Parameters_Description;
  uint8_t Exist_EUTRAN_Individual_Priority_Parameters_Description;
  EUTRAN_Individual_Priority_Parameters_Description_t EUTRAN_Individual_Priority_Parameters_Description;
  uint8_t Exist_T3230_timeout_value;
  uint8_t T3230_timeout_value;
} Provide_Individual_Priorities_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    Delete_All_Stored_Individual_Priorities_t Delete_All_Stored_Individual_Priorities;
    Provide_Individual_Priorities_t Provide_Individual_Priorities;
  } u;
} Individual_Priorities_t;

typedef struct
{
  bool              existBA_IND_3G_PMO_IND;
  uint8_t           BA_IND_3G;
  uint8_t           PMO_IND;

  bool              existPriorityAndEUTRAN_ParametersDescription_PMO;
  PriorityAndEUTRAN_ParametersDescription_PMO_t PriorityAndEUTRAN_ParametersDescription_PMO;

  bool              existIndividualPriorities_PMO;
  Individual_Priorities_t  IndividualPriorities_PMO;

  bool              existThreeG_CSG_Description;
  ThreeG_CSG_Description_t  ThreeG_CSG_Description_PMO;

  bool              existEUTRAN_CSG_Description;
  EUTRAN_CSG_Description_t  EUTRAN_CSG_Description_PMO;

  bool              existMeasurement_Control_Parameters_Description;
  Meas_Ctrl_Param_Desp_t Measurement_Control_Parameters_Description_PMO;

  bool              existAdditionsR9;
  PMO_AdditionsR9_t AdditionsR9;
} PMO_AdditionsR8_t;

typedef struct
{
  bool              existREPORTING_OFFSET_THRESHOLD_700;
  uint8_t           REPORTING_OFFSET_700;
  uint8_t           REPORTING_THRESHOLD_700;

  bool              existREPORTING_OFFSET_THRESHOLD_810;
  uint8_t           REPORTING_OFFSET_810;
  uint8_t           REPORTING_THRESHOLD_810;

  uint8_t existAdditionsR8;
  PMO_AdditionsR8_t additionsR8;
} PMO_AdditionsR7_t;

typedef struct
{
  uint8_t CCN_ACTIVE_3G;
  uint8_t existAdditionsR7;
  PMO_AdditionsR7_t additionsR7;
} PMO_AdditionsR6_t;

typedef struct
{
  uint8_t CCN_ACTIVE_3G;
} PCCO_AdditionsR6_t;

typedef struct
{
  uint8_t existGRNTI_Extension;
  uint8_t GRNTI;
  uint8_t exist_lu_ModeNeighbourCellParams;
  uint8_t count_lu_ModeNeighbourCellParams;
  lu_ModeNeighbourCellParams_t lu_ModeNeighbourCellParams[32];
  uint8_t existNC_lu_ModeOnlyCapableCellList;
  NC_lu_ModeOnlyCapableCellList_t NC_lu_ModeOnlyCapableCellList;
  uint8_t existGPRS_AdditionalMeasurementParams3G;
  GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G;
  uint8_t existAdditionsR6;
  PMO_AdditionsR6_t additionsR6;
} PMO_AdditionsR5_t;

typedef struct
{
  uint8_t existGRNTI_Extension;
  uint8_t GRNTI;
  uint8_t exist_lu_ModeNeighbourCellParams;
  uint8_t count_lu_ModeNeighbourCellParams;
  lu_ModeNeighbourCellParams_t lu_ModeNeighbourCellParams[32];
  uint8_t existNC_lu_ModeOnlyCapableCellList;
  NC_lu_ModeOnlyCapableCellList_t NC_lu_ModeOnlyCapableCellList;
  uint8_t existGPRS_AdditionalMeasurementParams3G;
  GPRS_AdditionalMeasurementParams3G_t GPRS_AdditionalMeasurementParams3G;
  uint8_t existAdditionsR6;
  PCCO_AdditionsR6_t additionsR6;
} PCCO_AdditionsR5_t;

typedef struct
{
  uint8_t CCN_ACTIVE;
  uint8_t Exist_CCN_Support_Description_ID;
  CCN_Support_Description_t CCN_Support_Description;
  uint8_t Exist_AdditionsR5;
  PMO_AdditionsR5_t AdditionsR5;
} PMO_AdditionsR4_t;

typedef struct
{
  uint8_t CCN_ACTIVE;
  uint8_t Exist_Container_ID;
  uint8_t CONTAINER_ID;
  uint8_t Exist_CCN_Support_Description_ID;
  CCN_Support_Description_t CCN_Support_Description;
  uint8_t Exist_AdditionsR5;
  PCCO_AdditionsR5_t AdditionsR5;
} PCCO_AdditionsR4_t;

typedef struct
{
  ENH_Measurement_Parameters_PCCO_t ENH_Measurement_Parameters;
  uint8_t Exist_AdditionsR4;
  PCCO_AdditionsR4_t AdditionsR4;
} PCCO_AdditionsR99_t;

typedef struct
{
  uint8_t Exist_ENH_Measurement_Parameters;
  ENH_Measurement_Parameters_PMO_t ENH_Measurement_Parameters;
  uint8_t Exist_AdditionsR4;
  PMO_AdditionsR4_t AdditionsR4;
} PMO_AdditionsR99_t;

typedef struct
{
  uint8_t Exist_LSA_Parameters;
  LSA_Parameters_t LSA_Parameters;

  uint8_t Exist_AdditionsR99;
  PMO_AdditionsR99_t AdditionsR99;
} PMO_AdditionsR98_t;

typedef struct
{
  uint8_t Exist_LSA_Parameters;
  LSA_Parameters_t LSA_Parameters;

  uint8_t Exist_AdditionsR99;
  PCCO_AdditionsR99_t AdditionsR99;
} PCCO_AdditionsR98_t;

typedef struct
{
  uint8_t IMMEDIATE_REL;
  uint16_t ARFCN;
  uint8_t BSIC;
  NC_Measurement_Parameters_with_Frequency_List_t NC_Measurement_Parameters;

  uint8_t Exist_AdditionsR98;
  PCCO_AdditionsR98_t AdditionsR98;
} Target_Cell_GSM_t;

typedef struct
{
  uint8_t Exist_EUTRAN_Target_Cell;
  EUTRAN_Target_Cell_t EUTRAN_Target_Cell;
  uint8_t Exist_Individual_Priorities;
  Individual_Priorities_t Individual_Priorities;
} Target_Cell_3G_AdditionsR8_t;

typedef struct
{
  uint8_t Exist_G_RNTI_Extention;
  uint8_t G_RNTI_Extention;
  uint8_t Exist_AdditionsR8;
  Target_Cell_3G_AdditionsR8_t AdditionsR8;
} Target_Cell_3G_AdditionsR5_t;

typedef struct
{
  /* 00 -- Message escape */
  uint8_t IMMEDIATE_REL;
  uint8_t Exist_FDD_Description;
  FDD_Target_Cell_t FDD_Target_Cell;
  uint8_t Exist_TDD_Description;
  TDD_Target_Cell_t TDD_Target_Cell;
  uint8_t Exist_AdditionsR5;
  Target_Cell_3G_AdditionsR5_t AdditionsR5;
} Target_Cell_3G_t;

#if 0
#define TARGET_CELL_GSM 0
#define TARGET_CELL_3G 1
#endif

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  PacketCellChangeOrderID_t ID;

  uint8_t UnionType;
  union
  {
    Target_Cell_GSM_t Target_Cell_GSM;
    Target_Cell_3G_t Target_Cell_3G;
  } u;

} Packet_Cell_Change_Order_t;

/* < Packet Cell Change Continue message contents > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  Global_TFI_t Global_TFI;
  uint8_t Exist_ID;
  uint16_t ARFCN;
  uint8_t BSIC;
  uint8_t CONTAINER_ID;
} Packet_Cell_Change_Continue_t;


/* < Packet Neighbour Cell Data message contents > */
typedef struct
{
  uint16_t ARFCN;
  uint8_t BSIC;
  uint8_t CONTAINER[17];     /* PD (3 bits) + CD_LENGTH (5 bits) + 16 bytes of CONTAINER_DATA (max!) */
} PNCD_Container_With_ID_t;

typedef struct
{
  uint8_t CONTAINER[19];     /* PD (3 bits) + CD_LENGTH (5 bits) + 18 bytes of CONTAINER_DATA (max!) */
} PNCD_Container_Without_ID_t;

typedef struct
{
  uint8_t UnionType;
  union
  {
    PNCD_Container_Without_ID_t PNCD_Container_Without_ID;
    PNCD_Container_With_ID_t PNCD_Container_With_ID;
  } u;
} PNCDContainer_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;
  /* Fixed 0 */
  Global_TFI_t Global_TFI;
  uint8_t CONTAINER_ID;
  uint8_t spare;
  uint8_t CONTAINER_INDEX;

  PNCDContainer_t Container;
} Packet_Neighbour_Cell_Data_t;

/* < Packet Serving Cell Data message contents > */
typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;
  /* Fixed 0 */
  Global_TFI_t Global_TFI;
  uint8_t spare;
  uint8_t CONTAINER_INDEX;
  uint8_t CONTAINER[19];     /* PD (3 bits) + CD_LENGTH (5 bits) + 18 bytes of CONTAINER_DATA (max!) */
} Packet_Serving_Cell_Data_t;

/* < Packet Measurement Order message contents > */
typedef struct
{
  uint16_t START_FREQUENCY;
  uint8_t NR_OF_FREQUENCIES;
  uint8_t FREQ_DIFF_LENGTH;

  uint8_t Count_FREQUENCY_DIFF;
  uint8_t FREQUENCY_DIFF[31];/* bit (FREQ_DIFF_LENGTH) * NR_OF_FREQUENCIES --> MAX is bit(7) * 31 */
} EXT_Frequency_List_t;

typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PAGE_MODE;

  PacketDownlinkID_t ID; /* use the PDA ID as it is the same as the PMO */

  uint8_t PMO_INDEX;
  uint8_t PMO_COUNT;

  uint8_t Exist_NC_Measurement_Parameters;
  NC_Measurement_Parameters_with_Frequency_List_t NC_Measurement_Parameters;

  uint8_t Exist_EXT_Measurement_Parameters;

  uint8_t Exist_AdditionsR98;
  PMO_AdditionsR98_t AdditionsR98;
} Packet_Measurement_Order_t;

/* Enhanced measurement report */

typedef struct
{
  uint8_t  RXLEV_SERVING_CELL;
} ServingCellData_t;

typedef struct
{
  uint8_t  BCCH_FREQ_NCELL;
  uint8_t  BSIC;
  uint8_t  RXLEV_NCELL;
} Repeated_Invalid_BSIC_Info_t;

typedef struct
{
  bool Exist_REPORTING_QUANTITY;
  uint8_t  REPORTING_QUANTITY;
} REPORTING_QUANTITY_t;

typedef struct
{
  uint8_t               NC_MODE;
  uint8_t UnionType;
  union
  {
    BA_USED_t           BA_USED;
    uint8_t             PSI3_CHANGE_MARK;
  } u;
  uint8_t PMO_USED;
  uint8_t SCALE;
  uint8_t Exist_ServingCellData;
  ServingCellData_t   ServingCellData;
  uint8_t  Count_Repeated_Invalid_BSIC_Info;
  Repeated_Invalid_BSIC_Info_t Repeated_Invalid_BSIC_Info[32];

  bool Exist_Repeated_REPORTING_QUANTITY;
  uint8_t  Count_Repeated_Reporting_Quantity;
  REPORTING_QUANTITY_t   Repeated_REPORTING_QUANTITY[96];
} NC_MeasurementReport_t;

/* Packet Handover  PHO ----------------- */

typedef struct
{
  uint8_t UnionType;
  union
  {
    uint8_t MS_TimeslotAllocation;
    Power_Control_Parameters_t Power_Control_Parameters;
  } u;
} GlobalTimeslotDescription_t;

typedef struct
{
  uint8_t TimeslotAllocation;
  uint8_t PFI;
  uint8_t RLC_Mode;
  uint8_t TFI_Assignment;
  uint8_t ControlACK;
  uint8_t Exist_EGPRS_WindowSize;
  uint8_t EGPRS_WindowSize;
} PHO_DownlinkAssignment_t;

typedef struct
{
  bool Exist_USF;
  uint8_t USF;
} PHO_USF_1_7_t;

typedef struct
{
  uint8_t USF_0;
  PHO_USF_1_7_t USF_1_7[7];
  uint8_t NBR_OfAllocatedTimeslots;
} USF_AllocationArray_t;

typedef struct
{
  uint8_t PFI;
  uint8_t RLC_Mode;
  uint8_t TFI_Assignment;
  uint8_t Exist_ChannelCodingCommand;
  uint8_t ChannelCodingCommand;
  uint8_t Exist_EGPRS_ChannelCodingCommand;
  uint8_t EGPRS_ChannelCodingCommand;
  uint8_t Exist_EGPRS_WindowSize;
  uint8_t EGPRS_WindowSize;
  uint8_t USF_Granularity;
  uint8_t Exist_TBF_TimeslotAllocation;
  uint8_t TBF_TimeslotAllocation;
  uint8_t UnionType;
  union
  {
    uint8_t USF_SingleAllocation;
    USF_AllocationArray_t USF_AllocationArray;
  } u;
} PHO_UplinkAssignment_t;

typedef struct
{
  GlobalTimeslotDescription_t GlobalTimeslotDescription;
  uint8_t Exist_PHO_UA;
  PHO_UplinkAssignment_t PHO_UA;
} GlobalTimeslotDescription_UA_t;

typedef struct
{
  uint8_t Exist_ChannelCodingCommand;
  uint8_t ChannelCodingCommand;
  uint8_t Exist_GlobalTimeslotDescription_UA;
  GlobalTimeslotDescription_UA_t GTD_UA;
  uint8_t Exist_DownlinkAssignment;
  PHO_DownlinkAssignment_t DownlinkAssignment;
} PHO_GPRS_t;


typedef struct
{
  uint8_t Exist_EGPRS_WindowSize;
  uint8_t EGPRS_WindowSize;
  uint8_t LinkQualityMeasurementMode;
  uint8_t Exist_BEP_Period2;
  uint8_t BEP_Period2;
} EGPRS_Description_t;

typedef struct
{
  uint8_t Exist_EGPRS_Description;
  EGPRS_Description_t EGPRS_Description;
  uint8_t Exist_DownlinkAssignment;
  PHO_DownlinkAssignment_t DownlinkAssignment;
} DownlinkTBF_t;

typedef struct
{
  uint8_t Exist_EGPRS_WindowSize;
  uint8_t EGPRS_WindowSize;
  uint8_t Exist_EGPRS_ChannelCodingCommand;
  uint8_t EGPRS_ChannelCodingCommand;
  uint8_t Exist_BEP_Period2;
  uint8_t BEP_Period2;
  uint8_t Exist_GlobalTimeslotDescription_UA;
  GlobalTimeslotDescription_UA_t GTD_UA;
  uint8_t Exist_DownlinkTBF;
  DownlinkTBF_t DownlinkTBF;
} PHO_EGPRS_t;

typedef struct
{
  Global_Packet_Timing_Advance_t    GlobalPacketTimingAdvance;
  uint8_t Exist_PacketExtendedTimingAdvance;
  uint8_t PacketExtendedTimingAdvance;
} PHO_TimingAdvance_t;

typedef struct
{
  uint8_t NAS_ContainerLength;
  uint8_t Spare_1a;
  uint8_t Spare_1b;
  uint8_t Spare_1c;
  uint8_t Old_XID;
  uint8_t Spare_1e;
  uint8_t Type_of_Ciphering_Algo;
  uint32_t IOV_UI_value;
} NAS_Container_For_PS_HO_t;

typedef struct
{
  uint8_t RRC_ContainerLength;
} PS_HandoverTo_UTRAN_Payload_t;

typedef struct
{
  uint8_t RRC_ContainerLength;
} PS_HandoverTo_E_UTRAN_Payload_t;

typedef struct
{
  uint8_t Exist_HandoverReference;
  uint8_t HandoverReference;
  uint8_t ARFCN;
  uint8_t SI;
  uint8_t NCI;
  uint8_t BSIC;
  uint8_t Exist_CCN_Active;
  uint8_t CCN_Active;
  uint8_t Exist_CCN_Active_3G;
  uint8_t CCN_Active_3G;
  uint8_t Exist_CCN_Support_Description;
  CCN_Support_Description_t CCN_Support_Description;
  Frequency_Parameters_t    Frequency_Parameters;
  uint8_t NetworkControlOrder;
  uint8_t Exist_PHO_TimingAdvance;
  PHO_TimingAdvance_t PHO_TimingAdvance;
  uint8_t Extended_Dynamic_Allocation;
  uint8_t RLC_Reset;
  uint8_t Exist_PO_PR;
  uint8_t PO;
  uint8_t PR_Mode;
  uint8_t Exist_UplinkControlTimeslot;
  uint8_t UplinkControlTimeslot;
  uint8_t UnionType;
  union
  {
    PHO_GPRS_t  PHO_GPRS_Mode;
    PHO_EGPRS_t PHO_EGPRS_Mode;
  } u;
} PHO_RadioResources_t;

typedef struct
{
  PHO_RadioResources_t PHO_RadioResources;
  uint8_t Exist_NAS_Container;
  NAS_Container_For_PS_HO_t NAS_Container;
} PS_HandoverTo_A_GB_ModePayload_t;

typedef struct
{
  uint8_t MessageType;
  uint8_t PageMode;
  Global_TFI_t Global_TFI;
  uint8_t ContainerID;
  uint8_t UnionType;
  union
  {
    PS_HandoverTo_A_GB_ModePayload_t PS_HandoverTo_A_GB_ModePayload;
    PS_HandoverTo_UTRAN_Payload_t    PS_HandoverTo_UTRAN_Payload;
    PS_HandoverTo_E_UTRAN_Payload_t  PS_HandoverTo_E_UTRAN_Payload;
  } u;
} Packet_Handover_Command_t;

/* End Packet Handover */

/* Packet Physical Information ----------------- */

typedef struct
{
  uint8_t MessageType;
  uint8_t PageMode;
  Global_TFI_t Global_TFI;
  uint8_t TimingAdvance;
} Packet_PhysicalInformation_t;

/* End Packet Physical Information */



/*  ADDITIONAL MS RADIO ACCESS CAPABILITIES -----------------*/
typedef struct
{
  uint8_t UnionType;
  union
  {
    Global_TFI_t Global_TFI;
    uint32_t TLLI;
  } u;
} AdditionalMsRadAccessCapID_t;


typedef struct
{
  uint8_t MESSAGE_TYPE;
  uint8_t PayloadType;
  uint8_t spare;
  uint8_t R;

  AdditionalMsRadAccessCapID_t ID;
  MS_Radio_Access_capability_t MS_Radio_Access_capability2;
} Additional_MS_Rad_Access_Cap_t;

/* End ADDITIONAL MS RADIO ACCESS CAPABILITIES */


/* Packet Pause -----------------*/

typedef struct
{
  uint8_t MESSAGE_TYPE;

  uint32_t TLLI;
  uint8_t RAI[48/8];
} Packet_Pause_t;

/* End Packet Pause */


/* < Payload Type Data MAC Header content > */
typedef struct
{
  uint8_t Payload_Type;
  uint8_t Countdown_Value;
  uint8_t SI;
  uint8_t R;
} UL_Data_Mac_Header_t;

typedef struct
{
  UL_Data_Mac_Header_t UL_Data_Mac_Header;
  uint8_t Spare;
  uint8_t PI;
  uint8_t TFI;
  uint8_t TI;
  uint8_t BSN;
  uint8_t E;
} UL_Data_Block_GPRS_t;

typedef struct
{
   uint8_t MESSAGE_TYPE;
   uint8_t CTRL_ACK;
}UL_Packet_Control_Ack_11_t;

typedef struct
{
   uint8_t MESSAGE_TYPE;
   uint8_t TN_RRBP;
   uint8_t CTRL_ACK;
}UL_Packet_Control_Ack_TN_RRBP_11_t;

typedef struct
{
   uint8_t MESSAGE_TYPE;
   uint8_t CTRL_ACK;
}UL_Packet_Control_Ack_8_t;

typedef struct
{
   uint8_t MESSAGE_TYPE;
   uint8_t TN_RRBP;
   uint8_t CTRL_ACK;
}UL_Packet_Control_Ack_TN_RRBP_8_t;

typedef struct
{
  uint8_t Payload_Type;
  uint8_t RRBP;
  uint8_t S_P;
  uint8_t USF;
} DL_Data_Mac_Header_t;

typedef struct
{
  DL_Data_Mac_Header_t DL_Data_Mac_Header;
  uint8_t Power_Reduction;
  uint8_t TFI;
  uint8_t FBI;
  uint8_t BSN;
  uint8_t E;
} DL_Data_Block_GPRS_t;

typedef struct
{
  uint8_t TFI;
  uint8_t RRBP;
  uint8_t ES_P;
  uint8_t USF;
  uint16_t BSN1;
  uint16_t BSN2_offset;
  uint8_t Power_Reduction;
  uint8_t SPB;
  uint8_t CPS;
  uint8_t PI;
  uint8_t ECS_P;
  uint8_t CC;
  uint8_t SPARE1;
  uint8_t SPARE2;
  uint8_t SPARE3;
} DL_Data_Block_EGPRS_Header_t;

typedef DL_Data_Block_EGPRS_Header_t DL_Data_Block_EGPRS_Header_Type1_t;
typedef DL_Data_Block_EGPRS_Header_t DL_Data_Block_EGPRS_Header_Type2_t;
typedef DL_Data_Block_EGPRS_Header_t DL_Data_Block_EGPRS_Header_Type3_t;
typedef DL_Data_Block_EGPRS_Header_t DL_Data_Block_EC_EGPRS_Header_Type1_t;
typedef DL_Data_Block_EGPRS_Header_t DL_Data_Block_EC_EGPRS_Header_Type2_t;
typedef DL_Data_Block_EGPRS_Header_t DL_Data_Block_EC_EGPRS_Header_Type3_t;

typedef DL_Data_Block_EGPRS_Header_t DL_Data_Block_EGPRS_Header_Type1_EC_t;

typedef struct
{
  uint8_t TFI;
  uint8_t Countdown_Value;
  uint8_t SI;
  uint8_t R;
  uint16_t BSN1;
  uint16_t BSN2_offset;
  uint8_t PI;
  uint8_t RSB;
  uint8_t SPB;
  uint8_t CPS;
  uint8_t FOI;
  uint8_t RI;
  uint8_t DL_CC_EST;
  uint8_t RTLLI;
  uint8_t SPARE1;
  uint8_t SPARE2;
  uint8_t dummy;
} UL_Data_Block_EGPRS_Header_t;

typedef UL_Data_Block_EGPRS_Header_t UL_Data_Block_EGPRS_Header_Type1_t;
typedef UL_Data_Block_EGPRS_Header_t UL_Data_Block_EGPRS_Header_Type2_t;
typedef UL_Data_Block_EGPRS_Header_t UL_Data_Block_EGPRS_Header_Type3_t;
typedef UL_Data_Block_EGPRS_Header_t UL_Data_Block_EC_EGPRS_Header_Type1_t;
typedef UL_Data_Block_EGPRS_Header_t UL_Data_Block_EC_EGPRS_Header_Type2_t;
typedef UL_Data_Block_EGPRS_Header_t UL_Data_Block_EC_EGPRS_Header_Type3_t;

typedef struct
{
  uint8_t                       DOWNLINK_TFI;
  uint8_t                       Exist_Wait;
  uint8_t                       WAIT_INDICATION;
  uint8_t                       WAIT_INDICATION_SIZE;
}
EC_Reject_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
  uint8_t                       Reject_Count;
  EC_Reject_t                   Reject[16];
}
EC_Packet_Access_Reject_t;

typedef struct
{
  uint8_t                       EC_MA_NUMBER;
  uint8_t                       TSC;
  uint8_t                       Primary_TSC_Set;
}
EC_Frequency_Parameters_t;

typedef struct {
  uint8_t                       TIMING_ADVANCE_VALUE;
} EC_Packet_Timing_Advance_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
  Global_TFI_t                  Global_TFI;
  uint8_t                       CONTROL_ACK;

  bool                          Exist_Frequency_Parameters;
  EC_Frequency_Parameters_t     Frequency_Parameters;

  uint8_t                       DL_COVERAGE_CLASS;
  uint8_t                       STARTING_DL_TIMESLOT;
  uint8_t                       TIMESLOT_MULTIPLICATOR;
  uint8_t                       DOWNLINK_TFI_ASSIGNMENT;
  uint8_t                       UL_COVERAGE_CLASS;
  uint8_t                       STARTING_UL_TIMESLOT_OFFSET;

  bool                          Exist_EC_Packet_Timing_Advance;
  EC_Packet_Timing_Advance_t    EC_Packet_Timing_Advance;

  bool                          Exist_P0_and_PR_MODE;
  uint8_t                       P0;
  uint8_t                       PR_MODE;

  bool                          Exist_GAMMA;
  uint8_t                       GAMMA;

  uint8_t                       ALPHA_Enable;

}
EC_Packet_Downlink_Assignment_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
  Global_TFI_t                  Global_TFI;
  uint8_t                       TYPE_OF_ACK;
}
EC_Packet_Polling_Req_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
  Global_TFI_t                  Global_TFI;

  bool                          Exist_T_AVG_T;
  uint8_t                       T_AVG_T;

  bool                          Exist_EC_Packet_Timing_Advance;
  EC_Packet_Timing_Advance_t    EC_Packet_Timing_Advance;

  bool                          Exist_GAMMA;
  uint8_t                       GAMMA;
}
EC_Packet_Power_Control_Timing_Advance_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
  Global_TFI_t                  Global_TFI;
  uint8_t                       TBF_RELEASE_CAUSE;

  uint8_t                       Exist_Wait;
  uint8_t                       WAIT_INDICATION;
  uint8_t                       WAIT_INDICATION_SIZE;
}
EC_Packet_Tbf_Release_t;

typedef struct{
  bool                          Exist_DELAY_NEXT_UL_RLC_DATA_BLOCK;
  uint8_t                       DELAY_NEXT_UL_RLC_DATA_BLOCK;
}
FUA_Delay_t;

typedef struct
{
  bool                          Exist_BSN_OFFSET;
  uint8_t                       BSN_OFFSET;
  uint8_t                       START_FIRST_UL_RLC_DATA_BLOCK;
  uint8_t                       Count_FUA_Delay;
  FUA_Delay_t                   FUA_Delay[16]; /* Max RLC window size */
}
PUAN_Fixed_Uplink_Allocation_t;

typedef struct{
  uint8_t                       STARTING_SEQUENCE_NUMBER;
  uint16_t                      RECEIVED_BLOCK_BITMAP;
}
EC_AckNack_Description_t;

typedef struct{
  uint8_t                       STARTING_SEQUENCE_NUMBER;
  uint8_t                       RECEIVED_BLOCK_BITMAP;
}
EC_Primary_AckNack_Description_t;

typedef struct{
  uint32_t                          CONTENTION_RESOLUTION_TLLI;
  EC_Primary_AckNack_Description_t  EC_AckNack_Description;
}
EC_Primary_AckNack_Description_TLLI_t;

typedef struct{
  uint32_t                          CONTENTION_RESOLUTION_rTLLI;
  EC_Primary_AckNack_Description_t  EC_AckNack_Description;
}
EC_Primary_AckNack_Description_rTLLI_t;

typedef struct{
  uint8_t                         EC_AckNack_Description_Type;
  union
  {
    EC_AckNack_Description_t      EC_AckNack_Description;
    EC_Primary_AckNack_Description_TLLI_t  EC_Primary_AckNack_Description_TLLI;
    EC_Primary_AckNack_Description_rTLLI_t EC_Primary_AckNack_Description_rTLLI;
  } u;

  PUAN_Fixed_Uplink_Allocation_t  PUAN_Fixed_Uplink_Allocation;
  uint8_t                       RESEGMENT;

  bool                          Exist_EGPRS_Channel_Coding_Command;
  uint8_t                       EGPRS_Channel_Coding_Command;

  bool                          Exist_CC_TS;
  uint8_t                       UL_COVERAGE_CLASS;
  uint8_t                       STARTING_UL_TIMESLOT;
  uint8_t                       DL_COVERAGE_CLASS;
  uint8_t                       STARTING_DL_TIMESLOT_OFFSET;
  uint8_t                       TIMESLOT_MULTIPLICATOR;
} EC_Packet_Uplink_Ack_Nack_fai0_t;
typedef struct{
  bool                          Exist_CONTENTION_RESOLUTION_TLLI;
  uint32_t                      CONTENTION_RESOLUTION_TLLI;

  bool                          Exist_MONITOR_EC_PACCH;
  uint8_t                       T3238;
  uint8_t                       Initial_Waiting_Time;
  uint8_t                       EC_PACCH_Monitoring_Pattern;

} EC_Packet_Uplink_Ack_Nack_fai1_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
  uint8_t                       UPLINK_TFI;
  uint8_t                       Final_Ack_Indicator;
  union
  {
    EC_Packet_Uplink_Ack_Nack_fai0_t fai0;
    EC_Packet_Uplink_Ack_Nack_fai1_t fai1;
  } u;

  bool                          Exist_EC_Packet_Timing_Advance;
  EC_Packet_Timing_Advance_t    EC_Packet_Timing_Advance;

  bool                          Exist_GAMMA;
  uint8_t                       GAMMA;
  uint8_t                       ALPHA_Enable;
}
EC_Packet_Uplink_Ack_Nack_t;

typedef struct
{
  uint8_t                       START_FIRST_UL_RLC_DATA_BLOCK;
  uint8_t                       Count_FUA_Delay;
  FUA_Delay_t                   FUA_Delay[16]; /* Max RLC window size */
}
Fixed_Uplink_Allocation_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
  Global_TFI_t                  Global_TFI;

  bool                          Exist_UPLINK_TFI_ASSIGNMENT;
  uint8_t                       UPLINK_TFI_ASSIGNMENT;

  bool                          Exist_EGPRS_Channel_Coding_Command;
  uint8_t                       EGPRS_Channel_Coding_Command;

  uint8_t                       Overlaid_CDMA_Code;

  bool                          Exist_EC_Packet_Timing_Advance;
  EC_Packet_Timing_Advance_t    EC_Packet_Timing_Advance;

  bool                          Exist_Frequency_Parameters;
  EC_Frequency_Parameters_t     Frequency_Parameters;

  uint8_t                       UL_COVERAGE_CLASS;
  uint8_t                       STARTING_UL_TIMESLOT;
  uint8_t                       TIMESLOT_MULTIPLICATOR;

  Fixed_Uplink_Allocation_t     Fixed_Uplink_Allocation;

  bool                          Exist_P0_and_PR_MODE;
  uint8_t                       P0;
  uint8_t                       PR_MODE;

  bool                          Exist_GAMMA;
  uint8_t                       GAMMA;
  uint8_t                       ALPHA_Enable;

  uint8_t                       DL_COVERAGE_CLASS;
  uint8_t                       STARTING_DL_TIMESLOT_OFFSET;

}
EC_Packet_Uplink_Assignment_t;

typedef struct
{
  uint8_t                          MESSAGE_TYPE;
  uint8_t                          USED_DL_COVERAGE_CLASS;
  uint8_t                          UPLINK_TFI;
  uint32_t                         CONTENTION_RESOLUTION_TLLI;
  EC_Primary_AckNack_Description_t EC_AckNack_Description;

  Fixed_Uplink_Allocation_t        PUANCR_Fixed_Uplink_Allocation;
  uint8_t                          RESEGMENT;
}
EC_Packet_Uplink_Ack_Nack_And_Contention_Resolution_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       USED_DL_COVERAGE_CLASS;
}
EC_Packet_Downlink_Dummy_Control_Block_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint32_t                      TLLI;
  uint8_t                       CTRL_ACK;
  uint8_t                       DL_CC_EST;
}
EC_Packet_Control_Acknowledgement_t;

typedef struct
{
  uint8_t                       PRIORITY;
  uint8_t                       NUMBER_OF_UL_DATA_BLOCKS;
}
EC_Channel_Request_Description_t;

typedef struct
{
  bool                          Exist_GMSK;
  uint8_t                       GMSK_MEAN_BEP;
  uint8_t                       GMSK_CV_BEP;
  bool                          Exist_8PSK;
  uint8_t                       PSK_MEAN_BEP;
  uint8_t                       PSK_CV_BEP;
  uint8_t                       C_VALUE;
}
EC_Channel_Quality_Report_t;

typedef struct
{
  uint8_t                       MESSAGE_TYPE;
  uint8_t                       DOWNLINK_TFI;
  uint8_t                       MS_OUT_OF_MEMORY;
  uint8_t                       Final_Ack_Indicator;

  EC_AckNack_Description_t      EC_AckNack_Description;

  bool                          Exist_EC_Channel_Quality_Report; /* DL CC EST is also conditional on this */
  EC_Channel_Quality_Report_t   EC_Channel_Quality_Report;
  uint8_t                       DL_CC_EST;

  bool                             Exist_EC_Channel_Request_Description;
  EC_Channel_Request_Description_t EC_Channel_Request_Description;
}
EC_Packet_Downlink_Ack_Nack_t;

/*
< NC Measurement Parameters struct > ::=
                                        < NETWORK_CONTROL_ORDER : bit (2) >
                                        { 0 | 1 < NC_ NON_DRX_PERIOD : bit (3) >
                                        < NC_REPORTING_PERIOD_I : bit (3) >
                                        < NC_REPORTING_PERIOD_T : bit (3) > } ;
< Cell Selection struct > ::=
                             < EXC_ACC : bit >
                             < CELL_BAR_ACCESS_2 : bit (1) >
                             < SAME_RA_AS_SERVING_CELL : bit (1) >
                             { 0 | 1  < GPRS_RXLEV_ACCESS_MIN : bit (6) >
                             < GPRS_MS_TXPWR_MAX_CCH : bit (5) > }
{ 0 | 1 < GPRS_TEMPORARY_OFFSET : bit (3) >
   < GPRS_PENALTY_TIME : bit (5) > }
Table 25 (concluded): PACKET CELL CHANGE ORDER message content
   { 0 | 1  < GPRS_RESELECT_OFFSET : bit (5) > }
{ 0 | 1  < HCS params : < HCS struct > > }
{ 0 | 1 < SI13_PBCCH_LOCATION : < SI13_PBCCH_LOCATION struct > > } ;

< SI13_PBCCH_LOCATION struct > ::=
                                  { 0  < SI13_LOCATION : bit (1) >
                                  | 1  < PBCCH_LOCATION : bit (2) >
                                  < PSI1_REPEAT_PERIOD : bit (4) > } ;

< HCS struct > ::=
                  < GPRS_PRIORITY_CLASS : bit (3) >
                  < GPRS_HCS_THR : bit (5) > ;
*/

/* < Downlink RLC/MAC control message > */
#define MT_PACKET_CELL_CHANGE_ORDER            0x01
#define MT_PACKET_DOWNLINK_ASSIGNMENT          0x02
#define MT_PACKET_MEASUREMENT_ORDER            0x03
#define MT_PACKET_POLLING_REQ                  0x04
#define MT_PACKET_POWER_CONTROL_TIMING_ADVANCE 0x05
#define MT_PACKET_QUEUEING_NOTIFICATION        0x06
#define MT_PACKET_TIMESLOT_RECONFIGURE         0x07
#define MT_PACKET_TBF_RELEASE                  0x08
#define MT_PACKET_UPLINK_ACK_NACK              0x09
#define MT_PACKET_UPLINK_ASSIGNMENT            0x0A
#define MT_PACKET_CELL_CHANGE_CONTINUE         0x0B
#define MT_PACKET_NEIGHBOUR_CELL_DATA          0x0C
#define MT_PACKET_SERVING_CELL_DATA            0x0D
#define MT_PACKET_HANDOVER_COMMAND             0x15
#define MT_PACKET_PHYSICAL_INFORMATION         0x16
#define MT_PACKET_ACCESS_REJECT                0x21
#define MT_PACKET_PAGING_REQUEST               0x22
#define MT_PACKET_PDCH_RELEASE                 0x23
#define MT_PACKET_PRACH_PARAMETERS             0x24
#define MT_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK 0x25
#define MT_PACKET_SYSTEM_INFO_6                0x30
#define MT_PACKET_SYSTEM_INFO_1                0x31
#define MT_PACKET_SYSTEM_INFO_2                0x32
#define MT_PACKET_SYSTEM_INFO_3                0x33
#define MT_PACKET_SYSTEM_INFO_3_BIS            0x34
#define MT_PACKET_SYSTEM_INFO_4                0x35
#define MT_PACKET_SYSTEM_INFO_5                0x36
#define MT_PACKET_SYSTEM_INFO_13               0x37
#define MT_PACKET_SYSTEM_INFO_7                0x38
#define MT_PACKET_SYSTEM_INFO_8                0x39
#define MT_PACKET_SYSTEM_INFO_14               0x3A
#define MT_PACKET_SYSTEM_INFO_3_TER            0x3C
#define MT_PACKET_SYSTEM_INFO_3_QUATER         0x3D
#define MT_PACKET_SYSTEM_INFO_15               0x3E

/* < Uplink RLC/MAC control message > */
#define MT_PACKET_CELL_CHANGE_FAILURE          0x00
#define MT_PACKET_CONTROL_ACK                  0x01
#define MT_PACKET_DOWNLINK_ACK_NACK            0x02
#define MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK   0x03
#define MT_PACKET_MEASUREMENT_REPORT           0x04
#define MT_PACKET_RESOURCE_REQUEST             0x05
#define MT_PACKET_MOBILE_TBF_STATUS            0x06
#define MT_PACKET_PSI_STATUS                   0x07
#define MT_EGPRS_PACKET_DOWNLINK_ACK_NACK      0x08
#define MT_PACKET_PAUSE                        0x09
#define MT_PACKET_ENHANCED_MEASUREMENT_REPORT  0x0A
#define MT_ADDITIONAL_MS_RAC                   0x0B
#define MT_PACKET_CELL_CHANGE_NOTIFICATION     0x0C
#define MT_PACKET_SI_STATUS                    0x0D
#define MT_ENHANCED_MEASUREMENT_REPORT         0x04

/* < Downlink EC-GSM-IoT RLC/MAC control messages > */
#define MT_EC_PACKET_ACCESS_REJECT                               0x11
#define MT_EC_PACKET_DOWNLINK_ASSIGNMENT                         0x01
#define MT_EC_PACKET_POLLING_REQ                                 0x02
#define MT_EC_PACKET_POWER_CONTROL_TIMING_ADVANCE                0x03
#define MT_EC_PACKET_TBF_RELEASE                                 0x04
#define MT_EC_PACKET_UPLINK_ACK_NACK                             0x05
#define MT_EC_PACKET_UPLINK_ASSIGNMENT                           0x06
#define MT_EC_PACKET_UPLINK_ACK_NACK_AND_CONTENTION_RESOLUTION   0x07
#define MT_EC_PACKET_DOWNLINK_DUMMY_CONTROL_BLOCK                0x12

/* < Uplink EC-GSM-IoT RLC/MAC control messages > */
#define MT_EC_PACKET_CONTROL_ACKNOWLEDGEMENT      0x01
#define MT_EC_PACKET_DOWNLINK_ACK_NACK            0x02

typedef enum
{
    RLCMAC_PRACH = 0x20,
    RLCMAC_CS1 = 0x21,
    RLCMAC_CS2 = 0x22,
    RLCMAC_CS3 = 0x23,
    RLCMAC_CS4 = 0x24,
    RLCMAC_HDR_TYPE_1 = 0x31,
    RLCMAC_HDR_TYPE_2 = 0x32,
    RLCMAC_HDR_TYPE_3 = 0x33,
    RLCMAC_HDR_TYPE_4 = 0x34,
    RLCMAC_HDR_TYPE_5 = 0x35,
    RLCMAC_HDR_TYPE_6 = 0x36,
    RLCMAC_HDR_TYPE_7 = 0x37,
    RLCMAC_HDR_TYPE_8 = 0x38,
    RLCMAC_HDR_TYPE_9 = 0x39,
    RLCMAC_HDR_TYPE_10 = 0x3a,
    RLCMAC_EC_CS1 = 0x40,
    RLCMAC_HDR_TYPE_1_EC   = 0x41,
    RLCMAC_HDR_TYPE_2_EC   = 0x42,
    RLCMAC_HDR_TYPE_3_EC   = 0x43
}RLCMAC_block_format_t;

/* < Downlink RLC/MAC control message > */
typedef struct
{
  union
  {
    uint8_t                                  MESSAGE_TYPE;
    DL_Data_Block_GPRS_t                     DL_Data_Block_GPRS;
    DL_Data_Block_EGPRS_Header_t             DL_Data_Block_EGPRS_Header;
    Packet_Access_Reject_t                   Packet_Access_Reject;
    Packet_Cell_Change_Order_t               Packet_Cell_Change_Order;
    Packet_Cell_Change_Continue_t            Packet_Cell_Change_Continue;
    Packet_Downlink_Assignment_t             Packet_Downlink_Assignment;
    Packet_Measurement_Order_t               Packet_Measurement_Order;
    Packet_Neighbour_Cell_Data_t             Packet_Neighbour_Cell_Data;
    Packet_Serving_Cell_Data_t               Packet_Serving_Cell_Data;
    Packet_Paging_Request_t                  Packet_Paging_Request;
    Packet_PDCH_Release_t                    Packet_PDCH_Release;
    Packet_Polling_Request_t                 Packet_Polling_Request;
    Packet_Power_Control_Timing_Advance_t    Packet_Power_Control_Timing_Advance;
    Packet_PRACH_Parameters_t                Packet_PRACH_Parameters;
    Packet_Queueing_Notification_t           Packet_Queueing_Notification;
    Packet_Timeslot_Reconfigure_t            Packet_Timeslot_Reconfigure;
    Packet_TBF_Release_t                     Packet_TBF_Release;
    Packet_Uplink_Ack_Nack_t                 Packet_Uplink_Ack_Nack;
    Packet_Uplink_Assignment_t               Packet_Uplink_Assignment;
    Packet_Handover_Command_t                Packet_Handover_Command;
    Packet_PhysicalInformation_t             Packet_PhysicalInformation;
    Packet_Downlink_Dummy_Control_Block_t    Packet_Downlink_Dummy_Control_Block;
    PSI1_t                                   PSI1;
    PSI2_t                                   PSI2;
    PSI3_t                                   PSI3;
    PSI5_t                                   PSI5;
    PSI13_t                                  PSI13;
    EC_Packet_Access_Reject_t                EC_Packet_Access_Reject;
    EC_Packet_Downlink_Assignment_t          EC_Packet_Downlink_Assignment;
    EC_Packet_Polling_Req_t                  EC_Packet_Polling_Req;
    EC_Packet_Power_Control_Timing_Advance_t EC_Packet_Power_Control_Timing_Advance;
    EC_Packet_Tbf_Release_t                  EC_Packet_Tbf_Release;
    EC_Packet_Uplink_Ack_Nack_t              EC_Packet_Uplink_Ack_Nack;
    EC_Packet_Uplink_Assignment_t            EC_Packet_Uplink_Assignment;
    EC_Packet_Uplink_Ack_Nack_And_Contention_Resolution_t EC_Packet_Uplink_Ack_Nack_And_Contention_Resolution;
    EC_Packet_Downlink_Dummy_Control_Block_t EC_Packet_Downlink_Dummy_Control_Block;
  } u;

  RLCMAC_block_format_t block_format;
  unsigned         flags;
} RlcMacDownlink_t;

typedef int16_t MSGGPRS_Status_t;
/* < Uplink RLC/MAC control message > */
typedef struct
{
  union
  {
    uint8_t MESSAGE_TYPE;
    Packet_Cell_Change_Failure_t          Packet_Cell_Change_Failure;
    Packet_Control_Acknowledgement_t      Packet_Control_Acknowledgement;
    Packet_Downlink_Ack_Nack_t            Packet_Downlink_Ack_Nack;
    Packet_Uplink_Dummy_Control_Block_t   Packet_Uplink_Dummy_Control_Block;
    Packet_Measurement_Report_t           Packet_Measurement_Report;
    Packet_Resource_Request_t             Packet_Resource_Request;
    Packet_Mobile_TBF_Status_t            Packet_Mobile_TBF_Status;
    Packet_PSI_Status_t                   Packet_PSI_Status;
    EGPRS_PD_AckNack_t                    Egprs_Packet_Downlink_Ack_Nack;
    Packet_Pause_t                        Packet_Pause;
    Packet_Enh_Measurement_Report_t       Packet_Enh_Measurement_Report;
    Additional_MS_Rad_Access_Cap_t        Additional_MS_Rad_Access_Cap;
    Packet_Cell_Change_Notification_t     Packet_Cell_Change_Notification;
    Packet_SI_Status_t                    Packet_SI_Status;
    UL_Data_Block_GPRS_t                  UL_Data_Block_GPRS;
    UL_Data_Block_EGPRS_Header_t          UL_Data_Block_EGPRS_Header;
    UL_Packet_Control_Ack_11_t            UL_Packet_Control_Ack_11;
    UL_Packet_Control_Ack_TN_RRBP_11_t    UL_Packet_Control_Ack_TN_RRBP_11;
    UL_Packet_Control_Ack_8_t             UL_Packet_Control_Ack_8;
    UL_Packet_Control_Ack_TN_RRBP_8_t     UL_Packet_Control_Ack_TN_RRBP_8;
    EC_Packet_Control_Acknowledgement_t   EC_Packet_Control_Acknowledgement;
    EC_Packet_Downlink_Ack_Nack_t         EC_Packet_Downlink_Ack_Nack;
  } u;
  RLCMAC_block_format_t block_format;
  unsigned         flags;
} RlcMacUplink_t;

typedef struct
{
   uint16_t bsn1;
   uint16_t bsn2;
   uint8_t pi;
}egprs_ul_header_info_t;

typedef struct
{
   uint16_t bsn1;
   uint16_t bsn2;
}egprs_dl_header_info_t;

typedef struct
{
   unsigned         magic;
   RLCMAC_block_format_t block_format;
   uint8_t          mcs;
   unsigned         frame_number;
#define GSM_RLC_MAC_EGPRS_BLOCK1 0x01
#define GSM_RLC_MAC_EGPRS_BLOCK2 0x02
#define GSM_RLC_MAC_EGPRS_FANR_FLAG 0x08
   unsigned         flags;
   union
   {
      egprs_ul_header_info_t egprs_ul_header_info;
      egprs_dl_header_info_t egprs_dl_header_info;
   }u;
} RlcMacPrivateData_t;


#if 0
void GPRSMSG_Profile(int16_t i);
#endif

/* SI1_RestOctet_t */

typedef struct
{
  bool                Exist_NCH_Position;
  uint8_t             NCH_Position;

  uint8_t             BandIndicator;
} SI1_RestOctet_t;

/* SI3_Rest_Octet_t */
typedef struct
{
  uint8_t CBQ;
  uint8_t CELL_RESELECT_OFFSET;
  uint8_t TEMPORARY_OFFSET;
  uint8_t PENALTY_TIME;
} Selection_Parameters_t;

typedef struct
{
  uint8_t Exist_Selection_Parameters;
  Selection_Parameters_t Selection_Parameters;

  uint8_t Exist_Power_Offset;
  uint8_t Power_Offset;

  uint8_t System_Information_2ter_Indicator;
  uint8_t Early_Classmark_Sending_Control;

  uint8_t Exist_WHERE;
  uint8_t WHERE;

  uint8_t Exist_GPRS_Indicator;
  uint8_t RA_COLOUR;
  uint8_t SI13_POSITION;
  uint8_t ECS_Restriction3G;
  uint8_t ExistSI2quaterIndicator;
  uint8_t SI2quaterIndicator;
} SI3_Rest_Octet_t;

typedef struct
{
  uint8_t Exist_Selection_Parameters;
  Selection_Parameters_t Selection_Parameters;

  uint8_t Exist_Power_Offset;
  uint8_t Power_Offset;

  uint8_t Exist_GPRS_Indicator;
  uint8_t RA_COLOUR;
  uint8_t SI13_POSITION;
} SI4_Rest_Octet_t;

#if 0
typedef SI4_Rest_Octet_t SI7_Rest_Octet_t;
typedef SI4_Rest_Octet_t SI8_Rest_Octet_t;
#endif

/* SI6_RestOctet_t */

typedef struct
{
  uint8_t  PagingChannelRestructuring;
  uint8_t  NLN_SACCH;

  bool Exist_CallPriority;
  uint8_t  CallPriority;

  uint8_t  NLN_Status;
} PCH_and_NCH_Info_t;

typedef struct
{
  bool                Exist_PCH_and_NCH_Info;
  PCH_and_NCH_Info_t PCH_and_NCH_Info;

  bool                Exist_VBS_VGCS_Options;
  uint8_t             VBS_VGCS_Options;

  /* The meaning of Exist_DTM_Support is as follows:
   * false => DTM is not supported in the serving cell, RAC and MAX_LAPDm are absent in bitstream
   * true  => DTM is supported in the serving cell, RAC and MAX_LAPDm are present in bitstream
   */
  bool                Exist_DTM_Support;
  uint8_t             RAC;
  uint8_t             MAX_LAPDm;

  uint8_t             BandIndicator; /* bit(1) L/H, L => ARFCN in 1800 band H => ARFCN in 1900 band */
} SI6_RestOctet_t;

/*************************************************
 * Enhanced Measurement Report. TS 04.18 9.1.55. *
 *************************************************/

typedef struct
{
  uint8_t       DTX_USED;
  uint8_t       RXLEV_VAL;
  uint8_t       RX_QUAL_FULL;
  uint8_t       MEAN_BEP;
  uint8_t       CV_BEP;
  uint8_t       NBR_RCVD_BLOCKS;
} EMR_ServingCell_t;

typedef struct
{
  uint8_t RR_Short_PD;
  uint8_t MESSAGE_TYPE;
  uint8_t ShortLayer2_Header;

  BA_USED_t BA_USED;
  uint8_t BSIC_Seen;

  uint8_t SCALE;

  uint8_t Exist_ServingCellData;
  EMR_ServingCell_t ServingCellData;

  uint8_t Count_RepeatedInvalid_BSIC_Info; /* Number of instances */
  RepeatedInvalid_BSIC_Info_t RepeatedInvalid_BSIC_Info[INV_BSIC_LIST_LEN];

  uint8_t Exist_ReportBitmap;
  uint8_t Count_REPORTING_QUANTITY_Instances; /* Number of instances */
  REPORTING_QUANTITY_Instance_t REPORTING_QUANTITY_Instances[REPORT_QUANTITY_LIST_LEN];

} EnhancedMeasurementReport_t;

extern const uint8_t gsm_rlcmac_gprs_cs_to_block_length[];
extern const uint8_t gsm_rlcmac_egprs_header_type_to_dl_header_block_length[];
extern const uint8_t gsm_rlcmac_egprs_header_type_to_ul_header_block_length[];
extern const uint8_t gsm_rlcmac_egprs_mcs_to_data_block_length[];

#endif /* __PACKET_GSM_RLCMAC_H__ */

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