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
|
/* packet-bssap.c
* Routines for Base Station Subsystem Application Part (BSSAP/BSAP) dissection
* Specifications from 3GPP2 (www.3gpp2.org) and 3GPP (www.3gpp.org)
* IOS 4.0.1 (BSAP)
* GSM 08.06 (BSSAP)
*
* Copyright 2003, Michael Lum <mlum [AT] telostech.com>
* In association with Telos Technology Inc.
*
* Added BSSAP+ according to ETSI TS 129 018 V6.3.0 (2005-3GPP TS 29.018 version 6.3.0 Release 6)
* Copyright 2006, Anders Broman <Anders.Broman [AT] ericsson.com>
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#include <string.h>
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/emem.h>
#include "packet-bssap.h"
#include "packet-gsm_a.h"
#include "packet-e212.h"
#include "packet-sccp.h"
static void init_bssap(void);
#define BSSAP 0
#define BSAP 1
#define BSSAP_OR_BSAP_DEFAULT BSSAP
#define PDU_TYPE_OFFSET 0
#define PDU_TYPE_LENGTH 1
/* Same as below but with names typed out */
static const value_string bssap_pdu_type_values[] = {
{ BSSAP_PDU_TYPE_BSSMAP, "BSS Management" },
{ BSSAP_PDU_TYPE_DTAP, "Direct Transfer" },
{ 0, NULL } };
static const value_string bsap_pdu_type_values[] = {
{ BSSAP_PDU_TYPE_BSSMAP, "BS Management" },
{ BSSAP_PDU_TYPE_DTAP, "Direct Transfer" },
{ 0, NULL } };
/* Same as above but in acronym for (for the Info column) */
static const value_string bssap_pdu_type_acro_values[] = {
{ BSSAP_PDU_TYPE_BSSMAP, "BSSMAP" },
{ BSSAP_PDU_TYPE_DTAP, "DTAP" },
{ 0, NULL } };
/* Same as above but in acronym for (for the Info column) */
static const value_string bsap_pdu_type_acro_values[] = {
{ BSSAP_PDU_TYPE_BSSMAP, "BSMAP" },
{ BSSAP_PDU_TYPE_DTAP, "DTAP" },
{ 0, NULL } };
#define PARAMETER_DLCI 0x00
#define PARAMETER_LENGTH 0x01
#define PARAMETER_DATA 0x02
#define DLCI_LENGTH 1
#define LENGTH_LENGTH 1
#define DATA_LENGTH 1
#define CC_MASK 0xc0
#define SPARE_MASK 0x38
#define SAPI_MASK 0x07
static guint global_bssap_ssn = 98;
static guint global_bssap_old_ssn = 98;
static const value_string bssap_cc_values[] = {
{ 0x00, "not further specified" },
{ 0x80, "FACCH or SDCCH" },
{ 0xc0, "SACCH" },
{ 0, NULL } };
static const value_string bsap_cc_values[] = {
{ 0x00, "default for TIA/EIA/IS-2000" },
{ 0, NULL } };
static const value_string bssap_sapi_values[] = {
{ 0x00, "RR/MM/CC" },
{ 0x03, "SMS" },
{ 0, NULL } };
static const value_string bsap_sapi_values[] = {
{ 0x00, "Not used" },
{ 0, NULL } };
#define BSSAP_PAGING_REQUEST 1
#define BSSAP_PAGING_REJECT 2 /* 17.1.18 */
#define BSSAP_DOWNLINK_TUNNEL_REQUEST 7 /* 17.1.4 */
#define BSSAP_UPLINK_TUNNEL_REQUEST 8 /* 17.1.23 */
#define BSSAP_LOCATION_UPDATE_REQUEST 9 /* 17.1.11 */
#define BSSAP_LOCATION_UPDATE_ACCEPT 10 /* 17.1.9 */
#define BSSAP_LOCATION_UPDATE_REJECT 11 /* 17.1.10 */
#define BSSAP_TMSI_REALLOCATION_COMPLETE 12 /* 17.1.22 */
#define BSSAP_ALERT_REQUEST 13 /* 17.1.3 */
#define BSSAP_ALERT_ACK 14 /* 17.1.1 */
#define BSSAP_ALERT_REJECT 15 /* 17.1.2 */
#define BSSAP_MS_ACTIVITY_INDICATION 16 /* 17.1.14 */
#define BSSAP_GPRS_DETACH_INDICATION 17 /* 17.1.6 */
#define BSSAP_GPRS_DETACH_ACK 18 /* 17.1.5 */
#define BSSAP_IMSI_DETACH_INDICATION 19 /* 17.1.8 */
#define BSSAP_IMSI_DETACH_ACK 20 /* 17.1.7 */
#define BSSAP_RESET_INDICATION 21 /* 17.1.21 */
#define BSSAP_RESET_ACK 22 /* 17.1.20 */
#define BSSAP_MS_INFORMATION_REQUEST 23 /* 17.1.15 */
#define BSSAP_MS_INFORMATION_RESPONSE 24 /* 17.1.16 */
#define BSSAP_MM_INFORMATION_REQUEST 26 /* 17.1.12 */
#define BSSAP_MOBILE_STATUS 29 /* 17.1.13 */
#define BSSAP_MS_UNREACHABLE 31 /* 17.1.17 */
static const value_string bssap_plus_message_type_values[] = {
{ 0x00, "Unassigned: treated as an unknown Message type." },
{ BSSAP_PAGING_REQUEST, "BSSAP+-PAGING-REQUEST" }, /* 17.1.19 */
{ BSSAP_PAGING_REJECT, "BSSAP+-PAGING-REJECT" }, /* 17.1.18 */
{ 0x03, "Unassigned: treated as an unknown Message type." },
{ 0x04, "Unassigned: treated as an unknown Message type." },
{ 0x05, "Unassigned: treated as an unknown Message type." },
{ 0x06, "Unassigned: treated as an unknown Message type." },
{ BSSAP_DOWNLINK_TUNNEL_REQUEST, "BSSAP+-DOWNLINK-TUNNEL-REQUEST" }, /* 17.1.4 */
{ BSSAP_UPLINK_TUNNEL_REQUEST, "BSSAP+-UPLINK-TUNNEL-REQUEST" }, /* 17.1.23 */
{ BSSAP_LOCATION_UPDATE_REQUEST, "BSSAP+-LOCATION-UPDATE-REQUEST" }, /* 17.1.11 */
{ BSSAP_LOCATION_UPDATE_ACCEPT, "BSSAP+-LOCATION-UPDATE-ACCEPT" }, /* 17.1.9 */
{ BSSAP_LOCATION_UPDATE_REJECT, "BSSAP+-LOCATION-UPDATE-REJECT" }, /* 17.1.10 */
{ BSSAP_TMSI_REALLOCATION_COMPLETE, "BSSAP+-TMSI-REALLOCATION-COMPLETE" }, /* 17.1.22 */
{ BSSAP_ALERT_REQUEST, "BSSAP+-ALERT-REQUEST" }, /* 17.1.3 */
{ BSSAP_ALERT_ACK, "BSSAP+-ALERT-ACK" }, /* 17.1.1 */
{ BSSAP_ALERT_REJECT, "BSSAP+-ALERT-REJECT" }, /* 17.1.2 */
{ BSSAP_MS_ACTIVITY_INDICATION, "BSSAP+-MS-ACTIVITY-INDICATION" }, /* 17.1.14 */
{ BSSAP_GPRS_DETACH_INDICATION, "BSSAP+-GPRS-DETACH-INDICATION" }, /* 17.1.6 */
{ BSSAP_GPRS_DETACH_ACK, "BSSAP+-GPRS-DETACH-ACK" }, /* 17.1.5 */
{ BSSAP_IMSI_DETACH_INDICATION, "BSSAP+-IMSI-DETACH-INDICATION" }, /* 17.1.8 */
{ BSSAP_IMSI_DETACH_ACK, "BSSAP+-IMSI-DETACH-ACK" }, /* 17.1.7 */
{ BSSAP_RESET_INDICATION, "BSSAP+-RESET-INDICATION" }, /* 17.1.21 */
{ BSSAP_RESET_ACK, "BSSAP+-RESET-ACK" }, /* 17.1.20 */
{ BSSAP_MS_INFORMATION_REQUEST, "BSSAP+-MS-INFORMATION-REQUEST" }, /* 17.1.15 */
{ BSSAP_MS_INFORMATION_RESPONSE, "BSSAP+-MS-INFORMATION-RESPONSE" }, /* 17.1.16 */
{ 0x19, "Unassigned: treated as an unknown Message type." },
{ BSSAP_MM_INFORMATION_REQUEST, "BSSAP+-MM-INFORMATION-REQUEST" }, /* 17.1.12 */
{ BSSAP_MOBILE_STATUS, "BSSAP+-MOBILE-STATUS" }, /* 17.1.13 */
{ 0x1e, "Unassigned: treated as an unknown Message type." },
{ BSSAP_MS_UNREACHABLE, "BSSAP+-MS-UNREACHABLE" }, /* 17.1.17 */
{ 0, NULL }
};
#define BSSAP_IMSI 1
#define BSSAP_VLR_NUMBER 2
#define BSSAP_TMSI 3
#define BSSAP_LOC_AREA_ID 4
#define BSSAP_CHANNEL_NEEDED 5
#define BSSAP_EMLPP_PRIORITY 6
#define BSSAP_TMSI_STATUS 7
#define BSSAP_GS_CAUSE 8
#define BSSAP_SGSN_NUMBER 9
#define BSSAP_GPRS_LOC_UPD_TYPE 0x0a
#define BSSAP_GLOBAL_CN_ID 0x0b
#define BSSAP_MOBILE_STN_CLS_MRK1 0x0d
#define BSSAP_MOBILE_ID 0x0e
#define BSSAP_REJECT_CAUSE 0x0f
#define BSSAP_IMSI_DET_FROM_GPRS_SERV_TYPE 0x10
#define BSSAP_IMSI_DET_FROM_NON_GPRS_SERV_TYPE 0x11
#define BSSAP_INFO_REQ 0x12
#define BSSAP_PTMSI 0x13
#define BSSAP_IMEI 0x14
#define BSSAP_IMEISV 0x15
#define BSSAP_MM_INFORMATION 0x17
#define BSSAP_CELL_GBL_ID 0x18
#define BSSAP_LOC_INF_AGE 0x19
#define BSSAP_MOBILE_STN_STATE 0x1a
#define BSSAP_SERVICE_AREA_ID 0x1e
#define BSSAP_ERRONEOUS_MSG 0x1b
#define BSSAP_DLINK_TNL_PLD_CTR_AND_INF 0x1c
#define BSSAP_ULINK_TNL_PLD_CTR_AND_INF 0x1d
static const value_string bssap_plus_ie_id_values[] = {
{ BSSAP_IMSI, "IMSI" }, /* 18.4.10 */
{ BSSAP_VLR_NUMBER, "VLR number" }, /* 18.4.26 */
{ BSSAP_TMSI, "TMSI" }, /* 18.4.23 */
{ BSSAP_LOC_AREA_ID, "Location area identifier" }, /* 18.4.14 */
{ BSSAP_CHANNEL_NEEDED, "Channel Needed" }, /* 18.4.2 */
{ BSSAP_EMLPP_PRIORITY, "eMLPP Priority" }, /* 18.4.4 */
{ BSSAP_TMSI_STATUS, "TMSI status" }, /* 18.4.24 */
{ BSSAP_GS_CAUSE, "Gs cause" }, /* 18.4.7 */
{ BSSAP_SGSN_NUMBER, "SGSN number" }, /* 18.4.22 */
{ BSSAP_GPRS_LOC_UPD_TYPE, "GPRS location update type" }, /* 18.4.6 */
{ BSSAP_GLOBAL_CN_ID, "Global CN-Id" }, /* 18.4.27 */
{ 0x0c, "Unassigned: treated as an unknown IEI." }, /* 18 and 16 */
{ BSSAP_MOBILE_STN_CLS_MRK1, "Mobile station classmark 1" }, /* 18.4.18 */
{ BSSAP_MOBILE_ID, "Mobile identity" }, /* 18.4.17 */
{ BSSAP_REJECT_CAUSE, "Reject cause" }, /* 18.4.21 */
{ BSSAP_IMSI_DET_FROM_GPRS_SERV_TYPE, "IMSI detach from GPRS service type" }, /* 18.4.11 */
{ BSSAP_IMSI_DET_FROM_NON_GPRS_SERV_TYPE, "IMSI detach from non-GPRS service type" }, /* 18.4.12 */
{ BSSAP_INFO_REQ, "Information requested" }, /* 18.4.13 */
{ BSSAP_PTMSI, "PTMSI" }, /* 18.4.20 */
{ BSSAP_IMEI, "IMEI" }, /* 18.4.8 */
{ BSSAP_IMEISV, "IMEISV" }, /* 18.4.9 */
{ 0x16, "Unassigned: treated as an unknown IEI." }, /* 18 and 16 */
{ BSSAP_MM_INFORMATION, "MM information" }, /* 18.4.16 */
{ BSSAP_CELL_GBL_ID, "Cell Global Identity" }, /* 18.4.1 */
{ BSSAP_LOC_INF_AGE, "Location information age" }, /* 18.4.15 */
{ BSSAP_MOBILE_STN_STATE, "Mobile station state" }, /* 18.4.19 */
{ BSSAP_ERRONEOUS_MSG, "Erroneous message" }, /* 18.4.5 */
{ BSSAP_DLINK_TNL_PLD_CTR_AND_INF, "Downlink Tunnel Payload Control and Info" }, /* 18.4.3 */
{ BSSAP_ULINK_TNL_PLD_CTR_AND_INF, "Uplink Tunnel Payload Control and Info" }, /* 18.4.25 */
{ BSSAP_SERVICE_AREA_ID, "Service Area Identification" }, /* 18.4.21b */
{ 0, NULL }
};
/* Initialize the protocol and registered fields */
static int proto_bssap = -1;
/*static int proto_bssap_plus = -1;*/
static int hf_bssap_pdu_type = -1;
static int hf_bsap_pdu_type = -1;
static int hf_bssap_dlci_cc = -1;
static int hf_bsap_dlci_cc = -1;
static int hf_bssap_dlci_spare = -1;
static int hf_bsap_dlci_rsvd = -1;
static int hf_bssap_dlci_sapi = -1;
static int hf_bsap_dlci_sapi = -1;
static int hf_bssap_length = -1;
static int hf_bssap_plus_ie = -1;
static int hf_bssap_plus_ie_len = -1;
static int hf_bssap_plus_message_type = -1;
static int hf_bssap_imsi_ie = -1;
static int hf_bssap_imsi_det_from_gprs_serv_type_ie = -1;
static int hf_bssap_imsi_det_from_non_gprs_serv_type_ie = -1;
static int hf_bssap_info_req_ie = -1;
static int hf_bssap_loc_area_id_ie = -1;
static int hf_bssap_loc_inf_age_ie = -1;
static int hf_bssap_mm_information_ie = -1;
static int hf_bssap_mobile_id_ie = -1;
static int hf_bssap_mobile_stn_cls_mrk1_ie = -1;
static int hf_bssap_mobile_station_state_ie = -1;
static int hf_bssap_ptmsi_ie = -1;
static int hf_bssap_reject_cause_ie = -1;
static int hf_bssap_service_area_id_ie = -1;
static int hf_bssap_sgsn_nr_ie = -1;
static int hf_bssap_tmsi_ie = -1;
static int hf_bssap_tmsi_status_ie = -1;
static int hf_bssap_vlr_number_ie = -1;
static int hf_bssap_global_cn_id_ie = -1;
static int hf_bssap_plus_ie_data = -1;
static int hf_bssap_extension = -1;
static int hf_bssap_type_of_number = -1;
static int hf_bssap_numbering_plan_id = -1;
static int hf_bssap_sgsn_number = -1;
static int hf_bssap_vlr_number = -1;
static int hf_bssap_call_priority = -1;
static int hf_bssap_gprs_loc_upd_type_ie = -1;
static int hf_bssap_Gs_cause_ie = -1;
static int hf_bssap_imei_ie = -1;
static int hf_bssap_imesiv_ie = -1;
static int hf_bssap_cell_global_id_ie = -1;
static int hf_bssap_channel_needed_ie = -1;
static int hf_bssap_dlink_tnl_pld_cntrl_amd_inf_ie = -1;
static int hf_bssap_ulink_tnl_pld_cntrl_amd_inf_ie = -1;
static int hf_bssap_emlpp_prio_ie = -1;
static int hf_bssap_gprs_erroneous_msg_ie = -1;
static int hf_bssap_gprs_loc_upd_type = -1;
static int hf_bssap_Gs_cause = -1;
static int hf_bssap_imei = -1;
static int hf_bssap_imeisv = -1;
static int hf_bssap_imsi = -1;
static int hf_bssap_imsi_det_from_gprs_serv_type = -1;
static int hf_bssap_info_req = -1;
static int hf_bssap_loc_inf_age = -1;
static int hf_bssap_mobile_station_state = -1;
static int hf_bssap_ptmsi = -1;
static int hf_bssap_tmsi = -1;
static int hf_bssap_tmsi_status = -1;
static int hf_bssap_tom_prot_disc = -1;
static int hf_bssap_e_bit = -1;
static int hf_bssap_tunnel_prio = -1;
static int hf_bssap_global_cn_id = -1;
static int hf_bssap_plmn_id = -1;
static int hf_bssap_cn_id = -1;
static int hf_bssap_cell_global_id = -1;
/* Initialize the subtree pointers */
static gint ett_bssap = -1;
static gint ett_bssap_dlci = -1;
static gint ett_bssap_imsi = -1;
static gint ett_bssap_imsi_det_from_gprs_serv_type = -1;
static gint ett_bssap_imsi_det_from_non_gprs_serv_type = -1;
static gint ett_bssap_info_req = -1;
static gint ett_bssap_loc_area_id = -1;
static gint ett_bssap_loc_inf_age = -1;
static gint ett_bssap_mm_information = -1;
static gint ett_bssap_mobile_id = -1;
static gint ett_bssap_sgsn_nr = -1;
static gint ett_bssap_tmsi = -1;
static gint ett_bssap_tmsi_status = -1;
static gint ett_bssap_vlr_number = -1;
static gint ett_bssap_global_cn = -1;
static gint ett_bssap_gprs_loc_upd = -1;
static gint ett_bassp_Gs_cause = -1;
static gint ett_bassp_imei = -1;
static gint ett_bassp_imesiv = -1;
static gint ett_bssap_cell_global_id = -1;
static gint ett_bssap_cgi = -1;
static gint ett_bssap_channel_needed = -1;
static gint ett_bssap_dlink_tnl_pld_cntrl_amd_inf = -1;
static gint ett_bssap_ulink_tnl_pld_cntrl_amd_inf = -1;
static gint ett_bssap_emlpp_prio = -1;
static gint ett_bssap_erroneous_msg = -1;
static gint ett_bssap_mobile_stn_cls_mrk1 = -1;
static gint ett_bssap_mobile_station_state = -1;
static gint ett_bssap_ptmsi = -1;
static gint ett_bssap_reject_cause = -1;
static gint ett_bssap_service_area_id =-1;
static gint ett_bssap_global_cn_id = -1;
static gint ett_bssap_plmn = -1;
static dissector_handle_t data_handle;
static dissector_handle_t rrlp_handle;
static dissector_handle_t bssap_plus_handle;
static dissector_table_t bssap_dissector_table;
static dissector_table_t bsap_dissector_table;
/*
* Keep track of pdu_type so we can call appropriate sub-dissector
*/
static guint8 pdu_type = 0xFF;
static gint bssap_or_bsap_global = BSSAP_OR_BSAP_DEFAULT;
static void
dissect_bssap_unknown_message(tvbuff_t *message_tvb, proto_tree *bssap_tree)
{
guint32 message_length;
message_length = tvb_length(message_tvb);
proto_tree_add_text(bssap_tree, message_tvb, 0, message_length,
"Unknown message (%u byte%s)",
message_length, plurality(message_length, "", "s"));
}
static void
dissect_bssap_unknown_param(tvbuff_t *tvb, proto_tree *tree, guint8 type, guint16 length)
{
proto_tree_add_text(tree, tvb, 0, length,
"Unknown parameter 0x%x (%u byte%s)",
type, length, plurality(length, "", "s"));
}
static void
dissect_bssap_data_param(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *bssap_tree, proto_tree *tree)
{
if ((pdu_type <= 0x01))
{
if (bssap_or_bsap_global == BSSAP)
{
/* BSSAP */
if (dissector_try_port(bssap_dissector_table, pdu_type, tvb, pinfo, tree)) return;
}
else
{
/* BSAP */
if (dissector_try_port(bsap_dissector_table, pdu_type, tvb, pinfo, tree)) return;
}
}
/* No sub-dissection occured, treat it as raw data */
call_dissector(data_handle, tvb, pinfo, bssap_tree);
}
static void
dissect_bssap_dlci_param(tvbuff_t *tvb, proto_tree *tree, guint16 length)
{
proto_item *dlci_item = 0;
proto_tree *dlci_tree = 0;
guint8 oct;
dlci_item =
proto_tree_add_text(tree, tvb, 0, length,
"Data Link Connection Identifier");
dlci_tree = proto_item_add_subtree(dlci_item, ett_bssap_dlci);
oct = tvb_get_guint8(tvb, 0);
if (bssap_or_bsap_global == BSSAP)
{
proto_tree_add_uint(dlci_tree, hf_bssap_dlci_cc, tvb, 0, length, oct);
proto_tree_add_uint(dlci_tree, hf_bssap_dlci_spare, tvb, 0, length, oct);
proto_tree_add_uint(dlci_tree, hf_bssap_dlci_sapi, tvb, 0, length, oct);
}
else
{
proto_tree_add_uint(dlci_tree, hf_bsap_dlci_cc, tvb, 0, length, oct);
proto_tree_add_uint(dlci_tree, hf_bsap_dlci_rsvd, tvb, 0, length, oct);
proto_tree_add_uint(dlci_tree, hf_bsap_dlci_sapi, tvb, 0, length, oct);
}
}
static void
dissect_bssap_length_param(tvbuff_t *tvb, proto_tree *tree, guint16 length)
{
guint8 data_length;
data_length = tvb_get_guint8(tvb, 0);
proto_tree_add_uint(tree, hf_bssap_length, tvb, 0, length, data_length);
}
/*
* Dissect a parameter given its type, offset into tvb, and length.
*/
static guint16
dissect_bssap_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bssap_tree,
proto_tree *tree, guint8 parameter_type, gint offset,
guint16 parameter_length)
{
tvbuff_t *parameter_tvb;
parameter_tvb = tvb_new_subset(tvb, offset, parameter_length, parameter_length);
switch (parameter_type)
{
case PARAMETER_DLCI:
dissect_bssap_dlci_param(parameter_tvb, bssap_tree, parameter_length);
break;
case PARAMETER_LENGTH:
dissect_bssap_length_param(parameter_tvb, bssap_tree, parameter_length);
break;
case PARAMETER_DATA:
dissect_bssap_data_param(parameter_tvb, pinfo, bssap_tree, tree);
break;
default:
dissect_bssap_unknown_param(parameter_tvb, bssap_tree, parameter_type,
parameter_length);
break;
}
return(parameter_length);
}
static guint16
dissect_bssap_var_parameter(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *bssap_tree, proto_tree *tree,
guint8 parameter_type, gint offset)
{
guint16 parameter_length;
guint8 length_length;
parameter_length = tvb_get_guint8(tvb, offset);
length_length = LENGTH_LENGTH;
offset += length_length;
dissect_bssap_parameter(tvb, pinfo, bssap_tree, tree, parameter_type,
offset, parameter_length);
return(parameter_length + length_length);
}
static void
dissect_bssap_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bssap_tree,
proto_tree *tree)
{
gint offset = 0;
/*
* Extract the PDU type
*/
pdu_type = tvb_get_guint8(tvb, PDU_TYPE_OFFSET);
offset = PDU_TYPE_LENGTH;
if (bssap_tree)
{
/*
* add the message type to the protocol tree
*/
proto_tree_add_uint(bssap_tree,
(bssap_or_bsap_global == BSSAP) ? hf_bssap_pdu_type : hf_bsap_pdu_type,
tvb, PDU_TYPE_OFFSET, PDU_TYPE_LENGTH, pdu_type);
}
/* Starting a new message dissection */
switch (pdu_type)
{
case BSSAP_PDU_TYPE_BSSMAP:
offset += dissect_bssap_parameter(tvb, pinfo, bssap_tree, tree,
PARAMETER_LENGTH, offset,
LENGTH_LENGTH);
offset += dissect_bssap_var_parameter(tvb, pinfo, bssap_tree, tree,
PARAMETER_DATA,
(offset - LENGTH_LENGTH));
break;
case BSSAP_PDU_TYPE_DTAP:
offset += dissect_bssap_parameter(tvb, pinfo, bssap_tree, tree,
PARAMETER_DLCI,
offset, DLCI_LENGTH);
offset += dissect_bssap_parameter(tvb, pinfo, bssap_tree, tree,
PARAMETER_LENGTH, offset,
LENGTH_LENGTH);
offset += dissect_bssap_var_parameter(tvb, pinfo, bssap_tree, tree,
PARAMETER_DATA,
(offset - LENGTH_LENGTH));
break;
default:
if (check_col(pinfo->cinfo, COL_INFO))
{
col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
val_to_str(pdu_type, ((bssap_or_bsap_global == BSSAP) ?
bssap_pdu_type_acro_values : bsap_pdu_type_acro_values),
"Unknown"));
}
dissect_bssap_unknown_message(tvb, bssap_tree);
break;
}
}
static void
dissect_bssap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *bssap_item;
proto_tree *bssap_tree = NULL;
/*
* Make entry in the Protocol column on summary display
*/
if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, ((bssap_or_bsap_global == BSSAP) ? "BSSAP" : "BSAP"));
}
if ( pinfo->sccp_info && pinfo->sccp_info->data.co.assoc )
pinfo->sccp_info->data.co.assoc->payload = SCCP_PLOAD_BSSAP;
/*
* create the bssap protocol tree
*/
proto_tree_add_item_hidden(tree, proto_bssap, tvb, 0, -1, FALSE);
bssap_item = proto_tree_add_text(tree, tvb, 0, -1, (bssap_or_bsap_global == BSSAP) ? "BSSAP" : "BSAP");
bssap_tree = proto_item_add_subtree(bssap_item, ett_bssap);
/* dissect the message */
dissect_bssap_message(tvb, pinfo, bssap_tree, tree);
}
/*
* BSSAP+ Routines
*/
typedef struct dgt_set_t
{
unsigned char out[15];
}
dgt_set_t;
#ifdef REMOVED
static dgt_set_t Dgt_tbcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#'
}
};
#endif
static dgt_set_t Dgt1_9_bcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?'
}
};
/* Assumes the rest of the tvb contains the digits to be turned into a string
*/
static char*
unpack_digits(tvbuff_t *tvb, int offset,dgt_set_t *dgt,gboolean skip_first){
int length;
guint8 octet;
int i=0;
char *digit_str;
length = tvb_length(tvb);
if (length < offset)
return "";
digit_str = ep_alloc((length - offset)*2+1);
while ( offset < length ){
octet = tvb_get_guint8(tvb,offset);
if (!skip_first){
digit_str[i] = dgt->out[octet & 0x0f];
i++;
}
skip_first = FALSE;
/*
* unpack second value in byte
*/
octet = octet >> 4;
if (octet == 0x0f) /* odd number bytes - hit filler */
break;
digit_str[i] = dgt->out[octet & 0x0f];
i++;
offset++;
}
digit_str[i]= '\0';
return digit_str;
}
static gboolean
check_ie(tvbuff_t *tvb, proto_tree *tree, int *offset, guint8 expected_ie){
guint8 ie_type;
guint8 ie_len;
ie_type = tvb_get_guint8(tvb,*offset);
if (ie_type != expected_ie){
proto_tree_add_text(tree, tvb, *offset, 1, "Mandatory IE %s expected but IE %s Found",
val_to_str(expected_ie,bssap_plus_ie_id_values,"Unknown %u"), val_to_str(ie_type,bssap_plus_ie_id_values,"Unknown %u"));
(*offset)++;
ie_len = tvb_get_guint8(tvb,*offset);
*offset = *offset + ie_len;
return FALSE;
}
return TRUE;
}
static gboolean
check_optional_ie(tvbuff_t *tvb, int offset, guint8 expected_ie){
guint8 ie_type;
ie_type = tvb_get_guint8(tvb,offset);
if (ie_type != expected_ie){
return FALSE;
}
return TRUE;
}
/* 18.4.1 Cell global identity */
static int
dissect_bssap_cell_global_id(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
proto_item *cgi_item = NULL;
proto_tree *cgi_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_cell_global_id_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_cell_global_id);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/*
* The rest of the information element is coded as the the value part
* of the cell global id IE defined in 3GPP TS 48.018 (not including
* 3GPP TS 48.018 IEI and 3GPP TS 48.018 length indicator).
*/
cgi_item= proto_tree_add_item(ie_tree, hf_bssap_cell_global_id, tvb, offset, ie_len, FALSE);
cgi_tree = proto_item_add_subtree(cgi_item, ett_bssap_cgi);
/* octets 3-8 Octets 3 to 8 contain the value part (starting with octet 2) of the
* Routing Area Identification IE defined in 3GPP TS 24.008, not
* including 3GPP TS 24.008 IEI
*/
de_gmm_rai(tvb, cgi_tree, offset, ie_len, NULL, 0);
/* Octets 9 and 10 contain the value part (starting with octet 2) of the
* Cell Identity IE defined in 3GPP TS 24.008, not including
* 3GPP TS 24.008 IEI
*/
offset = offset + 6;
de_cell_id(tvb, cgi_tree, offset, ie_len, NULL, 0);
offset = offset + 2;
return offset;
}
/* 18.4.2 Channel needed */
static int
dissect_bssap_channel_needed(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_channel_needed_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_channel_needed);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/*
* The rest of the information element is coded as the IEI part and the
* value part of the Channel Needed IE defined in 3GPP TS 44.018.
* 10.5.2.8 Channel Needed
*/
de_rr_chnl_needed(tvb, ie_tree, offset, ie_len, NULL, 0);
return offset + ie_len;
}
/* 18.4.3 Downlink Tunnel Payload Control and Info */
static int
dissect_bssap_dlink_tunnel_payload_control_and_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
tvbuff_t *next_tvb;
guint8 ie_len;
guint8 octet;
guint8 prot_disc;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_dlink_tnl_pld_cntrl_amd_inf_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_dlink_tnl_pld_cntrl_amd_inf);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* Bit 8 Spare */
/* Bit 7 - 4
* TOM Protocol Discriminator: Identifies the protocol using tunnelling of non-GSM signalling.
* For coding, see 3GPP TS 44.064.
*/
proto_tree_add_item(ie_tree, hf_bssap_tom_prot_disc, tvb, offset, 1, FALSE);
octet = tvb_get_guint8(tvb,offset);
prot_disc = (octet&0x78)>>3;
/* octet 3 bit 3 E: Cipher Request. When set to 1 indicates that the SGSN received the payload in ciphered form,
* when set to 0 indicates that the SGSN did not receive the payload in ciphered form.
*/
proto_tree_add_item(ie_tree, hf_bssap_e_bit, tvb, offset, 1, FALSE);
/* octet 3 bit 2 - 1
* Tunnel Priority: Indicates the priority of the Tunnel Payload. For coding, see Table 20.1: Association
* between Tunnel Priority and LLC SAPs.
*/
proto_tree_add_item(ie_tree, hf_bssap_tunnel_prio, tvb, offset, 1, FALSE);
/* Tunnel payload */
next_tvb = tvb_new_subset(tvb, offset, ie_len-4, ie_len-4);
if ((prot_disc == 2)&&(rrlp_handle))
call_dissector(rrlp_handle, next_tvb, pinfo, ie_tree);
else
call_dissector(data_handle, next_tvb, pinfo, ie_tree);
return offset + ie_len;
}
/* 18.4.4 eMLPP Priority */
/* Call priority */
static const value_string bssap_call_priority_values[] = {
{ 0x00, "No priority applied" },
{ 0x01, "Call priority level 4" },
{ 0x02, "Call priority level 3" },
{ 0x03, "Call priority level 2" },
{ 0x04, "Call priority level 1" },
{ 0x05, "Call priority level 0" },
{ 0x06, "Call priority level B" },
{ 0x07, "Call priority level A" },
{ 0, NULL }
};
static int
dissect_bssap_emlpp_priority(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_emlpp_prio_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_emlpp_prio);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The rest of the information element is coded as the value part of
the eMLPP-Priority IE defined in 3GPP TS 48.008 (not including
3GPP TS 48.008 IEI and 3GPP TS 48.008 length indicator).
3.2.2.56 eMLPP Priority
The call priority field (bit 3 to 1 of octet 2) is coded in the same way
as the call priority field (bit 3 to 1 of octet 5) in the Descriptive group
or broadcast call reference information element as defined in 3GPP TS 24.008.
*/
proto_tree_add_item(ie_tree, hf_bssap_call_priority, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.5 Erroneous message */
/* Erroneous message including the message type. */
static int
dissect_bssap_gprs_erroneous_msg(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_gprs_erroneous_msg_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_erroneous_msg);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* Erroneous message including the message type. */
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_data, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
static const value_string bssap_plus_GPRS_loc_upd_type_values[] = {
{ 0x00, "Shall not be sent in this version of the protocol. If received, shall be treated as '00000010'." },
{ 0x01, "IMSI attach" },
{ 0x02, "Normal location update" },
{ 0, NULL }
};
/* 18.4.6 GPRS location update type */
static int
dissect_bssap_gprs_location_update_type(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_gprs_loc_upd_type_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_gprs_loc_upd);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* GPRS location update type value (octet 3) */
proto_tree_add_item(ie_tree, hf_bssap_gprs_loc_upd_type, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* Gs Cause value (octet 3) */
static const value_string bssap_Gs_cause_values[] = {
{ 0x00, "Normal, unspecified in this version of the protocol." },
{ 0x01, "IMSI detached for GPRS services" },
{ 0x02, "IMSI detached for GPRS and non-GPRS services" },
{ 0x03, "IMSI unknown" },
{ 0x04, "IMSI detached for non-GPRS services" },
{ 0x05, "IMSI implicitly detached for non-GPRS services" },
{ 0x06, "MS unreachable" },
{ 0x07, "Message not compatible with the protocol state" },
{ 0x08, "Missing mandatory information element" },
{ 0x09, "Invalid mandatory information" },
{ 0x0a, "Conditional IE error" },
{ 0x0b, "Semantically incorrect message" },
{ 0x0c, "Message unknown" },
{ 0x0d, "Address error" },
{ 0x0e, "TOM functionality not supported" },
{ 0x0f, "Ciphering request cannot be accommodated" },
{ 0, NULL }
};
/* 18.4.7 Gs cause */
static int
dissect_bssap_Gs_cause(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_Gs_cause_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bassp_Gs_cause);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* Gs Cause value (octet 3) */
proto_tree_add_item(ie_tree, hf_bssap_Gs_cause, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.8 IMEI */
static int
dissect_bssap_imei(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
tvbuff_t *ie_tvb;
char *digit_str;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_imei_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bassp_imei);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The IMEI is coded as a sequence of BCD digits, compressed two into each octet.
* The IMEI consists of 15 digits (see 3GPP TS 23.003).
*/
ie_tvb = tvb_new_subset(tvb, offset, ie_len, ie_len);
digit_str = unpack_digits(ie_tvb, 0, &Dgt1_9_bcd, FALSE);
proto_tree_add_string(ie_tree, hf_bssap_imei, ie_tvb, 0, -1, digit_str);
return offset + ie_len;
}
/* 18.4.9 IMEISV */
static int
dissect_bssap_imesiv(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
tvbuff_t *ie_tvb;
char *digit_str;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_imesiv_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bassp_imesiv);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The IMEISV is coded as a sequence of BCD digits, compressed two into each octet.
* The IMEISV consists of 16 digits (see 3GPP TS 23.003).
*/
ie_tvb = tvb_new_subset(tvb, offset, ie_len, ie_len);
digit_str = unpack_digits(ie_tvb, 0, &Dgt1_9_bcd, FALSE);
proto_tree_add_string(ie_tree, hf_bssap_imeisv, ie_tvb, 0, -1, digit_str);
return offset + ie_len;
}
/* 18.4.10 IMSI
* The IMSI is coded as a sequence of BCD digits, compressed two into each octet.
* This is a variable length element, and includes a length indicator.
* The IMSI is defined in 3GPP TS 23.003. It shall not exceed 15 digits (see 3GPP TS 23.003).
*/
static int
dissect_bssap_imsi(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
tvbuff_t *ie_tvb;
char *digit_str;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_imsi_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_imsi);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
ie_tvb = tvb_new_subset(tvb, offset, ie_len,ie_len);
digit_str = unpack_digits(ie_tvb, 0, &Dgt1_9_bcd, TRUE);
proto_tree_add_string(ie_tree, hf_bssap_imsi, ie_tvb, 0, -1, digit_str);
return offset + ie_len;
}
static const value_string bssap_imsi_det_from_gprs_serv_type_values[] = {
{ 0x00, "Interpreted as reserved in this version of the protocol" },
{ 0x01, "Network initiated IMSI detach from GPRS service" },
{ 0x02, "MS initiated IMSI detach from GPRS service" },
{ 0x03, "GPRS services not allowed" },
{ 0, NULL }
};
/* 18.4.11 IMSI detach from GPRS service type */
static int
dissect_bssap_imsi_det_from_gprs_serv_type(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_imsi_det_from_gprs_serv_type_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_imsi_det_from_gprs_serv_type);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* IMSI detach from GPRS service type value (octet 3)*/
proto_tree_add_item(ie_tree, hf_bssap_imsi_det_from_gprs_serv_type, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.12 IMSI detach from non-GPRS service type */
static int
dissect_bssap_imsi_det_from_non_gprs_serv_type(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_imsi_det_from_non_gprs_serv_type_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_imsi_det_from_non_gprs_serv_type);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_data, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
static const value_string bssap_info_req_values[] = {
{ 0x00, "Interpreted as Not supported in this version of the protocol." },
{ 0x01, "PTMSI" },
{ 0x02, "IMEI" },
{ 0x03, "IMEISV" },
{ 0x04, "PTMSI and IMEI" },
{ 0x05, "PTMSI and IMEISV" },
{ 0x06, "IMEI and IMEISV" },
{ 0x07, "PTMSI, IMEI, and IMEISV" },
{ 0x08, "Mobile location information" },
{ 0x09, "TMSI" },
{ 0, NULL }
};
/* 18.4.13 Information requested */
static int
dissect_bssap_info_req(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_info_req_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_info_req);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/*Information requested value (octet 3) */
proto_tree_add_item(ie_tree, hf_bssap_info_req, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.14 Location area identifier */
static int
dissect_bssap_loc_area_id(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_loc_area_id_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_loc_area_id);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The rest of the information element is coded as the value part of
* the location area identifier IE defined in 3GPP TS 48.018 (not
* including 3GPP TS 48.018 IEI and 3GPP TS 48.018 length
* indicator).
*/
de_lai(tvb, ie_tree, offset, ie_len, NULL, 0);
return offset + ie_len;
}
/* 18.4.15 Location information age */
static int
dissect_bssap_location_information_age(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_loc_inf_age_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_loc_inf_age);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The rest of the IE is coded as the value part of the
* AgeOfLocationInformation as specified in 3GPP TS 29.002.:
* AgeOfLocationInformation ::= INTEGER (0..32767)
* -- the value represents the elapsed time in minutes since the last
* -- network contact of the mobile station (i.e. the actuality of the
* -- location information).
* -- value '0' indicates that the MS is currently in contact with the
* -- network
* -- value '32767' indicates that the location information is at least
* -- 32767 minutes old
*/
proto_tree_add_item(ie_tree, hf_bssap_loc_inf_age, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.16 MM information */
static int
dissect_bssap_MM_information(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_mm_information_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_mm_information);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* User information: This field is composed of one or more of the
* information elements of the MM information message as defined
* 3GPP TS 24.008, excluding the Protocol discriminator, Skip
* indicator and Message type. This field includes the IEI and length
* indicatior of the other information elements.
*/
dtap_mm_mm_info(tvb, ie_tree, offset, ie_len);
return offset + ie_len;
}
/* 18.4.17 Mobile identity */
static int
dissect_bssap_mobile_id(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_mobile_id_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_mobile_id);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The rest of the information element is coded as the value part of
* the mobile identity IE defined in 3GPP TS 24.008 (not including
* 3GPP TS 24.008 IEI and 3GPP TS 24.008 length indicator).
*/
de_mid(tvb, ie_tree, offset, ie_len, NULL, 0);
return offset + ie_len;
}
/* 18.4.18 Mobile station classmark 1 */
static int
dissect_bssap_mobile_stn_cls_mrk1(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_mobile_stn_cls_mrk1_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_mobile_stn_cls_mrk1);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The rest of the information element is coded as the value part of
* the mobile station classmark 1 IE defined in 3GPP TS 24.008 (not
* including 3GPP TS 24.008 IEI)
*/
de_ms_cm_1(tvb, ie_tree, offset, ie_len, NULL, 0);
return offset + ie_len;
}
/* 18.4.19 Mobile station state */
static const value_string bssap_mobile_station_state_values[] = {
{ 0x00, "IDLE or PMM-DETACHED" },
{ 0x01, "STANDBY or PMM-IDLE, 0 PDP contexts active" },
{ 0x02, "STANDBY or PMM-IDLE, 1 or more PDP contexts active" },
{ 0x03, "SUSPENDED, 0 PDP contexts active" },
{ 0x04, "SUSPENDED, 1 or more PDP contexts active" },
{ 0x05, "READY or PMM-CONNECTED, 0 PDP contexts active" },
{ 0x06, "READY or PMM-CONNECTED, 1 or more PDP contexts active" },
{ 0x07, "IMSI unknown" },
{ 0x08, "Information requested not supported" },
{ 0, NULL }
};
static int
dissect_bssap_mobile_station_state(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_mobile_station_state_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_mobile_station_state);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* Mobile station state value (octet 3) */
proto_tree_add_item(ie_tree, hf_bssap_mobile_station_state, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.20 PTMSI */
static int
dissect_bssap_ptmsi(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_ptmsi_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_ptmsi);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The PTMSI consists of 4 octets. It can be coded using a full hexadecimal representation
* (see 3GPP TS 23.003).
*/
proto_tree_add_item(ie_tree, hf_bssap_ptmsi, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.21 Reject cause */
static int
dissect_bssap_reject_cause(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_reject_cause_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_reject_cause);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The rest of the information element is coded as the value part of
* the reject cause IE defined in 3GPP TS 24.008, not including
* 3GPP TS 24.008 IEI.
*/
de_rej_cause(tvb, ie_tree, offset, ie_len, NULL, 0);
return offset + ie_len;
}
/* 18.4.21b Service Area Identification */
static int
dissect_bssap_service_area_id(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_service_area_id_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_service_area_id);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The rest of the information element is coded as the the value part
* of the SAI IE defined in 3GPP TS 25.413 (not including
* 3GPP TS 25.413 IEI and 3GPP TS 25.413 length indicator).
*/
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_data, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.22 SGSN number */
static const true_false_string bssap_extension_value = {
"No Extension",
"Extension"
};
static int
dissect_bssap_sgsn_number(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
tvbuff_t *number_tvb;
char *digit_str;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_sgsn_nr_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_sgsn_nr);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The SGSN number is coded as a sequence of TBCD digits (as specified in 3GPP TS 29.002),
* compressed two into each octet. The Number is in international E.164 format as indicated by Octet 3
* which coding is specified in 3GPP TS 29.002. This is a variable length information element,
* and includes a length indicator. The value part of the SGSN number information element
* (not including IEI, Length indicator and Octet 3) shall not exceed 15 digits.
*/
proto_tree_add_item(ie_tree, hf_bssap_extension, tvb, offset, 1, FALSE);
proto_tree_add_item(ie_tree, hf_bssap_type_of_number, tvb, offset, 1, FALSE);
proto_tree_add_item(ie_tree, hf_bssap_numbering_plan_id, tvb, offset, 1, FALSE);
offset++;
number_tvb = tvb_new_subset(tvb, offset, ie_len-1,ie_len-1);
digit_str = unpack_digits(number_tvb, 0, &Dgt1_9_bcd, FALSE);
proto_tree_add_string(ie_tree, hf_bssap_sgsn_number, number_tvb, 0, -1, digit_str);
return offset + ie_len-1;
}
/* 18.4.23 TMSI */
static int
dissect_bssap_tmsi(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_tmsi_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_tmsi);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The TMSI consists of 4 octets. It can be coded using a full hexadecimal representation
* (see 3GPP TS 23.003).
*/
proto_tree_add_item(ie_tree, hf_bssap_tmsi, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.24 TMSI status */
static const true_false_string bssap_tmsi_flag = {
"Valid TMSI available",
"No valid TMSI available"
};
static int
dissect_bssap_tmsi_status(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_tmsi_status_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_tmsi_status);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* TMSI flag (octet 3) */
proto_tree_add_item(ie_tree, hf_bssap_tmsi_status, tvb, offset, ie_len, FALSE);
return offset + ie_len;
}
/* 18.4.25 Uplink Tunnel Payload Control and Info */
static const true_false_string bssap_E_flag = {
"SGSN received the payload in ciphered",
"SGSN did not receive the payload in ciphered form"
};
/* 3GPP TS 44.064 B.1.1 TOM Protocol Discriminator */
static const value_string bssap_tom_prot_disc_values[] = {
{ 0x00, "Not specified" },
{ 0x01, "TIA/EIA-136" },
{ 0x02, "RRLP" },
{ 0x03, "Reserved for extension" },
{ 0, NULL }
};
static int
dissect_bssap_ulink_tunnel_payload_control_and_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
tvbuff_t *next_tvb;
guint8 ie_len;
guint8 octet;
guint8 prot_disc;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_ulink_tnl_pld_cntrl_amd_inf_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_ulink_tnl_pld_cntrl_amd_inf);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* octet 3 bit 8 Spare */
/* octet 3 bit 7 - 4
* TOM Protocol Discriminator: Identifies the protocol using tunnelling of non-GSM signalling.
* For coding, see 3GPP TS 44.064.
*/
proto_tree_add_item(ie_tree, hf_bssap_tom_prot_disc, tvb, offset, 1, FALSE);
octet = tvb_get_guint8(tvb,offset);
prot_disc = (octet&0x78)>>3;
/* octet 3 bit 3 E: Cipher Request. When set to 1 indicates that the SGSN received the payload in ciphered form,
* when set to 0 indicates that the SGSN did not receive the payload in ciphered form.
*/
proto_tree_add_item(ie_tree, hf_bssap_e_bit, tvb, offset, 1, FALSE);
/* octet 3 bit 2 - 1
* Tunnel Priority: Indicates the priority of the Tunnel Payload. For coding, see Table 20.1: Association
* between Tunnel Priority and LLC SAPs.
*/
proto_tree_add_item(ie_tree, hf_bssap_tunnel_prio, tvb, offset, 1, FALSE);
/* Tunnel payload */
next_tvb = tvb_new_subset(tvb, offset, ie_len-4, ie_len-4);
if ((prot_disc == 2)&&(rrlp_handle))
call_dissector(rrlp_handle, next_tvb, pinfo, ie_tree);
else
call_dissector(data_handle, next_tvb, pinfo, ie_tree);
return offset + ie_len;
}
/* 18.4.26 VLR number */
static int
dissect_bssap_vlr_number(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
guint8 ie_len;
tvbuff_t *number_tvb;
char *digit_str;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_vlr_number_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_vlr_number);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The VLR number is coded as a sequence of TBCD digits (as specified in 3GPP TS 29.002),
* compressed two into each octet. The Number is in international E.164 format as indicated by Octet 3
* which coding is specified in 3GPP TS 29.002. This is a variable length information element,
* and includes a length indicator. The value part of the VLR number information element
* (not including IEI, length indicator and Octet 3), shall not exceed 15 digits.
*/
proto_tree_add_item(ie_tree, hf_bssap_extension, tvb, offset, 1, FALSE);
proto_tree_add_item(ie_tree, hf_bssap_type_of_number, tvb, offset, 1, FALSE);
proto_tree_add_item(ie_tree, hf_bssap_numbering_plan_id, tvb, offset, 1, FALSE);
offset++;
number_tvb = tvb_new_subset(tvb, offset, ie_len-1,ie_len-1);
digit_str = unpack_digits(number_tvb, 0, &Dgt1_9_bcd, FALSE);
proto_tree_add_string(ie_tree, hf_bssap_sgsn_number, number_tvb, 0, -1, digit_str);
return offset + ie_len-1;
}
/* 18.4.27 Global CN-Id */
static int
dissect_bssap_global_cn_id(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item *item = NULL;
proto_tree *ie_tree = NULL;
proto_item *plmn_item = NULL;
proto_tree *plmn_tree = NULL;
proto_item *global_cn_id_item = NULL;
proto_tree *global_cn_id_tree = NULL;
guint8 ie_len;
ie_len = tvb_get_guint8(tvb,offset+1);
item = proto_tree_add_item(tree, hf_bssap_global_cn_id_ie, tvb, offset, ie_len+2, FALSE);
ie_tree = proto_item_add_subtree(item, ett_bssap_global_cn);
proto_tree_add_item(ie_tree, hf_bssap_plus_ie, tvb, offset, 1, FALSE);
offset++;
proto_tree_add_item(ie_tree, hf_bssap_plus_ie_len, tvb, offset, 1, FALSE);
offset++;
/* The Global CN-Id consists of a PLMN-Id and a CN-Id, see 3GPP TS 23.003.
* The PLMN-Id consists of MCC and MNC coded according to Location Area Identification
* in 3GPP TS 24.008. The CN-Id is an integer defined by O&M.
* The least significant bit of the CN-Id field is bit 1 of octet 7 and
* the most significant bit is bit 8 of octet 6. If the CN-Id does not fill the field reserved for it,
* the rest of the bits are set to '0'.
*/
global_cn_id_item = proto_tree_add_item(ie_tree, hf_bssap_global_cn_id, tvb, offset, ie_len, FALSE);
global_cn_id_tree = proto_item_add_subtree(global_cn_id_item, ett_bssap_global_cn_id);
/* Octet 3 - 5 PLMN-Id Coded as octets 2 to 4 of the Location Area Identification IE,
* defined in 3GPP TS 24.008 (not including 3GPP TS 24.008 IEI and LAC).
*/
plmn_item = proto_tree_add_item(global_cn_id_tree, hf_bssap_plmn_id, tvb, offset, 3, FALSE);
plmn_tree = proto_item_add_subtree(plmn_item, ett_bssap_plmn);
dissect_e212_mcc_mnc(tvb, plmn_tree, offset);
offset = offset + 3;
/* Octet 6 - 7 CN-Id (INTEGER 0..4095) */
proto_tree_add_item(global_cn_id_tree, hf_bssap_cn_id, tvb, offset, 2, FALSE);
offset = offset+2;
return offset;
}
static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *bssap_item;
proto_tree *bssap_tree = NULL;
guint8 message_type;
int offset = 0;
/*
* Make entry in the Protocol column on summary display
*/
if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BSSAP+");
}
if (pinfo->sccp_info && pinfo->sccp_info->data.co.assoc)
pinfo->sccp_info->data.co.assoc->payload = SCCP_PLOAD_BSSAP;
/* create the BSSAP+ protocol tree */
bssap_item = proto_tree_add_item(tree, proto_bssap, tvb, 0, -1, FALSE);
bssap_tree = proto_item_add_subtree(bssap_item, ett_bssap);
message_type = tvb_get_guint8(tvb,offset);
proto_tree_add_item(bssap_tree, hf_bssap_plus_message_type, tvb, offset, 1,FALSE);
offset++;
if (check_col(pinfo->cinfo, COL_INFO)){
col_set_str(pinfo->cinfo,COL_INFO, val_to_str(message_type,bssap_plus_message_type_values,"Unknown %u"));
}
switch(message_type){
case BSSAP_PAGING_REQUEST:
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* VLR number VLR number 18.4.26 M TLV 5-11 */
if ( check_ie(tvb, tree, &offset, BSSAP_VLR_NUMBER))
offset = dissect_bssap_vlr_number(tvb, bssap_tree, offset);
/* End of mandatory elements */
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* TMSI TMSI 18.4.23 O TLV 6 */
if ( check_optional_ie(tvb, offset, BSSAP_TMSI))
offset = dissect_bssap_tmsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Location area identifier Location area identifier 18.4.14 O TLV 7 */
if ( check_optional_ie(tvb, offset, BSSAP_LOC_AREA_ID))
offset = dissect_bssap_loc_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Channel needed Channel needed 18.4.2 O TLV 3 */
if ( check_optional_ie(tvb, offset, BSSAP_CHANNEL_NEEDED))
offset = dissect_bssap_channel_needed(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* eMLPP Priority eMLPP Priority 18.4.4 O TLV 3 */
if ( check_optional_ie(tvb, offset, BSSAP_EMLPP_PRIORITY))
offset = dissect_bssap_emlpp_priority(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Global CN-Id Global CN-Id 18.4.27 O TLV 7 */
if ( check_optional_ie(tvb, offset, BSSAP_GLOBAL_CN_ID))
offset = dissect_bssap_global_cn_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_PAGING_REJECT: /* 17.1.18 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* Gs Cause Gs Cause 18.4.7 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_GS_CAUSE))
offset = dissect_bssap_Gs_cause(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_DOWNLINK_TUNNEL_REQUEST: /* 17.1.4 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* VLR number VLR number 18.4.26 M TLV 5-11 */
if ( check_ie(tvb, tree, &offset, BSSAP_VLR_NUMBER))
offset = dissect_bssap_vlr_number(tvb, bssap_tree, offset);
/* Downlink Tunnel Payload Control and Info 18.4.3 M TLV 3-223 */
if ( check_ie(tvb, tree, &offset, BSSAP_DLINK_TNL_PLD_CTR_AND_INF))
offset = dissect_bssap_dlink_tunnel_payload_control_and_info(tvb, pinfo, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_UPLINK_TUNNEL_REQUEST: /* 17.1.23 */
/* SGSN number 18.4.22 M TLV 5-11 */
if ( check_ie(tvb, tree, &offset, BSSAP_SGSN_NUMBER))
offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset);
/* Uplink Tunnel Payload Control and Info 18.4.25 M TLV 3-223 */
if ( check_ie(tvb, tree, &offset, BSSAP_ULINK_TNL_PLD_CTR_AND_INF))
offset = dissect_bssap_ulink_tunnel_payload_control_and_info(tvb, pinfo, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
break;
case BSSAP_LOCATION_UPDATE_REQUEST: /* 17.1.11 BSSAP+-LOCATION-UPDATE-REQUEST */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* SGSN number SGSN number 18.4.22 M TLV 5-11 */
if ( check_ie(tvb, tree, &offset, BSSAP_SGSN_NUMBER))
offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset);
/* Update type GPRS location update type 18.4.6 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_GPRS_LOC_UPD_TYPE))
offset = dissect_bssap_gprs_location_update_type(tvb, bssap_tree, offset);
/* New Cell global identity Cell global identity 18.4.1 M TLV 10 */
if ( check_ie(tvb, tree, &offset, BSSAP_CELL_GBL_ID))
offset = dissect_bssap_cell_global_id(tvb, bssap_tree, offset);
/* Mobile station classmark Mobile station classmark 1 18.4.18 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_MOBILE_STN_CLS_MRK1))
offset = dissect_bssap_mobile_stn_cls_mrk1(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Old location area identifier Location area identifier 18.4.14 O TLV 7 */
if ( check_optional_ie(tvb, offset, BSSAP_LOC_AREA_ID))
offset = dissect_bssap_loc_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* TMSI status TMSI status 18.4.24 O TLV 3 */
if ( check_optional_ie(tvb, offset, BSSAP_TMSI_STATUS))
offset = dissect_bssap_tmsi_status(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* New service area identification Service area identification 18.4.21b O TLV 9 */
if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID))
offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* IMEISV IMEISV 18.4.9 O TLV 10 */
if ( check_optional_ie(tvb, offset, BSSAP_IMEISV))
offset = dissect_bssap_imesiv(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_LOCATION_UPDATE_ACCEPT: /* 17.1.9 */
/* IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* Location area identifier Location area identifier 18.4.14 M TLV 7 */
if ( check_ie(tvb, tree, &offset, BSSAP_LOC_AREA_ID))
offset = dissect_bssap_loc_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* New TMSI, or IMSI Mobile identity 18.4.17 O TLV 6-10 */
if ( check_optional_ie(tvb, offset, BSSAP_MOBILE_ID))
offset = dissect_bssap_mobile_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_LOCATION_UPDATE_REJECT: /* 17.1.10 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* Reject cause Reject cause 18.4.21 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_REJECT_CAUSE))
offset = dissect_bssap_reject_cause(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_TMSI_REALLOCATION_COMPLETE: /* 17.1.22 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Cell global identity Cell global identity 18.4.1 O TLV 10 */
if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID))
offset = dissect_bssap_cell_global_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Service area identification Service area identification 18.4.21b O TLV 9 */
if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID))
offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_ALERT_REQUEST: /* 17.1.3 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_ALERT_ACK: /* 17.1.1 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_ALERT_REJECT: /* 17.1.2 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* Gs Cause Gs Cause 18.4.7 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_GS_CAUSE))
offset = dissect_bssap_Gs_cause(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_MS_ACTIVITY_INDICATION: /* 17.1.14 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Cell global identity Cell global identity 18.4.1 O TLV 10 */
if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID))
offset = dissect_bssap_cell_global_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Service area identification Service area identification 18.4.21b O TLV 9 */
if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID))
offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_GPRS_DETACH_INDICATION: /* 17.1.6 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* SGSN number SGSN number 18.4.22 M TLV 5-11 */
if ( check_ie(tvb, tree, &offset, BSSAP_SGSN_NUMBER))
offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset);
/* IMSI detach from GPRS service type IMSI detach from GPRS service type 18.4.17 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI_DET_FROM_GPRS_SERV_TYPE))
offset = dissect_bssap_imsi_det_from_gprs_serv_type(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Cell global identity Cell global identity 18.4.1 O TLV 10 */
if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID))
offset = dissect_bssap_cell_global_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Service area identification Service area identification 18.4.21b O TLV 9 */
if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID))
offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_GPRS_DETACH_ACK: /* 17.1.5 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_IMSI_DETACH_INDICATION: /* 17.1.8 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* SGSN number SGSN number 18.4.22 M TLV 5-11 */
if ( check_ie(tvb, tree, &offset, BSSAP_SGSN_NUMBER))
offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset);
/* Detach type IMSI detach from non-GPRS service type 18.4.11 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI_DET_FROM_NON_GPRS_SERV_TYPE))
offset = dissect_bssap_imsi_det_from_non_gprs_serv_type(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Cell global identity Cell global identity 18.4.1 O TLV 10 */
if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID))
offset = dissect_bssap_cell_global_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Location information age Location information age 18.4.14 O TLV 4 */
if ( check_optional_ie(tvb, offset, BSSAP_LOC_INF_AGE))
offset = dissect_bssap_location_information_age(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Service area identification Service area identification 18.4.21b O TLV 9 */
if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID))
offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_IMSI_DETACH_ACK: /* 17.1.7 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_RESET_INDICATION: /* 17.1.21 */
/* Conditional IE:s */
/* SGSN number SGSN number 18.4.22 C TLV 5-11 */
if ( check_optional_ie(tvb, offset, BSSAP_SGSN_NUMBER)){
offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
}else{
/* VLR number VLR number 18.4.26 C TLV 5-11 */
if ( check_optional_ie(tvb, offset, BSSAP_VLR_NUMBER)){
offset = dissect_bssap_vlr_number(tvb, bssap_tree, offset);
return;
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
}
}
proto_tree_add_text(tree, tvb, offset, -1, "Conditional IE");
break;
case BSSAP_RESET_ACK: /* 17.1.20 */
/* Conditional IE:s */
/* SGSN number SGSN number 18.4.22 C TLV 5-11 */
if ( check_optional_ie(tvb, offset, BSSAP_SGSN_NUMBER)){
offset = dissect_bssap_sgsn_number(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
}else{
/* VLR number VLR number 18.4.26 C TLV 5-11 */
if ( check_optional_ie(tvb, offset, BSSAP_VLR_NUMBER)){
offset = dissect_bssap_vlr_number(tvb, bssap_tree, offset);
return;
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
}
}
proto_tree_add_text(tree, tvb, offset, -1, "Conditional IE");
break;
case BSSAP_MS_INFORMATION_REQUEST: /* 17.1.15 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* Information requested Information requested 18.4.13 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_INFO_REQ))
offset = dissect_bssap_info_req(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_MS_INFORMATION_RESPONSE: /* 17.1.16 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* TMSI TMSI 18.4.23 O TLV 6 */
if ( check_optional_ie(tvb, offset, BSSAP_TMSI))
offset = dissect_bssap_tmsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* PTMSI PTMSI 18.4.20 O TLV 6 BSSAP_PTMSI*/
if ( check_optional_ie(tvb, offset, BSSAP_PTMSI))
offset = dissect_bssap_ptmsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* IMEI IMEI 18.4.8 O TLV 10 */
if ( check_optional_ie(tvb, offset, BSSAP_IMEI))
offset = dissect_bssap_imei(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* IMEISV IMEISV 18.4.9 O TLV 10 BSSAP_IMEISV*/
if ( check_optional_ie(tvb, offset, BSSAP_IMEISV))
offset = dissect_bssap_imesiv(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Cell global identity Cell global identity 18.4.1 O TLV 10 */
if ( check_optional_ie(tvb, offset, BSSAP_CELL_GBL_ID))
offset = dissect_bssap_cell_global_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Location information age Location information age 18.4.15 O TLV 4 */
if ( check_optional_ie(tvb, offset, BSSAP_LOC_INF_AGE))
offset = dissect_bssap_location_information_age(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Mobile station state Mobile station state 18.4.19 O TLV 3 */
if ( check_optional_ie(tvb, offset, BSSAP_MOBILE_STN_STATE))
offset = dissect_bssap_mobile_station_state(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* Service area identification Service area identification 18.4.21b O TLV 9 */
if ( check_optional_ie(tvb, offset, BSSAP_SERVICE_AREA_ID))
offset = dissect_bssap_service_area_id(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_MM_INFORMATION_REQUEST: /* 17.1.12 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
/* MM information MM information 18.4.16 O TLV 3-n */
if ( check_optional_ie(tvb, offset, BSSAP_MM_INFORMATION))
offset = dissect_bssap_MM_information(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_MOBILE_STATUS: /* 17.1.13 */
/* IMSI IMSI 18.4.10 O TLV 6-10 */
if ( check_optional_ie(tvb, offset, BSSAP_MM_INFORMATION))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* Gs Cause Gs Cause 18.4.7 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_GS_CAUSE))
offset = dissect_bssap_Gs_cause(tvb, bssap_tree, offset);
/* Erroneous message Erroneous message 18.4.5 M TLV 3-n BSSAP_ERRONEOUS_MSG*/
if ( check_ie(tvb, tree, &offset, BSSAP_ERRONEOUS_MSG))
offset = dissect_bssap_gprs_erroneous_msg(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
case BSSAP_MS_UNREACHABLE: /* 17.1.17 */
/* IMSI IMSI 18.4.10 M TLV 6-10 */
if ( check_ie(tvb, tree, &offset, BSSAP_IMSI))
offset = dissect_bssap_imsi(tvb, bssap_tree, offset);
/* Gs Cause Gs Cause 18.4.7 M TLV 3 */
if ( check_ie(tvb, tree, &offset, BSSAP_GS_CAUSE))
offset = dissect_bssap_Gs_cause(tvb, bssap_tree, offset);
if (tvb_length_remaining(tvb,offset) == 0)
return;
proto_tree_add_text(tree, tvb, offset, -1, "Extraneous data");
break;
default:
break;
}
}
static gboolean
dissect_bssap_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Is it a BSSAP/BSAP packet?
* If octet_1 == 0x00 and octet_2 == length(tvb) - 2
* or if octet_1 == 0x01 and octet_3 == length(tvb) - 3
* then we'll assume it is a bssap packet
* If octet_1 == 0x00 a further check is done
* to differentiate a BSSMAP BLOCK message from a
* RANAP DirectTransfer (under certain conditions)
*/
switch (tvb_get_guint8(tvb, 0))
{
case 0x00:
if (tvb_get_guint8(tvb, 1) != (tvb_length(tvb) - 2)) { return(FALSE); }
if (tvb_get_guint8(tvb, 2) == 0x40 && tvb_get_guint8(tvb, 3) != 0x01) {
return(FALSE); }
break;
case 0x01:
if (tvb_get_guint8(tvb, 2) != (tvb_length(tvb) - 3)) { return(FALSE); }
break;
default:
return(FALSE);
}
dissect_bssap(tvb, pinfo, tree);
return(TRUE);
}
/* Register the protocol with Wireshark */
void
proto_register_bssap(void)
{
module_t *bssap_module;
/* Setup list of header fields */
static hf_register_info hf[] = {
{ &hf_bssap_pdu_type,
{ "Message Type", "bssap.pdu_type",
FT_UINT8, BASE_HEX, VALS(bssap_pdu_type_values), 0x0,
"", HFILL}},
{ &hf_bsap_pdu_type,
{ "Message Type", "bsap.pdu_type",
FT_UINT8, BASE_HEX, VALS(bsap_pdu_type_values), 0x0,
"", HFILL}},
{ &hf_bssap_dlci_cc,
{ "Control Channel", "bssap.dlci.cc",
FT_UINT8, BASE_HEX, VALS(bssap_cc_values), CC_MASK,
"", HFILL}},
{ &hf_bsap_dlci_cc,
{ "Control Channel", "bsap.dlci.cc",
FT_UINT8, BASE_HEX, VALS(bsap_cc_values), CC_MASK,
"", HFILL}},
{ &hf_bssap_dlci_spare,
{ "Spare", "bssap.dlci.spare",
FT_UINT8, BASE_HEX, NULL, SPARE_MASK,
"", HFILL}},
{ &hf_bsap_dlci_rsvd,
{ "Reserved", "bsap.dlci.rsvd",
FT_UINT8, BASE_HEX, NULL, SPARE_MASK,
"", HFILL}},
{ &hf_bssap_dlci_sapi,
{ "SAPI", "bssap.dlci.sapi",
FT_UINT8, BASE_HEX, VALS(bssap_sapi_values), SAPI_MASK,
"", HFILL}},
{ &hf_bsap_dlci_sapi,
{ "SAPI", "bsap.dlci.sapi",
FT_UINT8, BASE_HEX, VALS(bsap_sapi_values), SAPI_MASK,
"", HFILL}},
{ &hf_bssap_length,
{ "Length", "bssap.length",
FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL}},
{ &hf_bssap_plus_message_type,
{ "Message Type", "bssap_plus.msg_type",
FT_UINT8, BASE_DEC, VALS(bssap_plus_message_type_values), 0x0,
"Message Type", HFILL}},
{ &hf_bssap_plus_ie,
{ "IEI", "bssap_plus.iei",
FT_UINT8, BASE_DEC, VALS(bssap_plus_ie_id_values), 0x0,
"", HFILL}},
{ &hf_bssap_plus_ie_len,
{ "Length indicator", "bssap_plus.iei",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Length indicator", HFILL}},
{ &hf_bssap_extension,
{ "Extension", "bssap.extension",
FT_BOOLEAN, 8, TFS(&bssap_extension_value), 0x80,
"Extension", HFILL }},
{ &hf_bssap_type_of_number,
{ "Type of number", "bssap.type_of_number",
FT_UINT8, BASE_HEX, VALS(gsm_a_type_of_number_values), 0x70,
"Type of number", HFILL }},
{ &hf_bssap_numbering_plan_id,
{ "Numbering plan identification", "bssap.number_plan",
FT_UINT8, BASE_HEX, VALS(gsm_a_numbering_plan_id_values), 0x0f,
"Numbering plan identification", HFILL }},
{ &hf_bssap_sgsn_number,
{ "SGSN number", "bssap.sgsn_number",
FT_STRING, BASE_NONE, NULL, 0,
"SGSN number", HFILL }},
{ &hf_bssap_vlr_number,
{ "VLR number", "bssap.vlr_number",
FT_STRING, BASE_NONE, NULL, 0,
"VLR number", HFILL }},
{ &hf_bssap_cell_global_id_ie,
{ "Cell global identity IE", "bssap.cell_global_id_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Cell global identity IE", HFILL }},
{ &hf_bssap_channel_needed_ie,
{ "Channel needed IE", "bssap.cell_global_id_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Channel needed IE", HFILL }},
{ &hf_bssap_dlink_tnl_pld_cntrl_amd_inf_ie,
{ "Downlink Tunnel Payload Control and Info IE", "bssap.dlink_tnl_pld_cntrl_amd_inf_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Downlink Tunnel Payload Control and Info IE", HFILL }},
{ &hf_bssap_ulink_tnl_pld_cntrl_amd_inf_ie,
{ "Uplink Tunnel Payload Control and Info IE", "bssap.ulink_tnl_pld_cntrl_amd_inf_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Uplink Tunnel Payload Control and Info IE", HFILL }},
{ &hf_bssap_emlpp_prio_ie,
{ "eMLPP Priority IE", "bssap.emlpp_prio_ie",
FT_NONE, BASE_NONE, NULL, 0,
"eMLPP Priority IE", HFILL }},
{ &hf_bssap_gprs_erroneous_msg_ie,
{ "Erroneous message IE", "bssap.erroneous_msg_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Erroneous message IE", HFILL }},
{ &hf_bssap_gprs_loc_upd_type_ie,
{ "GPRS location update type IE", "bssap.loc_upd_type_ie",
FT_NONE, BASE_NONE, NULL, 0,
"GPRS location update type IE", HFILL }},
{ &hf_bssap_Gs_cause_ie,
{ "Gs Cause IE", "bssap.Gs_cause_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Gs Cause IE", HFILL }},
{ &hf_bssap_imei_ie,
{ "IMEI IE", "bssap.imei_ie",
FT_NONE, BASE_NONE, NULL, 0,
"IMEI IE", HFILL }},
{ &hf_bssap_imesiv_ie,
{ "IMEISV IE", "bssap.imesiv",
FT_NONE, BASE_NONE, NULL, 0,
"IMEISV IE", HFILL }},
{ &hf_bssap_imsi_ie,
{ "IMSI IE", "bssap.imsi_ie",
FT_NONE, BASE_NONE, NULL, 0,
"IMSI IE", HFILL }},
{ &hf_bssap_imsi_det_from_gprs_serv_type_ie,
{ "IMSI detach from GPRS service type IE", "bssap.msi_det_from_gprs_serv_type_ie",
FT_NONE, BASE_NONE, NULL, 0,
"IMSI detach from GPRS service type IE", HFILL }},
{ &hf_bssap_imsi_det_from_non_gprs_serv_type_ie,
{ "IMSI detach from non-GPRS servic IE", "bssap.msi_det_from_non_gprs_serv_type_ie",
FT_NONE, BASE_NONE, NULL, 0,
"IMSI detach from non-GPRS servic IE", HFILL }},
{ &hf_bssap_info_req_ie,
{ "Information requested IE", "bssap.info_req_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Information requested IE", HFILL }},
{ &hf_bssap_loc_area_id_ie,
{ "Location area identifier IE", "bssap.loc_area_id_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Location area identifier IE", HFILL }},
{ &hf_bssap_loc_inf_age_ie,
{ "Location information age IE", "bssap.loc_inf_age",
FT_NONE, BASE_NONE, NULL, 0,
"Location information age IE", HFILL }},
{ &hf_bssap_mm_information_ie,
{ "MM information IE", "bssap.mm_information",
FT_NONE, BASE_NONE, NULL, 0,
"MM information IE", HFILL }},
{ &hf_bssap_mobile_id_ie,
{ "Mobile identity IE", "bssap.mobile_id_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Mobile identity IE", HFILL }},
{ &hf_bssap_mobile_stn_cls_mrk1_ie,
{ "Mobile station classmark 1 IE", "bssap.mobile_stn_cls_mrk1_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Mobile station classmark 1 IE", HFILL }},
{ &hf_bssap_mobile_station_state_ie,
{ "Mobile station state IE", "bssap.mobile_station_state_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Mobile station state IE", HFILL }},
{ &hf_bssap_ptmsi_ie,
{ "PTMSI IE", "bssap.ptmsi_ie",
FT_NONE, BASE_NONE, NULL, 0,
"PTMSI IE", HFILL }},
{ &hf_bssap_reject_cause_ie,
{ "Reject cause IE", "bssap.reject_cause_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Reject cause IE", HFILL }},
{ &hf_bssap_service_area_id_ie,
{ "Service area identification IE", "bssap.mobile_stn_cls_mrk1_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Mobile station classmark 1", HFILL }},
{ &hf_bssap_sgsn_nr_ie,
{ "SGSN number IE", "bssap.imsi_ie",
FT_NONE, BASE_NONE, NULL, 0,
"SGSN number IE", HFILL }},
{ &hf_bssap_tmsi_ie,
{ "TMSI IE", "bssap.tmsi_ie",
FT_NONE, BASE_NONE, NULL, 0,
"TMSI IE", HFILL }},
{ &hf_bssap_tmsi_status_ie,
{ "TMSI status IE", "bssap.tmsi_status_ie",
FT_NONE, BASE_NONE, NULL, 0,
"TMSI status IE", HFILL }},
{ &hf_bssap_vlr_number_ie,
{ "VLR number IE", "bssap.vlr_number_ie",
FT_NONE, BASE_NONE, NULL, 0,
"VLR number IE", HFILL }},
{ &hf_bssap_global_cn_id_ie,
{ "Global CN-Id IE", "bssap.global_cn_id_ie",
FT_NONE, BASE_NONE, NULL, 0,
"Global CN-Id IE", HFILL }},
{ &hf_bssap_plus_ie_data,
{ "IE Data", "bssap.ie_data",
FT_BYTES, BASE_NONE, NULL, 0,
"IE Data", HFILL }},
{ &hf_bssap_call_priority,
{ "eMLPP Priority", "bssap.gprs_loc_upd_type",
FT_UINT8, BASE_DEC, VALS(bssap_call_priority_values), 0x07,
"eMLPP Priority", HFILL}},
{ &hf_bssap_gprs_loc_upd_type,
{ "GPRS location update type", "bssap.gprs_loc_upd_type",
FT_UINT8, BASE_DEC, VALS(bssap_plus_GPRS_loc_upd_type_values), 0x0,
"GPRS location update type", HFILL}},
{ &hf_bssap_Gs_cause,
{ "Gs cause", "bssap.gprs_loc_upd_type",
FT_UINT8, BASE_DEC, VALS(bssap_Gs_cause_values), 0x0,
"Gs cause", HFILL}},
{ &hf_bssap_imei,
{ "IMEI", "bssap.imei",
FT_STRING, BASE_NONE, NULL, 0,
"IMEI", HFILL }},
{ &hf_bssap_imeisv,
{ "IMEISV", "bssap.imeisv",
FT_STRING, BASE_NONE, NULL, 0,
"IMEISV", HFILL }},
{ &hf_bssap_imsi,
{ "IMSI", "bssap.imsi",
FT_STRING, BASE_NONE, NULL, 0,
"IMSI", HFILL }},
{ &hf_bssap_imsi_det_from_gprs_serv_type,
{ "IMSI detach from GPRS service type", "bssap.imsi_det_from_gprs_serv_type",
FT_UINT8, BASE_DEC, VALS(bssap_Gs_cause_values), 0x0,
"IMSI detach from GPRS service type", HFILL}},
{ &hf_bssap_info_req,
{ "Information requested", "bssap.info_req",
FT_UINT8, BASE_DEC, VALS(bssap_info_req_values), 0x0,
"Information requested", HFILL}},
{ &hf_bssap_loc_inf_age,
{ "AgeOfLocationInformation in minutes", "bssap.loc_inf_age",
FT_UINT16, BASE_DEC, NULL, 0x0,
"AgeOfLocationInformation in minutes", HFILL}},
{ &hf_bssap_mobile_station_state,
{ "Mobile station state", "bssap.mobile_station_state",
FT_UINT8, BASE_DEC, VALS(bssap_mobile_station_state_values), 0x0,
"Mobile station state", HFILL}},
{ &hf_bssap_ptmsi,
{ "PTMSI", "bssap.ptmsi",
FT_BYTES, BASE_HEX, NULL, 0x0,
"PTMSI", HFILL}},
{ &hf_bssap_tmsi,
{ "TMSI", "bssap.tmsi",
FT_BYTES, BASE_HEX, NULL, 0x0,
"TMSI", HFILL}},
{ &hf_bssap_tmsi_status,
{ "TMSI status", "bssap.tmsi_status",
FT_BOOLEAN, 8, TFS(&bssap_tmsi_flag), 0x01,
"TMSI status", HFILL }},
{ &hf_bssap_tom_prot_disc,
{ "TOM Protocol Discriminator", "bssap.Tom_prot_disc",
FT_UINT8, BASE_DEC, VALS(bssap_tom_prot_disc_values), 0x78,
"TOM Protocol Discriminator", HFILL}},
{ &hf_bssap_e_bit,
{ "E: Cipher Request", "bssap.tmsi_status",
FT_BOOLEAN, 8, TFS(&bssap_E_flag), 0x04,
"E: Cipher Request", HFILL }},
{ &hf_bssap_tunnel_prio,
{ "Tunnel Priority", "bssap.tunnel_prio",
FT_UINT8, BASE_DEC, NULL, 0x0,
"Tunnel Priority", HFILL}},
{ &hf_bssap_global_cn_id,
{ "Global CN-Id", "bssap.global_cn_id",
FT_BYTES, BASE_HEX, NULL, 0x0,
"Global CN-Id", HFILL}},
{ &hf_bssap_plmn_id,
{ "PLMN-Id", "bssap.plmn_id",
FT_BYTES, BASE_HEX, NULL, 0x0,
"PLMN-Id", HFILL}},
{ &hf_bssap_cn_id,
{ "CN-Id", "bssap.cn_id",
FT_UINT16, BASE_DEC, NULL, 0x0,
"CN-Id", HFILL}},
{ &hf_bssap_cell_global_id,
{ "Cell global identity", "bssap.plmn_id",
FT_BYTES, BASE_HEX, NULL, 0x0,
"Cell global identity", HFILL}},
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_bssap,
&ett_bssap_dlci,
&ett_bssap_imsi,
&ett_bssap_imsi_det_from_gprs_serv_type,
&ett_bssap_imsi_det_from_non_gprs_serv_type,
&ett_bssap_info_req,
&ett_bssap_loc_area_id,
&ett_bssap_loc_inf_age,
&ett_bssap_mm_information,
&ett_bssap_mobile_id,
&ett_bssap_sgsn_nr,
&ett_bssap_tmsi,
&ett_bssap_tmsi_status,
&ett_bssap_vlr_number,
&ett_bssap_global_cn,
&ett_bssap_gprs_loc_upd,
&ett_bassp_Gs_cause,
&ett_bassp_imei,
&ett_bassp_imesiv,
&ett_bssap_cell_global_id,
&ett_bssap_cgi,
&ett_bssap_channel_needed,
&ett_bssap_dlink_tnl_pld_cntrl_amd_inf,
&ett_bssap_ulink_tnl_pld_cntrl_amd_inf,
&ett_bssap_emlpp_prio,
&ett_bssap_erroneous_msg,
&ett_bssap_mobile_stn_cls_mrk1,
&ett_bssap_mobile_station_state,
&ett_bssap_ptmsi,
&ett_bssap_reject_cause,
&ett_bssap_service_area_id,
&ett_bssap_global_cn_id,
&ett_bssap_plmn,
};
static enum_val_t bssap_or_bsap_options[] = {
{ "bssap", "BSSAP", BSSAP },
{ "bsap", "BSAP", BSAP },
{ NULL, NULL, 0 }
};
/* Register the protocol name and description */
proto_bssap = proto_register_protocol("BSSAP/BSAP", "BSSAP", "bssap");
/*proto_bssap_plus = proto_register_protocol("BSSAP2", "BSSAP2", "bssap2");*/
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_bssap, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
bssap_module = prefs_register_protocol(proto_bssap, NULL);
prefs_register_enum_preference(bssap_module,
"bsap_or_bssap",
"Identify to sub-dissector as",
"For the sake of sub-dissectors registering to accept data from the BSSAP/BSAP dissector, this defines whether it is identified as BSSAP or BSAP.",
&bssap_or_bsap_global,
bssap_or_bsap_options,
FALSE);
prefs_register_uint_preference(bssap_module, "ssn",
"Subsystem number used for BSSAP",
"Set Subsystem number used for BSSAP/BSSAP+",
10, &global_bssap_ssn);
global_bssap_old_ssn=global_bssap_ssn;
bssap_dissector_table = register_dissector_table("bssap.pdu_type", "BSSAP Message Type", FT_UINT8, BASE_DEC);
bsap_dissector_table = register_dissector_table("bsap.pdu_type", "BSAP Message Type", FT_UINT8, BASE_DEC);
register_init_routine(&init_bssap);
}
static void init_bssap(void) {
dissector_delete("sccp.ssn", global_bssap_old_ssn, bssap_plus_handle);
dissector_add("sccp.ssn", global_bssap_ssn, bssap_plus_handle);
global_bssap_old_ssn=global_bssap_ssn;
}
void
proto_reg_handoff_bssap(void)
{
heur_dissector_add("sccp", dissect_bssap_heur, proto_bssap);
/* BSSAP+ */
bssap_plus_handle = create_dissector_handle(dissect_bssap_plus, proto_bssap);
dissector_add("sccp.ssn", global_bssap_ssn, bssap_plus_handle);
data_handle = find_dissector("data");
rrlp_handle = find_dissector("rrlp");
}
|