Coverage Report

Created: 2025-12-27 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-gsm_a_common.c
Line
Count
Source
1
/* packet-gsm_a_common.c
2
 * Common routines for GSM A Interface dissection
3
 *
4
 * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
5
 * In association with Telos Technology Inc.
6
 *
7
 * Split from packet-gsm_a.c by Neil Piercy <Neil [AT] littlebriars.co.uk>
8
 *
9
 * Wireshark - Network traffic analyzer
10
 * By Gerald Combs <gerald@wireshark.org>
11
 * Copyright 1998 Gerald Combs
12
 *
13
 * SPDX-License-Identifier: GPL-2.0-or-later
14
 */
15
16
#include "config.h"
17
18
#include <math.h>
19
20
#include <epan/packet.h>
21
#include <epan/expert.h>
22
#include <epan/tap.h>
23
#include <epan/stat_tap_ui.h>
24
#include <epan/tfs.h>
25
#include <epan/unit_strings.h>
26
27
#include <wsutil/str_util.h>
28
#include <wsutil/array.h>
29
#include "packet-gsm_a_common.h"
30
#include "packet-bssap.h"
31
#include "packet-gmr1_common.h"
32
#include "packet-e212.h"
33
34
void proto_register_gsm_a_common(void);
35
36
static const value_string gsm_common_elem_strings[] = {
37
    /* Common Information Elements 10.5.1 */
38
    { DE_CELL_ID, "Cell Identity" },
39
    { DE_CIPH_KEY_SEQ_NUM, "Ciphering Key Sequence Number" },
40
    { DE_LAI, "Location Area Identification (LAI)" },
41
    { DE_MID, "Mobile Identity" },
42
    { DE_MS_CM_1, "Mobile Station Classmark 1" },
43
    { DE_MS_CM_2, "Mobile Station Classmark 2" },
44
    { DE_MS_CM_3, "Mobile Station Classmark 3" },
45
    { DE_SPARE_NIBBLE, "Spare Half Octet" },
46
    { DE_D_GB_CALL_REF, "Descriptive group or broadcast call reference" },
47
    { DE_G_CIPH_KEY_NUM, "Group Cipher Key Number" },
48
    { DE_PD_SAPI, "PD and SAPI $(CCBS)$" },
49
    { DE_PRIO, "Priority Level" },
50
    { DE_CN_COMMON_GSM_MAP_NAS_SYS_INFO, "CN Common GSM-MAP NAS system information" },
51
    { DE_CS_DOMAIN_SPEC_SYS_INFO, "CS domain specific system information" },
52
    { DE_PS_DOMAIN_SPEC_SYS_INFO, "PS domain specific system information" },
53
    { DE_PLMN_LIST, "PLMN List" },
54
    { DE_NAS_CONT_FOR_PS_HO, "NAS container for PS HO" },
55
    { DE_MS_NET_FEAT_SUP, "MS network feature support" },
56
    { 0, NULL }
57
};
58
value_string_ext gsm_common_elem_strings_ext = VALUE_STRING_EXT_INIT(gsm_common_elem_strings);
59
60
static const value_string gsm_a_skip_ind_vals[] = {
61
    { 0, "No indication of selected PLMN"},
62
    { 1, "PLMN identity of the Common PLMN in the broadcast system information"},
63
    { 2, "PLMN identity of the first Additional PLMN in the broadcast system information"},
64
    { 3, "PLMN identity of the second Additional PLMN in the broadcast system information"},
65
    { 4, "PLMN identity of the third Additional PLMN in the broadcast system information"},
66
    { 5, "PLMN identity of the fourth Additional PLMN in the broadcast system information"},
67
    { 6, "Reserved"},
68
    { 7, "Reserved"},
69
    { 0, NULL }
70
};
71
72
static const true_false_string gsm_a_extension_value = {
73
    "No Extension",
74
    "Extended"
75
};
76
77
78
/* Mobile Station Classmark Value strings
79
 */
80
81
/* Mobile Station Classmark
82
 * Revision level
83
 */
84
static const value_string gsm_a_msc_rev_vals[] = {
85
    { 0, "Reserved for GSM phase 1"},
86
    { 1, "Used by GSM phase 2 mobile stations"},
87
    { 2, "Used by mobile stations supporting R99 or later versions of the protocol"},
88
    { 3, "Reserved for future use"},
89
    { 0, NULL }
90
};
91
92
/* ES IND (octet 3, bit 5) "Controlled Early Classmark Sending" option implementation */
93
static const true_false_string ES_IND_vals = {
94
    "Controlled Early Classmark Sending option is implemented in the MS",
95
    "Controlled Early Classmark Sending option is not implemented in the MS"
96
};
97
/* A5/1 algorithm supported (octet 3, bit 4) */
98
static const true_false_string A5_1_algorithm_sup_vals = {
99
    "encryption algorithm A5/1 not available",
100
    "encryption algorithm A5/1 available"
101
};
102
/* RF Power Capability (Octet 3) */
103
static const value_string RF_power_capability_vals[] = {
104
    { 0, "class 1"},
105
    { 1, "class 2"},
106
    { 2, "class 3"},
107
    { 3, "class 4"},
108
    { 4, "class 5"},
109
    { 7, "RF Power capability is irrelevant in this information element"},
110
    { 0, NULL }
111
};
112
/* PS capability (pseudo-synchronization capability) (octet 4) */
113
static const true_false_string ps_sup_cap_vals = {
114
    "PS capability present",
115
    "PS capability not present"
116
};
117
/* SS Screening Indicator (octet 4)defined in 3GPP TS 24.080 */
118
static const value_string SS_screening_indicator_vals[] = {
119
    { 0, "Default value of phase 1"},
120
    { 1, "Capability of handling of ellipsis notation and phase 2 error handling "},
121
    { 2, "For future use"},
122
    { 3, "For future use"},
123
    { 0, NULL }
124
};
125
/* SM capability (MT SMS pt to pt capability) (octet 4)*/
126
static const true_false_string SM_capability_vals = {
127
    "Mobile station supports mobile terminated point to point SMS",
128
    "Mobile station does not support mobile terminated point to point SMS"
129
};
130
/* VBS notification reception (octet 4) */
131
static const true_false_string VBS_notification_rec_vals = {
132
    "VBS capability and notifications wanted",
133
    "no VBS capability or no notifications wanted"
134
};
135
/* VGCS notification reception (octet 4) */
136
static const true_false_string VGCS_notification_rec_vals = {
137
    "VGCS capability and notifications wanted",
138
    "no VGCS capability or no notifications wanted"
139
};
140
/* FC Frequency Capability (octet 4 ) */
141
static const true_false_string FC_frequency_cap_vals = {
142
    "The MS does support the E-GSM or R-GSM",
143
    "The MS does not support the E-GSM or R-GSM band"
144
};
145
/* CM3 (octet 5, bit 8) */
146
static const true_false_string CM3_vals = {
147
    "The MS supports options that are indicated in classmark 3 IE",
148
    "The MS does not support any options that are indicated in CM3"
149
};
150
/* LCS VA capability (LCS value added location request notification capability) (octet 5,bit 6) */
151
static const true_false_string LCS_VA_cap_vals = {
152
    "LCS value added location request notification capability supported",
153
    "LCS value added location request notification capability not supported"
154
};
155
/* UCS2 treatment (octet 5, bit 5) */
156
static const true_false_string UCS2_treatment_vals = {
157
    "the ME has no preference between the use of the default alphabet and the use of UCS2",
158
    "the ME has a preference for the default alphabet"
159
};
160
/* SoLSA (octet 5, bit 4) */
161
static const true_false_string SoLSA_vals = {
162
    "The ME supports SoLSA",
163
    "The ME does not support SoLSA"
164
};
165
/* CMSP: CM Service Prompt (octet 5, bit 3) */
166
static const true_false_string CMSP_vals = {
167
    "Network initiated MO CM connection request supported for at least one CM protocol",
168
    "Network initiated MO CM connection request not supported"
169
};
170
/* A5/7 algorithm supported */
171
static const true_false_string A5_7_algorithm_sup_vals = {
172
    "encryption algorithm A5/7 available",
173
    "encryption algorithm A5/7 not available"
174
};
175
/* A5/6 algorithm supported */
176
static const true_false_string A5_6_algorithm_sup_vals = {
177
    "encryption algorithm A5/6 available",
178
    "encryption algorithm A5/6 not available"
179
};
180
/* A5/5 algorithm supported */
181
static const true_false_string A5_5_algorithm_sup_vals = {
182
    "encryption algorithm A5/5 available",
183
    "encryption algorithm A5/5 not available"
184
};
185
/* A5/4 algorithm supported */
186
static const true_false_string A5_4_algorithm_sup_vals = {
187
    "encryption algorithm A5/4 available",
188
    "encryption algorithm A5/4 not available"
189
};
190
/* A5/3 algorithm supported (octet 5, bit 2) */
191
static const true_false_string A5_3_algorithm_sup_vals = {
192
    "encryption algorithm A5/3 available",
193
    "encryption algorithm A5/3 not available"
194
};
195
/* A5/2 algorithm supported (octet 5, bit 1) */
196
static const true_false_string A5_2_algorithm_sup_vals = {
197
    "encryption algorithm A5/2 available",
198
    "encryption algorithm A5/2 not available"
199
};
200
201
static const value_string mobile_identity_type_vals[] = {
202
    { 0, "No Identity"},
203
    { 1, "IMSI"},
204
    { 2, "IMEI"},
205
    { 3, "IMEISV"},
206
    { 4, "TMSI/P-TMSI/M-TMSI"},
207
    { 5, "TMGI and optional MBMS Session Identity"}, /* ETSI TS 124 008 V6.8.0 (2005-03) p326 */
208
    { 0, NULL }
209
};
210
211
static const true_false_string oddevenind_vals = {
212
    "Odd number of identity digits",
213
    "Even number of identity digits"
214
};
215
216
217
const value_string gsm_a_sms_vals[] = {
218
    {  0, "1/4 timeslot (~144 microseconds)" },
219
    {  1, "2/4 timeslot (~288 microseconds)" },
220
    {  2, "3/4 timeslot (~433 microseconds)" },
221
    {  3, "4/4 timeslot (~577 microseconds)" },
222
    {  4, "5/4 timeslot (~721 microseconds)" },
223
    {  5, "6/4 timeslot (~865 microseconds)" },
224
    {  6, "7/4 timeslot (~1009 microseconds)" },
225
    {  7, "8/4 timeslot (~1154 microseconds)" },
226
    {  8, "9/4 timeslot (~1298 microseconds)" },
227
    {  9, "10/4 timeslot (~1442 microseconds)" },
228
    { 10, "11/4 timeslot (~1586 microseconds)" },
229
    { 11, "12/4 timeslot (~1730 microseconds)" },
230
    { 12, "13/4 timeslot (~1874 microseconds)" },
231
    { 13, "14/4 timeslot (~2019 microseconds)" },
232
    { 14, "15/4 timeslot (~2163 microseconds)" },
233
    { 15, "16/4 timeslot (~2307 microseconds)" },
234
    {  0, NULL}
235
};
236
237
static const true_false_string ms_assisted_e_otd_vals = {
238
    "MS assisted E-OTD supported",
239
    "MS assisted E-OTD not supported"
240
};
241
242
static const true_false_string ms_based_e_otd_vals = {
243
    "MS based E-OTD supported",
244
    "MS based E-OTD not supported"
245
};
246
247
static const true_false_string ms_assisted_gps_vals = {
248
    "MS assisted GPS supported",
249
    "MS assisted GPS not supported"
250
};
251
252
static const true_false_string ms_based_gps_vals = {
253
    "MS based GPS supported",
254
    "MS based GPS not supported"
255
};
256
257
static const true_false_string ms_conventional_gps_vals = {
258
    "Conventional GPS supported",
259
    "Conventional GPS not supported"
260
};
261
262
static const true_false_string modulation_capability_vals = {
263
    "8-PSK supported for uplink transmission and downlink reception",
264
    "8-PSK supported for downlink reception only"
265
};
266
267
static const value_string eight_psk_rf_power_capability_vals[] = {
268
    { 0, "Reserved" },
269
    { 1, "Power class E1" },
270
    { 2, "Power class E2" },
271
    { 3, "Power class E3" },
272
    { 0, NULL}
273
};
274
275
static const value_string gsm_400_bands_supported_vals[] = {
276
    { 1, "GSM 480 supported, GSM 450 not supported" },
277
    { 2, "GSM 450 supported, GSM 480 not supported" },
278
    { 3, "GSM 450 supported, GSM 480 supported" },
279
    { 0, NULL}
280
};
281
282
static const true_false_string umts_fdd_rat_cap_vals = {
283
    "UMTS FDD supported",
284
    "UMTS FDD not supported"
285
};
286
287
static const true_false_string umts_384_mcps_tdd_rat_cap_vals = {
288
    "UMTS 3.84 Mcps TDD supported",
289
    "UMTS 3.84 Mcps TDD not supported"
290
};
291
292
static const true_false_string cdma_2000_rat_cap_vals = {
293
    "CDMA 2000 supported",
294
    "CDMA 2000 not supported"
295
};
296
297
static const value_string dtm_gprs_multi_slot_class_vals[] = {
298
    { 0, "Unused. If received, the network shall interpret this as 1" },
299
    { 1, "Multislot class 5 supported" },
300
    { 2, "Multislot class 9 supported" },
301
    { 3, "Multislot class 11 supported" },
302
    { 0, NULL}
303
};
304
305
static const true_false_string single_slot_dtm_vals = {
306
    "Single Slot DTM supported",
307
    "Single Slot DTM not supported"
308
};
309
310
static const value_string gsm_band_vals[] = {
311
    { 0, "E-GSM is supported" },
312
    { 1, "P-GSM is supported" },
313
    { 2, "GSM 1800 is supported" },
314
    { 3, "GSM 450 is supported" },
315
    { 4, "GSM 480 is supported" },
316
    { 5, "GSM 850 is supported" },
317
    { 6, "GSM 1900 is supported" },
318
    { 7, "GSM 750 is supported" },
319
    { 8, "GSM 710 is supported" },
320
    { 9, "T-GSM 810 is supported" },
321
    { 0, NULL}
322
};
323
324
static const true_false_string umts_128_mcps_tdd_rat_cap_vals = {
325
    "UMTS 1.28 Mcps TDD supported",
326
    "UMTS 1.28 Mcps TDD not supported"
327
};
328
329
static const true_false_string geran_feature_package_1_vals = {
330
    "GERAN feature package 1 supported",
331
    "GERAN feature package 1 not supported"
332
};
333
334
static const true_false_string flo_iu_cap_vals = {
335
    "FLO in GERAN Iu Mode supported",
336
    "FLO in GERAN Iu Mode not supported"
337
};
338
339
static const true_false_string geran_feature_package_2_vals = {
340
    "GERAN feature package 2 supported",
341
    "GERAN feature package 2 not supported"
342
};
343
344
static const value_string gmsk_multislot_power_prof_vals[] = {
345
    { 0, "GMSK_MULTISLOT_POWER_PROFILE 0" },
346
    { 1, "GMSK_MULTISLOT_POWER_PROFILE 1" },
347
    { 2, "GMSK_MULTISLOT_POWER_PROFILE 2" },
348
    { 3, "GMSK_MULTISLOT_POWER_PROFILE 3" },
349
    { 0, NULL}
350
};
351
352
static const value_string eight_psk_multislot_power_prof_vals[] = {
353
    { 0, "8-PSK_MULTISLOT_POWER_PROFILE 0" },
354
    { 1, "8-PSK_MULTISLOT_POWER_PROFILE 1" },
355
    { 2, "8-PSK_MULTISLOT_POWER_PROFILE 2" },
356
    { 3, "8-PSK_MULTISLOT_POWER_PROFILE 3" },
357
    { 0, NULL}
358
};
359
360
static const value_string t_gsm_400_bands_supported_vals[] = {
361
    { 1, "T-GSM 380 supported, T-GSM 410 not supported" },
362
    { 2, "T-GSM 410 supported, T-GSM 380 not supported" },
363
    { 3, "T-GSM 410 supported, T-GSM 380 supported" },
364
    { 0, NULL}
365
};
366
367
static const value_string downlink_adv_receiver_perf_vals[] = {
368
    { 0, "Downlink Advanced Receiver Performance not supported" },
369
    { 1, "Downlink Advanced Receiver Performance - phase I supported" },
370
    { 2, "Downlink Advanced Receiver Performance - phase II supported" },
371
    { 0, NULL}
372
};
373
374
static const true_false_string dtm_enhancements_cap_vals = {
375
    "The mobile station supports enhanced DTM CS establishment and release procedures",
376
    "The mobile station does not support enhanced DTM CS establishment and release procedures"
377
};
378
379
static const true_false_string offset_required_vals = {
380
    "The mobile station requires the offset",
381
    "The mobile station does not require the offset"
382
};
383
384
static const value_string dtm_gprs_high_multi_slot_class_vals[] = {
385
    { 0, "Unused. If received, the network shall interpret this as \"0 0 1\"" },
386
    { 1, "Multislot class 31 or 36 supported" },
387
    { 2, "Multislot class 32 or 37 supported" },
388
    { 3, "Multislot class 33 or 38 supported" },
389
    { 4, "Multislot class 41 supported" },
390
    { 5, "Multislot class 42 supported" },
391
    { 6, "Multislot class 43 supported" },
392
    { 7, "Multislot class 44 supported" },
393
    { 0, NULL}
394
};
395
396
static const true_false_string repeated_acch_cap_vals = {
397
    "The mobile station supports Repeated SACCH and Repeated Downlink FACCH",
398
    "The mobile station does not support Repeated SACCH"
399
};
400
401
static const true_false_string ciphering_mode_setting_cap_vals = {
402
    "The mobile station supports the Ciphering Mode Setting IE in the DTM ASSIGNMENT COMMAND message",
403
    "The mobile station does not support the Ciphering Mode Setting IE in the DTM ASSIGNMENT COMMAND message"
404
};
405
406
static const true_false_string additional_positioning_caps_vals = {
407
    "The mobile station supports additional positioning capabilities which can be retrieved using RRLP",
408
    "The mobile station does not support additional positioning capabilities which can be retrieved using RRLP"
409
};
410
411
static const true_false_string e_utra_fdd_support_vals = {
412
    "E-UTRA FDD supported",
413
    "E-UTRA FDD not supported"
414
};
415
416
static const true_false_string e_utra_tdd_support_vals = {
417
    "E-UTRA TDD supported",
418
    "E-UTRA TDD not supported"
419
};
420
421
static const true_false_string e_utra_meas_and_report_support_vals = {
422
    "E-UTRAN Neighbour Cell measurements and measurement reporting while having an RR connection supported",
423
    "E-UTRAN Neighbour Cell measurements and measurement reporting while having an RR connection not supported"
424
};
425
426
static const true_false_string prio_based_resel_support_vals = {
427
    "Priority-based cell reselection supported",
428
    "Priority-based cell reselection not supported"
429
};
430
431
static const true_false_string utra_csg_cells_reporting_vals = {
432
    "Reporting of UTRAN CSG cells supported",
433
    "Reporting of UTRAN CSG cells not supported"
434
};
435
436
static const value_string vamos_level_vals[] = {
437
    { 0, "VAMOS not supported" },
438
    { 1, "VAMOS I supported" },
439
    { 2, "VAMOS II supported" },
440
    { 3, "VAMOS III supported" },
441
    { 0, NULL}
442
};
443
444
const value_string tighter_cap_level_vals[] = {
445
    { 0, "TIGHTER not supported" },
446
    { 1, "TIGHTER supported for speech and signalling channels only" },
447
    { 2, "TIGHTER supported for speech and signalling channels and for GPRS and EGPRS, but not for EGPRS2" },
448
    { 3, "TIGHTER supported for speech and signalling channels and for GPRS, EGPRS and EGPRS2" },
449
    { 0, NULL}
450
};
451
452
static const value_string cs_to_ps_srvcc_geran_to_utra_vals[] = {
453
    { 0, "CS to PS SRVCC from GERAN to UMTS FDD and 1.28 Mcps TDD not supported" },
454
    { 1, "CS to PS SRVCC from GERAN to UMTS FDD supported" },
455
    { 2, "CS to PS SRVCC from GERAN to UMTS 1.28 Mcps TDD supported" },
456
    { 3, "CS to PS SRVCC from GERAN to UMTS FDD and 1.28 Mcps TDD supported" },
457
    { 0, NULL}
458
};
459
460
static const value_string cs_to_ps_srvcc_geran_to_eutra_vals[] = {
461
    { 0, "CS to PS SRVCC from GERAN to E-UTRA FDD and TDD not supported" },
462
    { 1, "CS to PS SRVCC from GERAN to E-UTRA FDD supported" },
463
    { 2, "CS to PS SRVCC from GERAN to E-UTRA TDD supported" },
464
    { 3, "CS to PS SRVCC from GERAN to E-UTRA FDD and TDD supported" },
465
    { 0, NULL}
466
};
467
468
static const value_string gsm_a_rr_rxlev_vals [] = {
469
    {  0, "< -110 dBm"},
470
    {  1, "-110 <= x < -109 dBm"},
471
    {  2, "-109 <= x < -108 dBm"},
472
    {  3, "-108 <= x < -107 dBm"},
473
    {  4, "-107 <= x < -106 dBm"},
474
    {  5, "-106 <= x < -105 dBm"},
475
    {  6, "-105 <= x < -104 dBm"},
476
    {  7, "-104 <= x < -103 dBm"},
477
    {  8, "-103 <= x < -102 dBm"},
478
    {  9, "-102 <= x < -101 dBm"},
479
    { 10, "-101 <= x < -100 dBm"},
480
    { 11, "-100 <= x < -99 dBm"},
481
    { 12, "-99 <= x < -98 dBm"},
482
    { 13, "-98 <= x < -97 dBm"},
483
    { 14, "-97 <= x < -96 dBm"},
484
    { 15, "-96 <= x < -95 dBm"},
485
    { 16, "-95 <= x < -94 dBm"},
486
    { 17, "-94 <= x < -93 dBm"},
487
    { 18, "-93 <= x < -92 dBm"},
488
    { 19, "-92 <= x < -91 dBm"},
489
    { 20, "-91 <= x < -90 dBm"},
490
    { 21, "-90 <= x < -89 dBm"},
491
    { 22, "-89 <= x < -88 dBm"},
492
    { 23, "-88 <= x < -87 dBm"},
493
    { 24, "-87 <= x < -86 dBm"},
494
    { 25, "-86 <= x < -85 dBm"},
495
    { 26, "-85 <= x < -84 dBm"},
496
    { 27, "-84 <= x < -83 dBm"},
497
    { 28, "-83 <= x < -82 dBm"},
498
    { 29, "-82 <= x < -81 dBm"},
499
    { 30, "-81 <= x < -80 dBm"},
500
    { 31, "-80 <= x < -79 dBm"},
501
    { 32, "-79 <= x < -78 dBm"},
502
    { 33, "-78 <= x < -77 dBm"},
503
    { 34, "-77 <= x < -76 dBm"},
504
    { 35, "-76 <= x < -75 dBm"},
505
    { 36, "-75 <= x < -74 dBm"},
506
    { 37, "-74 <= x < -73 dBm"},
507
    { 38, "-73 <= x < -72 dBm"},
508
    { 39, "-72 <= x < -71 dBm"},
509
    { 40, "-71 <= x < -70 dBm"},
510
    { 41, "-70 <= x < -69 dBm"},
511
    { 42, "-69 <= x < -68 dBm"},
512
    { 43, "-68 <= x < -67 dBm"},
513
    { 44, "-67 <= x < -66 dBm"},
514
    { 45, "-66 <= x < -65 dBm"},
515
    { 46, "-65 <= x < -64 dBm"},
516
    { 47, "-64 <= x < -63 dBm"},
517
    { 48, "-63 <= x < -62 dBm"},
518
    { 49, "-62 <= x < -61 dBm"},
519
    { 50, "-61 <= x < -60 dBm"},
520
    { 51, "-60 <= x < -59 dBm"},
521
    { 52, "-59 <= x < -58 dBm"},
522
    { 53, "-58 <= x < -57 dBm"},
523
    { 54, "-57 <= x < -56 dBm"},
524
    { 55, "-56 <= x < -55 dBm"},
525
    { 56, "-55 <= x < -54 dBm"},
526
    { 57, "-54 <= x < -53 dBm"},
527
    { 58, "-53 <= x < -52 dBm"},
528
    { 59, "-52 <= x < -51 dBm"},
529
    { 60, "-51 <= x < -50 dBm"},
530
    { 61, "-50 <= x < -49 dBm"},
531
    { 62, "-49 <= x < -48 dBm"},
532
    { 63, ">= -48 dBm"},
533
    { 0, NULL}
534
};
535
value_string_ext gsm_a_rr_rxlev_vals_ext = VALUE_STRING_EXT_INIT(gsm_a_rr_rxlev_vals);
536
537
const value_string gsm_a_rr_rxqual_vals[] = {
538
    {0, "BER < 0.2%, Mean value 0.14%"},
539
    {1, "0.2% <= BER < 0.4%, Mean value 0.28%"},
540
    {2, "0.4% <= BER < 0.8%, Mean value 0.57%"},
541
    {3, "0.8% <= BER < 1.6%, Mean value 1.13%"},
542
    {4, "1.6% <= BER < 3.2%, Mean value 2.26%"},
543
    {5, "3.2% <= BER < 6.4%, Mean value 4.53%"},
544
    {6, "6.4% <= BER < 12.8%, Mean value 9.05%"},
545
    {7, "BER > 12.8%, Mean value 18.10%"},
546
    {0, NULL}
547
};
548
549
/* Initialize the protocol and registered fields */
550
static int proto_a_common;
551
static int proto_3gpp;
552
553
int gsm_a_tap;
554
555
int hf_gsm_a_common_elem_id;
556
static int hf_gsm_a_common_elem_id_f0;
557
static int hf_gsm_a_l_ext;
558
int hf_gsm_a_tmsi;
559
static int hf_gsm_a_imei;
560
static int hf_gsm_a_imeisv;
561
562
static int hf_gsm_a_MSC_rev;
563
static int hf_gsm_a_ES_IND;
564
static int hf_gsm_a_A5_1_algorithm_sup;
565
static int hf_gsm_a_RF_power_capability;
566
static int hf_gsm_a_ps_sup_cap;
567
static int hf_gsm_a_SS_screening_indicator;
568
static int hf_gsm_a_SM_capability;
569
static int hf_gsm_a_VBS_notification_rec;
570
static int hf_gsm_a_VGCS_notification_rec;
571
static int hf_gsm_a_FC_frequency_cap;
572
static int hf_gsm_a_CM3;
573
static int hf_gsm_a_LCS_VA_cap;
574
static int hf_gsm_a_UCS2_treatment;
575
static int hf_gsm_a_SoLSA;
576
static int hf_gsm_a_CMSP;
577
static int hf_gsm_a_A5_7_algorithm_sup;
578
static int hf_gsm_a_A5_6_algorithm_sup;
579
static int hf_gsm_a_A5_5_algorithm_sup;
580
static int hf_gsm_a_A5_4_algorithm_sup;
581
static int hf_gsm_a_A5_3_algorithm_sup;
582
static int hf_gsm_a_A5_2_algorithm_sup;
583
584
static int hf_gsm_a_odd_even_ind;
585
static int hf_gsm_a_id_dig_1;
586
static int hf_gsm_a_unused;
587
static int hf_gsm_a_mobile_identity_type;
588
static int hf_gsm_a_tmgi_mcc_mnc_ind;
589
static int hf_gsm_a_mbs_ses_id_ind;
590
static int hf_gsm_a_mbs_service_id;
591
static int hf_gsm_a_mbs_session_id;
592
static int hf_gsm_a_length;
593
static int hf_gsm_a_element_value;
594
int hf_gsm_a_extension;
595
int hf_gsm_a_L3_protocol_discriminator;
596
int hf_gsm_a_call_prio;
597
int hf_gsm_a_skip_ind;
598
int hf_gsm_a_spare_bits;
599
int hf_gsm_a_lac;
600
601
static int hf_gsm_a_spare_nibble;
602
static int hf_gsm_a_type_of_ciph_alg;
603
static int hf_gsm_a_att;
604
static int hf_gsm_a_nmo_1;
605
static int hf_gsm_a_nmo;
606
static int hf_gsm_a_old_xid;
607
static int hf_gsm_a_iov_ui;
608
static int hf_gsm_a_ext_periodic_timers;
609
static int hf_gsm_a_b7spare;
610
int hf_gsm_a_b8spare;
611
static int hf_gsm_a_multi_bnd_sup_fields;
612
static int hf_gsm_a_pgsm_supported;
613
static int hf_gsm_a_egsm_supported;
614
static int hf_gsm_a_gsm1800_supported;
615
static int hf_gsm_a_ass_radio_cap1;
616
static int hf_gsm_a_ass_radio_cap2;
617
static int hf_gsm_a_rsupport;
618
static int hf_gsm_a_r_capabilities;
619
static int hf_gsm_a_multislot_capabilities;
620
static int hf_gsm_a_multislot_class;
621
static int hf_gsm_a_ucs2_treatment;
622
static int hf_gsm_a_extended_measurement_cap;
623
static int hf_gsm_a_ms_measurement_capability;
624
static int hf_gsm_a_sms_value;
625
static int hf_gsm_a_sm_value;
626
static int hf_gsm_a_key_seq;
627
static int hf_gsm_a_ms_pos_method_cap_present;
628
static int hf_gsm_a_ms_pos_method;
629
static int hf_gsm_a_ms_assisted_e_otd;
630
static int hf_gsm_a_ms_based_e_otd;
631
static int hf_gsm_a_ms_assisted_gps;
632
static int hf_gsm_a_ms_based_gps;
633
static int hf_gsm_a_ms_conventional_gps;
634
static int hf_gsm_a_ecsd_multi_slot_capability;
635
static int hf_gsm_a_ecsd_multi_slot_class;
636
static int hf_gsm_a_8_psk_struct_present;
637
static int hf_gsm_a_8_psk_struct;
638
static int hf_gsm_a_modulation_capability;
639
static int hf_gsm_a_8_psk_rf_power_capability_1_present;
640
static int hf_gsm_a_8_psk_rf_power_capability_1;
641
static int hf_gsm_a_8_psk_rf_power_capability_2_present;
642
static int hf_gsm_a_8_psk_rf_power_capability_2;
643
static int hf_gsm_a_gsm_400_band_info_present;
644
static int hf_gsm_a_gsm_400_bands_supported;
645
static int hf_gsm_a_gsm_400_assoc_radio_cap;
646
static int hf_gsm_a_gsm_850_assoc_radio_cap_present;
647
static int hf_gsm_a_gsm_850_assoc_radio_cap;
648
static int hf_gsm_a_gsm_1900_assoc_radio_cap_present;
649
static int hf_gsm_a_gsm_1900_assoc_radio_cap;
650
static int hf_gsm_a_cm3_A5_bits;
651
static int hf_gsm_a_umts_fdd_rat_cap;
652
static int hf_gsm_a_umts_384_mcps_tdd_rat_cap;
653
static int hf_gsm_a_cdma_2000_rat_cap;
654
static int hf_gsm_a_dtm_e_gprs_multi_slot_info_present;
655
static int hf_gsm_a_dtm_gprs_multi_slot_class;
656
static int hf_gsm_a_single_slot_dtm;
657
static int hf_gsm_a_dtm_egprs_multi_slot_class_present;
658
static int hf_gsm_a_dtm_egprs_multi_slot_class;
659
static int hf_gsm_a_single_band_support;
660
static int hf_gsm_a_gsm_band;
661
static int hf_gsm_a_gsm_750_assoc_radio_cap_present;
662
static int hf_gsm_a_gsm_750_assoc_radio_cap;
663
static int hf_gsm_a_umts_128_mcps_tdd_rat_cap;
664
static int hf_gsm_a_geran_feature_package_1;
665
static int hf_gsm_a_ext_dtm_e_gprs_multi_slot_info_present;
666
static int hf_gsm_a_ext_dtm_gprs_multi_slot_class;
667
static int hf_gsm_a_ext_dtm_egprs_multi_slot_class;
668
static int hf_gsm_a_high_multislot_cap_present;
669
static int hf_gsm_a_high_multislot_cap;
670
static int hf_gsm_a_geran_iu_mode_support;
671
static int hf_gsm_a_geran_iu_mode_cap;
672
static int hf_gsm_a_geran_iu_mode_cap_length;
673
static int hf_gsm_a_flo_iu_cap;
674
static int hf_gsm_a_geran_feature_package_2;
675
static int hf_gsm_a_gmsk_multislot_power_prof;
676
static int hf_gsm_a_8_psk_multislot_power_prof;
677
static int hf_gsm_a_t_gsm_400_band_info_present;
678
static int hf_gsm_a_t_gsm_400_bands_supported;
679
static int hf_gsm_a_t_gsm_400_assoc_radio_cap;
680
static int hf_gsm_a_t_gsm_900_assoc_radio_cap_present;
681
static int hf_gsm_a_t_gsm_900_assoc_radio_cap;
682
static int hf_gsm_a_downlink_adv_receiver_perf;
683
static int hf_gsm_a_dtm_enhancements_cap;
684
static int hf_gsm_a_dtm_e_gprs_high_multi_slot_info_present;
685
static int hf_gsm_a_dtm_gprs_high_multi_slot_class;
686
static int hf_gsm_a_offset_required;
687
static int hf_gsm_a_dtm_egprs_high_multi_slot_class_present;
688
static int hf_gsm_a_dtm_egprs_high_multi_slot_class;
689
static int hf_gsm_a_repeated_acch_cap;
690
static int hf_gsm_a_gsm_710_assoc_radio_cap_present;
691
static int hf_gsm_a_gsm_710_assoc_radio_cap;
692
static int hf_gsm_a_t_gsm_810_assoc_radio_cap_present;
693
static int hf_gsm_a_t_gsm_810_assoc_radio_cap;
694
static int hf_gsm_a_ciphering_mode_setting_cap;
695
static int hf_gsm_a_additional_positioning_caps;
696
static int hf_gsm_a_e_utra_fdd_support;
697
static int hf_gsm_a_e_utra_tdd_support;
698
static int hf_gsm_a_e_utra_meas_and_report_support;
699
static int hf_gsm_a_prio_based_resel_support;
700
static int hf_gsm_a_utra_csg_cells_reporting;
701
static int hf_gsm_a_vamos_level;
702
static int hf_gsm_a_tighter_cap;
703
static int hf_gsm_a_selective_ciph_down_sacch;
704
static int hf_gsm_a_cs_to_ps_srvcc_geran_to_utra;
705
static int hf_gsm_a_cs_to_ps_srvcc_geran_to_eutra;
706
static int hf_gsm_a_geran_network_sharing_support;
707
static int hf_gsm_a_eutra_wb_rsrq_support;
708
static int hf_gsm_a_er_band_support;
709
static int hf_gsm_a_utra_mfbi_support;
710
static int hf_gsm_a_eutra_mfbi_support;
711
static int hf_gsm_a_ext_tsc_set_cap_support;
712
static int hf_gsm_a_ext_earfcn_value_range;
713
714
static int hf_gsm_a_geo_loc_type_of_shape;
715
static int hf_gsm_a_geo_loc_sign_of_lat;
716
static int hf_gsm_a_geo_loc_deg_of_lat;
717
static int hf_gsm_a_geo_loc_deg_of_long;
718
static int hf_gsm_a_geo_loc_osm_uri;
719
static int hf_gsm_a_geo_loc_uncertainty_code;
720
static int hf_gsm_a_geo_loc_uncertainty_semi_major;
721
static int hf_gsm_a_geo_loc_uncertainty_semi_minor;
722
static int hf_gsm_a_geo_loc_orientation_of_major_axis;
723
static int hf_gsm_a_geo_loc_uncertainty_altitude;
724
static int hf_gsm_a_geo_loc_confidence;
725
static int hf_gsm_a_geo_loc_uncertainty_range;
726
static int hf_gsm_a_geo_loc_horizontal_confidence;
727
static int hf_gsm_a_geo_loc_horizontal_uncertainty_range;
728
static int hf_gsm_a_geo_loc_vertical_confidence;
729
static int hf_gsm_a_geo_loc_vertical_uncertainty_range;
730
static int hf_gsm_a_geo_loc_high_acc_uncertainty_alt;
731
static int hf_gsm_a_geo_loc_no_of_points;
732
static int hf_gsm_a_geo_loc_high_acc_deg_of_lat;
733
static int hf_gsm_a_geo_loc_high_acc_deg_of_long;
734
static int hf_gsm_a_geo_loc_high_acc_uncertainty_semi_major;
735
static int hf_gsm_a_geo_loc_high_acc_uncertainty_semi_minor;
736
static int hf_gsm_a_geo_loc_high_acc_alt;
737
static int hf_gsm_a_velocity_type;
738
static int hf_gsm_a_bearing;
739
static int hf_gsm_a_horizontal_speed;
740
static int hf_gsm_a_uncertainty_speed;
741
static int hf_gsm_a_h_uncertainty_speed;
742
static int hf_gsm_a_v_uncertainty_speed;
743
static int hf_gsm_a_vertical_speed;
744
static int hf_gsm_a_d;
745
static int hf_gsm_a_geo_loc_D;
746
static int hf_gsm_a_geo_loc_altitude;
747
static int hf_gsm_a_geo_loc_inner_radius;
748
static int hf_gsm_a_geo_loc_uncertainty_radius;
749
static int hf_gsm_a_geo_loc_offset_angle;
750
static int hf_gsm_a_geo_loc_included_angle;
751
752
/* Generated from convert_proto_tree_add_text.pl */
753
static int hf_gsm_a_filler;
754
static int hf_gsm_a_identity_digit1;
755
static int hf_gsm_a_group_call_reference;
756
static int hf_gsm_a_service_flag;
757
static int hf_gsm_a_af_acknowledgement;
758
static int hf_gsm_a_call_priority;
759
static int hf_gsm_a_ciphering_info;
760
static int hf_gsm_a_sapi;
761
762
/* Inter protocol hf */
763
int hf_3gpp_tmsi;
764
765
static int ett_gsm_a_plmn;
766
static int ett_gsm_a_poly_pnt;
767
768
static expert_field ei_gsm_a_extraneous_data;
769
static expert_field ei_gsm_a_unknown_element;
770
static expert_field ei_gsm_a_unknown_pdu_type;
771
static expert_field ei_gsm_a_no_element_dissector;
772
static expert_field ei_gsm_a_format_not_supported;
773
static expert_field ei_gsm_a_mobile_identity_type;
774
static expert_field ei_gsm_a_ie_length_too_short;
775
776
sccp_assoc_info_t* sccp_assoc;
777
778
280
#define NUM_GSM_COMMON_ELEM array_length(gsm_common_elem_strings)
779
int ett_gsm_common_elem[NUM_GSM_COMMON_ELEM];
780
781
782
298
#define  ELLIPSOID_POINT 0
783
643
#define  ELLIPSOID_POINT_WITH_UNCERT_CIRC 1
784
637
#define  ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE 3
785
23
#define  POLYGON 5
786
629
#define  ELLIPSOID_POINT_WITH_ALT 8
787
631
#define  ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID 9
788
637
#define  ELLIPSOID_ARC 10
789
9
#define  HIGH_ACC_ELLIPSOID_PNT_WITH_UNCERT_ELLIPSE 11
790
8
#define  HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_UNCERT_ELLIPSOID 12
791
28
#define  HIGH_ACC_ELLIPSOID_PNT_WITH_SCALABLE_UNCERT_ELLIPSE 13
792
42
#define  HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_SCALABLE_UNCERT_ELLIPSOID 14
793
/*
794
4 3 2 1
795
0 0 0 0 Ellipsoid Point
796
0 0 0 1 Ellipsoid point with uncertainty Circle
797
0 0 1 1 Ellipsoid point with uncertainty Ellipse
798
0 1 0 1 Polygon
799
1 0 0 0 Ellipsoid point with altitude
800
1 0 0 1 Ellipsoid point with altitude and uncertainty Ellipsoid
801
1 0 1 0 Ellipsoid Arc
802
1 0 1 1 High Accuracy Ellipsoid point with uncertainty ellipse
803
1 1 0 0 High Accuracy Ellipsoid point with altitude and uncertainty ellipsoid
804
1 1 0 1 High Accuracy Ellipsoid point with scalable uncertainty ellipse
805
1 1 1 0 High Accuracy Ellipsoid point with altitude and scalable uncertainty ellipsoid
806
other values reserved for future use
807
*/
808
809
/* TS 23 032 Table 2a: Coding of Type of Shape */
810
static const value_string type_of_shape_vals[] = {
811
    { ELLIPSOID_POINT,                                                  "Ellipsoid Point"},
812
    { ELLIPSOID_POINT_WITH_UNCERT_CIRC,                                 "Ellipsoid point with uncertainty Circle"},
813
    { ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE,                              "Ellipsoid point with uncertainty Ellipse"},
814
    { POLYGON,                                                          "Polygon"},
815
    { ELLIPSOID_POINT_WITH_ALT,                                         "Ellipsoid point with altitude"},
816
    { ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID,                    "Ellipsoid point with altitude and uncertainty Ellipsoid"},
817
    { ELLIPSOID_ARC,                                                    "Ellipsoid Arc"},
818
    { HIGH_ACC_ELLIPSOID_PNT_WITH_UNCERT_ELLIPSE,                       "High Accuracy Ellipsoid point with uncertainty ellipse"},
819
    { HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_UNCERT_ELLIPSOID,             "High Accuracy Ellipsoid point with altitude and uncertainty ellipsoid"},
820
    { HIGH_ACC_ELLIPSOID_PNT_WITH_SCALABLE_UNCERT_ELLIPSE,              "High Accuracy Ellipsoid point with scalable uncertainty ellipse"},
821
    { HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_SCALABLE_UNCERT_ELLIPSOID,    "High Accuracy Ellipsoid point with altitude and scalable uncertainty ellipsoid"},
822
    { 0,    NULL }
823
};
824
825
/* 3GPP TS 23.032 7.3.1 */
826
static const value_string sign_of_latitude_vals[] = {
827
    { 0,  "North"},
828
    { 1,  "South"},
829
    { 0,  NULL }
830
};
831
832
static const value_string dir_of_alt_vals[] = {
833
    { 0,  "Altitude expresses height"},
834
    { 1,  "Altitude expresses depth"},
835
    { 0,  NULL }
836
};
837
838
static const value_string uncertainty_range[] = {
839
    { 0,  "High Accuracy default uncertainty range used"},
840
    { 1,  "High Accuracy Extended Uncertainty Range used"},
841
    { 0,  NULL }
842
};
843
844
typedef uint16_t (* const * elem_func_hander)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string, int string_len);
845
846
int
847
550
dissect_geographical_description(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) {
848
849
550
    proto_item *lat_item, *long_item, *major_item, *minor_item, *orientation_item, *alt_item, *uncer_item, *loc_uri_item;
850
    /*proto_tree *subtree; */
851
550
    uint32_t     type_of_shape;
852
550
    int         offset = 0;
853
550
    int         length;
854
550
    uint32_t    uvalue32;
855
550
    int32_t     svalue32;
856
550
    char        *deg_lat_str;
857
550
    char        *deg_lon_str;
858
550
    char        *osm_uri;
859
550
    int         loc_offset;
860
861
    /*subtree = proto_item_add_subtree(item, ett_gsm_a_geo_desc);*/
862
863
550
    length = tvb_reported_length_remaining(tvb, 0);
864
    /* Geographical Location
865
     * The Location Estimate field is composed of 1 or more octets with an internal structure
866
     * according to section 7 in [23.032].
867
     */
868
550
    proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_type_of_shape, tvb, 0, 1, ENC_BIG_ENDIAN, &type_of_shape);
869
550
    offset++;
870
550
    if (length < 2) {
871
62
        return length;
872
62
    }
873
488
    switch (type_of_shape) {
874
298
    case ELLIPSOID_POINT:
875
        /* Ellipsoid Point */
876
324
    case ELLIPSOID_POINT_WITH_UNCERT_CIRC:
877
        /* Ellipsoid Point with uncertainty Circle */
878
336
    case ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE:
879
        /* Ellipsoid Point with uncertainty Ellipse */
880
339
    case ELLIPSOID_POINT_WITH_ALT:
881
        /* Ellipsoid Point with Altitude */
882
343
    case ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID:
883
        /* Ellipsoid Point with altitude and uncertainty ellipsoid */
884
353
    case ELLIPSOID_ARC:
885
        /* Ellipsoid Arc */
886
353
        if (length < 4)
887
20
            return length;
888
333
        proto_tree_add_item(tree, hf_gsm_a_geo_loc_sign_of_lat, tvb, offset, 1, ENC_BIG_ENDIAN);
889
890
        /* convert degrees (X/0x7fffff) * 90 = degrees */
891
333
        lat_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_deg_of_lat, tvb, offset, 3, ENC_BIG_ENDIAN, &uvalue32);
892
333
        deg_lat_str = wmem_strdup_printf(pinfo->pool, "%s%.5f",
893
333
            (uvalue32 & 0x00800000) ? "-" : "",
894
333
            ((double)(uvalue32 & 0x7fffff)/8388607.0) * 90);
895
333
        proto_item_append_text(lat_item, " (%s degrees)", deg_lat_str);
896
333
        loc_offset = offset;
897
333
        offset = offset + 3;
898
333
        if (length < 7)
899
14
            return offset;
900
319
        long_item = proto_tree_add_item_ret_int(tree, hf_gsm_a_geo_loc_deg_of_long, tvb, offset, 3, ENC_BIG_ENDIAN, &svalue32);
901
319
        svalue32 |= (svalue32 & 0x800000) ? 0xff000000 : 0x00000000;
902
        /* (X/0xffffff) *360 = degrees */
903
319
        deg_lon_str = wmem_strdup_printf(pinfo->pool, "%.5f",
904
319
            ((double)svalue32/16777215.0) * 360);
905
319
        proto_item_append_text(long_item, " (%s degrees)", deg_lon_str);
906
319
        offset = offset + 3;
907
319
        if (type_of_shape == ELLIPSOID_POINT_WITH_UNCERT_CIRC) {
908
            /* Ellipsoid Point with uncertainty Circle */
909
18
            if (length < 8)
910
0
                return offset;
911
            /* Uncertainty code */
912
18
            uncer_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_uncertainty_code, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
913
18
            proto_item_append_text(uncer_item, " (%.1f m)", 10 * (pow(1.1, (double)uvalue32) - 1));
914
301
        }else if (type_of_shape == ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE) {
915
            /* Ellipsoid Point with uncertainty Ellipse */
916
            /* Uncertainty semi-major octet 10
917
             * To convert to metres 10*(((1.1)^X)-1)
918
             */
919
11
            major_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_uncertainty_semi_major, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
920
11
            proto_item_append_text(major_item, " (%.1f m)", 10 * (pow(1.1, (double)uvalue32) - 1));
921
11
            offset++;
922
            /* Uncertainty semi-minor Octet 11
923
             * To convert to metres 10*(((1.1)^X)-1)
924
             */
925
11
            minor_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_uncertainty_semi_minor, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
926
11
            proto_item_append_text(minor_item, " (%.1f m)", 10 * (pow(1.1, (double)uvalue32) - 1));
927
11
            offset++;
928
            /* TS 23.032 V15.1.0 (2018-09)
929
             * Orientation of major axis octet 12
930
             * allowed value from 0-179
931
             */
932
11
            orientation_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_orientation_of_major_axis, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
933
11
            proto_item_append_text(orientation_item, " (%d degrees)", 2 * uvalue32);
934
11
            offset++;
935
            /* Confidence */
936
11
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_confidence, tvb, offset, 1, ENC_BIG_ENDIAN);
937
11
            offset++;
938
290
        }else if (type_of_shape == ELLIPSOID_POINT_WITH_ALT) {
939
            /* Ellipsoid Point with Altitude */
940
            /*D: Direction of Altitude */
941
2
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_D, tvb, offset, 2, ENC_BIG_ENDIAN);
942
            /* Altitude */
943
2
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_altitude, tvb, offset, 2, ENC_BIG_ENDIAN);
944
288
        }else if (type_of_shape == ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID) {
945
            /* Ellipsoid Point with altitude and uncertainty ellipsoid */
946
            /*D: Direction of Altitude octet 8,9 */
947
4
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_D, tvb, offset, 2, ENC_BIG_ENDIAN);
948
            /* Altitude Octet 8,9*/
949
4
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_altitude, tvb, offset, 2, ENC_BIG_ENDIAN);
950
4
            offset = offset +2;
951
            /* Uncertainty semi-major octet 10
952
             * To convert to metres 10*(((1.1)^X)-1)
953
             */
954
4
            major_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_uncertainty_semi_major, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
955
4
            proto_item_append_text(major_item, " (%.1f m)", 10 * (pow(1.1, (double)uvalue32) - 1));
956
4
            offset++;
957
            /* Uncertainty semi-minor Octet 11
958
             * To convert to metres 10*(((1.1)^X)-1)
959
             */
960
4
            minor_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_uncertainty_semi_minor, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
961
4
            proto_item_append_text(minor_item, " (%.1f m)", 10 * (pow(1.1, (double)uvalue32) - 1));
962
4
            offset++;
963
            /* Orientation of major axis octet 12
964
             * allowed value from 0-179 to convert
965
             * to actual degrees multiply by 2.
966
             */
967
4
            orientation_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_orientation_of_major_axis, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
968
4
            proto_item_append_text(orientation_item, " (%d degrees)", 2 * uvalue32);
969
4
            offset++;
970
            /* Uncertainty Altitude 13
971
             * to convert to metres 45*(((1.025)^X)-1)
972
             */
973
4
            alt_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_uncertainty_altitude, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
974
4
            proto_item_append_text(alt_item, " (%.1f m)", 45 * (pow(1.025, (double)uvalue32) - 1));
975
4
            offset++;
976
            /* Confidence octet 14
977
             */
978
4
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_confidence, tvb, offset, 1, ENC_BIG_ENDIAN);
979
284
        }else if (type_of_shape == ELLIPSOID_ARC) {
980
            /* Ellipsoid Arc */
981
            /* Inner radius */
982
8
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_inner_radius, tvb, offset, 2, ENC_BIG_ENDIAN);
983
8
            offset = offset + 2;
984
            /* Uncertainty radius */
985
8
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_uncertainty_radius, tvb, offset, 1, ENC_BIG_ENDIAN);
986
8
            offset++;
987
            /* Offset angle */
988
8
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_offset_angle, tvb, offset, 1, ENC_BIG_ENDIAN);
989
8
            offset++;
990
            /* Included angle */
991
8
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_included_angle, tvb, offset, 1, ENC_BIG_ENDIAN);
992
8
            offset++;
993
            /* Confidence */
994
8
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_confidence, tvb, offset, 1, ENC_BIG_ENDIAN);
995
8
        }
996
319
        osm_uri = wmem_strdup_printf(pinfo->pool, "https://www.openstreetmap.org/?mlat=%s&mlon=%s&zoom=12", deg_lat_str, deg_lon_str);
997
319
        loc_uri_item = proto_tree_add_string(tree, hf_gsm_a_geo_loc_osm_uri, tvb, loc_offset, 6, osm_uri);
998
319
        proto_item_set_url(loc_uri_item);
999
319
        proto_item_set_generated(loc_uri_item);
1000
1001
319
        break;
1002
23
    case POLYGON:                   /* Polygon */
1003
23
    {
1004
        /* Number of points */
1005
23
        uint32_t no_of_points;
1006
23
        unsigned point_no = 0;
1007
23
        proto_tree* sub_tree;
1008
23
        proto_item *ti;
1009
1010
23
        proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_no_of_points, tvb, 0, 1, ENC_BIG_ENDIAN, &no_of_points);
1011
        /* offset increased with 1 after reading of shape above */
1012
120
        while (no_of_points > 0) {
1013
97
            point_no++;
1014
97
            sub_tree = proto_tree_add_subtree_format(tree, tvb, offset, 6,
1015
97
                ett_gsm_a_poly_pnt, &ti, "Polygon point %u", point_no);
1016
97
            proto_tree_add_item(sub_tree, hf_gsm_a_geo_loc_sign_of_lat, tvb, offset, 1, ENC_BIG_ENDIAN);
1017
1018
97
            uvalue32 = tvb_get_ntoh24(tvb, offset);
1019
            /* convert degrees (X/0x7fffff) * 90 = degrees */
1020
97
            lat_item = proto_tree_add_item(sub_tree, hf_gsm_a_geo_loc_deg_of_lat, tvb, offset, 3, ENC_BIG_ENDIAN);
1021
97
            deg_lat_str = wmem_strdup_printf(pinfo->pool, "%s%.5f",
1022
97
                (uvalue32 & 0x00800000) ? "-" : "",
1023
97
                ((double)(uvalue32 & 0x7fffff) / 8388607.0) * 90);
1024
97
            proto_item_append_text(lat_item, " (%s degrees)", deg_lat_str);
1025
97
            loc_offset = offset;
1026
97
            offset = offset + 3;
1027
97
            svalue32 = tvb_get_ntoh24(tvb, offset);
1028
97
            svalue32 |= (svalue32 & 0x800000) ? 0xff000000 : 0x00000000;
1029
97
            long_item = proto_tree_add_item(sub_tree, hf_gsm_a_geo_loc_deg_of_long, tvb, offset, 3, ENC_BIG_ENDIAN);
1030
            /* (X/0xffffff) *360 = degrees */
1031
97
            deg_lon_str = wmem_strdup_printf(pinfo->pool, "%.5f",
1032
97
                ((double)svalue32 / 16777215.0) * 360);
1033
97
            proto_item_append_text(long_item, " (%s degrees)", deg_lon_str);
1034
97
            offset = offset + 3;
1035
97
            no_of_points--;
1036
1037
97
            osm_uri = wmem_strdup_printf(pinfo->pool, "https://www.openstreetmap.org/?mlat=%s&mlon=%s&zoom=12", deg_lat_str, deg_lon_str);
1038
97
            loc_uri_item = proto_tree_add_string(tree, hf_gsm_a_geo_loc_osm_uri, tvb, loc_offset, 6, osm_uri);
1039
97
            proto_item_set_url(loc_uri_item);
1040
97
            proto_item_set_generated(loc_uri_item);
1041
97
        }
1042
23
    }
1043
23
        break;
1044
9
    case HIGH_ACC_ELLIPSOID_PNT_WITH_UNCERT_ELLIPSE:
1045
14
    case HIGH_ACC_ELLIPSOID_PNT_WITH_SCALABLE_UNCERT_ELLIPSE:
1046
14
        loc_offset = offset;
1047
14
        lat_item = proto_tree_add_item_ret_int(tree, hf_gsm_a_geo_loc_high_acc_deg_of_lat, tvb, offset, 4, ENC_BIG_ENDIAN, &svalue32);
1048
14
        deg_lat_str = wmem_strdup_printf(pinfo->pool, "%s%.5f",
1049
14
            (svalue32 & 0x80000000) ? "-" : "",
1050
14
            ((double)(svalue32 & 0x7fffffff) / 2147483647.0) * 90);
1051
14
        proto_item_append_text(lat_item, " (%s degrees)", deg_lat_str);
1052
14
        offset += 4;
1053
14
        long_item = proto_tree_add_item_ret_int(tree, hf_gsm_a_geo_loc_high_acc_deg_of_long, tvb, offset, 4, ENC_BIG_ENDIAN, &svalue32);
1054
14
        deg_lon_str = wmem_strdup_printf(pinfo->pool, "%s%.5f",
1055
14
            (svalue32 & 0x80000000) ? "-" : "",
1056
14
            ((double)svalue32 / 2147483647.0) * 180);
1057
14
        proto_item_append_text(long_item, " (%s degrees)", deg_lon_str);
1058
1059
14
        offset += 4;
1060
        /* High accuracy uncertainty semi-major*/
1061
14
        major_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_high_acc_uncertainty_semi_major, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
1062
14
        proto_item_append_text(major_item, " (%.5f m)", 0.3 * (pow(1.02, (double)uvalue32) - 1));
1063
14
        offset++;
1064
        /* High accuracy uncertainty semi-minor*/
1065
14
        minor_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_high_acc_uncertainty_semi_minor, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
1066
14
        proto_item_append_text(minor_item, " (%.5f m)", 0.3 * (pow(1.02, (double)uvalue32) - 1));
1067
14
        offset++;
1068
        /* Orientation of major axis */
1069
14
        orientation_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_orientation_of_major_axis, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
1070
14
        proto_item_append_text(orientation_item, " (%d degrees)", 2 * uvalue32);
1071
14
        offset++;
1072
        /* Confidence */
1073
14
        proto_tree_add_item(tree, hf_gsm_a_geo_loc_confidence, tvb, offset, 1, ENC_BIG_ENDIAN);
1074
14
        if (type_of_shape == HIGH_ACC_ELLIPSOID_PNT_WITH_SCALABLE_UNCERT_ELLIPSE) {
1075
            /* Uncertainty Range */
1076
5
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_uncertainty_range, tvb, offset, 1, ENC_BIG_ENDIAN);
1077
5
        }
1078
14
        offset++;
1079
1080
14
        osm_uri = wmem_strdup_printf(pinfo->pool, "https://www.openstreetmap.org/?mlat=%s&mlon=%s&zoom=12", deg_lat_str, deg_lon_str);
1081
14
        loc_uri_item = proto_tree_add_string(tree, hf_gsm_a_geo_loc_osm_uri, tvb, loc_offset, 6, osm_uri);
1082
14
        proto_item_set_url(loc_uri_item);
1083
14
        proto_item_set_generated(loc_uri_item);
1084
1085
14
        break;
1086
8
    case HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_UNCERT_ELLIPSOID:
1087
14
    case HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_SCALABLE_UNCERT_ELLIPSOID:
1088
14
        lat_item = proto_tree_add_item_ret_int(tree, hf_gsm_a_geo_loc_high_acc_deg_of_lat, tvb, offset, 4, ENC_BIG_ENDIAN, &svalue32);
1089
14
        deg_lat_str = wmem_strdup_printf(pinfo->pool, "%s%.5f",
1090
14
            (svalue32 & 0x80000000) ? "-" : "",
1091
14
            ((double)(svalue32 & 0x7fffffff) / 2147483647.0) * 90);
1092
14
        proto_item_append_text(lat_item, " (%s degrees)", deg_lat_str);
1093
14
        offset += 4;
1094
14
        long_item = proto_tree_add_item_ret_int(tree, hf_gsm_a_geo_loc_high_acc_deg_of_long, tvb, offset, 4, ENC_BIG_ENDIAN, &svalue32);
1095
14
        deg_lon_str = wmem_strdup_printf(pinfo->pool, "%s%.5f",
1096
14
            (svalue32 & 0x80000000) ? "-" : "",
1097
14
            ((double)svalue32 / 2147483647.0) * 180);
1098
14
        proto_item_append_text(long_item, " (%s degrees)", deg_lon_str);
1099
14
        offset += 4;
1100
1101
        /* High accuracy altitude
1102
         * High accuracy altitude is encoded as a number N between -64000 and 1280000 using 2's complement binary on 22 bits.
1103
         */
1104
1105
14
        alt_item = proto_tree_add_item_ret_int(tree, hf_gsm_a_geo_loc_high_acc_alt, tvb, offset, 3, ENC_BIG_ENDIAN, &svalue32);
1106
        /* double z = pow(double x, double y);*/
1107
14
        proto_item_append_text(alt_item, " (%.1f m)", (double)svalue32 * pow(2,-7));
1108
14
        offset += 3;
1109
1110
        /* High accuracy uncertainty semi-major*/
1111
14
        major_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_high_acc_uncertainty_semi_major, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
1112
14
        proto_item_append_text(major_item, " (%.5f m)", 0.3 * (pow(1.02, (double)uvalue32) - 1));
1113
14
        offset++;
1114
        /* High accuracy uncertainty semi-minor*/
1115
14
        minor_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_high_acc_uncertainty_semi_minor, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
1116
14
        proto_item_append_text(minor_item, " (%.5f m)", 0.3 * (pow(1.02, (double)uvalue32) - 1));
1117
14
        offset++;
1118
        /* Orientation of major axis */
1119
14
        orientation_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_orientation_of_major_axis, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
1120
14
        proto_item_append_text(orientation_item, " (%d degrees)", 2 * uvalue32);
1121
14
        offset++;
1122
1123
        /* Horizontal confidence */
1124
14
        proto_tree_add_item(tree, hf_gsm_a_geo_loc_horizontal_confidence, tvb, offset, 1, ENC_BIG_ENDIAN);
1125
14
        if (type_of_shape == HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_SCALABLE_UNCERT_ELLIPSOID) {
1126
            /* Horizontal Uncertainty Range */
1127
4
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_horizontal_uncertainty_range, tvb, offset, 1, ENC_BIG_ENDIAN);
1128
4
        }
1129
14
        offset++;
1130
1131
        /* High accuracy uncertainty altitude */
1132
14
        alt_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_geo_loc_high_acc_uncertainty_alt, tvb, offset, 1, ENC_BIG_ENDIAN, &uvalue32);
1133
14
        proto_item_append_text(alt_item, " (%.1f m)", 45 * (pow(1.025, (double)uvalue32) - 1));
1134
14
        offset++;
1135
1136
        /* Vertical confidence*/
1137
14
        proto_tree_add_item(tree, hf_gsm_a_geo_loc_vertical_confidence, tvb, offset, 1, ENC_BIG_ENDIAN);
1138
14
        if (type_of_shape == HIGH_ACC_ELLIPSOID_PNT_WITH_ALT_AND_SCALABLE_UNCERT_ELLIPSOID) {
1139
            /* Vertical Uncertainty Range */
1140
3
            proto_tree_add_item(tree, hf_gsm_a_geo_loc_vertical_uncertainty_range, tvb, offset, 1, ENC_BIG_ENDIAN);
1141
3
        }
1142
14
        offset++;
1143
14
        break;
1144
1145
76
    default:
1146
76
        break;
1147
488
    }
1148
424
    return offset;
1149
488
}
1150
1151
/* TS 23.032
1152
 * Ch. 8 Description of Velocity
1153
 */
1154
/* 8.6 Coding of Velocity Type */
1155
static const value_string gsm_a_velocity_type_vals[] = {
1156
    { 0,  "Horizontal Velocity"},
1157
    { 1,  "Horizontal with Vertical Velocity"},
1158
    { 2,  "Horizontal Velocity with Uncertainty"},
1159
    { 3,  "Horizontal with Vertical Velocity and Uncertainty"},
1160
    { 4,  "reserved for future use"},
1161
    { 5,  "reserved for future use"},
1162
    { 6,  "reserved for future use"},
1163
    { 7,  "reserved for future use"},
1164
    { 8,  "reserved for future use"},
1165
    { 9,  "reserved for future use"},
1166
    { 10, "reserved for future use"},
1167
    { 11, "reserved for future use"},
1168
    { 12, "reserved for future use"},
1169
    { 13, "reserved for future use"},
1170
    { 14, "reserved for future use"},
1171
    { 15, "reserved for future use"},
1172
    { 0,  NULL }
1173
};
1174
1175
static const true_false_string gsm_a_dir_of_ver_speed_vals = {
1176
    "Downward",
1177
    "Upward"
1178
};
1179
1180
uint16_t
1181
dissect_description_of_velocity(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
1182
0
{
1183
0
    proto_item *velocity_item;
1184
0
    uint32_t    curr_offset;
1185
0
    uint32_t    velocity_type, uncertainty_speed = 0;
1186
1187
0
    curr_offset = offset;
1188
1189
    /* Bit 8 - 5 Velocity Type */
1190
0
    proto_tree_add_item_ret_uint(tree, hf_gsm_a_velocity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &velocity_type);
1191
1192
0
    switch (velocity_type) {
1193
0
    case 0:
1194
        /* 8.12 Coding of Horizontal Velocity */
1195
        /* Spare bits */
1196
0
        proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3)+4, 3, ENC_BIG_ENDIAN);
1197
        /* Bearing is encoded in increments of 1 degree measured clockwise from North using a 9 bit binary coded number N. */
1198
0
        proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN);
1199
0
        curr_offset += 2;
1200
        /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */
1201
0
        proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1202
0
        curr_offset += 2;
1203
0
        break;
1204
0
    case 1:
1205
        /* 8.13 Coding of Horizontal with Vertical Velocity */
1206
        /* Spare bits */
1207
0
        proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3)+4, 2, ENC_BIG_ENDIAN);
1208
        /* D: Direction of Vertical Speed */
1209
0
        proto_tree_add_item(tree, hf_gsm_a_d, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1210
        /* Bearing is encoded in increments of 1 degree measured clockwise from North using a 9 bit binary coded number N. */
1211
0
        proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN);
1212
0
        curr_offset += 2;
1213
        /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */
1214
0
        proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1215
0
        curr_offset += 2;
1216
        /* Vertical Speed Octet 5
1217
         * Vertical speed is encoded in increments of 1 kilometre per hour using 8 bits giving a number N between 0 and 28-1.
1218
         */
1219
0
        proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1220
0
        curr_offset++;
1221
0
        break;
1222
0
    case 2:
1223
        /* 8.14 Coding of Horizontal Velocity with Uncertainty */
1224
        /* Spare bits */
1225
0
        proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3)+4, 3, ENC_BIG_ENDIAN);
1226
        /* Bearing is encoded in increments of 1 degree measured clockwise from North using a 9 bit binary coded number N. */
1227
0
        proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN);
1228
0
        curr_offset += 2;
1229
        /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */
1230
0
        proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1231
0
        curr_offset += 2;
1232
        /* Uncertainty Speed Octet 5
1233
         * Uncertainty speed is encoded in increments of 1 kilometre per hour using an 8 bit binary coded number N. The value of
1234
         * N gives the uncertainty speed except for N=255 which indicates that the uncertainty is not specified.
1235
         */
1236
0
        velocity_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_uncertainty_speed, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &uncertainty_speed);
1237
0
        if (uncertainty_speed == 255) {
1238
0
            proto_item_append_text(velocity_item, " (not specified)");
1239
0
        } else {
1240
0
            proto_item_append_text(velocity_item, "km/h");
1241
0
        }
1242
0
        curr_offset++;
1243
0
        break;
1244
0
    case 3:
1245
        /* 8.15 Coding of Horizontal with Vertical Velocity and Uncertainty */
1246
        /* Spare bits */
1247
0
        proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3)+4, 2, ENC_BIG_ENDIAN);
1248
        /* D: Direction of Vertical Speed */
1249
0
        proto_tree_add_item(tree, hf_gsm_a_d, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1250
        /* Bearing is encoded in increments of 1 degree measured clockwise from North using a 9 bit binary coded number N. */
1251
0
        proto_tree_add_bits_item(tree, hf_gsm_a_bearing, tvb, (curr_offset<<3)+7, 9, ENC_BIG_ENDIAN);
1252
0
        curr_offset += 2;
1253
        /* Horizontal speed is encoded in increments of 1 kilometre per hour using a 16 bit binary coded number N. */
1254
0
        proto_tree_add_item(tree, hf_gsm_a_horizontal_speed, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1255
0
        curr_offset += 2;
1256
        /* Vertical Speed Octet 5
1257
         * Vertical speed is encoded in increments of 1 kilometre per hour using 8 bits giving a number N between 0 and 28-1.
1258
         */
1259
0
        proto_tree_add_item(tree, hf_gsm_a_vertical_speed, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1260
0
        curr_offset++;
1261
1262
        /* Horizontal Uncertainty Speed Octet 6 */
1263
0
        velocity_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_h_uncertainty_speed, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &uncertainty_speed);
1264
0
        if (uncertainty_speed == 255) {
1265
0
            proto_item_append_text(velocity_item, " (not specified)");
1266
0
        } else {
1267
0
            proto_item_append_text(velocity_item, "km/h");
1268
0
        }
1269
0
        curr_offset++;
1270
1271
        /* Vertical Uncertainty Speed Octet 7 */
1272
0
        velocity_item = proto_tree_add_item_ret_uint(tree, hf_gsm_a_v_uncertainty_speed, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &uncertainty_speed);
1273
0
        if (uncertainty_speed == 255) {
1274
0
            proto_item_append_text(velocity_item, " (not specified)");
1275
0
        } else {
1276
0
            proto_item_append_text(velocity_item, "km/h");
1277
0
        }
1278
0
        curr_offset++;
1279
0
        break;
1280
0
    default:
1281
0
        break;
1282
0
    }
1283
1284
0
    return (curr_offset - offset);
1285
0
}
1286
1287
const char* get_gsm_a_msg_string(wmem_allocator_t* pool, int pdu_type, int idx)
1288
18.7k
{
1289
18.7k
    const char *msg_string = NULL;
1290
1291
18.7k
    switch (pdu_type) {
1292
0
    case GSM_A_PDU_TYPE_BSSMAP:
1293
0
        msg_string = val_to_str_ext(pool, idx, &gsm_bssmap_elem_strings_ext, "GSM_A_PDU_TYPE_BSSMAP (%u)");
1294
0
        break;
1295
28
    case GSM_A_PDU_TYPE_DTAP:
1296
28
        msg_string = val_to_str_ext(pool, idx, &gsm_dtap_elem_strings_ext, "GSM_A_PDU_TYPE_DTAP (%u)");
1297
28
        break;
1298
0
    case GSM_A_PDU_TYPE_RP:
1299
0
        msg_string = val_to_str_ext(pool, idx, &gsm_rp_elem_strings_ext, "GSM_A_PDU_TYPE_RP (%u)");
1300
0
        break;
1301
15.7k
    case GSM_A_PDU_TYPE_RR:
1302
15.7k
        msg_string = val_to_str_ext(pool, idx, &gsm_rr_elem_strings_ext, "GSM_A_PDU_TYPE_RR (%u)");
1303
15.7k
        break;
1304
518
    case GSM_A_PDU_TYPE_COMMON:
1305
518
        msg_string = val_to_str_ext(pool, idx, &gsm_common_elem_strings_ext, "GSM_A_PDU_TYPE_COMMON (%u)");
1306
518
        break;
1307
783
    case GSM_A_PDU_TYPE_GM:
1308
783
        msg_string = val_to_str_ext(pool, idx, &gsm_gm_elem_strings_ext, "GSM_A_PDU_TYPE_GM (%u)");
1309
783
        break;
1310
0
    case GSM_A_PDU_TYPE_BSSLAP:
1311
0
        msg_string = val_to_str_ext(pool, idx, &gsm_bsslap_elem_strings_ext, "GSM_A_PDU_TYPE_BSSLAP (%u)");
1312
0
        break;
1313
16
    case GSM_PDU_TYPE_BSSMAP_LE:
1314
16
        msg_string = val_to_str_ext(pool, idx, &gsm_bssmap_le_elem_strings_ext, "GSM_PDU_TYPE_BSSMAP_LE (%u)");
1315
16
        break;
1316
0
    case NAS_PDU_TYPE_COMMON:
1317
0
        msg_string = val_to_str_ext(pool, idx, &nas_eps_common_elem_strings_ext, "NAS_PDU_TYPE_COMMON (%u)");
1318
0
        break;
1319
0
    case NAS_PDU_TYPE_EMM:
1320
0
        msg_string = val_to_str_ext(pool, idx, &nas_emm_elem_strings_ext, "NAS_PDU_TYPE_EMM (%u)");
1321
0
        break;
1322
1
    case NAS_PDU_TYPE_ESM:
1323
1
        msg_string = val_to_str_ext(pool, idx, &nas_esm_elem_strings_ext, "NAS_PDU_TYPE_ESM (%u)");
1324
1
        break;
1325
0
    case SGSAP_PDU_TYPE:
1326
0
        msg_string = val_to_str_ext(pool, idx, &sgsap_elem_strings_ext, "SGSAP_PDU_TYPE (%u)");
1327
0
        break;
1328
1.65k
    case BSSGP_PDU_TYPE:
1329
1.65k
        msg_string = val_to_str_ext(pool, idx, &bssgp_elem_strings_ext, "BSSGP_PDU_TYPE (%u)");
1330
1.65k
        break;
1331
0
    case GMR1_IE_COMMON:
1332
0
        msg_string = val_to_str_ext(pool, idx, &gmr1_ie_common_strings_ext, "GMR1_IE_COMMON (%u)");
1333
0
        break;
1334
0
    case GMR1_IE_RR:
1335
0
        msg_string = val_to_str_ext(pool, idx, &gmr1_ie_rr_strings_ext, "GMR1_IE_RR (%u)");
1336
0
        break;
1337
0
    case NAS_5GS_PDU_TYPE_COMMON:
1338
0
        msg_string = val_to_str_ext(pool, idx, &nas_5gs_common_elem_strings_ext, "NAS_5GS_PDU_TYPE_COMMON (%u)");
1339
0
        break;
1340
0
    case NAS_5GS_PDU_TYPE_MM:
1341
0
        msg_string = val_to_str_ext(pool, idx, &nas_5gs_mm_elem_strings_ext, "NAS_5GS_PDU_TYPE_MM (%u)");
1342
0
        break;
1343
0
    case NAS_5GS_PDU_TYPE_SM:
1344
0
        msg_string = val_to_str_ext(pool, idx, &nas_5gs_sm_elem_strings_ext, "NAS_5GS_PDU_TYPE_SM (%u)");
1345
0
        break;
1346
0
    case NAS_5GS_PDU_TYPE_UPDP:
1347
0
        msg_string = val_to_str_ext(pool, idx, &nas_5gs_updp_elem_strings_ext, "NAS_5GS_PDU_TYPE_UPDP (%u)");
1348
0
        break;
1349
0
    default:
1350
0
        DISSECTOR_ASSERT_NOT_REACHED();
1351
18.7k
    }
1352
1353
18.7k
    return msg_string;
1354
18.7k
}
1355
1356
static int get_hf_elem_id(int pdu_type)
1357
3.05k
{
1358
3.05k
    int hf_elem_id = 0;
1359
1360
3.05k
    switch (pdu_type) {
1361
23
    case GSM_A_PDU_TYPE_BSSMAP:
1362
23
        hf_elem_id = hf_gsm_a_bssmap_elem_id;
1363
23
        break;
1364
28
    case GSM_A_PDU_TYPE_DTAP:
1365
28
        hf_elem_id = hf_gsm_a_dtap_elem_id;
1366
28
        break;
1367
0
    case GSM_A_PDU_TYPE_RP:
1368
0
        hf_elem_id = hf_gsm_a_rp_elem_id;
1369
0
        break;
1370
231
    case GSM_A_PDU_TYPE_RR:
1371
231
        hf_elem_id = hf_gsm_a_rr_elem_id;
1372
231
        break;
1373
27
    case GSM_A_PDU_TYPE_COMMON:
1374
27
        hf_elem_id = hf_gsm_a_common_elem_id;
1375
27
        break;
1376
737
    case GSM_A_PDU_TYPE_GM:
1377
737
        hf_elem_id = hf_gsm_a_gm_elem_id;
1378
737
        break;
1379
0
    case GSM_A_PDU_TYPE_BSSLAP:
1380
0
        hf_elem_id = hf_gsm_a_bsslap_elem_id;
1381
0
        break;
1382
4
    case GSM_PDU_TYPE_BSSMAP_LE:
1383
4
        hf_elem_id = hf_gsm_bssmap_le_elem_id;
1384
4
        break;
1385
0
    case NAS_PDU_TYPE_COMMON:
1386
0
        hf_elem_id = hf_nas_eps_common_elem_id;
1387
0
        break;
1388
3
    case NAS_PDU_TYPE_EMM:
1389
3
        hf_elem_id = hf_nas_eps_emm_elem_id;
1390
3
        break;
1391
0
    case NAS_PDU_TYPE_ESM:
1392
0
        hf_elem_id = hf_nas_eps_esm_elem_id;
1393
0
        break;
1394
0
    case SGSAP_PDU_TYPE:
1395
0
        hf_elem_id = hf_sgsap_elem_id;
1396
0
        break;
1397
2.00k
    case BSSGP_PDU_TYPE:
1398
2.00k
        hf_elem_id = hf_bssgp_elem_id;
1399
2.00k
        break;
1400
0
    case GMR1_IE_COMMON:
1401
0
    case GMR1_IE_RR:
1402
0
        hf_elem_id = hf_gmr1_elem_id;
1403
0
        break;
1404
0
    case NAS_5GS_PDU_TYPE_COMMON:
1405
0
        hf_elem_id = hf_nas_5gs_common_elem_id;
1406
0
        break;
1407
0
    case NAS_5GS_PDU_TYPE_MM:
1408
0
        hf_elem_id = hf_nas_5gs_mm_elem_id;
1409
0
        break;
1410
0
    case NAS_5GS_PDU_TYPE_SM:
1411
0
        hf_elem_id = hf_nas_5gs_sm_elem_id;
1412
0
        break;
1413
0
    case NAS_5GS_PDU_TYPE_UPDP:
1414
0
        hf_elem_id = hf_nas_5gs_updp_elem_id;
1415
0
        break;
1416
0
    default:
1417
0
        DISSECTOR_ASSERT_NOT_REACHED();
1418
3.05k
    }
1419
1420
3.05k
    return hf_elem_id;
1421
3.05k
}
1422
1423
/*
1424
 * Type Length Value (TLV) element dissector
1425
 */
1426
uint16_t elem_tlv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint8_t iei, int pdu_type, int idx, uint32_t offset, unsigned len _U_, const char *name_add)
1427
11.3k
{
1428
11.3k
    uint8_t             oct;
1429
11.3k
    uint16_t            parm_len;
1430
11.3k
    uint8_t             lengt_length = 1;
1431
11.3k
    uint16_t            consumed;
1432
11.3k
    uint32_t            curr_offset;
1433
11.3k
    proto_tree         *subtree;
1434
11.3k
    proto_item         *item;
1435
11.3k
    value_string_ext    elem_names_ext;
1436
11.3k
    int                *elem_ett;
1437
11.3k
    const char         *elem_name;
1438
11.3k
    elem_func_hander    elem_funcs;
1439
1440
11.3k
    curr_offset = offset;
1441
11.3k
    consumed = 0;
1442
1443
11.3k
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1444
1445
11.3k
    oct = tvb_get_uint8(tvb, curr_offset);
1446
1447
11.3k
    if (oct == iei) {
1448
285
        parm_len = tvb_get_uint8(tvb, curr_offset + 1);
1449
1450
285
        elem_name = try_val_to_str_ext(idx, &elem_names_ext);
1451
1452
        /* idx is out of range */
1453
285
        if (elem_name == NULL) {
1454
0
            proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_unknown_element,
1455
0
                tvb, curr_offset, parm_len + 1 + lengt_length,
1456
0
                "Unknown - aborting dissection%s", (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1457
0
            return consumed;
1458
0
        }
1459
1460
285
        subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, parm_len + 1 + lengt_length, elem_ett[idx], &item,
1461
285
                                             "%s%s", elem_name, (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1462
1463
285
        proto_tree_add_uint(subtree,
1464
285
            get_hf_elem_id(pdu_type), tvb,
1465
285
            curr_offset, 1, oct);
1466
1467
285
        proto_tree_add_uint(subtree, hf_gsm_a_length, tvb,
1468
285
            curr_offset + 1, lengt_length, parm_len);
1469
1470
285
        if (parm_len > 0)
1471
256
        {
1472
256
            if (elem_funcs[idx] == NULL)
1473
0
            {
1474
0
                proto_tree_add_item(subtree, hf_gsm_a_element_value, tvb, curr_offset + 1 + lengt_length, parm_len, ENC_NA);
1475
                /* See ASSERT above */
1476
0
                consumed = (uint8_t)parm_len;
1477
0
            }
1478
256
            else
1479
256
            {
1480
256
                char *a_add_string;
1481
1482
256
                a_add_string = (char *)wmem_alloc(pinfo->pool, 1024);
1483
256
                a_add_string[0] = '\0';
1484
256
                consumed =
1485
256
                (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset + 2,
1486
256
                    parm_len, a_add_string, 1024);
1487
1488
256
                if (a_add_string[0] != '\0')
1489
25
                {
1490
25
                    proto_item_append_text(item, "%s", a_add_string);
1491
25
                }
1492
256
            }
1493
256
        }
1494
1495
285
        consumed += 1 + lengt_length;
1496
285
    }
1497
1498
11.3k
    return consumed;
1499
11.3k
}
1500
1501
/*
1502
 * Type Extendable Length Value (TELV) element dissector
1503
 * This is a version where the length field can be one or two octets depending
1504
 * if the extension bit is set or not (TS 48.016 p 10.1.2).
1505
 *         8        7 6 5 4 3 2 1
1506
 * octet 2 0/1 ext  length
1507
 * octet 2a length
1508
 */
1509
uint16_t elem_telv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint8_t iei, int pdu_type, int idx, uint32_t offset, unsigned len _U_, const char *name_add)
1510
14.4k
{
1511
14.4k
    uint8_t             oct;
1512
14.4k
    uint16_t            parm_len;
1513
14.4k
    uint8_t             lengt_length = 1;
1514
14.4k
    uint16_t            consumed;
1515
14.4k
    uint32_t            curr_offset;
1516
14.4k
    proto_tree         *subtree;
1517
14.4k
    proto_item         *item;
1518
14.4k
    value_string_ext    elem_names_ext;
1519
14.4k
    int                *elem_ett;
1520
14.4k
    const char         *elem_name;
1521
14.4k
    elem_func_hander    elem_funcs;
1522
1523
14.4k
    curr_offset = offset;
1524
14.4k
    consumed = 0;
1525
1526
14.4k
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1527
1528
14.4k
    oct = tvb_get_uint8(tvb, curr_offset);
1529
1530
14.4k
    if (oct == iei) {
1531
2.61k
        parm_len = tvb_get_uint8(tvb, curr_offset + 1);
1532
2.61k
        if ((parm_len&0x80) == 0) {
1533
            /* length in 2 octets */
1534
2.13k
            parm_len = tvb_get_ntohs(tvb, curr_offset + 1);
1535
2.13k
            lengt_length = 2;
1536
2.13k
        }else{
1537
482
            parm_len = parm_len & 0x7f;
1538
482
        }
1539
1540
2.61k
        elem_name = try_val_to_str_ext(idx, &elem_names_ext);
1541
1542
        /* idx is out of range */
1543
2.61k
        if (elem_name == NULL) {
1544
1
            proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_unknown_element,
1545
1
                tvb, curr_offset, parm_len + 1 + lengt_length,
1546
1
                "Unknown - aborting dissection%s", (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1547
1
            return consumed;
1548
1
        }
1549
1550
2.61k
        subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, parm_len + 1 + lengt_length, elem_ett[idx], &item,
1551
2.61k
                                             "%s%s", elem_name, (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1552
1553
2.61k
        proto_tree_add_uint(subtree,
1554
2.61k
            get_hf_elem_id(pdu_type), tvb,
1555
2.61k
            curr_offset, 1, oct);
1556
1557
2.61k
        proto_tree_add_item(subtree, hf_gsm_a_l_ext, tvb, curr_offset+1, 1, ENC_BIG_ENDIAN);
1558
1559
2.61k
        proto_tree_add_uint(subtree, hf_gsm_a_length, tvb,
1560
2.61k
            curr_offset + 1, lengt_length, parm_len);
1561
1562
2.61k
        if (parm_len > 0)
1563
2.58k
        {
1564
2.58k
            if (elem_funcs[idx] == NULL)
1565
2
            {
1566
2
                proto_tree_add_item(subtree, hf_gsm_a_element_value, tvb, curr_offset + 1 + lengt_length, parm_len, ENC_NA);
1567
                /* See ASSERT above */
1568
2
                consumed = parm_len;
1569
2
            }
1570
2.58k
            else
1571
2.58k
            {
1572
2.58k
                char *a_add_string;
1573
1574
2.58k
                a_add_string = (char*)wmem_alloc(pinfo->pool, 1024);
1575
2.58k
                a_add_string[0] = '\0';
1576
2.58k
                consumed =
1577
2.58k
                (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset + 1 + lengt_length,
1578
2.58k
                    parm_len, a_add_string, 1024);
1579
1580
2.58k
                if (a_add_string[0] != '\0')
1581
23
                {
1582
23
                    proto_item_append_text(item, "%s", a_add_string);
1583
23
                }
1584
2.58k
            }
1585
2.58k
        }
1586
1587
2.61k
        consumed += 1 + lengt_length;
1588
2.61k
    }
1589
1590
14.4k
    return consumed;
1591
14.4k
}
1592
1593
/*
1594
 * Type Length Value Extended(TLV-E) element dissector
1595
 * TS 24.007
1596
 * information elements of format LV-E or TLV-E with value part consisting of zero,
1597
 * one or more octets and a maximum of 65535 octets (type 6). This category is used in EPS only.
1598
 */
1599
uint16_t elem_tlv_e(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint8_t iei, int pdu_type, int idx, uint32_t offset, unsigned len _U_, const char *name_add)
1600
52
{
1601
52
    uint8_t             oct;
1602
52
    uint16_t            parm_len;
1603
52
    uint16_t            consumed;
1604
52
    uint32_t            curr_offset;
1605
52
    proto_tree         *subtree;
1606
52
    proto_item         *item;
1607
52
    value_string_ext    elem_names_ext;
1608
52
    int                *elem_ett;
1609
52
    const char         *elem_name;
1610
52
    elem_func_hander    elem_funcs;
1611
1612
52
    curr_offset = offset;
1613
52
    consumed = 0;
1614
1615
52
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1616
1617
52
    oct = tvb_get_uint8(tvb, curr_offset);
1618
1619
52
    if (oct == iei) {
1620
14
        parm_len = tvb_get_ntohs(tvb, curr_offset + 1);
1621
1622
14
        elem_name = try_val_to_str_ext(idx, &elem_names_ext);
1623
1624
        /* idx is out of range */
1625
14
        if (elem_name == NULL) {
1626
0
            proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_unknown_element,
1627
0
                tvb, curr_offset, parm_len + 1 + 2,
1628
0
                "Unknown - aborting dissection%s", (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1629
0
            return consumed;
1630
0
        }
1631
1632
14
        subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, parm_len + 1 + 2, elem_ett[idx], &item,
1633
14
                                             "%s%s", elem_name, (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1634
1635
14
        proto_tree_add_uint(subtree,
1636
14
            get_hf_elem_id(pdu_type), tvb,
1637
14
            curr_offset, 1, oct);
1638
1639
14
        proto_tree_add_uint(subtree, hf_gsm_a_length, tvb,
1640
14
            curr_offset + 1, 2, parm_len);
1641
1642
14
        if (parm_len > 0)
1643
14
        {
1644
14
            if (elem_funcs[idx] == NULL)
1645
0
            {
1646
0
                proto_tree_add_item(subtree, hf_gsm_a_element_value, tvb, curr_offset + 1 + 2, parm_len, ENC_NA);
1647
                /* See ASSERT above */
1648
0
                consumed = parm_len;
1649
0
            }
1650
14
            else
1651
14
            {
1652
14
                char *a_add_string;
1653
1654
14
                a_add_string = (char*)wmem_alloc(pinfo->pool, 1024);
1655
14
                a_add_string[0] = '\0';
1656
14
                consumed =
1657
14
                (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset + 1 + 2,
1658
14
                    parm_len, a_add_string, 1024);
1659
1660
14
                if (a_add_string[0] != '\0')
1661
0
                {
1662
0
                    proto_item_append_text(item, "%s", a_add_string);
1663
0
                }
1664
14
            }
1665
14
        }
1666
1667
14
        consumed += 1 + 2;
1668
14
    }
1669
1670
52
    return consumed;
1671
52
}
1672
1673
/*
1674
 * Type Value (TV) element dissector
1675
 *
1676
 * Length cannot be used in these functions, big problem if a element dissector
1677
 * is not defined for these.
1678
 */
1679
uint16_t elem_tv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint8_t iei, int pdu_type, int idx, uint32_t offset, const char *name_add)
1680
8.49k
{
1681
8.49k
    uint8_t             oct;
1682
8.49k
    uint16_t            consumed;
1683
8.49k
    uint32_t            curr_offset;
1684
8.49k
    proto_tree         *subtree;
1685
8.49k
    proto_item         *item;
1686
8.49k
    value_string_ext    elem_names_ext;
1687
8.49k
    int                *elem_ett;
1688
8.49k
    const char         *elem_name;
1689
8.49k
    elem_func_hander    elem_funcs;
1690
1691
8.49k
    curr_offset = offset;
1692
8.49k
    consumed = 0;
1693
1694
8.49k
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1695
1696
8.49k
    oct = tvb_get_uint8(tvb, curr_offset);
1697
1698
8.49k
    if (oct == iei)
1699
148
    {
1700
148
        elem_name = try_val_to_str_ext(idx, &elem_names_ext);
1701
1702
        /* idx is out of range */
1703
148
        if (elem_name == NULL) {
1704
0
            proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_unknown_element,
1705
0
                tvb, curr_offset, -1,
1706
0
                "Unknown - aborting dissection%s", (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1707
0
            return consumed;
1708
0
        }
1709
1710
148
        subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, -1, elem_ett[idx], &item,
1711
148
                                             "%s%s", elem_name, (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1712
1713
148
        proto_tree_add_uint(subtree,
1714
148
            get_hf_elem_id(pdu_type), tvb,
1715
148
            curr_offset, 1, oct);
1716
1717
148
        if (elem_funcs[idx] == NULL)
1718
0
        {
1719
            /* BAD THING, CANNOT DETERMINE LENGTH */
1720
0
            expert_add_info(pinfo, item, &ei_gsm_a_no_element_dissector);
1721
1722
0
            consumed = 1;
1723
0
        }
1724
148
        else
1725
148
        {
1726
148
            char *a_add_string;
1727
1728
148
            a_add_string = (char*)wmem_alloc(pinfo->pool, 1024);
1729
148
            a_add_string[0] = '\0';
1730
148
            consumed = (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset + 1, -1, a_add_string, 1024);
1731
1732
148
            if (a_add_string[0] != '\0')
1733
0
            {
1734
0
                proto_item_append_text(item, "%s", a_add_string);
1735
0
            }
1736
148
        }
1737
1738
148
        consumed++;
1739
1740
148
        proto_item_set_len(item, consumed);
1741
148
    }
1742
1743
8.49k
    return consumed;
1744
8.49k
}
1745
1746
/*
1747
 * Type Value (TV) element dissector
1748
 * Where top half nibble is IEI and bottom half nibble is value.
1749
 *
1750
 * Length cannot be used in these functions, big problem if a element dissector
1751
 * is not defined for these.
1752
 */
1753
uint16_t elem_tv_short(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint8_t iei, int pdu_type, int idx, uint32_t offset, const char *name_add)
1754
2.59k
{
1755
2.59k
    uint8_t             oct;
1756
2.59k
    uint16_t            consumed;
1757
2.59k
    uint32_t            curr_offset;
1758
2.59k
    proto_tree         *subtree;
1759
2.59k
    proto_item         *item;
1760
2.59k
    value_string_ext    elem_names_ext;
1761
2.59k
    int                *elem_ett;
1762
2.59k
    const char         *elem_name;
1763
2.59k
    elem_func_hander    elem_funcs;
1764
1765
2.59k
    curr_offset = offset;
1766
2.59k
    consumed = 0;
1767
1768
2.59k
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1769
1770
2.59k
    oct = tvb_get_uint8(tvb, curr_offset);
1771
1772
2.59k
    if ((oct & 0xf0) == (iei & 0xf0))
1773
173
    {
1774
173
        elem_name = try_val_to_str_ext(idx, &elem_names_ext);
1775
1776
        /* idx is out of range */
1777
173
        if (elem_name == NULL) {
1778
0
            proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_unknown_element,
1779
0
                tvb, curr_offset, -1,
1780
0
                "Unknown - aborting dissection%s", (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1781
0
            return consumed;
1782
0
        }
1783
1784
173
        subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, -1, elem_ett[idx], &item,
1785
173
                                             "%s%s", elem_name, (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1786
1787
173
        proto_tree_add_uint_format_value(subtree, hf_gsm_a_common_elem_id_f0, tvb, curr_offset, 1, oct, "0x%1x-", oct>>4);
1788
1789
173
        if (elem_funcs[idx] == NULL)
1790
0
        {
1791
            /* BAD THING, CANNOT DETERMINE LENGTH */
1792
1793
0
            expert_add_info(pinfo, item, &ei_gsm_a_no_element_dissector);
1794
1795
0
            consumed++;
1796
0
        }
1797
173
        else
1798
173
        {
1799
173
            char *a_add_string;
1800
1801
173
            a_add_string = (char*)wmem_alloc(pinfo->pool, 1024);
1802
173
            a_add_string[0] = '\0';
1803
173
            consumed = (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset, RIGHT_NIBBLE, a_add_string, 1024);
1804
1805
173
            if (a_add_string[0] != '\0')
1806
0
            {
1807
0
                proto_item_append_text(item, "%s", a_add_string);
1808
0
            }
1809
173
        }
1810
1811
173
        proto_item_set_len(item, consumed);
1812
173
    }
1813
1814
2.59k
    return consumed;
1815
2.59k
}
1816
1817
/*
1818
 * Type (T) element dissector
1819
 */
1820
uint16_t elem_t(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint8_t iei, int pdu_type, int idx, uint32_t offset, const char *name_add)
1821
95
{
1822
95
    uint8_t             oct;
1823
95
    uint32_t            curr_offset;
1824
95
    uint16_t            consumed;
1825
95
    value_string_ext    elem_names_ext;
1826
95
    int                *elem_ett;
1827
95
    elem_func_hander    elem_funcs;
1828
1829
95
    curr_offset = offset;
1830
95
    consumed = 0;
1831
1832
95
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1833
1834
95
    (void)elem_ett;
1835
95
    (void)elem_funcs;
1836
1837
95
    oct = tvb_get_uint8(tvb, curr_offset);
1838
1839
95
    if (oct == iei)
1840
0
    {
1841
0
        proto_tree_add_uint_format(tree,
1842
0
            get_hf_elem_id(pdu_type), tvb,
1843
0
            curr_offset, 1, oct,
1844
0
            "%s%s",
1845
0
            val_to_str_ext(pinfo->pool, idx, &elem_names_ext, "Unknown (%u)"),
1846
0
            (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1847
1848
0
        consumed = 1;
1849
0
    }
1850
1851
95
    return consumed;
1852
95
}
1853
1854
/*
1855
 * Length Value (LV) element dissector
1856
 */
1857
uint16_t
1858
elem_lv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int pdu_type, int idx, uint32_t offset, unsigned len _U_, const char *name_add)
1859
4.83k
{
1860
4.83k
    uint8_t             parm_len;
1861
4.83k
    uint16_t            consumed;
1862
4.83k
    uint32_t            curr_offset;
1863
4.83k
    proto_tree         *subtree;
1864
4.83k
    proto_item         *item;
1865
4.83k
    value_string_ext    elem_names_ext;
1866
4.83k
    int                *elem_ett;
1867
4.83k
    const char         *elem_name;
1868
4.83k
    elem_func_hander    elem_funcs;
1869
1870
4.83k
    curr_offset = offset;
1871
4.83k
    consumed = 0;
1872
1873
4.83k
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1874
1875
4.83k
    parm_len = tvb_get_uint8(tvb, curr_offset);
1876
1877
4.83k
    elem_name = try_val_to_str_ext(idx, &elem_names_ext);
1878
1879
    /* idx is out of range */
1880
4.83k
    if (elem_name == NULL) {
1881
0
        proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_unknown_element,
1882
0
            tvb, curr_offset, parm_len + 1,
1883
0
            "Unknown - aborting dissection%s", (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1884
0
        return consumed;
1885
0
    }
1886
1887
4.83k
    subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, parm_len + 1, elem_ett[idx], &item,
1888
4.83k
                                            "%s%s", elem_name, (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1889
1890
4.83k
    proto_tree_add_uint(subtree, hf_gsm_a_length, tvb,
1891
4.83k
        curr_offset, 1, parm_len);
1892
1893
4.83k
    if (parm_len > 0)
1894
4.50k
    {
1895
4.50k
        if (elem_funcs[idx] == NULL)
1896
0
        {
1897
0
            proto_tree_add_item(subtree, hf_gsm_a_element_value, tvb, curr_offset + 1, parm_len, ENC_NA);
1898
1899
0
            consumed = parm_len;
1900
0
        }
1901
4.50k
        else
1902
4.50k
        {
1903
4.50k
            char *a_add_string;
1904
1905
4.50k
            a_add_string = (char*)wmem_alloc(pinfo->pool, 1024);
1906
4.50k
            a_add_string[0] = '\0';
1907
4.50k
            consumed =
1908
4.50k
                (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset + 1,
1909
4.50k
                    parm_len, a_add_string, 1024);
1910
1911
4.50k
            if (a_add_string[0] != '\0')
1912
303
            {
1913
303
                proto_item_append_text(item, "%s", a_add_string);
1914
303
            }
1915
4.50k
        }
1916
4.50k
    }
1917
1918
4.83k
    return (consumed + 1);
1919
4.83k
}
1920
1921
/*
1922
 * Length Value Extended(LV-E) element dissector
1923
 */
1924
uint16_t elem_lv_e(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int pdu_type, int idx, uint32_t offset, unsigned len _U_, const char *name_add)
1925
4
{
1926
4
    uint16_t            parm_len;
1927
4
    uint16_t            consumed;
1928
4
    uint32_t            curr_offset;
1929
4
    proto_tree         *subtree;
1930
4
    proto_item         *item;
1931
4
    value_string_ext    elem_names_ext;
1932
4
    int                *elem_ett;
1933
4
    const char         *elem_name;
1934
4
    elem_func_hander    elem_funcs;
1935
1936
4
    curr_offset = offset;
1937
4
    consumed = 0;
1938
1939
4
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
1940
1941
4
    parm_len = tvb_get_ntohs(tvb, curr_offset);
1942
1943
4
    elem_name = try_val_to_str_ext(idx, &elem_names_ext);
1944
1945
    /* idx is out of range */
1946
4
    if (elem_name == NULL) {
1947
0
        proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_unknown_element,
1948
0
            tvb, curr_offset, parm_len + 2,
1949
0
            "Unknown - aborting dissection%s", (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1950
0
        return consumed;
1951
0
    }
1952
1953
4
    subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, parm_len + 2, elem_ett[idx], &item,
1954
4
                                            "%s%s", elem_name, (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
1955
1956
4
    proto_tree_add_uint(subtree, hf_gsm_a_length, tvb,
1957
4
        curr_offset, 2, parm_len);
1958
1959
4
    if (parm_len > 0)
1960
4
    {
1961
4
        if (elem_funcs[idx] == NULL)
1962
0
        {
1963
0
            proto_tree_add_item(subtree, hf_gsm_a_element_value, tvb, curr_offset + 2, parm_len, ENC_NA);
1964
1965
0
            consumed = parm_len;
1966
0
        }
1967
4
        else
1968
4
        {
1969
4
            char *a_add_string;
1970
1971
4
            a_add_string = (char*)wmem_alloc(pinfo->pool, 1024);
1972
4
            a_add_string[0] = '\0';
1973
4
            consumed =
1974
4
                (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset + 2,
1975
4
                    parm_len, a_add_string, 1024);
1976
1977
4
            if (a_add_string[0] != '\0')
1978
0
            {
1979
0
                proto_item_append_text(item, "%s", a_add_string);
1980
0
            }
1981
4
        }
1982
4
    }
1983
1984
4
    return (consumed + 2);
1985
4
}
1986
/*
1987
 * Value (V) element dissector
1988
 *
1989
 * Length cannot be used in these functions, big problem if a element dissector
1990
 * is not defined for these.
1991
 */
1992
uint16_t elem_v(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int pdu_type, int idx, uint32_t offset, const char *name_add)
1993
18.2k
{
1994
18.2k
    uint16_t            consumed;
1995
18.2k
    uint32_t            curr_offset;
1996
18.2k
    proto_tree         *subtree;
1997
18.2k
    proto_item         *item;
1998
18.2k
    value_string_ext    elem_names_ext;
1999
18.2k
    int                *elem_ett;
2000
18.2k
    const char         *elem_name;
2001
18.2k
    elem_func_hander    elem_funcs;
2002
2003
18.2k
    curr_offset = offset;
2004
18.2k
    consumed = 0;
2005
2006
18.2k
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
2007
2008
18.2k
    elem_name = try_val_to_str_ext(idx, &elem_names_ext);
2009
2010
18.2k
    if (elem_name == NULL || elem_funcs[idx] == NULL)
2011
0
    {
2012
        /* BAD THING, CANNOT DETERMINE LENGTH */
2013
0
        proto_tree_add_expert(tree, pinfo, &ei_gsm_a_no_element_dissector, tvb, curr_offset, 1);
2014
2015
0
        consumed = 1;
2016
0
    }
2017
18.2k
    else
2018
18.2k
    {
2019
18.2k
        char *a_add_string;
2020
2021
18.2k
        subtree =
2022
18.2k
            proto_tree_add_subtree_format(tree,
2023
18.2k
                tvb, curr_offset, 0,
2024
18.2k
                elem_ett[idx], &item, "%s%s", elem_name,
2025
18.2k
                (name_add == NULL) || (name_add[0] == '\0') ? "" : name_add);
2026
2027
18.2k
        a_add_string= (char*)wmem_alloc(pinfo->pool, 1024);
2028
18.2k
        a_add_string[0] = '\0';
2029
18.2k
        consumed = (*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset, -1, a_add_string, 1024);
2030
18.2k
        if (a_add_string[0] != '\0')
2031
1.69k
        {
2032
1.69k
            proto_item_append_text(item, "%s", a_add_string);
2033
1.69k
        }
2034
18.2k
        proto_item_set_len(item, consumed);
2035
18.2k
    }
2036
2037
18.2k
    return (consumed);
2038
18.2k
}
2039
2040
/*
2041
 * Short Value (V_SHORT) element dissector
2042
 *
2043
 * nibble is used in this function to indicate right or left nibble of the octet
2044
 * This is expected to be used right nibble first, as the tables of 24.008.
2045
 */
2046
2047
uint16_t elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int pdu_type, int idx, uint32_t offset, uint32_t nibble)
2048
4.41k
{
2049
4.41k
    uint16_t            consumed = 1;
2050
4.41k
    uint32_t            curr_offset;
2051
4.41k
    proto_tree         *subtree;
2052
4.41k
    proto_item         *item;
2053
4.41k
    value_string_ext    elem_names_ext;
2054
4.41k
    int                *elem_ett;
2055
4.41k
    const elem_fcn     *elem_funcs;
2056
4.41k
    char               *a_add_string;
2057
4.41k
    const char         *elem_name;
2058
2059
4.41k
    curr_offset = offset;
2060
2061
4.41k
    SET_ELEM_VARS(pdu_type, elem_names_ext, elem_ett, elem_funcs, &ei_gsm_a_unknown_pdu_type);
2062
2063
4.41k
    elem_name = try_val_to_str_ext(idx, &elem_names_ext);
2064
2065
    /* idx is out of range */
2066
4.41k
    if (elem_name == NULL) {
2067
0
        proto_tree_add_expert(tree, pinfo, &ei_gsm_a_unknown_element,
2068
0
            tvb, curr_offset, 0);
2069
0
        return consumed;
2070
0
    }
2071
2072
4.41k
    subtree = proto_tree_add_subtree(tree, tvb, curr_offset, 0, elem_ett[idx], &item, elem_name);
2073
2074
4.41k
    a_add_string= (char*)wmem_alloc(pinfo->pool, 1024);
2075
4.41k
    a_add_string[0] = '\0';
2076
2077
4.41k
    if (elem_funcs[idx] == NULL)
2078
0
    {
2079
        /* NOT NECESSARILY A BAD THING - LENGTH IS HALF OCTET */
2080
0
        (void)de_spare_nibble(tvb, subtree, pinfo, curr_offset, nibble, a_add_string, 1024);
2081
0
    }
2082
4.41k
    else
2083
4.41k
    {
2084
4.41k
        (void)(*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset, nibble, a_add_string, 1024);
2085
4.41k
    }
2086
2087
4.41k
    if (a_add_string[0] != '\0')
2088
0
    {
2089
0
        proto_item_append_text(item, "%s", a_add_string);
2090
0
    }
2091
4.41k
    proto_item_set_len(item, consumed);
2092
2093
4.41k
    return consumed;
2094
4.41k
}
2095
2096
2097
static dgt_set_t Dgt1_9_bcd = {
2098
    {
2099
  /*  0   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f */
2100
     '0','1','2','3','4','5','6','7','8','9','?','?','?','?','?','?'
2101
    }
2102
};
2103
2104
/* FUNCTIONS */
2105
2106
/* 3GPP TS 24.008
2107
 * [3] 10.5.1.1 Cell Identity
2108
 */
2109
uint16_t
2110
de_cell_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string, int string_len)
2111
362
{
2112
362
    uint32_t curr_offset;
2113
2114
362
    curr_offset = offset;
2115
2116
362
    curr_offset +=
2117
        /* 0x02 CI */
2118
362
        be_cell_id_aux(tvb, tree, pinfo, offset, len, add_string, string_len, 0x02);
2119
2120
    /* no length check possible */
2121
2122
362
    return (curr_offset - offset);
2123
362
}
2124
/*
2125
 * 10.5.1.2 Ciphering Key Sequence Number
2126
 */
2127
2128
2129
/*
2130
 * Key sequence (octet 1)
2131
 * Bits
2132
 * 3 2 1
2133
 * 0 0 0
2134
 * through
2135
 * 1 1 0
2136
 * Possible values for the ciphering key sequence number
2137
 * 1 1 1 No key is available (MS to network);Reserved (network to MS)
2138
 */
2139
2140
static const value_string gsm_a_key_seq_vals[] = {
2141
    { 0, "Ciphering key sequence number"},
2142
    { 1, "Ciphering key sequence number"},
2143
    { 2, "Ciphering key sequence number"},
2144
    { 3, "Ciphering key sequence number"},
2145
    { 4, "Ciphering key sequence number"},
2146
    { 5, "Ciphering key sequence number"},
2147
    { 6, "Ciphering key sequence number"},
2148
    { 7, "No key is available (MS to network)"},
2149
    { 0,    NULL }
2150
};
2151
2152
static uint16_t
2153
de_ciph_key_seq_num( tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
2154
579
{
2155
579
    uint32_t curr_offset, bit_offset;
2156
2157
579
    curr_offset = offset;
2158
2159
579
    if (RIGHT_NIBBLE == len)
2160
6
        bit_offset = 4;
2161
573
    else
2162
573
        bit_offset = 0;
2163
2164
579
    proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3)+bit_offset, 1, ENC_BIG_ENDIAN);
2165
579
    proto_tree_add_bits_item(tree, hf_gsm_a_key_seq, tvb, (curr_offset<<3)+bit_offset+1, 3, ENC_BIG_ENDIAN);
2166
579
    curr_offset++;
2167
2168
579
    return (curr_offset - offset);
2169
579
}
2170
2171
2172
/*
2173
 * [3] 10.5.1.3
2174
 */
2175
2176
uint16_t
2177
de_lai(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
2178
829
{
2179
829
    uint16_t    value;
2180
829
    uint32_t    curr_offset;
2181
829
    proto_tree *subtree;
2182
829
    proto_item *item;
2183
829
    char       *mcc_mnc_str;
2184
2185
829
    curr_offset = offset;
2186
2187
829
    subtree = proto_tree_add_subtree(tree,
2188
829
                               tvb, curr_offset, 5, ett_gsm_common_elem[DE_LAI], &item,
2189
829
                               val_to_str_ext_const(DE_LAI, &gsm_common_elem_strings_ext, ""));
2190
2191
829
    mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, subtree, curr_offset, E212_LAI, true);
2192
2193
829
    curr_offset += 3;
2194
2195
829
    value = tvb_get_ntohs(tvb, curr_offset);
2196
2197
829
    proto_tree_add_item(subtree, hf_gsm_a_lac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
2198
2199
829
    proto_item_append_text(item, " - %s, LAC %u", mcc_mnc_str, value);
2200
2201
829
    curr_offset += 2;
2202
2203
    /* no length check possible */
2204
2205
829
    return (curr_offset - offset);
2206
829
}
2207
2208
/*
2209
 * [3] 10.5.1.4 Mobile Identity
2210
 * 3GPP TS 24.008 version 7.8.0 Release 7
2211
 */
2212
2213
uint16_t
2214
de_mid(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string, int string_len)
2215
1.73k
{
2216
1.73k
    uint8_t   oct;
2217
1.73k
    uint32_t  curr_offset;
2218
1.73k
    uint32_t  value;
2219
1.73k
    bool      odd;
2220
1.73k
    const char *digit_str;
2221
1.73k
    proto_item* ti;
2222
2223
1.73k
    curr_offset = offset;
2224
2225
1.73k
    oct = tvb_get_uint8(tvb, curr_offset);
2226
2227
1.73k
    switch (oct & 0x07)
2228
1.73k
    {
2229
318
    case 0: /* No Identity */
2230
318
        proto_tree_add_item(tree, hf_gsm_a_unused, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2231
318
        proto_tree_add_item(tree, hf_gsm_a_odd_even_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2232
318
        proto_tree_add_item(tree, hf_gsm_a_mobile_identity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2233
2234
318
        if (add_string)
2235
318
            snprintf(add_string, string_len, " - No Identity Code");
2236
2237
318
        curr_offset++;
2238
2239
318
        if (len != 1 && len != 3)
2240
285
        {
2241
285
            expert_add_info(pinfo, tree, &ei_gsm_a_format_not_supported);
2242
285
        }
2243
2244
318
        curr_offset += len - 1;
2245
318
        break;
2246
2247
86
    case 3: /* IMEISV */
2248
        /* FALLTHRU */
2249
2250
972
    case 1: /* IMSI */
2251
972
        odd = oct & 0x08;
2252
972
        proto_tree_add_item(tree, hf_gsm_a_id_dig_1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2253
972
        proto_tree_add_item(tree, hf_gsm_a_odd_even_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2254
972
        proto_tree_add_item(tree, hf_gsm_a_mobile_identity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2255
2256
972
        if (curr_offset - offset >= len) /* Sanity check */
2257
19
            return (curr_offset - offset);
2258
2259
953
        if((oct & 0x07) == 3){
2260
            /* imeisv */
2261
77
            digit_str = tvb_bcd_dig_to_str(pinfo->pool, tvb ,curr_offset , len - (curr_offset - offset), NULL, true);
2262
77
            proto_tree_add_string_format(tree,
2263
77
                hf_gsm_a_imeisv,
2264
77
                tvb, curr_offset, len - (curr_offset - offset),
2265
77
                digit_str,
2266
77
                "BCD Digits: %s",
2267
77
                digit_str);
2268
876
        }else{
2269
876
            digit_str = dissect_e212_imsi(tvb, pinfo, tree,  curr_offset, len - (curr_offset - offset), true);
2270
876
        }
2271
2272
953
        if (sccp_assoc && ! sccp_assoc->calling_party) {
2273
0
            sccp_assoc->calling_party = wmem_strdup_printf(wmem_file_scope(),
2274
0
                ((oct & 0x07) == 3) ? "IMEISV: %s" : "IMSI: %s",
2275
0
                digit_str );
2276
0
        }
2277
2278
953
        if (add_string)
2279
953
            snprintf(add_string, string_len, " - %s (%s)",
2280
953
                ((oct & 0x07) == 3) ? "IMEISV" : "IMSI",
2281
953
                digit_str);
2282
2283
953
        curr_offset += len - (curr_offset - offset);
2284
2285
953
        if (!odd)
2286
853
        {
2287
853
            proto_tree_add_item(tree, hf_gsm_a_filler, tvb, curr_offset - 1, 1, ENC_NA);
2288
853
        }
2289
953
        break;
2290
2291
113
    case 2: /* IMEI */
2292
113
        proto_tree_add_uint_format_value(tree, hf_gsm_a_identity_digit1, tvb, curr_offset, 1, oct, "%c", Dgt1_9_bcd.out[(oct & 0xf0) >> 4]);
2293
2294
113
        proto_tree_add_item(tree, hf_gsm_a_odd_even_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2295
2296
113
        proto_tree_add_item(tree, hf_gsm_a_mobile_identity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2297
2298
113
        if (curr_offset - offset >= len) /* Sanity check */
2299
17
            return (curr_offset - offset);
2300
2301
96
        digit_str = tvb_bcd_dig_to_str(pinfo->pool, tvb, curr_offset, len - (curr_offset - offset), NULL, true);
2302
2303
96
        proto_tree_add_string_format(tree,
2304
96
            hf_gsm_a_imei,
2305
96
            tvb, curr_offset, len - (curr_offset - offset),
2306
96
            digit_str,
2307
96
            "BCD Digits: %s",
2308
96
            digit_str);
2309
2310
96
        if (add_string)
2311
96
            snprintf(add_string, string_len, " - IMEI (%s)", digit_str);
2312
2313
96
        curr_offset += len - (curr_offset - offset);
2314
96
        break;
2315
2316
60
    case 4: /* TMSI/P-TMSI/M-TMSI */
2317
60
        proto_tree_add_item(tree, hf_gsm_a_unused, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2318
60
        proto_tree_add_item(tree, hf_gsm_a_odd_even_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2319
60
        proto_tree_add_item(tree, hf_gsm_a_mobile_identity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2320
60
        curr_offset++;
2321
2322
60
        proto_tree_add_item_ret_uint(tree, hf_3gpp_tmsi, tvb, curr_offset, 4, ENC_BIG_ENDIAN, &value);
2323
2324
60
        if (add_string)
2325
60
            snprintf(add_string, string_len, " - TMSI/P-TMSI (0x%04x)", value);
2326
2327
60
        curr_offset += 4;
2328
60
        break;
2329
2330
92
    case 5: /* TMGI and optional MBMS Session Identity */
2331
        /* Spare bits (octet 3) Bits 8-7 */
2332
92
        proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, curr_offset<<3, 2, ENC_BIG_ENDIAN);
2333
        /* MBMS Session Identity indication (octet 3) Bit 6 */
2334
92
        proto_tree_add_item(tree, hf_gsm_a_mbs_ses_id_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2335
        /* MCC/MNC indication (octet 3) Bit 5 */
2336
92
        proto_tree_add_item(tree, hf_gsm_a_tmgi_mcc_mnc_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2337
        /* Odd/even indication (octet 3) Bit 4 */
2338
92
        proto_tree_add_item(tree, hf_gsm_a_odd_even_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2339
        /* Type of identity (octet 3) Bits 3-1 */
2340
92
        proto_tree_add_item(tree, hf_gsm_a_mobile_identity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2341
92
        curr_offset++;
2342
        /* MBMS Service ID (octet 4, 5 and 6) */
2343
92
        proto_tree_add_item(tree, hf_gsm_a_mbs_service_id, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
2344
92
        curr_offset += 3;
2345
92
        if ((oct&0x10) == 0x10) {
2346
            /* MCC/MNC*/
2347
            /* MCC, Mobile country code (octet 6a, octet 6b bits 1 to 4)*/
2348
            /* MNC, Mobile network code (octet 6b bits 5 to 8, octet 6c) */
2349
32
            curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, E212_NONE, true);
2350
32
        }
2351
92
        if ((oct&0x20) == 0x20) {
2352
            /* MBMS Session Identity (octet 7)
2353
             * The MBMS Session Identity field is encoded as the value part
2354
             * of the MBMS Session Identity IE as specified in 3GPP TS 48.018 [86].
2355
             */
2356
27
            proto_tree_add_item(tree, hf_gsm_a_mbs_session_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2357
27
            curr_offset++;
2358
27
        }
2359
92
        break;
2360
2361
168
    default:    /* Reserved */
2362
168
        proto_tree_add_item(tree, hf_gsm_a_odd_even_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2363
168
        ti = proto_tree_add_item(tree, hf_gsm_a_mobile_identity_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2364
168
        expert_add_info_format(pinfo, ti, &ei_gsm_a_mobile_identity_type, "Unknown format %u", (oct & 0x07));
2365
2366
168
        if (add_string)
2367
168
            snprintf(add_string, string_len, " - Format Unknown");
2368
2369
168
        curr_offset += len;
2370
168
        break;
2371
1.73k
    }
2372
2373
1.61k
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
2374
2375
1.61k
    return (curr_offset - offset);
2376
1.73k
}
2377
2378
/*
2379
 * [3] 10.5.1.5
2380
 */
2381
uint16_t
2382
de_ms_cm_1(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
2383
12
{
2384
12
    uint32_t    curr_offset;
2385
12
    proto_tree *subtree;
2386
2387
12
    curr_offset = offset;
2388
2389
12
    subtree =
2390
12
    proto_tree_add_subtree(tree,
2391
12
        tvb, curr_offset, 1, ett_gsm_common_elem[DE_MS_CM_1], NULL,
2392
12
        val_to_str_ext_const(DE_MS_CM_1, &gsm_common_elem_strings_ext, ""));
2393
2394
12
    proto_tree_add_item(subtree, hf_gsm_a_b8spare, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2395
2396
12
    proto_tree_add_item(subtree, hf_gsm_a_MSC_rev, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2397
2398
12
    proto_tree_add_item(subtree, hf_gsm_a_ES_IND, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2399
2400
12
    proto_tree_add_item(subtree, hf_gsm_a_A5_1_algorithm_sup, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2401
2402
12
    proto_tree_add_item(subtree, hf_gsm_a_RF_power_capability, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2403
2404
12
    curr_offset++;
2405
2406
    /* no length check possible */
2407
2408
12
    return (curr_offset - offset);
2409
12
}
2410
2411
/*
2412
 * [3] 10.5.1.6 Mobile Station Classmark 2
2413
 * 3GPP TS 24.008 version 7.8.0 Release 7
2414
 */
2415
uint16_t
2416
de_ms_cm_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
2417
1.29k
{
2418
1.29k
    uint32_t curr_offset;
2419
1.29k
    curr_offset = offset;
2420
2421
1.29k
    proto_tree_add_item(tree, hf_gsm_a_b8spare, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2422
2423
1.29k
    proto_tree_add_item(tree, hf_gsm_a_MSC_rev, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2424
2425
1.29k
    proto_tree_add_item(tree, hf_gsm_a_ES_IND, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2426
2427
1.29k
    proto_tree_add_item(tree, hf_gsm_a_A5_1_algorithm_sup, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2428
2429
1.29k
    proto_tree_add_item(tree, hf_gsm_a_RF_power_capability, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2430
2431
1.29k
    curr_offset++;
2432
2433
1.29k
    NO_MORE_DATA_CHECK(len);
2434
2435
779
    proto_tree_add_item(tree, hf_gsm_a_b8spare, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2436
2437
779
    proto_tree_add_item(tree, hf_gsm_a_ps_sup_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2438
2439
779
    proto_tree_add_item(tree, hf_gsm_a_SS_screening_indicator, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2440
2441
    /* SM capability (MT SMS pt to pt capability) (octet 4)*/
2442
779
    proto_tree_add_item(tree, hf_gsm_a_SM_capability, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2443
    /* VBS notification reception (octet 4) */
2444
779
    proto_tree_add_item(tree, hf_gsm_a_VBS_notification_rec, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2445
    /*VGCS notification reception (octet 4)*/
2446
779
    proto_tree_add_item(tree, hf_gsm_a_VGCS_notification_rec, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2447
    /* FC Frequency Capability (octet 4 ) */
2448
779
    proto_tree_add_item(tree, hf_gsm_a_FC_frequency_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2449
2450
779
    curr_offset++;
2451
2452
779
    NO_MORE_DATA_CHECK(len);
2453
2454
    /* CM3 (octet 5, bit 8) */
2455
740
    proto_tree_add_item(tree, hf_gsm_a_CM3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2456
    /* spare bit 7 */
2457
740
    proto_tree_add_item(tree, hf_gsm_a_b7spare, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2458
    /* LCS VA capability (LCS value added location request notification capability) (octet 5,bit 6) */
2459
740
    proto_tree_add_item(tree, hf_gsm_a_LCS_VA_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2460
    /* UCS2 treatment (octet 5, bit 5) */
2461
740
    proto_tree_add_item(tree, hf_gsm_a_UCS2_treatment, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2462
    /* SoLSA (octet 5, bit 4) */
2463
740
    proto_tree_add_item(tree, hf_gsm_a_SoLSA, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2464
    /* CMSP: CM Service Prompt (octet 5, bit 3) */
2465
740
    proto_tree_add_item(tree, hf_gsm_a_CMSP, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2466
    /* A5/3 algorithm supported (octet 5, bit 2) */
2467
740
    proto_tree_add_item(tree, hf_gsm_a_A5_3_algorithm_sup, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2468
    /* A5/2 algorithm supported (octet 5, bit 1) */
2469
740
    proto_tree_add_item(tree, hf_gsm_a_A5_2_algorithm_sup, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2470
2471
740
    curr_offset++;
2472
2473
740
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
2474
2475
740
    return (curr_offset - offset);
2476
779
}
2477
2478
/*
2479
 * [3] 10.5.1.7 Mobile Station Classmark 3
2480
 * 3GPP TS 24.008 version 12.10.0 Release 12
2481
 */
2482
#define AVAILABLE_BITS_CHECK(n) \
2483
28.8k
    bits_left = ((len + offset) << 3) - bit_offset; \
2484
28.8k
    if (bits_left < (n)) { \
2485
566
        if (bits_left > 0) \
2486
566
            proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, bits_left, ENC_BIG_ENDIAN); \
2487
566
        else if (bits_left < 0) \
2488
525
            proto_tree_add_expert(tree, pinfo, &ei_gsm_a_ie_length_too_short, tvb, offset, len); \
2489
566
        return len; \
2490
566
    }
2491
2492
uint16_t
2493
de_ms_cm_3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
2494
881
{
2495
881
    uint32_t    curr_offset;
2496
881
    uint32_t    bit_offset;     /* Offset in bits */
2497
881
    uint8_t     length;
2498
881
    proto_tree *subtree;
2499
881
    proto_item *item;
2500
881
    int32_t     bits_left;
2501
881
    uint32_t    target_bit_offset, old_bit_offset;
2502
881
    uint64_t    multi_bnd_sup_fields, rsupport, multislotCapability;
2503
881
    uint64_t    msMeasurementCapability, msPosMethodCapPresent;
2504
881
    uint64_t    ecsdMultiSlotCapability, eightPskStructPresent, eightPskStructRfPowerCapPresent;
2505
881
    uint64_t    gsm400BandInfoPresent, gsm850AssocRadioCapabilityPresent;
2506
881
    uint64_t    gsm1900AssocRadioCapabilityPresent, dtmEGprsMultiSlotInfoPresent;
2507
881
    uint64_t    dtmEgprsMultiSlotClassPresent, singleBandSupport;
2508
881
    uint64_t    gsm750AssocRadioCapabilityPresent, extDtmEGprsMultiSlotInfoPresent;
2509
881
    uint64_t    highMultislotCapPresent, geranIuModeSupport;
2510
881
    uint64_t    tGsm400BandInfoPresent, tGsm900AssocRadioCapabilityPresent, dtmEGprsHighMultiSlotInfoPresent;
2511
881
    uint64_t    dtmEgprsHighMultiSlotClassPresent, gsm710AssocRadioCapabilityPresent;
2512
881
    uint64_t    tGsm810AssocRadioCapabilityPresent;
2513
2514
881
    curr_offset = offset;
2515
2516
881
    bit_offset = curr_offset << 3;
2517
2518
    /* Spare bit */
2519
881
    proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2520
881
    bit_offset++;
2521
2522
    /* Multiband supported field
2523
     * { < Multiband supported : { 000 } >
2524
     * < A5 bits >
2525
     * | < Multiband supported : { 101 | 110 } >
2526
     * < A5 bits >
2527
     * < Associated Radio Capability 2 : bit(4) >
2528
     * < Associated Radio Capability 1 : bit(4) >
2529
     * | < Multiband supported : { 001 | 010 | 100 } >
2530
     * < A5 bits >
2531
     * < spare bit >(4)
2532
     * < Associated Radio Capability 1 : bit(4) > }
2533
     */
2534
2535
881
    item = proto_tree_add_bits_ret_val(tree, hf_gsm_a_multi_bnd_sup_fields, tvb, bit_offset, 3, &multi_bnd_sup_fields, ENC_BIG_ENDIAN);
2536
881
    subtree = proto_item_add_subtree(item, ett_gsm_common_elem[DE_MS_CM_3]);
2537
2538
881
    proto_tree_add_bits_item(subtree, hf_gsm_a_gsm1800_supported, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2539
881
    bit_offset++;
2540
2541
881
    proto_tree_add_bits_item(subtree, hf_gsm_a_egsm_supported, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2542
881
    bit_offset++;
2543
2544
881
    proto_tree_add_bits_item(subtree, hf_gsm_a_pgsm_supported, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2545
881
    bit_offset++;
2546
2547
881
    item = proto_tree_add_bits_item(tree, hf_gsm_a_cm3_A5_bits, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2548
881
    subtree = proto_item_add_subtree(item, ett_gsm_common_elem[DE_MS_CM_3]);
2549
2550
    /* < A5 bits > */
2551
881
    proto_tree_add_bits_item(subtree, hf_gsm_a_A5_7_algorithm_sup, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2552
881
    bit_offset++;
2553
881
    proto_tree_add_bits_item(subtree, hf_gsm_a_A5_6_algorithm_sup, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2554
881
    bit_offset++;
2555
881
    proto_tree_add_bits_item(subtree, hf_gsm_a_A5_5_algorithm_sup, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2556
881
    bit_offset++;
2557
881
    proto_tree_add_bits_item(subtree, hf_gsm_a_A5_4_algorithm_sup, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2558
881
    bit_offset++;
2559
2560
881
    switch (multi_bnd_sup_fields) {
2561
408
    case 0:
2562
        /* A5 bits dissected is done */
2563
408
        break;
2564
        /*
2565
         * | < Multiband supported : { 001 | 010 | 100 } >
2566
         */
2567
52
    case 1:
2568
137
    case 2:
2569
230
    case 4:
2570
        /* < spare bit >(4) */
2571
230
        proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2572
230
        bit_offset += 4;
2573
        /* < Associated Radio Capability 1 : bit(4) > */
2574
230
        proto_tree_add_bits_item(tree, hf_gsm_a_ass_radio_cap1, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2575
230
        bit_offset += 4;
2576
230
        break;
2577
        /* < Multiband supported : { 101 | 110 } > */
2578
39
    case 5:
2579
        /* fall trough */
2580
99
    case 6:
2581
        /* < Associated Radio Capability 2 : bit(4) > */
2582
99
        proto_tree_add_bits_item(tree, hf_gsm_a_ass_radio_cap2, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2583
99
        bit_offset += 4;
2584
        /* < Associated Radio Capability 1 : bit(4) > */
2585
99
        proto_tree_add_bits_item(tree, hf_gsm_a_ass_radio_cap1, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2586
99
        bit_offset += 4;
2587
99
        break;
2588
144
    default:
2589
144
        break;
2590
881
    }
2591
    /* Extract R Support */
2592
879
    AVAILABLE_BITS_CHECK(1);
2593
731
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_rsupport, tvb, bit_offset, 1, &rsupport, ENC_BIG_ENDIAN);
2594
731
    bit_offset++;
2595
2596
731
    if (rsupport == 1)
2597
262
    {
2598
        /*
2599
         * { 0 | 1 < R Support > }
2600
         * Extract R Capabilities
2601
         */
2602
262
        proto_tree_add_bits_item(tree, hf_gsm_a_r_capabilities, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2603
262
        bit_offset = bit_offset + 3;
2604
262
    }
2605
2606
    /*
2607
     * { 0 | 1 < HSCSD Multi Slot Capability > }
2608
     * Extract Multislot capability
2609
     */
2610
731
    AVAILABLE_BITS_CHECK(1);
2611
731
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_multislot_capabilities, tvb, bit_offset, 1, &multislotCapability, ENC_BIG_ENDIAN);
2612
731
    bit_offset++;
2613
2614
731
    if (multislotCapability == 1)
2615
217
    {
2616
        /* Extract Multislot Class */
2617
217
        proto_tree_add_bits_item(tree, hf_gsm_a_multislot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2618
217
        bit_offset = bit_offset + 5;
2619
217
    }
2620
2621
    /* < UCS2 treatment: bit > */
2622
731
    AVAILABLE_BITS_CHECK(1);
2623
728
    proto_tree_add_bits_item(tree, hf_gsm_a_ucs2_treatment, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2624
728
    bit_offset = bit_offset + 1;
2625
2626
    /* < Extended Measurement Capability : bit > */
2627
728
    AVAILABLE_BITS_CHECK(1);
2628
720
    proto_tree_add_bits_item(tree, hf_gsm_a_extended_measurement_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2629
720
    bit_offset = bit_offset + 1;
2630
2631
    /* { 0 | 1 < MS measurement capability > }
2632
     * Extract MS Measurement capability
2633
     */
2634
720
    AVAILABLE_BITS_CHECK(1);
2635
720
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_ms_measurement_capability, tvb, bit_offset, 1, &msMeasurementCapability, ENC_BIG_ENDIAN);
2636
720
    bit_offset = bit_offset + 1;
2637
2638
720
    if (msMeasurementCapability == 1)
2639
291
    {
2640
        /* Extract SMS Value n/4 */
2641
291
        proto_tree_add_bits_item(tree, hf_gsm_a_sms_value, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2642
291
        bit_offset = bit_offset + 4;
2643
2644
        /* Extract SM Value n/4 */
2645
291
        proto_tree_add_bits_item(tree, hf_gsm_a_sm_value, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2646
291
        bit_offset = bit_offset + 4;
2647
291
    }
2648
2649
    /* { 0 | 1 < MS Positioning Method Capability > }
2650
     * Extract MS Positioning Method Capability
2651
     */
2652
720
    AVAILABLE_BITS_CHECK(1);
2653
709
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_ms_pos_method_cap_present, tvb, bit_offset, 1, &msPosMethodCapPresent, ENC_BIG_ENDIAN);
2654
709
    bit_offset = bit_offset + 1;
2655
2656
709
    if (msPosMethodCapPresent == 1)
2657
254
    {
2658
        /* Extract MS Positioning Method */
2659
254
        item = proto_tree_add_bits_item(tree, hf_gsm_a_ms_pos_method, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2660
254
        subtree = proto_item_add_subtree(item, ett_gsm_common_elem[DE_MS_CM_3]);
2661
2662
254
        proto_tree_add_bits_item(subtree, hf_gsm_a_ms_assisted_e_otd, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2663
254
        bit_offset++;
2664
2665
254
        proto_tree_add_bits_item(subtree, hf_gsm_a_ms_based_e_otd, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2666
254
        bit_offset++;
2667
2668
254
        proto_tree_add_bits_item(subtree, hf_gsm_a_ms_assisted_gps, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2669
254
        bit_offset++;
2670
2671
254
        proto_tree_add_bits_item(subtree, hf_gsm_a_ms_based_gps, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2672
254
        bit_offset++;
2673
2674
254
        proto_tree_add_bits_item(subtree, hf_gsm_a_ms_conventional_gps, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2675
254
        bit_offset++;
2676
254
    }
2677
2678
    /* { 0 | 1 < ECSD Multi Slot Capability > }
2679
     * Extract ECSD Multi Slot Capability
2680
     */
2681
709
    AVAILABLE_BITS_CHECK(1);
2682
704
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_ecsd_multi_slot_capability, tvb, bit_offset, 1, &ecsdMultiSlotCapability, ENC_BIG_ENDIAN);
2683
704
    bit_offset = bit_offset + 1;
2684
2685
704
    if (ecsdMultiSlotCapability == 1)
2686
243
    {
2687
        /* Extract ECSD Multi Slot Class */
2688
243
        proto_tree_add_bits_item(tree, hf_gsm_a_ecsd_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2689
243
        bit_offset = bit_offset + 5;
2690
243
    }
2691
2692
    /* { 0 | 1 < 8-PSK Struct > }
2693
     * Extract 8-PSK struct presence
2694
     */
2695
704
    AVAILABLE_BITS_CHECK(1);
2696
700
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_8_psk_struct_present, tvb, bit_offset, 1, &eightPskStructPresent, ENC_BIG_ENDIAN);
2697
700
    bit_offset = bit_offset + 1;
2698
2699
700
    if (eightPskStructPresent == 1)
2700
238
    {
2701
        /* At least Modulation Capability and cap1,cap2 present indicators are present */
2702
238
        uint8_t psk_struct_len = 3;
2703
238
        uint32_t tmp_bit_offset = bit_offset;
2704
2705
        /* Check if Power Capability 1 is present */
2706
238
        tmp_bit_offset++;
2707
238
        if (tvb_get_bits8(tvb,tmp_bit_offset,1) == 1){
2708
138
            psk_struct_len += 2;
2709
138
            tmp_bit_offset += 2;
2710
138
        }
2711
238
        tmp_bit_offset++;
2712
        /* Check if Power Capability 2 is present */
2713
238
        if (tvb_get_bits8(tvb,tmp_bit_offset,1) == 1){
2714
133
            psk_struct_len += 2;
2715
133
        }
2716
        /* Extract 8-PSK struct */
2717
238
        item = proto_tree_add_bits_item(tree, hf_gsm_a_8_psk_struct, tvb, bit_offset, psk_struct_len, ENC_BIG_ENDIAN);
2718
238
        subtree = proto_item_add_subtree(item, ett_gsm_common_elem[DE_MS_CM_3]);
2719
238
        old_bit_offset = bit_offset;
2720
2721
        /* Extract Modulation Capability */
2722
238
        proto_tree_add_bits_item(subtree, hf_gsm_a_modulation_capability, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2723
238
        bit_offset = bit_offset + 1;
2724
2725
        /* Extract 8_PSK RF Power Capability 1 */
2726
238
        proto_tree_add_bits_ret_val(subtree, hf_gsm_a_8_psk_rf_power_capability_1_present, tvb, bit_offset,
2727
238
                                    1, &eightPskStructRfPowerCapPresent, ENC_BIG_ENDIAN);
2728
238
        bit_offset = bit_offset + 1;
2729
238
        if (eightPskStructRfPowerCapPresent == 1)
2730
137
        {
2731
137
            proto_tree_add_bits_item(subtree, hf_gsm_a_8_psk_rf_power_capability_1, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2732
137
            bit_offset = bit_offset + 2;
2733
137
        }
2734
2735
        /* Extract 8_PSK RF Power Capability 2 */
2736
238
        proto_tree_add_bits_ret_val(subtree, hf_gsm_a_8_psk_rf_power_capability_2_present, tvb, bit_offset,
2737
238
                                    1, &eightPskStructRfPowerCapPresent, ENC_BIG_ENDIAN);
2738
238
        bit_offset = bit_offset + 1;
2739
238
        if (eightPskStructRfPowerCapPresent == 1)
2740
133
        {
2741
133
            proto_tree_add_bits_item(subtree, hf_gsm_a_8_psk_rf_power_capability_2, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2742
133
            bit_offset = bit_offset + 2;
2743
133
        }
2744
238
        length = (uint8_t)((bit_offset - old_bit_offset)>>3);
2745
238
        if ((bit_offset - old_bit_offset) & 0x07)
2746
237
            length++;
2747
238
        proto_item_set_len(item, length);
2748
238
    }
2749
2750
    /* { 0 | 1 < GSM 400 Bands Supported : { 01 | 10 | 11 } >
2751
     *   < GSM 400 Associated Radio Capability: bit(4) > }
2752
     * Extract GSM 400 Band Information presence
2753
     */
2754
700
    AVAILABLE_BITS_CHECK(1);
2755
689
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_gsm_400_band_info_present, tvb, bit_offset, 1, &gsm400BandInfoPresent, ENC_BIG_ENDIAN);
2756
689
    bit_offset = bit_offset + 1;
2757
2758
689
    if (gsm400BandInfoPresent == 1)
2759
241
    {
2760
        /* Extract GSM 400 Bands Supported */
2761
241
        proto_tree_add_bits_item(tree, hf_gsm_a_gsm_400_bands_supported, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2762
241
        bit_offset = bit_offset + 2;
2763
2764
        /* Extract GSM 400 Associated Radio Capability */
2765
241
        proto_tree_add_bits_item(tree, hf_gsm_a_gsm_400_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2766
241
        bit_offset = bit_offset + 4;
2767
241
    }
2768
2769
    /* { 0 | 1 <GSM 850 Associated Radio Capability : bit(4) > }
2770
     * Extract GSM 850 Associated Radio Capability presence
2771
     */
2772
689
    AVAILABLE_BITS_CHECK(1);
2773
684
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_gsm_850_assoc_radio_cap_present, tvb, bit_offset, 1, &gsm850AssocRadioCapabilityPresent, ENC_BIG_ENDIAN);
2774
684
    bit_offset = bit_offset + 1;
2775
2776
684
    if (gsm850AssocRadioCapabilityPresent == 1)
2777
211
    {
2778
        /* Extract GSM 850 Associated Radio Capability */
2779
211
        proto_tree_add_bits_item(tree, hf_gsm_a_gsm_850_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2780
211
        bit_offset = bit_offset + 4;
2781
211
    }
2782
2783
    /* { 0 | 1 <GSM 1900 Associated Radio Capability : bit(4) > }
2784
     * Extract GSM 1900 Associated Radio Capability presence
2785
     */
2786
684
    AVAILABLE_BITS_CHECK(1);
2787
673
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_gsm_1900_assoc_radio_cap_present, tvb, bit_offset, 1, &gsm1900AssocRadioCapabilityPresent, ENC_BIG_ENDIAN);
2788
673
    bit_offset = bit_offset + 1;
2789
2790
673
    if (gsm1900AssocRadioCapabilityPresent == 1)
2791
211
    {
2792
        /* Extract GSM 1900 Associated Radio Capability */
2793
211
        proto_tree_add_bits_item(tree, hf_gsm_a_gsm_1900_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2794
211
        bit_offset = bit_offset + 4;
2795
211
    }
2796
2797
    /* < UMTS FDD Radio Access Technology Capability : bit >
2798
     * Extract UMTS FDD Radio Access Technology Capability
2799
     */
2800
673
    AVAILABLE_BITS_CHECK(1);
2801
657
    proto_tree_add_bits_item(tree, hf_gsm_a_umts_fdd_rat_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2802
657
    bit_offset = bit_offset + 1;
2803
2804
    /* < UMTS 3.84 Mcps TDD Radio Access Technology Capability : bit >
2805
     * Extract UMTS 3.84 Mcps TDD Radio Access Technology Capability
2806
     */
2807
657
    AVAILABLE_BITS_CHECK(1);
2808
647
    proto_tree_add_bits_item(tree, hf_gsm_a_umts_384_mcps_tdd_rat_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2809
647
    bit_offset = bit_offset + 1;
2810
2811
    /* < CDMA 2000 Radio Access Technology Capability : bit >
2812
     * Extract CDMA 2000 Radio Access Technology Capability
2813
     */
2814
647
    AVAILABLE_BITS_CHECK(1);
2815
644
    proto_tree_add_bits_item(tree, hf_gsm_a_cdma_2000_rat_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2816
644
    bit_offset = bit_offset + 1;
2817
2818
    /* { 0 | 1 < DTM GPRS Multi Slot Class : bit(2) >
2819
     *   < Single Slot DTM : bit >
2820
     *   {0 | 1< DTM EGPRS Multi Slot Class : bit(2) > } }
2821
     * Extract DTM E/GPRS Information presence
2822
     */
2823
644
    AVAILABLE_BITS_CHECK(1);
2824
643
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_dtm_e_gprs_multi_slot_info_present, tvb, bit_offset, 1, &dtmEGprsMultiSlotInfoPresent, ENC_BIG_ENDIAN);
2825
643
    bit_offset = bit_offset + 1;
2826
2827
643
    if (dtmEGprsMultiSlotInfoPresent == 1)
2828
295
    {
2829
        /* Extract DTM GPRS Multi Slot Class */
2830
295
        proto_tree_add_bits_item(tree, hf_gsm_a_dtm_gprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2831
295
        bit_offset = bit_offset + 2;
2832
2833
        /* Extract Single Slot DTM */
2834
295
        proto_tree_add_bits_item(tree, hf_gsm_a_single_slot_dtm, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2835
295
        bit_offset = bit_offset + 1;
2836
2837
        /* Extract DTM EGPRS Multi Slot Class Presence */
2838
295
        proto_tree_add_bits_ret_val(tree, hf_gsm_a_dtm_egprs_multi_slot_class_present, tvb, bit_offset, 1, &dtmEgprsMultiSlotClassPresent, ENC_BIG_ENDIAN);
2839
295
        bit_offset = bit_offset + 1;
2840
2841
        /* Extract DTM EGPRS Multi Slot Class */
2842
295
        if (dtmEgprsMultiSlotClassPresent == 1)
2843
111
        {
2844
111
            proto_tree_add_bits_item(tree, hf_gsm_a_dtm_egprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2845
111
            bit_offset = bit_offset + 2;
2846
111
        }
2847
295
    }
2848
2849
    /*
2850
     * Release 4 starts here
2851
     *
2852
     * { 0 | 1 < Single Band Support > } -- Release 4 starts here:
2853
     * Extract Single Band Support
2854
     */
2855
643
    AVAILABLE_BITS_CHECK(1);
2856
634
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_single_band_support, tvb, bit_offset, 1, &singleBandSupport, ENC_BIG_ENDIAN);
2857
634
    bit_offset = bit_offset + 1;
2858
2859
634
    if (singleBandSupport == 1)
2860
154
    {
2861
        /* Extract Single Band Support */
2862
154
        proto_tree_add_bits_item(tree, hf_gsm_a_gsm_band, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2863
154
        bit_offset = bit_offset + 4;
2864
154
    }
2865
2866
    /* { 0 | 1 <GSM 750 Associated Radio Capability : bit(4) > }
2867
     * Extract GSM 750 Associated Radio Capability presence
2868
     */
2869
634
    AVAILABLE_BITS_CHECK(1);
2870
629
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_gsm_750_assoc_radio_cap_present, tvb, bit_offset, 1, &gsm750AssocRadioCapabilityPresent, ENC_BIG_ENDIAN);
2871
629
    bit_offset = bit_offset + 1;
2872
2873
629
    if (gsm750AssocRadioCapabilityPresent == 1)
2874
168
    {
2875
        /* Extract GSM 750 Associated Radio Capability */
2876
168
        proto_tree_add_bits_item(tree, hf_gsm_a_gsm_750_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2877
168
        bit_offset = bit_offset + 4;
2878
168
    }
2879
2880
    /* < UMTS 1.28 Mcps TDD Radio Access Technology Capability : bit >
2881
     * Extract UMTS 1.28 Mcps TDD Radio Access Technology Capability
2882
     */
2883
629
    AVAILABLE_BITS_CHECK(1);
2884
625
    proto_tree_add_bits_item(tree, hf_gsm_a_umts_128_mcps_tdd_rat_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2885
625
    bit_offset = bit_offset + 1;
2886
2887
    /* < GERAN Feature Package 1 : bit >
2888
     * Extract GERAN Feature Package 1
2889
     */
2890
625
    AVAILABLE_BITS_CHECK(1);
2891
621
    proto_tree_add_bits_item(tree, hf_gsm_a_geran_feature_package_1, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2892
621
    bit_offset = bit_offset + 1;
2893
2894
    /* { 0 | 1 < Extended DTM GPRS Multi Slot Class : bit(2) >
2895
     *   < Extended DTM EGPRS Multi Slot Class : bit(2) > }
2896
     * Extract Extended DTM E/GPRS Information presence
2897
     */
2898
621
    AVAILABLE_BITS_CHECK(1);
2899
616
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_ext_dtm_e_gprs_multi_slot_info_present, tvb, bit_offset, 1, &extDtmEGprsMultiSlotInfoPresent, ENC_BIG_ENDIAN);
2900
616
    bit_offset = bit_offset + 1;
2901
2902
616
    if (extDtmEGprsMultiSlotInfoPresent == 1)
2903
170
    {
2904
        /* Extract Extended DTM GPRS Multi Slot Class */
2905
170
        proto_tree_add_bits_item(tree, hf_gsm_a_ext_dtm_gprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2906
170
        bit_offset = bit_offset + 2;
2907
2908
        /* Extract Extended DTM EGPRS Multi Slot Class */
2909
170
        proto_tree_add_bits_item(tree, hf_gsm_a_ext_dtm_egprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2910
170
        bit_offset = bit_offset + 2;
2911
170
    }
2912
2913
    /*
2914
     * Release 5 starts here
2915
     *
2916
     * { 0 | 1 < High Multislot Capability : bit(2) > } -- Release 5 starts here.
2917
     * Extract High Multislot Capability presence
2918
     */
2919
616
    AVAILABLE_BITS_CHECK(1);
2920
608
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_high_multislot_cap_present, tvb, bit_offset, 1, &highMultislotCapPresent, ENC_BIG_ENDIAN);
2921
608
    bit_offset = bit_offset + 1;
2922
2923
608
    if (highMultislotCapPresent == 1)
2924
228
    {
2925
        /* Extract High Multislot Capability */
2926
228
        proto_tree_add_bits_item(tree, hf_gsm_a_high_multislot_cap, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2927
228
        bit_offset = bit_offset + 2;
2928
228
    }
2929
2930
    /*
2931
     * { 0 | 1 < GERAN Iu Mode Capabilities > } -- "1" also means support of GERAN Iu mode
2932
     * Extract GERAN Iu Mode Capabilities presence
2933
     */
2934
608
    AVAILABLE_BITS_CHECK(1);
2935
580
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_geran_iu_mode_support, tvb, bit_offset, 1, &geranIuModeSupport, ENC_BIG_ENDIAN);
2936
580
    bit_offset = bit_offset + 1;
2937
2938
580
    if (geranIuModeSupport == 1)
2939
162
    {
2940
        /* Extract GERAN Iu Mode Capabilities Length */
2941
162
        length = tvb_get_bits8(tvb, bit_offset, 4);
2942
2943
        /* Extract GERAN Iu Mode Capabilities */
2944
162
        item = proto_tree_add_bits_item(tree, hf_gsm_a_geran_iu_mode_cap, tvb, bit_offset, length + 4, ENC_BIG_ENDIAN);
2945
162
        subtree = proto_item_add_subtree(item, ett_gsm_common_elem[DE_MS_CM_3]);
2946
2947
        /* Add GERAN Iu Mode Capabilities Length in subtree */
2948
162
        proto_tree_add_bits_item(subtree, hf_gsm_a_geran_iu_mode_cap_length, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2949
162
        bit_offset += 4;
2950
162
        target_bit_offset = bit_offset + length;
2951
2952
        /* Extract FLO Iu Capability */
2953
162
        proto_tree_add_bits_item(subtree, hf_gsm_a_flo_iu_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2954
162
        bit_offset += 1;
2955
2956
        /* If needed, add spare bits */
2957
162
        if (target_bit_offset > bit_offset)
2958
114
        {
2959
114
            proto_tree_add_bits_item(subtree, hf_gsm_a_spare_bits, tvb, bit_offset, target_bit_offset - bit_offset, ENC_BIG_ENDIAN);
2960
114
            bit_offset = target_bit_offset;
2961
114
        }
2962
162
    }
2963
2964
    /* < GERAN Feature Package 2 : bit >
2965
     * Extract GERAN Feature Package 2
2966
     */
2967
580
    AVAILABLE_BITS_CHECK(1);
2968
577
    proto_tree_add_bits_item(tree, hf_gsm_a_geran_feature_package_2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2969
577
    bit_offset = bit_offset + 1;
2970
2971
    /* < GMSK Multislot Power Profile : bit (2) >
2972
     * Extract GMSK Multislot Power Profile
2973
     */
2974
577
    AVAILABLE_BITS_CHECK(2);
2975
571
    proto_tree_add_bits_item(tree, hf_gsm_a_gmsk_multislot_power_prof, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2976
571
    bit_offset = bit_offset + 2;
2977
2978
    /* < 8-PSK Multislot Power Profile : bit (2) >
2979
     * Extract GMSK Multislot Power Profile
2980
     */
2981
571
    AVAILABLE_BITS_CHECK(2);
2982
560
    proto_tree_add_bits_item(tree, hf_gsm_a_8_psk_multislot_power_prof, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2983
560
    bit_offset = bit_offset + 2;
2984
2985
    /*
2986
     * Release 6 starts here
2987
     *
2988
     * { 0 | 1 < T-GSM 400 Bands Supported : { 01 | 10 | 11 } > -- Release 6 starts here.
2989
     *   < T-GSM 400 Associated Radio Capability: bit(4) > }
2990
     */
2991
560
    AVAILABLE_BITS_CHECK(1);
2992
556
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_t_gsm_400_band_info_present, tvb, bit_offset, 1, &tGsm400BandInfoPresent, ENC_BIG_ENDIAN);
2993
556
    bit_offset = bit_offset + 1;
2994
2995
556
    if (tGsm400BandInfoPresent == 1)
2996
168
    {
2997
        /* Extract T-GSM 400 Bands Supported */
2998
168
        proto_tree_add_bits_item(tree, hf_gsm_a_t_gsm_400_bands_supported, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2999
168
        bit_offset = bit_offset + 2;
3000
3001
        /* Extract T-GSM 400 Associated Radio Capability */
3002
168
        proto_tree_add_bits_item(tree, hf_gsm_a_t_gsm_400_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3003
168
        bit_offset = bit_offset + 4;
3004
168
    }
3005
3006
    /* { 0 | 1 < T-GSM 900 Associated Radio Capability: bit(4) > }
3007
     * Extract T-GSM 900 Associated Radio Capability presence
3008
     */
3009
556
    AVAILABLE_BITS_CHECK(1);
3010
551
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_t_gsm_900_assoc_radio_cap_present, tvb, bit_offset, 1, &tGsm900AssocRadioCapabilityPresent, ENC_BIG_ENDIAN);
3011
551
    bit_offset = bit_offset + 1;
3012
3013
551
    if (tGsm900AssocRadioCapabilityPresent == 1)
3014
187
    {
3015
        /* Extract T-GSM 900 Associated Radio Capability */
3016
187
        proto_tree_add_bits_item(tree, hf_gsm_a_t_gsm_900_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3017
187
        bit_offset = bit_offset + 4;
3018
187
    }
3019
3020
    /* < Downlink Advanced Receiver Performance : bit (2)>
3021
     * Extract Downlink Advanced Receiver Performance
3022
     */
3023
551
    AVAILABLE_BITS_CHECK(2);
3024
538
    proto_tree_add_bits_item(tree, hf_gsm_a_downlink_adv_receiver_perf, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3025
538
    bit_offset = bit_offset + 2;
3026
3027
    /* < DTM Enhancements Capability : bit >
3028
     * Extract DTM Enhancements Capability
3029
     */
3030
538
    AVAILABLE_BITS_CHECK(1);
3031
535
    proto_tree_add_bits_item(tree, hf_gsm_a_dtm_enhancements_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3032
535
    bit_offset = bit_offset + 1;
3033
3034
    /* { 0 | 1 < DTM GPRS High Multi Slot Class : bit(3) >
3035
     *   < Offset required : bit>
3036
     *   { 0 | 1 < DTM EGPRS High Multi Slot Class : bit(3) > } }
3037
     * Extract DTM E/GPRS High Multi Slot Information presence
3038
     */
3039
535
    AVAILABLE_BITS_CHECK(1);
3040
522
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_dtm_e_gprs_high_multi_slot_info_present, tvb, bit_offset, 1, &dtmEGprsHighMultiSlotInfoPresent, ENC_BIG_ENDIAN);
3041
522
    bit_offset = bit_offset + 1;
3042
3043
522
    if (dtmEGprsHighMultiSlotInfoPresent == 1)
3044
211
    {
3045
        /* Extract DTM GPRS High Multi Slot Class */
3046
211
        proto_tree_add_bits_item(tree, hf_gsm_a_dtm_gprs_high_multi_slot_class, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3047
211
        bit_offset = bit_offset + 3;
3048
3049
        /* Extract Offset Required */
3050
211
        proto_tree_add_bits_item(tree, hf_gsm_a_offset_required, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3051
211
        bit_offset = bit_offset + 1;
3052
3053
        /* Extract DTM EGPRS High Multi Slot Class Presence */
3054
211
        proto_tree_add_bits_ret_val(tree, hf_gsm_a_dtm_egprs_high_multi_slot_class_present, tvb, bit_offset, 1, &dtmEgprsHighMultiSlotClassPresent, ENC_BIG_ENDIAN);
3055
211
        bit_offset = bit_offset + 1;
3056
3057
        /* Extract DTM EGPRS High Multi Slot Class */
3058
211
        if (dtmEgprsHighMultiSlotClassPresent == 1)
3059
87
        {
3060
87
            proto_tree_add_bits_item(tree, hf_gsm_a_dtm_egprs_high_multi_slot_class, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3061
87
            bit_offset = bit_offset + 3;
3062
87
        }
3063
211
    }
3064
3065
    /* < Repeated ACCH Capability : bit >
3066
     * Extract Repeated ACCH Capability
3067
     */
3068
522
    AVAILABLE_BITS_CHECK(1);
3069
513
    proto_tree_add_bits_item(tree, hf_gsm_a_repeated_acch_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3070
513
    bit_offset = bit_offset + 1;
3071
3072
    /*
3073
     * Release 7 starts here
3074
     *
3075
     * { 0 | 1 <GSM 710 Associated Radio Capability : bit(4) > } -- Release 7 starts here.
3076
     * Extract GSM 710 Associated Radio Capability presence
3077
     */
3078
513
    AVAILABLE_BITS_CHECK(1);
3079
505
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_gsm_710_assoc_radio_cap_present, tvb, bit_offset, 1, &gsm710AssocRadioCapabilityPresent, ENC_BIG_ENDIAN);
3080
505
    bit_offset = bit_offset + 1;
3081
3082
505
    if (gsm710AssocRadioCapabilityPresent == 1)
3083
163
    {
3084
        /* Extract GSM 710 Associated Radio Capability */
3085
163
        proto_tree_add_bits_item(tree, hf_gsm_a_gsm_710_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3086
163
        bit_offset = bit_offset + 4;
3087
163
    }
3088
3089
    /* { 0 | 1 < T-GSM 810 Associated Radio Capability: bit(4) > }
3090
     * Extract T-GSM 810 Associated Radio Capability presence
3091
     */
3092
505
    AVAILABLE_BITS_CHECK(1);
3093
491
    proto_tree_add_bits_ret_val(tree, hf_gsm_a_t_gsm_810_assoc_radio_cap_present, tvb, bit_offset, 1, &tGsm810AssocRadioCapabilityPresent, ENC_BIG_ENDIAN);
3094
491
    bit_offset = bit_offset + 1;
3095
3096
491
    if (tGsm810AssocRadioCapabilityPresent == 1)
3097
173
    {
3098
        /* Extract T-GSM 810 Associated Radio Capability */
3099
173
        proto_tree_add_bits_item(tree, hf_gsm_a_t_gsm_810_assoc_radio_cap, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3100
173
        bit_offset = bit_offset + 4;
3101
173
    }
3102
3103
    /* < Ciphering Mode Setting Capability : bit >
3104
     * Extract Ciphering Mode Setting Capability
3105
     */
3106
491
    AVAILABLE_BITS_CHECK(1);
3107
479
    proto_tree_add_bits_item(tree, hf_gsm_a_ciphering_mode_setting_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3108
479
    bit_offset = bit_offset + 1;
3109
3110
    /* < Additional Positioning Capabilities : bit >
3111
     * Extract Additional Positioning Capabilities
3112
     */
3113
479
    AVAILABLE_BITS_CHECK(1);
3114
477
    proto_tree_add_bits_item(tree, hf_gsm_a_additional_positioning_caps, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3115
477
    bit_offset = bit_offset + 1;
3116
3117
    /*
3118
     * Release 8 starts here
3119
     *
3120
     * <E-UTRA FDD support : bit > -- Release 8 starts here.
3121
     * Extract E-UTRA FDD support
3122
     */
3123
477
    AVAILABLE_BITS_CHECK(1);
3124
473
    proto_tree_add_bits_item(tree, hf_gsm_a_e_utra_fdd_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3125
473
    bit_offset = bit_offset + 1;
3126
3127
    /*
3128
     * <E-UTRA TDD support : bit >
3129
     * Extract E-UTRA TDD support
3130
     */
3131
473
    AVAILABLE_BITS_CHECK(1);
3132
467
    proto_tree_add_bits_item(tree, hf_gsm_a_e_utra_tdd_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3133
467
    bit_offset = bit_offset + 1;
3134
3135
    /*
3136
     * <E-UTRA Measurement and Reporting support : bit >
3137
     * Extract E-UTRA Measurement and Reporting support
3138
     */
3139
467
    AVAILABLE_BITS_CHECK(1);
3140
461
    proto_tree_add_bits_item(tree, hf_gsm_a_e_utra_meas_and_report_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3141
461
    bit_offset = bit_offset + 1;
3142
3143
    /*
3144
     * <Priority-based reselection support : bit >
3145
     * Extract Priority-based reselection support
3146
     */
3147
461
    AVAILABLE_BITS_CHECK(1);
3148
457
    proto_tree_add_bits_item(tree, hf_gsm_a_prio_based_resel_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3149
457
    bit_offset = bit_offset + 1;
3150
3151
    /*
3152
     * Release 9 starts here
3153
     *
3154
     * <UTRA CSG Cells Reporting : bit > -- Release 9 starts here.
3155
     * Extract UTRA CSG Cells Reporting
3156
     */
3157
457
    AVAILABLE_BITS_CHECK(1);
3158
448
    proto_tree_add_bits_item(tree, hf_gsm_a_utra_csg_cells_reporting, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3159
448
    bit_offset = bit_offset + 1;
3160
3161
    /*
3162
     * <VAMOS Level : bit(2) >
3163
     * Extract VAMOS Level
3164
     */
3165
448
    AVAILABLE_BITS_CHECK(2);
3166
427
    proto_tree_add_bits_item(tree, hf_gsm_a_vamos_level, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3167
427
    bit_offset = bit_offset + 2;
3168
3169
    /*
3170
     * Release 10 starts here
3171
     *
3172
     * < TIGHTER Capability : bit(2) > -- Release 10 starts here.
3173
     * Extract TIGHTER Capability
3174
     */
3175
427
    AVAILABLE_BITS_CHECK(2);
3176
409
    proto_tree_add_bits_item(tree, hf_gsm_a_tighter_cap, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3177
409
    bit_offset = bit_offset + 2;
3178
3179
    /*
3180
     * < Selective Ciphering of Downlink SACCH : bit >
3181
     * Extract Selective Ciphering of Downlink SACCH
3182
     */
3183
409
    AVAILABLE_BITS_CHECK(1);
3184
407
    proto_tree_add_bits_item(tree, hf_gsm_a_selective_ciph_down_sacch, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3185
407
    bit_offset = bit_offset + 1;
3186
3187
    /*
3188
     * Release 11 starts here
3189
     *
3190
     * < CS to PS SRVCC from GERAN to UTRA : bit(2) > -- Release 11 starts here
3191
     */
3192
407
    AVAILABLE_BITS_CHECK(2);
3193
389
    proto_tree_add_bits_item(tree, hf_gsm_a_cs_to_ps_srvcc_geran_to_utra, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3194
389
    bit_offset = bit_offset + 2;
3195
3196
    /*
3197
     * < CS to PS SRVCC from GERAN to E-UTRA : bit(2)>
3198
     */
3199
389
    AVAILABLE_BITS_CHECK(2);
3200
366
    proto_tree_add_bits_item(tree, hf_gsm_a_cs_to_ps_srvcc_geran_to_eutra, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3201
366
    bit_offset = bit_offset + 2;
3202
3203
    /*
3204
     * < GERAN Network Sharing support : bit(1)>
3205
     */
3206
366
    AVAILABLE_BITS_CHECK(1);
3207
360
    proto_tree_add_bits_item(tree, hf_gsm_a_geran_network_sharing_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3208
360
    bit_offset = bit_offset + 1;
3209
3210
    /*
3211
     * < E-UTRA Wideband RSRQ measurements support : bit(1)>
3212
     */
3213
360
    AVAILABLE_BITS_CHECK(1);
3214
355
    proto_tree_add_bits_item(tree, hf_gsm_a_eutra_wb_rsrq_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3215
355
    bit_offset = bit_offset + 1;
3216
3217
    /*
3218
     * Release 12 starts here
3219
     *
3220
     * < ER Band support : bit(1) > -- Release 12 starts here
3221
     */
3222
355
    AVAILABLE_BITS_CHECK(1);
3223
343
    proto_tree_add_bits_item(tree, hf_gsm_a_er_band_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3224
343
    bit_offset = bit_offset + 1;
3225
3226
    /*
3227
     * < UTRA Multiple Frequency Band Indicators support : bit(1)>
3228
     */
3229
343
    AVAILABLE_BITS_CHECK(1);
3230
339
    proto_tree_add_bits_item(tree, hf_gsm_a_utra_mfbi_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3231
339
    bit_offset = bit_offset + 1;
3232
3233
    /*
3234
     * < E-UTRA Multiple Frequency Band Indicators support : bit(1)>
3235
     */
3236
339
    AVAILABLE_BITS_CHECK(1);
3237
333
    proto_tree_add_bits_item(tree, hf_gsm_a_eutra_mfbi_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3238
333
    bit_offset = bit_offset + 1;
3239
3240
    /*
3241
     * < Extended TSC Set Capability support : bit(1)>
3242
     */
3243
333
    AVAILABLE_BITS_CHECK(1);
3244
321
    proto_tree_add_bits_item(tree, hf_gsm_a_ext_tsc_set_cap_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3245
321
    bit_offset = bit_offset + 1;
3246
3247
    /*
3248
     * < Extended EARFCN value range : bit(1)>
3249
     */
3250
321
    AVAILABLE_BITS_CHECK(1);
3251
313
    proto_tree_add_bits_item(tree, hf_gsm_a_ext_earfcn_value_range, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3252
313
    bit_offset = bit_offset + 1;
3253
3254
    /*
3255
     * Add spare bits until we reach an octet boundary
3256
     */
3257
313
    bits_left = (((len + offset) << 3) - bit_offset) & 0x07;
3258
313
    if (bits_left != 0)
3259
260
    {
3260
260
        proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, bits_left, ENC_BIG_ENDIAN);
3261
260
        bit_offset += bits_left;
3262
260
    }
3263
3264
    /* translate to byte offset (we already know that we are on an octet boundary) */
3265
313
    curr_offset = bit_offset >> 3;
3266
313
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
3267
3268
313
    return len;
3269
321
}
3270
/*
3271
 * [3] 10.5.1.8
3272
 */
3273
uint16_t de_spare_nibble(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
3274
10
{
3275
10
   uint32_t curr_offset;
3276
10
   int     bit_offset;
3277
3278
10
   curr_offset = offset;
3279
10
   if (RIGHT_NIBBLE == len)
3280
0
       bit_offset = 4;
3281
10
   else
3282
10
       bit_offset = 0;
3283
3284
10
   proto_tree_add_bits_item(tree, hf_gsm_a_spare_nibble, tvb, (curr_offset<<3)+bit_offset, 4, ENC_BIG_ENDIAN);
3285
10
   curr_offset = curr_offset + 1;
3286
3287
10
   return (curr_offset - offset);
3288
10
}
3289
3290
/*
3291
 * [3] 10.5.1.9 Descriptive group or broadcast call reference
3292
 */
3293
static const true_false_string tfs_vgcs_vbs = { "VGCS (Group call reference)", "VBS (Broadcast call reference)" };
3294
3295
static const value_string gsm_a_call_priority_vals[] = {
3296
    { 0, "no priority applied"},
3297
    { 1, "call priority level 4"},
3298
    { 2, "call priority level 3"},
3299
    { 3, "call priority level 2"},
3300
    { 4, "call priority level 1"},
3301
    { 5, "call priority level 0"},
3302
    { 6, "call priority level B"},
3303
    { 7, "call priority level A"},
3304
    { 0,    NULL }
3305
};
3306
3307
uint16_t
3308
de_d_gb_call_ref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
3309
0
{
3310
0
    uint32_t     curr_offset = offset;
3311
3312
0
    proto_tree_add_item(tree, hf_gsm_a_group_call_reference, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
3313
0
    proto_tree_add_item(tree, hf_gsm_a_service_flag, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
3314
0
    proto_tree_add_item(tree, hf_gsm_a_af_acknowledgement, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
3315
0
    proto_tree_add_item(tree, hf_gsm_a_call_priority, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
3316
0
    curr_offset += 4;
3317
3318
0
    proto_tree_add_item(tree, hf_gsm_a_ciphering_info, tvb, curr_offset, 1, ENC_NA);
3319
3320
0
    proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3)+4, 4, ENC_BIG_ENDIAN);
3321
0
    curr_offset++;
3322
3323
    /* no length check possible */
3324
3325
0
    return (curr_offset - offset);
3326
0
}
3327
3328
/*
3329
 * [3] 10.5.1.10a PD and SAPI $(CCBS)$
3330
 */
3331
static const value_string gsm_a_sapi_vals[] = {
3332
    { 0, "SAPI 0"},
3333
    { 1, "Reserved"},
3334
    { 2, "Reserved"},
3335
    { 3, "SAPI 3"},
3336
    { 0,    NULL }
3337
};
3338
3339
static uint16_t
3340
de_pd_sapi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
3341
2
{
3342
2
    uint32_t     curr_offset;
3343
2
    proto_tree  *subtree;
3344
3345
2
    curr_offset = offset;
3346
3347
2
    subtree =
3348
2
    proto_tree_add_subtree(tree,
3349
2
        tvb, curr_offset, 1, ett_gsm_dtap_elem[DE_PD_SAPI], NULL,
3350
2
        val_to_str_ext_const(DE_PD_SAPI, &gsm_dtap_elem_strings_ext, ""));
3351
3352
2
    proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, curr_offset<<3, 2, ENC_BIG_ENDIAN);
3353
3354
2
    proto_tree_add_item(subtree, hf_gsm_a_sapi, tvb, curr_offset, 1, ENC_NA);
3355
3356
2
    proto_tree_add_item(tree, hf_gsm_a_L3_protocol_discriminator, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3357
3358
2
    curr_offset++;
3359
3360
    /* no length check possible */
3361
3362
2
    return (curr_offset - offset);
3363
2
}
3364
3365
/*
3366
 * [3] 10.5.1.11 Priority Level
3367
 */
3368
static const value_string gsm_a_call_prio_vals[] = {
3369
    { 0x00, "no priority applied" },
3370
    { 0x01, "call priority level 4" },
3371
    { 0x02, "call priority level 3" },
3372
    { 0x03, "call priority level 2" },
3373
    { 0x04, "call priority level 1" },
3374
    { 0x05, "call priority level 0" },
3375
    { 0x06, "call priority level B" },
3376
    { 0x07, "call priority level A" },
3377
    { 0,            NULL }
3378
};
3379
3380
static uint16_t
3381
de_prio(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
3382
3
{
3383
3
    uint32_t curr_offset;
3384
3385
3
    curr_offset = offset;
3386
3387
3
    proto_tree_add_item(tree, hf_gsm_a_b8spare, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3388
3
    proto_tree_add_bits_item(tree, hf_gsm_a_call_prio, tvb, (curr_offset<<3)+5, 3, ENC_BIG_ENDIAN);
3389
3
    curr_offset++;
3390
3391
    /* no length check possible */
3392
3393
3
    return (curr_offset - offset);
3394
3
}
3395
3396
/*
3397
 * [3] 10.5.1.12.1 CN Common GSM-MAP NAS system information
3398
 */
3399
uint16_t
3400
de_cn_common_gsm_map_nas_sys_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
3401
234
{
3402
234
    uint32_t curr_offset;
3403
3404
234
    curr_offset = offset;
3405
3406
234
    proto_tree_add_item(tree, hf_gsm_a_lac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
3407
234
    curr_offset += 2;
3408
3409
234
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
3410
3411
234
    return (curr_offset - offset);
3412
234
}
3413
3414
/*
3415
 * [3] 10.5.1.12.2 CS domain specific system information
3416
 */
3417
static const true_false_string gsm_a_att_value = {
3418
    "MSs shall apply IMSI attach and detach procedure",
3419
    "MSs shall not apply IMSI attach and detach procedure"
3420
};
3421
3422
uint16_t
3423
de_cs_domain_spec_sys_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
3424
651
{
3425
651
    uint32_t curr_offset;
3426
3427
651
    curr_offset = offset;
3428
3429
651
    proto_tree_add_item(tree, hf_gsm_a_rr_t3212, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3430
651
    curr_offset++;
3431
651
    proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 7, ENC_BIG_ENDIAN);
3432
651
    proto_tree_add_item(tree, hf_gsm_a_att, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3433
651
    curr_offset++;
3434
3435
651
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
3436
3437
651
    return (curr_offset - offset);
3438
651
}
3439
3440
/*
3441
 * [3] 10.5.1.12.3 PS domain specific system information
3442
 */
3443
static const true_false_string gsm_a_nmo_1_value = {
3444
    "Network Mode of Operation I is used for MS configured for NMO_I_Behaviour",
3445
    "Network Mode of Operation indicated in Bit 1 (NMO) is used for MS configured for NMO_I_Behaviour"
3446
};
3447
3448
static const true_false_string gsm_a_nmo_value = {
3449
    "Network Mode of Operation II",
3450
    "Network Mode of Operation I"
3451
};
3452
3453
uint16_t
3454
de_ps_domain_spec_sys_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
3455
388
{
3456
388
    uint32_t curr_offset;
3457
3458
388
    curr_offset = offset;
3459
3460
388
    proto_tree_add_item(tree, hf_gsm_a_gm_rac, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3461
388
    curr_offset++;
3462
388
    proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 6, ENC_BIG_ENDIAN);
3463
388
    proto_tree_add_item(tree, hf_gsm_a_nmo_1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3464
388
    proto_tree_add_item(tree, hf_gsm_a_nmo, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3465
388
    curr_offset++;
3466
3467
388
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
3468
3469
388
    return (curr_offset - offset);
3470
388
}
3471
3472
/*
3473
 * [3] 10.5.1.13 PLMN list
3474
 */
3475
uint16_t
3476
de_plmn_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string, int string_len)
3477
3
{
3478
3
    char   *mcc_mnc_str;
3479
3
    uint32_t curr_offset;
3480
3
    uint8_t num_plmn;
3481
3
    proto_tree* subtree;
3482
3483
3
    curr_offset = offset;
3484
3485
3
    num_plmn = 0;
3486
49
    while ((len - (curr_offset - offset)) >= 3)
3487
46
    {
3488
46
        subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, 3, ett_gsm_a_plmn, NULL, "PLMN[%u]", num_plmn + 1);
3489
46
        mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, subtree, curr_offset, E212_NONE, true);
3490
46
        proto_item_append_text(subtree, ": %s", mcc_mnc_str);
3491
3492
46
        curr_offset += 3;
3493
3494
46
        num_plmn++;
3495
46
    }
3496
3497
3
    if (add_string)
3498
3
        snprintf(add_string, string_len, " - %u PLMN%s",
3499
3
            num_plmn, plurality(num_plmn, "", "s"));
3500
3501
3
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
3502
3503
3
    return (curr_offset - offset);
3504
3
}
3505
3506
/*
3507
 * 10.5.1.14 NAS container for PS HO
3508
 */
3509
3510
static const value_string gsm_a_pld_xid_vals[] = {
3511
    { 0x00, "The MS shall perform a Reset of LLC and SNDCP without old XID indicator" },
3512
    { 0x01, "The MS shall perform a Reset of LLC and SNDCP with old XID indicator" },
3513
    { 0,            NULL }
3514
};
3515
3516
static uint16_t
3517
de_nas_cont_for_ps_ho(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
3518
1
{
3519
1
    uint32_t curr_offset;
3520
3521
1
    curr_offset = offset;
3522
3523
    /*     8     7     6     5     4     3     2      1
3524
     *     0     0     0   old     0     Type of ciphering
3525
     * spare  spare  spare XID  spare      algorithm
3526
     */
3527
1
    proto_tree_add_item(tree, hf_gsm_a_old_xid, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3528
1
    proto_tree_add_item(tree, hf_gsm_a_type_of_ciph_alg, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3529
1
    curr_offset++;
3530
3531
    /* IOV-UI value (octet 2 to 5)
3532
     * The IOV-UI value consists of 32 bits, the format is defined in 3GPP TS 44.064 [78a].
3533
     */
3534
1
    proto_tree_add_item(tree, hf_gsm_a_iov_ui, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
3535
1
    curr_offset += 4;
3536
3537
1
    EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_extraneous_data);
3538
3539
1
    return (curr_offset - offset);
3540
1
}
3541
3542
/*
3543
 * 10.5.1.15 MS network feature support
3544
 */
3545
static const true_false_string gsm_a_ext_periodic_timers_value = {
3546
    "MS supports the extended periodic timer in this domain",
3547
    "MS does not support the extended periodic timer in this domain"
3548
};
3549
3550
static uint16_t
3551
de_ms_net_feat_sup(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
3552
10
{
3553
10
    uint32_t curr_offset, bit_offset;
3554
3555
10
    curr_offset = offset;
3556
10
    bit_offset  = (curr_offset<<3)+4;
3557
3558
10
    proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3559
10
    bit_offset += 3;
3560
10
    proto_tree_add_bits_item(tree, hf_gsm_a_ext_periodic_timers, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3561
10
    curr_offset++;
3562
3563
10
    return (curr_offset - offset);
3564
10
}
3565
3566
3567
uint16_t (* const common_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string, int string_len) = {
3568
    /* Common Information Elements 10.5.1 */
3569
    de_cell_id,                        /* Cell Identity */
3570
    de_ciph_key_seq_num,               /* Ciphering Key Sequence Number */
3571
    de_lai,                            /* Location Area Identification */
3572
    de_mid,                            /* Mobile Identity */
3573
    de_ms_cm_1,                        /* Mobile Station Classmark 1 */
3574
    de_ms_cm_2,                        /* Mobile Station Classmark 2 */
3575
    de_ms_cm_3,                        /* Mobile Station Classmark 3 */
3576
    de_spare_nibble,                   /* Spare Half Octet */
3577
    de_d_gb_call_ref,                  /* Descriptive group or broadcast call reference */
3578
    NULL       /* handled inline */,   /* Group Cipher Key Number */
3579
    de_pd_sapi,                        /* PD and SAPI $(CCBS)$ */
3580
    /* Pos 10 */
3581
    de_prio    /* handled inline */,   /* Priority Level */
3582
    de_cn_common_gsm_map_nas_sys_info, /* 10.5.1.12.1 CN Common GSM-MAP NAS system information */
3583
    de_cs_domain_spec_sys_info,        /* 10.5.1.12.2 CS domain specific system information */
3584
    de_ps_domain_spec_sys_info,        /* 10.5.1.12.2 PS domain specific system information */
3585
    de_plmn_list,                      /* 10.5.1.13 PLMN list */
3586
    de_nas_cont_for_ps_ho,             /* 10.5.1.14 NAS container for PS HO */
3587
    de_ms_net_feat_sup,                /* 10.5.1.15 MS network feature support */
3588
    NULL,                   /* NONE */
3589
};
3590
3591
/* TAP STAT INFO */
3592
typedef enum
3593
{
3594
    IEI_COLUMN,
3595
    MSG_NAME_COLUMN,
3596
    COUNT_COLUMN
3597
} gsm_a_stat_columns;
3598
3599
static stat_tap_table_item gsm_a_stat_fields[] = {
3600
    {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "IEI", "%d"},
3601
    {TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Message Name", "%-25s"},
3602
    {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Count", "%d"}
3603
};
3604
3605
static void gsm_a_stat_init(stat_tap_table_ui* new_stat, const char *table_title, const value_string *msg_strings)
3606
0
{
3607
0
    int num_fields = array_length(gsm_a_stat_fields);
3608
0
    stat_tap_table* table;
3609
0
    unsigned i;
3610
0
    stat_tap_table_item_type items[array_length(gsm_a_stat_fields)];
3611
3612
0
    items[IEI_COLUMN].type = TABLE_ITEM_UINT;
3613
0
    items[MSG_NAME_COLUMN].type = TABLE_ITEM_STRING;
3614
0
    items[COUNT_COLUMN].type = TABLE_ITEM_UINT;
3615
0
    items[COUNT_COLUMN].value.uint_value = 0;
3616
3617
0
    table = stat_tap_find_table(new_stat, table_title);
3618
0
    if (table) {
3619
0
        if (new_stat->stat_tap_reset_table_cb) {
3620
0
            new_stat->stat_tap_reset_table_cb(table);
3621
0
        }
3622
0
        return;
3623
0
    }
3624
3625
0
    table = stat_tap_init_table(table_title, num_fields, 0, NULL);
3626
0
    stat_tap_add_table(new_stat, table);
3627
3628
    /* Add a row for each value type */
3629
0
    for (i = 0; i < 256; i++)
3630
0
    {
3631
0
        const char *msg_str = try_val_to_str(i, msg_strings);
3632
0
        char *col_str;
3633
0
        if (msg_str) {
3634
0
            col_str = g_strdup(msg_str);
3635
0
        } else {
3636
0
            col_str = ws_strdup_printf("Unknown message %d", i);
3637
0
        }
3638
3639
0
        items[IEI_COLUMN].value.uint_value = i;
3640
0
        items[MSG_NAME_COLUMN].value.string_value = col_str;
3641
0
        stat_tap_init_table_row(table, i, num_fields, items);
3642
0
    }
3643
0
}
3644
3645
static void gsm_a_bssmap_stat_init(stat_tap_table_ui* new_stat)
3646
0
{
3647
0
    gsm_a_stat_init(new_stat,
3648
0
                    "GSM A-I/F BSSMAP Statistics", gsm_a_bssmap_msg_strings);
3649
0
}
3650
3651
static void gsm_a_dtap_mm_stat_init(stat_tap_table_ui* new_stat)
3652
0
{
3653
0
    gsm_a_stat_init(new_stat,
3654
0
                    "GSM A-I/F DTAP Mobility Management Statistics", gsm_a_dtap_msg_mm_strings);
3655
0
}
3656
3657
static void gsm_a_dtap_rr_stat_init(stat_tap_table_ui* new_stat)
3658
0
{
3659
0
    gsm_a_stat_init(new_stat,
3660
0
                    "GSM A-I/F DTAP Radio Resource Management Statistics", gsm_a_dtap_msg_rr_strings);
3661
0
}
3662
3663
static void gsm_a_dtap_cc_stat_init(stat_tap_table_ui* new_stat)
3664
0
{
3665
0
    gsm_a_stat_init(new_stat,
3666
0
                    "GSM A-I/F DTAP Call Control Statistics", gsm_a_dtap_msg_cc_strings);
3667
0
}
3668
3669
static void gsm_a_dtap_gmm_stat_init(stat_tap_table_ui* new_stat)
3670
0
{
3671
0
    gsm_a_stat_init(new_stat,
3672
0
                    "GSM A-I/F DTAP GPRS Mobility Management Statistics", gsm_a_dtap_msg_gmm_strings);
3673
0
}
3674
3675
static void gsm_a_dtap_sm_stat_init(stat_tap_table_ui* new_stat)
3676
0
{
3677
0
    gsm_a_stat_init(new_stat,
3678
0
                    "GSM A-I/F DTAP GPRS Session Management Statistics", gsm_a_dtap_msg_sm_strings);
3679
0
}
3680
3681
static void gsm_a_dtap_sms_stat_init(stat_tap_table_ui* new_stat)
3682
0
{
3683
0
    gsm_a_stat_init(new_stat,
3684
0
                    "GSM A-I/F DTAP Short Message Service Statistics", gsm_a_dtap_msg_sms_strings);
3685
0
}
3686
3687
static void gsm_a_dtap_tp_stat_init(stat_tap_table_ui* new_stat)
3688
0
{
3689
0
    gsm_a_stat_init(new_stat,
3690
0
                    "GSM A-I/F DTAP Special Conformance Testing Functions", gsm_a_dtap_msg_tp_strings);
3691
0
}
3692
3693
static void gsm_a_dtap_ss_stat_init(stat_tap_table_ui* new_stat)
3694
0
{
3695
0
    gsm_a_stat_init(new_stat,
3696
0
                    "GSM A-I/F DTAP Supplementary Services Statistics", gsm_a_dtap_msg_ss_strings);
3697
0
}
3698
3699
static void gsm_a_sacch_rr_stat_init(stat_tap_table_ui* new_stat)
3700
0
{
3701
0
    gsm_a_stat_init(new_stat,
3702
0
                    "GSM A-I/F SACCH Statistics", gsm_a_rr_short_pd_msg_strings);
3703
0
}
3704
3705
static tap_packet_status
3706
gsm_a_stat_packet(void *tapdata, const void *gatr_ptr, uint8_t pdu_type, int protocol_disc)
3707
0
{
3708
0
    stat_data_t* stat_data = (stat_data_t*)tapdata;
3709
0
    const gsm_a_tap_rec_t *gatr = (const gsm_a_tap_rec_t *) gatr_ptr;
3710
0
    stat_tap_table* table;
3711
0
    stat_tap_table_item_type* msg_data;
3712
3713
0
    if (gatr->pdu_type != pdu_type) return TAP_PACKET_DONT_REDRAW;
3714
0
    if (pdu_type == BSSAP_PDU_TYPE_DTAP && (int)gatr->protocol_disc != protocol_disc) return TAP_PACKET_DONT_REDRAW;
3715
0
    if (pdu_type == GSM_A_PDU_TYPE_SACCH && gatr->protocol_disc != 0) return TAP_PACKET_DONT_REDRAW;
3716
3717
0
    table = g_array_index(stat_data->stat_tap_data->tables, stat_tap_table*, 0);
3718
0
    msg_data = stat_tap_get_field_data(table, gatr->message_type, COUNT_COLUMN);
3719
0
    msg_data->value.uint_value++;
3720
0
    stat_tap_set_field_data(table, gatr->message_type, COUNT_COLUMN, msg_data);
3721
3722
0
    return TAP_PACKET_REDRAW;
3723
0
}
3724
3725
static tap_packet_status
3726
gsm_a_bssmap_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3727
0
{
3728
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_BSSMAP, 0);
3729
0
}
3730
3731
static tap_packet_status
3732
gsm_a_dtap_mm_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3733
0
{
3734
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_MM);
3735
0
}
3736
3737
static tap_packet_status
3738
gsm_a_dtap_rr_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3739
0
{
3740
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_RR);
3741
0
}
3742
3743
static tap_packet_status
3744
gsm_a_dtap_cc_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3745
0
{
3746
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_CC);
3747
0
}
3748
3749
static tap_packet_status
3750
gsm_a_dtap_gmm_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3751
0
{
3752
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_GMM);
3753
0
}
3754
3755
static tap_packet_status
3756
gsm_a_dtap_sms_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3757
0
{
3758
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_SMS);
3759
0
}
3760
3761
static tap_packet_status
3762
gsm_a_dtap_sm_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3763
0
{
3764
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_SM);
3765
0
}
3766
3767
static tap_packet_status
3768
gsm_a_dtap_ss_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3769
0
{
3770
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_SS);
3771
0
}
3772
3773
static tap_packet_status
3774
gsm_a_dtap_tp_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3775
0
{
3776
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, BSSAP_PDU_TYPE_DTAP, PD_TP);
3777
0
}
3778
3779
static tap_packet_status
3780
gsm_a_sacch_rr_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *gatr_ptr, tap_flags_t flags _U_)
3781
0
{
3782
0
    return gsm_a_stat_packet(tapdata, gatr_ptr, GSM_A_PDU_TYPE_SACCH, 0);
3783
0
}
3784
3785
static void
3786
gsm_a_stat_reset(stat_tap_table* table)
3787
0
{
3788
0
    unsigned element;
3789
0
    stat_tap_table_item_type* item_data;
3790
3791
0
    for (element = 0; element < table->num_elements; element++)
3792
0
    {
3793
0
        item_data = stat_tap_get_field_data(table, element, COUNT_COLUMN);
3794
0
        item_data->value.uint_value = 0;
3795
0
        stat_tap_set_field_data(table, element, COUNT_COLUMN, item_data);
3796
0
    }
3797
0
}
3798
3799
static void
3800
gsm_a_stat_free_table_item(stat_tap_table* table _U_, unsigned row _U_, unsigned column, stat_tap_table_item_type* field_data)
3801
0
{
3802
0
    if (column != MSG_NAME_COLUMN) return;
3803
0
    g_free((char*)field_data->value.string_value);
3804
0
}
3805
3806
/* Register the protocol with Wireshark */
3807
void
3808
proto_register_gsm_a_common(void)
3809
14
{
3810
14
    unsigned   i;
3811
14
    unsigned   last_offset;
3812
3813
    /* Setup list of header fields */
3814
14
    static hf_register_info hf[] =
3815
14
    {
3816
14
    { &hf_gsm_a_common_elem_id,
3817
14
        { "Element ID", "gsm_a.common.elem_id",
3818
14
        FT_UINT8, BASE_HEX, NULL, 0,
3819
14
        NULL, HFILL }
3820
14
    },
3821
14
    { &hf_gsm_a_common_elem_id_f0,
3822
14
        { "Element ID", "gsm_a.common.elem_id",
3823
14
        FT_UINT8, BASE_HEX, NULL, 0xF0,
3824
14
        NULL, HFILL }
3825
14
    },
3826
14
    { &hf_gsm_a_l_ext,
3827
14
        { "ext",    "gsm_a.l_ext",
3828
14
        FT_UINT8, BASE_DEC, NULL, 0x80,
3829
14
        NULL, HFILL }
3830
14
    },
3831
14
    { &hf_gsm_a_tmsi,
3832
14
        { "TMSI/P-TMSI",    "gsm_a.tmsi",
3833
14
        FT_UINT32, BASE_DEC_HEX, 0, 0x0,
3834
14
        NULL, HFILL }
3835
14
    },
3836
14
    { &hf_gsm_a_imei,
3837
14
        { "IMEI",   "gsm_a.imei",
3838
14
        FT_STRING, BASE_NONE, 0, 0,
3839
14
        NULL, HFILL }
3840
14
    },
3841
14
    { &hf_gsm_a_imeisv,
3842
14
        { "IMEISV", "gsm_a.imeisv",
3843
14
        FT_STRING, BASE_NONE, 0, 0,
3844
14
        NULL, HFILL }
3845
14
    },
3846
14
    { &hf_gsm_a_MSC_rev,
3847
14
        { "Revision Level", "gsm_a.MSC_rev",
3848
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_msc_rev_vals), 0x60,
3849
14
        NULL, HFILL }
3850
14
    },
3851
14
    { &hf_gsm_a_ES_IND,
3852
14
        { "ES IND", "gsm_a.ES_IND",
3853
14
        FT_BOOLEAN, 8, TFS(&ES_IND_vals), 0x10,
3854
14
            NULL, HFILL }
3855
14
    },
3856
14
    { &hf_gsm_a_A5_1_algorithm_sup,
3857
14
        { "A5/1 algorithm supported", "gsm_a.A5_1_algorithm_sup",
3858
14
        FT_BOOLEAN, 8, TFS(&A5_1_algorithm_sup_vals), 0x08,
3859
14
        NULL, HFILL }
3860
14
    },
3861
14
    { &hf_gsm_a_RF_power_capability,
3862
14
        { "RF Power Capability", "gsm_a.RF_power_capability",
3863
14
        FT_UINT8, BASE_DEC, VALS(RF_power_capability_vals), 0x07,
3864
14
        NULL, HFILL }
3865
14
    },
3866
14
    { &hf_gsm_a_ps_sup_cap,
3867
14
        { "PS capability (pseudo-synchronization capability)", "gsm_a.ps_sup_cap",
3868
14
        FT_BOOLEAN, 8, TFS(&ps_sup_cap_vals), 0x40,
3869
14
        NULL, HFILL }
3870
14
    },
3871
14
    { &hf_gsm_a_SS_screening_indicator,
3872
14
        { "SS Screening Indicator", "gsm_a.SS_screening_indicator",
3873
14
        FT_UINT8, BASE_DEC, VALS(SS_screening_indicator_vals), 0x30,
3874
14
        NULL, HFILL }
3875
14
    },
3876
14
    { &hf_gsm_a_SM_capability,
3877
14
        { "SM capability (MT SMS pt to pt capability)", "gsm_a.SM_cap",
3878
14
        FT_BOOLEAN, 8, TFS(&SM_capability_vals), 0x08,
3879
14
        NULL, HFILL }
3880
14
    },
3881
14
    { &hf_gsm_a_VBS_notification_rec,
3882
14
        { "VBS notification reception", "gsm_a.VBS_notification_rec",
3883
14
        FT_BOOLEAN, 8, TFS(&VBS_notification_rec_vals), 0x04,
3884
14
        NULL, HFILL }
3885
14
    },
3886
14
    { &hf_gsm_a_VGCS_notification_rec,
3887
14
        { "VGCS notification reception", "gsm_a.VGCS_notification_rec",
3888
14
        FT_BOOLEAN, 8, TFS(&VGCS_notification_rec_vals), 0x02,
3889
14
        NULL, HFILL }
3890
14
    },
3891
14
    { &hf_gsm_a_FC_frequency_cap,
3892
14
        { "FC Frequency Capability", "gsm_a.FC_frequency_cap",
3893
14
        FT_BOOLEAN, 8, TFS(&FC_frequency_cap_vals), 0x01,
3894
14
        NULL, HFILL }
3895
14
    },
3896
14
    { &hf_gsm_a_CM3,
3897
14
        { "CM3", "gsm_a.CM3",
3898
14
        FT_BOOLEAN, 8, TFS(&CM3_vals), 0x80,
3899
14
        NULL, HFILL }
3900
14
    },
3901
14
    { &hf_gsm_a_LCS_VA_cap,
3902
14
        { "LCS VA capability (LCS value added location request notification capability)", "gsm_a.LCS_VA_cap",
3903
14
        FT_BOOLEAN, 8, TFS(&LCS_VA_cap_vals), 0x20,
3904
14
        NULL, HFILL }
3905
14
    },
3906
14
    { &hf_gsm_a_UCS2_treatment,
3907
14
        { "UCS2 treatment", "gsm_a.UCS2_treatment",
3908
14
        FT_BOOLEAN, 8, TFS(&UCS2_treatment_vals), 0x10,
3909
14
        NULL, HFILL }
3910
14
    },
3911
14
    { &hf_gsm_a_SoLSA,
3912
14
        { "SoLSA", "gsm_a.SoLSA",
3913
14
        FT_BOOLEAN, 8, TFS(&SoLSA_vals), 0x08,
3914
14
        NULL, HFILL }
3915
14
    },
3916
14
    { &hf_gsm_a_CMSP,
3917
14
        { "CMSP: CM Service Prompt", "gsm_a.CMSP",
3918
14
        FT_BOOLEAN, 8, TFS(&CMSP_vals), 0x04,
3919
14
        NULL, HFILL }
3920
14
    },
3921
14
    { &hf_gsm_a_A5_7_algorithm_sup,
3922
14
        { "A5/7 algorithm supported", "gsm_a.A5_7_algorithm_sup",
3923
14
        FT_BOOLEAN, BASE_NONE, TFS(&A5_7_algorithm_sup_vals), 0x0,
3924
14
        NULL, HFILL }
3925
14
    },
3926
14
    { &hf_gsm_a_A5_6_algorithm_sup,
3927
14
        { "A5/6 algorithm supported", "gsm_a.A5_6_algorithm_sup",
3928
14
        FT_BOOLEAN, BASE_NONE, TFS(&A5_6_algorithm_sup_vals), 0x0,
3929
14
        NULL, HFILL }
3930
14
    },
3931
14
    { &hf_gsm_a_A5_5_algorithm_sup,
3932
14
        { "A5/5 algorithm supported", "gsm_a.A5_5_algorithm_sup",
3933
14
        FT_BOOLEAN, BASE_NONE, TFS(&A5_5_algorithm_sup_vals), 0x0,
3934
14
        NULL, HFILL }
3935
14
    },
3936
14
    { &hf_gsm_a_A5_4_algorithm_sup,
3937
14
        { "A5/4 algorithm supported", "gsm_a.A5_4_algorithm_sup",
3938
14
        FT_BOOLEAN, BASE_NONE, TFS(&A5_4_algorithm_sup_vals), 0x0,
3939
14
        NULL, HFILL }
3940
14
    },
3941
14
    { &hf_gsm_a_A5_3_algorithm_sup,
3942
14
        { "A5/3 algorithm supported", "gsm_a.A5_3_algorithm_sup",
3943
14
        FT_BOOLEAN, 8, TFS(&A5_3_algorithm_sup_vals), 0x02,
3944
14
        NULL, HFILL }
3945
14
    },
3946
14
    { &hf_gsm_a_A5_2_algorithm_sup,
3947
14
        { "A5/2 algorithm supported", "gsm_a.A5_2_algorithm_sup",
3948
14
        FT_BOOLEAN, 8, TFS(&A5_2_algorithm_sup_vals), 0x01,
3949
14
        NULL, HFILL }
3950
14
    },
3951
14
    { &hf_gsm_a_mobile_identity_type,
3952
14
        { "Mobile Identity Type", "gsm_a.ie.mobileid.type",
3953
14
        FT_UINT8, BASE_DEC, VALS(mobile_identity_type_vals), 0x07,
3954
14
        NULL, HFILL }
3955
14
    },
3956
14
    { &hf_gsm_a_id_dig_1,
3957
14
        { "Identity Digit 1", "gsm_a.id_dig_1",
3958
14
        FT_UINT8, BASE_DEC, NULL, 0xf0,
3959
14
        NULL, HFILL }
3960
14
    },
3961
14
    { &hf_gsm_a_odd_even_ind,
3962
14
        { "Odd/even indication", "gsm_a.oddevenind",
3963
14
        FT_BOOLEAN, 8, TFS(&oddevenind_vals), 0x08,
3964
14
        NULL, HFILL }
3965
14
    },
3966
14
    { &hf_gsm_a_unused,
3967
14
        { "Unused", "gsm_a.unused",
3968
14
        FT_UINT8, BASE_HEX, NULL, 0xf0,
3969
14
        NULL, HFILL }
3970
14
    },
3971
14
    { &hf_gsm_a_tmgi_mcc_mnc_ind,
3972
14
        { "MCC/MNC indication", "gsm_a.tmgi_mcc_mnc_ind",
3973
14
        FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
3974
14
        NULL, HFILL}
3975
14
    },
3976
14
    { &hf_gsm_a_mbs_ses_id_ind,
3977
14
        { "MBMS Session Identity indication", "gsm_a.mbs_session_id_ind",
3978
14
        FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
3979
14
        NULL, HFILL}
3980
14
    },
3981
14
    { &hf_gsm_a_mbs_service_id,
3982
14
        { "MBMS Service ID", "gsm_a.mbs_service_id",
3983
14
        FT_UINT24, BASE_HEX, NULL, 0x0,
3984
14
        NULL, HFILL }
3985
14
    },
3986
14
    { &hf_gsm_a_mbs_session_id,
3987
14
        { "MBMS Session ID", "gsm_a.mbs_session_id",
3988
14
        FT_UINT8, BASE_HEX, NULL, 0x0,
3989
14
        NULL, HFILL }
3990
14
    },
3991
14
    { &hf_gsm_a_length,
3992
14
        { "Length",     "gsm_a.len",
3993
14
        FT_UINT16, BASE_DEC, NULL, 0,
3994
14
        NULL, HFILL }
3995
14
    },
3996
14
    { &hf_gsm_a_element_value,
3997
14
        { "Element Value",     "gsm_a.element_value",
3998
14
        FT_BYTES, BASE_NONE, NULL, 0,
3999
14
        NULL, HFILL }
4000
14
    },
4001
14
    { &hf_gsm_a_extension,
4002
14
        { "Extension", "gsm_a.extension",
4003
14
        FT_BOOLEAN, 8, TFS(&gsm_a_extension_value), 0x80,
4004
14
        NULL, HFILL }
4005
14
    },
4006
14
    { &hf_gsm_a_L3_protocol_discriminator,
4007
14
        { "Protocol discriminator", "gsm_a.L3_protocol_discriminator",
4008
14
        FT_UINT8, BASE_HEX, VALS(protocol_discriminator_vals), 0x0f,
4009
14
        NULL, HFILL }
4010
14
    },
4011
14
    { &hf_gsm_a_call_prio,
4012
14
        { "Call priority", "gsm_a.call_prio",
4013
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_call_prio_vals), 0x00,
4014
14
        NULL, HFILL }
4015
14
    },
4016
14
    { &hf_gsm_a_type_of_ciph_alg,
4017
14
        { "Type of ciphering algorithm", "gsm_a.type_of_ciph_alg",
4018
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_ciph_alg_vals), 0x07,
4019
14
        NULL, HFILL }
4020
14
    },
4021
14
    { &hf_gsm_a_att,
4022
14
        { "ATT", "gsm_a.att",
4023
14
        FT_BOOLEAN, 8, TFS(&gsm_a_att_value), 0x01,
4024
14
        "Attach-detach allowed", HFILL }
4025
14
    },
4026
14
    { &hf_gsm_a_nmo_1,
4027
14
        { "NMO I", "gsm_a.nmo_1",
4028
14
        FT_BOOLEAN, 8, TFS(&gsm_a_nmo_1_value), 0x02,
4029
14
        "Network Mode of Operation I", HFILL }
4030
14
    },
4031
14
    { &hf_gsm_a_nmo,
4032
14
        { "NMO", "gsm_a.nmo",
4033
14
        FT_BOOLEAN, 8, TFS(&gsm_a_nmo_value), 0x01,
4034
14
        "Network Mode of Operation", HFILL }
4035
14
    },
4036
14
    { &hf_gsm_a_old_xid,
4037
14
        { "Old XID", "gsm_a.old_xid",
4038
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_pld_xid_vals), 0x10,
4039
14
        NULL, HFILL }
4040
14
    },
4041
14
    { &hf_gsm_a_iov_ui,
4042
14
        { "IOV-UI", "gsm_a.iov_ui",
4043
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
4044
14
        NULL, HFILL }
4045
14
    },
4046
14
    { &hf_gsm_a_ext_periodic_timers,
4047
14
        { "Extended periodic timers", "gsm_a.ext_periodic_timers",
4048
14
        FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_ext_periodic_timers_value), 0x0,
4049
14
        NULL, HFILL }
4050
14
    },
4051
14
    { &hf_gsm_a_skip_ind,
4052
14
        { "Skip Indicator", "gsm_a.skip.ind",
4053
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_skip_ind_vals), 0xf0,
4054
14
        NULL, HFILL }
4055
14
    },
4056
14
    { &hf_gsm_a_b7spare,
4057
14
        { "Spare", "gsm_a.spareb7",
4058
14
        FT_UINT8, BASE_DEC, NULL, 0x40,
4059
14
        NULL, HFILL }
4060
14
    },
4061
14
    { &hf_gsm_a_b8spare,
4062
14
        { "Spare", "gsm_a.spareb8",
4063
14
        FT_UINT8, BASE_DEC, NULL, 0x80,
4064
14
        NULL, HFILL }
4065
14
    },
4066
14
    { &hf_gsm_a_spare_bits,
4067
14
        { "Spare bit(s)", "gsm_a.spare_bits",
4068
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4069
14
        NULL, HFILL }
4070
14
    },
4071
14
    { &hf_gsm_a_multi_bnd_sup_fields,
4072
14
        { "Multiband supported field", "gsm_a.multi_bnd_sup_fields",
4073
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4074
14
        NULL, HFILL }
4075
14
    },
4076
14
    { &hf_gsm_a_pgsm_supported,
4077
14
        { "P-GSM Supported", "gsm_a.classmark3.pgsmSupported",
4078
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4079
14
        NULL, HFILL}
4080
14
    },
4081
14
    { &hf_gsm_a_egsm_supported,
4082
14
        { "E-GSM or R-GSM Supported", "gsm_a.classmark3.egsmSupported",
4083
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4084
14
        NULL, HFILL}
4085
14
    },
4086
14
    { &hf_gsm_a_gsm1800_supported,
4087
14
        { "GSM 1800 Supported", "gsm_a.classmark3.gsm1800Supported",
4088
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4089
14
        NULL, HFILL}
4090
14
    },
4091
14
    { &hf_gsm_a_ass_radio_cap1,
4092
14
        { "Associated Radio Capability 1", "gsm_a.classmark3.ass_radio_cap1",
4093
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4094
14
        NULL, HFILL}
4095
14
    },
4096
14
    { &hf_gsm_a_ass_radio_cap2,
4097
14
        { "Associated Radio Capability 2", "gsm_a.classmark3.ass_radio_cap2",
4098
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4099
14
        NULL, HFILL}
4100
14
    },
4101
14
    { &hf_gsm_a_cm3_A5_bits,
4102
14
        { "A5 bits", "gsm_a.classmark3.a5_bits",
4103
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4104
14
        NULL, HFILL}
4105
14
    },
4106
14
    { &hf_gsm_a_rsupport,
4107
14
        { "R Support", "gsm_a.classmark3.rsupport",
4108
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4109
14
        NULL, HFILL}
4110
14
    },
4111
14
    { &hf_gsm_a_r_capabilities,
4112
14
        { "R-GSM band Associated Radio Capability", "gsm_a.classmark3.r_capabilities",
4113
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4114
14
        NULL, HFILL}
4115
14
    },
4116
14
    { &hf_gsm_a_multislot_capabilities,
4117
14
        { "HSCSD Multi Slot Capability", "gsm_a.classmark3.multislot_capabilities",
4118
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4119
14
        NULL, HFILL}
4120
14
    },
4121
14
    { &hf_gsm_a_multislot_class,
4122
14
        { "HSCSD Multi Slot Class", "gsm_a.classmark3.multislot_cap",
4123
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4124
14
        NULL, HFILL}
4125
14
    },
4126
14
    { &hf_gsm_a_ucs2_treatment,
4127
14
        { "UCS2 treatment", "gsm_a.UCS2_treatment",
4128
14
        FT_BOOLEAN, BASE_NONE, TFS(&UCS2_treatment_vals), 0x0,
4129
14
        NULL, HFILL }
4130
14
    },
4131
14
    { &hf_gsm_a_extended_measurement_cap,
4132
14
        { "Extended Measurement Capability", "gsm_a.classmark3.ext_meas_cap",
4133
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4134
14
        NULL, HFILL}
4135
14
    },
4136
14
    { &hf_gsm_a_ms_measurement_capability,
4137
14
        { "MS measurement capability", "gsm_a.classmark3.ms_measurement_capability",
4138
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x0,
4139
14
        NULL, HFILL}
4140
14
    },
4141
14
    { &hf_gsm_a_sms_value,
4142
14
        { "SMS_VALUE (Switch-Measure-Switch)", "gsm_a.classmark3.sms_value",
4143
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_sms_vals), 0x0,
4144
14
        NULL, HFILL}
4145
14
    },
4146
14
    { &hf_gsm_a_sm_value,
4147
14
        { "SM_VALUE (Switch-Measure)", "gsm_a.classmark3.sm_value",
4148
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_sms_vals), 0x0,
4149
14
        NULL, HFILL}
4150
14
    },
4151
14
    { &hf_gsm_a_ms_pos_method_cap_present,
4152
14
        { "MS Positioning Method Capability present", "gsm_a.classmark3.ms_pos_method_cap_present",
4153
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4154
14
        NULL, HFILL}
4155
14
    },
4156
14
    { &hf_gsm_a_ms_pos_method,
4157
14
        { "MS Positioning Method", "gsm_a.classmark3.ms_pos_method",
4158
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4159
14
        NULL, HFILL}
4160
14
    },
4161
14
    { &hf_gsm_a_ms_assisted_e_otd,
4162
14
        { "MS assisted E-OTD", "gsm_a.classmark3.ms_assisted_e_otd",
4163
14
        FT_BOOLEAN, BASE_NONE, TFS(&ms_assisted_e_otd_vals), 0x0,
4164
14
        NULL, HFILL}
4165
14
    },
4166
14
    { &hf_gsm_a_ms_based_e_otd,
4167
14
        { "MS based E-OTD", "gsm_a.classmark3.ms_based_e_otd",
4168
14
        FT_BOOLEAN, BASE_NONE, TFS(&ms_based_e_otd_vals), 0x0,
4169
14
        NULL, HFILL}
4170
14
    },
4171
14
    { &hf_gsm_a_ms_assisted_gps,
4172
14
        { "MS assisted GPS", "gsm_a.classmark3.ms_assisted_gps",
4173
14
        FT_BOOLEAN, BASE_NONE, TFS(&ms_assisted_gps_vals), 0x0,
4174
14
        NULL, HFILL}
4175
14
    },
4176
14
    { &hf_gsm_a_ms_based_gps,
4177
14
        { "MS based GPS", "gsm_a.classmark3.ms_based_gps",
4178
14
        FT_BOOLEAN, BASE_NONE, TFS(&ms_based_gps_vals), 0x0,
4179
14
        NULL, HFILL}
4180
14
    },
4181
14
    { &hf_gsm_a_ms_conventional_gps,
4182
14
        { "MS Conventional GPS", "gsm_a.classmark3.ms_conventional_gps",
4183
14
        FT_BOOLEAN, BASE_NONE, TFS(&ms_conventional_gps_vals), 0x0,
4184
14
        NULL, HFILL}
4185
14
    },
4186
14
    { &hf_gsm_a_ecsd_multi_slot_capability,
4187
14
        { "ECSD Multi Slot Capability present", "gsm_a.classmark3.ecsd_multi_slot_capability",
4188
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4189
14
        NULL, HFILL}
4190
14
    },
4191
14
    { &hf_gsm_a_ecsd_multi_slot_class,
4192
14
        { "ECSD Multi Slot Class", "gsm_a.classmark3.ecsd_multi_slot_class",
4193
14
        FT_UINT8, BASE_DEC, NULL, 0x00,
4194
14
        NULL, HFILL}
4195
14
    },
4196
14
    { &hf_gsm_a_8_psk_struct_present,
4197
14
        { "8-PSK Struct present", "gsm_a.classmark3.8_psk_struct_present",
4198
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4199
14
        NULL, HFILL}
4200
14
    },
4201
14
    { &hf_gsm_a_8_psk_struct,
4202
14
        { "8-PSK Struct", "gsm_a.classmark3.8_psk_struct",
4203
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4204
14
        NULL, HFILL}
4205
14
    },
4206
14
    { &hf_gsm_a_modulation_capability,
4207
14
        { "Modulation Capability", "gsm_a.classmark3.modulation_capability",
4208
14
        FT_BOOLEAN, BASE_NONE, TFS(&modulation_capability_vals), 0x00,
4209
14
        NULL, HFILL}
4210
14
    },
4211
14
    { &hf_gsm_a_8_psk_rf_power_capability_1_present,
4212
14
        { "8-PSK RF Power Capability 1 present", "gsm_a.classmark3.8_psk_rf_power_capability_1_present",
4213
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4214
14
        NULL, HFILL}
4215
14
    },
4216
14
    { &hf_gsm_a_8_psk_rf_power_capability_1,
4217
14
        { "8-PSK RF Power Capability 1", "gsm_a.classmark3.8_psk_rf_power_capability_1",
4218
14
        FT_UINT8, BASE_HEX, VALS(eight_psk_rf_power_capability_vals), 0x00,
4219
14
        NULL, HFILL}
4220
14
    },
4221
14
    { &hf_gsm_a_8_psk_rf_power_capability_2_present,
4222
14
        { "8-PSK RF Power Capability 2 present", "gsm_a.classmark3.8_psk_rf_power_capability_2_present",
4223
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4224
14
        NULL, HFILL}
4225
14
    },
4226
14
    { &hf_gsm_a_8_psk_rf_power_capability_2,
4227
14
        { "8-PSK RF Power Capability 2", "gsm_a.classmark3.8_psk_rf_power_capability_2",
4228
14
        FT_UINT8, BASE_HEX, VALS(eight_psk_rf_power_capability_vals), 0x00,
4229
14
        NULL, HFILL}
4230
14
    },
4231
14
    { &hf_gsm_a_gsm_400_band_info_present,
4232
14
        { "GSM 400 Band Information present", "gsm_a.classmark3.gsm_400_band_info_present",
4233
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4234
14
        NULL, HFILL}
4235
14
    },
4236
14
    { &hf_gsm_a_gsm_400_bands_supported,
4237
14
        { "GSM 400 Bands Supported", "gsm_a.classmark3.gsm_400_bands_supported",
4238
14
        FT_UINT8, BASE_HEX, VALS(gsm_400_bands_supported_vals), 0x00,
4239
14
        NULL, HFILL}
4240
14
    },
4241
14
    { &hf_gsm_a_gsm_400_assoc_radio_cap,
4242
14
        { "GSM 400 Associated Radio Capability", "gsm_a.classmark3.gsm_400_assoc_radio_cap",
4243
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4244
14
        NULL, HFILL}
4245
14
    },
4246
14
    { &hf_gsm_a_gsm_850_assoc_radio_cap_present,
4247
14
        { "GSM 850 Associated Radio Capability present", "gsm_a.classmark3.gsm_850_assoc_radio_cap_present",
4248
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4249
14
        NULL, HFILL}
4250
14
    },
4251
14
    { &hf_gsm_a_gsm_850_assoc_radio_cap,
4252
14
        { "GSM 850 Associated Radio Capability", "gsm_a.classmark3.gsm_850_assoc_radio_cap",
4253
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4254
14
        NULL, HFILL}
4255
14
    },
4256
14
    { &hf_gsm_a_gsm_1900_assoc_radio_cap_present,
4257
14
        { "GSM 1900 Associated Radio Capability present", "gsm_a.classmark3.gsm_1900_assoc_radio_cap_present",
4258
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4259
14
        NULL, HFILL}
4260
14
    },
4261
14
    { &hf_gsm_a_gsm_1900_assoc_radio_cap,
4262
14
        { "GSM 1900 Associated Radio Capability", "gsm_a.classmark3.gsm_1900_assoc_radio_cap",
4263
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4264
14
        NULL, HFILL}
4265
14
    },
4266
14
    { &hf_gsm_a_umts_fdd_rat_cap,
4267
14
        { "UMTS FDD Radio Access Technology Capability", "gsm_a.classmark3.umts_fdd_rat_cap",
4268
14
        FT_BOOLEAN, BASE_NONE, TFS(&umts_fdd_rat_cap_vals), 0x00,
4269
14
        NULL, HFILL}
4270
14
    },
4271
14
    { &hf_gsm_a_umts_384_mcps_tdd_rat_cap,
4272
14
        { "UMTS 3.84 Mcps TDD Radio Access Technology Capability", "gsm_a.classmark3.umts_384_mcps_tdd_rat_cap",
4273
14
        FT_BOOLEAN, BASE_NONE, TFS(&umts_384_mcps_tdd_rat_cap_vals), 0x00,
4274
14
        NULL, HFILL}
4275
14
    },
4276
14
    { &hf_gsm_a_cdma_2000_rat_cap,
4277
14
        { "CDMA 2000 Radio Access Technology Capability", "gsm_a.classmark3.cdma_2000_rat_cap",
4278
14
        FT_BOOLEAN, BASE_NONE, TFS(&cdma_2000_rat_cap_vals), 0x00,
4279
14
        NULL, HFILL}
4280
14
    },
4281
14
    { &hf_gsm_a_dtm_e_gprs_multi_slot_info_present,
4282
14
        { "DTM E/GPRS Multi Slot Information present", "gsm_a.classmark3.dtm_e_gprs_multi_slot_info_present",
4283
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4284
14
        NULL, HFILL}
4285
14
    },
4286
14
    { &hf_gsm_a_dtm_gprs_multi_slot_class,
4287
14
        { "DTM GPRS Multi Slot Class", "gsm_a.classmark3.dtm_gprs_multi_slot_class",
4288
14
        FT_UINT8, BASE_DEC, VALS(dtm_gprs_multi_slot_class_vals), 0x00,
4289
14
        NULL, HFILL}
4290
14
    },
4291
14
    { &hf_gsm_a_single_slot_dtm,
4292
14
        { "Single Slot DTM", "gsm_a.classmark3.single_slot_dtm_supported",
4293
14
        FT_BOOLEAN, BASE_NONE, TFS(&single_slot_dtm_vals), 0x0,
4294
14
        NULL, HFILL}
4295
14
    },
4296
14
    { &hf_gsm_a_dtm_egprs_multi_slot_class_present,
4297
14
        { "DTM EGPRS Multi Slot Class present", "gsm_a.classmark3.dtm_egprs_multi_slot_class_present",
4298
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4299
14
        NULL, HFILL}
4300
14
    },
4301
14
    { &hf_gsm_a_dtm_egprs_multi_slot_class,
4302
14
        { "DTM EGPRS Multi Slot Class", "gsm_a.classmark3.dtm_egprs_multi_slot_class",
4303
14
        FT_UINT8, BASE_DEC, VALS(dtm_gprs_multi_slot_class_vals), 0x00,
4304
14
        NULL, HFILL}
4305
14
    },
4306
14
    { &hf_gsm_a_single_band_support,
4307
14
        { "Single Band Support", "gsm_a.classmark3.single_band_support",
4308
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4309
14
        NULL, HFILL}
4310
14
    },
4311
14
    { &hf_gsm_a_gsm_band,
4312
14
        { "GSM Band", "gsm_a.classmark3.gsm_band",
4313
14
        FT_UINT8, BASE_DEC, VALS(gsm_band_vals), 0x00,
4314
14
        NULL, HFILL}
4315
14
    },
4316
14
    { &hf_gsm_a_gsm_750_assoc_radio_cap_present,
4317
14
        { "GSM 750 Associated Radio Capability present", "gsm_a.classmark3.gsm_750_assoc_radio_cap_present",
4318
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4319
14
        NULL, HFILL}
4320
14
    },
4321
14
    { &hf_gsm_a_gsm_750_assoc_radio_cap,
4322
14
        { "GSM 750 Associated Radio Capability", "gsm_a.classmark3.gsm_750_assoc_radio_cap",
4323
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4324
14
        NULL, HFILL}
4325
14
    },
4326
14
    { &hf_gsm_a_umts_128_mcps_tdd_rat_cap,
4327
14
        { "UMTS 1.28 Mcps TDD Radio Access Technology Capability", "gsm_a.classmark3.umts_128_mcps_tdd_rat_cap",
4328
14
        FT_BOOLEAN, BASE_NONE, TFS(&umts_128_mcps_tdd_rat_cap_vals), 0x00,
4329
14
        NULL, HFILL}
4330
14
    },
4331
14
    { &hf_gsm_a_geran_feature_package_1,
4332
14
        { "GERAN Feature Package 1", "gsm_a.classmark3.geran_feature_package_1",
4333
14
        FT_BOOLEAN, BASE_NONE, TFS(&geran_feature_package_1_vals), 0x00,
4334
14
        NULL, HFILL}
4335
14
    },
4336
14
    { &hf_gsm_a_ext_dtm_e_gprs_multi_slot_info_present,
4337
14
        { "Extended DTM E/GPRS Multi Slot Information present", "gsm_a.classmark3.ext_dtm_e_gprs_info_present",
4338
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4339
14
        NULL, HFILL}
4340
14
    },
4341
14
    { &hf_gsm_a_ext_dtm_gprs_multi_slot_class,
4342
14
        { "Extended DTM GPRS Multi Slot Class", "gsm_a.classmark3.ext_dtm_gprs_multi_slot_class",
4343
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4344
14
        NULL, HFILL}
4345
14
    },
4346
14
    { &hf_gsm_a_ext_dtm_egprs_multi_slot_class,
4347
14
        { "Extended DTM EGPRS Multi Slot Class", "gsm_a.classmark3.ext_dtm_egprs_multi_slot_class",
4348
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4349
14
        NULL, HFILL}
4350
14
    },
4351
14
    { &hf_gsm_a_high_multislot_cap_present,
4352
14
        { "High Multislot Capability present", "gsm_a.classmark3.high_multislot_cap_present",
4353
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4354
14
        NULL, HFILL}
4355
14
    },
4356
14
    { &hf_gsm_a_high_multislot_cap,
4357
14
        { "High Multislot Capability", "gsm_a.classmark3.high_multislot_cap",
4358
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4359
14
        NULL, HFILL}
4360
14
    },
4361
14
    { &hf_gsm_a_geran_iu_mode_support,
4362
14
        { "GERAN Iu Mode Support", "gsm_a.classmark3.geran_iu_mode_support",
4363
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4364
14
        NULL, HFILL}
4365
14
    },
4366
14
    { &hf_gsm_a_geran_iu_mode_cap,
4367
14
        { "GERAN Iu Mode Capabilities", "gsm_a.classmark3.geran_iu_mode_cap",
4368
14
        FT_UINT24, BASE_HEX, NULL, 0x00,
4369
14
        NULL, HFILL}
4370
14
    },
4371
14
    { &hf_gsm_a_geran_iu_mode_cap_length,
4372
14
        { "Length", "gsm_a.classmark3.geran_iu_mode_cap.length",
4373
14
        FT_UINT8, BASE_DEC, NULL, 0x00,
4374
14
        NULL, HFILL}
4375
14
    },
4376
14
    { &hf_gsm_a_flo_iu_cap,
4377
14
        { "FLO Iu Capability", "gsm_a.classmark3.geran_iu_mode_cap.flo_iu_cap",
4378
14
        FT_BOOLEAN, BASE_NONE, TFS(&flo_iu_cap_vals), 0x00,
4379
14
        NULL, HFILL}
4380
14
    },
4381
14
    { &hf_gsm_a_geran_feature_package_2,
4382
14
        { "GERAN Feature Package 2", "gsm_a.classmark3.geran_feature_package_2",
4383
14
        FT_BOOLEAN, BASE_NONE, TFS(&geran_feature_package_2_vals), 0x00,
4384
14
        NULL, HFILL}
4385
14
    },
4386
14
    { &hf_gsm_a_gmsk_multislot_power_prof,
4387
14
        { "GMSK Multislot Power Profile", "gsm_a.classmark3.gmsk_multislot_power_prof",
4388
14
        FT_UINT8, BASE_DEC, VALS(gmsk_multislot_power_prof_vals), 0x00,
4389
14
        NULL, HFILL}
4390
14
    },
4391
14
    { &hf_gsm_a_8_psk_multislot_power_prof,
4392
14
        { "8-PSK Multislot Power Profile", "gsm_a.classmark3.8_psk_multislot_power_prof",
4393
14
        FT_UINT8, BASE_DEC, VALS(eight_psk_multislot_power_prof_vals), 0x00,
4394
14
        NULL, HFILL}
4395
14
    },
4396
14
    { &hf_gsm_a_t_gsm_400_band_info_present,
4397
14
        { "T-GSM 400 Band Information present", "gsm_a.classmark3.gsm_400_band_info_present",
4398
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4399
14
        NULL, HFILL}
4400
14
    },
4401
14
    { &hf_gsm_a_t_gsm_400_bands_supported,
4402
14
        { "T-GSM 400 Bands Supported", "gsm_a.classmark3.t_gsm_400_bands_supported",
4403
14
        FT_UINT8, BASE_HEX, VALS(t_gsm_400_bands_supported_vals), 0x00,
4404
14
        NULL, HFILL}
4405
14
    },
4406
14
    { &hf_gsm_a_t_gsm_400_assoc_radio_cap,
4407
14
        { "T-GSM 400 Associated Radio Capability", "gsm_a.classmark3.t_gsm_400_assoc_radio_cap",
4408
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4409
14
        NULL, HFILL}
4410
14
    },
4411
14
    { &hf_gsm_a_t_gsm_900_assoc_radio_cap_present,
4412
14
        { "T-GSM 900 Associated Radio Capability present", "gsm_a.classmark3.t_gsm_900_assoc_radio_cap_present",
4413
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4414
14
        NULL, HFILL}
4415
14
    },
4416
14
    { &hf_gsm_a_t_gsm_900_assoc_radio_cap,
4417
14
        { "T-GSM 900 Associated Radio Capability", "gsm_a.classmark3.t_gsm_900_assoc_radio_cap",
4418
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4419
14
        NULL, HFILL}
4420
14
    },
4421
14
    { &hf_gsm_a_downlink_adv_receiver_perf,
4422
14
        { "Downlink Advanced Receiver Performance", "gsm_a.classmark3.downlink_adv_receiver_perf",
4423
14
        FT_UINT8, BASE_DEC, VALS(downlink_adv_receiver_perf_vals), 0x00,
4424
14
        NULL, HFILL}
4425
14
    },
4426
14
    { &hf_gsm_a_dtm_enhancements_cap,
4427
14
        { "DTM Enhancements Capability", "gsm_a.classmark3.dtm_enhancements_capability",
4428
14
        FT_BOOLEAN, BASE_NONE, TFS(&dtm_enhancements_cap_vals), 0x00,
4429
14
        NULL, HFILL}
4430
14
    },
4431
14
    { &hf_gsm_a_dtm_e_gprs_high_multi_slot_info_present,
4432
14
        { "DTM E/GPRS High Multi Slot Information present", "gsm_a.classmark3.dtm_e_gprs_high_multi_slot_info_present",
4433
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4434
14
        NULL, HFILL}
4435
14
    },
4436
14
    { &hf_gsm_a_dtm_gprs_high_multi_slot_class,
4437
14
        { "DTM GPRS Multi Slot Class", "gsm_a.classmark3.dtm_gprs_multi_slot_class",
4438
14
        FT_UINT8, BASE_DEC, VALS(dtm_gprs_high_multi_slot_class_vals), 0x00,
4439
14
        NULL, HFILL}
4440
14
    },
4441
14
    { &hf_gsm_a_offset_required,
4442
14
        { "Offset required", "gsm_a.classmark3.offset_required",
4443
14
        FT_BOOLEAN, BASE_NONE, TFS(&offset_required_vals), 0x0,
4444
14
        NULL, HFILL}
4445
14
    },
4446
14
    { &hf_gsm_a_dtm_egprs_high_multi_slot_class_present,
4447
14
        { "DTM EGPRS High Multi Slot Class present", "gsm_a.classmark3.dtm_egprs_high_multi_slot_class_present",
4448
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4449
14
        NULL, HFILL}
4450
14
    },
4451
14
    { &hf_gsm_a_dtm_egprs_high_multi_slot_class,
4452
14
        { "DTM EGPRS High Multi Slot Class", "gsm_a.classmark3.dtm_egprs_high_multi_slot_class",
4453
14
        FT_UINT8, BASE_DEC, VALS(dtm_gprs_high_multi_slot_class_vals), 0x00,
4454
14
        NULL, HFILL}
4455
14
    },
4456
14
    { &hf_gsm_a_repeated_acch_cap,
4457
14
        { "Repeated ACCH Capability", "gsm_a.classmark3.repeated_acch_cap",
4458
14
        FT_BOOLEAN, BASE_NONE, TFS(&repeated_acch_cap_vals), 0x00,
4459
14
        NULL, HFILL}
4460
14
    },
4461
14
    { &hf_gsm_a_gsm_710_assoc_radio_cap_present,
4462
14
        { "GSM 710 Associated Radio Capability present", "gsm_a.classmark3.gsm_710_assoc_radio_cap_present",
4463
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4464
14
        NULL, HFILL}
4465
14
    },
4466
14
    { &hf_gsm_a_gsm_710_assoc_radio_cap,
4467
14
        { "GSM 710 Associated Radio Capability", "gsm_a.classmark3.gsm_710_assoc_radio_cap",
4468
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4469
14
        NULL, HFILL}
4470
14
    },
4471
14
    { &hf_gsm_a_t_gsm_810_assoc_radio_cap_present,
4472
14
        { "T-GSM 810 Associated Radio Capability present", "gsm_a.classmark3.t_gsm_810_assoc_radio_cap_present",
4473
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4474
14
        NULL, HFILL}
4475
14
    },
4476
14
    { &hf_gsm_a_t_gsm_810_assoc_radio_cap,
4477
14
        { "T-GSM 810 Associated Radio Capability", "gsm_a.classmark3.t_gsm_810_assoc_radio_cap",
4478
14
        FT_UINT8, BASE_HEX, NULL, 0x00,
4479
14
        NULL, HFILL}
4480
14
    },
4481
14
    { &hf_gsm_a_ciphering_mode_setting_cap,
4482
14
        { "Ciphering Mode Setting Capability", "gsm_a.classmark3.ciphering_mode_setting_cap",
4483
14
        FT_BOOLEAN, BASE_NONE, TFS(&ciphering_mode_setting_cap_vals), 0x00,
4484
14
        NULL, HFILL}
4485
14
    },
4486
14
    { &hf_gsm_a_additional_positioning_caps,
4487
14
        { "Additional Positioning Capabilities", "gsm_a.classmark3.additional_positioning_caps",
4488
14
        FT_BOOLEAN, BASE_NONE, TFS(&additional_positioning_caps_vals), 0x00,
4489
14
        NULL, HFILL}
4490
14
    },
4491
14
    { &hf_gsm_a_e_utra_fdd_support,
4492
14
        { "E-UTRA FDD support", "gsm_a.classmark3.e_utra_fdd_support",
4493
14
        FT_BOOLEAN, BASE_NONE, TFS(&e_utra_fdd_support_vals), 0x00,
4494
14
        NULL, HFILL}
4495
14
    },
4496
14
    { &hf_gsm_a_e_utra_tdd_support,
4497
14
        { "E-UTRA TDD support", "gsm_a.classmark3.e_utra_tdd_support",
4498
14
        FT_BOOLEAN, BASE_NONE, TFS(&e_utra_tdd_support_vals), 0x00,
4499
14
        NULL, HFILL}
4500
14
    },
4501
14
    { &hf_gsm_a_e_utra_meas_and_report_support,
4502
14
        { "E-UTRA Measurement and Reporting support", "gsm_a.classmark3.e_utra_meas_and_report_support",
4503
14
        FT_BOOLEAN, BASE_NONE, TFS(&e_utra_meas_and_report_support_vals), 0x00,
4504
14
        NULL, HFILL}
4505
14
    },
4506
14
    { &hf_gsm_a_prio_based_resel_support,
4507
14
        { "Priority-based reselection support", "gsm_a.classmark3.prio_based_resel_support",
4508
14
        FT_BOOLEAN, BASE_NONE, TFS(&prio_based_resel_support_vals), 0x00,
4509
14
        NULL, HFILL}
4510
14
    },
4511
14
    { &hf_gsm_a_utra_csg_cells_reporting,
4512
14
        { "UTRA CSG Cells Reporting", "gsm_a.classmark3.utra_csg_cells_reporting",
4513
14
        FT_BOOLEAN, BASE_NONE, TFS(&utra_csg_cells_reporting_vals), 0x00,
4514
14
        NULL, HFILL}
4515
14
    },
4516
14
    { &hf_gsm_a_vamos_level,
4517
14
        { "VAMOS Level", "gsm_a.classmark3.vamos_level",
4518
14
        FT_UINT8, BASE_DEC, VALS(vamos_level_vals), 0x00,
4519
14
        NULL, HFILL}
4520
14
    },
4521
14
    { &hf_gsm_a_tighter_cap,
4522
14
        { "TIGHTER Capability", "gsm_a.classmark3.tighter_cap",
4523
14
        FT_UINT8, BASE_DEC, VALS(tighter_cap_level_vals), 0x00,
4524
14
        NULL, HFILL}
4525
14
    },
4526
14
    { &hf_gsm_a_selective_ciph_down_sacch,
4527
14
        { "Selective Ciphering of Downlink SACCH", "gsm_a.classmark3.selective_ciph_down_sacch",
4528
14
        FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x00,
4529
14
        NULL, HFILL}
4530
14
    },
4531
14
    { &hf_gsm_a_cs_to_ps_srvcc_geran_to_utra,
4532
14
        { "CS to PS SRVCC from GERAN to UTRA", "gsm_a.classmark3.cs_to_ps_srvcc_geran_to_utra",
4533
14
        FT_UINT8, BASE_DEC, VALS(cs_to_ps_srvcc_geran_to_utra_vals), 0x00,
4534
14
        NULL, HFILL}
4535
14
    },
4536
14
    { &hf_gsm_a_cs_to_ps_srvcc_geran_to_eutra,
4537
14
        { "CS to PS SRVCC from GERAN to E-UTRA", "gsm_a.classmark3.cs_to_ps_srvcc_geran_to_eutra",
4538
14
        FT_UINT8, BASE_DEC, VALS(cs_to_ps_srvcc_geran_to_eutra_vals), 0x00,
4539
14
        NULL, HFILL}
4540
14
    },
4541
14
    { &hf_gsm_a_geran_network_sharing_support,
4542
14
        { "GERAN Network Sharing support", "gsm_a.classmark3.geran_network_sharing_support",
4543
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4544
14
        NULL, HFILL}
4545
14
    },
4546
14
    { &hf_gsm_a_eutra_wb_rsrq_support,
4547
14
        { "E-UTRA Wideband RSRQ measurements support", "gsm_a.classmark3.eutra_wb_rsrq_support",
4548
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4549
14
        NULL, HFILL}
4550
14
    },
4551
14
    { &hf_gsm_a_er_band_support,
4552
14
        { "ER Band support", "gsm_a.classmark3.er_band_support",
4553
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4554
14
        NULL, HFILL}
4555
14
    },
4556
14
    { &hf_gsm_a_utra_mfbi_support,
4557
14
        { "UTRA Multiple Frequency Band Indicators support", "gsm_a.classmark3.utra_mfbi_support",
4558
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4559
14
        NULL, HFILL}
4560
14
    },
4561
14
    { &hf_gsm_a_eutra_mfbi_support,
4562
14
        { "E-UTRA Multiple Frequency Band Indicators support", "gsm_a.classmark3.eutra_mfbi_support",
4563
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4564
14
        NULL, HFILL}
4565
14
    },
4566
14
    { &hf_gsm_a_ext_tsc_set_cap_support,
4567
14
        { "Extended TSC Set Capability support", "gsm_a.classmark3.ext_tsc_set_cap_support",
4568
14
        FT_BOOLEAN, BASE_NONE, NULL, 0x00,
4569
14
        NULL, HFILL}
4570
14
    },
4571
14
    { &hf_gsm_a_ext_earfcn_value_range,
4572
14
        { "Extended EARFCN value range", "gsm_a.classmark3.ext_earfcn_value_range",
4573
14
        FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x00,
4574
14
        NULL, HFILL}
4575
14
    },
4576
14
    { &hf_gsm_a_geo_loc_type_of_shape,
4577
14
        { "Location estimate", "gsm_a.gad.location_estimate",
4578
14
        FT_UINT8, BASE_DEC, VALS(type_of_shape_vals), 0xf0,
4579
14
        NULL, HFILL }
4580
14
    },
4581
14
    { &hf_gsm_a_geo_loc_sign_of_lat,
4582
14
        { "Sign of latitude", "gsm_a.gad.sign_of_latitude",
4583
14
        FT_UINT8, BASE_DEC, VALS(sign_of_latitude_vals), 0x80,
4584
14
        NULL, HFILL }
4585
14
    },
4586
14
    { &hf_gsm_a_geo_loc_deg_of_lat,
4587
14
        { "Degrees of latitude", "gsm_a.gad.deg_of_latitude",
4588
14
        FT_UINT24, BASE_DEC, NULL, 0x7fffff,
4589
14
        NULL, HFILL }
4590
14
    },
4591
14
    { &hf_gsm_a_geo_loc_deg_of_long,
4592
14
        { "Degrees of longitude", "gsm_a.gad.deg_of_longitude",
4593
14
        FT_INT24, BASE_DEC, NULL, 0xffffff,
4594
14
        NULL, HFILL }
4595
14
    },
4596
14
    { &hf_gsm_a_geo_loc_osm_uri,
4597
14
        { "Location OSM URI", "gsm_a.gad.location_uri",
4598
14
        FT_STRING, BASE_NONE, NULL, 0x0,
4599
14
        NULL, HFILL }
4600
14
    },
4601
14
    { &hf_gsm_a_geo_loc_uncertainty_code,
4602
14
        { "Uncertainty code", "gsm_a.gad.uncertainty_code",
4603
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4604
14
        NULL, HFILL }
4605
14
    },
4606
14
    { &hf_gsm_a_geo_loc_uncertainty_semi_major,
4607
14
        { "Uncertainty semi-major", "gsm_a.gad.uncertainty_semi_major",
4608
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4609
14
        NULL, HFILL }
4610
14
    },
4611
14
    { &hf_gsm_a_geo_loc_uncertainty_semi_minor,
4612
14
        { "Uncertainty semi-minor", "gsm_a.gad.uncertainty_semi_minor",
4613
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4614
14
        NULL, HFILL }
4615
14
    },
4616
14
    { &hf_gsm_a_geo_loc_orientation_of_major_axis,
4617
14
        { "Orientation of major axis", "gsm_a.gad.orientation_of_major_axis",
4618
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4619
14
        NULL, HFILL }
4620
14
    },
4621
14
    { &hf_gsm_a_geo_loc_uncertainty_altitude,
4622
14
        { "Uncertainty Altitude", "gsm_a.gad.uncertainty_altitude",
4623
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4624
14
        NULL, HFILL }
4625
14
    },
4626
14
    { &hf_gsm_a_geo_loc_confidence,
4627
14
        { "Confidence(%)", "gsm_a.gad.confidence",
4628
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4629
14
        NULL, HFILL }
4630
14
    },
4631
14
    { &hf_gsm_a_geo_loc_uncertainty_range,
4632
14
        { "Uncertainty Range", "gsm_a.gad.uncertainty_range",
4633
14
        FT_UINT8, BASE_DEC, VALS(uncertainty_range), 0x80,
4634
14
        NULL, HFILL }
4635
14
    },
4636
14
    { &hf_gsm_a_geo_loc_horizontal_confidence,
4637
14
        { "Horizontal confidence(%)", "gsm_a.gad.horizontal_confidence",
4638
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4639
14
        NULL, HFILL }
4640
14
    },
4641
14
    { &hf_gsm_a_geo_loc_horizontal_uncertainty_range,
4642
14
        { "Horizontal Uncertainty Range", "gsm_a.gad.horizontal_uncertainty_range",
4643
14
        FT_UINT8, BASE_DEC, VALS(uncertainty_range), 0x80,
4644
14
        NULL, HFILL }
4645
14
    },
4646
14
    { &hf_gsm_a_geo_loc_vertical_confidence,
4647
14
        { "Vertical Confidence(%)", "gsm_a.gad.vertical_confidence",
4648
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4649
14
        NULL, HFILL }
4650
14
    },
4651
14
    { &hf_gsm_a_geo_loc_vertical_uncertainty_range,
4652
14
        { "Vertical Uncertainty Range", "gsm_a.gad.vertical_uncertainty_range",
4653
14
        FT_UINT8, BASE_DEC, VALS(uncertainty_range), 0x80,
4654
14
        NULL, HFILL }
4655
14
    },
4656
14
    { &hf_gsm_a_geo_loc_high_acc_uncertainty_alt,
4657
14
        { "High accuracy uncertainty altitude", "gsm_a.gad.high_acc_uncertainty_alt",
4658
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4659
14
        NULL, HFILL }
4660
14
    },
4661
14
    { &hf_gsm_a_geo_loc_no_of_points,
4662
14
        { "Number of points", "gsm_a.gad.no_of_points",
4663
14
        FT_UINT8, BASE_DEC, NULL, 0x0f,
4664
14
        NULL, HFILL }
4665
14
    },
4666
14
    { &hf_gsm_a_geo_loc_high_acc_deg_of_lat,
4667
14
        { "High accuracy degrees of latitude", "gsm_a.gad.hig_acc_deg_of_lat",
4668
14
        FT_INT32, BASE_DEC, NULL, 0x0,
4669
14
        NULL, HFILL }
4670
14
    },
4671
14
    { &hf_gsm_a_geo_loc_high_acc_deg_of_long,
4672
14
        { "High accuracy degrees of longitude", "gsm_a.gad.high_acc_deg_of_long",
4673
14
        FT_INT32, BASE_DEC, NULL, 0x0,
4674
14
        NULL, HFILL }
4675
14
    },
4676
14
    { &hf_gsm_a_geo_loc_high_acc_uncertainty_semi_major,
4677
14
        { "High accuracy uncertainty semi-major", "gsm_a.gad.high_acc_uncertainty_semi_major",
4678
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4679
14
        NULL, HFILL }
4680
14
    },
4681
14
    { &hf_gsm_a_geo_loc_high_acc_uncertainty_semi_minor,
4682
14
        { "High accuracy uncertainty semi-minor", "gsm_a.gad.high_acc_uncertainty_semi_minor",
4683
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4684
14
        NULL, HFILL }
4685
14
    },
4686
14
    { &hf_gsm_a_geo_loc_high_acc_alt,
4687
14
        { "High accuracy altitude", "gsm_a.gad.high_acc_alt",
4688
14
        FT_INT24, BASE_DEC, NULL, 0x3fffff,
4689
14
        NULL, HFILL }
4690
14
    },
4691
14
    { &hf_gsm_a_velocity_type,
4692
14
        { "Velocity type", "gsm_a.gad.velocity_type",
4693
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_velocity_type_vals), 0xf0,
4694
14
        NULL, HFILL }
4695
14
    },
4696
14
    { &hf_gsm_a_bearing,
4697
14
        { "Bearing", "gsm_a.gad.bearing",
4698
14
        FT_UINT16, BASE_DEC, NULL, 0x0,
4699
14
        NULL, HFILL }
4700
14
    },
4701
14
    { &hf_gsm_a_horizontal_speed,
4702
14
        { "Horizontal Speed", "gsm_a.gad.horizontal_velocity",
4703
14
        FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kmh), 0x0,
4704
14
        NULL, HFILL }
4705
14
    },
4706
14
    { &hf_gsm_a_vertical_speed,
4707
14
        { "Vertical Speed", "gsm_a.gad.vertical_speed",
4708
14
        FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kmh), 0x0,
4709
14
        NULL, HFILL }
4710
14
    },
4711
14
    { &hf_gsm_a_uncertainty_speed,
4712
14
        { "Uncertainty Speed", "gsm_a.gad.uncertainty_speed",
4713
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4714
14
        NULL, HFILL }
4715
14
    },
4716
14
    { &hf_gsm_a_h_uncertainty_speed,
4717
14
        { "Horizontal Uncertainty Speed", "gsm_a.gad.h_uncertainty_speed",
4718
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4719
14
        NULL, HFILL }
4720
14
    },
4721
14
    { &hf_gsm_a_v_uncertainty_speed,
4722
14
        { "Vertical Uncertainty Speed", "gsm_a.gad.v_uncertainty_speed",
4723
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4724
14
        NULL, HFILL }
4725
14
    },
4726
14
    { &hf_gsm_a_d,
4727
14
        { "Direction of Vertical Speed", "gsm_a.gad.d",
4728
14
          FT_BOOLEAN, 8, TFS(&gsm_a_dir_of_ver_speed_vals), 0x02,
4729
14
        NULL, HFILL}
4730
14
    },
4731
14
    { &hf_gsm_a_geo_loc_D,
4732
14
        { "D: Direction of Altitude", "gsm_a.gad.D",
4733
14
        FT_UINT16, BASE_DEC, VALS(dir_of_alt_vals), 0x8000,
4734
14
        NULL, HFILL }
4735
14
    },
4736
14
    { &hf_gsm_a_geo_loc_altitude,
4737
14
        { "Altitude in meters", "gsm_a.gad.altitude",
4738
14
        FT_UINT16, BASE_DEC, NULL, 0x7fff,
4739
14
        NULL, HFILL }
4740
14
    },
4741
14
    { &hf_gsm_a_geo_loc_inner_radius,
4742
14
        { "Inner radius", "gsm_a.gad.inner_radius",
4743
14
        FT_UINT16, BASE_DEC, NULL, 0x0,
4744
14
        NULL, HFILL }
4745
14
    },
4746
14
    { &hf_gsm_a_geo_loc_uncertainty_radius,
4747
14
        { "Uncertainty radius", "gsm_a.gad.uncertainty_radius",
4748
14
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4749
14
        NULL, HFILL }
4750
14
    },
4751
14
    { &hf_gsm_a_geo_loc_offset_angle,
4752
14
        { "Offset angle", "gsm_a.gad.offset_angle",
4753
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4754
14
        NULL, HFILL }
4755
14
    },
4756
14
    { &hf_gsm_a_geo_loc_included_angle,
4757
14
        { "Included angle", "gsm_a.gad.included_angle",
4758
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
4759
14
        NULL, HFILL }
4760
14
    },
4761
14
    { &hf_gsm_a_key_seq,
4762
14
        { "key sequence", "gsm_a.key_seq",
4763
14
        FT_UINT8, BASE_DEC, VALS(gsm_a_key_seq_vals), 0x00,
4764
14
        NULL, HFILL }
4765
14
    },
4766
14
    { &hf_gsm_a_lac,
4767
14
        { "Location Area Code (LAC)", "gsm_a.lac",
4768
14
        FT_UINT16, BASE_HEX_DEC, NULL, 0x00,
4769
14
        NULL, HFILL }
4770
14
    },
4771
14
    { &hf_gsm_a_spare_nibble,
4772
14
        { "Spare Nibble", "gsm_a.spare",
4773
14
        FT_UINT8, BASE_DEC_HEX, NULL, 0x00,
4774
14
        NULL, HFILL }
4775
14
    },
4776
      /* Generated from convert_proto_tree_add_text.pl */
4777
14
      { &hf_gsm_a_filler, { "Filler", "gsm_a.filler", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL }},
4778
14
      { &hf_gsm_a_identity_digit1, { "Identity Digit 1", "gsm_a.identity_digit1", FT_UINT8, BASE_HEX, NULL, 0xF0, NULL, HFILL }},
4779
14
      { &hf_gsm_a_group_call_reference, { "Group or Broadcast call reference", "gsm_a.group_call_reference", FT_UINT32, BASE_DEC_HEX, NULL, 0xffffffe0, NULL, HFILL }},
4780
14
      { &hf_gsm_a_service_flag, { "SF Service Flag", "gsm_a.service_flag", FT_BOOLEAN, 32, TFS(&tfs_vgcs_vbs), 0x00000010, NULL, HFILL }},
4781
14
      { &hf_gsm_a_af_acknowledgement, { "AF Acknowledgement", "gsm_a.af_acknowledgement", FT_BOOLEAN, 32, TFS(&tfs_required_not_required), 0x00000008, NULL, HFILL }},
4782
14
      { &hf_gsm_a_call_priority, { "Call Priority", "gsm_a.call_priority", FT_UINT32, BASE_DEC, VALS(gsm_a_call_priority_vals), 0x00000007, NULL, HFILL }},
4783
14
      { &hf_gsm_a_ciphering_info, { "Ciphering Information", "gsm_a.ciphering_info", FT_UINT8, BASE_HEX, NULL, 0xf0, NULL, HFILL }},
4784
14
      { &hf_gsm_a_sapi, { "SAPI (Service Access Point Identifier)", "gsm_a.sapi", FT_UINT8, BASE_DEC, VALS(gsm_a_sapi_vals), 0x30, NULL, HFILL }},
4785
14
    };
4786
4787
    /* Setup protocol subtree array */
4788
14
#define NUM_INDIVIDUAL_ELEMS    2
4789
14
    static int *ett[NUM_INDIVIDUAL_ELEMS +
4790
14
            NUM_GSM_COMMON_ELEM];
4791
4792
14
    static ei_register_info ei[] = {
4793
14
        { &ei_gsm_a_extraneous_data, { "gsm_a.extraneous_data", PI_PROTOCOL, PI_NOTE, "Extraneous Data, dissector bug or later version spec (report to wireshark.org)", EXPFILL }},
4794
14
        { &ei_gsm_a_unknown_element, { "gsm_a.unknown_element", PI_PROTOCOL, PI_ERROR, "Unknown - aborting dissection", EXPFILL }},
4795
14
        { &ei_gsm_a_unknown_pdu_type, { "gsm_a.unknown_pdu_type", PI_PROTOCOL, PI_WARN, "Unknown PDU type", EXPFILL }},
4796
14
        { &ei_gsm_a_no_element_dissector, { "gsm_a.no_element_dissector", PI_PROTOCOL, PI_WARN, "No element dissector, rest of dissection may be incorrect", EXPFILL }},
4797
14
        { &ei_gsm_a_format_not_supported, { "gsm_a.format_not_supported", PI_PROTOCOL, PI_WARN, "Format not supported", EXPFILL }},
4798
14
        { &ei_gsm_a_mobile_identity_type, { "gsm_a.ie.mobileid.type.unknown", PI_PROTOCOL, PI_WARN, "Format unknown", EXPFILL }},
4799
14
        { &ei_gsm_a_ie_length_too_short, { "gsm_a.ie.length_too_short", PI_PROTOCOL, PI_ERROR, "IE length too short", EXPFILL }}
4800
14
    };
4801
4802
14
    expert_module_t* expert_a_common;
4803
4804
14
    static tap_param gsm_a_stat_params[] = {
4805
14
        { PARAM_FILTER, "filter", "Filter", NULL, true }
4806
14
    };
4807
4808
14
    static stat_tap_table_ui gsm_a_bssmap_stat_table = {
4809
14
        REGISTER_TELEPHONY_GROUP_GSM,
4810
14
        "A-Interface BSSMAP",
4811
14
        "gsm_a",
4812
14
        "gsm_a,bssmap",
4813
14
        gsm_a_bssmap_stat_init,
4814
14
        gsm_a_bssmap_stat_packet,
4815
14
        gsm_a_stat_reset,
4816
14
        gsm_a_stat_free_table_item,
4817
14
        NULL,
4818
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4819
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4820
14
        NULL,
4821
14
        0
4822
14
    };
4823
4824
14
    static stat_tap_table_ui gsm_a_dtap_mm_stat_table = {
4825
14
        REGISTER_TELEPHONY_GROUP_GSM,
4826
14
        "A-Interface DTAP Mobility Management",
4827
14
        "gsm_a",
4828
14
        "gsm_a,dtap_mm",
4829
14
        gsm_a_dtap_mm_stat_init,
4830
14
        gsm_a_dtap_mm_stat_packet,
4831
14
        gsm_a_stat_reset,
4832
14
        gsm_a_stat_free_table_item,
4833
14
        NULL,
4834
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4835
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4836
14
        NULL,
4837
14
        0
4838
14
    };
4839
4840
14
    static stat_tap_table_ui gsm_a_dtap_rr_stat_table = {
4841
14
        REGISTER_TELEPHONY_GROUP_GSM,
4842
14
        "A-Interface DTAP Radio Resource Management",
4843
14
        "gsm_a",
4844
14
        "gsm_a,dtap_rr",
4845
14
        gsm_a_dtap_rr_stat_init,
4846
14
        gsm_a_dtap_rr_stat_packet,
4847
14
        gsm_a_stat_reset,
4848
14
        gsm_a_stat_free_table_item,
4849
14
        NULL,
4850
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4851
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4852
14
        NULL,
4853
14
        0
4854
14
    };
4855
4856
14
    static stat_tap_table_ui gsm_a_dtap_cc_stat_table = {
4857
14
        REGISTER_TELEPHONY_GROUP_GSM,
4858
14
        "A-Interface DTAP Call Control",
4859
14
        "gsm_a",
4860
14
        "gsm_a,dtap_cc",
4861
14
        gsm_a_dtap_cc_stat_init,
4862
14
        gsm_a_dtap_cc_stat_packet,
4863
14
        gsm_a_stat_reset,
4864
14
        gsm_a_stat_free_table_item,
4865
14
        NULL,
4866
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4867
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4868
14
        NULL,
4869
14
        0
4870
14
    };
4871
4872
14
    static stat_tap_table_ui gsm_a_dtap_gmm_stat_table = {
4873
14
        REGISTER_TELEPHONY_GROUP_GSM,
4874
14
        "A-Interface DTAP GPRS Mobility Management",
4875
14
        "gsm_a",
4876
14
        "gsm_a,dtap_gmm",
4877
14
        gsm_a_dtap_gmm_stat_init,
4878
14
        gsm_a_dtap_gmm_stat_packet,
4879
14
        gsm_a_stat_reset,
4880
14
        gsm_a_stat_free_table_item,
4881
14
        NULL,
4882
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4883
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4884
14
        NULL,
4885
14
        0
4886
14
    };
4887
4888
14
    static stat_tap_table_ui gsm_a_dtap_sm_stat_table = {
4889
14
        REGISTER_TELEPHONY_GROUP_GSM,
4890
14
        "A-Interface DTAP GPRS Session Management",
4891
14
        "gsm_a",
4892
14
        "gsm_a,dtap_sm",
4893
14
        gsm_a_dtap_sm_stat_init,
4894
14
        gsm_a_dtap_sm_stat_packet,
4895
14
        gsm_a_stat_reset,
4896
14
        gsm_a_stat_free_table_item,
4897
14
        NULL,
4898
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4899
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4900
14
        NULL,
4901
14
        0
4902
14
    };
4903
4904
14
    static stat_tap_table_ui gsm_a_dtap_sms_stat_table = {
4905
14
        REGISTER_TELEPHONY_GROUP_GSM,
4906
14
        "A-Interface DTAP Short Message Service",
4907
14
        "gsm_a",
4908
14
        "gsm_a,dtap_sms",
4909
14
        gsm_a_dtap_sms_stat_init,
4910
14
        gsm_a_dtap_sms_stat_packet,
4911
14
        gsm_a_stat_reset,
4912
14
        gsm_a_stat_free_table_item,
4913
14
        NULL,
4914
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4915
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4916
14
        NULL,
4917
14
        0
4918
14
    };
4919
4920
14
    static stat_tap_table_ui gsm_a_dtap_tp_stat_table = {
4921
14
        REGISTER_TELEPHONY_GROUP_GSM,
4922
14
        "A-Interface DTAP Special Conformance Testing Functions",
4923
14
        "gsm_a",
4924
14
        "gsm_a,dtap_tp",
4925
14
        gsm_a_dtap_tp_stat_init,
4926
14
        gsm_a_dtap_tp_stat_packet,
4927
14
        gsm_a_stat_reset,
4928
14
        gsm_a_stat_free_table_item,
4929
14
        NULL,
4930
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4931
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4932
14
        NULL,
4933
14
        0
4934
14
    };
4935
4936
14
    static stat_tap_table_ui gsm_a_dtap_ss_stat_table = {
4937
14
        REGISTER_TELEPHONY_GROUP_GSM,
4938
14
        "A-Interface DTAP Supplementary Services",
4939
14
        "gsm_a",
4940
14
        "gsm_a,dtap_ss",
4941
14
        gsm_a_dtap_ss_stat_init,
4942
14
        gsm_a_dtap_ss_stat_packet,
4943
14
        gsm_a_stat_reset,
4944
14
        gsm_a_stat_free_table_item,
4945
14
        NULL,
4946
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4947
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4948
14
        NULL,
4949
14
        0
4950
14
    };
4951
4952
14
    static stat_tap_table_ui gsm_a_sacch_rr_stat_table = {
4953
14
        REGISTER_TELEPHONY_GROUP_GSM,
4954
14
        "A-Interface SACCH",
4955
14
        "gsm_a",
4956
14
        "gsm_a,dtap_sacch",
4957
14
        gsm_a_sacch_rr_stat_init,
4958
14
        gsm_a_sacch_rr_stat_packet,
4959
14
        gsm_a_stat_reset,
4960
14
        gsm_a_stat_free_table_item,
4961
14
        NULL,
4962
14
        array_length(gsm_a_stat_fields), gsm_a_stat_fields,
4963
14
        array_length(gsm_a_stat_params), gsm_a_stat_params,
4964
14
        NULL,
4965
14
        0
4966
14
    };
4967
4968
14
    last_offset = NUM_INDIVIDUAL_ELEMS;
4969
4970
14
    ett[0] = &ett_gsm_a_plmn;
4971
14
    ett[1] = &ett_gsm_a_poly_pnt;
4972
280
    for (i=0; i < NUM_GSM_COMMON_ELEM; i++, last_offset++)
4973
266
    {
4974
266
        ett[last_offset]       = &ett_gsm_common_elem[i];
4975
266
    }
4976
4977
    /* Register the protocol name and description */
4978
4979
14
    proto_a_common =
4980
14
    proto_register_protocol("GSM A-I/F COMMON", "GSM COMMON", "gsm_a");
4981
4982
14
    proto_register_field_array(proto_a_common, hf, array_length(hf));
4983
4984
14
    proto_register_subtree_array(ett, array_length(ett));
4985
14
    expert_a_common = expert_register_protocol(proto_a_common);
4986
14
    expert_register_field_array(expert_a_common, ei, array_length(ei));
4987
4988
4989
14
    gsm_a_tap = register_tap("gsm_a");
4990
4991
14
    register_stat_tap_table_ui(&gsm_a_bssmap_stat_table);
4992
14
    register_stat_tap_table_ui(&gsm_a_dtap_mm_stat_table);
4993
14
    register_stat_tap_table_ui(&gsm_a_dtap_rr_stat_table);
4994
14
    register_stat_tap_table_ui(&gsm_a_dtap_cc_stat_table);
4995
14
    register_stat_tap_table_ui(&gsm_a_dtap_gmm_stat_table);
4996
14
    register_stat_tap_table_ui(&gsm_a_dtap_sms_stat_table);
4997
14
    register_stat_tap_table_ui(&gsm_a_dtap_sm_stat_table);
4998
14
    register_stat_tap_table_ui(&gsm_a_dtap_ss_stat_table);
4999
14
    register_stat_tap_table_ui(&gsm_a_dtap_tp_stat_table);
5000
14
    register_stat_tap_table_ui(&gsm_a_sacch_rr_stat_table);
5001
5002
    /* Register a 3GPP protocol to be used for "global hf" that can be used to track inter protocol relations*/
5003
14
    static hf_register_info hf_3gpp[] =
5004
14
    {
5005
14
        { &hf_3gpp_tmsi,
5006
14
            { "TMSI/P-TMSI/M-TMSI/5G-TMSI", "3gpp.tmsi",
5007
14
            FT_UINT32, BASE_DEC_HEX, 0, 0x0,
5008
14
            "Filter TMSI, P-TMSI, M-TMSI, 5G-TMSI across protocols", HFILL }
5009
14
        },
5010
14
    };
5011
5012
14
    proto_3gpp = proto_register_protocol("3GPP COMMON", "3GPP COMMON", "3gpp");
5013
5014
14
    proto_register_field_array(proto_3gpp, hf_3gpp, array_length(hf_3gpp));
5015
5016
14
}
5017
5018
/*
5019
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
5020
 *
5021
 * Local variables:
5022
 * c-basic-offset: 4
5023
 * tab-width: 8
5024
 * indent-tabs-mode: nil
5025
 * End:
5026
 *
5027
 * vi: set shiftwidth=4 tabstop=8 expandtab:
5028
 * :indentSize=4:tabSize=8:noTabs=true:
5029
 */