Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: de9da1382faf6598d5f4741bf3ebab9e20e0364f (plain) (blame)
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
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2000-2019 Ericsson Telecom AB
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v2.0
// which accompanies this distribution, and is available at
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
///////////////////////////////////////////////////////////////////////////////
//
//  File:               NAS_EPS_Types.ttcn
//  Rev:                <RnXnn>
//  Prodnr:             1/CNL 113 862
//  Contact:            http://ttcn.ericsson.se
//  Reference:          3GPP 24.301 v15.2.0 (24.008 v15.3.0, 24.011 v15.1.0, 24.161 v15.0.0 

module NAS_EPS_Types
{

import from General_Types all;


external function enc_PDU_NAS_EPS(in PDU_NAS_EPS pdu) return octetstring
with { extension "prototype(convert)" extension "encode(RAW)" }

external function dec_PDU_NAS_EPS(in octetstring stream) return PDU_NAS_EPS
with { extension "prototype(convert)" extension "decode(RAW)" }

external function dec_PDU_NAS_EPS_backtrack(in octetstring stream, out PDU_NAS_EPS pdu) return integer
with { extension "prototype(backtrack) decode(RAW)" }

external function enc_EPS_MobileIdentityV_NAS_EPS(in EPS_MobileIdentityV ePS_mobileIdentityV) return octetstring
with { extension "prototype(convert)" extension "encode(RAW)" }

external function dec_EPS_MobileIdentityV_NAS_EPS(in octetstring ePS_mobileIdentityV_oct) return EPS_MobileIdentityV
with { extension "prototype(convert)" extension "decode(RAW)" }

external function dec_EPS_MobileIdentityV_NAS_EPS_backtrack(in octetstring ePS_mobileIdentityV_oct, out EPS_MobileIdentityV ePS_mobileIdentityV) return integer
with { extension "prototype(backtrack) decode(RAW)" }

external function enc_IMSI_NAS_EPS(in IMSI imsi) return octetstring
with { extension "prototype(convert)" extension "encode(RAW)" }

external function dec_IMSI_NAS_EPS(in octetstring imsi_oct) return IMSI
with { extension "prototype(convert)" extension "decode(RAW)" }

external function dec_IMSI_NAS_EPS_backtrack(in octetstring imsi_oct, out IMSI imsi) return integer
with { extension "prototype(backtrack) decode(RAW)" }

external function enc_GUTI_NAS_EPS(in GUTI guti) return octetstring
with { extension "prototype(convert)" extension "encode(RAW)" }

external function dec_GUTI_NAS_EPS(in octetstring guti_oct) return GUTI
with { extension "prototype(convert)" extension "decode(RAW)" }

external function dec_GUTI_NAS_EPS_backtrack(in octetstring guti_oct, out GUTI guti) return integer
with { extension "prototype(backtrack) decode(RAW)" }

external function enc_IMEI_NAS_EPS(in IMEI imei) return octetstring
with { extension "prototype(convert)" extension "encode(RAW)" }

external function dec_IMEI_NAS_EPS(in octetstring imei_oct) return IMEI
with { extension "prototype(convert)" extension "decode(RAW)" }

external function dec_IMEI_NAS_EPS_backtrack(in octetstring imei_oct, out IMEI imei) return integer
with { extension "prototype(backtrack) decode(RAW)" }

//==================================
// Common Information Elements
//==================================

// 9.9.2.0
type record AdditionalInformationTLV
{
  OCT1              elementIdentifier,
  LIN1              lengthIndicator,
  octetstring       additionalInformation_Value
} with {
  variant "PRESENCE (elementIdentifier = '65'O)"
  variant (lengthIndicator) "LENGTHTO (additionalInformation_Value)" 
}

// 9.9.2.0A  10.5.7.8/24.008
type record DevicePropertiesTV
{
  BIT1             lowPriority,
  BIT3             spare,
  BIT4             elementIdentifier
}

// 9.9.2.1
type record EPS_BearerContextStatusTLV
{
  OCT1              elementIdentifier,
  LIN1              lengthIndicator,
  BIT1              ebi0,
  BIT1              ebi1,
  BIT1              ebi2,
  BIT1              ebi3,
  BIT1              ebi4,
  BIT1              ebi5,
  BIT1              ebi6,
  BIT1              ebi7,
  BIT1              ebi8,
  BIT1              ebi9,
  BIT1              ebi10,
  BIT1              ebi11,
  BIT1              ebi12,
  BIT1              ebi13,
  BIT1              ebi14,
  BIT1              ebi15
} with { 
  variant (lengthIndicator) "LENGTHTO (ebi0,ebi1,ebi2,ebi3,ebi4,ebi5,ebi6,ebi7,ebi8,ebi9,ebi10,ebi11,ebi12,ebi13,ebi14,ebi15)"  
  variant "PRESENCE (elementIdentifier = '57'O )" 
}

// 9.9.2.2 - 10.5.1.3/24.008  

type record LocationAreaIdentificationV {
  OCT3  mcc_mnc,
  OCT2  lac
} 

type record LocationAreaIdentificationTV {
  OCT1  elementIdentifier,
  OCT3  mcc_mnc, 
  OCT2  lac
} with {
  variant "PRESENCE (elementIdentifier = '13'O)"
}

// 9.9.2.3 - 10.5.1.4/24.008

type record MobileIdentityTLV
{
  BIT7              elementIdentifier,
  BIT1              spare1,
  MobileIdentityLV  mobileIdentityLV
} with {
  variant "PRESENCE (elementIdentifier = '0100011'B)"
}

type record MobileIdentityLV
{
  LIN1             lengthIndicator,
  MobileIdentityV  mobileIdentityV
} with { 
  variant (lengthIndicator) "LENGTHTO (mobileIdentityV)"  
}

type record MobileIdentityV
{
  BIT3                         typeOfIdentity,
  OddEvenInd_Identity          oddEvenInd_identity
} with {
  variant (oddEvenInd_identity) "CROSSTAG(
  imsi,                     typeOfIdentity ='001'B;
  imei,                     typeOfIdentity ='010'B;
  imei_sv,                  typeOfIdentity ='011'B;
  tmsi_ptmsi_mtmsi,         typeOfIdentity ='100'B;
  tmgi_and_mbms_sessionID,  typeOfIdentity ='101'B;
  no_identity,              typeOfIdentity ='000'B;
 )"
}

type union OddEvenInd_Identity
{
  IMSI                     imsi,  
  IMEI                     imei,    
  IMEI_SV                  imei_sv,
  TMSI_PTMSI_MTMSI         tmsi_ptmsi_mtmsi,
  TMGI_and_MBMS_SessionID  tmgi_and_mbms_sessionID,
  No_Identity              no_identity
}

type record IMSI
{
  BIT1               oddevenIndicator,       
  hexstring          digits,
  BIT4               fillerDigit  optional   // filler '1111'B 
} with {
  variant (fillerDigit) "PRESENCE (oddevenIndicator   = '0'B) "
}

type record IMEI
{
  BIT1               oddevenIndicator,   
  hexstring          digits,   
  BIT4               fillerDigit  optional   // filler '1111'B  
} with {
  variant (fillerDigit) "PRESENCE (oddevenIndicator   = '0'B) "
}

type record IMEI_SV
{
  BIT1               oddevenIndicator,  
  hexstring          digits,
  BIT4               fillerDigit  optional   // filler '1111'B
} with {
  variant (fillerDigit) "PRESENCE (oddevenIndicator   = '0'B) "
}

type record TMSI_PTMSI_MTMSI
{
  BIT1               oddevenIndicator,  
  BIT4               fillerDigit,   // filler '1111'B
  hexstring          digits
} with {
  variant (fillerDigit) "PRESENCE (oddevenIndicator   = '0'B) ";
  variant (digits) "HEXORDER(high)"  
}

type record TMGI_and_MBMS_SessionID
{
  BIT1               oddevenIndicator,
  BIT1               mccMncIndicator,
  BIT1               sessIdIndicator,
  BIT2               spare,  // '00'B
  OCT3               mBMSServiceID,
  HEX1               mccDigit1 optional,
  HEX1               mccDigit2 optional,  
  HEX1               mccDigit3 optional,  
  HEX1               mncDigit3 optional,   
  HEX1               mncDigit1 optional,
  HEX1               mncDigit2 optional,   
  OCT1               mBMSSessionIdentity optional
} with {
  variant (mccDigit1) "PRESENCE (mccMncIndicator   = '1'B)";
  variant (mccDigit2) "PRESENCE (mccMncIndicator   = '1'B)";
  variant (mccDigit3) "PRESENCE (mccMncIndicator   = '1'B)";
  variant (mncDigit3) "PRESENCE (mccMncIndicator   = '1'B)";
  variant (mncDigit2) "PRESENCE (mccMncIndicator   = '1'B)";
  variant (mncDigit1) "PRESENCE (mccMncIndicator   = '1'B)";
  variant (mBMSSessionIdentity) "PRESENCE (sessIdIndicator   = '1'B)";
}

type record No_Identity
{
  BIT1               oddevenIndicator,
  hexstring          fillerDigits
};

// 9.9.2.4 - 10.5.1.6/24.008
//24.008/ 10.5.1.6 , 4th octet:
type record MobileStationClassmark2_oct4 {
  BIT1  fc, // '0'B no MS support of E/R_GSM
  // '1'B      MS support of E/R_GSM
////BIT2  spare1_2, // '00'B
  BIT1  vgcs,//'0'B no VGCS capability
  //'1'B  VGCS capability and notifications wanted
  BIT1  vbs, //'0'B no VBS capability, 
  //  '1'B VBS capability and notifications wanted
  BIT1  sm_Capability, // '0'B SM capbility present  not
  // '1'B SM capbility        present
  BIT2 ss_ScreenIndicator,
  // '00'B default value of phase1 (GSM+DCS) reserved or (PCS)
  // '01'B capability of notation  ellipsis
  // '10'B for future use
  // '11'B for use  future
  BIT1  ps_Capability, // 'x'B  ignored, received  if
  BIT1  spare2_1   // '0'B
} with { variant "" };


//24.008/ 10.5.1.6 5th octet ( Table 10.5.6a ):
type record MobileStationClassmark2_oct5 {
  BIT1  a5_2,     // '0'B encryption algorithm A5/2 available not(0)
                  // '1'B encryption algorithm A5/available  2   (1)
  BIT1  a5_3,     // '0'B encryption algorithm A5/3 available not(0)
                  // '1'B encryption algorithm A5/available  3   (1)
  //BIT5  spare3_5, //   '00000'B 
  BIT1  cmsp,
  BIT1  solsa,
  BIT1  ucs2,
  BIT1  lcsva_cap,
  BIT1  spare5_7,
  BIT1  cm3       // '0'B  no additional capability info
  // '1'B The MS supports options that are indicated in classmark 3 IE
  //      (additional info  capability)
} with { variant "" };


//24.008/ 10.5.1.6
type record MobileStationClassmark2_TLV {
  OCT1  elementIdentifier,
  LIN1  lengthIndicator, // '01'O..'03'O
  BIT3  rf_PowerCapability, //        '000'B class1 (for GSM+DCS+PCS)
  //        '001'B class2 (for GSM+DCS+PCS)
  //        '010'B class3 (for GSM+DCS+PCS)
  //        '011'class4  B  (only for GSM)
  //        '100'class5  B  (only for GSM)
  BIT1  a5_1, // '0'B encryption algorithm A5/1 available (0)
  // '1'B encryption algorithm A5/1 not available  1  (1)
  BIT1  esind,
  // '0'B controlled early classmark sending option implemented not (0)
  // '1'B controlled early classmark sending implemented option (1)
  BIT2  revisionLevel, //   '00'B reserved for phase1 (GSM+DCS)
  //   '00'B reserved for GSM phase 1 (PCS)
  //   '01'B used by phase2 MSs  (GSM+DCS)
  //   '01'B used by PCS1900 MSs  phase1  (PCS)
  //   '10'B used by  MSs  R99  supporting
  //   '11'B reserved for future use
  BIT1  spare1_1, // '0'B
  MobileStationClassmark2_oct4  mobileStationClassmark2_oct4    optional,
  MobileStationClassmark2_oct5  mobileStationClassmark2_oct5    optional
} with { 
  variant "PRESENCE (elementIdentifier = '11'O)"
  variant (lengthIndicator) "LENGTHTO (rf_PowerCapability, a5_1, esind,
                                             revisionLevel, spare1_1,
                                             mobileStationClassmark2_oct4,
                                             mobileStationClassmark2_oct5)"};


// 9.9.2.5 - 10.5.1.7/24.008
type record MobileStationClassmark3_TLV {
  OCT1  elementIdentifier,
  LIN1  lengthIndicator,
  OCTN  valuePart
} with { 
  variant "PRESENCE (elementIdentifier = '20'O)"
  variant (lengthIndicator) "LENGTHTO (valuePart)"};


// 9.9.2.6
type record NASSecurityParFromEUTRAN_TV{
  OCT1  elementIdentifier,
  BIT4  DL_NAS_count_value,
  BIT4  spare
} //with { 
//  variant "PRESENCE (elementIdentifier = '20'O)"
//};


// 9.9.2.7
type record NASSecurityParToEUTRAN_TV{
  OCT1  elementIdentifier,
  OCT4  nonceMME_value,
  BIT3  typeof_IP_algorithm,
  BIT1  spare,
  BIT3  typeof_ciphering_algorithm,
  BIT1  spare2,
  BIT3  NAS_key_ID,
  BIT1  tSC,
  BIT4  spare3
} // with { 
//  variant "PRESENCE (elementIdentifier = '20'O)"
//};

// 9.9.2.8 - 10.5.1.13/24.008
type record PLMN_ListTLV
{
  OCT1         elementIdentifier,
  LIN1         lengthIndicator,
  MCC_MNC_List mcc_mnc length(1..15)
} with {
  variant (lengthIndicator) "LENGTHTO (mcc_mnc)"
  variant "PRESENCE (elementIdentifier = '4A'O)"
}

type record of OCT3 MCC_MNC_List;

// 9.9.2.9
// implemented as BIT4

// 9.9.2.10 - 10.5.4.32/24.008
type record codec{
  OCT1  systemIdentification1,
  INT1  lengthOfBitmap1,
  OCT1  codecBitmap1_bits1to8,
  OCT1  codecBitmap1_bits9to16 optional,
  octetstring additional_codecs optional
} with { variant (lengthOfBitmap1) "LENGTHTO(codecBitmap1_bits1to8, codecBitmap1_bits9to16, additional_codecs)"; 
};

type record of codec CodecList_ML3 with { variant "" }; 

type record SupportedCodecListTLV {
  OCT1            elementIdentifier,
  LIN1            lengthIndicator, //  
  CodecList_ML3   codecList 
} with { 
  variant "PRESENCE (elementIdentifier = '40'O)"
  variant (lengthIndicator) "LENGTHTO( codecList )"};

//==================================================================
// EPS Mobility Management (EMM) information elements - 9.9.3/24.301
//==================================================================

// 9.9.3.0A
type record AdditionalUpdateResultTV
{
  BIT2      additionalUpdateResultValue,  // "CS Fallback not preferred" is never given as CS Fallback is not supported
  BIT2      spare,
  BIT4      elementIdentifier 
} with{
  variant "PRESENCE (elementIdentifier = '1111'B)"
}

// 9.9.3.0B
type record AdditionalUpdateTypeTV
{
  BIT1      aUTV,
  BIT1      SAF,
  BIT2      pNB_CIoT,
  BIT4      elementIdentifier  
} with{
  variant "PRESENCE (elementIdentifier = '1111'B)"
}

// 9.9.3.1 - 10.5.3.2.2/24.008
type record AuthenticationFailureParameterTLV
{
  OCT1     elementIdentifier,
  LIN1     lengthIndicator,
  OCT14    authenticationFailureParameter
} with{
  variant "PRESENCE (elementIdentifier = '30'O)"
  variant (lengthIndicator) "LENGTHTO (authenticationFailureParameter)"  
}

// 9.9.3.2 - 10.5.3.1.1/24.008
type record AuthenticationParameterAUTNLV
{
  LIN1        lengthIndicator,
  OCT16       aUTN
} with {
  variant (lengthIndicator) "LENGTHTO (aUTN)"  
}

// 9.9.3.3 - 10.5.3.1/24.008
type record AuthenticationParameterRANDV
{
  OCT16       rAND
}

// 9.9.3.4
type record AuthenticationResponseParameterLV
{
  LIN1              lengthIndicator,
  AuthenticationResponseParameterV authenticationResponseParameter
} with {
  variant (lengthIndicator) "LENGTHTO (authenticationResponseParameter)"  
}

type record AuthenticationResponseParameterV
{
  octetstring       rES length (4..16)
}

// 9.9.3.4A - 10.5.1.2/24.008
type record CipheringKeySequenceNumberTV
{
  CipheringKeySequenceNumberV  keySequence,
  BIT4                         elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1000'B)"; };


type record CipheringKeySequenceNumberV
{
  BIT3               keySequence,
  BIT1               spare
};

// 9.9.3.4B
type record SMS_ServiceStatusTV
{
  BIT3             sMS_ServiceStatusValue,
  BIT1             spare,
  BIT4             elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1110'B)"; };


// 9.9.3.5
type record CSFB_ResponseTV
{
 BIT3             cSFB_ResponseValue,
 BIT1             spare,
 BIT4             elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1011'B)"; };

// 9.9.3.6 - 10.5.3.12/24.008
type record DaylightSavingTimeTLV
{
  OCT1                        elementIdentifier,
  DaylightSavingTimeLV        daylightSavingTimeLV

} with { variant "PRESENCE (elementIdentifier = '49'O)"; };

type record DaylightSavingTimeLV
{
  LIN1                         lengthIndicator,
  DaylightSavingTimeV          daylightSavingTimeV
} with {
  variant (lengthIndicator) "LENGTHTO (daylightSavingTimeV)" 
}

type record DaylightSavingTimeV 
{
  BIT2               valueField,
  BIT6               spare     // Shall be set to 000000
}

// 9.9.3.7
// type record DetachTypeTV 
// {
//   DetachTypeV detachType,
//   BIT4 elementIdentifier
// } with {
//   variant "PRESENCE (elementIdentifier = '?? 'O)"
// }

type record DetachTypeV
{
  BIT3     typeofDetach,
  BIT1     switchOff
}

// 9.9.3.8 - 10.5.5.6/24.008
type record DRXParameterTV
{
  OCT1               elementIdentifier,
  DRXParameterV      drxParameter
} with { variant "PRESENCE (elementIdentifier = '5C'O)"; };

type record DRXParameterV
{
  OCT1               splitPGCycleCode,
  BIT3               nonDRXTimer,
  BIT1               splitOnCCCH,
  BIT4               cnSpecificDRXCycleLength
}

// 9.9.3.9
type record EMM_CauseTV
{
  OCT1        elementIdentifier,
  EMM_CauseV  causeValue
} with {
  variant "PRESENCE (elementIdentifier = '53'O)"
}

type record EMM_CauseV
{
  OCT1        causeValue
}

// 9.9.3.10
type record EPS_AttachResultV
{
  BIT3     valueOfAttachResult,
  BIT1     spare
}

// EPS_AttachResultTV -- not used

// 9.9.3.11
type record EPS_AttachTypeV
{
  BIT3     typeOfAttach,
  BIT1     spare
} 

// EPS_AttachTypeTV -- not used

// 9.9.3.12
type record EPS_MobileIdentityTLV
{
  OCT1                         elementIdentifier,
  EPS_MobileIdentityLV         ePS_MobileIdentity
} with {
  variant "PRESENCE (elementIdentifier = '50'O; )" 
}

type record EPS_MobileIdentityLV
{
  LIN1                         lengthIndicator,
  EPS_MobileIdentityV          ePS_MobileIdentity
} with {
  variant (lengthIndicator) "LENGTHTO (ePS_MobileIdentity)"
}

type record EPS_MobileIdentityV 
{
  BIT3                         typeOfIdentity,
  OddEvenInd_Identity_EPS      oddEvenInd_identity
} with {
  variant (oddEvenInd_identity) "CROSSTAG(
  imsi,                     typeOfIdentity ='001'B;
  guti,                     typeOfIdentity ='110'B;
  imei,                     typeOfIdentity ='011'B;
  )"
}

type union OddEvenInd_Identity_EPS
{
  IMSI  imsi,
  GUTI  guti,
  IMEI  imei       
}

type record GUTI
{
  BIT1               oddevenIndicator, 
  BIT4               spare,  // '1111'B
  HEX1               mccDigit1,
  HEX1               mccDigit2,
  HEX1               mccDigit3,
  HEX1               mncDigit3,
  HEX1               mncDigit1,
  HEX1               mncDigit2,
  OCT2               mMEGI,
  OCT1               mMEC,
  OCT4               mTMSI
}

// 9.9.3.12A
type record EPS_NetworkFeatureSupportTLV 
{
  OCT1     elementIdentifier,
  LIN1     lengthIndicator,
  BIT1     iMS_VoPS,
  BIT1     eMCBS,
  BIT1     ePC_LCS,
  BIT2     cS_LCS,
  BIT1     eSR_PS, 
  BIT1     eRwoPDN,
  BIT1     cP_CIoT,
  BIT1     uP_CIoT optional, 
  BIT1     s1_UData optional,
  BIT1     hC_CP_CIoT optional,
  BIT1     ePCO optional,
  BIT1     restrictEC optional,
  BIT1     restrictDCNR optional,
  BIT1     n26OInd optional,
  BIT1     spare optional
} with{
  variant "PRESENCE (elementIdentifier = '64'O)"
  variant (lengthIndicator) "LENGTHTO (iMS_VoPS, eMCBS, ePC_LCS, cS_LCS, eSR_PS, eRwoPDN, cP_CIoT,uP_CIoT,
                                       s1_UData, hC_CP_CIoT, ePCO, restrictEC, restrictDCNR, n26OInd, spare)"  
}

// 9.9.3.13
type record EPS_UpdateResultV
{
  BIT3         valueOfUpdateResult, // set to "TA updated" or "combined TA/LA updated"
  BIT1         spare
}

// 9.9.3.14
type record EPS_UpdateTypeV 
{
  BIT3         typeOfUpdate,
  BIT1         activeFlag  
}

// 9.9.3.15
type record ESM_MessageContainerTLVE
{
  OCT1                      elementIdentifier,
  ESM_MessageContainerLVE   eSM_MessageContainer
} with {
  variant "PRESENCE (elementIdentifier = '78'O)"
}

type record ESM_MessageContainerLVE
{
  LIN2_BO_LAST      lengthIndicator,
  octetstring       content length (1..65535)
} with { 
  variant (lengthIndicator) "LENGTHTO (content)"
}

// 9.9.3.16 - 10.5.7.3/24.008
type record GPRSTimerTV
{
  OCT1        elementIdentifier,   // different values in different PDUs
  GPRSTimerV  gprsTimer
} 

type record GPRSTimerV
{
  BIT5     timerValue,
  BIT3     unit
}

// 9.9.3.16a  10.5.7.4/24.008
type record GPRSTimer2TLV 
{
 OCT1          elementIdentifier,
 LIN1          lengthIndicator,
 GPRSTimer2V   gprsTimer2
} with { 
  variant (lengthIndicator) "LENGTHTO (gprsTimer2)"
}

type record GPRSTimer2V
{
  BIT5     timerValue,
  BIT3     unit
}

// 9.9.3.16b 10.5.7.4a/24.008
type record GPRSTimer3TLV
{
 OCT1          elementIdentifier,
 LIN1          lengthIndicator, 
 GPRSTimer3V   gprsTimer3
} with { 
  variant (lengthIndicator) "LENGTHTO (gprsTimer3)"
}

type record GPRSTimer3V
{
  BIT5     timerValue,
  BIT3     unit
}

// 9.9.3.17 - 10.5.5.9/24.008
type record IdentityType2V
{
  BIT3         typeOfIdentity,
  BIT1         spare  //'0'B
}

// 9.9.3.18 - 10.5.5.10/24.008
type record IMEISV_RequestTV
{ 
  IMEISV_RequestV   iMEISV_Request,
  BIT4              elementIdentifier
} with {
  variant "PRESENCE (elementIdentifier = '1100'B)"
} 

type record IMEISV_RequestV
{
  BIT3         valueOfRequest,
  BIT1         spare  //'0'B
}

//9.9.3.19
type record KSIandSequenceNumberV
{
  BIT5              sequenceNumber,
  BIT3              kSI
}

// 9.9.3.20 - 10.5.5.12/24.008
type record  MSNetworkCapabilityTLV
{
  OCT1                         elementIdentifier,
  MSNetworkCapabilityLV        mSNetworkCapabilityLV
} with { 
  variant "PRESENCE (elementIdentifier = '31'O)" 
};


type record MSNetworkCapabilityLV
{
  LIN1                         lengthIndicator,
  MSNetworkCapabilityV         msNetworkCapabilityV
} with { variant (lengthIndicator) "LENGTHTO (msNetworkCapabilityV)";
  variant (msNetworkCapabilityV)    "PADDING(yes)"
};


type record MSNetworkCapabilityV    //length 3-10 octets
{
  BIT1               gea1bit,
  BIT1               smCapabilitiesviaDedicatedChannels,
  BIT1               smCapabilitiesviaGPRSChannels,
  BIT1               ucs2Support,
  BIT2               ssScreeningIndicator,
  BIT1               solSACapability            optional, //spare in V97
  BIT1               revisionLevelIndicatior    optional, //spare in V97
  BIT1               pFCFeatureMode             optional, //spare in V97(opt)
  BIT6               extendedGEAbits            optional, //spare in V97(opt)
  BIT1               lcsVAcapability            optional, //spare in V97(opt)
  BIT1               pSInterRATHOtoUTRANIuModeCapability optional,
  BIT1               pSInterRATHOtoEUTRANS1ModeCapability optional,//18
  BIT1               eMMCombinedProceduresCapability optional,
  BIT1               iSRSupport                  optional,
  BIT1               sRVCCtoGERANUTRANCapability optional,
  BIT1               epcCapability               optional, //22
  BIT1               nFCapability                optional,
  BIT1               gERANNwSharingCapability    optional,
  BIT1               userPlaneIntegrityProtectionSupport  optional,
  BIT1               gIA4                        optional,
  BIT1               gIA5                        optional,
  BIT1               gIA6                        optional,
  BIT1               gIA7                        optional, //29
  BIT1               ePCOIEIndicator             optional,
  BIT1               restrictionOnUseOfEnhancedCoverageCapability optional,
  BIT1               dualConnectivityOfEUTRANwithNRCapability optional,
  octetstring        spare_octets length(0..6)   optional
} with { variant "FIELDORDER(msb)" };

//9.9.3.20a  10.5.1.15/24.008
type record MS_NetworkFeatureSupportTV
{
  BIT1          extendedPeriodicTimers,
  BIT3          spare,
  BIT4          elementIdentifier
}

// 9.9.3.21
type record NAS_KeySetIdentifierTV
{
  NAS_KeySetIdentifierV     nAS_KeySetIdentifiervalue,
  BIT4                      elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1011'B)"; }

type record NAS_KeySetIdentifierV
{
  BIT3         identifier,
  BIT1         tSC  // set to "native security context (for KSIASME)" is supported
                    // set to "mapped security context (for KSISGSN)" is ignored if received
}

// 9.9.3.22
type record NAS_MessageContainerTLV
{
  OCT1                   elementIdentifier,
  NAS_MessageContainerLV nAS_MessageContainerLV
}

type record NAS_MessageContainerLV
{
  LIN1                      lengthIndicator,
  NAS_MessageList           nAS_MessageContainerV
} with {
  variant (lengthIndicator) "LENGTHTO (nAS_MessageContainerV)"  
}
//     7.2/24.011
type union NAS_MessageList
{
  CP_DATA   cP_DATA,
  CP_ACK    cP_ACK,
  CP_ERROR  cP_ERROR
} with {
  variant  "TAG
  (
   cP_DATA,   messageType = '01'O;
   cP_ACK,    messageType = '04'O;
   cP_ERROR,  messageType = '10'O;
  )"
}

type record CP_DATA
{
  BIT4  protocolDiscriminator,
  BIT4  transactionID,
  OCT1  messageType,
  CP_UserDataLV cp_UserDataLV
}

type record CP_UserDataLV
{
  LIN1          lengthIndicator,
  octetstring   rPDU length (0..248)
} with {
  variant (lengthIndicator) "LENGTHTO (rPDU)"  
}

type record CP_ACK
{
  BIT4  protocolDiscriminator,
  BIT4  transactionID,
  OCT1  messageType
}

type record CP_ERROR
{
  BIT4  protocolDiscriminator,
  BIT4  transactionID,
  OCT1  messageType,
  OCT1  cP_Cause
}

// 9.9.3.23
type record NAS_SecurityAlgorithmsV
{
  BIT3         typeOfIntegrityProtection, //EIA1 is supported
  BIT1         spare1,
  BIT3         typeOfCiphering, //EEA1 and EEA0 are supported
  BIT1         spare2
} with { variant "" }

// 9.9.3.24 - 10.5.3.5a/24.008
type record NetworkNameTLV
{
  OCT1                      elementIdentifier,
  NetworkNameLV             networkNameLV
} 

type record NetworkNameLV
{
  LIN1            lengthIndicator,
  NetworkNameV    networkNameV
} with {
  variant (lengthIndicator) "LENGTHTO (networkNameV)"
}

type record NetworkNameV
{
  BIT3               nSpareBits,
  BIT1               addCI,
  BIT3               codingScheme,
  BIT1               ext1, //'1'B
  octetstring        textString
  // actually the upper limit depends on the max size of the PDU, see 44.006
};

// 9.9.3.24A - 10.5.5.31/24.008
type record NetworkResourceIdentifierContainerTLV
{
  OCT1            elementIdentifier,
  NetworkResourceIdentifierContainerLV networkResourceIdentifierContainerLV
} with { variant "PRESENCE (elementIdentifier = '10'O)"; }

type record NetworkResourceIdentifierContainerLV
{
  LIN1            lengthIndicator,
  NetworkResourceIdentifierContainerV networkResourceIdentifierContainerV
} with {
  variant (lengthIndicator) "LENGTHTO (networkResourceIdentifierContainerV)"
}

type record NetworkResourceIdentifierContainerV
{
  BIT10       nRIContainerValue,
  BIT6        spare
} with {
  variant (nRIContainerValue) "BITORDER(msb)";
  variant (nRIContainerValue,spare) "FIELDORDER(msb)"
}

// 9.9.3.25
type record NonceTV
{
  OCT1            elementIdentifier,
  OCT4            noncevalue 
} // with { variant "PRESENCE (elementIdentifier = '55'O)"; }  

// 9.9.3.25A
type record PagingIdentityTV {
  OCT1            elementIdentifier,
  PagingIdentityV pagingIdentityValue
} 

type record PagingIdentityV {
  BIT1           pagingIdentityValue,
  BIT7           spare
}

// 9.9.3.26 - 10.5.5.8/24.008
type record P_TMSISignatureTV
{
  OCT1               elementIdentifier,
  OCT3               valueField
} with { variant "PRESENCE (elementIdentifier = '19'O)"; }

// 9.9.3.26A
type record ExtendedEMM_CauseTV
{
  BIT1               eUTRANallowedValue,
  BIT1               ePSoptimizationInfo,
  BIT2               spare,
  BIT4               elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1010'B)"; }

// 9.9.3.27
// represented as BIT4 in message

// 9.9.3.28 
type record ShortMACTV //not used
{
  OCT1              elementIdentifier,
  ShortMACV         shortMAC
} with {
  variant "PRESENCE (elementIdentifier = '00'O)" //??
}

type record ShortMACV //used
{
  OCT2               valueOfShortMAC
} 

// 9.9.3.29 - 10.5.3.8/24.008 
type record TimeZoneTV
{
  OCT1 elementIdentifier,
  OCT1 valueOfTimeZone
} with {
  variant "PRESENCE (elementIdentifier = '46'O)" //??
}


// 9.9.3.30 - 10.5.3.9/24.008 
type record TimeZoneAndTimeTV
{
  OCT1                  elementIdentifier,
  TimeZoneAndTimeV      timeZoneAndTimeV
} with {
  variant "PRESENCE (elementIdentifier = '47'O)" 
}

type record TimeZoneAndTimeV
{
  OCT1               year,
  OCT1               month,
  OCT1               day,
  OCT1               hour,
  OCT1               minute,
  OCT1               second,
  OCT1               timeZone
};

// 9.9.3.31 - 10.5.5.4/24.008 
type record TMSIStatusTV
{
  TMSIStatusV        tmsiStatusV,
  BIT4               elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1001'B)" };

type record TMSIStatusV
{
  BIT1               tmsiFlag,
  BIT3               spare // '000'B
};

// 9.9.3.32
type record TrackingAreaIdentityTV
{
  OCT1               elementIdentifier,
  HEX1               mccDigit1,
  HEX1               mccDigit2,
  HEX1               mccDigit3,
  HEX1               mncDigit3,
  HEX1               mncDigit1,
  HEX1               mncDigit2,
  OCT2               tAC
} with {
  variant "PRESENCE (elementIdentifier = '52'O)"
}

// 9.9.3.33
type record TrackingAreaIdentityListTLV
{
  OCT1                            elementIdentifier,
  TrackingAreaIdentityListLV      trackingAreaIdentityListsLV
} with {
  variant "PRESENCE (elementIdentifier = '54'O)"
} 

type record TrackingAreaIdentityListLV
{
  LIN1         lengthIndicator,
  TAI_Lists    trackingAreaIdentityLists
} with {
  variant (lengthIndicator) "LENGTHTO (trackingAreaIdentityLists)"
}

type record of TAI_List TAI_Lists; 

type union TAI_List {
  TAI_List000  list00,
  TAI_List001  list01,
  TAI_List010  list10     
} with {
  variant  "TAG
  (
   list00,   typeOfList = '00'B; 
   list01,   typeOfList = '01'B;
   list10,   typeOfList = '10'B;
  )"
} //only 00 is supported

type record TAI_List000
{
  integer     nrOfElements,
  BIT2        typeOfList,
  BIT1        spare,  //0
  HEX1        mccDigit1,
  HEX1        mccDigit2,
  HEX1        mccDigit3,
  HEX1        mncDigit3,
  HEX1        mncDigit1,
  HEX1        mncDigit2,
  OCT2        tAC1,
  TAC_List    additional_TACs optional    
} with {
  variant (nrOfElements) "FIELDLENGTH(5)";
  variant (nrOfElements) "LENGTHTO (additional_TACs)";
  variant (nrOfElements) "UNIT (elements)";
};

type record of OCT2 TAC_List;

type record TAI_List001
{
  integer     nrOfElements, //0
  BIT2        typeOfList,
  BIT1        spare,  //0
  HEX1        mccDigit1,
  HEX1        mccDigit2,
  HEX1        mccDigit3,
  HEX1        mncDigit3,
  HEX1        mncDigit1,
  HEX1        mncDigit2,  
  OCT2        tAC1  
} with {
  variant (nrOfElements) "FIELDLENGTH(5)"     
}

type record TAI_List010
{
  integer           nrOfElements,
  BIT2              typeOfList,
  BIT1              spare,  //0
  MCC_MNC_TAC       mCC_MNC_TAC1,     
  MCC_MNC_TAC_List  additional_MCC_MNC_TACs optional
} with {
  variant (nrOfElements) "FIELDLENGTH(5)";
  variant (nrOfElements) "LENGTHTO (additional_MCC_MNC_TACs)";
  variant (nrOfElements) "UNIT (elements)"
}

type record of MCC_MNC_TAC MCC_MNC_TAC_List;

type record MCC_MNC_TAC
{
  HEX1        mccDigit1,
  HEX1        mccDigit2,
  HEX1        mccDigit3,
  HEX1        mncDigit3,
  HEX1        mncDigit1,
  HEX1        mncDigit2,  
  OCT2        tAC  
}

// 9.9.3.34
type record UENetworkCapabilityTLV
{
  OCT1                            elementIdentifier,
  UENetworkCapabilityLV           uENetworkCapabilityLV
}with {
  variant "PRESENCE (elementIdentifier = '58'O)"
} 

type record UENetworkCapabilityLV
{
  LIN1                  lengthIndicator,    //2..13
  UENetworkCapabilityV  uENetworkCapabilityV
} with {
  variant (lengthIndicator) "LENGTHTO (uENetworkCapabilityV)"
}

type record UENetworkCapabilityV    // Supported algorithms are EEA0, EEA1 and EIA1
{
  BIT8     eEA,
  BIT8     eIA,  
  BIT8     uEA         optional,  
  BIT7     uIA         optional,
  BIT1     uCS2        optional,//4. octet
  BIT1     nF          optional,
  BIT1     vCC         optional,
  BIT1     lCS         optional,
  BIT1     lPP         optional,
  BIT1     aCC_CSFB    optional,
  BIT1     h245_ASH    optional,
  BIT1     proSe       optional,
  BIT1     proSe_dd    optional,//5. octet
  BIT1     proSe_dc    optional,
  BIT1     proSe_relay optional,
  BIT1     cP_CIoT     optional,
  BIT1     uP_CIoT     optional,
  BIT1     s1_Udata    optional,
  BIT1     eRwoPDN     optional, 
  BIT1     hC_CP_CIoT  optional,
  BIT1     ePCO        optional,//6. octet //0
  BIT1     multipleDRB optional,
  BIT1     v2XPC5      optional,
  BIT1     restrictEC  optional,
  BIT1     cPbackoff   optional,
  BIT1     dCNR        optional,
  BIT1     n1Mode      optional,
  BIT1     sGC         optional,
  BIT1     spare1      optional,
  octetstring spare length (0..6) optional //0
}

// 9.9.3.35
type record UE_RadioCapabilityInfoUpdateNeededTV
{
  BIT1    uRC_upd,
  BIT3    spare,
  BIT4    elementIdentifier   
} with{
  variant "PRESENCE (elementIdentifier = '1010'B)"
}

// 9.9.3.36
type record UESecurityCapabilityLV  // Supported algorithms are EEA0, EEA1 and EIA1
{
  LIN1              lengthIndicator,
  BIT8              eEA,    
  BIT8              eIA, 
  BIT8              uEA    optional,
  BIT7              uIA    optional,
  BIT1              spare2 optional,
  BIT7              gEA    optional,
  BIT1              spare3 optional
} with { 
  variant (lengthIndicator) "LENGTHTO (eEA,eIA,uEA,uIA,spare2,gEA,spare3)"
}

// 9.9.3.37 - 10.5.3.13/24.008
type record EmergencyNumber{
  LIN1        lengthOfEmergencyNumber,
  BIT5        emergencyServiceCategoryValue,
  BIT3        spare,
  octetstring emergencyNumberDigits  
} with { 
  variant (lengthOfEmergencyNumber) "LENGTHTO( emergencyServiceCategoryValue,spare,emergencyNumberDigits )"};

type record of EmergencyNumber EmergencyNumberList with { variant "" }; 

type record EmergencyNumberListTLV {
  OCT1                elementIdentifier,
  LIN1                lengthIndicator, //  
  EmergencyNumberList emergencyNumberList 
} with { 
  variant "PRESENCE (elementIdentifier = '34'O)"
  variant (lengthIndicator) "LENGTHTO( emergencyNumberList )"};

// 9.9.3.37A The decode and details of this IE are FFS
type record ExtendedEmergencyNumber{
  LIN1        lengthOfExtendedEmergencyNumber,
  octetstring extendedEmergencyNumber  
} with { 
  variant (lengthOfExtendedEmergencyNumber) "LENGTHTO( extendedEmergencyNumber )"};

type record of ExtendedEmergencyNumber ExtendedEmergencyNumberList with { variant "" }; 

type record ExtendedEmergencyNumberListTLV {
  OCT1                        elementIdentifier,
  LIN1                        lengthIndicator,
  ExtendedEmergencyNumberList extendedEmergencyNumberList
} with { 
  variant (lengthIndicator) "LENGTHTO( extendedEmergencyNumberList )"
};

// 9.9.3.38
type record CLITLV
{
  OCT1              elementIdentifier,
  CLILV             cLILV

} with { variant "PRESENCE (elementIdentifier = '60'O)"; };

type record CLILV
{
  LIN1              lengthIndicator,
  CLI_Value         cLI_Value
} with {
  variant (lengthIndicator) "LENGTHTO (cLI_Value)" 
}

type record CLI_Value  //10.5.4.9/24.008
{
  BIT4          numberingPlanId,
  BIT3          typeOfNumber,
  BIT1          extensionBit,
  BIT2          screeningIndicator optional,
  BIT3          spare optional, //'000'
  BIT2          presentationIndicator optional,
  BIT1          extensionBit2 optional,  //'1'B
  hexstring     digits optional
} with {
  variant (screeningIndicator,spare,presentationIndicator,extensionBit2)"PRESENCE(extensionBit = '0'B)"; 
  variant "PADDING(yes)";
  variant "PADDING_PATTERN('1111'B)"
}

// 9.9.3.39
type record SS_CodeTV
{
  OCT1        elementIdentifier,
  OCT1        sS_CodeValue
} with{
  variant "PRESENCE (elementIdentifier = '61'O)"
}

// 9.9.3.40
type record LCS_IndicatorTV
{
  OCT1         elementIdentifier,
  OCT1         lCS_IndicatorValue    
} with {
  variant "PRESENCE (elementIdentifier = '62'O)"
}; 

// 9.9.3.41
type record LCS_ClientIdentityTLV
{
  OCT1                      elementIdentifier,
  LCS_ClientIdentityLV      lCS_ClientIdentityLV

} with { variant "PRESENCE (elementIdentifier = '63'O)"; };

type record LCS_ClientIdentityLV
{
  LIN1            lengthIndicator,
  octetstring     LCS_ClientIdentity length (1..255)
} with {
  variant (lengthIndicator) "LENGTHTO (LCS_ClientIdentity)" 
}

// 9.9.3.42
type OCT1 Generic_MessageContainerTypeV

// 9.9.3.43
type record Generic_MessageContainerLVE
{
  LIN2_BO_LAST      lengthIndicator,
  octetstring       content length (1..65535)
} with { 
  variant (lengthIndicator) "LENGTHTO (content)"
}

// 9.9.3.44 - 10.5.5.28/24.008
type record VoiceDomainPrefandUEsettingsTLV {
  OCT1                elementIdentifier,
  LIN1                lengthIndicator,  
  BIT2                voiceDomainPrefforEUTRAN,
  BIT1                uEsUsageSettings,
  BIT5                spare 
} with { 
  variant "PRESENCE (elementIdentifier = '5D'O)"
  variant (lengthIndicator) "LENGTHTO(voiceDomainPrefforEUTRAN,uEsUsageSettings,spare)"
};

// 9.9.3.45 
type record GUTI_TypeTV
{
  BIT1      gUTI_Type,
  BIT3      spare,
  BIT4      elementIdentifier      
} with{
  variant "PRESENCE (elementIdentifier = '1110'B)"
}

// 9.9.3.46 - 10.5.5.32/24.008
type record ExtendedDRXParametersTLV
{
  OCT1       elementIdentifier,
  LIN1       lengthIndicator,
  BIT4       eDRXvalue,
  BIT4       pagingTimeWindow
} with{
  variant "PRESENCE (elementIdentifier = '6E'O)"
  variant (lengthIndicator) "LENGTHTO (eDRXvalue,pagingTimeWindow)";
}

// 9.9.3.47
type record ControlPlaneServiceTypeTV
{
  ControlPlaneServiceTypeV controlPlaneServiceType,
  BIT4             elementIdentifier  //??
}

type record ControlPlaneServiceTypeV
{
  BIT3 controlPlaneServiceTypeValue,
  BIT1 activeFlag
}

// 9.9.3.48 - 10.5.5.35/24.008
type record DCNIDTLV
{
  OCT1       elementIdentifier,
  LIN1       lengthIndicator,
  OCT2       dCNIDvalue
} with{
  variant "PRESENCE (elementIdentifier = '65'O)"
  variant (lengthIndicator) "LENGTHTO (dCNIDvalue)";
}

// 9.9.3.49- 10.5.5.37/24.008
type record Non3GPP_NW_ProvidedPoliciesTV
{
  BIT1       n3EN_Indicator,
  BIT3       spare,
  BIT4       elementIdentifier
} with{
  variant "PRESENCE (elementIdentifier = '1101'B)"
}

// 9.9.3.50
type record HashTLV
{
  OCT1       elementIdentifier,
  LIN1       lengthIndicator,
  OCT8       hashMMEvalue
} with{
  variant "PRESENCE (elementIdentifier = '4F'O)"
  variant (lengthIndicator) "LENGTHTO (hashMMEvalue)";
}

// 9.9.3.51
type record ReplayedNASMessageContainerTLVE
{
  OCT1        elementIdentifier,
  LIN1        lengthIndicator,
  octetstring contents length (1..65535)
} with{
  variant "PRESENCE (elementIdentifier = '79'O)"
  variant (lengthIndicator) "LENGTHTO (contents)" 
}

// 9.9.3.52
type record NetworkPolicyTV
{
  BIT1       redirPolicy,
  BIT3       spare,
  BIT4       elementIdentifier
} with{
  variant "PRESENCE (elementIdentifier = '1100'B)"
}

// 9.9.3.53
type record UEAdditionalSecurityCapabilityTLV
{
  OCT1        elementIdentifier,
  LIN1        lengthIndicator,
  UEAdditionalSecurityCapabilityV uEAdditionalSecurityCapabilityV
} with { 
  variant "PRESENCE (elementIdentifier = '6F'O)"
  variant (lengthIndicator) "LENGTHTO (uEAdditionalSecurityCapabilityV)"
}

type record UEAdditionalSecurityCapabilityV
{
  BIT1              fiveG_eA7,    
  BIT1              fiveG_eA6,    
  BIT1              fiveG_eA5,    
  BIT1              fiveG_eA4,    
  BIT1              fiveG_eA3_128,    
  BIT1              fiveG_eA2_128,    
  BIT1              fiveG_eA1_128,    
  BIT1              fiveG_eA0,    
  BIT1              fiveG_eA15,    
  BIT1              fiveG_eA14,    
  BIT1              fiveG_eA13,    
  BIT1              fiveG_eA12,    
  BIT1              fiveG_eA11,    
  BIT1              fiveG_eA10,    
  BIT1              fiveG_eA9,    
  BIT1              fiveG_eA8,    
  BIT1              fiveG_iA7,    
  BIT1              fiveG_iA6,    
  BIT1              fiveG_iA5,    
  BIT1              fiveG_iA4,    
  BIT1              fiveG_iA3_128,    
  BIT1              fiveG_iA2_128,    
  BIT1              fiveG_iA1_128,    
  BIT1              fiveG_iA0,    
  BIT1              fiveG_iA15,    
  BIT1              fiveG_iA14,    
  BIT1              fiveG_iA13,    
  BIT1              fiveG_iA12,    
  BIT1              fiveG_iA11,    
  BIT1              fiveG_iA10,    
  BIT1              fiveG_iA9,    
  BIT1              fiveG_iA8    
}

// 9.9.3.54 3GPP TS 24.501 9.10.3.52
type record UEStatusTLV
{
  OCT1        elementIdentifier,
  LIN1        lengthIndicator,
  UEStatusV   uEStatusV
} with { 
  variant "PRESENCE (elementIdentifier = '6D'O)"
  variant (lengthIndicator) "LENGTHTO (uEStatusV)"
}

type record UEStatusV
{
  BIT1 s1ModeReg,
  BIT1 n1ModeReg,
  BIT5 spare
}

//=================================================================    
// EPS Session Management (ESM) information elements - 9.9.4/24.301 
//=================================================================


// 9.9.4.1 - 10.5.6.1/24.008 
type record AccessPointNameTLV 
{
  OCT1                      elementIdentifier,
  AccessPointNameLV         accessPointNamevalue
} with{
  variant "PRESENCE (elementIdentifier = '28'O)"
}

type record AccessPointNameLV 
{ 
  LIN1               lengthIndicator,
  octetstring        accessPointNameValue length (1..100)
} with{ 
  variant (lengthIndicator) "LENGTHTO (accessPointNameValue)";
} 


// 9.9.4.2
type record APN_AggregateMaximumBitRateTLV
{ 
  OCT1                      elementIdentifier,
  LIN1                      lengthIndicator,
  AggregateMaximumBitRateV  aggregateMaximumBitRateV
} with{ 
  variant "PRESENCE (elementIdentifier = '5E'O)"
  variant (lengthIndicator) "LENGTHTO (aggregateMaximumBitRateV)";
} 

type record AggregateMaximumBitRateV
{
  OCT1         aPN_AMBR_Downlink,
  OCT1         aPN_AMBR_Uplink,
  OCT1         aPN_AMBR_DownlinkExt  optional,
  OCT1         aPN_AMBR_UplinkExt    optional,
  OCT1         aPN_AMBR_DownlinkExt2 optional,
  OCT1         aPN_AMBR_UplinkExt2   optional
}

// 9.9.4.2a 10.5.6.19/24.008
type record ConnectivityTypeTV
{
  BIT4     connectivityTypeValue,
  BIT4     elementIdentifier 
} with{
  variant "PRESENCE (elementIdentifier = '1011'B)"
}

// 9.9.4.3
type record EPS_QualityOfServiceTLV
{
  OCT1                      elementIdentifier,
  LIN1                      lengthIndicator,
  EPS_QualityOfServiceV     ePS_QualityOfServiceV
} with{ 
  variant "PRESENCE (elementIdentifier = '5B'O)"
  variant (lengthIndicator) "LENGTHTO (ePS_QualityOfServiceV)";
}


type record EPS_QualityOfServiceLV
{
  LIN1                      lengthIndicator,
  EPS_QualityOfServiceV     ePS_QualityOfServiceV
} with{ 
  variant (lengthIndicator) "LENGTHTO (ePS_QualityOfServiceV)";
}

type record EPS_QualityOfServiceV 
{ 
  OCT1   qCI, 
  OCT1   maxBitRateUplink              optional,  
  OCT1   maxBitRateDownlink            optional, 
  OCT1   guaranteedBitRateUplink       optional,
  OCT1   guaranteedBitRateDownlink     optional, 
  OCT1   maxBitRateUplinkExt           optional,
  OCT1   maxBitRateDownlinkExt         optional,
  OCT1   guaranteedBitRateUplinkExt    optional,
  OCT1   guaranteedBitRateDownlinkExt  optional,
  OCT1   maxBitRateUplinkExt2          optional,
  OCT1   maxBitRateDownlinkExt2        optional,
  OCT1   guaranteedBitRateUplinkExt2   optional,
  OCT1   guaranteedBitRateDownlinkExt2 optional
} 

// 9.9.4.4
type record ESM_CauseTV
{
  OCT1        elementIdentifier,
  ESM_CauseV  causeValue
} with{
  variant "PRESENCE (elementIdentifier = '58'O)"
}

type record ESM_CauseV
{
  OCT1    causeValue
}

// 9.9.4.5
type record ESM_InformationTransferFlagTV
{
  BIT1     eIT,
  BIT3     spare,
  BIT4     elementIdentifier
} with{
  variant "PRESENCE (elementIdentifier = '1101'B)"
}

// 9.9.4.6
type record Linked_EPS_BearerIdentityV
{
  BIT4     linked_EPS_BearerIdentityValue  
}

// 9.9.4.7 - 10.5.6.9/24.008
type record LLC_SAPITV
{
  OCT1               elementIdentifier,
  LLC_SAPIV          valueField
} with { variant "PRESENCE (elementIdentifier = '32'O)"; };


type record  LLC_SAPIV
{
  BIT4               valueField,
  BIT4               spare        //'0000'B
};

// 9.9.4.7A
type record NotificationIndicatorLV
{
  LIN1               lengthIndicator,
  BIT8               valueField
} with {
  variant (lengthIndicator) "LENGTHTO (valueField)"
};

// 9.9.4.8 - 10.5.6.11/24.008
type record PacketFlowIDTLV
{
  OCT1               elementIdentifier,
  LIN1               lengthIndicator,
  PacketFlowIDV      valueField
} with {
  variant "PRESENCE (elementIdentifier = '34'O)";
  variant (lengthIndicator) "LENGTHTO (valueField)"
};


type record PacketFlowIDV
{
  BIT7               valueField,
  BIT1               spare   // '0'B
};

// 9.9.4.9
type record PDN_AddressLV
{  
  LIN1                     lengthIndicator,
  BIT3                     typeValue,
  BIT5                     spare,
  octetstring              addressInformation length (4..12)
} with {
  variant (lengthIndicator) "LENGTHTO (typeValue,spare,addressInformation)"
}

// 9.9.4.10
type record PDN_TypeV
{
  BIT3                     pDN_TypeValue,
  BIT1                     spare  //'0'B
}

// 9.9.4.11 - 10.5.6.3/24.008
type record ProtocolConfigOptionsTLV
{
  OCT1                      elementIdentifier,
  ProtocolConfigOptionsLV   protocolConfigOptions
} with{
  variant "PRESENCE (elementIdentifier = '27'O)"
}

type record ProtocolConfigOptionsLV
{
  LIN1                    lengthIndicator,
  ProtocolConfigOptionsV  protocolConfigOptionsV
} with {
  variant (lengthIndicator) "LENGTHTO (protocolConfigOptionsV)"
}

type record ProtocolConfigOptionsV
{
  BIT3                          configProtocol,
  BIT4                          spare,
  BIT1                          extensionField,
  ProtocolIDs_and_ContainerIDs  protocolIDs_and_ContainerIDs optional
}

type record length (1..250) of  ProtocolID_or_ContainerID  ProtocolIDs_and_ContainerIDs;

type record ProtocolID_or_ContainerID
{
  OCT2         protocolID_or_ContainerID,
  LIN1         lengthIndicator,
  octetstring  protID_orContID_Contents
} with {
  variant (lengthIndicator) "LENGTHTO (protID_orContID_Contents)"
}

// 9.9.4.12 -10.5.6.5/24.008
type record  QoSTLV
{
  OCT1               elementIdentifier,
  QoSLV              qoSLV
} with { variant "PRESENCE (elementIdentifier = '30'O)"; };


type record  QoSLV
{
  LIN1               lengthIndicator,
  QoSV               qoSV
} with { variant (lengthIndicator) "LENGTHTO (qoSV)"};


type record QoSV
{
  BIT3               reliabilityClass,
  BIT3               delayClass,
  BIT2               spare1,  // '00'B
  BIT3               precedenceClass,
  BIT1               spare2, //'0'B
  BIT4               peakThroughput,
  BIT5               meanThroughput,
  BIT3               spare3, //'000'B
  BIT3               deliverErroneusSDU            optional, //opt because of V97
  BIT2               deliveryOrder                 optional, //opt because of V97
  BIT3               trafficClass                  optional, //opt because of V97
  OCT1               maxSDUSize                    optional, //opt because of V97
  OCT1               maxBitrateUplink              optional, //opt because of V97
  OCT1               maxBitrateDownlink            optional, //opt because of V97
  BIT4               sduErrorRatio                 optional, //opt because of V97
  BIT4               residualBER                   optional, //opt because of V97 //oct10
  BIT2               trafficHandlingPriority       optional, //opt because of V97
  BIT6               transferDelay                 optional, //opt because of V97
  OCT1               guaranteedBitRateUplink       optional, //opt because of V97
  OCT1               guaranteedBitRateDownlink     optional, //opt because of V97 //oct13
  BIT4               sourceStatisticsDescriptor    optional, //opt because of V97
  BIT1               signallingIndication          optional, //opt because of V97
  BIT3               spare4                        optional, //opt because of V97 // '000'B //oct14
  OCT1               maxBitrateDownlinkExt         optional, //opt because of V97
  OCT1               guaranteedBitRateDownlinkExt  optional, //opt because of V97
  OCT1               maxBitrateUplinkExt           optional, //opt because of V97
  OCT1               guaranteedBitRateUplinkExt    optional, //opt because of V97 //oct 18
  OCT1               maxBitrateDownlinkExt2        optional, 
  OCT1               guaranteedBitRateDownlinkExt2 optional, 
  OCT1               maxBitrateUplinkExt2          optional, 
  OCT1               guaranteedBitRateUplinkExt2   optional   //oct 22

};
// 9.9.4.13 - 10.5.7.2/24.008
type record RadioPriorityTV {
  RadioPriorityV     valueField,
  BIT4               elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1000'B)"; };


type record RadioPriorityV
{
  BIT3               priorityLevelValue,
  BIT1               spare  // '0'B
};

// 9.9.4.13A
type record ReAttemptIndicatorTLV
{
  OCT1                       elementIdentifier,
  ReAttemptIndicatorLV       reAttemptIndicatorLV 
} with {
  variant "PRESENCE (elementIdentifier = '6B'O)"
}

type record ReAttemptIndicatorLV
{
  LIN1                       lengthIndicator,
  ReAttemptIndicatorV        valueField
} with { variant (lengthIndicator) "LENGTHTO(valueField)"};

type record ReAttemptIndicatorV
{
  BIT1      rATC,
  BIT1      ePLMNC,
  BIT6      spare //O  
}

// 9.9.4.14 - 10.5.6.17/24.008
type record RequestTypeV
{
  BIT3         requestTypeValue,
  BIT1         spare  //'0'B
}

// 9.9.4.15
type TrafficFlowTemplateLV TrafficFlowAggregateDescriptionLV

// 9.9.4.16 - 10.5.6.12/24.008
type record TrafficFlowTemplateLV
{
  LIN1                         lengthIndicator,
  TrafficFlowTemplateV         valueField
} with { variant (lengthIndicator) "LENGTHTO(valueField)"};

type record TrafficFlowTemplateTLV
{
  OCT1                         elementIdentifier,
  LIN1                         lengthIndicator,
  TrafficFlowTemplateV         valueField
} with {
   variant (lengthIndicator) "LENGTHTO(valueField)"
   variant  "PRESENCE (elementIdentifier = '36'O)" 
};


type union TrafficFlowTemplateV
{
  TrafficFlowTemplateV_CreateAddReplaceTFT
  trafficFlowTemplateV_CreateAddReplaceTFT,
  TrafficFlowTemplateV_DeletePacketFilter
  trafficFlowTemplateV_DeletePacketFilter,
  TrafficFlowTemplateV_Delete_Existing_TFT_or_No_TFT_Operation
  trafficFlowTemplateV_Delete_Existing_TFT_or_No_TFT_Operation
};

type record TrafficFlowTemplateV_CreateAddReplaceTFT
{
  integer                                numberOfPacketFilters,
  BIT1                                   eBIT,
  BIT3                                   operationCodeTFT,  //'001'B or
  PacketFilterList_CreateAddReplaceTFT   packetFilterList_CreateAddReplaceTFT,
  ParametersList                         parametersList            optional
} with {
  variant "PRESENCE (operationCodeTFT  = '001'B, //  Create New TFT
                     operationCodeTFT  = '011'B, //  Add packet filters to existing TFT
                     operationCodeTFT  = '100'B  //  Replace packet filters in existing TFT
  )";
  variant(parametersList)       "PRESENCE(eBIT = '1'B)";
  variant(numberOfPacketFilters)"FIELDLENGTH(4)";
  variant(numberOfPacketFilters)"LENGTHTO(packetFilterList_CreateAddReplaceTFT)";
  variant(numberOfPacketFilters)"UNIT(elements)";
};

type record TrafficFlowTemplateV_DeletePacketFilter
{
  integer                                numberOfPacketFilters,
  BIT1                                   eBIT,
  BIT3                                   operationCodeTFT,
  PacketFilterList_DeletePacketFilter    packetFilterList_DeletePacketFilter,
  ParametersList                         parametersList         optional
} with {
  variant "PRESENCE (operationCodeTFT = '101'B)"  // Delete packet filters from existing TFT
  variant(parametersList) "PRESENCE(eBIT = '1'B)";
  variant(numberOfPacketFilters)"FIELDLENGTH(4)";
  variant(numberOfPacketFilters)"LENGTHTO(packetFilterList_DeletePacketFilter)";
  variant  (numberOfPacketFilters)"UNIT(elements)";
};


type record TrafficFlowTemplateV_Delete_Existing_TFT_or_No_TFT_Operation
{
  BIT4                         numberOfPacketFilters, //'0000'B
  // numberOfPacketFilters is meaningless here since there is no PacketFilterList
  BIT1                         eBIT,
  BIT3                         operationCodeTFT,      // '010'B  or '110'B
  ParametersList               parametersList   optional
} with {
  variant "PRESENCE (operationCodeTFT = '000'B,  // ignore this IE
                     operationCodeTFT = '010'B,  // delete existing TFT
                     operationCodeTFT = '110'B   // No TFT Operation
  )";
  variant (parametersList) "PRESENCE(eBIT = '1'B)"
};

type record of PacketFilter PacketFilterList_CreateAddReplaceTFT;

type record PacketFilter
{
  PacketFilterIdentifier       identifier,
  OCT1                         evaluationPrecedence,
  LIN1                         lengthIndicator,
  octetstring                  contents
} with { variant (lengthIndicator) "LENGTHTO (contents)"};


type record of PacketFilterIdentifier  PacketFilterList_DeletePacketFilter;


type OCT1  PacketFilterIdentifier;


type record of Parameter ParametersList;


type record Parameter
{
  OCT1               parameterIdentifier,
  LIN1               lengthIndicator,
  octetstring        contents
} with { variant (lengthIndicator) "LENGTHTO (contents)"};

// 9.9.4.17
// 24.008 Linked TI - 10.5.6.7
type record TransactionIdentifierTLV
{
  OCT1                            elementIdentifier,
  TransactionIdentifierLV         transactionIdentifierLV
} with {
  variant "PRESENCE (elementIdentifier = '5D'O)"
}

type record TransactionIdentifierLV
{
  LIN1                     lengthIndicator,
  TransactionIdentifierV   transactionIdentifierV
} with { variant (lengthIndicator) "LENGTHTO (transactionIdentifierV)"};

type record TransactionIdentifierV
{
  BIT4               spare,  //'0000'B
  BIT3               tio,
  BIT1               tiFlag,
  TI_Extension       tIExtension  optional
} with { variant (tIExtension)"PRESENCE(tio = '111'B)"}; //???

type record        TI_Extension
{
  BIT7               tI_Value,
  BIT1               tI_ExtBit         //'1'B
};

// 9.9.4.18
// 24.008 - 10.5.6.20
type record WLANOffloadAcceptabilityTV
{
  WLANOffloadAcceptabilityV valueField,
  BIT4                      elementIdentifier
} with { variant "PRESENCE (elementIdentifier = '1100'B)"; };

type record WLANOffloadAcceptabilityV
{
  BIT1 eUTRAN_offloadAcceptabilityValue,
  BIT1 uTRAN_offloadAcceptabilityValue,
  BIT2 spare
}

// 9.9.4.19
// 24.008 -  10.5.6.21 NBIFOM container
type record NBIFOM_ContainerTLV
{
  OCT1                   elementIdentifier,
  LIN1                   lengthIndicator,
  NBIFOM_ParameterList   contents
} with { variant "PRESENCE (elementIdentifier = '33'O)";
  variant (lengthIndicator) "LENGTHTO (contents)" };

// 6.1 - TS 24.161
type record of NBIFOM_Parameter NBIFOM_ParameterList;

type record NBIFOM_Parameter
{
  OCT1         parameterIdentifier,
  LIN1         lengthIndicator,
  NBIFOM_ParameterContents parameterContents
} with {  variant (lengthIndicator) "LENGTHTO (parameterContents)";
  variant (parameterContents) "CROSSTAG(
    nBIFOM_Mode, parameterIdentifier = '01'O;
    nBIFOM_DefaultAccess, parameterIdentifier = '02'O;
    nBIFOM_Status, parameterIdentifier = '03'O;
    nBIFOM_RoutingRules, parameterIdentifier = '04'O;
    nBIFOM_IPFlowMapping, parameterIdentifier = '05'O;
    nBIFOM_RANRulesHandling, parameterIdentifier = '06'O;
    nBIFOM_RANRulesStatus, parameterIdentifier = '07'O;
    nBIFOM_AccessUsabilityIndication, parameterIdentifier = '08'O;
    unknownParameter, OTHERWISE)"};

type union NBIFOM_ParameterContents
{
  OCT1 nBIFOM_Mode,
  OCT1 nBIFOM_DefaultAccess,
  OCT1 nBIFOM_Status,
  NBIFOM_RoutingRules nBIFOM_RoutingRules,
  NBIFOM_RoutingRules nBIFOM_IPFlowMapping,
  OCT1 nBIFOM_RANRulesHandling,
  OCT1 nBIFOM_RANRulesStatus,
  NBIFOM_AccessUsabilityIndication nBIFOM_AccessUsabilityIndication,
  octetstring unknownParameter
};

type record of NBIFOM_RoutingRule NBIFOM_RoutingRules
type record NBIFOM_RoutingRule
{
  LIN1         lengthIndicator,
  OCT1         routingRuleIdentifier,
  BIT3         operationCode,
  BIT3         spare,
  BIT2         routingAccess,
  OCT1         routingRulePrioroty,
  RoutingFilter routingFilter
} with {  variant (lengthIndicator) "LENGTHTO (routingRuleIdentifier,operationCode,
  spare,routingAccess,routingRulePrioroty,routingFilter)";}

type record RoutingFilter
{
  BIT1 flagA,
  BIT1 flagB,
  BIT1 flagC,
  BIT1 flagD,
  BIT1 flagE,
  BIT1 flagF,
  BIT1 flagG,
  BIT1 flagH,
  BIT1 flagI,
  BIT1 flagJ,
  BIT1 flagK,
  BIT1 flagL,
  BIT1 flagM,
  BIT1 flagN,
  bitstring flagsZ length(18),
  OCT4  sourceIPv4Address optional,
  OCT4  destinationIPv4Address optional,
  OCT16 sourceIPv6Address optional,
  OCT16 destinationIPv6Address optional,
  OCT1  sourceAddressPrefixLength optional,
  OCT1  destinationAddressPrefixLength optional,
  OCT4  iPSecSecurityParameterIndex optional,
  OCT1  protocolTypeNextHeader optional,
  OCT4  startSourcePortRange optional,
  OCT4  endSourcePortRange optional,
  OCT4  startDestinationPortRange optional,
  OCT4  endDestinationPortRange optional,
  OCT1  typeOfService optional,
  OCT4  flowLabel optional
}  with { variant (sourceIPv4Address)  "PRESENCE(flagA = '1'B)";
  variant (destinationIPv4Address)  "PRESENCE(flagB = '1'B)";
  variant (sourceIPv6Address)  "PRESENCE(flagC = '1'B)";
  variant (destinationIPv6Address)  "PRESENCE(flagD = '1'B)";
  variant (sourceAddressPrefixLength)  "PRESENCE(flagE = '1'B)";
  variant (destinationAddressPrefixLength)  "PRESENCE(flagF = '1'B)";
  variant (iPSecSecurityParameterIndex)  "PRESENCE(flagG = '1'B)";
  variant (protocolTypeNextHeader)  "PRESENCE(flagH = '1'B)";
  variant (startSourcePortRange)  "PRESENCE(flagI = '1'B)";
  variant (endSourcePortRange)  "PRESENCE(flagJ = '1'B)";
  variant (startDestinationPortRange)  "PRESENCE(flagK = '1'B)";
  variant (endDestinationPortRange)  "PRESENCE(flagL = '1'B)";
  variant (typeOfService)  "PRESENCE(flagM = '1'B)";
  variant (flowLabel)  "PRESENCE(flagN = '1'B)";
}

type record NBIFOM_AccessUsabilityIndication
{
  BIT2 threeGPPAccessUsableValue,
  BIT2 wLANAccessUsableValue,
  BIT4 spare
}

// 9.9.4.20
type record RemoteUEContextListTLVE
{
  OCT1                   elementIdentifier,
  LIN1                   lengthIndicator,
  LIN1                   nrOfContents,
  RemoteUEContextList    contents
} with {
  variant (lengthIndicator) "LENGTHTO (nrOfContents, contents)" 
  variant (nrOfContents) "LENGTHTO (contents)";
  variant (nrOfContents) "UNIT (elements)";
};

type record of RemoteUEContext RemoteUEContextList;

type record RemoteUEContext
{
  LIN1               lengthIndicator,
  LIN1               numberOfUserIDs,
  RemoteUserIDList   userIDList,
  BIT3               addressType optional,
  BIT5               spare optional,
  AddressInformation addressInformation optional
} with {
  variant (lengthIndicator) "LENGTHTO (numberOfUserIDs,userIDList,addressType,spare,addressInformation)";
  variant (numberOfUserIDs)"LENGTHTO(userIDList)";
  variant (numberOfUserIDs)"UNIT(elements)";
  variant (addressInformation) "CROSSTAG(
		ipv4, addressType = '001'B;
		ipv6, addressType = '010'B)";
  };

type record of RemoteUserID RemoteUserIDList;

type record RemoteUserID
{
  LIN1               lengthIndicator,
  BIT3               typeOfUserInfo,
  OddEvenInd_IdentityDigits   digits
} with {
  variant (lengthIndicator) "LENGTHTO (typeOfUserInfo,digits)";
  variant (digits) "CROSSTAG(
    encriptedIMSI, typeOfUserInfo = '001'B;
    iMSI, typeOfUserInfo = '010'B;
    mSISDN, typeOfUserInfo = '011'B;
    iMEI, typeOfUserInfo = '100'B;
    iMEI_SV, typeOfUserInfo = '101'B)";
  };

type union AddressInformation
{
  OCT6 ipv4,
  OCT8 ipv6
}

type union OddEvenInd_IdentityDigits
{
  EncriptedIMSI encriptedIMSI,
  IMSI iMSI,
  MSISDN mSISDN,
  IMEI iMEI,
  IMEI_SV iMEI_SV
}

type record MSISDN
{
  BIT1               oddevenIndicator,       
  hexstring          digits,
  BIT4               fillerDigit  optional   // filler '1111'B 
} with {
  variant (fillerDigit) "PRESENCE (oddevenIndicator   = '0'B) "
}

type record EncriptedIMSI
{
  BIT1       oddevenIndicator,       
  BIT4       spare,
  bitstring  encriptedIMSI length(128)
}

// 9.9.4.21
type record PKMF_AddressTLV
{
  OCT1               elementIdentifier,
  LIN1               lengthIndicator,
  BIT3               addressType,
  BIT5               spare,
  PKMF_Address       addressInformation optional
} with {
  variant (lengthIndicator) "LENGTHTO (addressType,spare,addressInformation)";
  variant (addressInformation) "CROSSTAG(
		ipv4, addressType = '001'B;
		ipv6, addressType = '010'B)";
}

type union PKMF_Address
{
  OCT4  ipv4,
  OCT16 ipv6
}

// 9.9.4.22
type record HeaderCompressinConfigurationTLV
{
  OCT1               elementIdentifier,
  LIN1               lengthIndicator,
  HeaderCompressinConfigurationV headerCompressinConfiguration
} with {
  variant "PRESENCE (elementIdentifier = '66'O)";
  variant (lengthIndicator) "LENGTHTO (headerCompressinConfiguration)"
  };

type record HeaderCompressinConfigurationV
{
  BIT1 p0x0002,
  BIT1 p0x0003,
  BIT1 p0x0004,
  BIT1 p0x0006,
  BIT1 p0x0102,
  BIT1 p0x0103,
  BIT1 p0x0104,
  BIT1 spare,
  OCT2 max_CID,
  octetstring additionalHeaderCompression optional
}

// 9.9.4.23
type record ControlPlaneOnlyIndicationTV
{
  BIT1 cPOI,
  BIT3 spare,
  BIT4 elementIdentifier
} with { 
  variant "PRESENCE (elementIdentifier = '1001'B)";
}

// 9.9.4.24
type record UserDataContainerLVE
{
  LIN2_BO_LAST       lengthIndicator,
  octetstring        contents
} with { variant (lengthIndicator) "LENGTHTO(contents)"};

// 9.9.4.25
type record ReleaseAssistanceIndicationTV
{
  BIT2             dDX,
  BIT2             spare,
  BIT4             elementIdentifier
} with { 
  variant "PRESENCE (elementIdentifier = '1111'B)";
}


// 9.9.4.26 24.008 / 10.5.6.3A
type record ExtendedProtocolConfigurationOptionsTLVE
{
  OCT1               elementIdentifier,
  LIN2_BO_LAST       lengthIndicator,
  octetstring        extendedProtocolConfigurationOptions length(1..65535)
} with {
  variant "PRESENCE (elementIdentifier = '7B'O)";
  variant (lengthIndicator) "LENGTHTO (extendedProtocolConfigurationOptions)"
  };

// 9.9.4.27
type record HeaderCompressionConfigurationStatusTLV
{
  OCT1               elementIdentifier,
  LIN1               lengthIndicator,
  HeaderCompressionConfigurationStatusV headerCompressionConfigurationStatus
} with {
  variant "PRESENCE (elementIdentifier = '68'O)";
  variant (lengthIndicator) "LENGTHTO (headerCompressionConfigurationStatus)"
};

type record HeaderCompressionConfigurationStatusV
{
  BIT1              ebi0,
  BIT1              ebi1,
  BIT1              ebi2,
  BIT1              ebi3,
  BIT1              ebi4,
  BIT1              ebi5,
  BIT1              ebi6,
  BIT1              ebi7,
  BIT1              ebi8,
  BIT1              ebi9,
  BIT1              ebi10,
  BIT1              ebi11,
  BIT1              ebi12,
  BIT1              ebi13,
  BIT1              ebi14,
  BIT1              ebi15
}

// 9.9.4.28
type record ServingPLMNRateControlTLV
{
  OCT1               elementIdentifier,
  LIN1               lengthIndicator,
  LIN2_BO_LAST       servingPLMNRateControlValue
} with {
  variant "PRESENCE (elementIdentifier = '6E'O)";
  variant (lengthIndicator) "LENGTHTO (servingPLMNRateControlValue)"
};

// 9.9.4.29
type record Extended_APN_AMBR_TLV
{
  OCT1               elementIdentifier,
  LIN1               lengthIndicator,
  Extended_APN_AMBR_V  extended_APN_AMBR_Value
} with {
  variant "PRESENCE (elementIdentifier = '5F'O)";
  variant (lengthIndicator) "LENGTHTO (extended_APN_AMBR_Value)"
};

type record Extended_APN_AMBR_V
{
  OCT1 unit_Extended_APN_AMBR_Downlink,
  OCT2 extended_APN_AMBR_Downlink,
  OCT1 unit_Extended_APN_AMBR_Uplink,
  OCT2 extended_APN_AMBR_Uplink
}

// 9.9.4.30
type record ExtendedEPSQoSTLV
{
  OCT1               elementIdentifier,
  LIN1               lengthIndicator,
  Extended_QoS_V     extended_QoS_Value
} with {
  variant "PRESENCE (elementIdentifier = '5C'O)";
  variant (lengthIndicator) "LENGTHTO (extended_QoS_Value)"
};

type record Extended_QoS_V
{
  OCT1 unit_MaxBitRate,
  OCT2 maxBitRate_Uplink,
  OCT2 maxBitRate_Downlink,
  OCT1 unit_GuaranteedBitRate,
  OCT2 guaranteedBitRate_Uplink,
  OCT2 guaranteedBitRate_Downlink
}

//=====================================
// 8.2 EPS mobility management messages
//=====================================

// 8.2.1
type record PDU_NAS_EPS_AttachAccept
{
  BIT4                           securityHeaderType,
  BIT8                           messageType,
  EPS_AttachResultV              ePS_AttachResult,
  BIT4                           spare,
  GPRSTimerV                     t3412,
  TrackingAreaIdentityListLV     tAI_List,                 
  ESM_MessageContainerLVE        eSM_MessageContainer,
  EPS_MobileIdentityTLV          gUTI                        optional,
  LocationAreaIdentificationTV   locationAreaIdentification  optional,
  MobileIdentityTLV              msIdentity                  optional,
  EMM_CauseTV                    eMMCause                    optional,
  GPRSTimerTV                    t3402                       optional,
  GPRSTimerTV                    t3423                       optional,
  PLMN_ListTLV                   equivalentPLMNs             optional,
  EmergencyNumberListTLV         emergencyNumberList         optional, 
  EPS_NetworkFeatureSupportTLV   ePS_NetworkFeatureSupport   optional, 
  AdditionalUpdateResultTV       additionalUpdateResult      optional,
  GPRSTimer3TLV                  t3412_Extended              optional, 
  GPRSTimer2TLV                  t3324                       optional,
  ExtendedDRXParametersTLV       extendedDRXParameters       optional,
  DCNIDTLV                       dNCID                       optional,
  SMS_ServiceStatusTV            sMS_ServiceStatus           optional,
  Non3GPP_NW_ProvidedPoliciesTV  non3GPP_NW_ProvidedPolicies optional,
  GPRSTimer2TLV                  t3448                       optional,
  NetworkPolicyTV                networkPolicy               optional,
  GPRSTimer3TLV                  t3447                       optional,
  ExtendedEmergencyNumberListTLV extendedEmergencyNumberList optional
} with {
  variant "TAG (t3402, elementIdentifier = '17'O;
                t3423, elementIdentifier = '59'O;
                t3412_Extended, elementIdentifier = '5E'O;
                t3324, elementIdentifier = '6A'O;
                t3448, elementIdentifier = '6B'O;
                t3447, elementIdentifier = '6C'O; )";
}

// 8.2.2
type record PDU_NAS_EPS_AttachComplete
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  ESM_MessageContainerLVE          eSM_MessageContainer
}

// 8.2.3
type record PDU_NAS_EPS_AttachReject
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  EMM_CauseV                       emmCause,
  ESM_MessageContainerTLVE         eSM_MessageContainer optional,
  GPRSTimer2TLV                    t3346 optional,
  GPRSTimer2TLV                    t3402 optional,
  ExtendedEMM_CauseTV              extendedEmmCause optional
} with {
  variant "TAG (t3402, elementIdentifier = '16'O;
                t3346, elementIdentifier = '5F'O;)";
}

// 8.2.4
type record PDU_NAS_EPS_AttachRequest
{
  BIT4                           securityHeaderType,
  BIT8                           messageType,
  EPS_AttachTypeV                ePS_attachType,
  NAS_KeySetIdentifierV          nasKeySetId,
  EPS_MobileIdentityLV           ePSMobileId,
  UENetworkCapabilityLV          uENetworkCapability,
  ESM_MessageContainerLVE        eSM_MessageContainer,
  P_TMSISignatureTV              old_P_TMSISignature           optional,
  EPS_MobileIdentityTLV          additionalGUTI                optional,
  TrackingAreaIdentityTV         lastVisitedRegisteredTAI      optional,
  DRXParameterTV                 dRXParameter                  optional,
  MSNetworkCapabilityTLV         mSNetworkCapability           optional,
  LocationAreaIdentificationTV   oldLocationAreaIdentification optional,
  TMSIStatusTV                   tMSIStatusTV                  optional,
  MobileStationClassmark2_TLV    mobileStationClassmark2       optional,
  MobileStationClassmark3_TLV    mobileStationClassmark3       optional,
  SupportedCodecListTLV          supportedCodecList            optional, 
  AdditionalUpdateTypeTV         additionalUpdateType          optional,
  VoiceDomainPrefandUEsettingsTLV voiceDomainPrefandUEsettings optional,
  DevicePropertiesTV             deviceProperties              optional,
  GUTI_TypeTV                    oldGUTI_Type                  optional,
  MS_NetworkFeatureSupportTV     mS_NetworkFeatureSupport      optional,
  NetworkResourceIdentifierContainerTLV tMSIBasedNRIContainer  optional,
  GPRSTimer2TLV                  t3324                         optional,
  GPRSTimer3TLV                  t3412_Extended                optional,
  ExtendedDRXParametersTLV       extendedDRXParameters         optional,
  UEAdditionalSecurityCapabilityTLV uEAdditionalSecurityCapability optional
} with {  
  variant "TAG (mS_NetworkFeatureSupport, elementIdentifier = '1100'B;
                deviceProperties, elementIdentifier = '1101'B; 
                t3324, elementIdentifier = '6A'O;
                t3412_Extended, elementIdentifier = '5E'O;)";
}

// 8.2.5
type record PDU_NAS_EPS_AuthenticationFailure
{
  BIT4                           securityHeaderType,
  BIT8                           messageType,
  EMM_CauseV                     emmCause,
  AuthenticationFailureParameterTLV authenticationFailureParameter  optional
} with {
  variant (authenticationFailureParameter) "PRESENCE (emmCause.causeValue ='15'O)"
}


// 8.2.6
type record PDU_NAS_EPS_AuthenticationReject
{
  BIT4                           securityHeaderType,
  BIT8                           messageType
}

// 8.2.7
type record PDU_NAS_EPS_AuthenticationRequest
{
  BIT4                           securityHeaderType,
  BIT8                           messageType,
  NAS_KeySetIdentifierV          nasKeySetId,
  BIT4                           spare,
  AuthenticationParameterRANDV   authenticationParameterRAND,
  AuthenticationParameterAUTNLV  authenticationParameterAUTN
}

// 8.2.8
type record PDU_NAS_EPS_AuthenticationResponse
{
  BIT4                               securityHeaderType,
  BIT8                               messageType,
  AuthenticationResponseParameterLV  authenticationResponseParameter
}

// 8.2.9 PDU_NAS_EPS_CS_Service_Notification
type record PDU_NAS_EPS_CS_ServiceNotification
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  PagingIdentityV                  pagingIdentity,
  CLITLV                           cLI optional,
  SS_CodeTV                        sS_Code optional,
  LCS_IndicatorTV                  lCS_Indicator optional,
  LCS_ClientIdentityTLV            lCS_ClientIdentity optional
}

// 8.2.10.1 / 8.2.10.2
type record PDU_NAS_EPS_DetachAccept
{
  BIT4                             securityHeaderType,
  BIT8                             messageType
}

// Note: This PDU cannot be decoded
// 8.2.11.1
type record PDU_NAS_EPS_DetachRequest_UE_Orig
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  DetachTypeV                      detachType,           
  NAS_KeySetIdentifierV            nAS_KeySetIdentifier,
  EPS_MobileIdentityLV             ePSMobileId
}

// 8.2.11.2
type record PDU_NAS_EPS_DetachRequest_UE_Term
{
  BIT4                      securityHeaderType,
  BIT8                      messageType,
  DetachTypeV               detachType,
  BIT4                      spareHalfOctet,
  EMM_CauseTV               emmCause  optional
}

// 8.2.12 PDU_NAS_EPS_Downlink_NAS_Transport
type record PDU_NAS_EPS_Downlink_NAS_Transport
{
  BIT4                      securityHeaderType,
  BIT8                      messageType,
  NAS_MessageContainerLV    nAS_MessageContainer
}

// 8.2.13 PDU_NAS_EPS_EMM_Information
type record PDU_NAS_EPS_EMM_Information
{
  BIT4                      securityHeaderType,
  BIT8                      messageType,
  NetworkNameTLV            fullNameForNetwork optional,             
  NetworkNameTLV            shortNameForNetwork optional, 
  TimeZoneTV                localTimeZone optional,
  TimeZoneAndTimeTV         universalTimeAndLocalTimeZone optional,
  DaylightSavingTimeTLV     networkDaylightSavingTime optional  
}  with { variant "TAG
  ( 
    fullNameForNetwork,                 elementIdentifier = '43'O;  
    shortNameForNetwork,                elementIdentifier = '45'O;  
  )"
};

// 8.2.14 PDU_NAS_EPS_EMM_Status
type record PDU_NAS_EPS_EMM_Status
{
  BIT4                      securityHeaderType,
  BIT8                      messageType,
  EMM_CauseV                eMMCause
}

// 8.2.15 PDU_NAS_EPS_ExtendedServiceRequest
type record PDU_NAS_EPS_ExtendedServiceRequest
{
  BIT4                      securityHeaderType,
  BIT8                      messageType,
  BIT4                      serviceType,
  NAS_KeySetIdentifierV     nAS_KeySetIdentifier,
  MobileIdentityLV          m_TMSI,
  CSFB_ResponseTV           cSFB_Response optional,
  EPS_BearerContextStatusTLV ePS_BearerContextStatus optional,
  DevicePropertiesTV        deviceProperties optional
}with {
  variant "TAG (deviceProperties, elementIdentifier = '1101'B;)";
}

// 8.2.16 PDU_NAS_EPS_GUTI_ReallocationCommand
type record PDU_NAS_EPS_GUTI_ReallocationCommand{
  BIT4                      securityHeaderType,
  BIT8                      messageType,
  EPS_MobileIdentityLV      guti,
  TrackingAreaIdentityListTLV tAI_list optional,
  DCNIDTLV                  dNCID      optional
}

// 8.2.17 PDU_NAS_EPS_GUTI_ReallocationComplete
type record PDU_NAS_EPS_GUTI_ReallocationComplete{
  BIT4                      securityHeaderType,
  BIT8                      messageType
}

// 8.2.18
type record PDU_NAS_EPS_IdentityRequest
{
  BIT4                             securityHeaderType,
  BIT8                             messageType, 
  IdentityType2V                   identityType,
  BIT4                             spareHalfOctet  
}

// 8.2.19
type record PDU_NAS_EPS_IdentityResponse
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  MobileIdentityLV                 mobileIdentity
}  

// 8.2.20 
type record PDU_NAS_EPS_SecurityModeCommand
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  NAS_SecurityAlgorithmsV          selected_NAS_SecurityAlgorithms, 
  NAS_KeySetIdentifierV            nasKeySetId, 
  BIT4                             spareHalfOctet, 
  UESecurityCapabilityLV           replayed_UE_SecurityCapability,
  IMEISV_RequestTV                 iMEISV_Request optional,
  NonceTV                          replayedNonceUE optional,
  NonceTV                          nonceMME optional,
  HashTLV                          hashMME optional,
  UEAdditionalSecurityCapabilityTLV uEAdditionalSecurityCapability optional
} with {
  variant "TAG(replayedNonceUE, elementIdentifier = '55'O;
               nonceMME, elementIdentifier = '56'O;)";
}

// 8.2.21
type record PDU_NAS_EPS_SecurityModeComplete
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  MobileIdentityTLV                iMEISV optional,
  ReplayedNASMessageContainerTLVE  replayedNASMessageContainer optional
}

// 8.2.22
type record PDU_NAS_EPS_SecurityModeReject
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  EMM_CauseV                       eMMCause 
}

// 8.2.23 
type record PDU_NAS_EPS_SecurityProtectedNASMessage
{
  BIT4                             securityHeaderType,
  OCT4                             messageAuthenticationCode,
  integer                          sequenceNumber,
  octetstring                      nAS_Message
}

// 8.2.24
type record PDU_NAS_EPS_ServiceReject
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  EMM_CauseV                       eMMCause,
  GPRSTimerTV                      t3442 optional,
  GPRSTimer2TLV                    t3346 optional,
  GPRSTimer2TLV                    t3448 optional
} with {
  variant "TAG(t3442, elementIdentifier = '5B'O;
               t3346, elementIdentifier = '5F'O;
               t3448, elementIdentifier = '6B'O;)";
}


// 8.2.25
type record PDU_NAS_EPS_ServiceRequest
{
  BIT4                             securityHeaderType, 
  KSIandSequenceNumberV            ksiSequenceNumber, 
  ShortMACV                        mAC 
}

// 8.2.26
type record PDU_NAS_EPS_TrackingAreaUpdateAccept
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  EPS_UpdateResultV                updateResult,
  BIT4                             spareHalfOctet,  
  GPRSTimerTV                      t3412                      optional,
  EPS_MobileIdentityTLV            gUTI                       optional,
  TrackingAreaIdentityListTLV      tAI_List                   optional,
  EPS_BearerContextStatusTLV       ePSBearerContextStatus     optional,
  LocationAreaIdentificationTV     locationAreaIdentification optional,
  MobileIdentityTLV                msIdentity                 optional,
  EMM_CauseTV                      eMMCause                   optional,
  GPRSTimerTV                      t3402                      optional, 
  GPRSTimerTV                      t3423                      optional,
  PLMN_ListTLV                     equivalentPLMNs            optional,
  EmergencyNumberListTLV           emergencyNumberList        optional,
  EPS_NetworkFeatureSupportTLV     ePS_NetworkFeatureSupport  optional,
  AdditionalUpdateResultTV         additionalUpdateResult     optional,
  GPRSTimer3TLV                    t3412_Extended             optional,
  GPRSTimer2TLV                    t3324                      optional,
  ExtendedDRXParametersTLV         extendedDRXParameters      optional,
  HeaderCompressionConfigurationStatusTLV headerCompressionConfigurationStatus optional,
  DCNIDTLV                         dNCID                      optional,
  SMS_ServiceStatusTV              sMS_ServiceStatus          optional,
  Non3GPP_NW_ProvidedPoliciesTV    non3GPP_NW_ProvidedPolicies optional,
  GPRSTimer2TLV                    t3448                       optional,
  NetworkPolicyTV                  networkPolicy               optional,
  GPRSTimer3TLV                    t3447                       optional,
  ExtendedEmergencyNumberListTLV   extendedEmergencyNumberList optional
} with {
  variant "TAG (t3412, elementIdentifier = '5A'O;
                t3402, elementIdentifier = '17'O;
                t3423, elementIdentifier = '59'O;
                t3412_Extended, elementIdentifier = '5E'O;
                t3324, elementIdentifier = '6A'O;
                t3448, elementIdentifier = '6B'O;
                t3447, elementIdentifier = '6C'O;)";
};

// 8.2.27
type record PDU_NAS_EPS_TrackingAreaUpdateComplete
{
  BIT4                             securityHeaderType,
  BIT8                             messageType
}

// 8.2.28
type record PDU_NAS_EPS_TrackingAreaUpdateReject
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  EMM_CauseV                       emmCause,
  GPRSTimer2TLV                    t3346 optional,
  ExtendedEMM_CauseTV              extendedEmmCause optional
} with {
  variant "TAG(t3346, elementIdentifier = '5F'O;)";
}


// 8.2.29
type record PDU_NAS_EPS_TrackingAreaUpdateRequest
{ 
  BIT4                             securityHeaderType,
  BIT8                             messageType, 
  EPS_UpdateTypeV                  ePSupdateType,
  NAS_KeySetIdentifierV            nasKeySetId,
  EPS_MobileIdentityLV             oldGUTI, 
  NAS_KeySetIdentifierTV           nonCurrentNative_nasKeySetId   optional,
  CipheringKeySequenceNumberTV     gprsCipheringKeySequenceNumber optional,
  P_TMSISignatureTV                old_P_TMSISignature            optional,
  EPS_MobileIdentityTLV            additionalGUTI                 optional,
  NonceTV                          nonce                          optional,
  UENetworkCapabilityTLV           uENetworkCapability            optional,
  TrackingAreaIdentityTV           lastVisitedRegisteredTAI       optional,
  DRXParameterTV                   dRXParameter                   optional,
  UE_RadioCapabilityInfoUpdateNeededTV  uE_RadioCapabilityInfoUpdateNeeded optional,
  EPS_BearerContextStatusTLV       ePSBearerContextStatus         optional,
  MSNetworkCapabilityTLV           mSNetworkCapability            optional,
  LocationAreaIdentificationTV     oldLocationAreaIdentification  optional,
  TMSIStatusTV                     tMSIStatusTV                   optional,
  MobileStationClassmark2_TLV      mobileStationClassmark2        optional,
  MobileStationClassmark3_TLV      mobileStationClassmark3        optional, 
  SupportedCodecListTLV            supportedCodecList             optional,
  AdditionalUpdateTypeTV           additionalUpdateType           optional,
  VoiceDomainPrefandUEsettingsTLV  voiceDomainPrefandUEsettings   optional,
  GUTI_TypeTV                      oldGUTI_Type                   optional,
  DevicePropertiesTV               deviceProperties               optional,
  MS_NetworkFeatureSupportTV       mS_NetworkFeatureSupport       optional,  
  NetworkResourceIdentifierContainerTLV tMSIBasedNRIContainer     optional,       
  GPRSTimer2TLV                    t3324                          optional,
  GPRSTimer3TLV                    t3412_Extended                 optional,
  ExtendedDRXParametersTLV         extendedDRXParameters          optional,
  UEAdditionalSecurityCapabilityTLV uEAdditionalSecurityCapability optional,
  UEStatusTLV                      uEStatus                      optional
  } with {
  variant "TAG(nonce, elementIdentifier = '55'O;
               deviceProperties, elementIdentifier = '1101'B;
               mS_NetworkFeatureSupport, elementIdentifier = '1100'B;  
               t3324, elementIdentifier = '6A'O;
               t3412_Extended, elementIdentifier = '5E'O;)";
}

// 8.2.30 PDU_NAS_EPS_Uplink_NAS_Transport 
type record PDU_NAS_EPS_Uplink_NAS_Transport
{
  BIT4                      securityHeaderType,
  BIT8                      messageType,
  NAS_MessageContainerLV    nAS_MessageContainer
}

// 8.2.31 PDU_NAS_EPS_Downlink_Generic_NAS_Transport
type record PDU_NAS_EPS_Downlink_Generic_NAS_Transport
{
  BIT4                                  securityHeaderType,
  BIT8                                  messageType,
  BIT8                                  generic_MessageContainerType,
  Generic_MessageContainerLVE           generic_MessageConatiner,
  AdditionalInformationTLV              additionalInformation optional
} with {
  variant "PRESENCE(securityHeaderType='0000'B)"
}

// 8.2.32 PDU_NAS_EPS_Uplink_Generic_NAS_Transport
type record PDU_NAS_EPS_Uplink_Generic_NAS_Transport
{
  BIT4                                  securityHeaderType,
  BIT8                                  messageType,
  BIT8                                  generic_MessageContainerType,
  Generic_MessageContainerLVE           generic_MessageConatiner,
  AdditionalInformationTLV              additionalInformation optional
} with {
  variant "PRESENCE(securityHeaderType='0000'B)"
}

// 8.2.33 PDU_NAS_EPS_ControlPlaneServiceRequest
type record PDU_NAS_EPS_ControlPlaneServiceRequest
{
  BIT4                                  securityHeaderType,
  BIT8                                  messageType,
  ControlPlaneServiceTypeV              controlPlaneServiceType,
  NAS_KeySetIdentifierV                 nASKeySetIdentifier,
  ESM_MessageContainerTLVE              eSM_MessageContainer optional,
  NAS_MessageContainerTLV               nAS_MessageContainer optional,
  EPS_BearerContextStatusTLV            ePS_BearerContextStatus optional,
  DevicePropertiesTV                    deviceProperties optional
} with {  
  variant "TAG (nAS_MessageContainer, elementIdentifier = '67'O;)";
  variant "TAG (deviceProperties, elementIdentifier = '1101'B;)";
}

// 8.2.34 PDU_NAS_EPS_ServiceAccept
type record PDU_NAS_EPS_ServiceAccept
{
  BIT4                             securityHeaderType,
  BIT8                             messageType,
  EPS_BearerContextStatusTLV       ePS_BearerContextStatus optional,
  GPRSTimer2TLV                    t3448                   optional
} with {
  variant "TAG(t3448, elementIdentifier = '6B'O;)";
}

//==============================================
// EPS session management messages - 8.3/24.301
//==============================================

// 8.3.1 
type record PDU_NAS_EPS_ActDedEPSBearerContextAccept
{
  BIT4                             ePSBearerIdentity,
  BIT8                             procedureTransactionIdentifier,
  BIT8                             messageType, 
  ProtocolConfigOptionsTLV         protocolConfigOptions optional,
  NBIFOM_ContainerTLV              nBIFOMContainer optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.2
type record PDU_NAS_EPS_ActDedEPSBearerContextReject
{
  BIT4                             ePSBearerIdentity,
  BIT8                             procedureTransactionIdentifier,
  BIT8                             messageType,   
  ESM_CauseV                       esmCause,  
  ProtocolConfigOptionsTLV         protocolConfigOptions optional,  
  NBIFOM_ContainerTLV              nBIFOMContainer optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional  
}

// 8.3.3
type record PDU_NAS_EPS_ActDedEPSBearerContextRequest
{
  BIT4                             ePSBearerIdentity,
  BIT8                             procedureTransactionIdentifier,
  BIT8                             messageType,   
  Linked_EPS_BearerIdentityV       linked_EPS_BearerIdentity,
  BIT4                             spareHalfOctet,   
  EPS_QualityOfServiceLV           ePS_QoS,
  TrafficFlowTemplateLV            trafficFlowTemplate,
  TransactionIdentifierTLV         transactionIdentifier optional, 
  QoSTLV                           negotiatedQoS         optional,
  LLC_SAPITV                       negotiated_LLC_SAPI   optional,
  RadioPriorityTV                  radioPriority         optional,
  PacketFlowIDTLV                  packetFlowID          optional,
  ProtocolConfigOptionsTLV         protocolConfigOptions optional,
  WLANOffloadAcceptabilityTV       wLANOffloadIndication optional,
  NBIFOM_ContainerTLV              nBIFOMContainer       optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional,
  ExtendedEPSQoSTLV                extendedQoS           optional
}

// 8.3.4
type record PDU_NAS_EPS_ActDefEPSBearerContextAccept
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  ProtocolConfigOptionsTLV        protocolConfigOptions optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional    
}

// 8.3.5 PDU_NAS_EPS_ActDefEPSBearerContextReject
type record PDU_NAS_EPS_ActDefEPSBearerContextReject
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  ESM_CauseV                      esmCause,  
  ProtocolConfigOptionsTLV        protocolConfigOptions optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.6
type record PDU_NAS_EPS_ActDefEPSBearerContextRequest
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  EPS_QualityOfServiceLV              ePS_QoS,  
  AccessPointNameLV                   accessPointName, 
  PDN_AddressLV                       pDN_Address,
  TransactionIdentifierTLV            transactionIdentifier optional,
  QoSTLV                              negotiatedQoS         optional,
  LLC_SAPITV                          negotiated_LLC_SAPI   optional,
  RadioPriorityTV                     radioPriority         optional,
  PacketFlowIDTLV                     packetFlowID          optional,
  APN_AggregateMaximumBitRateTLV      aPN_AMBR              optional,
  ESM_CauseTV                         esmCause              optional,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  ConnectivityTypeTV                  connectivityType      optional,
  WLANOffloadAcceptabilityTV          wLANOffloadIndication optional,
  NBIFOM_ContainerTLV                 nBIFOMContainer       optional,
  HeaderCompressinConfigurationTLV    headerCompressinConfiguration optional,
  ControlPlaneOnlyIndicationTV        controlPlaneOnlyIndication optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional,
  ServingPLMNRateControlTLV           servingPLMNRateControl optional,
  Extended_APN_AMBR_TLV               extended_APN_AMBR     optional,
  ExtendedEPSQoSTLV                   extendedQoS           optional
};

// 8.3.7 PDU_NAS_EPS_BearerResourceAllocationReject
type record PDU_NAS_EPS_BearerResourceAllocationReject
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  ESM_CauseV                          esmCause,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  GPRSTimer3TLV                       backOffTimer          optional,
  ReAttemptIndicatorTLV               reAttemptIndicator    optional,
  NBIFOM_ContainerTLV                 nBIFOMContainer       optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}with { 
  variant "TAG (backOffTimer, elementIdentifier = '37'O;)";
};

// 8.3.8
type record PDU_NAS_EPS_BearerResourceAllocationRequest
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  Linked_EPS_BearerIdentityV          linked_EPS_BearerIdentity,
  BIT4                                spareHalfOctet,   
  TrafficFlowAggregateDescriptionLV   trafficFlowAggregate,
  EPS_QualityOfServiceLV              requiredTrafficFlowQOS,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  DevicePropertiesTV                  deviceProperties      optional, 
  NBIFOM_ContainerTLV                 nBIFOMContainer       optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional,
  ExtendedEPSQoSTLV                   extendedQoS           optional
} with { 
  variant "TAG(deviceProperties, elementIdentifier = '1100'B;)";  
}

// 8.3.9
type record PDU_NAS_EPS_BearerResourceModificationReject
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  ESM_CauseV                          esmCause,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  GPRSTimer3TLV                       backOffTimer          optional,
  ReAttemptIndicatorTLV               reAttemptIndicator    optional,
  NBIFOM_ContainerTLV                 nBIFOMContainer       optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}with { 
  variant "TAG (backOffTimer, elementIdentifier = '37'O;)";
};

// 8.3.10
type record PDU_NAS_EPS_BearerResourceModificationRequest
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  Linked_EPS_BearerIdentityV          linked_EPS_BearerIdentity,
  BIT4                                spareHalfOctet,   
  TrafficFlowAggregateDescriptionLV   trafficFlowAggregate,
  EPS_QualityOfServiceTLV             requiredTrafficFlowQOS optional,
  ESM_CauseTV                         esmCause               optional,
  ProtocolConfigOptionsTLV            protocolConfigOptions  optional,
  DevicePropertiesTV                  deviceProperties       optional,
  NBIFOM_ContainerTLV                 nBIFOMContainer        optional,
  HeaderCompressinConfigurationTLV    headerCompressinConfiguration optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional,
  ExtendedEPSQoSTLV                   extendedQoS            optional
} with { 
  variant "TAG(deviceProperties, elementIdentifier = '1100'B;)";  
}

// 8.3.11
type record PDU_NAS_EPS_DeactEPSBearerContextAccept
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional, 
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.12
type record PDU_NAS_EPS_DeactEPSBearerContextRequest
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  ESM_CauseV                          esmCause,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  GPRSTimer3TLV                       t3396                 optional,
  WLANOffloadAcceptabilityTV          wLANOffloadIndication optional,
  NBIFOM_ContainerTLV                 nBIFOMContainer       optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}with { 
  variant "TAG (t3396, elementIdentifier = '37'O;)";
};

// 8.3.12A
type record PDU_NAS_EPS_ESM_DummyMessage
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType
}

// 8.3.13 PDU_NAS_EPS_ESM_InformationRequest
type record PDU_NAS_EPS_ESM_InformationRequest
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType 
}

// 8.3.14 PDU_NAS_EPS_ESM_InformationResponse 
type record PDU_NAS_EPS_ESM_InformationResponse
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType, 
  AccessPointNameTLV                  accessPointName optional,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.15 PDU_NAS_EPS_ESM_Status
type record PDU_NAS_EPS_ESM_Status
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType, 
  ESM_CauseV                          esmCause  
}

// 8.3.16 PDU_NAS_EPS_ModifyEPSBearerContextAccept
type record PDU_NAS_EPS_ModifyEPSBearerContextAccept
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  NBIFOM_ContainerTLV                 nBIFOMContainer       optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.17 PDU_NAS_EPS_ModifyEPSBearerContextReject
type record PDU_NAS_EPS_ModifyEPSBearerContextReject
{
  BIT4                                ePSBearerIdentity,
  BIT8                                procedureTransactionIdentifier,
  BIT8                                messageType,
  ESM_CauseV                          esmCause,
  ProtocolConfigOptionsTLV            protocolConfigOptions optional,
  NBIFOM_ContainerTLV                 nBIFOMContainer       optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.18 PDU_NAS_EPS_ModifyEPSBearerContextRequest
type record PDU_NAS_EPS_ModifyEPSBearerContextRequest
{
  BIT4                             ePSBearerIdentity,
  BIT8                             procedureTransactionIdentifier,
  BIT8                             messageType,     
  EPS_QualityOfServiceTLV          newEPS_QoS              optional,
  TrafficFlowTemplateTLV           trafficFlowTemplate     optional,
  QoSTLV                           new_QoS                 optional,
  LLC_SAPITV                       negotiated_LLC_SAPI     optional,
  RadioPriorityTV                  radioPriority           optional,
  PacketFlowIDTLV                  packetFlowID            optional,
  APN_AggregateMaximumBitRateTLV   aPN_AMBR                optional,    
  ProtocolConfigOptionsTLV         protocolConfigOptions   optional,
  WLANOffloadAcceptabilityTV       wLANOffloadIndication   optional,
  NBIFOM_ContainerTLV              nBIFOMContainer         optional,
  HeaderCompressinConfigurationTLV headerCompressinConfiguration optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional,
  Extended_APN_AMBR_TLV            extended_APN_AMBR       optional,
  ExtendedEPSQoSTLV                extendedQoS             optional
}

// 8.3.18A
type record PDU_NAS_EPS_Notification
{
  BIT4                             ePSBearerIdentity,
  BIT8                             procedureTransactionIdentifier,
  BIT8                             messageType,
  NotificationIndicatorLV          notificationIndicator
}

// 8.3.19
type record PDU_NAS_EPS_PDN_ConnectivityReject
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  ESM_CauseV                      esmCause, 
  ProtocolConfigOptionsTLV        protocolConfigOptions optional,
  GPRSTimer3TLV                   backOffTimer optional,
  ReAttemptIndicatorTLV           reAttemptIndicator optional,
  NBIFOM_ContainerTLV             nBIFOMContainer         optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
} with { 
  variant "TAG (backOffTimer, elementIdentifier = '37'O;)";
};

// 8.3.20
type record PDU_NAS_EPS_PDN_ConnectivityRequest
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  RequestTypeV                    requestType,
  PDN_TypeV                       pDN_Type,
  ESM_InformationTransferFlagTV   eSM_InformationTransferFlag  optional,
  AccessPointNameTLV              accessPointName              optional,
  ProtocolConfigOptionsTLV        protocolConfigOptions        optional,
  DevicePropertiesTV              deviceProperties             optional,
  NBIFOM_ContainerTLV             nBIFOMContainer              optional,
  HeaderCompressinConfigurationTLV headerCompressinConfiguration optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
} with { 
  variant "TAG(deviceProperties, elementIdentifier = '1100'B;)";  
}

// 8.3.21 PDU_NAS_EPS_PDN_DisconnectReject
type record PDU_NAS_EPS_PDN_DisconnectReject 
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  ESM_CauseV                      esmCause, 
  ProtocolConfigOptionsTLV        protocolConfigOptions        optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.22 PDU_NAS_EPS_PDN_DisconnectRequest
type record PDU_NAS_EPS_PDN_DisconnectRequest
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  Linked_EPS_BearerIdentityV      linked_EPS_BearerIdentity,
  BIT4                            spareHalfOctet,
  ProtocolConfigOptionsTLV        protocolConfigOptions        optional,
  ExtendedProtocolConfigurationOptionsTLVE extendedProtocolConfigurationOptions optional
}

// 8.3.23 PDU_NAS_EPS_RemoteUEReport
type record PDU_NAS_EPS_RemoteUEReport
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  RemoteUEContextListTLVE         remoteUEContextConnected optional,
  RemoteUEContextListTLVE         remoteUEContextDisconnected optional,
  PKMF_AddressTLV                 proSeKeyManagementFunctionAddress optional
} with { 
  variant "TAG(remoteUEContextConnected, elementIdentifier = '79'O;  
               remoteUEContextDisconnected, elementIdentifier = '7A'O;
               proSeKeyManagementFunctionAddress, elementIdentifier = '6F'O)";  
}

// 8.3.24 PDU_NAS_EPS_RemoteUEReportResponse
type record PDU_NAS_EPS_RemoteUEReportResponse
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType
}

// 8.3.25 PDU_NAS_EPS_ESMDataTransport
type record PDU_NAS_EPS_ESMDataTransport
{
  BIT4                            ePSBearerIdentity,
  BIT8                            procedureTransactionIdentifier,
  BIT8                            messageType,
  UserDataContainerLVE            userDataContainer,
  ReleaseAssistanceIndicationTV   releaseAssistanceIndication optional
}
//see table 9.8.2/24.301:
type union EPS_SessionManagement
{  
  PDU_NAS_EPS_ActDefEPSBearerContextRequest    pDU_NAS_EPS_ActDefEPSBearerContextRequest,
  PDU_NAS_EPS_ActDefEPSBearerContextAccept     pDU_NAS_EPS_ActDefEPSBearerContextAccept,
  PDU_NAS_EPS_ActDefEPSBearerContextReject     pDU_NAS_EPS_ActDefEPSBearerContextReject,

  PDU_NAS_EPS_BearerResourceAllocationReject   pDU_NAS_EPS_BearerResourceAllocationReject,
  PDU_NAS_EPS_BearerResourceAllocationRequest  pDU_NAS_EPS_BearerResourceAllocationRequest,

  PDU_NAS_EPS_BearerResourceModificationReject   pDU_NAS_EPS_BearerResourceModificationReject,
  PDU_NAS_EPS_BearerResourceModificationRequest  pDU_NAS_EPS_BearerResourceModificationRequest,


  PDU_NAS_EPS_ActDedEPSBearerContextRequest    pDU_NAS_EPS_ActDedEPSBearerContextRequest,
  PDU_NAS_EPS_ActDedEPSBearerContextAccept     pDU_NAS_EPS_ActDedEPSBearerContextAccept,
  PDU_NAS_EPS_ActDedEPSBearerContextReject     pDU_NAS_EPS_ActDedEPSBearerContextReject,

  PDU_NAS_EPS_ModifyEPSBearerContextRequest    pDU_NAS_EPS_ModifyEPSBearerContextRequest,  
  PDU_NAS_EPS_ModifyEPSBearerContextAccept     pDU_NAS_EPS_ModifyEPSBearerContextAccept, 
  PDU_NAS_EPS_ModifyEPSBearerContextReject     pDU_NAS_EPS_ModifyEPSBearerContextReject,

  PDU_NAS_EPS_DeactEPSBearerContextRequest     pDU_NAS_EPS_DeactEPSBearerContextRequest,
  PDU_NAS_EPS_DeactEPSBearerContextAccept      pDU_NAS_EPS_DeactEPSBearerContextAccept,

  PDU_NAS_EPS_PDN_ConnectivityRequest          pDU_NAS_EPS_PDN_ConnectivityRequest,
  PDU_NAS_EPS_PDN_ConnectivityReject           pDU_NAS_EPS_PDN_ConnectivityReject,

  PDU_NAS_EPS_PDN_DisconnectRequest            pDU_NAS_EPS_PDN_DisconnectRequest,
  PDU_NAS_EPS_PDN_DisconnectReject             pDU_NAS_EPS_PDN_DisconnectReject,

  PDU_NAS_EPS_ESM_InformationRequest           pDU_NAS_EPS_ESM_InformationRequest, 
  PDU_NAS_EPS_ESM_InformationResponse          pDU_NAS_EPS_ESM_InformationResponse, 

  PDU_NAS_EPS_Notification                     pDU_NAS_EPS_Notification,

  PDU_NAS_EPS_ESM_DummyMessage                 pDU_NAS_EPS_ESM_DummyMessage,

  PDU_NAS_EPS_ESM_Status                       pDU_NAS_EPS_ESM_Status,

  PDU_NAS_EPS_RemoteUEReport                   pDU_NAS_EPS_RemoteUEReport,
  PDU_NAS_EPS_RemoteUEReportResponse           pDU_NAS_EPS_RemoteUEReportResponse,

  PDU_NAS_EPS_ESMDataTransport                 pDU_NAS_EPS_ESMDataTransport
} with {
  variant "TAG (    
  pDU_NAS_EPS_ActDefEPSBearerContextRequest,   messageType = '11000001'B;
  pDU_NAS_EPS_ActDefEPSBearerContextAccept,    messageType = '11000010'B;
  pDU_NAS_EPS_ActDefEPSBearerContextReject,    messageType = '11000011'B;

  pDU_NAS_EPS_ActDedEPSBearerContextRequest,   messageType = '11000101'B;
  pDU_NAS_EPS_ActDedEPSBearerContextAccept,    messageType = '11000110'B;
  pDU_NAS_EPS_ActDedEPSBearerContextReject,    messageType = '11000111'B;
  
  pDU_NAS_EPS_BearerResourceAllocationReject,  messageType = '11010101'B;
  pDU_NAS_EPS_BearerResourceAllocationRequest,  messageType = '11010100'B;
  
  pDU_NAS_EPS_BearerResourceModificationReject,  messageType = '11010111'B;
  pDU_NAS_EPS_BearerResourceModificationRequest,  messageType = '11010110'B;
    
  pDU_NAS_EPS_ModifyEPSBearerContextRequest,   messageType = '11001001'B;
  pDU_NAS_EPS_ModifyEPSBearerContextAccept,    messageType = '11001010'B;
  pDU_NAS_EPS_ModifyEPSBearerContextReject,    messageType = '11001011'B;
  
  pDU_NAS_EPS_DeactEPSBearerContextRequest,    messageType = '11001101'B;
  pDU_NAS_EPS_DeactEPSBearerContextAccept,     messageType = '11001110'B;
  
  pDU_NAS_EPS_PDN_ConnectivityRequest,         messageType = '11010000'B;
  pDU_NAS_EPS_PDN_ConnectivityReject,          messageType = '11010001'B;
  
  pDU_NAS_EPS_PDN_DisconnectRequest,           messageType = '11010010'B;
  pDU_NAS_EPS_PDN_DisconnectReject,            messageType = '11010011'B;
  
  pDU_NAS_EPS_ESM_InformationRequest,          messageType = '11011001'B;
  pDU_NAS_EPS_ESM_InformationResponse,         messageType = '11011010'B;
  
  pDU_NAS_EPS_Notification,                    messageType = '11011011'B;
  
  pDU_NAS_EPS_ESM_DummyMessage,                messageType = '11011100'B;
  
  pDU_NAS_EPS_ESM_Status,                      messageType = '11101000'B;
  
  pDU_NAS_EPS_RemoteUEReport,                  messageType = '11101001'B;
  pDU_NAS_EPS_RemoteUEReportResponse,          messageType = '11101010'B;
  
  pDU_NAS_EPS_ESMDataTransport,                messageType = '11101011'B;)"
} 

//see Table 9.8.1/24.301:
type union EPS_MobilityManagement
{
  PDU_NAS_EPS_ServiceRequest              pDU_NAS_EPS_ServiceRequest,
  PDU_NAS_EPS_SecurityProtectedNASMessage pDU_NAS_EPS_SecurityProtectedNASMessage,

  PDU_NAS_EPS_AttachRequest               pDU_NAS_EPS_AttachRequest,
  PDU_NAS_EPS_AttachAccept                pDU_NAS_EPS_AttachAccept,
  PDU_NAS_EPS_AttachComplete              pDU_NAS_EPS_AttachComplete,
  PDU_NAS_EPS_AttachReject                pDU_NAS_EPS_AttachReject,

  PDU_NAS_EPS_DetachAccept                pDU_NAS_EPS_DetachAccept,
  PDU_NAS_EPS_DetachRequest_UE_Term       pDU_NAS_EPS_DetachRequest_UE_Term,
  PDU_NAS_EPS_DetachRequest_UE_Orig       pDU_NAS_EPS_DetachRequest_UE_Orig, // Note: This PDU cannot be decoded

  PDU_NAS_EPS_TrackingAreaUpdateRequest   pDU_NAS_EPS_TrackingAreaUpdateRequest,
  PDU_NAS_EPS_TrackingAreaUpdateAccept    pDU_NAS_EPS_TrackingAreaUpdateAccept,
  PDU_NAS_EPS_TrackingAreaUpdateComplete  pDU_NAS_EPS_TrackingAreaUpdateComplete,
  PDU_NAS_EPS_TrackingAreaUpdateReject    pDU_NAS_EPS_TrackingAreaUpdateReject,

  PDU_NAS_EPS_ExtendedServiceRequest      pDU_NAS_EPS_ExtendedServiceRequest,
  PDU_NAS_EPS_ControlPlaneServiceRequest  pDU_NAS_EPS_ControlPlaneServiceRequest,
  PDU_NAS_EPS_ServiceReject               pDU_NAS_EPS_ServiceReject,
  PDU_NAS_EPS_ServiceAccept               pDU_NAS_EPS_ServiceAccept,

  PDU_NAS_EPS_GUTI_ReallocationCommand    pDU_NAS_EPS_GUTI_ReallocationCommand,  
  PDU_NAS_EPS_GUTI_ReallocationComplete   pDU_NAS_EPS_GUTI_ReallocationComplete,  
  PDU_NAS_EPS_AuthenticationRequest       pDU_NAS_EPS_AuthenticationRequest,
  PDU_NAS_EPS_AuthenticationResponse      pDU_NAS_EPS_AuthenticationResponse,
  PDU_NAS_EPS_AuthenticationReject        pDU_NAS_EPS_AuthenticationReject,
  PDU_NAS_EPS_AuthenticationFailure       pDU_NAS_EPS_AuthenticationFailure,
  PDU_NAS_EPS_IdentityRequest             pDU_NAS_EPS_IdentityRequest,
  PDU_NAS_EPS_IdentityResponse            pDU_NAS_EPS_IdentityResponse,
  PDU_NAS_EPS_SecurityModeCommand         pDU_NAS_EPS_SecurityModeCommand,
  PDU_NAS_EPS_SecurityModeComplete        pDU_NAS_EPS_SecurityModeComplete,
  PDU_NAS_EPS_SecurityModeReject          pDU_NAS_EPS_SecurityModeReject,

  PDU_NAS_EPS_EMM_Status                  pDU_NAS_EPS_EMM_Status,
  PDU_NAS_EPS_EMM_Information             pDU_NAS_EPS_EMM_Information,
  PDU_NAS_EPS_Downlink_NAS_Transport      pDU_NAS_EPS_Downlink_NAS_Transport,
  PDU_NAS_EPS_Uplink_NAS_Transport        pDU_NAS_EPS_Uplink_NAS_Transport,
  PDU_NAS_EPS_CS_ServiceNotification      pDU_NAS_EPS_CS_ServiceNotification,

  PDU_NAS_EPS_Downlink_Generic_NAS_Transport    pDU_NAS_EPS_Downlink_Generic_NAS_Transport,
  PDU_NAS_EPS_Uplink_Generic_NAS_Transport      pDU_NAS_EPS_Uplink_Generic_NAS_Transport
} with {
  variant "TAG (
  
  pDU_NAS_EPS_ServiceRequest,                 securityHeaderType= '1100'B; 
  pDU_NAS_EPS_ServiceRequest,                 securityHeaderType= '1101'B;  
  pDU_NAS_EPS_ServiceRequest,                 securityHeaderType= '1110'B;  
  pDU_NAS_EPS_ServiceRequest,                 securityHeaderType= '1111'B;  
  
  pDU_NAS_EPS_SecurityProtectedNASMessage,    securityHeaderType= '0001'B;
  pDU_NAS_EPS_SecurityProtectedNASMessage,    securityHeaderType= '0010'B;
  pDU_NAS_EPS_SecurityProtectedNASMessage,    securityHeaderType= '0011'B;
  pDU_NAS_EPS_SecurityProtectedNASMessage,    securityHeaderType= '0100'B; 
  pDU_NAS_EPS_SecurityProtectedNASMessage,    securityHeaderType= '0101'B;
  
  pDU_NAS_EPS_AttachRequest,                  messageType = '01000001'B;
  pDU_NAS_EPS_AttachAccept,                   messageType = '01000010'B;
  pDU_NAS_EPS_AttachComplete,                 messageType = '01000011'B;
  pDU_NAS_EPS_AttachReject,                   messageType = '01000100'B;
  pDU_NAS_EPS_DetachRequest_UE_Term,          messageType = '01000101'B;
  pDU_NAS_EPS_DetachRequest_UE_Orig,          messageType = '01000101'B;
  pDU_NAS_EPS_DetachAccept,                   messageType = '01000110'B;

  pDU_NAS_EPS_TrackingAreaUpdateRequest,      messageType = '01001000'B;
  pDU_NAS_EPS_TrackingAreaUpdateAccept,       messageType = '01001001'B;
  pDU_NAS_EPS_TrackingAreaUpdateComplete,     messageType = '01001010'B;
  pDU_NAS_EPS_TrackingAreaUpdateReject,       messageType = '01001011'B;

  pDU_NAS_EPS_ExtendedServiceRequest,         messageType = '01001100'B;
  pDU_NAS_EPS_ControlPlaneServiceRequest,     messageType = '01001101'B;
  pDU_NAS_EPS_ServiceReject,                  messageType = '01001110'B;
  pDU_NAS_EPS_ServiceAccept,                  messageType = '01001111'B;
  
  pDU_NAS_EPS_GUTI_ReallocationCommand,       messageType = '01010000'B; 
  pDU_NAS_EPS_GUTI_ReallocationComplete,      messageType = '01010001'B; 
  pDU_NAS_EPS_AuthenticationRequest,          messageType = '01010010'B;
  pDU_NAS_EPS_AuthenticationResponse,         messageType = '01010011'B;
  pDU_NAS_EPS_AuthenticationReject,           messageType = '01010100'B;
  pDU_NAS_EPS_AuthenticationFailure,          messageType = '01011100'B;
  pDU_NAS_EPS_IdentityRequest,                messageType = '01010101'B;
  pDU_NAS_EPS_IdentityResponse,               messageType = '01010110'B;
  pDU_NAS_EPS_SecurityModeCommand,            messageType = '01011101'B;
  pDU_NAS_EPS_SecurityModeComplete,           messageType = '01011110'B;
  pDU_NAS_EPS_SecurityModeReject,             messageType = '01011111'B;
  
  pDU_NAS_EPS_EMM_Status,                     messageType = '01100000'B;
  pDU_NAS_EPS_EMM_Information,                messageType = '01100001'B;
  pDU_NAS_EPS_Downlink_NAS_Transport,         messageType = '01100010'B;
  pDU_NAS_EPS_Uplink_NAS_Transport,           messageType = '01100011'B;
  pDU_NAS_EPS_CS_ServiceNotification,         messageType = '01100100'B;
  
  pDU_NAS_EPS_Downlink_Generic_NAS_Transport, messageType = '01101000'B;
  pDU_NAS_EPS_Uplink_Generic_NAS_Transport,   messageType = '01101001'B;
  )"
};


type union EPS_messages
{
  EPS_SessionManagement  ePS_SessionManagement,
  EPS_MobilityManagement ePS_MobilityManagement 
};

//see 11.2.3.1.1/24.007
type record PDU_NAS_EPS
{
  BIT4                 protocolDiscriminator,
  EPS_messages         ePS_messages
} with { variant (ePS_messages)"CROSSTAG(
                          ePS_SessionManagement,  protocolDiscriminator='0010'B;
                          ePS_MobilityManagement, protocolDiscriminator='0111'B;
                          )"
};


} with { encode "RAW"} // End of module

Back to the top