179dd0880c2036b4714d71d43f800484ec6a8198
[metze/wireshark/wip.git] / epan / dissectors / packet-gsm_a_gm.c
1 /* packet-gsm_a_gm.c
2  * Routines for GSM A Interface GPRS Mobility Management and GPRS Session Management
3  *
4  * Copyright 2003, Michael Lum <mlum [AT] telostech.com>
5  * In association with Telos Technology Inc.
6  *
7  * Added the GPRS Mobility Management Protocol and
8  * the GPRS Session Management Protocol
9  *   Copyright 2004, Rene Pilz <rene.pilz [AT] ftw.com>
10  *   In association with Telecommunications Research Center
11  *   Vienna (ftw.)Betriebs-GmbH within the Project Metawin.
12  *
13  * Various updates, enhancements and fixes
14  * Copyright 2009, Gerasimos Dimitriadis <dimeg [AT] intracom.gr>
15  * In association with Intracom Telecom SA
16  *
17  * Title                3GPP                    Other
18  *
19  *   Reference [7]
20  *   Mobile radio interface Layer 3 specification;
21  *   Core network protocols;
22  *   Stage 3
23  *   (3GPP TS 24.008 version 5.9.0 Release 5)
24  *
25  *   Reference [8]
26  *   Mobile radio interface Layer 3 specification;
27  *   Core network protocols;
28  *   Stage 3
29  *   (3GPP TS 24.008 version 6.7.0 Release 6)
30  *       (3GPP TS 24.008 version 6.8.0 Release 6)
31  *
32  *   Reference [9]
33  *   Mobile radio interface Layer 3 specification;
34  *   Core network protocols;
35  *   Stage 3
36  *   (3GPP TS 24.008 version 9.6.0 Release 9)
37  *
38  *   Reference [10]
39  *   Mobile radio interface Layer 3 specification;
40  *   Core network protocols;
41  *   Stage 3
42  *   (3GPP TS 24.008 version 10.6.1 Release 10)
43  *
44  *   Reference [11]
45  *   Mobile radio interface Layer 3 specification;
46  *   Core network protocols;
47  *   Stage 3
48  *   (3GPP TS 24.008 version 11.7.0 Release 11)
49  *
50  *   Reference [12]
51  *   Mobile radio interface Layer 3 specification;
52  *   Core network protocols;
53  *   Stage 3
54  *   (3GPP TS 24.008 version 12.10.0 Release 12)
55  *
56  *   Reference [13]
57  *   Mobile radio interface Layer 3 specification;
58  *   Core network protocols;
59  *   Stage 3
60  *   (3GPP TS 24.008 version 13.8.0 Release 13)
61  *
62  *   Reference [14]
63  *   Mobile radio interface Layer 3 specification;
64  *   Core network protocols;
65  *   Stage 3
66  *   (3GPP TS 24.008 version 14.6.0 Release 14)
67  *
68  *   Reference [15]
69  *   Mobile radio interface Layer 3 specification;
70  *   Core network protocols;
71  *   Stage 3
72  *   (3GPP TS 24.008 version 15.2.0 Release 15)
73  *
74  * Wireshark - Network traffic analyzer
75  * By Gerald Combs <gerald@wireshark.org>
76  * Copyright 1998 Gerald Combs
77  *
78  * SPDX-License-Identifier: GPL-2.0-or-later
79  */
80
81 #include "config.h"
82
83
84 #include <epan/packet.h>
85 #include <epan/expert.h>
86 #include <epan/ipproto.h>
87 #include "packet-ber.h"
88 #include "packet-gsm_a_common.h"
89 #include "packet-e212.h"
90 #include "packet-ppp.h"
91 #include "packet-e164.h"
92
93 void proto_register_gsm_a_gm(void);
94 void proto_reg_handoff_gsm_a_gm(void);
95
96 /* PROTOTYPES/FORWARDS */
97
98 const value_string gsm_a_dtap_msg_gmm_strings[] = {
99         { 0x01, "Attach Request" },
100         { 0x02, "Attach Accept" },
101         { 0x03, "Attach Complete" },
102         { 0x04, "Attach Reject" },
103         { 0x05, "Detach Request" },
104         { 0x06, "Detach Accept" },
105         { 0x08, "Routing Area Update Request" },
106         { 0x09, "Routing Area Update Accept" },
107         { 0x0a, "Routing Area Update Complete" },
108         { 0x0b, "Routing Area Update Reject" },
109         { 0x0c, "Service Request" },
110         { 0x0d, "Service Accept" },
111         { 0x0e, "Service Reject" },
112         { 0x10, "P-TMSI Reallocation Command" },
113         { 0x11, "P-TMSI Reallocation Complete" },
114         { 0x12, "Authentication and Ciphering Req" },
115         { 0x13, "Authentication and Ciphering Resp" },
116         { 0x14, "Authentication and Ciphering Rej" },
117         { 0x15, "Identity Request" },
118         { 0x16, "Identity Response" },
119         { 0x1c, "Authentication and Ciphering Failure" },
120         { 0x20, "GMM Status" },
121         { 0x21, "GMM Information" },
122         { 0, NULL }
123 };
124 static value_string_ext gsm_a_dtap_msg_gmm_strings_ext = VALUE_STRING_EXT_INIT(gsm_a_dtap_msg_gmm_strings);
125
126
127 const value_string gsm_a_dtap_msg_sm_strings[] = {
128         { 0x41, "Activate PDP Context Request" },
129         { 0x42, "Activate PDP Context Accept" },
130         { 0x43, "Activate PDP Context Reject" },
131         { 0x44, "Request PDP Context Activation" },
132         { 0x45, "Request PDP Context Activation rej." },
133         { 0x46, "Deactivate PDP Context Request" },
134         { 0x47, "Deactivate PDP Context Accept" },
135         { 0x48, "Modify PDP Context Request(Network to MS direction)" },
136         { 0x49, "Modify PDP Context Accept (MS to network direction)" },
137         { 0x4a, "Modify PDP Context Request(MS to network direction)" },
138         { 0x4b, "Modify PDP Context Accept (Network to MS direction)" },
139         { 0x4c, "Modify PDP Context Reject" },
140         { 0x4d, "Activate Secondary PDP Context Request" },
141         { 0x4e, "Activate Secondary PDP Context Accept" },
142         { 0x4f, "Activate Secondary PDP Context Reject" },
143         { 0x50, "Reserved: was allocated in earlier phases of the protocol" },
144         { 0x51, "Reserved: was allocated in earlier phases of the protocol" },
145         { 0x52, "Reserved: was allocated in earlier phases of the protocol" },
146         { 0x53, "Reserved: was allocated in earlier phases of the protocol" },
147         { 0x54, "Reserved: was allocated in earlier phases of the protocol" },
148         { 0x55, "SM Status" },
149         { 0x56, "Activate MBMS Context Request" },
150         { 0x57, "Activate MBMS Context Accept" },
151         { 0x58, "Activate MBMS Context Reject" },
152         { 0x59, "Request MBMS Context Activation" },
153         { 0x5a, "Request MBMS Context Activation Reject" },
154         { 0x5b, "Request Secondary PDP Context Activation" },
155         { 0x5c, "Request Secondary PDP Context Activation Reject" },
156         { 0x5d, "Notification" },
157         { 0, NULL }
158 };
159 static value_string_ext gsm_a_dtap_msg_sm_strings_ext = VALUE_STRING_EXT_INIT(gsm_a_dtap_msg_sm_strings);
160
161
162 static const value_string gsm_gm_elem_strings[] = {
163         /* GPRS Mobility Management Information Elements 10.5.5 */
164         { DE_ADD_UPD_TYPE,               "Additional Update Type" },
165         { DE_ATTACH_RES,                 "Attach Result" },
166         { DE_ATTACH_TYPE,                "Attach Type" },
167         { DE_CIPH_ALG,                   "Ciphering Algorithm" },
168         { DE_INTEG_ALG,                  "Integrity Algorithm" },
169         { DE_TMSI_STAT,                  "TMSI Status" },
170         { DE_DETACH_TYPE,                "Detach Type" },
171         { DE_DRX_PARAM,                  "DRX Parameter" },
172         { DE_FORCE_TO_STAND,             "Force to Standby" },
173         { DE_FORCE_TO_STAND_H,           "Force to Standby" },
174         { DE_P_TMSI_SIG,                 "P-TMSI Signature" },
175         { DE_P_TMSI_SIG_2,               "P-TMSI Signature 2" },
176         { DE_ID_TYPE_2,                  "Identity Type 2" },
177         { DE_IMEISV_REQ,                 "IMEISV Request" },
178         { DE_REC_N_PDU_NUM_LIST,         "Receive N-PDU Numbers List" },
179         { DE_MS_NET_CAP,                 "MS Network Capability" },
180         { DE_MS_RAD_ACC_CAP,             "MS Radio Access Capability" },
181         { DE_GMM_CAUSE,                  "GMM Cause" },
182         { DE_RAI,                        "Routing Area Identification" },
183         { DE_RAI_2,                      "Routing Area Identification 2" },
184         { DE_UPD_RES,                    "Update Result" },
185         { DE_UPD_TYPE,                   "Update Type" },
186         { DE_AC_REF_NUM,                 "A&C Reference Number" },
187         { DE_AC_REF_NUM_H,               "A&C Reference Number" },
188         { DE_SRVC_TYPE,                  "Service Type" },
189         { DE_CELL_NOT,                   "Cell Notification" },
190         { DE_PS_LCS_CAP,                 "PS LCS Capability" },
191         { DE_NET_FEAT_SUP,               "Network Feature Support" },
192         { DE_ADD_NET_FEAT_SUP,           "Additional Network Feature Support" },
193         { DE_RAT_INFO_CONTAINER,         "Inter RAT Information Container" },
194         { DE_REQ_MS_INFO,                "Requested MS Information" },
195         { DE_UE_NETWORK_CAP,             "UE Network Capability" },
196         { DE_EUTRAN_IRAT_INFO_CONTAINER, "E-UTRAN Inter RAT Information Container" },
197         { DE_VOICE_DOMAIN_PREF,          "Voice Domain Preference and UE's Usage Setting" },
198         { DE_PTMSI_TYPE,                 "P-TMSI Type" },
199         { DE_LAI_2,                      "Location Area Identification 2" },
200         { DE_NET_RES_ID_CONT,            "Network Resource Identifier Container" },
201         { DE_EXT_DRX_PARAMS,             "Extended DRX Parameters" },
202         { DE_MAC,                        "Message Authentication Code" },
203         { DE_UP_INTEG_IND,               "User Plane Integrity Indicator" },
204         { DE_DCN_ID,                     "DCN-ID"},
205         { DE_PLMN_ID_CN_OPERATOR,        "PLMN identity of the CN operator"},
206         { DE_NON_3GPP_NW_PROV_POL,       "Non-3GPP NW provided policies"},
207         /* Session Management Information Elements 10.5.6 */
208         { DE_ACC_POINT_NAME,             "Access Point Name" },
209         { DE_NET_SAPI,                   "Network Service Access Point Identifier" },
210         { DE_PRO_CONF_OPT,               "Protocol Configuration Options" },
211         { DE_EXT_PRO_CONF_OPT,           "Extended Protocol Configuration Options" },
212         { DE_PD_PRO_ADDR,                "Packet Data Protocol Address" },
213         { DE_QOS,                        "Quality Of Service" },
214         { DE_RE_ATTEMPT_IND,             "Re-attempt Indicator" },
215         { DE_EXT_QOS,                    "Extended Quality Of Service" },
216         { DE_SM_CAUSE,                   "SM Cause" },
217         { DE_SM_CAUSE_2,                 "SM Cause 2" },
218         { DE_LINKED_TI,                  "Linked TI" },
219         { DE_LLC_SAPI,                   "LLC Service Access Point Identifier" },
220         { DE_TEAR_DOWN_IND,              "Tear Down Indicator" },
221         { DE_PACKET_FLOW_ID,             "Packet Flow Identifier" },
222         { DE_TRAFFIC_FLOW_TEMPLATE,      "Traffic Flow Template" },
223         { DE_TMGI,                       "Temporary Mobile Group Identity (TMGI)" },
224         { DE_MBMS_BEARER_CAP,            "MBMS bearer capabilities" },
225         { DE_MBMS_PROT_CONF_OPT,         "MBMS protocol configuration options" },
226         { DE_ENH_NSAPI,                  "Enhanced network service access point identifier" },
227         { DE_REQ_TYPE,                   "Request type" },
228         { DE_SM_NOTIF_IND,               "Notification indicator" },
229         { DE_SM_CONNECTIVITY_TYPE,       "Connectivity type" },
230         { DE_SM_WLAN_OFFLOAD_ACCEPT,     "WLAN offload acceptability" },
231         { DE_NBIFOM_CONT,                "NBIFOM container" },
232         /* GPRS Common Information Elements 10.5.7 */
233         { DE_PDP_CONTEXT_STAT,           "PDP Context Status" },
234         { DE_RAD_PRIO,                   "Radio Priority" },
235         { DE_GPRS_TIMER,                 "GPRS Timer" },
236         { DE_GPRS_TIMER_2,               "GPRS Timer 2" },
237         { DE_GPRS_TIMER_3,               "GPRS Timer 3" },
238         { DE_RAD_PRIO_2,                 "Radio Priority 2"},
239         { DE_MBMS_CTX_STATUS,            "MBMS context status"},
240         { DE_UPLINK_DATA_STATUS,         "Uplink data status"},
241         { DE_DEVICE_PROPERTIES,          "Device properties"},
242         { 0, NULL }
243 };
244 value_string_ext gsm_gm_elem_strings_ext = VALUE_STRING_EXT_INIT(gsm_gm_elem_strings);
245
246 #define DTAP_GMM_IEI_MASK       0xff
247 #define DTAP_SM_IEI_MASK        0xff
248
249 /* Initialize the protocol and registered fields */
250 static int proto_a_gm = -1;
251
252 static int hf_gsm_a_dtap_msg_gmm_type = -1;
253 static int hf_gsm_a_dtap_msg_sm_type = -1;
254 int hf_gsm_a_gm_elem_id = -1;
255 static int hf_gsm_a_sm_qos_delay_cls    = -1;
256 static int hf_gsm_a_sm_qos_reliability_cls = -1;
257 static int hf_gsm_a_sm_qos_traffic_cls = -1;
258 static int hf_gsm_a_sm_qos_del_order = -1;
259 static int hf_gsm_a_sm_qos_del_of_err_sdu = -1;
260 static int hf_gsm_a_sm_qos_ber = -1;
261 static int hf_gsm_a_sm_qos_sdu_err_rat = -1;
262 static int hf_gsm_a_sm_qos_traff_hdl_pri = -1;
263
264 static int hf_gsm_a_gmm_split_pg_cycle_code = -1;
265 static int hf_gsm_a_gmm_split_on_ccch = -1;
266 static int hf_gsm_a_gmm_non_drx_timer = -1;
267 static int hf_gsm_a_gmm_cn_spec_drx_cycle_len_coef = -1;
268
269 static int hf_gsm_a_gmm_ptmsi_sig =-1;
270 static int hf_gsm_a_gmm_ptmsi_sig2 =-1;
271
272 static int hf_gsm_a_sm_tft_op_code = -1;
273 static int hf_gsm_a_sm_tft_e_bit = -1;
274 static int hf_gsm_a_sm_tft_pkt_flt = -1;
275 static int hf_gsm_a_sm_tft_pkt_flt_id = -1;
276 static int hf_gsm_a_sm_tft_pkt_flt_dir = -1;
277 static int hf_gsm_a_sm_ip4_address = -1;
278 static int hf_gsm_a_sm_ip4_mask = -1;
279 static int hf_gsm_a_sm_ip6_address = -1;
280 static int hf_gsm_a_sm_ip6_mask = -1;
281 static int hf_gsm_a_sm_ip6_prefix_length = -1;
282 static int hf_gsm_a_sm_tft_protocol_header = -1;
283 static int hf_gsm_a_sm_tft_port = -1;
284 static int hf_gsm_a_sm_tft_port_low = -1;
285 static int hf_gsm_a_sm_tft_port_high = -1;
286 static int hf_gsm_a_sm_tft_security = -1;
287 static int hf_gsm_a_sm_tft_traffic_class = -1;
288 static int hf_gsm_a_sm_tft_traffic_mask = -1;
289 static int hf_gsm_a_sm_tft_flow_label_type = -1;
290 static int hf_gsm_a_sm_tft_param_id = -1;
291 static int hf_gsm_a_sm_tft_packet_filter = -1;
292 static int hf_gsm_a_sm_tft_packet_evaluation_precedence = -1;
293 static int hf_gsm_a_sm_tft_packet_filter_length = -1;
294 static int hf_gsm_a_sm_tft_authorization_token_value = -1;
295 static int hf_gsm_a_sm_tft_media_component_number_value = -1;
296 static int hf_gsm_a_sm_tft_ip_flow_number = -1;
297 static int hf_gsm_a_sm_tft_packet_filter_identifier = -1;
298 static int hf_gsm_a_sm_tft_parameter_content = -1;
299 static int hf_gsm_a_sm_tft_packet_filter_component_type_id = -1;
300 static int hf_gsm_a_gm_acc_tech_type = -1;
301 static int hf_gsm_a_gm_acc_cap_struct_len = -1;
302 static int hf_gsm_a_gm_sms_value = -1;
303 static int hf_gsm_a_gm_sm_value = -1;
304 static int hf_gsm_a_gm_link_dir = -1;
305 static int hf_gsm_a_gm_cause = -1;
306
307 static int hf_gsm_a_gm_add_upd_type = -1;
308 static int hf_gsm_a_gm_fop = -1;
309 static int hf_gsm_a_gm_res_of_attach = -1;
310 static int hf_gsm_a_gm_type_of_ciph_alg = -1;
311 static int hf_gsm_a_gm_type_of_integ_alg = -1;
312 static int hf_gsm_a_gm_imeisv_req = -1;
313 static int hf_gsm_a_gm_nsapi = -1;
314 static int hf_gsm_a_gm_ac_ref_nr = -1;
315 static int hf_gsm_a_gm_force_to_standby = -1;
316 static int hf_gsm_a_gm_serv_type = -1;
317 static int hf_gsm_a_gm_for = -1;
318 static int hf_gsm_a_gm_type_of_attach = -1;
319 static int hf_gsm_a_gm_tmsi_flag = -1;
320 static int hf_gsm_a_gm_power_off = -1;
321 static int hf_gsm_a_gm_type_of_detach_mo = -1;
322 static int hf_gsm_a_gm_type_of_detach_mt = -1;
323 static int hf_gsm_a_gm_update_type = -1;
324 static int hf_gsm_a_gm_gprs_timer = -1;
325 static int hf_gsm_a_gm_gprs_timer_unit = -1;
326 static int hf_gsm_a_gm_gprs_timer_value = -1;
327 static int hf_gsm_a_gm_gprs_timer2 = -1;
328 static int hf_gsm_a_gm_gprs_timer2_unit = -1;
329 static int hf_gsm_a_gm_gprs_timer2_value = -1;
330 static int hf_gsm_a_gm_gprs_timer3 = -1;
331 static int hf_gsm_a_gm_gprs_timer3_unit = -1;
332 static int hf_gsm_a_gm_gprs_timer3_value = -1;
333 static int hf_gsm_a_gm_nsapi_5_ul_stat = -1;
334 static int hf_gsm_a_gm_nsapi_6_ul_stat = -1;
335 static int hf_gsm_a_gm_nsapi_7_ul_stat = -1;
336 static int hf_gsm_a_gm_nsapi_8_ul_stat = -1;
337 static int hf_gsm_a_gm_nsapi_9_ul_stat = -1;
338 static int hf_gsm_a_gm_nsapi_10_ul_stat = -1;
339 static int hf_gsm_a_gm_nsapi_11_ul_stat = -1;
340 static int hf_gsm_a_gm_nsapi_12_ul_stat = -1;
341 static int hf_gsm_a_gm_nsapi_13_ul_stat = -1;
342 static int hf_gsm_a_gm_nsapi_14_ul_stat = -1;
343 static int hf_gsm_a_gm_nsapi_15_ul_stat = -1;
344 static int hf_gsm_a_gm_device_prop_low_prio = -1;
345 static int hf_gsm_a_gm_apn = -1;
346 static int hf_gsm_a_gm_pco_pid = -1;
347 static int hf_gsm_a_gm_pco_app_spec_info = -1;
348 static int hf_gsm_a_gm_type_of_identity = -1;
349 int hf_gsm_a_gm_rac = -1;
350 static int hf_gsm_a_gm_mta_e = -1;
351 static int hf_gsm_a_gm_mta_r = -1;
352 static int hf_gsm_a_gm_apc = -1;
353 static int hf_gsm_a_gm_otd_a = -1;
354 static int hf_gsm_a_gm_otd_b = -1;
355 static int hf_gsm_a_gm_gps_a = -1;
356 static int hf_gsm_a_gm_gps_b = -1;
357 static int hf_gsm_a_gm_gps_c = -1;
358 static int hf_gsm_a_gm_motd = -1;
359 static int hf_gsm_a_gm_mta_a = -1;
360 static int hf_gsm_a_gm_lcs_molr = -1;
361 static int hf_gsm_a_gm_mbms = -1;
362 static int hf_gsm_a_gm_ims_vops = -1;
363 static int hf_gsm_a_gm_emc_bs = -1;
364 static int hf_gsm_a_gm_epco = -1;
365 static int hf_gsm_a_gm_restrict_ec = -1;
366 static int hf_gsm_a_gm_gprs_sms = -1;
367 static int hf_gsm_a_gm_req_ms_info_irat = -1;
368 static int hf_gsm_a_gm_req_ms_info_irat2 = -1;
369 static int hf_gsm_a_gm_ue_usage_setting = -1;
370 static int hf_gsm_a_gm_voice_domain_pref_for_eutran = -1;
371 static int hf_gsm_a_gm_ptmsi_type = -1;
372 static int hf_gsm_a_gm_nri_cont = -1;
373 static int hf_gsm_a_gm_paging_time_window = -1;
374 static int hf_gsm_a_gm_edrx_value = -1;
375 static int hf_gsm_a_gm_mac = -1;
376 static int hf_gsm_a_gm_up_integ_ind = -1;
377 static int hf_gsm_a_gm_dcn_id = -1;
378 static int hf_gsm_a_gm_n3en_ind = -1;
379 static int hf_gsm_a_sm_pdp_type_org = -1;
380 static int hf_gsm_a_sm_qos_mean_thr = -1;
381 static int hf_gsm_a_sm_qos_peak_thr = -1;
382 static int hf_gsm_a_sm_qos_prec_class = -1;
383 static int hf_gsm_a_sm_qos_trans_delay = -1;
384 static int hf_gsm_a_sm_qos_signalling_ind = -1;
385 static int hf_gsm_a_sm_qos_source_stat_desc = -1;
386 static int hf_gsm_a_sm_qos_max_bitrate_upl = -1;
387 static int hf_gsm_a_sm_qos_max_bitrate_downl = -1;
388 static int hf_gsm_a_sm_qos_guar_bitrate_upl = -1;
389 static int hf_gsm_a_sm_qos_guar_bitrate_downl = -1;
390 static int hf_gsm_a_sm_qos_max_bitrate_upl_ext = -1;
391 static int hf_gsm_a_sm_qos_max_bitrate_downl_ext = -1;
392 static int hf_gsm_a_sm_qos_guar_bitrate_upl_ext = -1;
393 static int hf_gsm_a_sm_qos_guar_bitrate_downl_ext = -1;
394 static int hf_gsm_a_sm_qos_max_bitrate_upl_ext2 = -1;
395 static int hf_gsm_a_sm_qos_max_bitrate_downl_ext2 = -1;
396 static int hf_gsm_a_sm_qos_guar_bitrate_upl_ext2 = -1;
397 static int hf_gsm_a_sm_qos_guar_bitrate_downl_ext2 = -1;
398 static int hf_gsm_a_sm_qos_maximum_sdu_size = -1;
399 static int hf_gsm_a_sm_eplmnc = -1;
400 static int hf_gsm_a_sm_ratc = -1;
401 static int hf_gsm_a_sm_cause = -1;
402 static int hf_gsm_a_sm_cause_2 = -1;
403 static int hf_gsm_a_sm_llc_sapi = -1;
404 static int hf_gsm_a_sm_tdi = -1;
405 static int hf_gsm_a_sm_packet_flow_id = -1;
406 static int hf_gsm_a_sm_tmgi = -1;
407 static int hf_gsm_a_sm_enh_nsapi = -1;
408 static int hf_gsm_a_sm_req_type = -1;
409 static int hf_gsm_a_sm_notif_ind = -1;
410 static int hf_gsm_a_sm_connectivity_type = -1;
411 static int hf_gsm_a_sm_wlan_utran_offload_accept = -1;
412 static int hf_gsm_a_sm_wlan_eutran_offload_accept = -1;
413 static int hf_gsm_a_sm_nbifom_cont = -1;
414 static int hf_gsm_a_gm_rac_ctrled_early_cm_sending = -1;
415 static int hf_gsm_a_gm_rac_pseudo_sync = -1;
416 static int hf_gsm_a_gm_rac_vgcs = -1;
417 static int hf_gsm_a_gm_rac_vbs = -1;
418 static int hf_gsm_a_gm_rac_multislot_capability = -1;
419 static int hf_gsm_a_gm_rac_hscsd_multi_slot_class = -1;
420 static int hf_gsm_a_gm_rac_gprs_multi_slot_class = -1;
421 static int hf_gsm_a_gm_rac_gprs_ext_dyn_alloc_cap = -1;
422 static int hf_gsm_a_gm_rac_ecsd_multi_slot_class = -1;
423 static int hf_gsm_a_gm_rac_egprs_multi_slot_class = -1;
424 static int hf_gsm_a_gm_rac_egprs_ext_dyn_alloc_cap = -1;
425 static int hf_gsm_a_gm_rac_dtm_gprs_multi_slot_class = -1;
426 static int hf_gsm_a_gm_rac_single_slt_dtm = -1;
427 static int hf_gsm_a_gm_rac_dtm_egprs_multi_slot_cls_pres = -1;
428 static int hf_gsm_a_gm_rac_dtm_egprs_multi_slot_class = -1;
429 static int hf_gsm_a_gm_rac_8psk_pow_cap_pres = -1;
430 static int hf_gsm_a_gm_rac_comp_int_meas_cap = -1;
431 static int hf_gsm_a_gm_rel_lev_ind = -1;
432 static int hf_gsm_a_gm_rac_geran_feat_pkg = -1;
433 static int hf_gsm_a_gm_rac_umts_fdd_cap = -1;
434 static int hf_gsm_a_gm_rac_umts_384_tdd_ra_cap = -1;
435 static int hf_gsm_a_gm_rac_cdma2000_cap = -1;
436 static int hf_gsm_a_gm_rac_umts_128_tdd_ra_cap = -1;
437 static int hf_gsm_a_gm_rac_mod_based_multi_slot_class_support = -1;
438 static int hf_gsm_a_gm_rac_geran_iu_mode_cap = -1;
439 static int hf_gsm_a_gm_rac_flo_iu_cap = -1;
440 static int hf_gsm_a_gm_rac_mult_tbf_cap = -1;
441 static int hf_gsm_a_gm_rac_down_adv_rec_perf = -1;
442 static int hf_gsm_a_gm_rac_ext_rlc_mac_ctrl_msg_seg_cap = -1;
443 static int hf_gsm_a_gm_rac_dtm_enh_cap = -1;
444 static int hf_gsm_a_gm_rac_dtm_gprs_high_multi_slot_class = -1;
445 static int hf_gsm_a_gm_rac_dtm_egprs_high_multi_slot_class = -1;
446 static int hf_gsm_a_gm_rac_ps_ho_cap = -1;
447 static int hf_gsm_a_gm_rac_dtm_ho_cap = -1;
448 static int hf_gsm_a_gm_rac_multi_slot_cap_red_down_dual_carrier = -1;
449 static int hf_gsm_a_gm_rac_down_dual_carrier_dtm_cap = -1;
450 static int hf_gsm_a_gm_rac_flex_ts_assign = -1;
451 static int hf_gsm_a_gm_rac_gan_ps_ho_cap = -1;
452 static int hf_gsm_a_gm_rac_rlc_non_pers_mode = -1;
453 static int hf_gsm_a_gm_rac_reduced_lat_cap = -1;
454 static int hf_gsm_a_gm_rac_ul_egprs2 = -1;
455 static int hf_gsm_a_gm_rac_dl_egprs2 = -1;
456 static int hf_gsm_a_gm_rac_eutra_fdd_support = -1;
457 static int hf_gsm_a_gm_rac_eutra_tdd_support = -1;
458 static int hf_gsm_a_gm_rac_geran_to_eutra_support_in_geran_ptm = -1;
459 static int hf_gsm_a_gm_rac_prio_based_resel_support = -1;
460 static int hf_gsm_a_gm_rac_alt_efta_multi_slot_class = -1;
461 static int hf_gsm_a_gm_rac_efta_multi_slot_cap_red_down_dual_carrier = -1;
462 static int hf_gsm_a_gm_rac_ind_up_layer_pdu_start_cap_for_rlc_um = -1;
463 static int hf_gsm_a_gm_rac_emst_cap = -1;
464 static int hf_gsm_a_gm_rac_mtti_cap = -1;
465 static int hf_gsm_a_gm_rac_utra_csg_cell_report = -1;
466 static int hf_gsm_a_gm_rac_eutra_csg_cell_report = -1;
467 static int hf_gsm_a_gm_rac_dtr_cap = -1;
468 static int hf_gsm_a_gm_rac_emsr_cap = -1;
469 static int hf_gsm_a_gm_rac_fast_down_freq_switch_cap = -1;
470 static int hf_gsm_a_gm_rac_tighter_cap = -1;
471 static int hf_gsm_a_gm_rac_fanr_cap = -1;
472 static int hf_gsm_a_gm_rac_ipa_cap = -1;
473 static int hf_gsm_a_gm_rac_geran_nw_sharing_support = -1;
474 static int hf_gsm_a_gm_rac_eutra_wb_rsrq_support = -1;
475 static int hf_gsm_a_gm_rac_utra_mfbi_support = -1;
476 static int hf_gsm_a_gm_rac_eutra_mfbi_support = -1;
477 static int hf_gsm_a_gm_rac_dlmc_non_contig_intra_band_recep = -1;
478 static int hf_gsm_a_gm_rac_dlmc_inter_band_recep = -1;
479 static int hf_gsm_a_gm_rac_dlmc_max_bandwidth = -1;
480 static int hf_gsm_a_gm_rac_dlmc_max_nb_dl_ts = -1;
481 static int hf_gsm_a_gm_rac_dlmc_max_nb_dl_carriers = -1;
482 static int hf_gsm_a_gm_rac_ext_tsc_set_cap_support = -1;
483 static int hf_gsm_a_gm_rac_ext_earfcn_value_range = -1;
484 static int hf_gsm_a_gm_rac_ec_pch_mon_support = -1;
485 static int hf_gsm_a_gm_rac_ms_sync_accuracy = -1;
486 static int hf_gsm_a_gm_rac_ext_ec_ul_cov_enh_support = -1;
487 static int hf_gsm_a_sm_ti_flag = -1;
488 static int hf_gsm_a_sm_ext = -1;
489
490 static int hf_gsm_a_gmm_net_cap_gea1 = -1;
491 static int hf_gsm_a_gmm_net_cap_smdch = -1;
492 static int hf_gsm_a_gmm_net_cap_smgprs = -1;
493 static int hf_gsm_a_gmm_net_cap_ucs2 = -1;
494 static int hf_gsm_a_gmm_net_cap_ss_scr_ind = -1;
495 static int hf_gsm_a_gmm_net_cap_solsa = -1;
496 static int hf_gsm_a_gmm_net_cap_rev = -1;
497 static int hf_gsm_a_gmm_net_cap_pfc = -1;
498 static int hf_gsm_a_gmm_net_cap_ext_gea_bits = -1;
499 static int hf_gsm_a_gmm_net_cap_gea2 = -1;
500 static int hf_gsm_a_gmm_net_cap_gea3 = -1;
501 static int hf_gsm_a_gmm_net_cap_gea4 = -1;
502 static int hf_gsm_a_gmm_net_cap_gea5 = -1;
503 static int hf_gsm_a_gmm_net_cap_gea6 = -1;
504 static int hf_gsm_a_gmm_net_cap_gea7 = -1;
505 static int hf_gsm_a_gmm_net_cap_lcs = -1;
506 static int hf_gsm_a_gmm_net_cap_ps_irat_iu = -1;
507 static int hf_gsm_a_gmm_net_cap_ps_irat_s1 = -1;
508 static int hf_gsm_a_gmm_net_cap_comb_proc = -1;
509 static int hf_gsm_a_gmm_net_cap_isr = -1;
510 static int hf_gsm_a_gmm_net_cap_srvcc_to_geran = -1;
511 static int hf_gsm_a_gmm_net_cap_epc = -1;
512 static int hf_gsm_a_gmm_net_cap_nf = -1;
513 static int hf_gsm_a_gmm_net_geran_net_sharing = -1;
514 static int hf_gsm_a_gmm_net_cap_up_int_prot = -1;
515 static int hf_gsm_a_gmm_net_cap_up_gia4 = -1;
516 static int hf_gsm_a_gmm_net_cap_up_gia5 = -1;
517 static int hf_gsm_a_gmm_net_cap_up_gia6 = -1;
518 static int hf_gsm_a_gmm_net_cap_up_gia7 = -1;
519 static int hf_gsm_a_gmm_net_cap_epco_ie_ind = -1;
520 static int hf_gsm_a_gmm_net_cap_restrict_use_enh_cov = -1;
521 static int hf_gsm_a_gmm_net_cap_dc_eutra_nr_cap = -1;
522
523 /* Generated from convert_proto_tree_add_text.pl */
524 static int hf_gsm_a_gm_presence = -1;
525 static int hf_gsm_a_gm_8psk_power_class = -1;
526 static int hf_gsm_a_gm_rf_power_capability = -1;
527 static int hf_gsm_a_gm_a5_bits = -1;
528 static int hf_gsm_a_gm_8psk_power_capability = -1;
529 static int hf_gsm_a_gm_extended_dtm_gprs_multi_slot_class = -1;
530 static int hf_gsm_a_gm_extended_dtm_egprs_multi_slot_class = -1;
531 static int hf_gsm_a_gm_high_multislot_capability = -1;
532 static int hf_gsm_a_gm_gmsk_multislot_power_profile = -1;
533 static int hf_gsm_a_gm_8psk_multislot_power_profile = -1;
534 static int hf_gsm_a_gm_update_result = -1;
535 static int hf_gsm_a_gm_radio_priority_pdp = -1;
536 static int hf_gsm_a_gm_radio_priority_tom8 = -1;
537 static int hf_gsm_a_gm_configuration_protocol = -1;
538 static int hf_gsm_a_gm_sm_pco_length = -1;
539 static int hf_gsm_a_gm_sm_pco_pcscf_ipv6 = -1;
540 static int hf_gsm_a_gm_sm_pco_dns_ipv6 = -1;
541 static int hf_gsm_a_gm_sm_pco_dsmipv6_home_agent_ipv6 = -1;
542 static int hf_gsm_a_gm_sm_pco_dsmipv6_home_network_ipv6 = -1;
543 static int hf_gsm_a_gm_sm_pco_reject_code = -1;
544 static int hf_gsm_a_gm_sm_pco_dsmipv6_home_network_prefix_length = -1;
545 static int hf_gsm_a_gm_sm_pco_dsmipv6_home_agent_ipv4 = -1;
546 static int hf_gsm_a_gm_sm_pco_pcscf_ipv4 = -1;
547 static int hf_gsm_a_gm_sm_pco_dns_ipv4 = -1;
548 static int hf_gsm_a_gm_sm_pco_ipv4_link_mtu_size = -1;
549 static int hf_gsm_a_gm_sm_pco_nbifom_mode = -1;
550 static int hf_gsm_a_gm_sm_pco_non_ip_link_mtu_size = -1;
551 static int hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_aer = -1;
552 static int hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_ul_time_unit = -1;
553 static int hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_max_ul_rate = -1;
554 static int hf_gsm_a_gm_sm_pco_3gpp_data_off_ue_status = -1;
555 static int hf_gsm_a_gm_sm_pco_sel_bearer_ctrl_mode = -1;
556 static int hf_gsm_a_gm_sm_pco_add_apn_rate_ctrl_params_ul_time_unit = -1;
557 static int hf_gsm_a_gm_sm_pco_add_apn_rate_ctrl_params_max_ul_rate = -1;
558 static int hf_gsm_a_gm_sm_pco_pdu_session_id = -1;
559 static int hf_gsm_a_gm_sm_pco_pdu_session_address_lifetime = -1;
560 static int hf_gsm_a_sm_pdp_type_number = -1;
561 static int hf_gsm_a_sm_pdp_address = -1;
562 static int hf_gsm_a_gm_ti_value = -1;
563
564 /* Initialize the subtree pointers */
565 static gint ett_gmm_radio_cap = -1;
566 static gint ett_gmm_network_cap = -1;
567 static gint ett_gsm_a_gm_msrac_multislot_capability = -1;
568 static gint ett_gmm_rai = -1;
569 static gint ett_gmm_gprs_timer = -1;
570
571 static gint ett_sm_tft = -1;
572 static gint ett_sm_pco = -1;
573
574 static expert_field ei_gsm_a_gm_extraneous_data = EI_INIT;
575 static expert_field ei_gsm_a_gm_not_enough_data = EI_INIT;
576 static expert_field ei_gsm_a_gm_undecoded = EI_INIT;
577 static expert_field ei_gsm_a_gm_apn_too_long = EI_INIT;
578 static expert_field ei_gsm_a_gm_missing_mandatory_element = EI_INIT;
579
580 static dissector_handle_t rrc_irat_ho_info_handle;
581 static dissector_handle_t lte_rrc_ue_eutra_cap_handle;
582 static dissector_handle_t nbifom_handle;
583
584 static dissector_table_t gprs_sm_pco_subdissector_table; /* GPRS SM PCO PPP Protocols */
585
586 static const unit_name_string units_message_messages = { " message", " messages" };
587
588 #define NUM_GSM_GM_ELEM (sizeof(gsm_gm_elem_strings)/sizeof(value_string))
589 gint ett_gsm_gm_elem[NUM_GSM_GM_ELEM];
590
591 static const gchar *pdp_str[2]={ "PDP-INACTIVE", "PDP-ACTIVE" };
592
593 /*
594  * [9] 10.5.5.0 Additional Update Type
595  */
596 static const true_false_string gsm_a_gm_add_upd_type_value = {
597         "SMS only",
598         "No additional information (shall be interpreted as request for combined attach or combined tracking area updating)"
599 };
600 static guint16
601 de_gmm_add_upd_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
602 {
603         guint32 curr_offset, bit_offset;
604
605         curr_offset = offset;
606         bit_offset  = (curr_offset<<3)+4;
607
608         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
609         bit_offset += 3;
610         proto_tree_add_bits_item(tree, hf_gsm_a_gm_add_upd_type, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
611         curr_offset++;
612
613         return (curr_offset - offset);
614 }
615
616  /*
617  * [9] 10.5.5.1 Attach result
618  */
619 static const value_string gsm_a_gm_res_of_attach_vals[] = {
620         { 0x01, "GPRS only attached" },
621         { 0x03, "Combined GPRS/IMSI attached" },
622         { 0, NULL }
623 };
624
625 static guint16
626 de_gmm_attach_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
627 {
628         proto_tree_add_item(tree, hf_gsm_a_gm_fop, tvb, offset, 1, ENC_BIG_ENDIAN);
629         proto_tree_add_item(tree, hf_gsm_a_gm_res_of_attach, tvb, offset, 1, ENC_BIG_ENDIAN);
630
631         /* no length check possible */
632         return (1);
633 }
634
635 /*
636  * [9] 10.5.5.2 Attach type
637  */
638 static const value_string gsm_a_gm_type_of_attach_vals[] = {
639         { 0x01, "GPRS attach" },
640         { 0x02, "Not used (In earlier versions: GPRS attach while IMSI attached)" },
641         { 0x03, "Combined GPRS/IMSI attached" },
642         { 0, NULL }
643 };
644
645 static guint16
646 de_gmm_attach_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
647 {
648         proto_tree_add_item(tree, hf_gsm_a_gm_for, tvb, offset, 1, ENC_BIG_ENDIAN);
649         proto_tree_add_item(tree, hf_gsm_a_gm_type_of_attach, tvb, offset, 1, ENC_BIG_ENDIAN);
650
651         /* no length check possible */
652         return (1);
653 }
654
655 /*
656  * [9] 10.5.5.3 Ciphering algorithm
657  */
658 const value_string gsm_a_gm_type_of_ciph_alg_vals[] = {
659         { 0x00, "ciphering not used" },
660         { 0x01, "GPRS Encryption Algorithm GEA/1" },
661         { 0x02, "GPRS Encryption Algorithm GEA/2" },
662         { 0x03, "GPRS Encryption Algorithm GEA/3" },
663         { 0x04, "GPRS Encryption Algorithm GEA/4" },
664         { 0x05, "GPRS Encryption Algorithm GEA/5" },
665         { 0x06, "GPRS Encryption Algorithm GEA/6" },
666         { 0x07, "GPRS Encryption Algorithm GEA/7" },
667         { 0, NULL }
668 };
669
670 static guint16
671 de_gmm_ciph_alg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
672 {
673         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 1, ENC_BIG_ENDIAN);
674         proto_tree_add_item(tree, hf_gsm_a_gm_type_of_ciph_alg, tvb, offset, 1, ENC_BIG_ENDIAN);
675
676         /* no length check possible */
677         return (1);
678 }
679
680 /*
681  * [13] 10.5.5.3a Integrity protection algorithm
682  */
683 const value_string gsm_a_gm_type_of_integ_alg_vals[] = {
684         { 0x00, "GPRS Integrity Algorithm GIA/4" },
685         { 0x01, "GPRS Integrity Algorithm GIA/5" },
686         { 0x02, "GPRS Integrity Algorithm GIA/6" },
687         { 0x03, "GPRS Integrity Algorithm GIA/7" },
688         { 0, NULL }
689 };
690
691 static guint16
692 de_gmm_integ_alg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
693 {
694         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 1, ENC_BIG_ENDIAN);
695         proto_tree_add_item(tree, hf_gsm_a_gm_type_of_integ_alg, tvb, offset, 1, ENC_BIG_ENDIAN);
696
697         /* no length check possible */
698         return (1);
699 }
700
701 /*
702  * [9] 10.5.5.4 TMSI status
703  */
704 const true_false_string gsm_a_gm_tmsi_flag_value = {
705         "valid TMSI available",
706         "no valid TMSI available"
707 };
708
709 static guint16
710 de_gmm_tmsi_stat(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
711 {
712         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 3, ENC_BIG_ENDIAN);
713         proto_tree_add_item(tree, hf_gsm_a_gm_tmsi_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
714
715         /* no length check possible */
716         return (1);
717 }
718
719 /*
720  * [7] 10.5.5.5
721  */
722 const true_false_string gsm_a_gm_power_off_value = {
723         "power switched off",
724         "normal detach"
725 };
726
727 const value_string gsm_a_gm_type_of_detach_mo_vals[] = {
728         { 0x01, "GPRS detach" },
729         { 0x02, "IMSI detach" },
730         { 0x03, "Combined GPRS/IMSI detach" },
731         { 0, NULL }
732 };
733
734 const value_string gsm_a_gm_type_of_detach_mt_vals[] = {
735         { 0x01, "re-attach required" },
736         { 0x02, "re-attach not required" },
737         { 0x03, "IMSI detach (after VLR failure)" },
738         { 0, NULL }
739 };
740
741 static guint16
742 de_gmm_detach_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
743 {
744         guint32 curr_offset;
745
746         curr_offset = offset;
747
748         if (pinfo->p2p_dir == P2P_DIR_RECV) {
749                 proto_tree_add_item(tree, hf_gsm_a_gm_power_off, tvb, offset, 1, ENC_BIG_ENDIAN);
750                 proto_tree_add_item(tree, hf_gsm_a_gm_type_of_detach_mo, tvb, offset, 1, ENC_BIG_ENDIAN);
751         } else {
752                 proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 1, ENC_BIG_ENDIAN);
753                 proto_tree_add_item(tree, hf_gsm_a_gm_type_of_detach_mt, tvb, offset, 1, ENC_BIG_ENDIAN);
754         }
755
756         curr_offset++;
757
758         /* no length check possible */
759
760         return (curr_offset - offset);
761 }
762
763 /*
764  * [7] 10.5.5.6
765  */
766
767 /* SPLIT PG CYCLE CODE, octet 2 */
768 static const value_string gsm_a_gmm_split_pg_cycle_code_strings[] = {
769         {  0, "704 (equivalent to no DRX)" },
770         {  1, "1" },
771         {  2, "2" },
772         {  3, "3" },
773         {  4, "4" },
774         {  5, "5" },
775         {  6, "6" },
776         {  7, "7" },
777         {  8, "8" },
778         {  9, "9" },
779         { 10, "10" },
780         { 11, "11" },
781         { 12, "12" },
782         { 13, "13" },
783         { 14, "14" },
784         { 15, "15" },
785         { 16, "16" },
786         { 17, "17" },
787         { 18, "18" },
788         { 19, "19" },
789         { 20, "20" },
790         { 21, "21" },
791         { 22, "22" },
792         { 23, "23" },
793         { 24, "24" },
794         { 25, "25" },
795         { 26, "26" },
796         { 27, "27" },
797         { 28, "28" },
798         { 29, "29" },
799         { 30, "30" },
800         { 31, "31" },
801         { 32, "32" },
802         { 33, "33" },
803         { 34, "34" },
804         { 35, "35" },
805         { 36, "36" },
806         { 37, "37" },
807         { 38, "38" },
808         { 39, "39" },
809         { 40, "40" },
810         { 41, "41" },
811         { 42, "42" },
812         { 43, "43" },
813         { 44, "44" },
814         { 45, "45" },
815         { 46, "46" },
816         { 47, "47" },
817         { 48, "48" },
818         { 49, "49" },
819         { 50, "50" },
820         { 51, "51" },
821         { 52, "52" },
822         { 53, "53" },
823         { 54, "54" },
824         { 55, "55" },
825         { 56, "56" },
826         { 57, "57" },
827         { 58, "58" },
828         { 59, "59" },
829         { 60, "60" },
830         { 61, "61" },
831         { 62, "62" },
832         { 63, "63" },
833         { 64, "64" },
834         { 65, "71" },
835         { 66, "72" },
836         { 67, "74" },
837         { 68, "75" },
838         { 69, "77" },
839         { 70, "79" },
840         { 71, "80" },
841         { 72, "83" },
842         { 73, "86" },
843         { 74, "88" },
844         { 75, "90" },
845         { 76, "92" },
846         { 77, "96" },
847         { 78, "101" },
848         { 79, "103" },
849         { 80, "107" },
850         { 81, "112" },
851         { 82, "116" },
852         { 83, "118" },
853         { 84, "128" },
854         { 85, "141" },
855         { 86, "144" },
856         { 87, "150" },
857         { 88, "160" },
858         { 89, "171" },
859         { 90, "176" },
860         { 91, "192" },
861         { 92, "214" },
862         { 93, "224" },
863         { 94, "235" },
864         { 95, "256" },
865         { 96, "288" },
866         { 97, "320" },
867         { 98, "352" },
868         { 0, NULL }
869 };
870 static value_string_ext gsm_a_gmm_split_pg_cycle_code_strings_ext = VALUE_STRING_EXT_INIT(gsm_a_gmm_split_pg_cycle_code_strings);
871
872 /* SPLIT on CCCH, octet 3 (bit 4)
873  * 0 Split pg cycle on CCCH is not supported by the mobile station
874  * 1 Split pg cycle on CCCH is supported by the mobile station
875  */
876 static const true_false_string gsm_a_gmm_split_on_ccch_value = {
877         "Split pg cycle on CCCH is supported by the mobile station",
878         "Split pg cycle on CCCH is not supported by the mobile station"
879 };
880
881 /* non-DRX timer, octet 3
882  * bit
883  * 3 2 1
884  */
885 static const value_string gsm_a_gmm_non_drx_timer_strings[] = {
886         { 0x00, "no non-DRX mode after transfer state" },
887         { 0x01, "max. 1 sec non-DRX mode after transfer state" },
888         { 0x02, "max. 2 sec non-DRX mode after transfer state" },
889         { 0x03, "max. 4 sec non-DRX mode after transfer state" },
890         { 0x04, "max. 8 sec non-DRX mode after transfer state" },
891         { 0x05, "max. 16 sec non-DRX mode after transfer state" },
892         { 0x06, "max. 32 sec non-DRX mode after transfer state" },
893         { 0x07, "max. 64 sec non-DRX mode after transfer state" },
894         { 0, NULL },
895 };
896 /*
897  * CN Specific DRX cycle length coefficient, octet 3
898  * bit
899  * 8 7 6 5 Iu and S1 mode specific
900  * 0 0 0 0 For Iu mode, CN Specific DRX cycle length coefficient not specified by the MS, ie. the
901  * system information value 'CN domain specific DRX cycle length' is used.
902  * For S1 mode, DRX value not specified by the MS.
903  * (Ref 3GPP TS 25.331 and 36.304)
904  * 0 1 1 0 CN Specific DRX cycle length coefficient 6 and T = 32
905  * 0 1 1 1 CN Specific DRX cycle length coefficient 7 and T = 64
906  * 1 0 0 0 CN Specific DRX cycle length coefficient 8 and T = 128
907  * 1 0 0 1 CN Specific DRX cycle length coefficient 9 and T = 256
908  * All other values shall be interpreted as "CN Specific DRX cycle length coefficient not
909  * specified by the MS" and "DRX value not specified by the MS" by this version of the protocol.
910  * NOTE: For Iu mode and S1 mode, this field (octet 3 bits 8 to 5) is used, but was spare in earlier
911  * versions of this protocol.
912  */
913 static const range_string gsm_a_gmm_cn_spec_drx_cycle_len_coef_strings[] = {
914         { 0x00, 0x05, "CN Specific DRX cycle length coefficient / value not specified by the MS" },
915         { 0x06, 0x06, "CN Specific DRX cycle length coefficient 6 and T = 32" },
916         { 0x07, 0x07, "CN Specific DRX cycle length coefficient 7 and T = 64" },
917         { 0x08, 0x08, "CN Specific DRX cycle length coefficient 8 and T = 128" },
918         { 0x09, 0x09, "CN Specific DRX cycle length coefficient 9 and T = 256" },
919         { 0x0a, 0x0f, "CN Specific DRX cycle length coefficient / value not specified by the MS" },
920         { 0, 0, NULL },
921 };
922 guint16
923 de_gmm_drx_param(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
924 {
925         guint32 curr_offset;
926
927         curr_offset = offset;
928
929         proto_tree_add_item(tree, hf_gsm_a_gmm_split_pg_cycle_code, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
930         curr_offset++;
931         proto_tree_add_item(tree, hf_gsm_a_gmm_cn_spec_drx_cycle_len_coef, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
932         proto_tree_add_item(tree, hf_gsm_a_gmm_split_on_ccch, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
933         proto_tree_add_item(tree, hf_gsm_a_gmm_non_drx_timer, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
934
935         curr_offset++;
936
937         /* no length check possible */
938
939         return (curr_offset - offset);
940 }
941
942 /*
943  * [9] 10.5.5.7 Force to standby (lower nibble)
944  */
945 static const range_string gsm_a_gm_force_to_standby_vals[] = {
946         { 0x00, 0x00, "Force to standby not indicated" },
947         { 0x01, 0x01, "Force to standby indicated" },
948         { 0x02, 0x07, "Unknown, interpreted as Force to standby not indicated" },
949         { 0, 0, NULL }
950 };
951
952 static guint16
953 de_gmm_ftostby(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
954 {
955         guint32 bit_offset;
956
957         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE LOWER NIBBLE */
958         bit_offset = (offset << 3) + 4;
959         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
960         proto_tree_add_bits_item(tree, hf_gsm_a_gm_force_to_standby, tvb, bit_offset + 1, 3, ENC_BIG_ENDIAN);
961
962         /* no length check possible */
963         return (1);
964 }
965
966 /*
967  * [9] 10.5.5.7 Force to standby (higher nibble)
968  */
969 static guint16
970 de_gmm_ftostby_h(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
971 {
972         guint32 bit_offset;
973
974         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
975         bit_offset = offset << 3;
976         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
977         proto_tree_add_bits_item(tree, hf_gsm_a_gm_force_to_standby, tvb, bit_offset + 1, 3, ENC_BIG_ENDIAN);
978
979         /* no length check possible */
980         return (1);
981 }
982
983 /*
984  * [7] 10.5.5.8
985  */
986 static guint16
987 de_gmm_ptmsi_sig(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
988 {
989         guint32     curr_offset;
990         proto_item *curr_item;
991
992         curr_offset = offset;
993
994         curr_item= proto_tree_add_item(tree, hf_gsm_a_gmm_ptmsi_sig, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
995         proto_item_append_text(curr_item, "%s", add_string ? add_string : "");
996
997         curr_offset += 3;
998
999         /* no length check possible */
1000
1001         return (curr_offset - offset);
1002 }
1003
1004 /*
1005  * [7] 10.5.5.8a
1006  */
1007 static guint16
1008 de_gmm_ptmsi_sig2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len _U_)
1009 {
1010         guint32     curr_offset;
1011         proto_item *curr_item;
1012
1013         curr_offset = offset;
1014
1015         curr_item= proto_tree_add_item(tree, hf_gsm_a_gmm_ptmsi_sig2, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
1016         proto_item_append_text(curr_item, "%s", add_string ? add_string : "");
1017         curr_offset += 3;
1018
1019         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
1020
1021         return (curr_offset - offset);
1022 }
1023
1024 /*
1025  * [9] 10.5.5.9 Identity type 2
1026  */
1027 static const value_string gsm_a_gm_type_of_identity_vals[] = {
1028         { 0x01, "IMSI" },
1029         { 0x02, "IMEI" },
1030         { 0x03, "IMEISV" },
1031         { 0x04, "TMSI" },
1032         { 0, NULL }
1033 };
1034
1035 static guint16
1036 de_gmm_ident_type2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1037 {
1038         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 1, ENC_BIG_ENDIAN);
1039         proto_tree_add_item(tree, hf_gsm_a_gm_type_of_identity, tvb, offset, 1, ENC_BIG_ENDIAN);
1040
1041         /* no length check possible */
1042         return (1);
1043 }
1044
1045 /*
1046  * [9] 10.5.5.10 IMEISV request
1047  */
1048 static const range_string gsm_a_gm_imeisv_req_vals[] = {
1049         { 0x00, 0x00, "IMEISV not requested" },
1050         { 0x01, 0x01, "IMEISV requested" },
1051         { 0x02, 0x07, "Unknown, interpreted as IMEISV not requested" },
1052         { 0, 0, NULL }
1053 };
1054
1055 static guint16
1056 de_gmm_imeisv_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1057 {
1058         guint32 bit_offset;
1059
1060         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
1061         bit_offset = offset << 3;
1062         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1063         proto_tree_add_bits_item(tree, hf_gsm_a_gm_imeisv_req, tvb, bit_offset + 1, 3, ENC_BIG_ENDIAN);
1064
1065         /* no length check possible */
1066         return (1);
1067 }
1068
1069 /*
1070  * [7] 10.5.5.11
1071  */
1072 static guint16
1073 de_gmm_rec_npdu_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1074 {
1075         guint32 curr_offset;
1076         guint   curr_len;
1077
1078         curr_len    = len;
1079         curr_offset = offset;
1080
1081         if (len == 0) return 0;
1082
1083         do
1084         {
1085                 guint32 oct;
1086                 oct = tvb_get_guint8(tvb, curr_offset);
1087                 oct <<= 8;
1088                 oct |= tvb_get_guint8(tvb, curr_offset+1);
1089                 curr_len -= 2;
1090                 oct <<= 8;
1091
1092                 proto_tree_add_uint_format(tree, hf_gsm_a_gm_nsapi, tvb, curr_offset, 2, (oct>>12)&0xff, "NSAPI %d: 0x%02x (%u)", oct>>20, (oct>>12)&0xff, (oct>>12)&0xff);
1093                 curr_offset +=  2;
1094
1095                 if (curr_len > 2)
1096                 {
1097                         oct |= tvb_get_guint8(tvb, curr_offset+2);
1098                         curr_len--;
1099                         oct <<= 12;
1100
1101                         proto_tree_add_uint_format(tree, hf_gsm_a_gm_nsapi, tvb, curr_offset-1, 2, (oct>>12)&0xff, "NSAPI %d: 0x%02x (%u)", oct>>20, (oct>>12)&0xff, (oct>>12)&0xff);
1102                         curr_offset++;
1103                 }
1104
1105         } while (curr_len > 1);
1106
1107         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
1108
1109         return (curr_offset - offset);
1110 }
1111
1112 /*
1113  * [9] 10.5.5.12 MS network capability
1114  */
1115 static const true_false_string gsm_a_gmm_net_cap_gea_vals = {
1116         "Encryption algorithm available",
1117         "Encryption algorithm not available"
1118 };
1119
1120 static const true_false_string gsm_a_gmm_net_cap_smdch_vals = {
1121         "Mobile station supports mobile terminated point to point SMS via dedicated signalling channels",
1122         "Mobile station does not support mobile terminated point to point SMS via dedicated signalling channels"
1123 };
1124
1125 static const true_false_string gsm_a_gmm_net_cap_smgprs_vals = {
1126         "Mobile station supports mobile terminated point to point SMS via GPRS packet data channels",
1127         "Mobile station does not support mobile terminated point to point SMS via GPRS packet data channels"
1128 };
1129
1130 static const true_false_string gsm_a_gmm_net_cap_ucs2_vals = {
1131         "The ME has no preference between the use of the default alphabet and the use of UCS2",
1132         "The ME has a preference for the default alphabet (defined in 3GPP TS 23.038 [8b]) over UCS2"
1133 };
1134
1135 static const value_string gsm_a_gmm_net_cap_ss_scr_ind_vals[]={
1136         { 0x00, "Default value of phase 1" },
1137         { 0x01, "capability of handling of ellipsis notation and phase 2 error handling" },
1138         { 0x02, "For future use, interpreted as Capability of handling of ellipsis notation and phase 2 error handling" },
1139         { 0x03, "For future use, interpreted as Capability of handling of ellipsis notation and phase 2 error handling" },
1140         { 0x00, NULL }
1141 };
1142
1143 static const true_false_string gsm_a_gmm_net_cap_solsa_vals = {
1144         "The ME supports SoLSA",
1145         "The ME does not support SoLSA"
1146 };
1147
1148 static const true_false_string gsm_a_gmm_net_cap_rev_vals = {
1149         "Used by a mobile station supporting R99 or later versions of the protocol",
1150         "Used by a mobile station not supporting R99 or later versions of the protocol"
1151 };
1152
1153 static const true_false_string gsm_a_gmm_net_cap_pfc_vals = {
1154         "Mobile station does support BSS packet flow procedures",
1155         "Mobile station does not support BSS packet flow procedures"
1156 };
1157
1158 static const true_false_string gsm_a_gmm_net_cap_lcs_vals = {
1159         "LCS value added location request notification capability supported",
1160         "LCS value added location request notification capability not supported"
1161 };
1162
1163 static const true_false_string gsm_a_gmm_net_cap_ps_irat_iu_vals = {
1164         "PS inter-RAT HO to UTRAN Iu mode supported",
1165         "PS inter-RAT HO to UTRAN Iu mode not supported"
1166 };
1167
1168 static const true_false_string gsm_a_gmm_net_cap_ps_irat_s1_vals = {
1169         "PS inter-RAT HO to E-UTRAN S1 mode supported",
1170         "PS inter-RAT HO to E-UTRAN S1 mode not supported"
1171 };
1172
1173 static const true_false_string gsm_a_gmm_net_cap_comb_proc_vals = {
1174         "Mobile station supports EMM combined procedures",
1175         "Mobile station does not support EMM combined procedures"
1176 };
1177
1178 static const true_false_string gsm_a_gmm_net_cap_isr_vals = {
1179         "The mobile station supports ISR",
1180         "The mobile station does not support ISR"
1181 };
1182
1183 static const true_false_string gsm_a_gmm_net_cap_srvcc_to_geran_vals = {
1184         "SRVCC from UTRAN HSPA or E-UTRAN to GERAN/UTRAN supported",
1185         "SRVCC from UTRAN HSPA or E-UTRAN to GERAN/UTRAN not supported"
1186 };
1187
1188 static const true_false_string gsm_a_gmm_net_cap_epc_vals = {
1189         "EPC supported",
1190         "EPC not supported"
1191 };
1192
1193 static const true_false_string gsm_a_gmm_net_cap_nf_vals = {
1194         "Mobile station supports the notification procedure",
1195         "Mobile station does not support the notification procedure"
1196 };
1197
1198 static const true_false_string gsm_a_gmm_net_geran_net_vals = {
1199         "Mobile station supports GERAN network sharing",
1200         "Mobile station does not support GERAN network sharing"
1201 };
1202
1203 static const true_false_string gsm_a_gmm_net_cap_gia_vals = {
1204         "Integrity algorithm available",
1205         "Integrity algorithm not available"
1206 };
1207
1208 static const true_false_string gsm_a_gmm_net_cap_epco_ie_ind_vals = {
1209         "Used by a mobile station supporting extended protocol configuration options IE",
1210         "Used by a mobile station not supporting extended protocol configuration options IE"
1211 };
1212
1213 static const true_false_string gsm_a_gmm_net_cap_restrict_use_enh_cov_vals = {
1214         "Mobile station supports restriction on use of enhanced coverage",
1215         "Mobile station does not support restriction on use of enhanced coverage"
1216 };
1217
1218 static const true_false_string gsm_a_gmm_net_cap_dc_eutra_nr_cap_vals = {
1219         "Mobile station supports dual connectivity of E-UTRA with NR",
1220         "Mobile station does not support dual connectivity of E-UTRA with NR"
1221 };
1222
1223 guint16
1224 de_gmm_ms_net_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1225 {
1226         guint32     curr_offset;
1227         proto_tree *subtree;
1228         proto_item *item;
1229
1230         curr_offset = offset;
1231
1232         /* bit 8: GEA1 */
1233         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_gea1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1234
1235         /* bit 7: SM capabilities via dedicated channels */
1236         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_smdch, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1237
1238         /* bit 6: SM capabilities via GPRS channels */
1239         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_smgprs, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1240
1241         /* bit 5: UCS2 support */
1242         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ucs2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1243
1244         /* bits 4 3: SS Screening Indicator */
1245         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ss_scr_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1246
1247         /* bit 2: SoLSA Capability */
1248         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_solsa, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1249
1250         /* bit 1 */
1251         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_rev, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1252
1253         curr_offset++;
1254         NO_MORE_DATA_CHECK(len);
1255
1256         /* bit 8: PFC feature mode */
1257         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_pfc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1258
1259         /* bits 7 6 5 4 3 2: Extended GEA bits */
1260         item = proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ext_gea_bits, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1261         subtree = proto_item_add_subtree(item, ett_gmm_network_cap);
1262         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1263         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1264         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1265         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1266         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1267         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1268
1269         /* bit 1: LCS VA capability */
1270         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_lcs, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1271
1272         curr_offset++;
1273         NO_MORE_DATA_CHECK(len);
1274
1275         /* bit 8: PS inter-RAT HO from GERAN to UTRAN Iu mode capability */
1276         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ps_irat_iu, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1277
1278         /* bit 7: PS inter-RAT HO from GERAN to E-UTRAN S1 mode capability */
1279         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ps_irat_s1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1280
1281         /* bit 6: EMM Combined procedures capability */
1282         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_comb_proc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1283
1284         /* bit 5: ISR support */
1285         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_isr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1286
1287         /* bit 4: SRVCC to GERAN/UTRAN capability */
1288         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_srvcc_to_geran, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1289
1290         /* bit 3: EPC capability */
1291         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_epc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1292
1293         /* bit 2: NF capability */
1294         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_nf, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1295
1296         /* bits 1: GERAN network sharing capability */
1297         proto_tree_add_item(tree, hf_gsm_a_gmm_net_geran_net_sharing, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1298
1299         curr_offset++;
1300         NO_MORE_DATA_CHECK(len);
1301
1302         /* bit 8: User plane integrity protection support */
1303         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_up_int_prot, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1304
1305         /* bit 7: GIA/4 */
1306         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_up_gia4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1307
1308         /* bit 6: GIA/5 */
1309         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_up_gia5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1310
1311         /* bit 5: GIA/6 */
1312         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_up_gia6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1313
1314         /* bit 4: GIA/7 */
1315         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_up_gia7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1316
1317         /* bit 3: ePCO IE indicator */
1318         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_epco_ie_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1319
1320         /* bit 2: Restriction on use of enhanced coverage capability */
1321         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_restrict_use_enh_cov, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1322
1323         /* bit 1: Dual connectivity of E-UTRA with NR capability */
1324         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_dc_eutra_nr_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1325
1326         curr_offset++;
1327         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
1328
1329         return (curr_offset - offset);
1330 }
1331
1332 /*
1333  * [7] 10.5.5.12a
1334  */
1335 #define GET_DATA                                /* check if we have enough bits left */ \
1336         if (curr_bits_length < bits_needed) \
1337                 continue; \
1338         /* check if oct has enough bits */ \
1339         if (bits_in_oct < bits_needed) \
1340         { \
1341                 guint32 tmp_oct; \
1342                 if (curr_len == 0) \
1343                 { \
1344                         proto_tree_add_expert(tf_tree, pinfo, &ei_gsm_a_gm_not_enough_data, tvb, curr_offset, 1); \
1345                 } \
1346                 tmp_oct = tvb_get_guint8(tvb, curr_offset); \
1347                 oct |= tmp_oct<<(32-8-bits_in_oct); \
1348                 curr_len--; \
1349                 curr_offset++; \
1350                 if (bits_in_oct != 0) \
1351                         add_octets = 1; \
1352                 else \
1353                         add_octets = 0; \
1354                 bits_in_oct += 8; \
1355         } \
1356         else \
1357                 add_octets = 0;
1358
1359 /* Access Technology Type */
1360
1361 static const value_string gsm_a_gm_acc_tech_type_vals[] = {
1362         { 0x00, "GSM P" },
1363         { 0x01, "GSM E --note that GSM E covers GSM P" },
1364         { 0x02, "GSM R --note that GSM R covers GSM E and GSM P" },
1365         { 0x03, "GSM 1800" },
1366         { 0x04, "GSM 1900" },
1367         { 0x05, "GSM 450" },
1368         { 0x06, "GSM 480" },
1369         { 0x07, "GSM 850" },
1370         { 0x08, "GSM 750" },
1371         { 0x09, "GSM T 380" },
1372         { 0x0a, "GSM T 410" },
1373         { 0x0b, "GSM T 900" },
1374         { 0x0c, "GSM 710" },
1375         { 0x0d, "GSM T 810" },
1376         { 0x0f, "Indicates the presence of a list of Additional access technologies" },
1377         { 0, NULL }
1378 };
1379
1380 static const true_false_string gsm_a_gm_vgcs = {
1381         "VGCS capability and notifications wanted",
1382         "no VGCS capability or no notifications wanted"
1383 };
1384
1385 static const true_false_string gsm_a_gm_vbs = {
1386         "VBS capability and notifications wanted",
1387         "no VBS capability or no notifications wanted"
1388 };
1389
1390 static const value_string gsm_a_gm_multi_slot_vals[] = {
1391         { 0x00, "Not specified" },
1392         { 0x01, "Max Rx-Slot/TDMA:1 Max Tx-Slot/TDMA:1 Max-Sum-Slot/TDMA:2 Tta:3 Ttb:2 Tra:4 Trb:2 Type:1" },
1393         { 0x02, "Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:1 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1" },
1394         { 0x03, "Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:3 Tta:3 Ttb:2 Tra:3 Trb:1 Type:1" },
1395         { 0x04, "Max Rx-Slot/TDMA:3 Max Tx-Slot/TDMA:1 Max-Sum-Slot/TDMA:4 Tta:3 Ttb:1 Tra:3 Trb:1 Type:1" },
1396         { 0x05, "Max Rx-Slot/TDMA:2 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:4 Tta:3 Ttb:1 Tra:3 Trb:1 Type:1" },
1397         { 0x06, "Max Rx-Slot/TDMA:3 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:4 Tta:3 Ttb:1 Tra:3 Trb:1 Type:1" },
1398         { 0x07, "Max Rx-Slot/TDMA:3 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:4 Tta:3 Ttb:1 Tra:3 Trb:1 Type:1" },
1399         { 0x08, "Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:1 Max-Sum-Slot/TDMA:5 Tta:3 Ttb:1 Tra:2 Trb:1 Type:1" },
1400         { 0x09, "Max Rx-Slot/TDMA:3 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:5 Tta:3 Ttb:1 Tra:2 Trb:1 Type:1" },
1401         { 0x0a, "Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:5 Tta:3 Ttb:1 Tra:2 Trb:1 Type:1" },
1402         { 0x0b, "Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:5 Tta:3 Ttb:1 Tra:2 Trb:1 Type:1" },
1403         { 0x0c, "Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:5 Tta:2 Ttb:1 Tra:2 Trb:1 Type:1" },
1404         { 0x0d, "Max Rx-Slot/TDMA:3 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:NA Tta:NA Ttb:a) Tra:3 Trb:a) Type:2 (a: 1 with frequency hopping, 0 otherwise)" },
1405         { 0x0e, "Max Rx-Slot/TDMA:4 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:NA Tta:NA Ttb:a) Tra:3 Trb:a) Type:2 (a: 1 with frequency hopping, 0 otherwise)" },
1406         { 0x0f, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:5 Max-Sum-Slot/TDMA:NA Tta:NA Ttb:a) Tra:3 Trb:a) Type:2 (a: 1 with frequency hopping, 0 otherwise)" },
1407         { 0x10, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:6 Max-Sum-Slot/TDMA:NA Tta:NA Ttb:a) Tra:2 Trb:a) Type:2 (a: 1 with frequency hopping, 0 otherwise)" },
1408         { 0x11, "Max Rx-Slot/TDMA:7 Max Tx-Slot/TDMA:7 Max-Sum-Slot/TDMA:NA Tta:NA Ttb:a) Tra:1 Trb:0 Type:2 (a: 1 with frequency hopping, 0 otherwise)" },
1409         { 0x12, "Max Rx-Slot/TDMA:8 Max Tx-Slot/TDMA:8 Max-Sum-Slot/TDMA:NA Tta:NA Ttb:0 Tra:0 Trb:0 Type:2" },
1410         { 0x13, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1411         { 0x14, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1412         { 0x15, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1413         { 0x16, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1414         { 0x17, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:6 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1415         { 0x18, "Max Rx-Slot/TDMA:8 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1416         { 0x19, "Max Rx-Slot/TDMA:8 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1417         { 0x1a, "Max Rx-Slot/TDMA:8 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1418         { 0x1b, "Max Rx-Slot/TDMA:8 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1419         { 0x1c, "Max Rx-Slot/TDMA:8 Max Tx-Slot/TDMA:6 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1420         { 0x1d, "Max Rx-Slot/TDMA:8 Max Tx-Slot/TDMA:8 Max-Sum-Slot/TDMA:NA Tta:3 Ttb:b) Tra:2 Trb:c) Type:1 (b: 1 with frequency hopping or change from Rx to Tx, 0 otherwise; c: 1 with frequency hopping or change from Tx to Rx, 0 otherwise" },
1421         { 0x1e, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:1 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1 Trb:1 Type:1" },
1422         { 0x1f, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1 Trb:1 Type:1" },
1423         { 0x20, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1 Trb:1 Type:1" },
1424         { 0x21, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1 Trb:1 Type:1" },
1425         { 0x22, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:5 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1 Trb:1 Type:1" },
1426         { 0x23, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:1 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1+to Trb:1 Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1427         { 0x24, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1+to Trb:1 Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1428         { 0x25, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1+to Trb:1 Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1429         { 0x26, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1+to Trb:1 Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1430         { 0x27, "Max Rx-Slot/TDMA:5 Max Tx-Slot/TDMA:5 Max-Sum-Slot/TDMA:6 Tta:2 Ttb:1 Tra:1+to Trb:1 Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1431         { 0x28, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:1 Max-Sum-Slot/TDMA:7 Tta:1 Ttb:1 Tra:1 Trb:to Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1432         { 0x29, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:2 Max-Sum-Slot/TDMA:7 Tta:1 Ttb:1 Tra:1 Trb:to Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1433         { 0x2a, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:3 Max-Sum-Slot/TDMA:7 Tta:1 Ttb:1 Tra:1 Trb:to Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1434         { 0x2b, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:4 Max-Sum-Slot/TDMA:7 Tta:1 Ttb:1 Tra:1 Trb:to Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1435         { 0x2c, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:5 Max-Sum-Slot/TDMA:7 Tta:1 Ttb:1 Tra:1 Trb:to Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1436         { 0x2d, "Max Rx-Slot/TDMA:6 Max Tx-Slot/TDMA:6 Max-Sum-Slot/TDMA:7 Tta:1 Ttb:1 Tra:1 Trb:to Type:1 (to: to = 31 symbol periods (this can be provided by a TA offset, i.e. a minimum TA value))" },
1437         { 0, NULL }
1438 };
1439
1440 static const value_string gsm_a_gm_dtm_gprs_multi_slot_class_vals[] = {
1441         { 0x00, "Unused. If received, the network shall interpret this as Multislot class 5" },
1442         { 0x01, "Multislot class 5 supported" },
1443         { 0x02, "Multislot class 9 supported" },
1444         { 0x03, "Multislot class 11 supported" },
1445         { 0, NULL }
1446 };
1447
1448 static const true_false_string gsm_a_gm_revision_level_indicator = {
1449         "The ME is Release '99 onwards",
1450         "The ME is Release '98 or older"
1451 };
1452
1453 static const value_string gsm_a_gm_down_adv_rec_perf_vals[] = {
1454         { 0x00, "Downlink Advanced Receiver Performance not supported" },
1455         { 0x01, "Downlink Advanced Receiver Performance - phase I supported" },
1456         { 0x02, "Downlink Advanced Receiver Performance - phase II supported" },
1457         { 0, NULL }
1458 };
1459
1460 static const true_false_string gsm_a_gm_dtm_enh_cap = {
1461         "The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures",
1462         "The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures"
1463 };
1464
1465 static const value_string gsm_a_gm_dtm_gprs_high_multi_slot_class_vals[] = {
1466         { 0x00, "Unused. If received, the network shall interpret this as 'Multislot class 31 or 36 supported'" },
1467         { 0x01, "Multislot class 31 or 36 supported" },
1468         { 0x02, "Multislot class 32 or 37 supported" },
1469         { 0x03, "Multislot class 33 or 38 supported" },
1470         { 0x04, "Multislot class 41 supported" },
1471         { 0x05, "Multislot class 42 supported" },
1472         { 0x06, "Multislot class 43 supported" },
1473         { 0x07, "Multislot class 44 supported" },
1474         { 0, NULL }
1475 };
1476
1477 static const value_string gsm_a_gm_multi_slot_cap_red_down_dual_carrier_vals[] = {
1478         { 0x00, "No reduction" },
1479         { 0x01, "The MS supports 1 timeslot fewer than the maximum number of receive timeslots" },
1480         { 0x02, "The MS supports 2 timeslots fewer than the maximum number of receive timeslots" },
1481         { 0x03, "The MS supports 3 timeslots fewer than the maximum number of receive timeslots" },
1482         { 0x04, "The MS supports 4 timeslots fewer than the maximum number of receive timeslots" },
1483         { 0x05, "The MS supports 5 timeslots fewer than the maximum number of receive timeslots" },
1484         { 0x06, "The MS supports 6 timeslots fewer than the maximum number of receive timeslots" },
1485         { 0x07, "Reserved for future use" },
1486         { 0, NULL }
1487 };
1488
1489 static const value_string gsm_a_gm_ul_egprs2_vals[] = {
1490         { 0x00, "The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink" },
1491         { 0x01, "The mobile station supports EGPRS2-A in the uplink" },
1492         { 0x02, "The mobile station supports both EGPRS2-A and EGPRS2-B in the uplink" },
1493         { 0x03, "The mobile station supports both EGPRS2-A and EGPRS2-B in the uplink" },
1494         { 0, NULL }
1495 };
1496
1497 static const value_string gsm_a_gm_dl_egprs2_vals[] = {
1498         { 0x00, "The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink" },
1499         { 0x01, "The mobile station supports EGPRS2-A in the downlink" },
1500         { 0x02, "The mobile station supports both EGPRS2-A and EGPRS2-B in the downlink" },
1501         { 0x03, "The mobile station supports both EGPRS2-A and EGPRS2-B in the downlink" },
1502         { 0, NULL }
1503 };
1504
1505 static const value_string gsm_a_gm_geran_to_eutra_support_in_geran_ptm_vals[] = {
1506         { 0x00, "None" },
1507         { 0x01, "E-UTRAN neighbour cell measurements and MS autonomous cell reselection to E-UTRAN supported" },
1508         { 0x02, "E-UTRAN neighbour cell meas and report, MS autonomous cell resel, CCN and network controlled cell reselection to E-UTRAN" },
1509         { 0x03, "E-UTRAN neighbour cell meas and report, MS autonomous cell resel, CCN, network controlled cell reselection and PS Handover to E-UTRAN" },
1510         { 0, NULL }
1511 };
1512
1513 static const value_string gsm_a_gm_alt_efta_multi_slot_class_vals[] = {
1514         { 0x00, "No Alternative EFTA multislot class is indicated. Use (DTM) EGPRS (high) multislot class only" },
1515         { 0x01, "Alternative EFTA multislot class 1" },
1516         { 0x02, "Alternative EFTA multislot class 2" },
1517         { 0x03, "Alternative EFTA multislot class 3" },
1518         { 0x04, "Unused" },
1519         { 0x05, "Unused" },
1520         { 0x06, "Unused" },
1521         { 0x07, "Unused" },
1522         { 0x08, "Unused" },
1523         { 0x09, "Unused" },
1524         { 0x0a, "Unused" },
1525         { 0x0b, "Unused" },
1526         { 0x0c, "Unused" },
1527         { 0x0d, "Unused" },
1528         { 0x0e, "Unused" },
1529         { 0x0f, "Unused" },
1530         { 0, NULL }
1531 };
1532
1533 static const value_string gsm_a_gm_dlmc_non_contig_intra_band_recep_vals[] = {
1534         { 0x00, "Not supported" },
1535         { 0x01, "Supported in band E-GSM or GSM850" },
1536         { 0x02, "Supported in band DCS1800 or PCS1900" },
1537         { 0x03, "Supported in band E-GSM, or GSM850, or DCS1800 or PCS1900" },
1538         { 0, NULL }
1539 };
1540
1541 static const true_false_string gsm_a_gm_dlmc_inter_band_recep_val = {
1542         "Supported in band combination (E-GSM, DCS1800), or band combination (GSM850, PCS1900)",
1543         "Not supported"
1544 };
1545
1546 static const value_string gsm_a_gm_dlmc_max_bandwidth_vals[] = {
1547         { 0x00, "5 MHz" },
1548         { 0x01, "10 MHz" },
1549         { 0x02, "15 MHz" },
1550         { 0x03, "20 MHz" },
1551         { 0, NULL }
1552 };
1553
1554 static void
1555 gsm_a_gm_dlmc_max_nb_dl_ts_fmt(gchar *s, guint32 v)
1556 {
1557         if (v < 0x3E)
1558                 g_snprintf(s, ITEM_LABEL_LENGTH, "%u TS supported (%u)",
1559                            2*v + 6, v);
1560         else
1561                 g_snprintf(s, ITEM_LABEL_LENGTH, "Reserved (%u)", v);
1562 }
1563
1564 static const value_string gsm_a_gm_dlmc_max_nb_dl_carriers_vals[] = {
1565         { 0x00, "2 carriers supported" },
1566         { 0x01, "4 carriers supported" },
1567         { 0x02, "6 carriers supported" },
1568         { 0x03, "8 carriers supported" },
1569         { 0x04, "10 carriers supported" },
1570         { 0x05, "12 carriers supported" },
1571         { 0x06, "14 carriers supported" },
1572         { 0x07, "16 carriers supported" },
1573         { 0, NULL }
1574 };
1575
1576 static const value_string gsm_a_gm_8psk_power_class_vals[] = {
1577         {0x00, "8PSK modulation not supported for uplink" },
1578         {0x01, "Power class E1"},
1579         {0x02, "Power class E2"},
1580         {0x03, "Power class E3"},
1581         {0, NULL},
1582 };
1583
1584
1585 static const value_string gsm_a_gm_8psk_power_cap_vals[] = {
1586         {0x00, "Reserved" },
1587         {0x01, "Power class E1"},
1588         {0x02, "Power class E2"},
1589         {0x03, "Power class E3"},
1590         {0, NULL},
1591 };
1592
1593 static const value_string gsm_a_gm_extended_dtm_gprs_multi_slot_class_vals[] = {
1594         {0x00,  "Unused. If received, it shall be interpreted as Multislot class 5 supported" },
1595         {0x01,  "Unused. If received, it shall be interpreted as Multislot class 5 supported"},
1596         {0x02,  "Unused. If received, it shall be interpreted as Multislot class 5 supported"},
1597         {0x03,  "Unused. If received, it shall be interpreted as Multislot class 5 supported"},
1598         {0x10,  "Multislot class 5 supported"},
1599         {0x11,  "Multislot class 6 supported"},
1600         {0x12,  "Unused. If received, it shall be interpreted as Multislot class 5 supported"},
1601         {0x13,  "Unused. If received, it shall be interpreted as Multislot class 5 supported"},
1602         {0x20,  "Multislot class 9 supported"},
1603         {0x21,  "Multislot class 10 supported"},
1604         {0x22,  "Unused. If received, it shall be interpreted as Multislot class 9 supported"},
1605         {0x23,  "Unused. If received, it shall be interpreted as Multislot class 9 supported"},
1606         {0x30,  "Multislot class 11 supported"},
1607         {0x31,  "Unused. If received, it shall be interpreted as Multislot class 11 supported"},
1608         {0x32,  "Unused. If received, it shall be interpreted as Multislot class 11 supported"},
1609         {0x33,  "Unused. If received, it shall be interpreted as Multislot class 11 supported"},
1610         {0, NULL}
1611 };
1612
1613 static const value_string gsm_a_gm_gmsk_multislot_power_profile_vals[] = {
1614         {0x00,  "GMSK_MULTISLOT_POWER_PROFILE 0" },
1615         {0x01,  "GMSK_MULTISLOT_POWER_PROFILE 1"},
1616         {0x02,  "GMSK_MULTISLOT_POWER_PROFILE 2"},
1617         {0x03,  "GMSK_MULTISLOT_POWER_PROFILE 3"},
1618         {0, NULL}
1619 };
1620
1621 static const value_string gsm_a_gm_8psk_multislot_power_profile_vals[] = {
1622         {0x00,  "8-PSK_MULTISLOT_POWER_PROFILE 0" },
1623         {0x01,  "8-PSK_MULTISLOT_POWER_PROFILE 1"},
1624         {0x02,  "8-PSK_MULTISLOT_POWER_PROFILE 2"},
1625         {0x03,  "8-PSK_MULTISLOT_POWER_PROFILE 3"},
1626         {0, NULL}
1627 };
1628
1629 static const value_string gsm_a_gm_ec_pch_mon_support_vals[] = {
1630         {0x00, "PCH supported"},
1631         {0x01, "EC-PCH supported"},
1632         {0x02, "PCH and EC-PCH supported"},
1633         {0x03, "Reserved"},
1634         {0, NULL}
1635 };
1636
1637 guint16
1638 de_gmm_ms_radio_acc_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
1639 {
1640         guint32      curr_offset;
1641         guint        curr_len;
1642         int          bit_offset;
1643         proto_item  *tf = NULL, *mc_item = NULL, *ti;
1644         proto_tree  *tf_tree = NULL, *mc_tree = NULL;
1645         guint32      oct;
1646         guchar       bits_in_oct;
1647         guchar       bits_needed;
1648         guint        bits_length;
1649         guint        add_octets;        /* octets which are covered by one element -1 */
1650         guint        curr_bits_length;
1651         guchar       acc_type;
1652         guint        value;
1653         const gchar *str;
1654         guint indx = 0;
1655
1656         guchar   dtm_gprs_mslot  = 0;
1657         guchar   dtm_egprs_mslot = 4;
1658         gboolean finished = TRUE;
1659
1660         curr_len    = len;
1661         curr_offset = offset;
1662         bit_offset  = offset<<3;
1663
1664         bits_in_oct = 0;
1665         oct = 0;
1666
1667
1668         do
1669         {
1670                 /* check for a new round */
1671                 if ((curr_len*8 + bits_in_oct) < 11)
1672                         break;
1673
1674                 /* now read the first 11 bits */
1675                 curr_bits_length = 11;
1676                 /*
1677                  *
1678                  */
1679                 if (curr_len != len)
1680                 {
1681                         bits_needed = 1;
1682                         GET_DATA;
1683
1684                         if ((oct>>(32-bits_needed)) != 1)
1685                         {
1686                                 break;
1687                         }
1688                         oct         <<= bits_needed;
1689                         bits_in_oct  -= bits_needed;
1690                         bit_offset++;
1691
1692                         if ((curr_len*8 + bits_in_oct) < 11)
1693                                 break;
1694                         curr_bits_length = 11;
1695                 }
1696
1697                 indx++;
1698                 tf_tree = proto_tree_add_subtree_format(tree,
1699                                 tvb, curr_offset, 1,
1700                                 ett_gmm_radio_cap, &tf, "MS RA capability %d", indx);
1701
1702                 /*
1703                  * Access Technology
1704                  */
1705                 bits_needed = 4;
1706                 GET_DATA;
1707
1708                 acc_type = oct>>(32-bits_needed);
1709
1710                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_acc_tech_type, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1711                 bit_offset += 4;
1712
1713                 curr_bits_length  -= bits_needed;
1714                 oct              <<= bits_needed;
1715                 bits_in_oct       -= bits_needed;
1716
1717                 /* < Access capabilities struct > ::= */
1718                 /*
1719                  * get bits_length
1720                  */
1721                 bits_needed = 7;
1722                 GET_DATA;
1723
1724                 bits_length = curr_bits_length = oct>>(32-bits_needed);
1725
1726                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_acc_cap_struct_len, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
1727                 proto_item_set_len(tf, (bits_length>>3)+1);
1728                 /* This is already done - length doesn't contain this field
1729                  curr_bits_length -= bits_needed;
1730                 */
1731                 bit_offset   += 7;
1732                 oct         <<= bits_needed;
1733                 bits_in_oct  -= bits_needed;
1734
1735                 if (acc_type == 0x0f)
1736                 {
1737                         do
1738                         {
1739                                 /*
1740                                  * Additional access technologies:
1741                                  */
1742                                 finished = TRUE; /* Break out of the loop unless proven unfinished */
1743
1744                                 /*
1745                                  * Presence bit
1746                                  */
1747                                 bits_needed = 1;
1748                                 GET_DATA;
1749
1750                                 /* analyse bits */
1751                                 switch (oct>>(32-bits_needed))
1752                                 {
1753                                         case 0x00: str = "Not Present"; finished = TRUE; break;
1754                                         case 0x01: str = "Present"; finished = FALSE;    break;
1755                                         default:   str = "This should not happen";
1756                                 }
1757
1758                                 proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_gm_presence, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed), "%s (%u)", str, oct>>(32-bits_needed));
1759                                 bit_offset++;
1760                                 curr_bits_length  -= bits_needed;
1761                                 oct              <<= bits_needed;
1762                                 bits_in_oct       -= bits_needed;
1763
1764                                 if (finished)
1765                                 {
1766                                         /*
1767                                          * No more valid data, get spare bits if any
1768                                          */
1769                                         while (curr_bits_length > 0)
1770                                         {
1771                                                 if (curr_bits_length > 8)
1772                                                         bits_needed = 8;
1773                                                 else
1774                                                         bits_needed = curr_bits_length;
1775                                                 GET_DATA;
1776                                                 curr_bits_length  -= bits_needed;
1777                                                 oct              <<= bits_needed;
1778                                                 bits_in_oct       -= bits_needed;
1779                                                 bit_offset        += bits_needed;
1780                                         }
1781                                         continue;
1782                                 }
1783
1784                                 /*
1785                                  * Access Technology
1786                                  */
1787                                 bits_needed = 4;
1788                                 GET_DATA;
1789
1790                                 acc_type = oct>>(32-bits_needed);
1791
1792                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_acc_tech_type, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1793                                 bit_offset += 4;
1794
1795                                 curr_bits_length  -= bits_needed;
1796                                 oct              <<= bits_needed;
1797                                 bits_in_oct       -= bits_needed;
1798
1799                                 /*
1800                                  * RF Power
1801                                  */
1802                                 bits_needed = 3;
1803                                 GET_DATA;
1804
1805                                 value = tvb_get_bits8(tvb, bit_offset, 3);
1806                                 /* analyse bits */
1807                                 if (acc_type == 0x04)   /* GSM 1900 */
1808                                 {
1809                                         switch (value)
1810                                         {
1811                                                 case 0x01: str = "1 W (30 dBm)";    break;
1812                                                 case 0x02: str = "0,25 W (24 dBm)"; break;
1813                                                 case 0x03: str = "2 W (33 dBm)";    break;
1814                                                 default:   str = "Not specified";
1815                                         }
1816                                 }
1817                                 else if (acc_type == 0x03)
1818                                 {
1819                                         /*
1820                                          * 3 GSM 1800
1821                                          */
1822                                         switch (value)
1823                                         {
1824                                                 case 0x01: str = "1 W (30 dBm)";    break;
1825                                                 case 0x02: str = "0,25 W (24 dBm)"; break;
1826                                                 case 0x03: str = "4 W (36 dBm)";    break;
1827                                                 default:   str = "Not specified";
1828                                         }
1829                                 }
1830                                 else if (acc_type <= 0x08)
1831                                 {
1832                                         /* 0 GSM P
1833                                          * 1 GSM E
1834                                          * 2 GSM R
1835                                          * 5 GSM 450
1836                                          * 6 GSM 480
1837                                          * 7 GSM 850
1838                                          */
1839
1840                                         switch (value)
1841                                         {
1842                                                 case 0x02: str = "8 W (39 dBm)";   break;
1843                                                 case 0x03: str = "5 W (37 dBm)";   break;
1844                                                 case 0x04: str = "2 W (33 dBm)";   break;
1845                                                 case 0x05: str = "0,8 W (29 dBm)"; break;
1846                                                 default:   str = "Not specified";
1847                                         }
1848                                 }
1849                                 else
1850                                         str = "Not specified??";
1851
1852                                 /* decode_bits_in_field(gint bit_offset, gint no_of_bits, guint64 value)*/
1853                                 proto_tree_add_uint_format(tf_tree, hf_gsm_a_gm_rf_power_capability, tvb, curr_offset-1-add_octets, 1+add_octets, value,
1854                                                                                                 "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value), str, value);
1855                                 bit_offset        += 3;
1856                                 curr_bits_length  -= bits_needed;
1857                                 oct              <<= bits_needed;
1858                                 bits_in_oct       -= bits_needed;
1859
1860                                 /*
1861                                  * 8PSK Power Class
1862                                  */
1863                                 bits_needed = 2;
1864                                 GET_DATA;
1865
1866                                 value = tvb_get_bits8(tvb, bit_offset, 2);
1867                                 /* analyse bits */
1868                                 proto_tree_add_uint(tf_tree, hf_gsm_a_gm_8psk_power_class, tvb, curr_offset-1-add_octets, 1+add_octets, value);
1869                                 bit_offset        += 2;
1870                                 curr_bits_length  -= bits_needed;
1871                                 oct              <<= bits_needed;
1872                                 bits_in_oct       -= bits_needed;
1873
1874                         } while (!finished);
1875
1876                         /* goto next one */
1877                         continue;
1878                 }
1879                 /*
1880                  * RF Power
1881                  */
1882                 bits_needed = 3;
1883                 GET_DATA;
1884
1885                 value = tvb_get_bits8(tvb, bit_offset, 3);
1886                 /* analyse bits */
1887                 if (acc_type == 0x04)   /* GSM 1900 */
1888                 {
1889                         switch (value)
1890                         {
1891                                 case 0x01: str = "1 W (30 dBm)";    break;
1892                                 case 0x02: str = "0,25 W (24 dBm)"; break;
1893                                 case 0x03: str = "2 W (33 dBm)";    break;
1894                                 default:   str = "Not specified";
1895                         }
1896                 }
1897                 else if (acc_type == 0x03)
1898                 {
1899                         switch (value)
1900                         {
1901                                 case 0x01: str = "1 W (30 dBm)";    break;
1902                                 case 0x02: str = "0,25 W (24 dBm)"; break;
1903                                 case 0x03: str = "4 W (36 dBm)";    break;
1904                                 default:   str = "Not specified";
1905                         }
1906                 }
1907                 else if (acc_type <= 0x08)
1908                 {
1909                         switch (value)
1910                         {
1911                                 case 0x02: str = "8 W (39 dBm)";   break;
1912                                 case 0x03: str = "5 W (37 dBm)";   break;
1913                                 case 0x04: str = "2 W (33 dBm)";   break;
1914                                 case 0x05: str = "0,8 W (29 dBm)"; break;
1915                                 default:   str = "Not specified";
1916                         }
1917                 }
1918                 else
1919                         str = "Not specified??";
1920
1921                 proto_tree_add_uint_format(tf_tree, hf_gsm_a_gm_rf_power_capability, tvb, curr_offset-1-add_octets, 1+add_octets, value,
1922                                                 "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value), str, value);
1923
1924                 bit_offset        += 3;
1925                 curr_bits_length  -= bits_needed;
1926                 oct              <<= bits_needed;
1927                 bits_in_oct       -= bits_needed;
1928
1929                 /*
1930                  * A5 Bits?
1931                  */
1932                 bits_needed = 1;
1933                 GET_DATA;
1934
1935                 /* analyse bits */
1936                 if ((oct>>(32-bits_needed)) == 0)
1937                 {
1938                         proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_gm_a5_bits, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed),
1939                                                 "Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (%u)",
1940                                                 oct>>(32-bits_needed));
1941                         bit_offset++;
1942                         curr_bits_length  -= bits_needed;
1943                         oct              <<= bits_needed;
1944                         bits_in_oct       -= bits_needed;
1945                 }
1946                 else
1947                 {
1948                         int i;
1949
1950                         proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_gm_a5_bits, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed), "A5 bits follow (%u)", oct>>(32-bits_needed));
1951
1952                         bit_offset++;
1953                         curr_bits_length  -= bits_needed;
1954                         oct              <<= bits_needed;
1955                         bits_in_oct       -= bits_needed;
1956
1957                         for (i=1; i<=7 ; i++)
1958                         {
1959                                 /*
1960                                  * A5 Bits decoding
1961                                  */
1962                                 bits_needed = 1;
1963                                 GET_DATA;
1964
1965                                 /* analyse bits */
1966                                 switch (oct>>(32-bits_needed))
1967                                 {
1968                                         case 0x00: str = "encryption algorithm not available"; break;
1969                                         case 0x01: str = "encryption algorithm available";     break;
1970                                         default:   str = "This should not happen";
1971                                 }
1972
1973                                 proto_tree_add_uint_format(tf_tree, hf_gsm_a_gm_a5_bits, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed), "A5/%d: %s (%u)", i, str, oct>>(32-bits_needed));
1974                                 bit_offset++;
1975                                 curr_bits_length  -= bits_needed;
1976                                 oct              <<= bits_needed;
1977                                 bits_in_oct       -= bits_needed;
1978                         }
1979                 }
1980
1981                 /*
1982                  * ES IND
1983                  */
1984                 bits_needed = 1;
1985                 GET_DATA;
1986
1987                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ctrled_early_cm_sending, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1988                 bit_offset++;
1989                 curr_bits_length  -= bits_needed;
1990                 oct              <<= bits_needed;
1991                 bits_in_oct       -= bits_needed;
1992
1993                 /*
1994                  * PS
1995                  */
1996                 bits_needed = 1;
1997                 GET_DATA;
1998
1999                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_pseudo_sync, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2000                 bit_offset++;
2001                 curr_bits_length  -= bits_needed;
2002                 oct              <<= bits_needed;
2003                 bits_in_oct       -= bits_needed;
2004
2005                 /*
2006                  * VGCS
2007                  */
2008                 bits_needed = 1;
2009                 GET_DATA;
2010
2011                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_vgcs, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2012                 bit_offset++;
2013                 curr_bits_length  -= bits_needed;
2014                 oct              <<= bits_needed;
2015                 bits_in_oct       -= bits_needed;
2016
2017                 /*
2018                  * VBS
2019                  */
2020                 bits_needed = 1;
2021                 GET_DATA;
2022
2023                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_vbs, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2024                 bit_offset++;
2025                 curr_bits_length  -= bits_needed;
2026                 oct              <<= bits_needed;
2027                 bits_in_oct       -= bits_needed;
2028
2029                 /*
2030                  * Multislot capability?
2031                  */
2032                 bits_needed = 1;
2033                 GET_DATA;
2034
2035                 value = oct>>(32-bits_needed);
2036
2037                 mc_item = proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_multislot_capability, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2038                 bit_offset++;
2039
2040                 curr_bits_length  -= bits_needed;
2041                 oct              <<= bits_needed;
2042                 bits_in_oct       -= bits_needed;
2043
2044                 /* analyse bits */
2045                 if (value == 1)
2046                 {
2047                         mc_tree = proto_item_add_subtree(mc_item, ett_gsm_a_gm_msrac_multislot_capability);
2048                         /*
2049                          * HSCSD multislot class?
2050                          */
2051                         bits_needed = 1;
2052                         GET_DATA;
2053
2054                         /* analyse bits */
2055                         if ((oct>>(32-bits_needed)) == 0)
2056                         {
2057                                 proto_tree_add_uint_format_value(mc_tree, hf_gsm_a_gm_rac_hscsd_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF,
2058                                                                                                  "Bits are not available (%u)", oct>>(32-bits_needed));
2059                                 bit_offset++;
2060                                 curr_bits_length  -= bits_needed;
2061                                 oct              <<= bits_needed;
2062                                 bits_in_oct       -= bits_needed;
2063                         }
2064                         else
2065                         {
2066                                 curr_bits_length  -= bits_needed;
2067                                 oct              <<= bits_needed;
2068                                 bits_in_oct       -= bits_needed;
2069                                 bit_offset++;
2070
2071                                 /*
2072                                  * HSCSD multislot class
2073                                  */
2074                                 bits_needed = 5;
2075                                 GET_DATA;
2076
2077                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_hscsd_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2078                                 bit_offset        += 5;
2079                                 curr_bits_length  -= bits_needed;
2080                                 oct              <<= bits_needed;
2081                                 bits_in_oct       -= bits_needed;
2082                         }
2083
2084                         /*
2085                          * GPRS multislot class?
2086                          */
2087                         bits_needed = 1;
2088                         GET_DATA;
2089
2090                         /* analyse bits */
2091                         if ((oct>>(32-bits_needed)) == 0)
2092                         {
2093                                 proto_tree_add_uint_format_value(mc_tree, hf_gsm_a_gm_rac_gprs_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF,
2094                                                                                                 "Bits are not available (%u)", oct>>(32-bits_needed));
2095                                 bit_offset++;
2096                                 curr_bits_length  -= bits_needed;
2097                                 oct              <<= bits_needed;
2098                                 bits_in_oct       -= bits_needed;
2099                         }
2100                         else
2101                         {
2102                                 curr_bits_length  -= bits_needed;
2103                                 oct              <<= bits_needed;
2104                                 bits_in_oct       -= bits_needed;
2105                                 bit_offset++;
2106
2107                                 /*
2108                                  * GPRS multislot class
2109                                  */
2110                                 bits_needed = 5;
2111                                 GET_DATA;
2112
2113                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_gprs_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2114                                 bit_offset        += 5;
2115                                 curr_bits_length  -= bits_needed;
2116                                 oct              <<= bits_needed;
2117                                 bits_in_oct       -= bits_needed;
2118
2119                                 /*
2120                                  * GPRS Extended Dynamic Allocation Capability
2121                                  */
2122                                 bits_needed = 1;
2123                                 GET_DATA;
2124
2125                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_gprs_ext_dyn_alloc_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2126                                 bit_offset++;
2127                                 curr_bits_length  -= bits_needed;
2128                                 oct              <<= bits_needed;
2129                                 bits_in_oct       -= bits_needed;
2130                         }
2131
2132                         /*
2133                          * SMS/SM values
2134                          */
2135                         bits_needed = 1;
2136                         GET_DATA;
2137
2138                         /* analyse bits */
2139                         if ((oct>>(32-bits_needed)) == 0)
2140                         {
2141                                 proto_tree_add_uint_format_value(mc_tree, hf_gsm_a_gm_sms_value, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF,
2142                                                                                                 "Bits are not available (%u)", oct>>(32-bits_needed));
2143                                 bit_offset++;
2144                                 curr_bits_length  -= bits_needed;
2145                                 oct              <<= bits_needed;
2146                                 bits_in_oct       -= bits_needed;
2147                         }
2148                         else
2149                         {
2150                                 curr_bits_length  -= bits_needed;
2151                                 oct              <<= bits_needed;
2152                                 bits_in_oct       -= bits_needed;
2153                                 bit_offset++;
2154
2155                                 /*
2156                                  * Switch-Measure-Switch value
2157                                  */
2158                                 bits_needed = 4;
2159                                 GET_DATA;
2160
2161                                 /* analyse bits */
2162                                 proto_tree_add_bits_item(mc_tree, hf_gsm_a_gm_sms_value, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2163                                 bit_offset        += 4;
2164                                 curr_bits_length  -= bits_needed;
2165                                 oct              <<= bits_needed;
2166                                 bits_in_oct       -= bits_needed;
2167
2168                                 /*
2169                                  * Switch-Measure value
2170                                  */
2171                                 bits_needed = 4;
2172                                 GET_DATA;
2173
2174                                 /* analyse bits */
2175                                 proto_tree_add_bits_item(mc_tree, hf_gsm_a_gm_sm_value, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2176                                 bit_offset        += 4;
2177                                 curr_bits_length  -= bits_needed;
2178                                 oct              <<= bits_needed;
2179                                 bits_in_oct       -= bits_needed;
2180                         }
2181
2182                         /*
2183                          * ECSD multislot class?
2184                          */
2185                         bits_needed = 1;
2186                         GET_DATA;
2187
2188                         /* analyse bits */
2189                         if ((oct>>(32-bits_needed)) == 0)
2190                         {
2191                                 proto_tree_add_uint_format_value(mc_tree, hf_gsm_a_gm_rac_ecsd_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF,
2192                                                                                                 "Bits are not available (%u)", oct>>(32-bits_needed));
2193                                 bit_offset++;
2194                                 curr_bits_length  -= bits_needed;
2195                                 oct              <<= bits_needed;
2196                                 bits_in_oct       -= bits_needed;
2197                         }
2198                         else
2199                         {
2200                                 curr_bits_length  -= bits_needed;
2201                                 oct              <<= bits_needed;
2202                                 bits_in_oct       -= bits_needed;
2203                                 bit_offset++;
2204
2205                                 /*
2206                                  * ECSD multislot class
2207                                  */
2208                                 bits_needed = 5;
2209                                 GET_DATA;
2210
2211                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ecsd_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2212                                 bit_offset        += 5;
2213                                 curr_bits_length  -= bits_needed;
2214                                 oct              <<= bits_needed;
2215                                 bits_in_oct       -= bits_needed;
2216                         }
2217
2218                         /*
2219                          * EGPRS multislot class?
2220                          */
2221                         bits_needed = 1;
2222                         GET_DATA;
2223
2224                         /* analyse bits */
2225                         if ((oct>>(32-bits_needed)) == 0)
2226                         {
2227                                 proto_tree_add_uint_format_value(mc_tree, hf_gsm_a_gm_rac_egprs_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF,
2228                                                                                                 "Bits are not available (%u)", oct>>(32-bits_needed));
2229                                 curr_bits_length  -= bits_needed;
2230                                 oct              <<= bits_needed;
2231                                 bits_in_oct       -= bits_needed;
2232                                 bit_offset++;
2233                         }
2234                         else
2235                         {
2236                                 curr_bits_length  -= bits_needed;
2237                                 oct              <<= bits_needed;
2238                                 bits_in_oct       -= bits_needed;
2239                                 bit_offset++;
2240
2241                                 /*
2242                                  * EGPRS multislot class
2243                                  */
2244                                 bits_needed = 5;
2245                                 GET_DATA;
2246
2247                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_egprs_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
2248                                 bit_offset        += 5;
2249                                 curr_bits_length  -= bits_needed;
2250                                 oct              <<= bits_needed;
2251                                 bits_in_oct       -= bits_needed;
2252
2253                                 /*
2254                                  * EGPRS Extended Dynamic Allocation Capability
2255                                  */
2256                                 bits_needed = 1;
2257                                 GET_DATA;
2258
2259                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_egprs_ext_dyn_alloc_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2260                                 bit_offset++;
2261                                 curr_bits_length  -= bits_needed;
2262                                 oct              <<= bits_needed;
2263                                 bits_in_oct       -= bits_needed;
2264                         }
2265
2266                         /*
2267                          * DTM GPRS Multi Slot Class ?
2268                         */
2269                         bits_needed = 1;
2270                         GET_DATA;
2271
2272                         /* analyse bits */
2273                         if ((oct>>(32-bits_needed)) == 0)
2274                         {
2275                                 proto_tree_add_uint_format_value(mc_tree, hf_gsm_a_gm_rac_dtm_gprs_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF,
2276                                                                                                 "Bits are not available (%u)", oct>>(32-bits_needed));
2277                                 bit_offset++;
2278                                 curr_bits_length  -= bits_needed;
2279                                 oct              <<= bits_needed;
2280                                 bits_in_oct       -= bits_needed;
2281                         }
2282                         else
2283                         {
2284                                 curr_bits_length  -= bits_needed;
2285                                 oct              <<= bits_needed;
2286                                 bits_in_oct       -= bits_needed;
2287                                 bit_offset++;
2288
2289                                 /*
2290                                  * DTM GPRS Multi Slot Class
2291                                  */
2292                                 bits_needed = 2;
2293                                 GET_DATA;
2294
2295                                 /* analyse bits */
2296                                 dtm_gprs_mslot = oct>>(32-bits_needed);
2297
2298                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_gprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2299                                 bit_offset        += 2;
2300                                 curr_bits_length  -= bits_needed;
2301                                 oct              <<= bits_needed;
2302                                 bits_in_oct       -= bits_needed;
2303
2304                                 /*
2305                                  * Single Slot DTM
2306                                  */
2307                                 bits_needed = 1;
2308                                 GET_DATA;
2309
2310                                 proto_tree_add_bits_item(mc_tree, hf_gsm_a_gm_rac_single_slt_dtm, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2311                                 bit_offset++;
2312                                 curr_bits_length  -= bits_needed;
2313                                 oct              <<= bits_needed;
2314                                 bits_in_oct       -= bits_needed;
2315
2316                                 /*
2317                                  * DTM EGPRS Multi Slot Class ?
2318                                 */
2319                                 bits_needed = 1;
2320                                 GET_DATA;
2321
2322                                 /* analyse bits */
2323                                 dtm_egprs_mslot    = oct>>(32-bits_needed);
2324                                 proto_tree_add_bits_item(mc_tree, hf_gsm_a_gm_rac_dtm_egprs_multi_slot_cls_pres, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2325                                 bit_offset++;
2326                                 curr_bits_length  -= bits_needed;
2327                                 oct              <<= bits_needed;
2328                                 bits_in_oct       -= bits_needed;
2329
2330                                 if ((oct>>(32-bits_needed)) == 1)
2331                                 {
2332                                         /*
2333                                          * DTM EGPRS Multi Slot Class
2334                                          */
2335                                         bits_needed = 2;
2336                                         GET_DATA;
2337
2338                                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_egprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2339                                         bit_offset        += 2;
2340                                         curr_bits_length  -= bits_needed;
2341                                         oct              <<= bits_needed;
2342                                         bits_in_oct       -= bits_needed;
2343                                 }
2344                         }
2345                 }
2346
2347                 /*
2348                  * 8PSK Power Capability?
2349                  */
2350                 bits_needed = 1;
2351                 GET_DATA;
2352                 value = oct>>(32-bits_needed);
2353
2354                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_8psk_pow_cap_pres, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2355                 bit_offset++;
2356                 curr_bits_length  -= bits_needed;
2357                 oct              <<= bits_needed;
2358                 bits_in_oct       -= bits_needed;
2359
2360                 /* analyse bits */
2361                 if (value == 1)
2362                 {
2363                         /*
2364                          * 8PSK Power Capability
2365                          */
2366                         bits_needed = 2;
2367                         GET_DATA;
2368
2369
2370                         proto_tree_add_uint(tf_tree, hf_gsm_a_gm_8psk_power_capability, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed));
2371                         bit_offset        += 2;
2372                         curr_bits_length  -= bits_needed;
2373                         oct              <<= bits_needed;
2374                         bits_in_oct       -= bits_needed;
2375                 }
2376
2377                 /*
2378                  * COMPACT Interference Measurement Capability
2379                  */
2380                 bits_needed = 1;
2381                 GET_DATA;
2382
2383                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_comp_int_meas_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2384                 bit_offset++;
2385                 curr_bits_length  -= bits_needed;
2386                 oct              <<= bits_needed;
2387                 bits_in_oct       -= bits_needed;
2388
2389                 /*
2390                  * Revision Level Indicator
2391                  */
2392                 bits_needed = 1;
2393                 GET_DATA;
2394
2395                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rel_lev_ind, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2396                 bit_offset++;
2397                 curr_bits_length  -= bits_needed;
2398                 oct              <<= bits_needed;
2399                 bits_in_oct       -= bits_needed;
2400
2401                 /*
2402                  * UMTS FDD Radio Access Technology Capability
2403                  */
2404                 bits_needed = 1;
2405                 GET_DATA;
2406
2407                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_umts_fdd_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2408                 bit_offset++;
2409                 curr_bits_length  -= bits_needed;
2410                 oct              <<= bits_needed;
2411                 bits_in_oct       -= bits_needed;
2412
2413                 /*
2414                  * UMTS 3.84 Mcps TDD Radio Access Technology Capability
2415                  */
2416                 bits_needed = 1;
2417                 GET_DATA;
2418
2419                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_umts_384_tdd_ra_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2420                 bit_offset++;
2421                 curr_bits_length  -= bits_needed;
2422                 oct              <<= bits_needed;
2423                 bits_in_oct       -= bits_needed;
2424
2425                 /*
2426                  * CDMA 2000 Radio Access Technology Capability
2427                  */
2428                 bits_needed = 1;
2429                 GET_DATA;
2430
2431                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_cdma2000_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2432                 bit_offset++;
2433                 curr_bits_length  -= bits_needed;
2434                 oct              <<= bits_needed;
2435                 bits_in_oct       -= bits_needed;
2436
2437                 /*
2438                  * UMTS 1.28 Mcps TDD Radio Access Technology Capability
2439                  */
2440                 bits_needed = 1;
2441                 GET_DATA;
2442
2443                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_umts_128_tdd_ra_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2444                 bit_offset++;
2445                 curr_bits_length  -= bits_needed;
2446                 oct              <<= bits_needed;
2447                 bits_in_oct       -= bits_needed;
2448
2449                 /*
2450                  * GERAN Feature Package 1
2451                  */
2452                 bits_needed = 1;
2453                 GET_DATA;
2454
2455                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_geran_feat_pkg, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2456                 bit_offset++;
2457                 curr_bits_length  -= bits_needed;
2458                 oct              <<= bits_needed;
2459                 bits_in_oct       -= bits_needed;
2460
2461                 /*
2462                  * Extended DTM (E)GPRS Multi Slot Class
2463                  */
2464
2465                 bits_needed = 1;
2466                 GET_DATA;
2467
2468                 /* analyse bits */
2469                 if ((oct>>(32-bits_needed)) == 0)
2470                 {
2471                         proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_gm_extended_dtm_egprs_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF, "Bits are not available (%u)", oct>>(32-bits_needed));
2472                         curr_bits_length  -= bits_needed;
2473                         oct              <<= bits_needed;
2474                         bits_in_oct       -= bits_needed;
2475                         bit_offset++;
2476                 }
2477                 else
2478                 {
2479                         curr_bits_length  -= bits_needed;
2480                         oct              <<= bits_needed;
2481                         bits_in_oct       -= bits_needed;
2482                         bit_offset++;
2483
2484                         /*
2485                          * Extended DTM GPRS Multi Slot Class
2486                          */
2487                         bits_needed = 2;
2488                         GET_DATA;
2489
2490                         /* analyse bits */
2491                         proto_tree_add_uint(tf_tree, hf_gsm_a_gm_extended_dtm_gprs_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, (oct>>(32-bits_needed))|(dtm_gprs_mslot<<4));
2492                         bit_offset        += 2;
2493                         curr_bits_length  -= bits_needed;
2494                         oct              <<= bits_needed;
2495                         bits_in_oct       -= bits_needed;
2496
2497                         if (dtm_egprs_mslot <= 3)
2498                         {
2499                                 /*
2500                                  * Extended DTM EGPRS Multi Slot Class
2501                                  */
2502                                 bits_needed = 2;
2503                                 GET_DATA;
2504
2505                                 /* analyse bits */
2506                                 proto_tree_add_uint(tf_tree, hf_gsm_a_gm_extended_dtm_egprs_multi_slot_class, tvb, curr_offset-1-add_octets, 1+add_octets, (oct>>(32-bits_needed))|(dtm_egprs_mslot<<4));
2507                                 bit_offset        += 2;
2508                                 curr_bits_length  -= bits_needed;
2509                                 oct              <<= bits_needed;
2510                                 bits_in_oct       -= bits_needed;
2511                         }
2512                 }
2513
2514                 /*
2515                  * Modulation based multislot class support
2516                  */
2517                 bits_needed = 1;
2518                 GET_DATA;
2519
2520                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_mod_based_multi_slot_class_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2521                 bit_offset++;
2522                 curr_bits_length  -= bits_needed;
2523                 oct              <<= bits_needed;
2524                 bits_in_oct       -= bits_needed;
2525
2526                 /*
2527                  * High Multislot Capability
2528                  */
2529                 bits_needed = 1;
2530                 GET_DATA;
2531
2532                 /* analyse bits */
2533                 if ((oct>>(32-bits_needed)) == 0)
2534                 {
2535                         proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_gm_high_multislot_capability, tvb, curr_offset-1-add_octets, 1+add_octets, 0xFF, "Bits are not available (%u)", oct>>(32-bits_needed));
2536                         bit_offset++;
2537                         curr_bits_length  -= bits_needed;
2538                         oct              <<= bits_needed;
2539                         bits_in_oct       -= bits_needed;
2540                 }
2541                 else
2542                 {
2543                         curr_bits_length  -= bits_needed;
2544                         oct              <<= bits_needed;
2545                         bits_in_oct       -= bits_needed;
2546                         bit_offset++;
2547
2548                         /*
2549                          * High Multislot Capability
2550                          */
2551                         bits_needed = 2;
2552                         GET_DATA;
2553
2554                         /* analyse bits */
2555                         ti = proto_tree_add_uint(tf_tree, hf_gsm_a_gm_high_multislot_capability, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed));
2556                         proto_item_append_text(ti, " - This field effect all other multislot fields."
2557                                                                             " To understand the value please read TS 24.008 5.6.0"
2558                                                                             " Release 5 Chap 10.5.5.12 Page 406");
2559                         bit_offset        += 2;
2560                         curr_bits_length  -= bits_needed;
2561                         oct              <<= bits_needed;
2562                         bits_in_oct       -= bits_needed;
2563                 }
2564
2565                 /*
2566                  * GERAN Iu Mode Capability
2567                  */
2568                 bits_needed = 1;
2569                 GET_DATA;
2570
2571                 value              = tvb_get_bits8(tvb, bit_offset, 1);
2572                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_geran_iu_mode_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2573                 bit_offset        += bits_needed;
2574                 curr_bits_length  -= bits_needed;
2575                 oct              <<= bits_needed;
2576                 bits_in_oct       -= bits_needed;
2577                 if (value)
2578                 {
2579                         /* GERAN Iu Mode Capabilities struct present */
2580                         bits_needed        = 4;
2581                         GET_DATA;
2582                         value              = tvb_get_bits8(tvb, bit_offset, 4);
2583                         bit_offset        += bits_needed;
2584                         curr_bits_length  -= bits_needed;
2585                         oct              <<= bits_needed;
2586                         bits_in_oct       -= bits_needed;
2587                         if (value)
2588                         {
2589                                 /*
2590                                  * FLO Iu Capability
2591                                  */
2592                                 bits_needed        = 1;
2593                                 GET_DATA;
2594                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_flo_iu_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2595                                 bit_offset        += bits_needed;
2596                                 curr_bits_length  -= bits_needed;
2597                                 oct              <<= bits_needed;
2598                                 bits_in_oct       -= bits_needed;
2599                                 value--;
2600
2601                                 /* skip spare bits */
2602                                 bit_offset        += value;
2603                                 curr_bits_length  -= value;
2604                                 oct              <<= value;
2605                                 bits_in_oct       -= value;
2606                         }
2607                 }
2608
2609                 /*
2610                  * GMSK Multislot Power Profile
2611                  */
2612                 bits_needed = 2;
2613                 GET_DATA;
2614
2615                 /* analyse bits */
2616                 proto_tree_add_uint(tf_tree, hf_gsm_a_gm_gmsk_multislot_power_profile, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed));
2617                 bit_offset        += 2;
2618                 curr_bits_length  -= bits_needed;
2619                 oct              <<= bits_needed;
2620                 bits_in_oct       -= bits_needed;
2621
2622                 /*
2623                  * 8-PSK Multislot Power Profile
2624                  */
2625                 bits_needed = 2;
2626                 GET_DATA;
2627
2628                 /* analyse bits */
2629                 proto_tree_add_uint(tf_tree, hf_gsm_a_gm_8psk_multislot_power_profile, tvb, curr_offset-1-add_octets, 1+add_octets, oct>>(32-bits_needed));
2630                 bit_offset        += 2;
2631                 curr_bits_length  -= bits_needed;
2632                 oct              <<= bits_needed;
2633                 bits_in_oct       -= bits_needed;
2634
2635                 /*
2636                  * Release 6
2637                  */
2638
2639                 /*
2640                  * Multiple TBF Capability
2641                  */
2642                 bits_needed        = 1;
2643                 GET_DATA;
2644                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_mult_tbf_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2645                 bit_offset        += bits_needed;
2646                 curr_bits_length  -= bits_needed;
2647                 oct              <<= bits_needed;
2648                 bits_in_oct       -= bits_needed;
2649
2650                 /*
2651                  * Downlink Advanced Receiver Performance
2652                  */
2653                 bits_needed        = 2;
2654                 GET_DATA;
2655                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_down_adv_rec_perf, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2656                 bit_offset        += bits_needed;
2657                 curr_bits_length  -= bits_needed;
2658                 oct              <<= bits_needed;
2659                 bits_in_oct       -= bits_needed;
2660
2661                 /*
2662                  * Extended RLC/MAC Control Message Segmentation Capability
2663                  */
2664                 bits_needed        = 1;
2665                 GET_DATA;
2666                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ext_rlc_mac_ctrl_msg_seg_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2667                 bit_offset        += bits_needed;
2668                 curr_bits_length  -= bits_needed;
2669                 oct              <<= bits_needed;
2670                 bits_in_oct       -= bits_needed;
2671
2672                 /*
2673                  * DTM Enhancements Capability
2674                  */
2675                 bits_needed        = 1;
2676                 GET_DATA;
2677                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_enh_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2678                 bit_offset        += bits_needed;
2679                 curr_bits_length  -= bits_needed;
2680                 oct              <<= bits_needed;
2681                 bits_in_oct       -= bits_needed;
2682
2683                 /*
2684                  * DTM GPRS High Multi Slot Class & DTM EGPRS High Multi Slot Class
2685                  */
2686                 bits_needed = 1;
2687                 GET_DATA;
2688                 if ((oct>>(32-bits_needed)) == 0)
2689                 {
2690                         bit_offset        += bits_needed;
2691                         curr_bits_length  -= bits_needed;
2692                         oct              <<= bits_needed;
2693                         bits_in_oct       -= bits_needed;
2694                 }
2695                 else
2696                 {
2697                         bit_offset        += bits_needed;
2698                         curr_bits_length  -= bits_needed;
2699                         oct              <<= bits_needed;
2700                         bits_in_oct       -= bits_needed;
2701
2702                         /*
2703                          * DTM GPRS High Multi Slot Class
2704                          */
2705                         bits_needed        = 3;
2706                         GET_DATA;
2707                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_gprs_high_multi_slot_class, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2708                         bit_offset        += bits_needed;
2709                         curr_bits_length  -= bits_needed;
2710                         oct              <<= bits_needed;
2711                         bits_in_oct       -= bits_needed;
2712
2713                         bits_needed = 1;
2714                         GET_DATA;
2715                         if ((oct>>(32-bits_needed)) == 0)
2716                         {
2717                                 bit_offset        += bits_needed;
2718                                 curr_bits_length  -= bits_needed;
2719                                 oct              <<= bits_needed;
2720                                 bits_in_oct       -= bits_needed;
2721                         }
2722                         else
2723                         {
2724                                 bit_offset        += bits_needed;
2725                                 curr_bits_length  -= bits_needed;
2726                                 oct              <<= bits_needed;
2727                                 bits_in_oct       -= bits_needed;
2728
2729                                 /*
2730                                  * DTM EGPRS High Multi Slot Class
2731                                  */
2732                                 bits_needed        = 3;
2733                                 GET_DATA;
2734                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_egprs_high_multi_slot_class, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2735                                 bit_offset        += bits_needed;
2736                                 curr_bits_length  -= bits_needed;
2737                                 oct              <<= bits_needed;
2738                                 bits_in_oct       -= bits_needed;
2739                         }
2740                 }
2741
2742                 /*
2743                  * PS Handover Capability
2744                  */
2745                 bits_needed        = 1;
2746                 GET_DATA;
2747                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ps_ho_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2748                 bit_offset        += bits_needed;
2749                 curr_bits_length  -= bits_needed;
2750                 oct              <<= bits_needed;
2751                 bits_in_oct       -= bits_needed;
2752
2753                 /*
2754                  * Release 7
2755                  */
2756
2757                 /*
2758                  * DTM Handover Capability
2759                  */
2760                 bits_needed        = 1;
2761                 GET_DATA;
2762                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_ho_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2763                 bit_offset        += bits_needed;
2764                 curr_bits_length  -= bits_needed;
2765                 oct              <<= bits_needed;
2766                 bits_in_oct       -= bits_needed;
2767
2768                 /*
2769                  * Multislot Capability Reduction for Downlink Dual Carrier & Downlink Dual Carrier for DTM Capability
2770                  */
2771
2772                 bits_needed = 1;
2773                 GET_DATA;
2774                 if ((oct>>(32-bits_needed)) == 0)
2775                 {
2776                         bit_offset        += bits_needed;
2777                         curr_bits_length  -= bits_needed;
2778                         oct              <<= bits_needed;
2779                         bits_in_oct       -= bits_needed;
2780                 }
2781                 else
2782                 {
2783                         bit_offset        += bits_needed;
2784                         curr_bits_length  -= bits_needed;
2785                         oct              <<= bits_needed;
2786                         bits_in_oct       -= bits_needed;
2787
2788                         /*
2789                          * Multislot Capability Reduction for Downlink Dual Carrier
2790                          */
2791                         bits_needed        = 3;
2792                         GET_DATA;
2793                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_multi_slot_cap_red_down_dual_carrier, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2794                         bit_offset        += bits_needed;
2795                         curr_bits_length  -= bits_needed;
2796                         oct              <<= bits_needed;
2797                         bits_in_oct       -= bits_needed;
2798
2799                         /*
2800                          * Downlink Dual Carrier for DTM Capability
2801                          */
2802                         bits_needed        = 1;
2803                         GET_DATA;
2804                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_down_dual_carrier_dtm_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2805                         bit_offset        += bits_needed;
2806                         curr_bits_length  -= bits_needed;
2807                         oct              <<= bits_needed;
2808                         bits_in_oct       -= bits_needed;
2809                 }
2810
2811                 /*
2812                  * Flexible Timeslot Assignment
2813                  */
2814                 bits_needed        = 1;
2815                 GET_DATA;
2816                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_flex_ts_assign, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2817                 bit_offset        += bits_needed;
2818                 curr_bits_length  -= bits_needed;
2819                 oct              <<= bits_needed;
2820                 bits_in_oct       -= bits_needed;
2821
2822                 /*
2823                  * GAN PS Handover Capability
2824                  */
2825                 bits_needed        = 1;
2826                 GET_DATA;
2827                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_gan_ps_ho_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2828                 bit_offset        += bits_needed;
2829                 curr_bits_length  -= bits_needed;
2830                 oct              <<= bits_needed;
2831                 bits_in_oct       -= bits_needed;
2832
2833                 /*
2834                  * RLC Non-persistent Mode
2835                  */
2836                 bits_needed        = 1;
2837                 GET_DATA;
2838                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_rlc_non_pers_mode, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2839                 bit_offset        += bits_needed;
2840                 curr_bits_length  -= bits_needed;
2841                 oct              <<= bits_needed;
2842                 bits_in_oct       -= bits_needed;
2843
2844                 /*
2845                  * Reduced Latency Capability
2846                  */
2847                 bits_needed        = 1;
2848                 GET_DATA;
2849                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_reduced_lat_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2850                 bit_offset        += bits_needed;
2851                 curr_bits_length  -= bits_needed;
2852                 oct              <<= bits_needed;
2853                 bits_in_oct       -= bits_needed;
2854
2855                 /*
2856                  * Uplink EGPRS2
2857                  */
2858                 bits_needed        = 2;
2859                 GET_DATA;
2860                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ul_egprs2, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2861                 bit_offset        += bits_needed;
2862                 curr_bits_length  -= bits_needed;
2863                 oct              <<= bits_needed;
2864                 bits_in_oct       -= bits_needed;
2865
2866                 /*
2867                  * Downlink EGPRS2
2868                  */
2869                 bits_needed        = 2;
2870                 GET_DATA;
2871                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dl_egprs2, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2872                 bit_offset        += bits_needed;
2873                 curr_bits_length  -= bits_needed;
2874                 oct              <<= bits_needed;
2875                 bits_in_oct       -= bits_needed;
2876
2877                 /*
2878                  * Release 8
2879                  */
2880
2881                 /*
2882                  * E-UTRA FDD support
2883                  */
2884                 bits_needed        = 1;
2885                 GET_DATA;
2886                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_fdd_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2887                 bit_offset        += bits_needed;
2888                 curr_bits_length  -= bits_needed;
2889                 oct              <<= bits_needed;
2890                 bits_in_oct       -= bits_needed;
2891
2892                 /*
2893                  * E-UTRA TDD support
2894                  */
2895                 bits_needed        = 1;
2896                 GET_DATA;
2897                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_tdd_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2898                 bit_offset        += bits_needed;
2899                 curr_bits_length  -= bits_needed;
2900                 oct              <<= bits_needed;
2901                 bits_in_oct       -= bits_needed;
2902
2903                 /*
2904                  * GERAN to E-UTRA support in GERAN packet transfer mode
2905                  */
2906                 bits_needed        = 2;
2907                 GET_DATA;
2908                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_geran_to_eutra_support_in_geran_ptm, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2909                 bit_offset        += bits_needed;
2910                 curr_bits_length  -= bits_needed;
2911                 oct              <<= bits_needed;
2912                 bits_in_oct       -= bits_needed;
2913
2914                 /*
2915                  * Priority-based reselection support
2916                  */
2917                 bits_needed        = 1;
2918                 GET_DATA;
2919                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_prio_based_resel_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2920                 bit_offset        += bits_needed;
2921                 curr_bits_length  -= bits_needed;
2922                 oct              <<= bits_needed;
2923                 bits_in_oct       -= bits_needed;
2924
2925                 /*
2926                  * Release 9
2927                  */
2928
2929                 /*
2930                  * Enhanced Flexible Timeslot Assignment
2931                  */
2932                 bits_needed = 1;
2933                 GET_DATA;
2934                 if ((oct>>(32-bits_needed)) == 0)
2935                 {
2936                         bit_offset        += bits_needed;
2937                         curr_bits_length  -= bits_needed;
2938                         oct              <<= bits_needed;
2939                         bits_in_oct       -= bits_needed;
2940                 }
2941                 else
2942                 {
2943                         bit_offset        += bits_needed;
2944                         curr_bits_length  -= bits_needed;
2945                         oct              <<= bits_needed;
2946                         bits_in_oct       -= bits_needed;
2947
2948                         /*
2949                          * Alternative EFTA Multislot Class
2950                          */
2951                         bits_needed        = 4;
2952                         GET_DATA;
2953                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_alt_efta_multi_slot_class, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2954                         bit_offset        += bits_needed;
2955                         curr_bits_length  -= bits_needed;
2956                         oct              <<= bits_needed;
2957                         bits_in_oct       -= bits_needed;
2958
2959                         /*
2960                          * EFTA Multislot Capability Reduction for Downlink Dual Carrier
2961                          */
2962                         bits_needed        = 3;
2963                         GET_DATA;
2964                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_efta_multi_slot_cap_red_down_dual_carrier, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2965                         bit_offset        += bits_needed;
2966                         curr_bits_length  -= bits_needed;
2967                         oct              <<= bits_needed;
2968                         bits_in_oct       -= bits_needed;
2969                 }
2970
2971                 /*
2972                  * Indication of Upper Layer PDU Start Capability for RLC UM
2973                  */
2974                 bits_needed = 1;
2975                 GET_DATA;
2976                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ind_up_layer_pdu_start_cap_for_rlc_um, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2977                 bit_offset        += bits_needed;
2978                 curr_bits_length  -= bits_needed;
2979                 oct              <<= bits_needed;
2980                 bits_in_oct       -= bits_needed;
2981
2982                 /*
2983                  * EMST Capability
2984                  */
2985                 bits_needed       = 1;
2986                 GET_DATA;
2987                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_emst_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2988                 bit_offset        += bits_needed;
2989                 curr_bits_length  -= bits_needed;
2990                 oct              <<= bits_needed;
2991                 bits_in_oct       -= bits_needed;
2992
2993                 /*
2994                  * MTTI Capability
2995                  */
2996                 bits_needed        = 1;
2997                 GET_DATA;
2998                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_mtti_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2999                 bit_offset        += bits_needed;
3000                 curr_bits_length  -= bits_needed;
3001                 oct              <<= bits_needed;
3002                 bits_in_oct       -= bits_needed;
3003
3004                 /*
3005                  * UTRA CSG Cells Reporting
3006                  */
3007                 bits_needed        = 1;
3008                 GET_DATA;
3009                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_utra_csg_cell_report, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3010                 bit_offset        += bits_needed;
3011                 curr_bits_length  -= bits_needed;
3012                 oct              <<= bits_needed;
3013                 bits_in_oct       -= bits_needed;
3014
3015                 /*
3016                  * E-UTRA CSG Cells Reporting
3017                  */
3018                 bits_needed        = 1;
3019                 GET_DATA;
3020                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_csg_cell_report, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3021                 bit_offset        += bits_needed;
3022                 curr_bits_length  -= bits_needed;
3023                 oct              <<= bits_needed;
3024                 bits_in_oct       -= bits_needed;
3025
3026                 /*
3027                  * Release 10
3028                  */
3029
3030                  /*
3031                  * DTR Capability
3032                  */
3033                 bits_needed = 1;
3034                 GET_DATA;
3035                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtr_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3036                 bit_offset += bits_needed;
3037                 curr_bits_length -= bits_needed;
3038                 oct <<= bits_needed;
3039                 bits_in_oct -= bits_needed;
3040
3041                  /*
3042                  * EMSR Capability
3043                  */
3044                 bits_needed = 1;
3045                 GET_DATA;
3046                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_emsr_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3047                 bit_offset += bits_needed;
3048                 curr_bits_length -= bits_needed;
3049                 oct <<= bits_needed;
3050                 bits_in_oct -= bits_needed;
3051
3052                  /*
3053                  * Fast Downlink Frequency Switching Capability
3054                  */
3055                 bits_needed = 1;
3056                 GET_DATA;
3057                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_fast_down_freq_switch_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3058                 bit_offset += bits_needed;
3059                 curr_bits_length -= bits_needed;
3060                 oct <<= bits_needed;
3061                 bits_in_oct -= bits_needed;
3062
3063                  /*
3064                  * TIGHTER Capability
3065                  */
3066                 bits_needed = 2;
3067                 GET_DATA;
3068                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_tighter_cap, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3069                 bit_offset += bits_needed;
3070                 curr_bits_length -= bits_needed;
3071                 oct <<= bits_needed;
3072                 bits_in_oct -= bits_needed;
3073
3074                 /*
3075                  * Release 11
3076                  */
3077
3078                  /*
3079                  * FANR Capability
3080                  */
3081                 bits_needed = 1;
3082                 GET_DATA;
3083                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_fanr_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3084                 bit_offset += bits_needed;
3085                 curr_bits_length -= bits_needed;
3086                 oct <<= bits_needed;
3087                 bits_in_oct -= bits_needed;
3088
3089                  /*
3090                  * IPA Capability
3091                  */
3092                 bits_needed = 1;
3093                 GET_DATA;
3094                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ipa_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3095                 bit_offset += bits_needed;
3096                 curr_bits_length -= bits_needed;
3097                 oct <<= bits_needed;
3098                 bits_in_oct -= bits_needed;
3099
3100                  /*
3101                  * GERAN Network Sharing support
3102                  */
3103                 bits_needed = 1;
3104                 GET_DATA;
3105                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_geran_nw_sharing_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3106                 bit_offset += bits_needed;
3107                 curr_bits_length -= bits_needed;
3108                 oct <<= bits_needed;
3109                 bits_in_oct -= bits_needed;
3110
3111                  /*
3112                  * E-UTRA Wideband RSRQ measurements support
3113                  */
3114                 bits_needed = 1;
3115                 GET_DATA;
3116                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_wb_rsrq_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3117                 bit_offset += bits_needed;
3118                 curr_bits_length -= bits_needed;
3119                 oct <<= bits_needed;
3120                 bits_in_oct -= bits_needed;
3121
3122                 /*
3123                  * Release 12
3124                  */
3125
3126                  /*
3127                  * UTRA Multiple Frequency Band Indicators support
3128                  */
3129                 bits_needed = 1;
3130                 GET_DATA;
3131                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_utra_mfbi_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3132                 bit_offset += bits_needed;
3133                 curr_bits_length -= bits_needed;
3134                 oct <<= bits_needed;
3135                 bits_in_oct -= bits_needed;
3136
3137                  /*
3138                  * E-UTRA Multiple Frequency Band Indicators support
3139                  */
3140                 bits_needed = 1;
3141                 GET_DATA;
3142                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_mfbi_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3143                 bit_offset += bits_needed;
3144                 curr_bits_length -= bits_needed;
3145                 oct <<= bits_needed;
3146                 bits_in_oct -= bits_needed;
3147
3148                  /*
3149                  * DLMC Capability
3150                  */
3151                 bits_needed = 1;
3152                 GET_DATA;
3153                 if ((oct>>(32-bits_needed)) == 0)
3154                 {
3155                         bit_offset += bits_needed;
3156                         curr_bits_length -= bits_needed;
3157                         oct <<= bits_needed;
3158                         bits_in_oct -= bits_needed;
3159                 }
3160                 else
3161                 {
3162                         bit_offset += bits_needed;
3163                         curr_bits_length -= bits_needed;
3164                         oct  <<= bits_needed;
3165                         bits_in_oct -= bits_needed;
3166
3167                         bits_needed = 1;
3168                         GET_DATA;
3169                         if ((oct>>(32-bits_needed)) == 0)
3170                         {
3171                                 bit_offset += bits_needed;
3172                                 curr_bits_length -= bits_needed;
3173                                 oct <<= bits_needed;
3174                                 bits_in_oct -= bits_needed;
3175                         }
3176                         else
3177                         {
3178                                 bit_offset += bits_needed;
3179                                 curr_bits_length -= bits_needed;
3180                                 oct <<= bits_needed;
3181                                 bits_in_oct -= bits_needed;
3182
3183                                 /*
3184                                  * DLMC - Non-contiguous intra-band reception
3185                                 */
3186                                 bits_needed = 2;
3187                                 GET_DATA;
3188                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dlmc_non_contig_intra_band_recep, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3189                                 bit_offset += bits_needed;
3190                                 curr_bits_length -= bits_needed;
3191                                 oct <<= bits_needed;
3192                                 bits_in_oct -= bits_needed;
3193
3194                                 /*
3195                                  * DLMC - Inter-band reception
3196                                 */
3197                                 bits_needed = 1;
3198                                 GET_DATA;
3199                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dlmc_inter_band_recep, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3200                                 bit_offset += bits_needed;
3201                                 curr_bits_length -= bits_needed;
3202                                 oct <<= bits_needed;
3203                                 bits_in_oct -= bits_needed;
3204                         }
3205
3206                         /*
3207                          * DLMC - Maximum Bandwidth
3208                         */
3209                         bits_needed = 2;
3210                         GET_DATA;
3211                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dlmc_max_bandwidth, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3212                         bit_offset += bits_needed;
3213                         curr_bits_length -= bits_needed;
3214                         oct <<= bits_needed;
3215                         bits_in_oct -= bits_needed;
3216
3217                         /*
3218                          * DLMC - Maximum Number of Downlink Timeslots
3219                         */
3220                         bits_needed = 6;
3221                         GET_DATA;
3222                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dlmc_max_nb_dl_ts, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
3223                         bit_offset += bits_needed;
3224                         curr_bits_length -= bits_needed;
3225                         oct <<= bits_needed;
3226                         bits_in_oct -= bits_needed;
3227
3228                         /*
3229                          * DLMC - Maximum Number of Downlink Carriers
3230                         */
3231                         bits_needed = 3;
3232                         GET_DATA;
3233                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dlmc_max_nb_dl_carriers, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3234                         bit_offset += bits_needed;
3235                         curr_bits_length -= bits_needed;
3236                         oct <<= bits_needed;
3237                         bits_in_oct -= bits_needed;
3238                 }
3239
3240                 /*
3241                  * Extended TSC Set Capability support
3242                  */
3243                 bits_needed = 1;
3244                 GET_DATA;
3245                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ext_tsc_set_cap_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3246                 bit_offset += bits_needed;
3247                 curr_bits_length -= bits_needed;
3248                 oct <<= bits_needed;
3249                 bits_in_oct -= bits_needed;
3250
3251                 /*
3252                  * Extended EARFCN value range
3253                  */
3254                 bits_needed = 1;
3255                 GET_DATA;
3256                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ext_earfcn_value_range, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3257                 bit_offset += bits_needed;
3258                 curr_bits_length -= bits_needed;
3259                 oct <<= bits_needed;
3260                 bits_in_oct -= bits_needed;
3261
3262                 /*
3263                  * Release 13
3264                  */
3265
3266                 /*
3267                  * (EC-)PCH monitoring support
3268                  */
3269                 bits_needed = 2;
3270                 GET_DATA;
3271                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ec_pch_mon_support, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3272                 bit_offset += bits_needed;
3273                 curr_bits_length -= bits_needed;
3274                 oct <<= bits_needed;
3275                 bits_in_oct -= bits_needed;
3276
3277                 /*
3278                  * Release 14
3279                  */
3280
3281                 /*
3282                  * MS Sync Accuracy
3283                  */
3284                 bits_needed = 1;
3285                 GET_DATA;
3286                 if ((oct>>(32-bits_needed)) == 0)
3287                 {
3288                         bit_offset += bits_needed;
3289                         curr_bits_length -= bits_needed;
3290                         oct <<= bits_needed;
3291                         bits_in_oct -= bits_needed;
3292                 }
3293                 else
3294                 {
3295                         bits_needed = 4;
3296                         GET_DATA;
3297                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ms_sync_accuracy, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3298                         bit_offset += bits_needed;
3299                         curr_bits_length -= bits_needed;
3300                         oct <<= bits_needed;
3301                         bits_in_oct -= bits_needed;
3302                 }
3303
3304                 /*
3305                  * EC uplink coverage enhancement support
3306                  */
3307                 bits_needed = 1;
3308                 GET_DATA;
3309                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ext_ec_ul_cov_enh_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3310                 bit_offset += bits_needed;
3311                 curr_bits_length -= bits_needed;
3312                 oct <<= bits_needed;
3313                 bits_in_oct -= bits_needed;
3314
3315                  /*
3316                  * we are too long ... so jump over it
3317                  */
3318                 while (curr_bits_length > 0)
3319                 {
3320                         if (curr_bits_length > 8)
3321                                 bits_needed = 8;
3322                         else
3323                                 bits_needed = curr_bits_length;
3324                         GET_DATA;
3325                         curr_bits_length  -= bits_needed;
3326                         oct              <<= bits_needed;
3327                         bits_in_oct       -= bits_needed;
3328                 }
3329
3330
3331         } while (1);
3332
3333         curr_offset += curr_len;
3334
3335         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
3336
3337         return (curr_offset - offset);
3338 }
3339
3340 /*
3341  * [9] 10.5.5.14
3342  */
3343 static const range_string gmm_cause_vals[] = {
3344         { 0x00, 0x01, "Protocol error, unspecified"},
3345         { 0x02, 0x02, "IMSI unknown in HLR"},
3346         { 0x03, 0x03, "Illegal MS"},
3347         { 0x04, 0x04, "IMSI unknown in VLR"}, /* Annex G.1 */
3348         { 0x05, 0x05, "IMEI not accepted"}, /* Annex G.1 */
3349         { 0x06, 0x06, "Illegal ME"},
3350         { 0x07, 0x07, "GPRS services not allowed"},
3351         { 0x08, 0x08, "GPRS services and non-GPRS services not allowed"},
3352         { 0x09, 0x09, "MS identity cannot be derived by the network"},
3353         { 0x0a, 0x0a, "Implicitly detached"},
3354         { 0x0b, 0x0b, "PLMN not allowed"},
3355         { 0x0c, 0x0c, "Location Area not allowed"},
3356         { 0x0d, 0x0d, "Roaming not allowed in this location area"},
3357         { 0x0e, 0x0e, "GPRS services not allowed in this PLMN"},
3358         { 0x0f, 0x0f, "No Suitable Cells In Location Area"},
3359         { 0x10, 0x10, "MSC temporarily not reachable"},
3360         { 0x11, 0x11, "Network failure"},
3361         { 0x12, 0x13, "Protocol error, unspecified"},
3362         { 0x14, 0x14, "MAC failure"},
3363         { 0x15, 0x15, "Synch failure"},
3364         { 0x16, 0x16, "Congestion"},
3365         { 0x17, 0x17, "GSM authentication unacceptable"},
3366         { 0x18, 0x18, "Protocol error, unspecified"},
3367         { 0x19, 0x19, "Not authorized for this CSG"},
3368         { 0x1c, 0x1c, "SMS provided via GPRS in this routing area"},
3369         { 0x20, 0x20, "Service option not supported"},                                          /* Annex G.4 */
3370         { 0x21, 0x21, "Requested service option not subscribed"},                       /* Annex G.4 */
3371         { 0x22, 0x22, "Service option temporarily out of order"},                       /* Annex G.4 */
3372         { 0x23, 0x25, "Protocol error, unspecified"},
3373         { 0x26, 0x26, "Call cannot be identified(non-GPRS services only)"},     /* Annex G.4 */
3374         { 0x27, 0x27, "Protocol error, unspecified"},
3375         { 0x28, 0x28, "No PDP context activated"},
3376         { 0x29, 0x2f, "Protocol error, unspecified"},
3377         { 0x30, 0x3f, "Retry upon entry into a new cell"},
3378         { 0x40, 0x5e, "Protocol error, unspecified"},
3379         { 0x5f, 0x5f, "Semantically incorrect message"},
3380         { 0x60, 0x60, "Invalid mandatory information"},
3381         { 0x61, 0x61, "Message type non-existent or not implemented"},
3382         { 0x62, 0x62, "Message type not compatible with the protocol state"},
3383         { 0x63, 0x63, "Information element non-existent or not implemented"},
3384         { 0x64, 0x64, "Conditional IE error"},
3385         { 0x65, 0x65, "Message not compatible with the protocol state"},
3386         { 0x66, 0x6e, "Protocol error, unspecified"},
3387         { 0x6f, 0x6f, "Protocol error, unspecified"},
3388         { 0x70, 0xff, "Protocol error, unspecified"},
3389         { 0, 0, NULL }
3390 };
3391 /* NOTE 1 TS 124 008 V8.6.0 (2009-07)
3392         "Any other value received by the mobile station shall be treated as 0110 1111, "Protocol
3393         error, unspecified". Any other value received by the network shall be treated as
3394         0110 1111, "Protocol error, unspecified".
3395  */
3396
3397 /* NOTE: The listed reject cause values are defined in annex G. */
3398
3399 static guint16
3400 de_gmm_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3401 {
3402         guint32 curr_offset;
3403
3404         curr_offset = offset;
3405
3406         proto_tree_add_item(tree, hf_gsm_a_gm_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3407
3408         curr_offset++;
3409
3410         /* no length check possible */
3411
3412         return (curr_offset - offset);
3413 }
3414
3415 /*
3416  * [7] 10.5.5.15 Routing area identification
3417  */
3418 guint16
3419 de_gmm_rai(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3420 {
3421         proto_tree *subtree;
3422         guint32     mcc;
3423         guint32     mnc;
3424         guint32     lac;
3425         guint32     rac;
3426         guint32     curr_offset;
3427
3428         curr_offset = offset;
3429
3430         mcc = (tvb_get_guint8(tvb, curr_offset) & 0x0f) <<8;
3431         mcc |= (tvb_get_guint8(tvb, curr_offset) & 0xf0);
3432         mcc |= (tvb_get_guint8(tvb, curr_offset+1) & 0x0f);
3433         mnc = (tvb_get_guint8(tvb, curr_offset+2) & 0x0f) <<8;
3434         mnc |= (tvb_get_guint8(tvb, curr_offset+2) & 0xf0);
3435         mnc |= (tvb_get_guint8(tvb, curr_offset+1) & 0xf0) >>4;
3436         if ((mnc&0x000f) == 0x000f)
3437                  mnc = mnc>>4;
3438
3439         lac = tvb_get_ntohs(tvb, curr_offset+3);
3440         rac = tvb_get_guint8(tvb, curr_offset+5);
3441
3442         subtree = proto_tree_add_subtree_format(tree,
3443                 tvb, curr_offset, 6, ett_gmm_rai, NULL,
3444                 "Routing area identification: %x-%x-%u-%u",
3445                 mcc, mnc, lac, rac);
3446
3447         dissect_e212_mcc_mnc(tvb, pinfo, subtree, offset, E212_RAI, TRUE);
3448
3449         proto_tree_add_item(subtree, hf_gsm_a_lac, tvb, curr_offset+3, 2, ENC_BIG_ENDIAN);
3450         proto_tree_add_item(subtree, hf_gsm_a_gm_rac, tvb, curr_offset+5, 1, ENC_BIG_ENDIAN);
3451
3452         curr_offset += 6;
3453         if (add_string)
3454         {
3455                 if (add_string[0] == '\0')
3456                 {
3457                         g_snprintf(add_string, string_len, " - RAI: %x-%x-%u-%u", mcc, mnc, lac, rac);
3458                 }
3459         }
3460
3461
3462         /* no length check possible */
3463
3464         return (curr_offset - offset);
3465 }
3466
3467 /*
3468  * [7] 10.5.5.15a Routing area identification 2
3469  */
3470 static guint16
3471 de_gmm_rai2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3472 {
3473         /* The routing area identification 2 value is coded as octet 2 to 7 of the Routing area identification information element. */
3474         return de_gmm_rai(tvb, tree, pinfo, offset, len, add_string, string_len);
3475 }
3476
3477 /*
3478  * [7] 10.5.5.17
3479  */
3480 static const value_string gsm_a_gm_update_res_vals[] = {
3481         {0,  "RA updated" },
3482         {1,  "Combined RA/LA updated"},
3483         {2,  "Reserved"},
3484         {3,  "Reserved"},
3485         {4,  "Reserved"},
3486         {5,  "Reserved"},
3487         {6,  "Reserved"},
3488         {7,  "Reserved"},
3489         {0, NULL}
3490 };
3491
3492
3493 static guint16
3494 de_gmm_update_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3495 {
3496         guint32      curr_offset = offset;
3497
3498         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
3499         proto_tree_add_item(tree, hf_gsm_a_gm_update_result, tvb, curr_offset, 1, ENC_NA);
3500
3501         curr_offset++;
3502
3503         /* no length check possible */
3504
3505         return (curr_offset - offset);
3506 }
3507
3508 /*
3509  * [9] 10.5.5.18 Update Type
3510  */
3511 static const value_string gsm_a_gm_update_type_vals[] = {
3512         { 0x00, "RA updating" },
3513         { 0x01, "combined RA/LA updating" },
3514         { 0x02, "combined RA/LA updating with IMSI attach" },
3515         { 0x03, "Periodic updating" },
3516         { 0, NULL }
3517 };
3518
3519 static guint16
3520 de_gmm_update_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3521 {
3522         proto_tree_add_item(tree, hf_gsm_a_gm_for, tvb, offset, 1, ENC_BIG_ENDIAN);
3523         proto_tree_add_item(tree, hf_gsm_a_gm_update_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3524
3525         /* no length check possible */
3526         return (1);
3527 }
3528
3529 /*
3530  * [9] 10.5.5.19 A&C reference number (lower nibble)
3531  */
3532 static guint16
3533 de_gmm_ac_ref_nr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3534 {
3535         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE LOWER NIBBLE */
3536         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ac_ref_nr, tvb, (offset << 3) + 4, 4, ENC_BIG_ENDIAN);
3537
3538         /* no length check possible */
3539         return (1);
3540 }
3541
3542 /*
3543  * [9] 10.5.5.19 A&C reference number (higher nibble)
3544  */
3545 static guint16
3546 de_gmm_ac_ref_nr_h(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3547 {
3548         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
3549         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ac_ref_nr, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
3550
3551         /* no length check possible */
3552         return (1);
3553 }
3554
3555 /*
3556  * [9] 10.5.5.20 Service type
3557  */
3558 static const value_string gsm_a_gm_serv_type_vals[] = {
3559         { 0x00, "Signalling" },
3560         { 0x01, "Data" },
3561         { 0x02, "Paging response" },
3562         { 0x03, "MBMS Multicast Service Reception" },
3563         { 0x04, "MBMS Broadcast Service Reception" },
3564         { 0, NULL }
3565 };
3566
3567 static guint16
3568 de_gmm_service_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3569 {
3570         guint32 bit_offset;
3571
3572         bit_offset = offset << 3;
3573         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3574         bit_offset  +=  1;
3575         proto_tree_add_bits_item(tree, hf_gsm_a_gm_serv_type, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3576         /*bit_offset  +=  3;*/
3577
3578         /* no length check possible */
3579         return (1);
3580 }
3581
3582 /*
3583  * [9] 10.5.5.21 Cell Notification
3584  * No data
3585  */
3586
3587 /*
3588  * [9] 10.5.5.22 PS LCS Capability
3589  */
3590 static const true_false_string gsm_a_gm_mta_e_vals = {
3591         "Multilateration Timing Advance using Extended Access Burst method supported",
3592         "Multilateration Timing Advance using Extended Access Burst method not supported"
3593 };
3594
3595 static const true_false_string gsm_a_gm_mta_r_vals = {
3596         "Multilateration Timing Advance using RLC data block method supported",
3597         "Multilateration Timing Advance using RLC data block method not supported"
3598 };
3599
3600 static const true_false_string gsm_a_gm_apc_vals = {
3601         "Additional Positioning Capabilities which can be retrieved by RRLP are supported",
3602         "Additional Positioning Capabilities which can be retrieved by RRLP are not supported"
3603 };
3604
3605 static const true_false_string gsm_a_gm_otd_a_vals = {
3606         "MS assisted E-OTD supported",
3607         "MS assisted E-OTD not supported"
3608 };
3609
3610 static const true_false_string gsm_a_gm_otd_b_vals = {
3611         "MS based E-OTD supported",
3612         "MS based E-OTD not supported"
3613 };
3614
3615 static const true_false_string gsm_a_gm_gps_a_vals = {
3616         "MS assisted GPS supported",
3617         "MS assisted GPS not supported"
3618 };
3619
3620 static const true_false_string gsm_a_gm_gps_b_vals = {
3621         "MS based GPS supported",
3622         "MS based GPS not supported"
3623 };
3624
3625 static const true_false_string gsm_a_gm_gps_c_vals = {
3626         "Conventional GPS supported",
3627         "Conventional GPS not supported"
3628 };
3629
3630 static const true_false_string gsm_a_gm_motd_vals = {
3631         "Multilateration Observed Time Difference supported",
3632         "Multilateration Observed Time Difference not supported"
3633 };
3634
3635 static const true_false_string gsm_a_gm_mta_a_vals = {
3636         "Multilateration Timing Advance using Access Burst method supported",
3637         "Multilateration Timing Advance using Access Burst method not supported"
3638 };
3639
3640 static guint16
3641 de_gmm_ps_lcs_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3642 {
3643         guint32 curr_offset;
3644
3645         curr_offset = offset;
3646         proto_tree_add_item(tree, hf_gsm_a_gm_mta_e, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3647         proto_tree_add_item(tree, hf_gsm_a_gm_mta_r, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3648         proto_tree_add_item(tree, hf_gsm_a_gm_apc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3649         proto_tree_add_item(tree, hf_gsm_a_gm_otd_a, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3650         proto_tree_add_item(tree, hf_gsm_a_gm_otd_b, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3651         proto_tree_add_item(tree, hf_gsm_a_gm_gps_a, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3652         proto_tree_add_item(tree, hf_gsm_a_gm_gps_b, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3653         proto_tree_add_item(tree, hf_gsm_a_gm_gps_c, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3654
3655         curr_offset++;
3656
3657         if (len > 2) {
3658                 proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, curr_offset << 3, 6, ENC_BIG_ENDIAN);
3659                 proto_tree_add_item(tree, hf_gsm_a_gm_motd, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3660                 proto_tree_add_item(tree, hf_gsm_a_gm_mta_a, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3661         }
3662
3663         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
3664
3665         return (curr_offset - offset);
3666 }
3667
3668 /*
3669  * [7] 10.5.5.23
3670  */
3671 static const true_false_string gsm_a_gm_lcs_molr_value = {
3672         "LCS-MOLR via PS domain supported",
3673         "LCS-MOLR via PS domain not supported"
3674 };
3675 static const true_false_string gsm_a_gm_ims_vops_value = {
3676         "IMS voice over PS session supported in Iu mode, but not supported in A/Gb mode",
3677         "IMS voice over PS session in Iu mode and A/Gb mode not supported"
3678 };
3679 static const true_false_string gsm_a_gm_emc_bs_value = {
3680         "Emergency bearer services supported in Iu mode, but not supported in A/Gb mode",
3681         "Emergency bearer services in Iu mode and A/Gb mode not supported"
3682 };
3683 static guint16
3684 de_gmm_net_feat_supp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3685 {
3686         guint32 curr_offset;
3687
3688         curr_offset = offset;
3689
3690         proto_tree_add_item(tree, hf_gsm_a_gm_lcs_molr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3691         proto_tree_add_item(tree, hf_gsm_a_gm_mbms, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3692         proto_tree_add_item(tree, hf_gsm_a_gm_ims_vops, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3693         proto_tree_add_item(tree, hf_gsm_a_gm_emc_bs, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3694         curr_offset++;
3695
3696         return (curr_offset - offset);
3697 }
3698
3699 /*
3700  * [7] 10.5.5.23a Additional network feature support
3701  */
3702 static const true_false_string gsm_a_gm_epco_value = {
3703         "Extended protocol configuration options IE supported",
3704         "Extended protocol configuration options IE not supported"
3705 };
3706 static const true_false_string gsm_a_gm_restrict_ec_value = {
3707         "Enhanced coverage restricted",
3708         "Enhanced coverage not restricted"
3709 };
3710 static const true_false_string gsm_a_gm_gprs_sms_value = {
3711         "SMS via GPRS not supported",
3712         "SMS via GPRS supported"
3713 };
3714 static guint16
3715 de_gmm_add_net_feat_supp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3716 {
3717         guint32 curr_offset;
3718
3719         curr_offset = offset;
3720
3721         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, curr_offset << 3, 5, ENC_BIG_ENDIAN);
3722         proto_tree_add_item(tree, hf_gsm_a_gm_epco, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3723         proto_tree_add_item(tree, hf_gsm_a_gm_restrict_ec, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3724         proto_tree_add_item(tree, hf_gsm_a_gm_gprs_sms, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3725         curr_offset++;
3726
3727         return (curr_offset - offset);
3728 }
3729
3730 /* [7] 10.5.5.24 Inter RAT information container */
3731 static guint16
3732 de_gmm_rat_info_container(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3733 {
3734         guint32   curr_offset;
3735         tvbuff_t *rrc_irat_ho_info_tvb;
3736
3737         curr_offset = offset;
3738
3739 /* The value part of the Inter RAT information container information element is the INTER RAT HANDOVER INFO as
3740 defined in 3GPP TS 25.331 [23c]. If this field includes padding bits, they are defined in 3GPP TS 25.331 [23c].*/
3741         rrc_irat_ho_info_tvb = tvb_new_subset_length(tvb, curr_offset, len);
3742         if (rrc_irat_ho_info_handle)
3743                 call_dissector(rrc_irat_ho_info_handle, rrc_irat_ho_info_tvb, pinfo, tree);
3744         else
3745                 proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_gm_undecoded, tvb, curr_offset, len, "INTER RAT HANDOVER INFO - Not decoded");
3746
3747         return len;
3748
3749 }
3750
3751 /* [7] 10.5.5.25 Requested MS information */
3752 static const true_false_string gsm_a_gm_req_ms_info_irat_vals = {
3753         "Inter RAT information container IE requested",
3754         "Inter RAT information container IE not requested"
3755 };
3756 static const true_false_string gsm_a_gm_req_ms_info_irat2_vals = {
3757         "E-UTRAN inter RAT information container IE requested",
3758         "E-UTRAN inter RAT information container IE not requested"
3759 };
3760
3761 static guint16
3762 de_gmm_req_ms_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3763 {
3764         guint32 curr_offset;
3765         guint32 bit_offset;
3766
3767         curr_offset = offset;
3768         bit_offset  = (curr_offset<<3)+4;
3769
3770         proto_tree_add_bits_item(tree, hf_gsm_a_gm_req_ms_info_irat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3771         bit_offset++;
3772         proto_tree_add_bits_item(tree, hf_gsm_a_gm_req_ms_info_irat2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3773         bit_offset++;
3774         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3775         /*bit_offset += 2;
3776         curr_offset++;*/
3777
3778         return len;
3779 }
3780
3781 /* [7] 10.5.5.26 UE network capability
3782  * See subclause 9.9.3.x in 3GPP TS 24.301 [120].
3783  */
3784
3785 /* [7] 10.5.5.27 E-UTRAN inter RAT information container */
3786 static guint16
3787 de_gmm_eutran_irat_info_container(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3788 {
3789         guint32   curr_offset;
3790         tvbuff_t *lte_rrc_ue_eutra_cap_tvb;
3791
3792         curr_offset = offset;
3793
3794 /* The value part of the E-UTRAN inter RAT information container information element
3795    is formatted and coded according to the UE-EUTRA-Capability IE defined in 3GPP TS 36.331 [129]*/
3796         lte_rrc_ue_eutra_cap_tvb = tvb_new_subset_length(tvb, curr_offset, len);
3797         if (lte_rrc_ue_eutra_cap_handle)
3798                 call_dissector(lte_rrc_ue_eutra_cap_handle, lte_rrc_ue_eutra_cap_tvb, pinfo, tree);
3799         else
3800                 proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_gm_undecoded, tvb, curr_offset, len, "E-UTRAN Inter RAT information container - Not decoded");
3801
3802         return len;
3803 }
3804
3805 /* [7] 10.5.5.28 Voice domain preference and UE's usage setting */
3806 static const true_false_string gsm_a_gm_ue_usage_setting_vals = {
3807         "Data centric",
3808         "Voice centric"
3809 };
3810 static const value_string gsm_a_gm_voice_domain_pref_for_eutran_vals[] = {
3811         {0x0,   "CS Voice only"},
3812         {0x1,   "IMS PS Voice only"},
3813         {0x2,   "CS voice preferred, IMS PS Voice as secondary"},
3814         {0x3,   "IMS PS voice preferred, CS Voice as secondary"},
3815         {  0,   NULL }
3816 };
3817
3818 guint16
3819 de_gmm_voice_domain_pref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3820 {
3821         guint32 curr_offset;
3822         guint32 bit_offset;
3823
3824         curr_offset = offset;
3825         bit_offset  = curr_offset<<3;
3826
3827         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
3828         bit_offset += 5;
3829         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ue_usage_setting, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3830         bit_offset++;
3831         proto_tree_add_bits_item(tree, hf_gsm_a_gm_voice_domain_pref_for_eutran, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3832         /*bit_offset += 2;
3833         curr_offset++;*/
3834
3835         return len;
3836 }
3837
3838 /* [10] 10.5.5.29 P-TMSI type */
3839 static const true_false_string gsm_a_gm_ptmsi_type_value = {
3840         "Mapped P-TMSI",
3841         "Native P-TMSI"
3842 };
3843
3844 static guint16
3845 de_gmm_ptmsi_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3846 {
3847         guint32 curr_offset, bit_offset;
3848
3849         curr_offset = offset;
3850         bit_offset  = (curr_offset<<3)+4;
3851
3852         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3853         bit_offset += 3;
3854         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ptmsi_type, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3855         curr_offset++;
3856
3857         return (curr_offset - offset);
3858 }
3859
3860 /* [10] 10.5.5.30 Location Area Identification 2 */
3861 static guint16
3862 de_gmm_lai_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len)
3863 {
3864         /* The Location Area Identification 2 value is coded as octet 2 to 6 of the */
3865         /* Location Area Identification information element */
3866         return de_lai(tvb, tree, pinfo, offset, len, add_string, string_len);
3867 }
3868
3869 /* [11] 10.5.5.31 Network resource identifier container */
3870 static guint16
3871 de_gmm_net_res_id_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3872 {
3873         guint32 curr_offset;
3874         guint32 bit_offset;
3875
3876         curr_offset = offset;
3877         bit_offset  = curr_offset<<3;
3878
3879         proto_tree_add_item(tree, hf_gsm_a_gm_nri_cont, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
3880         bit_offset += 10;
3881         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 6, ENC_BIG_ENDIAN);
3882
3883         return len;
3884 }
3885
3886 /* [13] 10.5.5.32 Extended DRX parameters */
3887 static const value_string gsm_a_gm_paging_time_window_vals[] = {
3888         {0x0,   "Iu: 0 s / WB-S1: 1.28 s / NB-S1: 2.56 s"},
3889         {0x1,   "Iu: 1 s / WB-S1: 2.56 s / NB-S1: 5.12 s"},
3890         {0x2,   "Iu: 2 s / WB-S1: 3.84 s / NB-S1: 7.68 s"},
3891         {0x3,   "Iu: 3 s / WB-S1: 5.12 s / NB-S1: 10.24 s"},
3892         {0x4,   "Iu: 4 s / WB-S1: 6.4 s / NB-S1: 12.8 s"},
3893         {0x5,   "Iu: 5 s / WB-S1: 7.68 s / NB-S1: 15.36 s"},
3894         {0x6,   "Iu: 6 s / WB-S1: 8.96 s / NB-S1: 17.92 s"},
3895         {0x7,   "Iu: 7 s / WB-S1: 10.24 s / NB-S1: 20.48 s"},
3896         {0x8,   "Iu: 8 s / WB-S1: 11.52 s / NB-S1: 23.04 s"},
3897         {0x9,   "Iu: 9 s / WB-S1: 12.8 s / NB-S1: 25.6 s"},
3898         {0xa,   "Iu: 10 s / WB-S1: 14.08 s / NB-S1: 28.16 s"},
3899         {0xb,   "Iu: 12 s / WB-S1: 15.36 s / NB-S1: 30.72 s"},
3900         {0xc,   "Iu: 14 s / WB-S1: 16.64 s / NB-S1: 33.28 s"},
3901         {0xd,   "Iu: 16 s / WB-S1: 17.92 s / NB-S1: 35.84 s"},
3902         {0xe,   "Iu: 18 s / WB-S1: 19.2 s / NB-S1: 38.4 s"},
3903         {0xf,   "Iu: 20 s / WB-S1: 20.48 s / NB-S1: 40.96 s"},
3904         {  0,   NULL }
3905 };
3906
3907 static const value_string gsm_a_gm_edrx_vals[] = {
3908         {0x0,   "GERAN: 1.88 s / UTRAN: 10.24 s / E-UTRAN: 5.12 s"},
3909         {0x1,   "GERAN: 3.76 s / UTRAN: 20.48 s / E-UTRAN: 10.24 s"},
3910         {0x2,   "GERAN: 7.53 s / UTRAN: 40.96 s / E-UTRAN: 20.48 s"},
3911         {0x3,   "GERAN: 12.24 s / UTRAN: 81.92 s / E-UTRAN: 40.96 s"},
3912         {0x4,   "GERAN: 24.48 s / UTRAN: 163.84 s / E-UTRAN: 61.44 s"},
3913         {0x5,   "GERAN: 48.96 s / UTRAN: 327.68 s / E-UTRAN: 81.92 s"},
3914         {0x6,   "GERAN: 97.92 s / UTRAN: 655.36 s / E-UTRAN: 102.4 s"},
3915         {0x7,   "GERAN: 195.84 s / UTRAN: 1310.72 s / E-UTRAN: 122.88 s"},
3916         {0x8,   "GERAN: 391.68 s / UTRAN: 1966.08 s / E-UTRAN: 143.36 s"},
3917         {0x9,   "GERAN: 783.36 s / UTRAN: 2621.44 s / E-UTRAN: 163.84 s"},
3918         {0xa,   "GERAN: 1566.72 s / UTRAN: 10.24 s / E-UTRAN: 327.68 s"},
3919         {0xb,   "GERAN: 3133.44 s / UTRAN: 10.24 s / E-UTRAN: 655.36 s"},
3920         {0xc,   "GERAN: 1.88 s / UTRAN: 10.24 s / E-UTRAN: 1310.72 s"},
3921         {0xd,   "GERAN: 1.88 s / UTRAN: 10.24 s / E-UTRAN: 2621.44 s"},
3922         {0xe,   "GERAN: 1.88 s / UTRAN: 10.24 s / E-UTRAN: 5242.88 s"},
3923         {0xf,   "GERAN: 1.88 s / UTRAN: 10.24 s / E-UTRAN: 10485.76 s"},
3924         {  0,   NULL }
3925 };
3926
3927 static guint16
3928 de_gmm_ext_drx_params(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3929 {
3930         guint32 curr_offset;
3931
3932         curr_offset = offset;
3933
3934         proto_tree_add_item(tree, hf_gsm_a_gm_paging_time_window, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3935         proto_tree_add_item(tree, hf_gsm_a_gm_edrx_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3936
3937         return len;
3938 }
3939
3940 /* [13] 10.5.5.33 Message authentication code */
3941 static guint16
3942 de_gmm_mac(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3943 {
3944         proto_tree_add_item(tree, hf_gsm_a_gm_mac, tvb, offset, 4, ENC_BIG_ENDIAN);
3945
3946         return len;
3947 }
3948
3949 /* [13] 10.5.5.34 User Plane integrity indicator */
3950 const true_false_string gsm_a_gm_up_integ_ind_value = {
3951         "MS shall enable integrity protection of user plane data in LLC layer",
3952         "MS shall disable integrity protection of user plane data in LLC layer"
3953 };
3954
3955 static guint16
3956 de_gmm_up_integ_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3957 {
3958         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 3, ENC_BIG_ENDIAN);
3959         proto_tree_add_item(tree, hf_gsm_a_gm_up_integ_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
3960
3961         /* no length check possible */
3962         return (1);
3963 }
3964
3965 /* [14] 10.5.5.35 DCN-ID */
3966 static guint16
3967 de_gmm_dcn_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3968 {
3969         proto_tree_add_item(tree, hf_gsm_a_gm_dcn_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3970
3971         return 2;
3972 }
3973
3974 /* [14] 10.5.5.36 PLMN identity of the CN operator */
3975 static guint16
3976 de_gmm_plmn_id_cn_operator(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3977 {
3978         dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_NONE, TRUE);
3979
3980         return 3;
3981 }
3982
3983 /* [14] 10.5.5.37 Non-3GPP NW provided policies */
3984 const true_false_string gsm_a_gm_n3en_ind_value = {
3985         "Use of non-3GPP emergency numbers permitted",
3986         "Use of non-3GPP emergency numbers not permitted"
3987 };
3988
3989 static guint16
3990 de_gmm_non_3gpp_nw_prov_pol(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3991 {
3992         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 3, ENC_BIG_ENDIAN);
3993         proto_tree_add_item(tree, hf_gsm_a_gm_n3en_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
3994
3995         /* no length check possible */
3996         return (1);
3997 }
3998
3999 /*
4000  * [7] 10.5.7.1
4001  */
4002 static guint16
4003 de_gc_context_stat(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
4004 {
4005         guint8      oct;
4006         guint16     pdp_nr;
4007         guint32     curr_offset;
4008
4009         curr_offset = offset;
4010
4011         oct = tvb_get_guint8(tvb, curr_offset);
4012
4013         for (pdp_nr=0; pdp_nr<16; pdp_nr++)
4014         {
4015                 if (pdp_nr == 8)
4016                 {
4017                         curr_offset++;
4018                         oct = tvb_get_guint8(tvb, curr_offset);
4019                 }
4020                 proto_tree_add_uint_format(tree, hf_gsm_a_gm_nsapi, tvb, curr_offset, 1, oct&1, "NSAPI %d: %s (%u)", pdp_nr, pdp_str[oct&1], oct&1);
4021                 oct>>=1;
4022         }
4023
4024         curr_offset++;
4025
4026         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
4027
4028         return (curr_offset - offset);
4029 }
4030
4031 /*
4032  * [7] 10.5.7.2
4033  */
4034 static const value_string gsm_a_gm_radio_prio_vals[] = {
4035         {0,  "priority level 4 (lowest)" },
4036         {1,  "priority level 1 (highest)"},
4037         {2,  "priority level 2"},
4038         {3,  "priority level 3"},
4039         {4,  "priority level 4 (lowest)"},
4040         {5,  "priority level 4 (lowest)"},
4041         {6,  "priority level 4 (lowest)"},
4042         {7,  "priority level 4 (lowest)"},
4043         {0, NULL}
4044 };
4045
4046 static guint16
4047 de_gc_radio_prio(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
4048 {
4049         guint32      curr_offset = offset;
4050
4051         proto_tree_add_item(tree, hf_gsm_a_gm_radio_priority_pdp, tvb, curr_offset, 1, ENC_NA);
4052
4053         curr_offset++;
4054
4055         return (curr_offset - offset);
4056 }
4057
4058 /*
4059  * [9] 10.5.7.3 GPRS Timer
4060  */
4061 static const value_string gsm_a_gm_gprs_timer_unit_vals[] = {
4062         { 0x00, "value is incremented in multiples of 2 seconds" },
4063         { 0x01, "value is incremented in multiples of 1 minute" },
4064         { 0x02, "value is incremented in multiples of decihours" },
4065         { 0x07, "value indicates that the timer is deactivated" },
4066         { 0, NULL }
4067 };
4068
4069 static guint16
4070 de_gc_timer(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
4071 {
4072         guint8       oct;
4073         guint16      val;
4074         const gchar *str;
4075         proto_item  *item = NULL;
4076         proto_tree  *subtree;
4077
4078         oct = tvb_get_guint8(tvb, offset);
4079         val = oct&0x1f;
4080
4081         switch (oct>>5)
4082         {
4083                 case 0:
4084                         str = "sec"; val*=2;
4085                         break;
4086                 case 1:
4087                         str = "min";
4088                         break;
4089                 case 2:
4090                         str = "min"; val*=6;
4091                         break;
4092                 case 7:
4093                         str = "";
4094                         item = proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_gprs_timer, tvb, offset, 1, val, "timer is deactivated");
4095                         break;
4096                 default:  str = "min";
4097         }
4098
4099         if (item == NULL) {
4100                 item = proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_gprs_timer, tvb, offset, 1, val, "%u %s", val, str);
4101         }
4102
4103         subtree = proto_item_add_subtree(item, ett_gmm_gprs_timer);
4104         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
4105         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer_value, tvb, offset, 1, ENC_BIG_ENDIAN);
4106
4107         /* no length check possible */
4108         return (1);
4109 }
4110
4111 /*
4112  * [7] 10.5.7.4
4113  */
4114 static guint16
4115 de_gc_timer2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string, int string_len _U_)
4116 {
4117         guint8       oct;
4118         guint16      val;
4119         guint32      curr_offset;
4120         const gchar *str = NULL;
4121         proto_tree  *subtree;
4122         proto_item  *item = NULL;
4123
4124         curr_offset = offset;
4125
4126         oct = tvb_get_guint8(tvb, curr_offset);
4127
4128         val = oct&0x1f;
4129
4130         switch (oct>>5)
4131         {
4132                 case 0:
4133                         str = "sec"; val*=2;
4134                         break;
4135                 case 1:
4136                         str = "min";
4137                         break;
4138                 case 2:
4139                         str = "min"; val*=6;
4140                         break;
4141                 case 7:
4142                         item = proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_gprs_timer2, tvb, curr_offset, 1, val, "timer is deactivated");
4143                         break;
4144                 default:  str = "min";
4145         }
4146
4147         if (item == NULL) {
4148                 item = proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_gprs_timer2, tvb, curr_offset, 1, val, "%u %s %s", val, str, add_string ? add_string : "");
4149         }
4150
4151         subtree = proto_item_add_subtree(item, ett_gmm_gprs_timer);
4152         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer2_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
4153         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer2_value, tvb, offset, 1, ENC_BIG_ENDIAN);
4154         curr_offset++;
4155
4156         return (curr_offset - offset);
4157 }
4158
4159 /*
4160  * [10] 10.5.7.4a
4161  */
4162 static const value_string gsm_a_gm_gprs_timer3_unit_vals[] = {
4163         { 0x00, "value is incremented in multiples of 10 minutes" },
4164         { 0x01, "value is incremented in multiples of 1 hour" },
4165         { 0x02, "value is incremented in multiples of 10 hours" },
4166         { 0x03, "value is incremented in multiples of 2 seconds" },
4167         { 0x04, "value is incremented in multiples of 30 seconds" },
4168         { 0x05, "value is incremented in multiples of 1 minute" },
4169         { 0x06, "value is incremented in multiples of 320 hours (for T3312/T3412 extended), 1 hour otherwise" },
4170         { 0x07, "value indicates that the timer is deactivated" },
4171         { 0, NULL }
4172 };
4173
4174 guint16
4175 de_gc_timer3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
4176 {
4177         guint8       oct;
4178         guint16      val;
4179         guint32      curr_offset;
4180         const gchar *str = NULL;
4181         proto_tree  *subtree;
4182         proto_item  *item = NULL;
4183
4184         curr_offset = offset;
4185
4186         oct = tvb_get_guint8(tvb, curr_offset);
4187
4188         val = oct&0x1f;
4189
4190         switch (oct>>5)
4191         {
4192                 case 0:  str = "min"; val*=10; break;
4193                 case 1:  str = "hr"; break;
4194                 case 2:  str = "hr"; val*=10; break;
4195                 case 3:  str = "sec"; val*=2; break;
4196                 case 4:  str = "sec"; val*=30; break;
4197                 case 5:  str = "min"; break;
4198                 case 7:
4199                         item = proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_gprs_timer3, tvb, curr_offset, 1, val, "timer is deactivated");
4200                         break;
4201                 default:  str = "hr";
4202         }
4203
4204         if (item == NULL) {
4205                 item = proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_gprs_timer3, tvb, curr_offset, 1, val, "%u %s", val, str);
4206         }
4207
4208         subtree = proto_item_add_subtree(item, ett_gmm_gprs_timer);
4209         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer3_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
4210         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer3_value, tvb, offset, 1, ENC_BIG_ENDIAN);
4211         curr_offset++;
4212
4213         return (curr_offset - offset);
4214 }
4215
4216 /*
4217  * [7] 10.5.7.5
4218  */
4219 static guint16
4220 de_gc_radio_prio2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
4221 {
4222         guint32      curr_offset = offset;
4223
4224         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
4225         proto_tree_add_item(tree, hf_gsm_a_gm_radio_priority_tom8, tvb, curr_offset, 1, ENC_NA);
4226
4227         curr_offset++;
4228
4229         return (curr_offset - offset);
4230 }
4231
4232 /*
4233  * [8] 10.5.7.6 MBMS context status
4234  */
4235 static guint16
4236 de_gc_mbms_context_stat(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4237 {
4238         guint32     curr_offset;
4239         guint       i;
4240         guint8      oct, j;
4241
4242         curr_offset = offset;
4243
4244         for (i=0; i<len; i++)
4245         {
4246                 oct = tvb_get_guint8(tvb, curr_offset);
4247
4248                 for (j=0; j<8; j++)
4249                 {
4250                         proto_tree_add_uint_format(tree, hf_gsm_a_gm_nsapi, tvb, curr_offset, 1, oct&1, "NSAPI %d: %s (%u)", 128+i*8+j, pdp_str[oct&1], oct&1);
4251                         oct>>=1;
4252                 }
4253                 curr_offset++;
4254         }
4255
4256         return (len);
4257 }
4258
4259 /*
4260  * [8] 10.5.7.7 Uplink data status
4261  */
4262 static const true_false_string gsm_a_gm_nsapi_ul_stat_vals = {
4263         "uplink data are pending for the preserved PDP context",
4264         "no uplink data are pending for the preserved PDP context or the PDP context is PDP-INACTIVE or is PDP-ACTIVE with a RAB already established"
4265 };
4266
4267 static guint16
4268 de_gc_uplink_data_stat(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4269 {
4270         guint32 curr_offset;
4271         guint32 bit_offset;
4272
4273         curr_offset = offset;
4274         bit_offset  = curr_offset<<3;
4275
4276         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_7_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4277         bit_offset++;
4278         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_6_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4279         bit_offset++;
4280         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_5_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4281         bit_offset++;
4282         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
4283         bit_offset += 5;
4284         curr_offset++;
4285         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_15_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4286         bit_offset++;
4287         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_14_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4288         bit_offset++;
4289         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_13_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4290         bit_offset++;
4291         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_12_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4292         bit_offset++;
4293         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_11_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4294         bit_offset++;
4295         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_10_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4296         bit_offset++;
4297         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_9_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4298         bit_offset++;
4299         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_8_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4300 /*
4301         bit_offset++;
4302         curr_offset++;
4303 */
4304         return (len);
4305 }
4306
4307 /*
4308  * [8] 10.5.7.8 Device properties
4309  */
4310 static const true_false_string gsm_a_gm_device_prop_low_prio_value = {
4311         "MS is configured for NAS signalling low priority",
4312         "MS is not configured for NAS signalling low priority"
4313 };
4314
4315 static guint16
4316 de_gc_device_properties(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
4317 {
4318         guint32 curr_offset;
4319         guint32 bit_offset;
4320
4321         curr_offset = offset;
4322         bit_offset  = (curr_offset<<3)+4;
4323
4324         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
4325         bit_offset += 3;
4326         proto_tree_add_bits_item(tree, hf_gsm_a_gm_device_prop_low_prio, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
4327         curr_offset++;
4328
4329         return (curr_offset - offset);
4330 }
4331
4332 /*
4333  * [7] 10.5.6.1
4334  */
4335 guint16
4336 de_sm_apn(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4337 {
4338         guint32     curr_offset;
4339         guint       curr_len;
4340         guint8     *str;
4341         proto_item *pi;
4342
4343         curr_offset = offset;
4344
4345         str = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len, ENC_ASCII|ENC_NA);
4346
4347         curr_len = 0;
4348         while (curr_len < len)
4349         {
4350                 guint step    = str[curr_len];
4351                 str[curr_len] = '.';
4352                 curr_len     += step+1;
4353         }
4354
4355         /* Highlight bytes including the first length byte */
4356         if (str[0]) {
4357                 pi = proto_tree_add_string(tree, hf_gsm_a_gm_apn, tvb, curr_offset, len, str+1);
4358                 if (len > 100) {
4359                         expert_add_info(pinfo, pi, &ei_gsm_a_gm_apn_too_long);
4360                 }
4361         }
4362         curr_offset += len;
4363
4364         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
4365
4366         return (curr_offset - offset);
4367 }
4368
4369 /*
4370  * [7] 10.5.6.2
4371  */
4372 static guint16
4373 de_sm_nsapi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string, int string_len _U_)
4374 {
4375         guint8  oct;
4376         guint32 curr_offset;
4377
4378         curr_offset = offset;
4379
4380         oct = tvb_get_guint8(tvb, curr_offset);
4381
4382         proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_nsapi, tvb, curr_offset, 1, oct&0x0f, "0x%02x (%u) %s", oct&0x0f, oct&0x0f, add_string ? add_string : "");
4383
4384         curr_offset++;
4385
4386         return (curr_offset - offset);
4387 }
4388
4389 /*
4390  * [7] 10.5.6.3 Protocol configuration options
4391  */
4392 static const range_string gsm_a_sm_pco_ms2net_prot_vals[] = {
4393         { 0x0001, 0x0001, "P-CSCF IPv6 Address Request" },
4394         { 0x0002, 0x0002, "IM CN Subsystem Signaling Flag" },
4395         { 0x0003, 0x0003, "DNS Server IPv6 Address Request" },
4396         { 0x0004, 0x0004, "Not Supported" },
4397         { 0x0005, 0x0005, "MS Support of Network Requested Bearer Control indicator" },
4398         { 0x0006, 0x0006, "Reserved" },
4399         { 0x0007, 0x0007, "DSMIPv6 Home Agent Address Request" },
4400         { 0x0008, 0x0008, "DSMIPv6 Home Network Prefix Request" },
4401         { 0x0009, 0x0009, "DSMIPv6 IPv4 Home Agent Address Request" },
4402         { 0x000a, 0x000a, "IP address allocation via NAS signalling" },
4403         { 0x000b, 0x000b, "IPv4 address allocation via DHCPv4" },
4404         { 0x000c, 0x000c, "P-CSCF IPv4 Address Request" },
4405         { 0x000d, 0x000d, "DNS Server IPv4 Address Request" },
4406         { 0x000e, 0x000e, "MSISDN Request" },
4407         { 0x000f, 0x000f, "IFOM-Support-Request" },
4408         { 0x0010, 0x0010, "IPv4 Link MTU Request" },
4409         { 0x0011, 0x0011, "MS support of Local address in TFT indicator" },
4410         { 0x0012, 0x0012, "P-CSCF Re-selection support" },
4411         { 0x0013, 0x0013, "NBIFOM request indicator" },
4412         { 0x0014, 0x0014, "NBIFOM mode" },
4413         { 0x0015, 0x0015, "Non-IP Link MTU Request" },
4414         { 0x0016, 0x0016, "APN rate control support indicator" },
4415         { 0x0017, 0x0017, "3GPP PS data off UE status" },
4416         { 0x0018, 0x0018, "Reliable Data Service request indicator" },
4417         { 0x0019, 0x0019, "Additional APN rate control for exception data support indicator" },
4418         { 0x001a, 0x001a, "PDU session ID" },
4419         { 0xff00, 0xffff, "Operator Specific Use" },
4420         { 0, 0, NULL }
4421 };
4422 static const range_string gsm_a_sm_pco_net2ms_prot_vals[] = {
4423         { 0x0001, 0x0001, "P-CSCF IPv6 Address" },
4424         { 0x0002, 0x0002, "IM CN Subsystem Signaling Flag" },
4425         { 0x0003, 0x0003, "DNS Server IPv6 Address" },
4426         { 0x0004, 0x0004, "Policy Control rejection code" },
4427         { 0x0005, 0x0005, "Selected Bearer Control Mode" },
4428         { 0x0006, 0x0006, "Reserved" },
4429         { 0x0007, 0x0007, "DSMIPv6 Home Agent Address" },
4430         { 0x0008, 0x0008, "DSMIPv6 Home Network Prefix" },
4431         { 0x0009, 0x0009, "DSMIPv6 IPv4 Home Agent Address" },
4432         { 0x000a, 0x000a, "Reserved" },
4433         { 0x000b, 0x000b, "Reserved" },
4434         { 0x000c, 0x000c, "P-CSCF IPv4 Address" },
4435         { 0x000d, 0x000d, "DNS Server IPv4 Address" },
4436         { 0x000e, 0x000e, "MSISDN" },
4437         { 0x000f, 0x000f, "IFOM-Support" },
4438         { 0x0010, 0x0010, "IPv4 Link MTU" },
4439         { 0x0011, 0x0011, "Network support of Local address in TFT indicator" },
4440         { 0x0012, 0x0012, "Reserved" },
4441         { 0x0013, 0x0013, "NBIFOM accepted indicator" },
4442         { 0x0014, 0x0014, "NBIFOM mode" },
4443         { 0x0015, 0x0015, "Non-IP Link MTU" },
4444         { 0x0016, 0x0016, "APN rate control parameters" },
4445         { 0x0017, 0x0017, "3GPP PS data off support indication" },
4446         { 0x0018, 0x0018, "Reliable Data Service accepted indicator" },
4447         { 0x0019, 0x0019, "Additional APN rate control for exception data parameters" },
4448         { 0x001a, 0x001a, "Reserved" },
4449         { 0x001b, 0x001b, "S-NSSAI" },
4450         { 0x001c, 0x001c, "QoS rules" },
4451         { 0x001d, 0x001d, "Session-AMBR" },
4452         { 0x001e, 0x001e, "PDU session address lifetime" },
4453         { 0xff00, 0xffff, "Operator Specific Use" },
4454         { 0, 0, NULL }
4455 };
4456
4457 static const value_string gsm_a_gm_link_dir_vals[] = {
4458         { -1, "Unknown" },
4459         { 0x0, "MS to network" },
4460         { 0x1, "Network to MS" },
4461         { 0, NULL }
4462 };
4463
4464 static const value_string gsm_a_gm_sel_bearer_ctrl_mode_vals[] = {
4465         { 1, "MS only" },
4466         { 2, "MS/NW" },
4467         { 0, NULL }
4468 };
4469
4470 static const value_string gsm_a_gm_nbifom_mode_vals[] = {
4471         { 0, "UE-initiated" },
4472         { 1, "Network-initiated" },
4473         { 0, NULL }
4474 };
4475
4476 const true_false_string gsm_a_gm_apn_rate_ctrl_params_aer_value = {
4477         "Additional exception reports at maximum rate reached are allowed",
4478         "Additional exception reports at maximum rate reached are not allowed"
4479 };
4480
4481 static const value_string gsm_a_gm_apn_rate_ctrl_ul_time_unit_vals[] = {
4482         { 0, "Unrestricted" },
4483         { 1, "Minute" },
4484         { 2, "Hour" },
4485         { 3, "Day" },
4486         { 4, "Week" },
4487         { 0, NULL }
4488 };
4489
4490 static const value_string gsm_a_gm_sm_pco_3gpp_data_off_ue_status_vals[] = {
4491         { 1, "Deactivated"},
4492         { 2, "Activated"},
4493         { 0, NULL}
4494 };
4495
4496 guint16
4497 de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4498 {
4499         proto_item        *generated_item;
4500         guint32            curr_offset;
4501         gint               curr_len;
4502         guchar             oct;
4503         int                link_dir;
4504         proto_item        *pco_item;
4505         proto_tree        *pco_tree;
4506
4507         curr_len    = (gint)len; /* length field is only 1 or 2 bytes long */
4508         curr_offset = offset;
4509
4510         oct = tvb_get_guint8(tvb, curr_offset);
4511
4512         link_dir = pinfo->link_dir;
4513         generated_item = proto_tree_add_int(tree, hf_gsm_a_gm_link_dir, tvb, curr_offset, 0, link_dir);
4514         PROTO_ITEM_SET_GENERATED(generated_item);
4515
4516
4517         /* 1 ext 0 0 0 0 Spare  Configuration protocol */
4518         proto_tree_add_item(tree, hf_gsm_a_sm_ext, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4519         /* Configuration protocol (octet 3)
4520          * Bits
4521          * 3 2 1
4522          * 0 0 0 PPP for use with IP PDP type or IP PDN type (see 3GPP TS 24.301 [120])
4523          *
4524          * All other values are interpreted as PPP in this version of the protocol.
4525          * (3GPP TS 24.008 version 9.4.0 Release 9)
4526          */
4527         proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_configuration_protocol, tvb, curr_offset, 1, oct&0x07, "PPP for use with IP PDP type or IP PDN type (%u)", oct&0x07);
4528         curr_len--;
4529         curr_offset++;
4530
4531         while (curr_len >= 3) /* 2 bytes protocol/container ID + 1 byte length */
4532         {
4533                 guchar e_len;
4534                 guint16 prot;
4535                 tvbuff_t *l3_tvb;
4536
4537                 /* Protocol ID 1                    octet 4
4538                  *                                  octet 5
4539                  * Length of protocol ID 1 contents octet 6
4540                  * Protocol ID 1 contents           octet 7
4541                  */
4542
4543                 prot = tvb_get_ntohs(tvb, curr_offset);
4544                 pco_item = proto_tree_add_uint_format_value(tree, hf_gsm_a_gm_pco_pid, tvb, curr_offset, 2, (guint32)prot,
4545                                 "%s (0x%04x)",
4546                                 link_dir ?
4547                                         rval_to_str_const((guint32)prot, gsm_a_sm_pco_net2ms_prot_vals, val_to_str_ext_const(prot, &ppp_vals_ext, "Unknown")) :
4548                                         rval_to_str_const((guint32)prot, gsm_a_sm_pco_ms2net_prot_vals, val_to_str_ext_const(prot, &ppp_vals_ext, "Unknown")),
4549                                 (guint32)prot);
4550                 pco_tree = proto_item_add_subtree(pco_item, ett_sm_pco);
4551
4552                 curr_len    -= 2;
4553                 curr_offset += 2;
4554                 e_len = tvb_get_guint8(tvb, curr_offset);
4555                 proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_length, tvb, curr_offset, 1, ENC_NA);
4556                 curr_len    -= 1;
4557                 curr_offset += 1;
4558
4559                 switch (prot)
4560                 {
4561                         case 0x0001:
4562                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4563                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_pcscf_ipv6, tvb, curr_offset, 16, ENC_NA);
4564                                 }
4565                                 break;
4566                         case 0x0003:
4567                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4568                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_dns_ipv6, tvb, curr_offset, 16, ENC_NA);
4569                                 }
4570                                 break;
4571                         case 0x0007:
4572                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4573                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_dsmipv6_home_agent_ipv6, tvb, curr_offset, 16, ENC_NA);
4574                                 }
4575                                 break;
4576                         case 0x0002:
4577                         case 0x0006:
4578                         case 0x000A:
4579                         case 0x000B:
4580                         case 0x000F:
4581                         case 0x0011:
4582                         case 0x0012:
4583                         case 0x0013:
4584                         case 0x0018:
4585                                 break;
4586                         case 0x0004:
4587                                 if ((link_dir == P2P_DIR_DL) && (e_len == 1)) {
4588                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_reject_code, tvb, curr_offset, 1, ENC_NA);
4589                                 }
4590                                 break;
4591                         case 0x0005:
4592                                 if ((link_dir == P2P_DIR_DL) && (e_len == 1)) {
4593                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_sel_bearer_ctrl_mode, tvb, curr_offset, 1, ENC_NA);
4594                                 }
4595                                 break;
4596                         case 0x0008:
4597                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4598                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_dsmipv6_home_network_ipv6, tvb, curr_offset, 16, ENC_NA);
4599                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_dsmipv6_home_network_prefix_length, tvb, curr_offset+16, 1, ENC_NA);
4600                                 }
4601                                 break;
4602                         case 0x0009:
4603                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4604                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_dsmipv6_home_agent_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
4605                                 }
4606                                 break;
4607                         case 0x000C:
4608                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4609                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_pcscf_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
4610                                 }
4611                                 break;
4612                         case 0x000D:
4613                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4614                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_dns_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
4615                                 }
4616                                 break;
4617                         case 0x000E:
4618                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
4619                                         dissect_e164_msisdn(tvb, pco_tree, curr_offset, e_len, E164_ENC_BCD);
4620                                 }
4621                                 break;
4622                         case 0x0010:
4623                                 if ((link_dir == P2P_DIR_DL) && (e_len == 2)) {
4624                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_ipv4_link_mtu_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
4625                                 }
4626                                 break;
4627                         case 0x0014:
4628                                 if (e_len == 1) {
4629                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_nbifom_mode, tvb, curr_offset, 1, ENC_NA);
4630                                 }
4631                                 break;
4632                         case 0x0015:
4633                                 if ((link_dir == P2P_DIR_DL) && (e_len == 2)) {
4634                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_non_ip_link_mtu_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
4635                                 }
4636                                 break;
4637                         case 0x0016:
4638                                 if (link_dir == P2P_DIR_DL) {
4639                                         proto_tree_add_bits_item(pco_tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 4, ENC_BIG_ENDIAN);
4640                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_aer, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4641                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_ul_time_unit, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4642                                         if (e_len >= 4) {
4643                                                 proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_max_ul_rate, tvb, curr_offset+1, 3, ENC_BIG_ENDIAN);
4644                                         }
4645                                 }
4646                                 break;
4647                         case 0x0017:
4648                                 if (link_dir == P2P_DIR_UL && e_len >= 1) {
4649                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_3gpp_data_off_ue_status, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4650                                 }
4651                                 break;
4652                         case 0x0019:
4653                                 if (link_dir == P2P_DIR_DL) {
4654                                         proto_tree_add_bits_item(pco_tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 5, ENC_BIG_ENDIAN);
4655                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_add_apn_rate_ctrl_params_ul_time_unit, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4656                                         if (e_len >= 3) {
4657                                                 proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_add_apn_rate_ctrl_params_max_ul_rate, tvb, curr_offset+1, 2, ENC_BIG_ENDIAN);
4658                                         }
4659                                 }
4660                                 break;
4661                         case 0x001a:
4662                                 if (link_dir == P2P_DIR_UL) {
4663                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_pdu_session_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4664                                 }
4665                                 break;
4666                         case 0x001b:
4667                                 if (link_dir == P2P_DIR_DL && e_len >= 4) {
4668                                         de_nas_5gs_cmn_s_nssai(tvb, pco_tree, pinfo, curr_offset, e_len - 3, NULL, 0);
4669                                         dissect_e212_mcc_mnc(tvb, pinfo, pco_tree, curr_offset + e_len - 3, E212_NONE, TRUE);
4670                                 }
4671                                 break;
4672                         case 0x001c:
4673                                 if (link_dir == P2P_DIR_DL) {
4674                                         de_nas_5gs_sm_qos_rules(tvb, pco_tree, pinfo, curr_offset, e_len, NULL, 0);
4675                                 }
4676                                 break;
4677                         case 0x001d:
4678                                 if (link_dir == P2P_DIR_DL) {
4679                                         /* Network to MS direction */
4680                                         de_nas_5gs_sm_session_ambr(tvb, pco_tree, pinfo, curr_offset, e_len, NULL, 0);
4681                                 }
4682                                 break;
4683                         case 0x001e:
4684                                 if (link_dir == P2P_DIR_DL && e_len == 2) {
4685                                         /* When the container identifier indicates PDU session address lifetime,
4686                                          * the length of container identifier contents indicates a length equal to two.
4687                                          * The container identifier contents field contains the binary coded representation
4688                                          * of how long the network is willing to maintain the PDU session in units of seconds.
4689                                          * ...If the length of container identifier contents is different from two octets,
4690                                          * then it shall be ignored by the receiver
4691                                          */
4692                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_pdu_session_address_lifetime, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
4693                                 }
4694                                 break;
4695                         case 0x001f:
4696                                 if (link_dir == P2P_DIR_DL && e_len == 2) {
4697                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_sm_pco_pdu_session_address_lifetime, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
4698                                 }
4699                                 break;
4700                         default:
4701                         {
4702                                 if (e_len > 0) {
4703                                         if (prot >= 0xff00) {
4704                                                 dissect_e212_mcc_mnc(tvb, pinfo, pco_tree, curr_offset, E212_NONE, TRUE);
4705                                                 if ((e_len - 3) > 0) {
4706                                                         proto_tree_add_item(pco_tree, hf_gsm_a_gm_pco_app_spec_info, tvb, curr_offset+3, e_len-3, ENC_NA);
4707                                                 }
4708                                         } else {
4709                                                 dissector_handle_t handle;
4710                                                 handle = dissector_get_uint_handle (gprs_sm_pco_subdissector_table, prot);
4711                                                 l3_tvb = tvb_new_subset_length(tvb, curr_offset, e_len);
4712                                                 if (handle != NULL)
4713                                                 {
4714                                                         /*
4715                                                          * dissect the embedded message
4716                                                         */
4717                                                         /* In this case we do not want the columns updated */
4718                                                         col_set_writable(pinfo->cinfo, -1, FALSE);
4719                                                         call_dissector(handle, l3_tvb, pinfo, pco_tree);
4720                                                         col_set_writable(pinfo->cinfo, -1, TRUE);
4721                                                 }
4722                                                 else
4723                                                 {
4724                                                         /*
4725                                                         * dissect the embedded DATA message
4726                                                         */
4727                                                         call_data_dissector(l3_tvb, pinfo, pco_tree);
4728                                                 }
4729                                         }
4730                                 }
4731                         }
4732                 }
4733                 curr_len    -= e_len;
4734                 curr_offset += e_len;
4735         }
4736
4737         if (curr_len < 0) {
4738                 proto_tree_add_expert(tree, pinfo, &ei_gsm_a_gm_not_enough_data, tvb, offset, len);
4739         } else {
4740                 EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
4741         }
4742
4743         return len;
4744 }
4745
4746 /*
4747  * [9] 10.5.6.4 Packet data protocol address
4748  */
4749 static const value_string gsm_a_sm_pdp_type_org_vals[] = {
4750         { 0x00, "ETSI allocated address" },
4751         { 0x01, "IETF allocated address" },
4752         { 0x0f, "Empty PDP type" },
4753         { 0, NULL }
4754 };
4755
4756 guint16
4757 de_sm_pdp_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4758 {
4759         guint32      curr_offset;
4760         const gchar *str;
4761         guchar       pdp_type_org, pdp_type_num;
4762
4763         curr_offset = offset;
4764
4765         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 4, ENC_BIG_ENDIAN);
4766         proto_tree_add_item(tree, hf_gsm_a_sm_pdp_type_org, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4767
4768         pdp_type_org = tvb_get_guint8(tvb, curr_offset) & 0x0f;
4769         curr_offset += 1;
4770         pdp_type_num = tvb_get_guint8(tvb, curr_offset);
4771
4772         if (pdp_type_org == 0)
4773         {
4774                 /* ETSI allocated address */
4775                 switch (pdp_type_num)
4776                 {
4777                         case 0x00: str = "Reserved, used in earlier version of this protocol"; break;
4778                         case 0x01: str = "PDP-type PPP"; break;
4779                         case 0x02: str = "non IP"; break;
4780                         default:   str = "reserved";
4781                 }
4782         }
4783         else if (pdp_type_org == 1)
4784         {
4785                 /* IETF allocated address */
4786                 switch (pdp_type_num)
4787                 {
4788                         case 0x21: str = "IPv4 address"; break;
4789                         case 0x57: str = "IPv6 address"; break;
4790                         case 0x8d: str = "IPv4v6 address"; break;
4791                         default:   str = "Unknown, interpreted as IPv4 address";
4792                 }
4793         }
4794         else if ((pdp_type_num == 0) && (pdp_type_org == 0x0f))
4795                 str = "Empty";
4796         else
4797                 str = "Not specified";
4798
4799         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_pdp_type_number, tvb, curr_offset, 1, pdp_type_num, "%s (%u)", str, pdp_type_num);
4800
4801         if ((len == 2) && ((pdp_type_num == 0x21) || (pdp_type_num == 0x57) || (pdp_type_num == 0x8d)))
4802         {
4803                 proto_tree_add_uint_format(tree, hf_gsm_a_sm_pdp_address, tvb, curr_offset, 1, pdp_type_num, "Dynamic addressing");
4804                 curr_offset += 1;
4805                 return (curr_offset - offset);
4806         }
4807         else if (len == 2)
4808         {
4809                 proto_tree_add_uint_format(tree, hf_gsm_a_sm_pdp_address, tvb, curr_offset, 1, 0, "No PDP address is included");
4810                 curr_offset += 1;
4811                 return (curr_offset - offset);
4812         }
4813
4814         curr_offset += 1;
4815         if (pdp_type_org == 1)
4816         switch (pdp_type_num)
4817         {
4818                 case 0x57:
4819                         proto_tree_add_item(tree, hf_gsm_a_sm_ip6_address, tvb, curr_offset, 16, ENC_NA);
4820                         curr_offset += 16;
4821                         break;
4822
4823                 case 0x8d:
4824                         proto_tree_add_item(tree, hf_gsm_a_sm_ip4_address, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
4825                         curr_offset += 4;
4826                         proto_tree_add_item(tree, hf_gsm_a_sm_ip6_address, tvb, curr_offset, 16, ENC_NA);
4827                         curr_offset += 16;
4828                         break;
4829
4830                 default:
4831                         proto_tree_add_item(tree, hf_gsm_a_sm_ip4_address, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
4832                         curr_offset += 4;
4833         }
4834
4835         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
4836
4837         return (curr_offset - offset);
4838 }
4839
4840 /*
4841  * [9] 10.5.6.5 Quality of service
4842  */
4843 static const value_string gsm_a_sm_qos_delay_cls_vals[] = {
4844         { 0x00, "Subscribed delay class (in MS to network direction)" },
4845         { 0x01, "Delay class 1" },
4846         { 0x02, "Delay class 2" },
4847         { 0x03, "Delay class 3" },
4848         { 0x04, "Delay class 4 (best effort)" },
4849         { 0x07, "Reserved" },
4850         { 0, NULL }
4851 };
4852
4853 static const value_string gsm_a_sm_qos_reliability_vals[] = {
4854         { 0x00, "Subscribed reliability class (in MS to network direction)" },
4855         { 0x01, "Acknowledged GTP, LLC, and RLC; Protected data" },
4856         { 0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data" },
4857         { 0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data" },
4858         { 0x04, "Unacknowledged GTP/LLC/RLC, Protected data" },
4859         { 0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data" },
4860         { 0x07, "Reserved" },
4861         { 0, NULL }
4862 };
4863  /* Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107) Bits 3 2 1 */
4864 const value_string gsm_a_sm_qos_del_of_err_sdu_vals[] = {
4865         { 0, "Subscribed delivery of erroneous SDUs/Reserved" },
4866         { 1, "No detect('-')" },
4867         { 2, "Erroneous SDUs are delivered('yes')" },
4868         { 3, "Erroneous SDUs are not delivered('No')" },
4869         { 7, "Reserved" },
4870         { 0, NULL }
4871 };
4872
4873  /* Delivery order, octet 6 (see 3GPP TS 23.107) Bits 5 4 */
4874 const value_string gsm_a_sm_qos_del_order_vals[] = {
4875         { 0, "Subscribed delivery order/Reserved" },
4876         { 1, "With delivery order ('yes')" },
4877         { 2, "Without delivery order ('no')" },
4878         { 3, "Reserved" },
4879         { 0, NULL }
4880 };
4881 /* Traffic class, octet 6 (see 3GPP TS 23.107) Bits 8 7 6 */
4882 const value_string gsm_a_sm_qos_traffic_cls_vals[] = {
4883         { 0, "Subscribed traffic class/Reserved" },
4884         { 1, "Conversational class" },
4885         { 2, "Streaming class" },
4886         { 3, "Interactive class" },
4887         { 4, "Background class" },
4888         { 7, "Reserved" },
4889         { 0, NULL }
4890 };
4891
4892 /* Residual Bit Error Rate (BER), octet 10 (see 3GPP TS 23.107) Bits 8 7 6 5 */
4893 const value_string gsm_a_sm_qos_ber_vals[] = {
4894         { 0, "Subscribed residual BER/Reserved" },
4895         { 1, "5*10-2" },
4896         { 2, "1*10-2" },
4897         { 3, "5*10-3" },
4898         { 4, "4*10-3" },
4899         { 5, "1*10-3" },
4900         { 6, "1*10-4" },
4901         { 7, "1*10-5" },
4902         { 8, "1*10-6" },
4903         { 9, "6*10-8" },
4904         { 10, "Reserved" },
4905         { 0, NULL }
4906 };
4907
4908 /* SDU error ratio, octet 10 (see 3GPP TS 23.107) Bits 4 3 2 1 */
4909 const value_string gsm_a_sm_qos_sdu_err_rat_vals[] = {
4910         { 0, "Subscribed SDU error ratio/Reserved" },
4911         { 1, "1*10-2" },
4912         { 2, "7*10-3" },
4913         { 3, "1*10-3" },
4914         { 4, "1*10-4" },
4915         { 5, "1*10-5" },
4916         { 6, "1*10-6" },
4917         { 7, "1*10-1" },
4918         { 15, "Reserved" },
4919         { 0, NULL }
4920 };
4921
4922 /* Traffic handling priority, octet 11 (see 3GPP TS 23.107) Bits 2 1 */
4923 const value_string gsm_a_sm_qos_traff_hdl_pri_vals[] = {
4924         { 0, "Subscribed traffic handling priority/Reserved" },
4925         { 1, "Priority level 1" },
4926         { 2, "Priority level 2" },
4927         { 3, "Priority level 3" },
4928         { 0, NULL }
4929 };
4930
4931 const range_string gsm_a_sm_qos_peak_thr_vals[] = {
4932         { 0x00, 0x00, "Subscribed peak throughput/reserved" },
4933         { 0x01, 0x01, "Up to 1 000 octet/s" },
4934         { 0x02, 0x02, "Up to 2 000 octet/s" },
4935         { 0x03, 0x03, "Up to 4 000 octet/s" },
4936         { 0x04, 0x04, "Up to 8 000 octet/s" },
4937         { 0x05, 0x05, "Up to 16 000 octet/s" },
4938         { 0x06, 0x06, "Up to 32 000 octet/s" },
4939         { 0x07, 0x07, "Up to 64 000 octet/s" },
4940         { 0x08, 0x08, "Up to 128 000 octet/s" },
4941         { 0x09, 0x09, "Up to 256 000 octet/s" },
4942         { 0x0a, 0x0e, "Interpreted as Up to 1 000 octet/s" },
4943         { 0x0f, 0x0f, "Reserved" },
4944         { 0, 0, NULL }
4945 };
4946
4947 const range_string gsm_a_sm_qos_mean_thr_vals[] = {
4948         { 0x00, 0x00, "Subscribed peak throughput/reserved" },
4949         { 0x01, 0x01, "100 octet/h" },
4950         { 0x02, 0x02, "200 octet/h" },
4951         { 0x03, 0x03, "500 octet/h" },
4952         { 0x04, 0x04, "1 000 octet/h" },
4953         { 0x05, 0x05, "2 000 octet/h" },
4954         { 0x06, 0x06, "5 000 octet/h" },
4955         { 0x07, 0x07, "10 000 octet/h" },
4956         { 0x08, 0x08, "20 000 octet/h" },
4957         { 0x09, 0x09, "50 000 octet/h" },
4958         { 0x0a, 0x0a, "100 000 octet/h" },
4959         { 0x0b, 0x0b, "200 000 octet/h" },
4960         { 0x0c, 0x0c, "500 000 octet/h" },
4961         { 0x0d, 0x0d, "1 000 000 octet/h" },
4962         { 0x0e, 0x0e, "2 000 000 octet/h" },
4963         { 0x0f, 0x0f, "5 000 000 octet/h" },
4964         { 0x10, 0x10, "10 000 000 octet/h" },
4965         { 0x11, 0x11, "20 000 000 octet/h" },
4966         { 0x12, 0x12, "50 000 000 octet/h" },
4967         { 0x13, 0x1d, "Interpreted as Best effort" },
4968         { 0x1e, 0x1e, "Reserved" },
4969         { 0x1f, 0x1f, "Best effort" },
4970         { 0, 0, NULL }
4971 };
4972
4973 const range_string gsm_a_sm_qos_prec_class_vals[] = {
4974         { 0x00, 0x00, "Subscribed precedence/reserved" },
4975         { 0x01, 0x01, "High priority" },
4976         { 0x02, 0x02, "Normal priority" },
4977         { 0x03, 0x03, "Low priority" },
4978         { 0x04, 0x06, "Interpreted as Normal priority" },
4979         { 0x07, 0x07, "Reserved" },
4980         { 0, 0, NULL }
4981 };
4982
4983 const true_false_string gsm_a_sm_qos_signalling_ind_value = {
4984         "Optimised for signalling traffic",
4985         "Not optimised for signalling traffic"
4986 };
4987
4988 /* Helper function returning the main bitrates in kbps */
4989 static guint32
4990 qos_calc_bitrate(guint8 oct)
4991 {
4992         if (oct <= 0x3f)
4993                 return oct;
4994         if (oct <= 0x7f)
4995                 return 64 + (oct-0x40) * 8;
4996
4997         return 576 + (oct-0x80) * 64;
4998 }
4999
5000 /* Helper function returning the extended bitrates in kbps */
5001 static guint32
5002 qos_calc_ext_bitrate(guint8 oct)
5003 {
5004         if (oct <= 0x4a)
5005                 return 8600 + oct * 100;
5006         if (oct <= 0xba)
5007                 return 16000 + (oct-0x4a) * 1000;
5008
5009         return 128000 + (oct - 0xba) * 2000;
5010 }
5011
5012 static guint32
5013 qos_calc_ext2_bitrate(guint8 oct)
5014 {
5015         if (oct <= 0x3d)
5016                 return (256 + oct * 4);
5017         if (oct <= 0xa1)
5018                 return (500 + (oct-0x3d) * 10);
5019         if (oct <= 0xf6)
5020                 return (1500 + (oct-0xa1) * 100);
5021
5022         return 10000;
5023 }
5024
5025 /*
5026  * 10.5.6.5 Quality of service
5027  */
5028 guint16
5029 de_sm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5030 {
5031         guint32      curr_offset;
5032         guchar       oct, tmp_oct;
5033         const gchar *str;
5034         guint32      temp32;
5035
5036         curr_offset = offset;
5037
5038         /* Octet 3 */
5039         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 2, ENC_BIG_ENDIAN);
5040         proto_tree_add_item(tree, hf_gsm_a_sm_qos_delay_cls, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5041         proto_tree_add_item(tree, hf_gsm_a_sm_qos_reliability_cls, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5042         curr_offset += 1;
5043
5044         /* Octet 4 */
5045         proto_tree_add_item(tree, hf_gsm_a_sm_qos_peak_thr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5046         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3) + 4, 1, ENC_BIG_ENDIAN);
5047         proto_tree_add_item(tree, hf_gsm_a_sm_qos_prec_class, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5048         curr_offset += 1;
5049
5050         /* Octet 5 */
5051         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 3, ENC_BIG_ENDIAN);
5052         proto_tree_add_item(tree, hf_gsm_a_sm_qos_mean_thr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5053         curr_offset += 1;
5054
5055         NO_MORE_DATA_CHECK(len);
5056
5057         /* Octet 6 */
5058         proto_tree_add_item(tree, hf_gsm_a_sm_qos_traffic_cls, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5059         proto_tree_add_item(tree, hf_gsm_a_sm_qos_del_order, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5060         proto_tree_add_item(tree, hf_gsm_a_sm_qos_del_of_err_sdu, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5061         curr_offset += 1;
5062
5063         NO_MORE_DATA_CHECK(len);
5064
5065         /* Octet 7 */
5066         oct = tvb_get_guint8(tvb, curr_offset);
5067
5068         switch (oct)
5069         {
5070                 case 0x00: str = "Subscribed maximum SDU size/reserved"; break;
5071                 case 0x97: str = "1502 octets"; break;
5072                 case 0x98: str = "1510 octets"; break;
5073                 case 0x99: str = "1520 octets"; break;
5074                 case 0xff: str = "Reserved"; break;
5075                 default:   str = "Unspecified";
5076         }
5077
5078         if ((oct >= 1) && (oct <= 0x96))
5079                 proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_maximum_sdu_size, tvb, curr_offset, 1, oct, "%u octets (%u)", oct*10, oct);
5080         else
5081                 proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_maximum_sdu_size, tvb, curr_offset, 1, oct, "%s (%u)", str, oct);
5082
5083         curr_offset += 1;
5084
5085         NO_MORE_DATA_CHECK(len);
5086
5087         /* Octet 8 */
5088         oct = tvb_get_guint8(tvb, curr_offset);
5089
5090         switch (oct)
5091         {
5092                 case 0x00: str = "Subscribed maximum bit rate for uplink/reserved"; break;
5093                 case 0xff: str = "0 kbps"; break;
5094                 default:   str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", qos_calc_bitrate(oct));
5095         }
5096
5097         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_upl, tvb,
5098                 curr_offset, 1, oct, "%s (%u)", str, oct);
5099         curr_offset += 1;
5100
5101         NO_MORE_DATA_CHECK(len);
5102
5103         /* Octet 9 */
5104         oct = tvb_get_guint8(tvb, curr_offset);
5105
5106         switch (oct)
5107         {
5108                 case 0x00: str = "Subscribed maximum bit rate for downlink/reserved"; break;
5109                 case 0xff: str = "0 kbps"; break;
5110                 default:   str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", qos_calc_bitrate(oct));
5111         }
5112
5113         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_downl, tvb,
5114                 curr_offset, 1, oct, "%s (%u)", str, oct);
5115         curr_offset += 1;
5116
5117         NO_MORE_DATA_CHECK(len);
5118
5119         /* Octet 10 */
5120         proto_tree_add_item(tree, hf_gsm_a_sm_qos_ber, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5121         proto_tree_add_item(tree, hf_gsm_a_sm_qos_sdu_err_rat, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5122
5123         curr_offset += 1;
5124         NO_MORE_DATA_CHECK(len);
5125
5126         /* Octet 11 */
5127         oct = tvb_get_guint8(tvb, curr_offset);
5128
5129         tmp_oct = oct>>2;
5130         switch (tmp_oct)
5131         {
5132                 case 0x00: str = "Subscribed transfer delay/reserved"; break;
5133                 case 0x3f: str = "Reserved"; break;
5134                 default:
5135                         if (tmp_oct <= 0x0f)
5136                                 temp32 = tmp_oct * 10;
5137                         else if (tmp_oct <= 0x1f)
5138                                 temp32 = (tmp_oct - 0x10) * 50 + 200;
5139                         else
5140                                 temp32 = (tmp_oct - 0x20) * 100 + 1000;
5141                         str = wmem_strdup_printf(wmem_packet_scope(), "%u ms", temp32);
5142         }
5143
5144         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_trans_delay, tvb,
5145                 curr_offset, 1, oct, "%s (%u)", str, tmp_oct);
5146
5147         proto_tree_add_item(tree, hf_gsm_a_sm_qos_traff_hdl_pri, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5148
5149         curr_offset += 1;
5150         NO_MORE_DATA_CHECK(len);
5151
5152         /* Octet 12 */
5153         oct = tvb_get_guint8(tvb, curr_offset);
5154
5155         switch (oct)
5156         {
5157                 case 0x00: str = "Subscribed guaranteed bit rate for uplink/reserved"; break;
5158                 case 0xff: str = "0 kbps"; break;
5159                 default:   str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", qos_calc_bitrate(oct));
5160         }
5161
5162         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_guar_bitrate_upl, tvb,
5163                 curr_offset, 1, oct, "%s (%u)", str, oct);
5164
5165         curr_offset += 1;
5166         NO_MORE_DATA_CHECK(len);
5167
5168         /* Octet 13 */
5169         oct = tvb_get_guint8(tvb, curr_offset);
5170
5171         switch (oct)
5172         {
5173                 case 0x00: str = "Subscribed guaranteed bit rate for downlink/reserved"; break;
5174                 case 0xff: str = "0 kbps"; break;
5175                 default:   str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", qos_calc_bitrate(oct));
5176         }
5177
5178         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_guar_bitrate_downl, tvb,
5179                 curr_offset, 1, oct, "%s (%u)", str, oct);
5180
5181         curr_offset += 1;
5182         NO_MORE_DATA_CHECK(len);
5183
5184         /* Ocet 14 */
5185         oct = tvb_get_guint8(tvb, curr_offset);
5186         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 3, ENC_BIG_ENDIAN);
5187         proto_tree_add_item(tree, hf_gsm_a_sm_qos_signalling_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5188
5189         tmp_oct = oct & 7;
5190         if (tmp_oct == 0x01)
5191                 str = "speech";
5192         else
5193                 str = "unknown";
5194
5195         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_source_stat_desc, tvb,
5196                 curr_offset, 1, oct, "%s (%u)", str, tmp_oct);
5197
5198         curr_offset += 1;
5199         NO_MORE_DATA_CHECK(len);
5200
5201         /* Octet 15 */
5202         oct = tvb_get_guint8(tvb, curr_offset);
5203
5204         if (oct == 0x00)
5205                 str = "Use the value indicated by the Maximum bit rate for downlink";
5206         else
5207         {
5208                 temp32 = qos_calc_ext_bitrate(oct);
5209                 if (temp32 % 1000 == 0)
5210                         str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000);
5211                 else
5212                         str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32);
5213         }
5214         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_downl_ext, tvb,
5215                 curr_offset, 1, oct, "%s (%u)", str, oct);
5216
5217         curr_offset += 1;
5218         NO_MORE_DATA_CHECK(len);
5219
5220         /* Octet 16 */
5221         oct = tvb_get_guint8(tvb, curr_offset);
5222
5223         if (oct == 0x00)
5224                 str = "Use the value indicated by the Guaranteed bit rate for downlink";
5225         else
5226         {
5227                 temp32 = qos_calc_ext_bitrate(oct);
5228                 if (temp32 % 1000 == 0)
5229                         str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000);
5230                 else
5231                         str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32);
5232         }
5233         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_guar_bitrate_downl_ext, tvb,
5234                 curr_offset, 1, oct, "%s (%u)", str, oct);
5235
5236         curr_offset += 1;
5237         NO_MORE_DATA_CHECK(len);
5238
5239         /* Maximum bit rate for uplink (extended) Octet 17 */
5240         oct = tvb_get_guint8(tvb, curr_offset);
5241
5242         if (oct == 0x00)
5243                 str = "Use the value indicated by the Maximum bit rate for uplink";
5244         else
5245         {
5246                 temp32 = qos_calc_ext_bitrate(oct);
5247                 if (temp32 % 1000 == 0)
5248                         str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000);
5249                 else
5250                         str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32);
5251         }
5252         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_upl_ext, tvb,
5253                 curr_offset, 1, oct, "%s (%u)", str, oct);
5254
5255         curr_offset += 1;
5256         NO_MORE_DATA_CHECK(len);
5257
5258         /* Guaranteed bit rate for uplink (extended) Octet 18 */
5259         oct = tvb_get_guint8(tvb, curr_offset);
5260
5261         if (oct == 0x00)
5262                 str = "Use the value indicated by the Guaranteed bit rate for uplink";
5263         else
5264         {
5265                 temp32 = qos_calc_ext_bitrate(oct);
5266                 if (temp32 % 1000 == 0)
5267                         str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000);
5268                 else
5269                         str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32);
5270         }
5271         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_guar_bitrate_upl_ext, tvb,
5272                 curr_offset, 1, oct, "%s (%u)", str, oct);
5273
5274         curr_offset += 1;
5275         NO_MORE_DATA_CHECK(len);
5276
5277         /* Maximum bit rate for downlink (extended-2) Octet 19 */
5278         oct = tvb_get_guint8(tvb, curr_offset);
5279
5280         if (oct == 0x00)
5281                 str = "Use the value indicated by the Maximum bit rate for downlink";
5282         else
5283         {
5284                 temp32 = qos_calc_ext2_bitrate(oct);
5285                 str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32);
5286         }
5287         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_downl_ext2, tvb,
5288                 curr_offset, 1, oct, "%s (%u)", str, oct);
5289
5290         curr_offset += 1;
5291         NO_MORE_DATA_CHECK(len);
5292
5293         /* Guaranteed bit rate for downlink (extended-2) Octet 20 */
5294         oct = tvb_get_guint8(tvb, curr_offset);
5295
5296         if (oct == 0x00)
5297                 str = "Use the value indicated by the Guaranteed bit rate for downlink";
5298         else
5299         {
5300                 temp32 = qos_calc_ext2_bitrate(oct);
5301                 str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32);
5302         }
5303         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_guar_bitrate_downl_ext2, tvb,
5304                 curr_offset, 1, oct, "%s (%u)", str, oct);
5305
5306         curr_offset += 1;
5307         NO_MORE_DATA_CHECK(len);
5308
5309         /* Maximum bit rate for uplink (extended-2) Octet 21 */
5310         oct = tvb_get_guint8(tvb, curr_offset);
5311
5312         if (oct == 0x00)
5313                 str = "Use the value indicated by the Maximum bit rate for uplink";
5314         else
5315         {
5316                 temp32 = qos_calc_ext2_bitrate(oct);
5317                 str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32);
5318         }
5319         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_upl_ext2, tvb,
5320                 curr_offset, 1, oct, "%s (%u)", str, oct);
5321
5322         curr_offset += 1;
5323         NO_MORE_DATA_CHECK(len);
5324
5325         /* Guaranteed bit rate for uplink (extended-2) Octet 22 */
5326         oct = tvb_get_guint8(tvb, curr_offset);
5327
5328         if (oct == 0x00)
5329                 str = "Use the value indicated by the Guaranteed bit rate for uplink";
5330         else
5331         {
5332                 temp32 = qos_calc_ext2_bitrate(oct);
5333                 str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32);
5334         }
5335         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_guar_bitrate_upl_ext2, tvb,
5336                 curr_offset, 1, oct, "%s (%u)", str, oct);
5337
5338         curr_offset += 1;
5339
5340         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
5341
5342         return (curr_offset - offset);
5343 }
5344
5345 /*
5346  * [12] 10.5.6.5a Re-attempt indicator
5347  */
5348 const true_false_string gsm_a_gm_eplmnc_value = {
5349         "MS is not allowed to re-attempt the procedure in an equivalent PLMN",
5350         "MS is allowed to re-attempt the procedure in an equivalent PLMN"
5351 };
5352
5353 const true_false_string gsm_a_gm_ratc_value = {
5354         "MS is not allowed to re-attempt the procedure in S1 mode",
5355         "MS is allowed to re-attempt the procedure in S1 mode"
5356 };
5357
5358 static guint16
5359 de_sm_re_attempt_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5360 {
5361         guint32 curr_offset;
5362
5363         curr_offset = offset;
5364
5365         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, offset << 3, 6, ENC_BIG_ENDIAN);
5366         proto_tree_add_item(tree, hf_gsm_a_sm_eplmnc, tvb, offset, 1, ENC_BIG_ENDIAN);
5367         proto_tree_add_item(tree, hf_gsm_a_sm_ratc, tvb, offset, 1, ENC_BIG_ENDIAN);
5368         curr_offset++;
5369
5370         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
5371
5372         return len;
5373 }
5374
5375 /*
5376  * [15] 10.5.6.5b Extended quality of service
5377  */
5378 static guint16
5379 de_sm_ext_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5380 {
5381         guint32 curr_offset;
5382
5383         curr_offset = offset;
5384
5385         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
5386
5387         return len;
5388 }
5389
5390 /*
5391  * [9] 10.5.6.6 SM cause
5392  */
5393 static const value_string gsm_a_sm_cause_vals[] = {
5394         { 0x08, "Operator Determined Barring" },
5395         { 0x18, "MBMS bearer capabilities insufficient for the service" },
5396         { 0x19, "LLC or SNDCP failure(A/Gb only)" },
5397         { 0x1a, "Insufficient resources" },
5398         { 0x1b, "Missing or unknown APN" },
5399         { 0x1c, "Unknown PDP address or PDP type" },
5400         { 0x1d, "User authentication failed" },
5401         { 0x1e, "Activation rejected by GGSN, Serving GW or PDN GW" },
5402         { 0x1f, "Activation rejected, unspecified" },
5403         { 0x20, "Service option not supported" },
5404         { 0x21, "Requested service option not subscribed" },
5405         { 0x22, "Service option temporarily out of order" },
5406         { 0x23, "NSAPI already used (not sent)" },
5407         { 0x24, "Regular deactivation" },
5408         { 0x25, "QoS not accepted" },
5409         { 0x26, "Network failure" },
5410         { 0x27, "Reactivation requested" },
5411         { 0x28, "Feature not supported" },
5412         { 0x29, "Semantic error in the TFT operation" },
5413         { 0x2a, "Syntactical error in the TFT operation" },
5414         { 0x2b, "Unknown PDP context" },
5415         { 0x2c, "Semantic errors in packet filter(s)" },
5416         { 0x2d, "Syntactical errors in packet filter(s)" },
5417         { 0x2e, "PDP context without TFT already activated" },
5418         { 0x2f, "Multicast group membership time-out" },
5419         { 0x30, "Request rejected, BCM violation" },
5420         { 0x32, "PDP type IPv4 only allowed" },
5421         { 0x33, "PDP type IPv6 only allowed" },
5422         { 0x34, "Single address bearers only allowed" },
5423         { 0x38, "Collision with network initiated request" },
5424         { 0x39, "PDP type IPv4v6 only allowed" },
5425         { 0x3a, "PDP type non IP only allowed" },
5426         { 0x3c, "Bearer handling not supported" },
5427         { 0x41, "Maximum number of PDP contexts reached" },
5428         { 0x42, "Requested APN not supported in current RAT and PLMN combination" },
5429         { 0x51, "Invalid transaction identifier value" },
5430         { 0x5f, "Semantically incorrect message" },
5431         { 0x60, "Invalid mandatory information" },
5432         { 0x61, "Message type non-existent or not implemented" },
5433         { 0x62, "Message type not compatible with the protocol state" },
5434         { 0x63, "Information element non-existent or not implemented" },
5435         { 0x64, "Conditional IE error" },
5436         { 0x65, "Message not compatible with the protocol state" },
5437         { 0x6f, "Protocol error, unspecified" },
5438         { 0x70, "APN restriction value incompatible with active PDP context" },
5439         { 0x71, "Multiple accesses to a PDN connection not allowed" },
5440         { 0, NULL }
5441 };
5442 static value_string_ext gsm_a_sm_cause_vals_ext = VALUE_STRING_EXT_INIT(gsm_a_sm_cause_vals);
5443
5444 static guint16
5445 de_sm_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
5446 {
5447         guint8       oct;
5448         const gchar *str;
5449
5450         oct = tvb_get_guint8(tvb, offset);
5451
5452         /* SM Cause can be sent in both directions */
5453         str = val_to_str_ext_const(oct, &gsm_a_sm_cause_vals_ext,
5454                                "Protocol error, unspecified / Service option temporarily out of order");
5455
5456         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_cause, tvb,
5457                                 offset, 1, oct, "%s (%u)", str, oct);
5458
5459         /* no length check possible */
5460         return (1);
5461 }
5462
5463 /*
5464  * [9] 10.5.6.6a SM cause 2
5465  */
5466 static guint16
5467 de_sm_cause_2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
5468 {
5469         guint8       oct;
5470         const gchar *str;
5471
5472         oct = tvb_get_guint8(tvb, offset);
5473
5474         /* SM Cause 2 is sent only in the Network-to-MS direction */
5475         str = val_to_str_ext_const(oct, &gsm_a_sm_cause_vals_ext,
5476                                "Service option temporarily out of order");
5477
5478         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_cause_2, tvb,
5479                                 offset, 1, oct, "%s (%u)", str, oct);
5480
5481         /* no length check possible */
5482         return (1);
5483 }
5484 /*
5485  * [7] 10.5.6.7
5486  */
5487
5488 static const true_false_string gsm_a_sm_ti_flag_vals = {
5489         "The message is sent to the side that originates the TI",
5490         "The message is sent from the side that originates the TI"
5491 };
5492
5493 static guint16
5494 de_sm_linked_ti(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5495 {
5496         guint32 curr_offset;
5497         guint   curr_len;
5498         gchar   oct;
5499
5500         curr_len    = len;
5501         curr_offset = offset;
5502
5503         oct = tvb_get_guint8(tvb, curr_offset);
5504
5505         proto_tree_add_item(tree, hf_gsm_a_sm_ti_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
5506
5507         /* The TI value and the TI flag occupy bits 5 - 7 and bit 8 of the first octet respectively.
5508          * The extended TI shall not be used unless TI values of 7 or greater are needed.
5509          * Where the extended TI is used, the TI IE includes a second octet. The TI value in the first octet is ignored, and the TI
5510          * value is encoded in bits 7-1 of the second octet.
5511          */
5512
5513         if (curr_len > 1)
5514         {
5515                 curr_offset++;
5516                 oct = tvb_get_guint8(tvb, curr_offset);
5517
5518                 proto_tree_add_uint(tree, hf_gsm_a_gm_ti_value, tvb, curr_offset, 1, oct&0x7f);
5519
5520                 proto_tree_add_item(tree, hf_gsm_a_sm_ext, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5521
5522                 curr_offset++;
5523         }
5524         else
5525         {
5526                 proto_tree_add_uint(tree, hf_gsm_a_gm_ti_value, tvb, curr_offset, 1, (oct>>4)&7);
5527                 curr_offset++;
5528         }
5529
5530
5531         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
5532
5533         return (curr_offset - offset);
5534 }
5535
5536 /*
5537  * [9] 10.5.6.9 LLC service access point identifier
5538  */
5539 static const value_string gsm_a_sm_llc_sapi_vals[] = {
5540         { 0, "LLC SAPI not assigned" },
5541         { 3, "SAPI 3" },
5542         { 5, "SAPI 5" },
5543         { 9, "SAPI 9" },
5544         { 11, "SAPI 11" },
5545         { 0, NULL }
5546 };
5547
5548 static guint16
5549 de_sm_sapi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
5550 {
5551         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
5552         proto_tree_add_item(tree, hf_gsm_a_sm_llc_sapi, tvb, offset, 1, ENC_BIG_ENDIAN);
5553
5554         /* no length check possible */
5555         return (1);
5556 }
5557
5558 /*
5559  * [9] 10.5.6.10 Tear down indicator
5560  */
5561 const true_false_string gsm_a_sm_tdi_value = {
5562         "Tear down requested",
5563         "Tear down not requested"
5564 };
5565
5566 static guint16
5567 de_sm_tear_down(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
5568 {
5569         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 3, ENC_BIG_ENDIAN);
5570         proto_tree_add_item(tree, hf_gsm_a_sm_tdi, tvb, offset, 1, ENC_BIG_ENDIAN);
5571
5572         /* no length check possible */
5573         return (1);
5574 }
5575
5576 /*
5577  * [9] 10.5.6.11 Packet Flow Identifier
5578  */
5579 static const range_string gsm_a_sm_packet_flow_id_vals[] = {
5580         { 0x00, 0x00, "Best Effort"},
5581         { 0x01, 0x01, "Signalling"},
5582         { 0x02, 0x02, "SMS"},
5583         { 0x03, 0x03, "TOM8"},
5584         { 0x04, 0x07, "Reserved"},
5585         { 0x08, 0x7f, "Dynamically assigned"},
5586         { 0x00, 0x00, NULL }
5587 };
5588
5589 guint16
5590 de_sm_pflow_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5591 {
5592         guint32 curr_offset;
5593         guint   value;
5594
5595         curr_offset = offset;
5596         value = tvb_get_guint8(tvb, curr_offset);
5597         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, curr_offset << 3, 1, ENC_BIG_ENDIAN);
5598         proto_tree_add_item(tree, hf_gsm_a_sm_packet_flow_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5599         curr_offset++;
5600
5601         if (add_string)
5602                 g_snprintf(add_string, string_len, " - %s", rval_to_str(value, gsm_a_sm_packet_flow_id_vals, "Unknown"));
5603
5604         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
5605
5606         return (curr_offset - offset);
5607 }
5608
5609 /*
5610  * [7] 10.5.6.12     TFT - Traffic Flow Template
5611  */
5612 /* TFT operation code (octet 3) */
5613 static const value_string gsm_a_sm_tft_op_code_vals[] = {
5614         { 0,            "Ignore this IE"},
5615         { 1,            "Create new TFT"},
5616         { 2,            "Delete existing TFT"},
5617         { 3,            "Add packet filters to existing TFT"},
5618         { 4,            "Replace packet filters in existing TFT"},
5619         { 5,            "Delete packet filters from existing TFT"},
5620         { 6,            "No TFT operation"},
5621         { 7,            "Reserved"},
5622         { 0,    NULL }
5623 };
5624
5625 static const true_false_string gsm_a_sm_tft_e_bit  = {
5626         "Parameters list is included",
5627         "Parameters list is not included"
5628 };
5629
5630 static const value_string gsm_a_sm_tft_pkt_flt_dir_vals[] = {
5631         { 0,    "Pre Rel-7 TFT filter"},
5632         { 1,    "Downlink only"},
5633         { 2,    "Uplink only"},
5634         { 3,    "Bidirectional"},
5635         { 0,    NULL }
5636 };
5637
5638 static const value_string gsm_a_sm_tft_param_id_vals[] = {
5639         { 1,    "Authorization Token"},
5640         { 2,    "Flow Identifier"},
5641         { 3,    "Packet Filter Identifier"},
5642         { 0,    NULL }
5643 };
5644
5645 static const value_string packet_filter_component_type_vals[] = {
5646         {0x10,  "IPv4 remote address type" },
5647         {0x11,  "IPv4 local address type"},
5648         {0x20,  "IPv6 remote address type"},
5649         {0x21,  "IPv6 remote address/prefix length type"},
5650         {0x23,  "IPv6 local address/prefix length type"},
5651         {0x30,  "Protocol identifier/Next header type"},
5652         {0x40,  "Single local port type"},
5653         {0x41,  "Local port range type"},
5654         {0x50,  "Single remote port type"},
5655         {0x51,  "Remote port range type"},
5656         {0x60,  "Security parameter index type"},
5657         {0x70,  "Type of service/Traffic class type"},
5658         {0x80,  "Flow label type"},
5659         {0, NULL}
5660 };
5661
5662 guint16
5663 de_sm_tflow_temp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5664 {
5665         guint32       curr_offset, prev_offset;
5666         guint         curr_len;
5667         guint8        op_code;
5668         guint8        pkt_fil_count;
5669         guint8        e_bit;
5670         guint8        count;
5671         guint8        oct;
5672         gint          pf_length;
5673         gint          i;
5674         gint          pack_component_type;
5675         gint          param;
5676
5677         curr_len    = len;
5678         curr_offset = offset;
5679
5680         /*
5681          * parse first octet. It contain TFT operation code, E bit and Number of packet filters
5682          */
5683         oct = tvb_get_guint8(tvb, curr_offset);
5684
5685         op_code = oct>>5;
5686         pkt_fil_count = oct&0x0f;
5687         e_bit = (oct>>4)&1;
5688
5689         proto_tree_add_item(tree, hf_gsm_a_sm_tft_op_code, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5690         proto_tree_add_item(tree, hf_gsm_a_sm_tft_e_bit,   tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5691         proto_tree_add_item(tree, hf_gsm_a_sm_tft_pkt_flt, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5692
5693         curr_offset++;
5694         curr_len--;
5695
5696         /* Packet filter list dissect */
5697
5698         count = 0;
5699         if (op_code == 2)                       /* delete TFT contains no packet filters. so we will jump over it */
5700                 count = pkt_fil_count;
5701         while (count < pkt_fil_count)
5702         {
5703                 proto_item *tf_pf;
5704                 proto_tree *tf_tree;
5705                 prev_offset = curr_offset;
5706                 tf_pf = proto_tree_add_uint(tree, hf_gsm_a_sm_tft_packet_filter, tvb, curr_offset, 1, count);   /* 0-> 7 */
5707
5708                 tf_tree = proto_item_add_subtree(tf_pf, ett_sm_tft);
5709
5710                 if ((curr_offset-offset)<1) {
5711                         proto_tree_add_expert(tf_tree, pinfo, &ei_gsm_a_gm_not_enough_data, tvb, curr_offset, 1);
5712                         return (len);
5713                 }
5714
5715                 if (op_code == 5)  /* Delete packet filters from existing TFT - just a list of identifiers */
5716                 {
5717                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 4, ENC_BIG_ENDIAN);
5718                         oct = tvb_get_guint8(tvb, curr_offset) & 0x0f;
5719                         proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_sm_tft_pkt_flt_id, tvb, curr_offset, 1, oct, "%d (%d)", oct+1, oct);
5720                         curr_offset++;
5721                         curr_len--;
5722                         count++;
5723                 }
5724                 else                            /* create new, Add packet filters or Replace packet filters */
5725                 {
5726                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 2, ENC_BIG_ENDIAN);
5727                         proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_pkt_flt_dir, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5728                         oct = tvb_get_guint8(tvb, curr_offset) & 0x0f;
5729                         proto_tree_add_uint_format_value(tf_tree, hf_gsm_a_sm_tft_pkt_flt_id, tvb, curr_offset, 1, oct, "%d (%d)", oct+1, oct);
5730                         curr_offset++;
5731                         curr_len--;
5732
5733                         if ((curr_offset-offset) < 1) {
5734                                 proto_tree_add_expert(tf_tree, pinfo, &ei_gsm_a_gm_not_enough_data, tvb, curr_offset, 1);
5735                                 return (len);
5736                         }
5737                         proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_packet_evaluation_precedence, tvb, curr_offset, 1, ENC_NA);
5738                         curr_offset++;
5739                         curr_len--;
5740
5741                         if ((curr_offset-offset)<1) {
5742                                 proto_tree_add_expert(tf_tree, pinfo, &ei_gsm_a_gm_not_enough_data, tvb, curr_offset, 1);
5743                                 return (len);
5744                         }
5745                         pf_length = tvb_get_guint8(tvb, curr_offset);
5746                         proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_packet_filter_length, tvb, curr_offset, 1, ENC_NA);
5747                         curr_offset++;
5748                         curr_len--;
5749
5750                         /* New tree for component */
5751
5752                         /* Dissect Packet filter Component */
5753                         /* while (filter_len > 1) */
5754                         /* packet filter component type identifier: */
5755
5756                         while (pf_length > 0) {
5757                                 proto_item *tf;
5758                                 proto_tree *comp_tree;
5759                                 if ((curr_offset-offset) < 1) {
5760                                         proto_tree_add_expert(tf_tree, pinfo, &ei_gsm_a_gm_not_enough_data, tvb, curr_offset, 1);
5761                                         return (len);
5762                                 }
5763                                 pack_component_type = tvb_get_guint8(tvb, curr_offset);
5764                                 tf = proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_packet_filter_component_type_id, tvb, curr_offset, 1, ENC_NA);
5765                                 comp_tree = proto_item_add_subtree(tf, ett_sm_tft);
5766
5767                                 curr_offset++;
5768                                 curr_len--;
5769                                 pf_length--;
5770
5771                                 switch (pack_component_type) {
5772
5773                                 case 0x10:
5774                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip4_address, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
5775                                         curr_offset += 4;
5776                                         curr_len    -= 4;
5777                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip4_mask, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
5778                                         curr_offset += 4;
5779                                         curr_len    -= 4;
5780                                         pf_length   -= 8;
5781                                         break;
5782
5783                                 case 0x11:
5784                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip4_address, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
5785                                         curr_offset += 4;
5786                                         curr_len    -= 4;
5787                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip4_mask, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
5788                                         curr_offset += 4;
5789                                         curr_len    -= 4;
5790                                         pf_length   -= 8;
5791                                         break;
5792
5793                                 case 0x20:
5794                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip6_address, tvb, curr_offset, 16, ENC_NA);
5795                                         curr_offset += 16;
5796                                         curr_len    -= 16;
5797                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip6_mask, tvb, curr_offset, 16, ENC_NA);
5798                                         curr_offset += 16;
5799                                         curr_len    -= 16;
5800                                         pf_length   -= 32;
5801                                         break;
5802
5803                                 case 0x21:
5804                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip6_address, tvb, curr_offset, 16, ENC_NA);
5805                                         curr_offset += 16;
5806                                         curr_len    -= 16;
5807                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip6_prefix_length, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5808                                         curr_offset += 1;
5809                                         curr_len    -= 1;
5810                                         pf_length   -= 17;
5811                                         break;
5812
5813                                 case 0x23:
5814                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip6_address, tvb, curr_offset, 16, ENC_NA);
5815                                         curr_offset += 16;
5816                                         curr_len    -= 16;
5817                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_ip6_prefix_length, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5818                                         curr_offset += 1;
5819                                         curr_len    -= 1;
5820                                         pf_length   -= 17;
5821                                         break;
5822
5823                                 case 0x30:
5824                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_protocol_header, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5825                                         curr_offset += 1;
5826                                         curr_len    -= 1;
5827                                         pf_length   -= 1;
5828                                         break;
5829
5830                                 case 0x40:
5831                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_port, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
5832                                         curr_offset += 2;
5833                                         curr_len    -= 2;
5834                                         pf_length   -= 2;
5835                                         break;
5836
5837                                 case 0x41:
5838                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_port_low, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
5839                                         curr_offset += 2;
5840                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_port_high, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
5841                                         curr_offset += 2;
5842                                         curr_len    -= 4;
5843                                         pf_length   -= 4;
5844                                         break;
5845
5846                                 case 0x50:
5847                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_port, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
5848                                         curr_offset += 2;
5849                                         curr_len    -= 2;
5850                                         pf_length   -= 2;
5851                                         break;
5852
5853                                 case 0x51:
5854                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_port_low, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
5855                                         curr_offset += 2;
5856                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_port_high, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
5857                                         curr_offset += 2;
5858                                         curr_len    -= 4;
5859                                         pf_length   -= 4;
5860                                         break;
5861
5862                                 case 0x60:
5863                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_security, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
5864                                         curr_offset += 4;
5865                                         curr_len    -= 4;
5866                                         pf_length   -= 4;
5867                                         break;
5868
5869
5870                                 case 0x70:
5871                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_traffic_class, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5872                                         curr_offset++;
5873                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_traffic_mask, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5874                                         curr_offset++;
5875                                         curr_len-=2;
5876                                         pf_length-=2;
5877                                         break;
5878
5879                                 case 0x80:
5880                                         proto_tree_add_bits_item(comp_tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 4, ENC_BIG_ENDIAN);
5881                                         proto_tree_add_item(comp_tree, hf_gsm_a_sm_tft_flow_label_type, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
5882                                         curr_offset += 3;
5883                                         curr_len    -= 3;
5884                                         pf_length   -= 3;
5885                                         break;
5886
5887                                 default:
5888                                         curr_offset += pf_length;
5889                                         curr_len    -= pf_length;
5890                                         pf_length    = 0;
5891                                 }
5892                         }
5893                         count++;
5894                 }
5895                 proto_item_set_len(tf_pf, curr_offset - prev_offset);
5896         }
5897
5898         /* The parameters list contains a variable number of parameters that might need to be
5899          * transferred in addition to the packet filters. If the parameters list is included, the E
5900          * bit is set to 1; otherwise, the E bit is set to 0.
5901          */
5902         if ((e_bit == 1) && curr_len) {
5903                 count = 0;
5904                 while (curr_len) {
5905                         proto_tree *tf_tree;
5906                         pf_length = tvb_get_guint8(tvb, curr_offset+1);
5907                         tf_tree   = proto_tree_add_subtree_format(tree, tvb, curr_offset, pf_length+2, ett_sm_tft, NULL, "Parameter %d", count);
5908                         param     = tvb_get_guint8(tvb, curr_offset);
5909                         proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_param_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5910                         curr_offset += 2;
5911                         curr_len    -= 2;
5912                         switch (param) {
5913                         case 0x01:
5914                                 proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_authorization_token_value, tvb, curr_offset, pf_length, ENC_NA);
5915                                 break;
5916
5917                         case 0x02:
5918                                 proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_media_component_number_value, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
5919                                 proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_ip_flow_number, tvb, curr_offset+2, 2, ENC_BIG_ENDIAN);
5920                                 break;
5921
5922                         case 0x03:
5923                                 for (i=0; i<pf_length; i++) {
5924                                         oct = tvb_get_guint8(tvb, curr_offset+i) & 0x0f;
5925                                         proto_tree_add_uint_format(tf_tree, hf_gsm_a_sm_tft_packet_filter_identifier, tvb, curr_offset+i, 1, oct+1, "Packet filter identifier %d: %d (%d)", i, oct+1, oct);
5926                                 }
5927                                 break;
5928
5929                         default:
5930                                 proto_tree_add_item(tf_tree, hf_gsm_a_sm_tft_parameter_content, tvb, curr_offset, pf_length, ENC_NA);
5931                                 break;
5932                         }
5933                         curr_offset += pf_length;
5934                         curr_len    -= pf_length;
5935                         count++;
5936                 }
5937         }
5938
5939         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
5940
5941         return (len);
5942 }
5943
5944 /*
5945  * [9] 10.5.6.13 Temporary Mobile Group Identity (TMGI)
5946  */
5947 static guint16
5948 de_sm_tmgi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5949 {
5950         guint32 curr_offset;
5951
5952         curr_offset = offset;
5953
5954         proto_tree_add_item(tree, hf_gsm_a_sm_tmgi, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
5955         curr_offset += 3;
5956
5957         NO_MORE_DATA_CHECK(len);
5958         curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, E212_NONE, TRUE);
5959
5960         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
5961
5962         return (curr_offset - offset);
5963 }
5964
5965 /*
5966  * [9] 10.5.6.14 MBMS bearer capabilities
5967  */
5968 static guint16
5969 de_sm_mbms_bearer_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
5970 {
5971         guint32      curr_offset, temp32;
5972         guint8       oct;
5973         const gchar *str;
5974
5975         curr_offset = offset;
5976
5977         oct = tvb_get_guint8(tvb, curr_offset);
5978
5979         switch (oct)
5980         {
5981                 case 0x00: str = "Subscribed maximum bit rate for downlink/reserved"; break;
5982                 case 0xff: str = "0 kbps"; break;
5983                 default:   str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", qos_calc_bitrate(oct));
5984         }
5985
5986         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_downl, tvb,
5987                 curr_offset, 1, oct, "%s (%u)", str, oct);
5988         curr_offset += 1;
5989
5990         NO_MORE_DATA_CHECK(len);
5991
5992         oct = tvb_get_guint8(tvb, curr_offset);
5993
5994         if (oct == 0x00)
5995                 str = "Use the value indicated by the Maximum bit rate for downlink";
5996         else
5997         {
5998                 temp32 = qos_calc_ext_bitrate(oct);
5999                 if (temp32 % 1000 == 0)
6000                         str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000);
6001                 else
6002                         str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32);
6003         }
6004         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_qos_max_bitrate_downl_ext, tvb,
6005                 curr_offset, 1, oct, "%s (%u)", str, oct);
6006
6007         curr_offset += 1;
6008
6009         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
6010
6011         return (curr_offset - offset);
6012 }
6013
6014 /*
6015  * [9] 10.5.6.15 MBMS protocol configuration options
6016  */
6017 static guint16
6018 de_sm_mbms_prot_conf_opt(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6019 {
6020         guint32 curr_offset;
6021
6022         curr_offset = offset;
6023         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 8, ENC_BIG_ENDIAN);
6024         curr_offset++;
6025
6026         EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_gm_extraneous_data);
6027
6028         return (curr_offset - offset);
6029 }
6030
6031 /*
6032  * [9] 10.5.6.16 Enhanced network service access point identifier
6033  */
6034 static guint16
6035 de_sm_enh_nsapi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6036 {
6037         guint8       oct;
6038         const gchar *str;
6039
6040         oct = tvb_get_guint8(tvb, offset);
6041
6042         if(oct < 0x80)
6043                 str = "Reserved";
6044         else if (oct < 0xff)
6045                         str = wmem_strdup_printf(wmem_packet_scope(), "NSAPI %u for Multimedia Broadcast/Multicast Service (MBMS) Multicast mode", oct);
6046                 else
6047                         str = "Reserved for use by lower layers in the p2p radio bearer allocation message for MBMS Broadcast mode";
6048
6049
6050         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_enh_nsapi, tvb,
6051                 offset, 1, oct, "%s (%u)", str, oct);
6052
6053         /* no length check possible */
6054         return (1);
6055 }
6056
6057 /*
6058  * [9] 10.5.6.17 Request type
6059  */
6060 static const value_string gsm_a_sm_req_type_vals[] = {
6061         { 0x01, "Initial request" },
6062         { 0x02, "Handover" },
6063         { 0x03, "Unused. If received, the network shall interpret this as \"Initial request\"." },
6064         { 0x04, "Emergency" },
6065         { 0x06, "Handover of emergency bearer services" },
6066         { 0, NULL }
6067 };
6068
6069 static guint16
6070 de_sm_req_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
6071 {
6072         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset<<3) + 4, 1, ENC_BIG_ENDIAN);
6073         proto_tree_add_item(tree, hf_gsm_a_sm_req_type, tvb, offset, 1, ENC_BIG_ENDIAN);
6074
6075         /* no length check possible */
6076         return (1);
6077 }
6078
6079 /*
6080  * [9] 10.5.6.18 Notification indicator
6081  */
6082 static const value_string gsm_a_sm_notif_ind_vals[] = {
6083         { 0x0,  "Reserved"},
6084         { 0x1,  "SRVCC handover cancelled, IMS session re-establishment required"},
6085         { 0, NULL }
6086 };
6087
6088 static guint16
6089 de_sm_notif_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6090 {
6091         guint32 curr_offset;
6092
6093         curr_offset = offset;
6094
6095         proto_tree_add_item(tree, hf_gsm_a_sm_notif_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
6096
6097         return (len);
6098 }
6099
6100 /*
6101  * [10] 10.5.6.19 Connectivity type
6102  */
6103 static const range_string gsm_a_sm_connectivity_type_vals[] = {
6104         { 0x0,  0x0, "The PDN connection type is not indicated"},
6105         { 0x1,  0x1, "The PDN connection is considered a LIPA PDN connection"},
6106         { 0x2,  0xF, "The PDN connection type is not indicated"},
6107         { 0, 0, NULL }
6108 };
6109
6110 static guint16
6111 de_sm_connectivity_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6112 {
6113         proto_tree_add_item(tree, hf_gsm_a_sm_connectivity_type, tvb, offset, 1, ENC_BIG_ENDIAN);
6114
6115         return (len);
6116 }
6117
6118 /*
6119  * [12] 10.5.6.20 WLAN offload acceptability
6120  */
6121 static const true_false_string gsm_a_sm_wlan_utran_offload_accept_value = {
6122         "Offloading the traffic of the PDN connection via a WLAN when in Iu mode is acceptable",
6123         "Offloading the traffic of the PDN connection via a WLAN when in Iu mode is not acceptable"
6124 };
6125
6126 static const true_false_string gsm_a_sm_wlan_eutran_offload_accept_value = {
6127         "Offloading the traffic of the PDN connection via a WLAN when in S1 mode is acceptable",
6128         "Offloading the traffic of the PDN connection via a WLAN when in S1 mode is not acceptable"
6129 };
6130
6131 static guint16
6132 de_sm_wlan_offload_accept(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6133 {
6134         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset<<3)+4, 2, ENC_BIG_ENDIAN);
6135         proto_tree_add_bits_item(tree, hf_gsm_a_sm_wlan_utran_offload_accept, tvb, (offset<<3)+6, 1, ENC_BIG_ENDIAN);
6136         proto_tree_add_bits_item(tree, hf_gsm_a_sm_wlan_eutran_offload_accept, tvb, (offset<<3)+7, 1, ENC_BIG_ENDIAN);
6137
6138         return (len);
6139 }
6140
6141 /*
6142  * [13] 10.5.6.21 NBIFOM container
6143  */
6144 static guint16
6145 de_sm_nbifom_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
6146 {
6147         if (nbifom_handle) {
6148                 tvbuff_t *nbifom_tvb = tvb_new_subset_length(tvb, offset, len);
6149
6150                 call_dissector(nbifom_handle, nbifom_tvb, pinfo, tree);
6151         } else {
6152                 proto_tree_add_item(tree, hf_gsm_a_sm_nbifom_cont, tvb, offset, len, ENC_NA);
6153         }
6154
6155         return len;
6156 }
6157
6158 guint16 (*gm_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) = {
6159         /* GPRS Mobility Management Information Elements 10.5.5 */
6160         de_gmm_add_upd_type,               /* Additional Update Type */
6161         de_gmm_attach_res,                 /* Attach Result */
6162         de_gmm_attach_type,                /* Attach Type */
6163         de_gmm_ciph_alg,                   /* Ciphering Algorithm */
6164         de_gmm_integ_alg,                  /* Integrity Algorithm */
6165         de_gmm_tmsi_stat,                  /* TMSI Status */
6166         de_gmm_detach_type,                /* Detach Type */
6167         de_gmm_drx_param,                  /* DRX Parameter */
6168         de_gmm_ftostby,                    /* Force to Standby */
6169         de_gmm_ftostby_h,                  /* Force to Standby - Info is in the high nibble */
6170         de_gmm_ptmsi_sig,                  /* P-TMSI Signature */
6171         de_gmm_ptmsi_sig2,                 /* P-TMSI Signature 2 */
6172         de_gmm_ident_type2,                /* Identity Type 2 */
6173         de_gmm_imeisv_req,                 /* IMEISV Request */
6174         de_gmm_rec_npdu_lst,               /* Receive N-PDU Numbers List */
6175         de_gmm_ms_net_cap,                 /* MS Network Capability */
6176         de_gmm_ms_radio_acc_cap,           /* MS Radio Access Capability */
6177         de_gmm_cause,                      /* GMM Cause */
6178         de_gmm_rai,                        /* Routing Area Identification */
6179         de_gmm_rai2,                       /* Routing Area Identification 2 */
6180         de_gmm_update_res,                 /* Update Result */
6181         de_gmm_update_type,                /* Update Type */
6182         de_gmm_ac_ref_nr,                  /* A&C Reference Number */
6183         de_gmm_ac_ref_nr_h,                /* A&C Reference Number - Info is in the high nibble */
6184         de_gmm_service_type,               /* Service Type */
6185         NULL  /* no associated data */,    /* Cell Notification */
6186         de_gmm_ps_lcs_cap,                 /* PS LCS Capability */
6187         de_gmm_net_feat_supp,              /* Network Feature Support */
6188         de_gmm_add_net_feat_supp,          /* Network Feature Support */
6189         de_gmm_rat_info_container,         /* Inter RAT information container */
6190         de_gmm_req_ms_info,                /* Requested MS information */
6191         NULL,                              /* UE network capability */
6192         de_gmm_eutran_irat_info_container, /* E-UTRAN inter RAT information container */
6193         de_gmm_voice_domain_pref,          /* Voice domain preference and UE's usage setting */
6194         de_gmm_ptmsi_type,                 /* P-TMSI type */
6195         de_gmm_lai_2,                      /* Location Area Identification 2 */
6196         de_gmm_net_res_id_cont,            /* Network resource identifier container */
6197         de_gmm_ext_drx_params,             /* Extended DRX parameters */
6198         de_gmm_mac,                        /* Message authentication code */
6199         de_gmm_up_integ_ind,               /* User Plane integrity indicator */
6200         de_gmm_dcn_id,                     /* DCN-ID */
6201         de_gmm_plmn_id_cn_operator,        /* PLMN identity of the CN operator */
6202         de_gmm_non_3gpp_nw_prov_pol,       /* Non-3GPP NW provided policies */
6203         /* Session Management Information Elements 10.5.6 */
6204         de_sm_apn,                         /* Access Point Name */
6205         de_sm_nsapi,                       /* Network Service Access Point Identifier */
6206         de_sm_pco,                         /* Protocol Configuration Options */
6207         de_sm_pco,                         /* Extended Protocol Configuration Options */
6208         de_sm_pdp_addr,                    /* Packet Data Protocol Address */
6209         de_sm_qos,                         /* Quality Of Service */
6210         de_sm_re_attempt_ind,              /* Re-attempt indicator */
6211         de_sm_ext_qos,                     /* Extended quality of service */
6212         de_sm_cause,                       /* SM Cause */
6213         de_sm_cause_2,                     /* SM Cause 2 */
6214         de_sm_linked_ti,                   /* Linked TI */
6215         de_sm_sapi,                        /* LLC Service Access Point Identifier */
6216         de_sm_tear_down,                   /* Tear Down Indicator */
6217         de_sm_pflow_id,                    /* Packet Flow Identifier */
6218         de_sm_tflow_temp,                  /* Traffic Flow Template */
6219         de_sm_tmgi,                        /* Temporary Mobile Group Identity (TMGI) */
6220         de_sm_mbms_bearer_cap,             /* MBMS bearer capabilities */
6221         de_sm_mbms_prot_conf_opt,          /* MBMS protocol configuration options */
6222         de_sm_enh_nsapi,                   /* Enhanced network service access point identifier */
6223         de_sm_req_type,                    /* Request type */
6224         de_sm_notif_ind,                   /* Notification indicator */
6225         de_sm_connectivity_type,           /* Connectivity type */
6226         de_sm_wlan_offload_accept,         /* WLAN offload acceptability */
6227         de_sm_nbifom_cont,                 /* NBIFOM container */
6228         /* GPRS Common Information Elements 10.5.7 */
6229         de_gc_context_stat,                /* PDP Context Status */
6230         de_gc_radio_prio,                  /* Radio Priority */
6231         de_gc_timer,                       /* GPRS Timer */
6232         de_gc_timer2,                      /* GPRS Timer 2 */
6233         de_gc_timer3,                      /* GPRS Timer 3 */
6234         de_gc_radio_prio2,                 /* Radio Priority 2 */
6235         de_gc_mbms_context_stat,           /* 10.5.7.6 MBMS context status */
6236         de_gc_uplink_data_stat,            /* 10.5.7.7 Uplink data status */
6237         de_gc_device_properties,           /* 10.5.7.8 Device properties */
6238         NULL,   /* NONE */
6239 };
6240
6241 /* MESSAGE FUNCTIONS */
6242
6243 /*
6244  * [7] 9.4.1
6245  */
6246 static void
6247 dtap_gmm_attach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6248 {
6249         guint32 curr_offset;
6250         guint32 consumed;
6251         guint   curr_len;
6252
6253         curr_offset = offset;
6254         curr_len    = len;
6255
6256         pinfo->p2p_dir = P2P_DIR_RECV;
6257
6258         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP, NULL, ei_gsm_a_gm_missing_mandatory_element);
6259
6260         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_ATTACH_TYPE, GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, ei_gsm_a_gm_missing_mandatory_element);
6261
6262         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_DRX_PARAM, NULL, ei_gsm_a_gm_missing_mandatory_element);
6263
6264         ELEM_MAND_LV( GSM_A_PDU_TYPE_COMMON, DE_MID, NULL, ei_gsm_a_gm_missing_mandatory_element);
6265
6266         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAI, " - Old routing area identification", ei_gsm_a_gm_missing_mandatory_element);
6267
6268         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP, NULL, ei_gsm_a_gm_missing_mandatory_element);
6269
6270         ELEM_OPT_TV( 0x19, GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, " - Old P-TMSI Signature");
6271
6272         ELEM_OPT_TV( 0x17, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - Ready Timer");
6273
6274         ELEM_OPT_TV_SHORT( 0x90, GSM_A_PDU_TYPE_GM, DE_TMSI_STAT, NULL);
6275
6276         ELEM_OPT_TLV( 0x33, GSM_A_PDU_TYPE_GM, DE_PS_LCS_CAP, NULL);
6277
6278         ELEM_OPT_TLV( 0x11, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL);
6279
6280         ELEM_OPT_TLV( 0x20, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_3, NULL);
6281
6282         ELEM_OPT_TLV( 0x40, GSM_A_PDU_TYPE_DTAP, DE_SUP_CODEC_LIST, NULL);
6283
6284         ELEM_OPT_TLV( 0x58, NAS_PDU_TYPE_EMM, DE_EMM_UE_NET_CAP, NULL);
6285
6286         ELEM_OPT_TLV( 0x1A, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Additional mobile identity");
6287
6288         ELEM_OPT_TLV( 0x1B, GSM_A_PDU_TYPE_GM, DE_RAI_2, " - Additional old routing area identification");
6289
6290         ELEM_OPT_TLV( 0x5D, GSM_A_PDU_TYPE_GM, DE_VOICE_DOMAIN_PREF, NULL);
6291
6292         ELEM_OPT_TV_SHORT(0xD0, GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
6293
6294         ELEM_OPT_TV_SHORT(0xE0, GSM_A_PDU_TYPE_GM, DE_PTMSI_TYPE, NULL);
6295
6296         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_COMMON, DE_MS_NET_FEAT_SUP, NULL);
6297
6298         ELEM_OPT_TLV(0x14, GSM_A_PDU_TYPE_GM, DE_LAI_2, " - Old location area identification");
6299
6300         ELEM_OPT_TV_SHORT(0xF0, GSM_A_PDU_TYPE_GM, DE_ADD_UPD_TYPE, NULL);
6301
6302         ELEM_OPT_TLV(0x10, GSM_A_PDU_TYPE_GM, DE_NET_RES_ID_CONT, " - TMSI based NRI container");
6303
6304         ELEM_OPT_TLV(0x6A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3324 value");
6305
6306         ELEM_OPT_TLV(0x39, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3312 extended value");
6307
6308         ELEM_OPT_TLV(0x6E, GSM_A_PDU_TYPE_GM, DE_EXT_DRX_PARAMS, NULL);
6309
6310         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6311 }
6312
6313 /*
6314  * [7] 9.4.2
6315  */
6316 static void
6317 dtap_gmm_attach_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6318 {
6319         guint32 curr_offset;
6320         guint32 consumed;
6321         guint   curr_len;
6322
6323         curr_offset = offset;
6324         curr_len    = len;
6325
6326         pinfo->p2p_dir = P2P_DIR_SENT;
6327
6328         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_ATTACH_RES, GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND_H, ei_gsm_a_gm_missing_mandatory_element);
6329
6330         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, NULL, ei_gsm_a_gm_missing_mandatory_element);
6331
6332         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAD_PRIO_2, " - Radio priority for TOM8", ei_gsm_a_gm_missing_mandatory_element);
6333         curr_len++;
6334         curr_offset--;
6335
6336         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, " - Radio priority for SMS", ei_gsm_a_gm_missing_mandatory_element);
6337
6338         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAI, NULL, ei_gsm_a_gm_missing_mandatory_element);
6339
6340         ELEM_OPT_TV( 0x19, GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, NULL);
6341
6342         ELEM_OPT_TV( 0x17, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - Negotiated Ready Timer");
6343
6344         ELEM_OPT_TLV( 0x18, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Allocated P-TMSI");
6345
6346         ELEM_OPT_TLV( 0x23, GSM_A_PDU_TYPE_COMMON, DE_MID, NULL);
6347
6348         ELEM_OPT_TV( 0x25, GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
6349
6350         ELEM_OPT_TLV( 0x2A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3302 value");
6351
6352         ELEM_OPT_T( 0x8C, GSM_A_PDU_TYPE_GM, DE_CELL_NOT, NULL);
6353
6354         ELEM_OPT_TLV( 0x4A, GSM_A_PDU_TYPE_COMMON, DE_PLMN_LIST, NULL);
6355
6356         ELEM_OPT_TV_SHORT( 0xB0, GSM_A_PDU_TYPE_GM, DE_NET_FEAT_SUP, NULL);
6357
6358         ELEM_OPT_TLV( 0x34, GSM_A_PDU_TYPE_DTAP, DE_EMERGENCY_NUM_LIST, NULL);
6359
6360         ELEM_OPT_TV_SHORT( 0xA0, GSM_A_PDU_TYPE_GM, DE_REQ_MS_INFO, NULL);
6361
6362         ELEM_OPT_TLV( 0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3319 value");
6363
6364         ELEM_OPT_TLV( 0x38, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3323 value" );
6365
6366         ELEM_OPT_TLV(0x39, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3312 extended value");
6367
6368         ELEM_OPT_TLV(0x66, GSM_A_PDU_TYPE_GM, DE_ADD_NET_FEAT_SUP, NULL);
6369
6370         ELEM_OPT_TLV(0x6A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3324 value");
6371
6372         ELEM_OPT_TLV(0x6E, GSM_A_PDU_TYPE_GM, DE_EXT_DRX_PARAMS, NULL);
6373
6374         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_GM, DE_UP_INTEG_IND, NULL);
6375
6376         ELEM_OPT_TLV(0x31, GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP, " - Replayed MS network capability");
6377
6378         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP, " - Replayed MS Radio Access capability");
6379
6380         ELEM_OPT_TLV(0x65, GSM_A_PDU_TYPE_GM, DE_DCN_ID, NULL);
6381
6382         ELEM_OPT_TLV(0x63, GSM_A_PDU_TYPE_GM, DE_PLMN_ID_CN_OPERATOR, NULL);
6383
6384         ELEM_OPT_TV_SHORT(0xD0, GSM_A_PDU_TYPE_GM, DE_NON_3GPP_NW_PROV_POL, NULL);
6385
6386         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6387 }
6388
6389 /*
6390  * [7] 9.4.3
6391  */
6392 static void
6393 dtap_gmm_attach_com(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6394 {
6395
6396         guint32 curr_offset;
6397         guint32 consumed;
6398         guint   curr_len;
6399
6400         curr_offset = offset;
6401         curr_len    = len;
6402
6403         pinfo->p2p_dir = P2P_DIR_RECV;
6404
6405         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_RAT_INFO_CONTAINER, " - Inter RAT handover information");
6406
6407         ELEM_OPT_TLV( 0x2B, GSM_A_PDU_TYPE_GM, DE_EUTRAN_IRAT_INFO_CONTAINER, " - E-UTRAN inter RAT handover information");
6408
6409         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6410 }
6411
6412 /*
6413  * [7] 9.4.4
6414  */
6415 static void
6416 dtap_gmm_attach_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6417 {
6418         guint32 curr_offset;
6419         guint32 consumed;
6420         guint   curr_len;
6421
6422         curr_offset = offset;
6423         curr_len    = len;
6424
6425         pinfo->p2p_dir = P2P_DIR_SENT;
6426
6427         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
6428
6429         ELEM_OPT_TLV( 0x2A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3302 value" );
6430
6431         ELEM_OPT_TLV(0x3A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3346 value");
6432
6433         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6434 }
6435
6436 /*
6437  * [7] 9.4.5
6438  */
6439 static void
6440 dtap_gmm_detach_req_MT(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6441 {
6442         guint32 curr_offset;
6443         guint32 consumed;
6444         guint   curr_len;
6445
6446         curr_offset = offset;
6447         curr_len    = len;
6448
6449         pinfo->p2p_dir = P2P_DIR_SENT;
6450
6451         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_DETACH_TYPE, GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND_H, ei_gsm_a_gm_missing_mandatory_element);
6452
6453         ELEM_OPT_TV( 0x25, GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
6454
6455         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6456 }
6457
6458 static void
6459 dtap_gmm_detach_req_MO(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6460 {
6461         guint32 curr_offset;
6462         guint32 consumed;
6463         guint   curr_len;
6464
6465         curr_offset = offset;
6466         curr_len    = len;
6467
6468         pinfo->p2p_dir = P2P_DIR_RECV;
6469
6470         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_DETACH_TYPE, GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, ei_gsm_a_gm_missing_mandatory_element);
6471
6472         ELEM_OPT_TLV( 0x18, GSM_A_PDU_TYPE_COMMON, DE_MID, NULL);
6473
6474         ELEM_OPT_TLV( 0x19, GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG_2, NULL);
6475
6476         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6477 }
6478
6479 static void
6480 dtap_gmm_detach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6481 {
6482         if (pinfo->link_dir == P2P_DIR_UL) {
6483                 dtap_gmm_detach_req_MO(tvb, tree, pinfo, offset, len);
6484                 return;
6485         }else if (pinfo->link_dir == P2P_DIR_DL) {
6486                 dtap_gmm_detach_req_MT(tvb, tree, pinfo, offset, len);
6487                 return;
6488         } else {
6489                 /* Unknown direction. Try heuristics based on message length. */
6490                 if (len > 5) {
6491                         dtap_gmm_detach_req_MO(tvb, tree, pinfo, offset, len);
6492                 } else {
6493                         dtap_gmm_detach_req_MT(tvb, tree, pinfo, offset, len);
6494                 }
6495         }
6496 }
6497
6498 /*
6499  * [7] 9.4.6
6500  */
6501 static void
6502 dtap_gmm_detach_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6503 {
6504         guint32 curr_offset;
6505         guint   curr_len;
6506
6507         curr_offset = offset;
6508         curr_len    = len;
6509
6510         pinfo->p2p_dir = P2P_DIR_RECV;
6511
6512         if (curr_len == 0) {
6513                 return;
6514         }
6515
6516         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, ei_gsm_a_gm_missing_mandatory_element);
6517
6518         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6519 }
6520
6521 /*
6522  * [7] 9.4.7
6523  */
6524 static void
6525 dtap_gmm_ptmsi_realloc_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6526 {
6527         guint32 curr_offset;
6528         guint32 consumed;
6529         guint   curr_len;
6530
6531         curr_offset = offset;
6532         curr_len    = len;
6533
6534         pinfo->p2p_dir = P2P_DIR_SENT;
6535
6536         ELEM_MAND_LV( GSM_A_PDU_TYPE_COMMON, DE_MID, " - Allocated P-TMSI", ei_gsm_a_gm_missing_mandatory_element);
6537
6538         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAI, NULL, ei_gsm_a_gm_missing_mandatory_element);
6539
6540         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, ei_gsm_a_gm_missing_mandatory_element);
6541
6542         ELEM_OPT_TV( 0x19, GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, " - P-TMSI Signature" );
6543
6544         ELEM_OPT_TLV(0x65, GSM_A_PDU_TYPE_GM, DE_DCN_ID, NULL);
6545
6546         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6547 }
6548
6549 /*
6550  * [7] 9.4.8
6551  */
6552 static void
6553 dtap_gmm_ptmsi_realloc_com(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6554 {
6555         guint32 curr_offset;
6556 /*    guint32   consumed; */
6557         guint   curr_len;
6558
6559         curr_offset = offset;
6560         curr_len    = len;
6561
6562         pinfo->p2p_dir = P2P_DIR_RECV;
6563
6564         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6565 }
6566
6567 /*
6568  * [7] 9.4.9
6569  */
6570 static void
6571 dtap_gmm_auth_ciph_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6572 {
6573         guint32 curr_offset;
6574         guint32 consumed;
6575         guint   curr_len;
6576
6577         curr_offset = offset;
6578         curr_len    = len;
6579
6580         pinfo->p2p_dir = P2P_DIR_SENT;
6581
6582         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_CIPH_ALG, GSM_A_PDU_TYPE_GM, DE_IMEISV_REQ, ei_gsm_a_gm_missing_mandatory_element);
6583
6584         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, GSM_A_PDU_TYPE_GM, DE_AC_REF_NUM_H, ei_gsm_a_gm_missing_mandatory_element);
6585
6586         ELEM_OPT_TV(0x21, GSM_A_PDU_TYPE_DTAP, DE_AUTH_PARAM_RAND, NULL);
6587
6588         ELEM_OPT_TV_SHORT(0x80, GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, NULL);
6589
6590         ELEM_OPT_TLV(0x28, GSM_A_PDU_TYPE_DTAP, DE_AUTH_PARAM_AUTN, NULL);
6591
6592         ELEM_OPT_TLV(0x31, GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP, " - Replayed MS network capability");
6593
6594         ELEM_OPT_TLV(0x42, GSM_A_PDU_TYPE_GM, DE_INTEG_ALG, NULL);
6595
6596         ELEM_OPT_TLV(0x43, GSM_A_PDU_TYPE_GM, DE_MAC, NULL);
6597
6598         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP, " - Replayed MS Radio Access capability");
6599
6600         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6601 }
6602
6603 /*
6604  * [7] 9.4.10
6605  */
6606 static void
6607 dtap_gmm_auth_ciph_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6608 {
6609         guint32 curr_offset;
6610         guint32 consumed;
6611         guint   curr_len;
6612
6613         curr_offset = offset;
6614         curr_len    = len;
6615
6616         pinfo->p2p_dir = P2P_DIR_RECV;
6617
6618         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_AC_REF_NUM, GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, ei_gsm_a_gm_missing_mandatory_element);
6619
6620         ELEM_OPT_TV(0x22, GSM_A_PDU_TYPE_DTAP, DE_AUTH_RESP_PARAM, NULL);
6621
6622         ELEM_OPT_TLV(0x23, GSM_A_PDU_TYPE_COMMON, DE_MID, " - IMEISV" );
6623
6624         ELEM_OPT_TLV(0x29, GSM_A_PDU_TYPE_DTAP, DE_AUTH_RESP_PARAM_EXT, NULL);
6625
6626         ELEM_OPT_TLV(0x43, GSM_A_PDU_TYPE_GM, DE_MAC, NULL);
6627
6628         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6629 }
6630
6631 /*
6632  * [7] 9.4.11
6633  */
6634 static void
6635 dtap_gmm_auth_ciph_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6636 {
6637         guint32 curr_offset;
6638         guint   curr_len;
6639
6640         curr_offset = offset;
6641         curr_len    = len;
6642
6643         pinfo->p2p_dir = P2P_DIR_SENT;
6644
6645         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6646 }
6647
6648 /*
6649  * [7] 9.4.10a
6650  */
6651 static void
6652 dtap_gmm_auth_ciph_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6653 {
6654         guint32 curr_offset;
6655         guint32 consumed;
6656         guint   curr_len;
6657
6658         curr_offset = offset;
6659         curr_len    = len;
6660
6661         pinfo->p2p_dir = P2P_DIR_RECV;
6662
6663         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
6664
6665         ELEM_OPT_TLV( 0x30, GSM_A_PDU_TYPE_DTAP, DE_AUTH_FAIL_PARAM, NULL);
6666
6667         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6668 }
6669
6670 /*
6671  * [7] 9.4.12
6672  */
6673 static void
6674 dtap_gmm_ident_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6675 {
6676         guint32 curr_offset;
6677         guint   curr_len;
6678
6679         curr_offset = offset;
6680         curr_len    = len;
6681
6682         pinfo->p2p_dir = P2P_DIR_SENT;
6683
6684         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_ID_TYPE_2, GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND_H, ei_gsm_a_gm_missing_mandatory_element);
6685
6686         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6687 }
6688
6689 /*
6690  * [7] 9.4.13
6691  */
6692 static void
6693 dtap_gmm_ident_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6694 {
6695         guint32 curr_offset;
6696         guint32 consumed;
6697         guint   curr_len;
6698
6699         curr_offset = offset;
6700         curr_len    = len;
6701
6702         pinfo->p2p_dir = P2P_DIR_RECV;
6703
6704         ELEM_MAND_LV( GSM_A_PDU_TYPE_COMMON, DE_MID, NULL, ei_gsm_a_gm_missing_mandatory_element);
6705
6706         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6707 }
6708
6709 /*
6710  * [7] 9.4.14
6711  */
6712 static void
6713 dtap_gmm_rau_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6714 {
6715         guint32 curr_offset;
6716         guint32 consumed;
6717         guint   curr_len;
6718
6719         curr_offset = offset;
6720         curr_len    = len;
6721
6722         pinfo->p2p_dir = P2P_DIR_RECV;
6723
6724         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_UPD_TYPE, GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, ei_gsm_a_gm_missing_mandatory_element);
6725
6726         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAI, " - Old routing area identification", ei_gsm_a_gm_missing_mandatory_element);
6727
6728         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP, NULL, ei_gsm_a_gm_missing_mandatory_element);
6729
6730         ELEM_OPT_TV( 0x19, GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, " - Old P-TMSI Signature" );
6731
6732         ELEM_OPT_TV( 0x17, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - Requested Ready Timer" );
6733
6734         ELEM_OPT_TV( 0x27, GSM_A_PDU_TYPE_GM, DE_DRX_PARAM, NULL);
6735
6736         ELEM_OPT_TV_SHORT( 0x90, GSM_A_PDU_TYPE_GM, DE_TMSI_STAT, NULL);
6737
6738         ELEM_OPT_TLV( 0x18, GSM_A_PDU_TYPE_COMMON, DE_MID, " - P-TMSI" );
6739
6740         ELEM_OPT_TLV( 0x31, GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP, NULL);
6741
6742         ELEM_OPT_TLV( 0x32, GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT, NULL);
6743
6744         ELEM_OPT_TLV( 0x33, GSM_A_PDU_TYPE_GM, DE_PS_LCS_CAP, NULL);
6745
6746         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS, NULL);
6747
6748         ELEM_OPT_TLV( 0x58, NAS_PDU_TYPE_EMM, DE_EMM_UE_NET_CAP, NULL);
6749
6750         ELEM_OPT_TLV( 0x1A, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Additional mobile identity");
6751
6752         ELEM_OPT_TLV( 0x1B, GSM_A_PDU_TYPE_GM, DE_RAI_2, " - Additional old routing area identification");
6753
6754         ELEM_OPT_TLV( 0x11, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL);
6755
6756         ELEM_OPT_TLV( 0x20, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_3, NULL);
6757
6758         ELEM_OPT_TLV( 0x40, GSM_A_PDU_TYPE_DTAP, DE_SUP_CODEC_LIST, NULL);
6759
6760         ELEM_OPT_TLV( 0x5D, GSM_A_PDU_TYPE_GM, DE_VOICE_DOMAIN_PREF, NULL);
6761
6762         ELEM_OPT_TV_SHORT(0xE0, GSM_A_PDU_TYPE_GM, DE_PTMSI_TYPE, NULL);
6763
6764         ELEM_OPT_TV_SHORT(0xD0, GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
6765
6766         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_COMMON, DE_MS_NET_FEAT_SUP, NULL);
6767
6768         ELEM_OPT_TLV(0x14, GSM_A_PDU_TYPE_GM, DE_LAI_2, " - Old location area identification");
6769
6770         ELEM_OPT_TV_SHORT(0xF0, GSM_A_PDU_TYPE_GM, DE_ADD_UPD_TYPE, NULL);
6771
6772         ELEM_OPT_TLV(0x10, GSM_A_PDU_TYPE_GM, DE_NET_RES_ID_CONT, " - TMSI based NRI container");
6773
6774         ELEM_OPT_TLV(0x6A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3324 value");
6775
6776         ELEM_OPT_TLV(0x39, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3312 extended value");
6777
6778         ELEM_OPT_TLV(0x6E, GSM_A_PDU_TYPE_GM, DE_EXT_DRX_PARAMS, NULL);
6779
6780         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6781 }
6782
6783 /*
6784  * [7] 9.4.15
6785  */
6786 static void
6787 dtap_gmm_rau_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6788 {
6789         guint32 curr_offset;
6790         guint32 consumed;
6791         guint   curr_len;
6792
6793         curr_offset = offset;
6794         curr_len    = len;
6795
6796         pinfo->p2p_dir = P2P_DIR_SENT;
6797
6798         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, GSM_A_PDU_TYPE_GM, DE_UPD_RES, ei_gsm_a_gm_missing_mandatory_element);
6799
6800         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - Periodic RA update timer", ei_gsm_a_gm_missing_mandatory_element);
6801
6802         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAI, NULL, ei_gsm_a_gm_missing_mandatory_element);
6803
6804         ELEM_OPT_TV( 0x19, GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, NULL);
6805
6806         ELEM_OPT_TLV( 0x18, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Allocated P-TMSI");
6807
6808         ELEM_OPT_TLV( 0x23, GSM_A_PDU_TYPE_COMMON, DE_MID, " - MS identity");
6809
6810         ELEM_OPT_TLV( 0x26, GSM_A_PDU_TYPE_GM, DE_REC_N_PDU_NUM_LIST, NULL);
6811
6812         ELEM_OPT_TV( 0x17, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - Negotiated Ready Timer" );
6813
6814         ELEM_OPT_TV( 0x25, GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
6815
6816         ELEM_OPT_TLV( 0x2A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3302 value" );
6817
6818         ELEM_OPT_T( 0x8C, GSM_A_PDU_TYPE_GM, DE_CELL_NOT, NULL);
6819
6820         ELEM_OPT_TLV( 0x4A, GSM_A_PDU_TYPE_COMMON, DE_PLMN_LIST, NULL);
6821
6822         ELEM_OPT_TLV( 0x32, GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT, NULL);
6823
6824         ELEM_OPT_TV_SHORT( 0xB0, GSM_A_PDU_TYPE_GM, DE_NET_FEAT_SUP, NULL);
6825
6826         ELEM_OPT_TLV( 0x34, GSM_A_PDU_TYPE_DTAP, DE_EMERGENCY_NUM_LIST, NULL);
6827
6828         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS, NULL);
6829
6830         ELEM_OPT_TV_SHORT( 0xA0, GSM_A_PDU_TYPE_GM, DE_REQ_MS_INFO, NULL);
6831
6832         ELEM_OPT_TLV( 0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3319 value");
6833
6834         ELEM_OPT_TLV( 0x38, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3323 value");
6835
6836         ELEM_OPT_TLV(0x39, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3312 extended value");
6837
6838         ELEM_OPT_TLV(0x66, GSM_A_PDU_TYPE_GM, DE_ADD_NET_FEAT_SUP, NULL);
6839
6840         ELEM_OPT_TLV(0x6A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3324 value");
6841
6842         ELEM_OPT_TLV(0x6E, GSM_A_PDU_TYPE_GM, DE_EXT_DRX_PARAMS, NULL);
6843
6844         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_GM, DE_UP_INTEG_IND, NULL);
6845
6846         ELEM_OPT_TLV(0x31, GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP, " - Replayed MS network capability");
6847
6848         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP, " - Replayed MS Radio Access capability");
6849
6850         ELEM_OPT_TLV(0x65, GSM_A_PDU_TYPE_GM, DE_DCN_ID, NULL);
6851
6852         ELEM_OPT_TLV(0x63, GSM_A_PDU_TYPE_GM, DE_PLMN_ID_CN_OPERATOR, NULL);
6853
6854         ELEM_OPT_TV_SHORT(0xD0, GSM_A_PDU_TYPE_GM, DE_NON_3GPP_NW_PROV_POL, NULL);
6855
6856         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6857 }
6858
6859 /*
6860  * [7] 9.4.16
6861  */
6862 static void
6863 dtap_gmm_rau_com(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6864 {
6865         guint32 curr_offset;
6866         guint32 consumed;
6867         guint   curr_len;
6868
6869         curr_offset = offset;
6870         curr_len    = len;
6871
6872         pinfo->p2p_dir = P2P_DIR_RECV;
6873         /* [7] 10.5.5.11 */
6874         ELEM_OPT_TLV( 0x26, GSM_A_PDU_TYPE_GM, DE_REC_N_PDU_NUM_LIST, NULL);
6875         /* Inter RAT information container 10.5.5.24 TS 24.008 version 6.8.0 Release 6 */
6876         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_RAT_INFO_CONTAINER, " - Inter RAT handover information");
6877
6878         ELEM_OPT_TLV( 0x2B, GSM_A_PDU_TYPE_GM, DE_EUTRAN_IRAT_INFO_CONTAINER, " - E-UTRAN inter RAT handover information");
6879
6880         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6881 }
6882
6883 /*
6884  * [7] 9.4.17
6885  */
6886 static void
6887 dtap_gmm_rau_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6888 {
6889         guint32 curr_offset;
6890         guint32 consumed;
6891         guint   curr_len;
6892
6893         curr_offset = offset;
6894         curr_len    = len;
6895
6896         pinfo->p2p_dir = P2P_DIR_SENT;
6897
6898         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
6899
6900         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, ei_gsm_a_gm_missing_mandatory_element);
6901
6902         ELEM_OPT_TLV(0x2A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3302 value");
6903
6904         ELEM_OPT_TLV(0x3A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3346 value");
6905
6906         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6907 }
6908
6909 /*
6910  * [7] 9.4.18
6911  */
6912 static void
6913 dtap_gmm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6914 {
6915         guint32 curr_offset;
6916         guint32 consumed;
6917         guint   curr_len;
6918
6919         curr_offset = offset;
6920         curr_len    = len;
6921
6922         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6923
6924         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
6925
6926         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6927 }
6928
6929 /*
6930  * [8] 9.4.19 GMM Information
6931  */
6932 static void
6933 dtap_gmm_information(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6934 {
6935         guint32 curr_offset;
6936         guint32 consumed;
6937         guint   curr_len;
6938
6939         curr_offset = offset;
6940         curr_len    = len;
6941
6942         pinfo->p2p_dir = P2P_DIR_SENT;
6943
6944         ELEM_OPT_TLV( 0x43, GSM_A_PDU_TYPE_DTAP, DE_NETWORK_NAME, " - Full Name" );
6945
6946         ELEM_OPT_TLV( 0x45, GSM_A_PDU_TYPE_DTAP, DE_NETWORK_NAME, " - Short Name" );
6947
6948         ELEM_OPT_TV( 0x46, GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE, NULL);
6949
6950         ELEM_OPT_TV( 0x47, GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE_TIME, NULL);
6951
6952         ELEM_OPT_TLV( 0x48, GSM_A_PDU_TYPE_DTAP, DE_LSA_ID, NULL);
6953
6954         ELEM_OPT_TLV( 0x49, GSM_A_PDU_TYPE_DTAP, DE_DAY_SAVING_TIME, NULL);
6955
6956         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6957 }
6958
6959 /*
6960  * [7] 9.4.20
6961  */
6962 static void
6963 dtap_gmm_service_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6964 {
6965         guint32 curr_offset;
6966         guint32 consumed;
6967         guint   curr_len;
6968
6969         curr_offset = offset;
6970         curr_len    = len;
6971
6972         pinfo->p2p_dir = P2P_DIR_RECV;
6973
6974         ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, GSM_A_PDU_TYPE_GM, DE_SRVC_TYPE, ei_gsm_a_gm_missing_mandatory_element);
6975
6976         /* P-TMSI Mobile station identity 10.5.1.4 M LV 6 */
6977         ELEM_MAND_LV( GSM_A_PDU_TYPE_COMMON, DE_MID, NULL, ei_gsm_a_gm_missing_mandatory_element);
6978
6979         ELEM_OPT_TLV( 0x32, GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT, NULL);
6980
6981         /* MBMS context status 10.5.7.6 TLV 2 - 18 */
6982         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS, NULL);
6983
6984         ELEM_OPT_TLV( 0x36, GSM_A_PDU_TYPE_GM, DE_UPLINK_DATA_STATUS, NULL);
6985
6986         ELEM_OPT_TV_SHORT(0xD0, GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
6987
6988         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
6989 }
6990
6991 /*
6992  * [7] 9.4.21
6993  */
6994 static void
6995 dtap_gmm_service_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6996 {
6997         guint32 curr_offset;
6998         guint32 consumed;
6999         guint   curr_len;
7000
7001         curr_offset = offset;
7002         curr_len    = len;
7003
7004         pinfo->p2p_dir = P2P_DIR_SENT;
7005
7006         ELEM_OPT_TLV( 0x32, GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT, NULL);
7007
7008         /* MBMS context status 10.5.7.6 TLV 2 - 18 */
7009         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS, NULL);
7010
7011         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7012 }
7013
7014 /*
7015  * [7] 9.4.22
7016  */
7017 static void
7018 dtap_gmm_service_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7019 {
7020         guint32 curr_offset;
7021         guint32 consumed;
7022         guint   curr_len;
7023
7024         curr_offset = offset;
7025         curr_len    = len;
7026
7027         pinfo->p2p_dir = P2P_DIR_SENT;
7028
7029         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7030
7031         ELEM_OPT_TLV(0x3A, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3346 value");
7032
7033         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7034 }
7035
7036 /*
7037  * [8] 9.5.1 Activate PDP context request
7038  * Direction:                   MS to network
7039  */
7040 static void
7041 dtap_sm_act_pdp_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7042 {
7043         guint32 curr_offset;
7044         guint32 consumed;
7045         guint   curr_len;
7046
7047         curr_offset = offset;
7048         curr_len    = len;
7049
7050         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7051         /* MS to network */
7052         pinfo->link_dir = P2P_DIR_UL;
7053
7054         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_NET_SAPI, " - Requested NSAPI", ei_gsm_a_gm_missing_mandatory_element);
7055
7056         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI", ei_gsm_a_gm_missing_mandatory_element);
7057
7058         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_QOS, " - Requested QoS", ei_gsm_a_gm_missing_mandatory_element);
7059
7060         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR, " - Requested PDP address", ei_gsm_a_gm_missing_mandatory_element);
7061
7062         ELEM_OPT_TLV( 0x28, GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME, NULL);
7063
7064         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7065
7066         ELEM_OPT_TV_SHORT( 0xA0, GSM_A_PDU_TYPE_GM, DE_REQ_TYPE, NULL);
7067
7068         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
7069
7070         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7071
7072         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7073
7074         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7075
7076         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7077 }
7078
7079 /*
7080  * [9] 9.5.2 Activate PDP context accept
7081  * Direction:                   network to MS
7082  */
7083 static void
7084 dtap_sm_act_pdp_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7085 {
7086         guint32 curr_offset;
7087         guint32 consumed;
7088         guint   curr_len;
7089
7090         curr_offset = offset;
7091         curr_len    = len;
7092
7093         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7094         /* Network to MS*/
7095         pinfo->link_dir = P2P_DIR_DL;
7096
7097         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Negotiated LLC SAPI", ei_gsm_a_gm_missing_mandatory_element);
7098
7099         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_QOS, " - Negotiated QoS", ei_gsm_a_gm_missing_mandatory_element);
7100
7101 #if 0
7102         /* This is done automatically */
7103         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SPARE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7104         curr_offset--;
7105         curr_len++;
7106 #endif
7107
7108         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, NULL, ei_gsm_a_gm_missing_mandatory_element);
7109
7110         ELEM_OPT_TLV( 0x2B, GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR, " - PDP address");
7111
7112         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7113
7114         ELEM_OPT_TLV( 0x34, GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID, NULL);
7115
7116         ELEM_OPT_TLV( 0x39, GSM_A_PDU_TYPE_GM, DE_SM_CAUSE_2, " - SM cause");
7117
7118         ELEM_OPT_TV_SHORT(0xB0 , GSM_A_PDU_TYPE_GM, DE_SM_CONNECTIVITY_TYPE, NULL);
7119
7120         ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_SM_WLAN_OFFLOAD_ACCEPT, " - WLAN offload indication");
7121
7122         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7123
7124         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7125
7126         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7127
7128         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7129 }
7130
7131 /*
7132  * [8] 9.5.3 Activate PDP context reject
7133  * Direction:                   network to MS
7134  */
7135 static void
7136 dtap_sm_act_pdp_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7137 {
7138         guint32 curr_offset;
7139         guint32 consumed;
7140         guint   curr_len;
7141
7142         curr_offset = offset;
7143         curr_len    = len;
7144
7145         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7146         /* Network to MS*/
7147         pinfo->link_dir = P2P_DIR_DL;
7148
7149         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7150
7151         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7152
7153         ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - Back-off timer value");
7154
7155         ELEM_OPT_TLV(0x6B, GSM_A_PDU_TYPE_GM, DE_RE_ATTEMPT_IND, NULL);
7156
7157         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7158
7159         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7160
7161         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7162 }
7163
7164 /*
7165  * [8] 9.5.4 Activate Secondary PDP Context Request
7166  * Direction:                   MS to network
7167  */
7168 static void
7169 dtap_sm_act_sec_pdp_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7170 {
7171         guint32 curr_offset;
7172         guint32 consumed;
7173         guint   curr_len;
7174
7175         curr_offset = offset;
7176         curr_len    = len;
7177
7178         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7179         /* MS to Network */
7180         pinfo->link_dir = P2P_DIR_UL;
7181
7182         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_NET_SAPI, " - Requested NSAPI", ei_gsm_a_gm_missing_mandatory_element);
7183
7184         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI", ei_gsm_a_gm_missing_mandatory_element);
7185
7186         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_QOS, " - Requested QoS", ei_gsm_a_gm_missing_mandatory_element);
7187
7188         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_LINKED_TI, NULL, ei_gsm_a_gm_missing_mandatory_element);
7189
7190         /* 3GPP TS 24.008 version 6.8.0 Release 6, 36 TFT Traffic Flow Template 10.5.6.12 O TLV 3-257 */
7191         ELEM_OPT_TLV( 0x36, GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE, NULL);
7192
7193         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7194
7195         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
7196
7197         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7198
7199         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7200
7201         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7202
7203         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7204 }
7205
7206 /*
7207  * [7] 9.5.5    Activate Secondary PDP Context Accept
7208  * Direction:                   network to MS
7209  */
7210 static void
7211 dtap_sm_act_sec_pdp_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7212 {
7213         guint32 curr_offset;
7214         guint32 consumed;
7215         guint   curr_len;
7216
7217         curr_offset = offset;
7218         curr_len    = len;
7219
7220         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7221         /* Network to MS*/
7222         pinfo->link_dir = P2P_DIR_DL;
7223
7224         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Negotiated LLC SAPI", ei_gsm_a_gm_missing_mandatory_element);
7225
7226         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_QOS, " - Negotiated QoS", ei_gsm_a_gm_missing_mandatory_element);
7227
7228         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, NULL, ei_gsm_a_gm_missing_mandatory_element);
7229
7230 #if 0
7231         /* This is done automatically */
7232         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SPARE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7233         curr_offset--;
7234         curr_len++;
7235 #endif
7236
7237         ELEM_OPT_TLV( 0x34, GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID, NULL);
7238
7239         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7240
7241         ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_SM_WLAN_OFFLOAD_ACCEPT, " - WLAN offload indication");
7242
7243         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7244
7245         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7246
7247         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7248
7249         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7250 }
7251
7252 /*
7253  * [8] 9.5.6 Activate Secondary PDP Context Reject
7254  * Direction:                   network to MS
7255  */
7256 static void
7257 dtap_sm_act_sec_pdp_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7258 {
7259         guint32 curr_offset;
7260         guint32 consumed;
7261         guint   curr_len;
7262
7263         curr_offset = offset;
7264         curr_len    = len;
7265
7266         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7267         /* Network to MS*/
7268         pinfo->link_dir = P2P_DIR_DL;
7269
7270         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7271
7272         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7273
7274         ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - Back-off timer value");
7275
7276         ELEM_OPT_TLV(0x6B, GSM_A_PDU_TYPE_GM, DE_RE_ATTEMPT_IND, NULL);
7277
7278         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7279
7280         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7281
7282         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7283 }
7284
7285 /*
7286  * [8] 9.5.7 Request PDP context activation
7287  * Direction:                   network to MS
7288  */
7289 static void
7290 dtap_sm_req_pdp_act(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7291 {
7292         guint32 curr_offset;
7293         guint32 consumed;
7294         guint   curr_len;
7295
7296         curr_offset = offset;
7297         curr_len    = len;
7298
7299         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7300         /* Network to MS*/
7301         pinfo->link_dir = P2P_DIR_DL;
7302
7303         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR, " - Offered PDP address", ei_gsm_a_gm_missing_mandatory_element);
7304
7305         ELEM_OPT_TLV( 0x28, GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME, NULL);
7306
7307         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7308
7309         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7310
7311         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7312
7313         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7314 }
7315
7316 /*
7317  * [8] 9.5.8 Request PDP context activation reject
7318  * Direction:                   MS to network
7319  */
7320 static void
7321 dtap_sm_req_pdp_act_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7322 {
7323         guint32 curr_offset;
7324         guint32 consumed;
7325         guint   curr_len;
7326
7327         curr_offset = offset;
7328         curr_len    = len;
7329
7330         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7331         /* MS to  Network */
7332         pinfo->link_dir = P2P_DIR_UL;
7333
7334         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7335
7336         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7337
7338         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7339
7340         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7341
7342         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7343 }
7344
7345 /*
7346  * [8] 9.5.9 Modify PDP context request (Network to MS direction)
7347  * Direction:                   network to MS
7348  */
7349 static void
7350 dtap_sm_mod_pdp_req_net(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7351 {
7352         guint32 curr_offset;
7353         guint32 consumed;
7354         guint   curr_len;
7355
7356         curr_offset = offset;
7357         curr_len    = len;
7358
7359         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7360         /* Network to MS */
7361         pinfo->link_dir = P2P_DIR_DL;
7362
7363         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, NULL, ei_gsm_a_gm_missing_mandatory_element);
7364 #if 0
7365         /* This is done automatically */
7366         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SPARE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7367         curr_offset--;
7368         curr_len++;
7369 #endif
7370
7371         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI", ei_gsm_a_gm_missing_mandatory_element);
7372
7373         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_QOS, " - New QoS", ei_gsm_a_gm_missing_mandatory_element);
7374
7375         ELEM_OPT_TLV( 0x2B, GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR, " - PDP address");
7376
7377         ELEM_OPT_TLV( 0x34, GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID, NULL);
7378
7379         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7380
7381         ELEM_OPT_TLV( 0x36, GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE, NULL);
7382
7383         ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_SM_WLAN_OFFLOAD_ACCEPT, " - WLAN offload indication");
7384
7385         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7386
7387         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7388
7389         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7390
7391         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7392 }
7393
7394 /*
7395  * [8] 9.5.10 Modify PDP context request (MS to network direction)
7396  * Direction:                   MS to network
7397  */
7398 static void
7399 dtap_sm_mod_pdp_req_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7400 {
7401         guint32 curr_offset;
7402         guint32 consumed;
7403         guint   curr_len;
7404
7405         curr_offset = offset;
7406         curr_len    = len;
7407
7408         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7409         /* MS to Network */
7410         pinfo->link_dir = P2P_DIR_UL;
7411
7412         ELEM_OPT_TV( 0x32, GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI" );
7413
7414         ELEM_OPT_TLV( 0x30, GSM_A_PDU_TYPE_GM, DE_QOS, " - Requested new QoS" );
7415
7416         ELEM_OPT_TLV( 0x31, GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE, " - New TFT" );
7417
7418         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7419
7420         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
7421
7422         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7423
7424         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7425
7426         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7427
7428         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7429 }
7430
7431 /*
7432  * [8] 9.5.11 Modify PDP context accept (MS to network direction)
7433  * Direction:                   MS to network
7434  */
7435 static void
7436 dtap_sm_mod_pdp_acc_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7437 {
7438         guint32 curr_offset;
7439         guint32 consumed;
7440         guint   curr_len;
7441
7442         curr_offset = offset;
7443         curr_len    = len;
7444
7445         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7446         /* MS to Network */
7447         pinfo->link_dir = P2P_DIR_UL;
7448
7449         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7450
7451         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7452
7453         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7454
7455         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7456 }
7457
7458 /*
7459  * [8] 9.5.12 Modify PDP context accept (Network to MS direction)
7460  * Direction:                   Network to MS
7461  */
7462 static void
7463 dtap_sm_mod_pdp_acc_net(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7464 {
7465         guint32 curr_offset;
7466         guint32 consumed;
7467         guint   curr_len;
7468
7469         curr_offset = offset;
7470         curr_len    = len;
7471
7472         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7473         /* Network to MS */
7474         pinfo->link_dir = P2P_DIR_DL;
7475
7476         ELEM_OPT_TLV( 0x30, GSM_A_PDU_TYPE_GM, DE_QOS, " - Negotiated QoS" );
7477
7478         ELEM_OPT_TV( 0x32, GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Negotiated LLC SAPI" );
7479
7480         ELEM_OPT_TV_SHORT ( 0x80, GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, " - New radio priority" );
7481
7482         ELEM_OPT_TLV( 0x34, GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID, NULL);
7483
7484         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7485
7486         ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_SM_WLAN_OFFLOAD_ACCEPT, " - WLAN offload indication");
7487
7488         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7489
7490         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7491
7492         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7493
7494         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7495 }
7496
7497 /*
7498  * [8] 9.5.13 Modify PDP Context Reject
7499  * Direction:                   both
7500  */
7501 static void
7502 dtap_sm_mod_pdp_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7503 {
7504         guint32 curr_offset;
7505         guint32 consumed;
7506         guint   curr_len;
7507
7508         curr_offset = offset;
7509         curr_len    = len;
7510
7511         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7512         /* Network or the MS; do not reset link_dir in case it was set by lower layers */
7513         /* pinfo->link_dir = LINK_DIR_UNKNOWN; */
7514
7515
7516         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7517
7518         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7519
7520         ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - Back-off timer value");
7521
7522         ELEM_OPT_TLV(0x6B, GSM_A_PDU_TYPE_GM, DE_RE_ATTEMPT_IND, NULL);
7523
7524         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7525
7526         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7527
7528         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7529 }
7530
7531 /*
7532  * [8] 9.5.14 Deactivate PDP context request
7533  * Direction:                   both
7534  */
7535 static void
7536 dtap_sm_deact_pdp_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7537 {
7538         guint32 curr_offset;
7539         guint32 consumed;
7540         guint   curr_len;
7541
7542         curr_offset = offset;
7543         curr_len    = len;
7544
7545         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7546         pinfo->link_dir = LINK_DIR_UNKNOWN;
7547
7548         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7549
7550         ELEM_OPT_TV_SHORT( 0x90, GSM_A_PDU_TYPE_GM, DE_TEAR_DOWN_IND, NULL);
7551
7552         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7553
7554         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL);
7555
7556         ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3396 value");
7557
7558         ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_SM_WLAN_OFFLOAD_ACCEPT, " - WLAN offload indication");
7559
7560         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7561
7562         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7563 }
7564
7565 /*
7566  * [8] 9.5.15 Deactivate PDP context accept
7567  * Direction:                   both
7568  */
7569 static void
7570 dtap_sm_deact_pdp_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7571 {
7572         guint32 curr_offset;
7573         guint32 consumed;
7574         guint   curr_len;
7575
7576         curr_offset = offset;
7577         curr_len    = len;
7578
7579         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7580         pinfo->link_dir = LINK_DIR_UNKNOWN;
7581
7582         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7583
7584         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL);
7585
7586         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7587
7588         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7589 }
7590
7591 /*
7592  * [8] 9.5.15a Request Secondary PDP Context Activation
7593  * Direction:                   network to MS
7594  */
7595 static void
7596 dtap_sm_req_sec_pdp_act(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7597 {
7598         guint32 curr_offset;
7599         guint32 consumed;
7600         guint   curr_len;
7601
7602         curr_offset = offset;
7603         curr_len    = len;
7604
7605         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7606         pinfo->link_dir = P2P_DIR_DL;
7607
7608         /* Required QoS Quality of service 10.5.6.5 M LV 13-17 */
7609         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_QOS, " - Required QoS", ei_gsm_a_gm_missing_mandatory_element);
7610
7611         /* Linked TI Linked TI 10.5.6.7 M LV 2-3 */
7612         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_LINKED_TI, NULL, ei_gsm_a_gm_missing_mandatory_element);
7613
7614         /* 36 TFT Traffic Flow Template 10.5.6.12 O TLV 3-257 */
7615         ELEM_OPT_TLV( 0x36, GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE, NULL);
7616
7617         /* 27 Protocol configuration options Protocol configuration options 10.5.6.3 O TLV 3 - 253 */
7618         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7619
7620         /* C- WLAN offload acceptability 10.5.6.20 O TV 1 */
7621         ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_SM_WLAN_OFFLOAD_ACCEPT, " - WLAN offload indication");
7622
7623         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7624
7625         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7626
7627         ELEM_OPT_TLV(0x5C, GSM_A_PDU_TYPE_GM, DE_EXT_QOS, NULL);
7628
7629         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7630 }
7631
7632 /*
7633  * [8] 9.5.15b Request Secondary PDP Context Activation Reject
7634  * Direction:                   MS to network
7635  */
7636 static void
7637 dtap_sm_req_sec_pdp_act_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7638 {
7639         guint32 curr_offset;
7640         guint32 consumed;
7641         guint   curr_len;
7642
7643         curr_offset = offset;
7644         curr_len    = len;
7645
7646         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7647         pinfo->link_dir = P2P_DIR_UL;
7648
7649         /* SM cause SM cause 10.5.6.6 M V 1 */
7650         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7651
7652         /* 27 Protocol configuration options Protocol configuration options 10.5.6.3 O TLV 3 - 253 */
7653         ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
7654
7655         ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
7656
7657         ELEM_OPT_TLV_E(0x7B, GSM_A_PDU_TYPE_GM, DE_EXT_PRO_CONF_OPT, NULL);
7658
7659         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7660 }
7661
7662 /*
7663  * [8] 9.5.16a Notification
7664  * Direction:                   network to MS
7665  */
7666 static void
7667 dtap_sm_notif(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7668 {
7669         guint32 curr_offset;
7670         guint32 consumed;
7671         guint   curr_len;
7672
7673         curr_offset = offset;
7674         curr_len    = len;
7675
7676         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7677         pinfo->link_dir = P2P_DIR_DL;
7678
7679         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_SM_NOTIF_IND, NULL, ei_gsm_a_gm_missing_mandatory_element);
7680
7681         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7682 }
7683
7684 /*
7685  * [8] 9.5.21 SM Status
7686  * Direction:                   both
7687  */
7688 static void
7689 dtap_sm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7690 {
7691         guint32 curr_offset;
7692         guint32 consumed;
7693         guint   curr_len;
7694
7695         curr_offset = offset;
7696         curr_len    = len;
7697
7698         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
7699         pinfo->link_dir = LINK_DIR_UNKNOWN;
7700
7701         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7702
7703         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7704 }
7705
7706 /*
7707  * [9] 9.5.22 Activate MBMS Context Request
7708  * Direction:                   MS to network
7709  */
7710 static void
7711 dtap_sm_act_mbms_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7712 {
7713         guint32 curr_offset;
7714         guint32 consumed;
7715         guint   curr_len;
7716
7717         curr_offset = offset;
7718         curr_len    = len;
7719
7720         pinfo->p2p_dir = P2P_DIR_RECV;
7721
7722         /* Requested MBMS NSAPI Enhanced Network service access point identifier 10.5.6.16 M V */
7723         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_ENH_NSAPI, " - Requested MBMS NSAPI", ei_gsm_a_gm_missing_mandatory_element);
7724
7725         /* Requested LLC SAPI LLC service access point identifier 10.5.6.9 M V 1 */
7726         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI", ei_gsm_a_gm_missing_mandatory_element);
7727
7728         /* Supported MBMS bearer capabilities MBMS bearer capabilities 10.5.6.14 M LV 2 - 3 */
7729         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_MBMS_BEARER_CAP, NULL, ei_gsm_a_gm_missing_mandatory_element);
7730
7731         /* Requested multicast address Packet data protocol address 10.5.6.4 M LV 3 - 19 */
7732         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR, " - Requested multicast address", ei_gsm_a_gm_missing_mandatory_element);
7733
7734         /* Access point name Access point name 10.5.6.1 M LV 2 - 101 */
7735         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME, NULL, ei_gsm_a_gm_missing_mandatory_element);
7736
7737         /* 35 MBMS protocol configuration options MBMS protocol configuration options 10.5.6.15 O TLV 3 - 253 */
7738         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL);
7739
7740         ELEM_OPT_TV_SHORT(0xC0, GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
7741
7742         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7743 }
7744
7745 /*
7746  * [9] 9.5.23 Activate MBMS Context Accept
7747  * Direction:                   network to MS
7748  */
7749 static void
7750 dtap_sm_act_mbms_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7751 {
7752         guint32 curr_offset;
7753         guint32 consumed;
7754         guint   curr_len;
7755
7756         curr_offset = offset;
7757         curr_len    = len;
7758
7759         pinfo->p2p_dir = P2P_DIR_SENT;
7760
7761         ELEM_MAND_LV(  GSM_A_PDU_TYPE_GM, DE_TMGI, NULL, ei_gsm_a_gm_missing_mandatory_element);
7762
7763         ELEM_MAND_V(  GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Negotiated LLC SAPI", ei_gsm_a_gm_missing_mandatory_element);
7764
7765         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL);
7766
7767         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7768 }
7769
7770 /*
7771  * [9] 9.5.24 Activate MBMS Context Reject
7772  * Direction:                   network to MS
7773  */
7774 static void
7775 dtap_sm_act_mbms_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7776 {
7777         guint32 curr_offset;
7778         guint32 consumed;
7779         guint   curr_len;
7780
7781         curr_offset = offset;
7782         curr_len    = len;
7783
7784         pinfo->p2p_dir = P2P_DIR_SENT;
7785
7786         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7787
7788         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL);
7789
7790         ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3396 value");
7791
7792         ELEM_OPT_TLV(0x6B, GSM_A_PDU_TYPE_GM, DE_RE_ATTEMPT_IND, NULL);
7793
7794         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7795 }
7796
7797 /*
7798  * [9] 9.5.25 Request MBMS Context Activation
7799  * Direction:                   network to MS
7800  */
7801 static void
7802 dtap_sm_req_mbms_act(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7803 {
7804         guint32 curr_offset;
7805         guint32 consumed;
7806         guint   curr_len;
7807
7808         curr_offset = offset;
7809         curr_len    = len;
7810
7811         pinfo->p2p_dir = P2P_DIR_SENT;
7812
7813         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_NET_SAPI, " - Linked NSAPI", ei_gsm_a_gm_missing_mandatory_element);
7814
7815         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR, " - Offered multicast address", ei_gsm_a_gm_missing_mandatory_element);
7816
7817         ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME, NULL, ei_gsm_a_gm_missing_mandatory_element);
7818
7819         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL);
7820
7821         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7822 }
7823
7824 /*
7825  * [8] 9.5.26 Request MBMS Context Activation Reject
7826  * Direction:                   MS to network
7827  */
7828 static void
7829 dtap_sm_req_mbms_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
7830 {
7831         guint32 curr_offset;
7832         guint32 consumed;
7833         guint   curr_len;
7834
7835         curr_offset = offset;
7836         curr_len    = len;
7837
7838         pinfo->p2p_dir = P2P_DIR_RECV;
7839
7840         ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL, ei_gsm_a_gm_missing_mandatory_element);
7841
7842         ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL);
7843
7844         EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
7845 }
7846
7847 #define NUM_GSM_DTAP_MSG_GMM (sizeof(gsm_a_dtap_msg_gmm_strings)/sizeof(value_string))
7848 static gint ett_gsm_dtap_msg_gmm[NUM_GSM_DTAP_MSG_GMM];
7849 static void (*dtap_msg_gmm_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) = {
7850         dtap_gmm_attach_req,            /* Attach Request */
7851         dtap_gmm_attach_acc,            /* Attach Accept */
7852         dtap_gmm_attach_com,            /* Attach Complete */
7853         dtap_gmm_attach_rej,            /* Attach Reject */
7854         dtap_gmm_detach_req,            /* Detach Request */
7855         dtap_gmm_detach_acc,            /* Detach Accept */
7856         dtap_gmm_rau_req,               /* Routing Area Update Request */
7857         dtap_gmm_rau_acc,               /* Routing Area Update Accept */
7858         dtap_gmm_rau_com,               /* Routing Area Update Complete */
7859         dtap_gmm_rau_rej,               /* Routing Area Update Reject */
7860         dtap_gmm_service_req,           /* Service Request */
7861         dtap_gmm_service_acc,           /* Service Accept */
7862         dtap_gmm_service_rej,           /* Service Reject */
7863         dtap_gmm_ptmsi_realloc_cmd,     /* P-TMSI Reallocation Command */
7864         dtap_gmm_ptmsi_realloc_com,     /* P-TMSI Reallocation Complete */
7865         dtap_gmm_auth_ciph_req,         /* Authentication and Ciphering Req */
7866         dtap_gmm_auth_ciph_resp,        /* Authentication and Ciphering Resp */
7867         dtap_gmm_auth_ciph_rej,         /* Authentication and Ciphering Rej */
7868         dtap_gmm_ident_req,             /* Identity Request */
7869         dtap_gmm_ident_res,             /* Identity Response */
7870         dtap_gmm_auth_ciph_fail,        /* Authentication and Ciphering Failure */
7871         dtap_gmm_status,                /* GMM Status */
7872         dtap_gmm_information,           /* GMM Information */
7873         NULL,   /* NONE */
7874 };
7875
7876 #define NUM_GSM_DTAP_MSG_SM (sizeof(gsm_a_dtap_msg_sm_strings)/sizeof(value_string))
7877 static gint ett_gsm_dtap_msg_sm[NUM_GSM_DTAP_MSG_SM];
7878 static void (*dtap_msg_sm_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) = {
7879         dtap_sm_act_pdp_req,            /* Activate PDP Context Request */
7880         dtap_sm_act_pdp_acc,            /* Activate PDP Context Accept */
7881         dtap_sm_act_pdp_rej,            /* Activate PDP Context Reject */
7882         dtap_sm_req_pdp_act,            /* Request PDP Context Activation */
7883         dtap_sm_req_pdp_act_rej,        /* Request PDP Context Activation rej. */
7884         dtap_sm_deact_pdp_req,          /* Deactivate PDP Context Request */
7885         dtap_sm_deact_pdp_acc,          /* Deactivate PDP Context Accept */
7886         dtap_sm_mod_pdp_req_net,        /* Modify PDP Context Request(Network to MS direction) */
7887         dtap_sm_mod_pdp_acc_ms,         /* Modify PDP Context Accept (MS to network direction) */
7888         dtap_sm_mod_pdp_req_ms,         /* Modify PDP Context Request(MS to network direction) */
7889         dtap_sm_mod_pdp_acc_net,        /* Modify PDP Context Accept (Network to MS direction) */
7890         dtap_sm_mod_pdp_rej,            /* Modify PDP Context Reject */
7891         dtap_sm_act_sec_pdp_req,        /* Activate Secondary PDP Context Request */
7892         dtap_sm_act_sec_pdp_acc,        /* Activate Secondary PDP Context Accept */
7893         dtap_sm_act_sec_pdp_rej,        /* Activate Secondary PDP Context Reject */
7894         NULL,                           /* Reserved: was allocated in earlier phases of the protocol */
7895         NULL,                           /* Reserved: was allocated in earlier phases of the protocol */
7896         NULL,                           /* Reserved: was allocated in earlier phases of the protocol */
7897         NULL,                           /* Reserved: was allocated in earlier phases of the protocol */
7898         NULL,                           /* Reserved: was allocated in earlier phases of the protocol */
7899         dtap_sm_status,                 /* SM Status */
7900         dtap_sm_act_mbms_req,           /* Activate MBMS Context Request */
7901         dtap_sm_act_mbms_acc,           /* Activate MBMS Context Accept */
7902         dtap_sm_act_mbms_rej,           /* Activate MBMS Context Reject */
7903         dtap_sm_req_mbms_act,           /* Request MBMS Context Activation */
7904         dtap_sm_req_mbms_rej,           /* Request MBMS Context Activation Reject */
7905         dtap_sm_req_sec_pdp_act,        /* Request Secondary PDP Context Activation */
7906         dtap_sm_req_sec_pdp_act_rej,    /* Request Secondary PDP Context Activation Reject */
7907         dtap_sm_notif,                  /* Notification */
7908         NULL,   /* NONE */
7909 };
7910
7911 void
7912 get_gmm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *dtap_msg_fcn)
7913 {
7914         gint idx;
7915
7916         *msg_str      = try_val_to_str_idx_ext((guint32) (oct & DTAP_GMM_IEI_MASK), &gsm_a_dtap_msg_gmm_strings_ext, &idx);
7917         *hf_idx       = hf_gsm_a_dtap_msg_gmm_type;
7918         if (*msg_str != NULL) {
7919                 *ett_tree     = ett_gsm_dtap_msg_gmm[idx];
7920                 *dtap_msg_fcn = dtap_msg_gmm_fcn[idx];
7921         }
7922
7923         return;
7924 }
7925
7926 void
7927 get_sm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *dtap_msg_fcn)
7928 {
7929         gint idx;
7930
7931         *msg_str      = try_val_to_str_idx_ext((guint32) (oct & DTAP_SM_IEI_MASK), &gsm_a_dtap_msg_sm_strings_ext, &idx);
7932         *hf_idx       = hf_gsm_a_dtap_msg_sm_type;
7933         if (*msg_str != NULL) {
7934                 *ett_tree     = ett_gsm_dtap_msg_sm[idx];
7935                 *dtap_msg_fcn = dtap_msg_sm_fcn[idx];
7936         }
7937
7938         return;
7939 }
7940
7941 /* Register the protocol with Wireshark */
7942 void
7943 proto_register_gsm_a_gm(void)
7944 {
7945         guint i;
7946         guint last_offset;
7947
7948         /* Setup list of header fields */
7949
7950         static hf_register_info hf[] = {
7951                 { &hf_gsm_a_dtap_msg_gmm_type,
7952                   { "DTAP GPRS Mobility Management Message Type",       "gsm_a.dtap.msg_gmm_type",
7953                     FT_UINT8, BASE_HEX | BASE_EXT_STRING, &gsm_a_dtap_msg_gmm_strings_ext, 0x0,
7954                     NULL, HFILL }
7955                 },
7956                 { &hf_gsm_a_dtap_msg_sm_type,
7957                   { "DTAP GPRS Session Management Message Type",        "gsm_a.dtap.msg_sm_type",
7958                     FT_UINT8, BASE_HEX | BASE_EXT_STRING, &gsm_a_dtap_msg_sm_strings_ext, 0x0,
7959                     NULL, HFILL }
7960                 },
7961                 { &hf_gsm_a_gm_elem_id,
7962                   { "Element ID",       "gsm_a.gm.elem_id",
7963                     FT_UINT8, BASE_HEX, NULL, 0,
7964                     NULL, HFILL }
7965                 },
7966                 { &hf_gsm_a_sm_qos_delay_cls,
7967                   { "Quality of Service Delay class", "gsm_a.gm.sm.qos.delay_cls",
7968                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_delay_cls_vals), 0x38,
7969                     NULL, HFILL }
7970                 },
7971                 { &hf_gsm_a_sm_qos_reliability_cls,
7972                   { "Reliability class", "gsm_a.gm.sm.qos.reliability_cls",
7973                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_reliability_vals), 0x07,
7974                     NULL, HFILL }
7975                 },
7976                 { &hf_gsm_a_sm_qos_traffic_cls,
7977                   { "Traffic class", "gsm_a.gm.sm.qos.traffic_cls",
7978                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_traffic_cls_vals), 0xe0,
7979                     NULL, HFILL }
7980                 },
7981                 { &hf_gsm_a_sm_qos_del_order,
7982                   { "Delivery order", "gsm_a.gm.sm.qos.del_order",
7983                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_del_order_vals), 0x18,
7984                     NULL, HFILL }
7985                 },
7986                 { &hf_gsm_a_sm_qos_del_of_err_sdu,
7987                   { "Delivery of erroneous SDUs", "gsm_a.gm.sm.qos.del_of_err_sdu",
7988                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_del_of_err_sdu_vals), 0x07,
7989                     NULL, HFILL }
7990                 },
7991                 { &hf_gsm_a_sm_qos_ber,
7992                   { "Residual Bit Error Rate (BER)", "gsm_a.gm.sm.qos.ber",
7993                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_ber_vals), 0xf0,
7994                     NULL, HFILL }
7995                 },
7996                 { &hf_gsm_a_sm_qos_sdu_err_rat,
7997                   { "SDU error ratio", "gsm_a.gm.sm.qos.sdu_err_rat",
7998                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_sdu_err_rat_vals), 0x0f,
7999                     NULL, HFILL }
8000                 },
8001                 { &hf_gsm_a_sm_qos_traff_hdl_pri,
8002                   { "Traffic handling priority", "gsm_a.gm.sm.qos.traff_hdl_pri",
8003                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_qos_traff_hdl_pri_vals), 0x03,
8004                     NULL, HFILL }
8005                 },
8006                 { &hf_gsm_a_gmm_split_pg_cycle_code,
8007                   { "SPLIT PG CYCLE CODE", "gsm_a.gm.gmm.split_pg_cycle_code",
8008                     FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gsm_a_gmm_split_pg_cycle_code_strings_ext, 0x00,
8009                     NULL, HFILL }
8010                 },
8011                 { &hf_gsm_a_gmm_split_on_ccch,
8012                   { "SPLIT on CCCH", "gsm_a.gm.gmm.split_on_ccch",
8013                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_split_on_ccch_value), 0x08,
8014                     NULL, HFILL }
8015                 },
8016                 { &hf_gsm_a_gmm_non_drx_timer,
8017                   { "Non-DRX timer", "gsm_a.gm.gmm.non_drx_timer",
8018                     FT_UINT8, BASE_DEC, VALS(gsm_a_gmm_non_drx_timer_strings), 0x07,
8019                     NULL, HFILL }
8020                 },
8021                 { &hf_gsm_a_gmm_cn_spec_drx_cycle_len_coef,
8022                   { "CN Specific DRX cycle length coefficient", "gsm_a.gm.gmm.cn_spec_drx_cycle_len_coef",
8023                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_gmm_cn_spec_drx_cycle_len_coef_strings), 0xf0,
8024                     NULL, HFILL }
8025                 },
8026                 { &hf_gsm_a_sm_tft_op_code,
8027                   { "TFT operation code", "gsm_a.gm.sm.tft.op_code",
8028                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_tft_op_code_vals), 0xe0,
8029                     NULL, HFILL }
8030                 },
8031                 { &hf_gsm_a_sm_tft_e_bit,
8032                   { "E bit", "gsm_a.gm.sm.tft.e_bit",
8033                     FT_BOOLEAN, 8, TFS(&gsm_a_sm_tft_e_bit), 0x10,
8034                     NULL, HFILL }
8035                 },
8036                 { &hf_gsm_a_sm_tft_pkt_flt,
8037                   { "Number of packet filters", "gsm_a.gm.sm.tft.pkt_flt",
8038                     FT_UINT8, BASE_DEC, NULL, 0x0f,
8039                     NULL, HFILL }
8040                 },
8041                 { &hf_gsm_a_sm_tft_pkt_flt_dir,
8042                   { "Packet filter direction", "gsm_a.gm.sm.tft.pkt_flt_dir",
8043                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_tft_pkt_flt_dir_vals), 0x30,
8044                     NULL, HFILL }
8045                 },
8046                 { &hf_gsm_a_sm_tft_pkt_flt_id,
8047                   { "Packet filter identifier", "gsm_a.gm.sm.tft.pkt_flt_id",
8048                     FT_UINT8, BASE_DEC, NULL, 0x0f,
8049                     NULL, HFILL }
8050                 },
8051                 { &hf_gsm_a_sm_ip4_address,
8052                   { "IPv4 address", "gsm_a.gm.sm.ip4_address",
8053                     FT_IPv4, BASE_NONE, NULL, 0x0,
8054                     NULL, HFILL }
8055                 },
8056                 { &hf_gsm_a_sm_ip4_mask,
8057                   { "IPv4 address mask", "gsm_a.gm.sm.ip4_mask",
8058                     FT_IPv4, BASE_NONE, NULL, 0x0,
8059                     NULL, HFILL }
8060                 },
8061                 { &hf_gsm_a_sm_ip6_address,
8062                   { "IPv6 address", "gsm_a.gm.sm.ip6_address",
8063                     FT_IPv6, BASE_NONE, NULL, 0x0,
8064                     NULL, HFILL }
8065                 },
8066                 { &hf_gsm_a_sm_ip6_mask,
8067                   { "IPv6 address mask", "gsm_a.gm.sm.ip6_mask",
8068                     FT_IPv6, BASE_NONE, NULL, 0x0,
8069                     NULL, HFILL }
8070                 },
8071                 { &hf_gsm_a_sm_ip6_prefix_length,
8072                   { "IPv6 prefix length", "gsm_a.gm.sm.ip6_prefix_length",
8073                     FT_UINT8, BASE_DEC, NULL, 0x0,
8074                     NULL, HFILL }
8075                 },
8076                 { &hf_gsm_a_sm_tft_protocol_header,
8077                   { "Protocol/header", "gsm_a.gm.sm.tft.protocol_header",
8078                     FT_UINT8, BASE_HEX|BASE_EXT_STRING, &ipproto_val_ext, 0x0,
8079                     NULL, HFILL }
8080                 },
8081                 { &hf_gsm_a_sm_tft_port,
8082                   { "Port", "gsm_a.gm.sm.tft.port",
8083                     FT_UINT16, BASE_DEC, NULL, 0x0,
8084                     NULL, HFILL }
8085                 },
8086                 { &hf_gsm_a_sm_tft_port_low,
8087                   { "Low limit port", "gsm_a.gm.sm.tft.port_low",
8088                     FT_UINT16, BASE_DEC, NULL, 0x0,
8089                     NULL, HFILL }
8090                 },
8091                 { &hf_gsm_a_sm_tft_port_high,
8092                   { "High limit port", "gsm_a.gm.sm.tft.port_high",
8093                     FT_UINT16, BASE_DEC, NULL, 0x0,
8094                     NULL, HFILL }
8095                 },
8096                 { &hf_gsm_a_sm_tft_security,
8097                   { "IPSec security parameter index", "gsm_a.gm.sm.tft.security",
8098                     FT_UINT32, BASE_HEX, NULL, 0x0,
8099                     NULL, HFILL }
8100                 },
8101                 { &hf_gsm_a_sm_tft_traffic_class,
8102                   { "Type of service/Traffic class field", "gsm_a.gm.sm.tft.traffic_class",
8103                     FT_UINT8, BASE_HEX, NULL, 0x0,
8104                     NULL, HFILL }
8105                 },
8106                 { &hf_gsm_a_sm_tft_traffic_mask,
8107                   { "Mask field", "gsm_a.gm.sm.tft.traffic_mask",
8108                     FT_UINT8, BASE_HEX, NULL, 0x0,
8109                     NULL, HFILL }
8110                 },
8111                 { &hf_gsm_a_sm_tft_flow_label_type,
8112                   { "Flow Label Type", "gsm_a.gm.sm.tft.flow_label_type",
8113                     FT_UINT24, BASE_HEX, NULL, 0x0FFFFF,
8114                     NULL, HFILL }
8115                 },
8116                 { &hf_gsm_a_sm_tft_param_id,
8117                   { "Parameter identifier", "gsm_a.gm.sm.tft.param_id",
8118                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_tft_param_id_vals), 0x0,
8119                     NULL, HFILL }
8120                 },
8121                 { &hf_gsm_a_gmm_ptmsi_sig,
8122                   { "P-TMSI Signature", "gsm_a.gm.gmm.ptmsi_sig",
8123                     FT_UINT24, BASE_HEX, NULL, 0x0,
8124                     NULL, HFILL }
8125                 },
8126                 { &hf_gsm_a_gmm_ptmsi_sig2,
8127                   { "P-TMSI Signature 2", "gsm_a.gm.gmm.ptmsi_sig2",
8128                     FT_UINT24, BASE_HEX, NULL, 0x0,
8129                     NULL, HFILL }
8130                 },
8131                 { &hf_gsm_a_gm_acc_tech_type,
8132                   { "Access Technology Type", "gsm_a.gm.gmm.acc_tech_type",
8133                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_acc_tech_type_vals), 0x0,
8134                     NULL, HFILL }
8135                 },
8136                 { &hf_gsm_a_gm_acc_cap_struct_len,
8137                   { "Length in bits", "gsm_a.gm.gmm.acc_cap_struct_len",
8138                     FT_UINT8, BASE_HEX_DEC, NULL, 0x0,
8139                     NULL, HFILL }
8140                 },
8141                 { &hf_gsm_a_gm_sms_value,
8142                   { "SMS_VALUE (Switch-Measure-Switch)", "gsm_a.gm.gmm.sms",
8143                     FT_UINT8, BASE_DEC, VALS(gsm_a_sms_vals), 0x0,
8144                     NULL, HFILL }
8145                 },
8146                 { &hf_gsm_a_gm_sm_value,
8147                   { "(SM_VALUE) Switch-Measure", "gsm_a.gm.gmm.sm",
8148                     FT_UINT8, BASE_DEC, VALS(gsm_a_sms_vals), 0x0,
8149                     NULL, HFILL }
8150                 },
8151                 { &hf_gsm_a_gm_link_dir,
8152                   { "Link direction", "gsm_a.gm.sm.link_dir",
8153                     FT_INT32, BASE_DEC, VALS(gsm_a_gm_link_dir_vals), 0x0,
8154                     NULL, HFILL }
8155                 },
8156                 { &hf_gsm_a_gm_cause,
8157                   { "GMM Cause", "gsm_a.gm.gmm.cause",
8158                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gmm_cause_vals), 0x0,
8159                     NULL, HFILL }
8160                 },
8161                 { &hf_gsm_a_gm_add_upd_type,
8162                   { "Additional update type", "gsm_a.gm.gmm.add_upd_type",
8163                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_add_upd_type_value), 0x0,
8164                     NULL, HFILL }
8165                 },
8166                 { &hf_gsm_a_gm_fop,
8167                   { "Follow-on proceed", "gsm_a.gm.gmm.fop",
8168                     FT_BOOLEAN, 8, NULL, 0x08,
8169                     NULL, HFILL }
8170                 },
8171                 { &hf_gsm_a_gm_res_of_attach,
8172                   { "Result of attach", "gsm_a.gm.gmm.res_of_attach",
8173                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_res_of_attach_vals), 0x07,
8174                     NULL, HFILL }
8175                 },
8176                 { &hf_gsm_a_gm_type_of_ciph_alg,
8177                   { "Type of ciphering algorithm", "gsm_a.gm.gmm.type_of_ciph_alg",
8178                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_ciph_alg_vals), 0x07,
8179                     NULL, HFILL }
8180                 },
8181                 { &hf_gsm_a_gm_type_of_integ_alg,
8182                   { "Type of integrity algorithm", "gsm_a.gm.gmm.type_of_integ_alg",
8183                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_integ_alg_vals), 0x07,
8184                     NULL, HFILL }
8185                 },
8186                 { &hf_gsm_a_gm_imeisv_req,
8187                   { "IMEISV request", "gsm_a.gm.gmm.imeisv_req",
8188                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_gm_imeisv_req_vals), 0x00,
8189                     NULL, HFILL }
8190                 },
8191                 { &hf_gsm_a_gm_nsapi,
8192                   { "NSAPI", "gsm_a.gm.gmm.nsapi",
8193                     FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
8194                     NULL, HFILL }
8195                 },
8196                 { &hf_gsm_a_gm_ac_ref_nr,
8197                   { "A&C reference number", "gsm_a.gm.gmm.ac_ref_nr",
8198                     FT_UINT8, BASE_DEC, NULL, 0x0,
8199                     NULL, HFILL }
8200                 },
8201                 { &hf_gsm_a_gm_force_to_standby,
8202                   { "Force to standby", "gsm_a.gm.gmm.force_to_standby",
8203                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_gm_force_to_standby_vals), 0x00,
8204                     NULL, HFILL }
8205                 },
8206                 { &hf_gsm_a_gm_serv_type,
8207                   { "Service type", "gsm_a.gm.gmm.serv_type",
8208                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_serv_type_vals), 0x00,
8209                     NULL, HFILL }
8210                 },
8211                 { &hf_gsm_a_gm_for,
8212                   { "Follow-on request pending", "gsm_a.gm.gmm.for",
8213                     FT_BOOLEAN, 8, NULL, 0x08,
8214                     NULL, HFILL }
8215                 },
8216                 { &hf_gsm_a_gm_type_of_attach,
8217                   { "Type of attach", "gsm_a.gm.gmm.type_of_attach",
8218                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_attach_vals), 0x07,
8219                     NULL, HFILL }
8220                 },
8221                 { &hf_gsm_a_gm_tmsi_flag,
8222                   { "TMSI flag", "gsm_a.gm.gmm.tmsi_flag",
8223                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_tmsi_flag_value), 0x01,
8224                     NULL, HFILL }
8225                 },
8226                 { &hf_gsm_a_gm_power_off,
8227                   { "Power off", "gsm_a.gm.gmm.power_off",
8228                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_power_off_value), 0x08,
8229                     NULL, HFILL }
8230                 },
8231                 { &hf_gsm_a_gm_type_of_detach_mo,
8232                   { "Type of detach", "gsm_a.gm.gmm.type_of_detach",
8233                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_detach_mo_vals), 0x07,
8234                     NULL, HFILL }
8235                 },
8236                 { &hf_gsm_a_gm_type_of_detach_mt,
8237                   { "Type of detach", "gsm_a.gm.gmm.type_of_detach",
8238                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_detach_mt_vals), 0x07,
8239                     NULL, HFILL }
8240                 },
8241                 { &hf_gsm_a_gm_update_type,
8242                   { "Update type", "gsm_a.gm.gmm.update_type",
8243                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_update_type_vals), 0x07,
8244                     NULL, HFILL }
8245                 },
8246                 { &hf_gsm_a_gm_gprs_timer,
8247                   { "GPRS Timer", "gsm_a.gm.gmm.gprs_timer",
8248                     FT_UINT8, BASE_HEX, NULL, 0x0,
8249                     NULL, HFILL }
8250                 },
8251                 { &hf_gsm_a_gm_gprs_timer_unit,
8252                   { "Unit", "gsm_a.gm.gmm.gprs_timer_unit",
8253                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_gprs_timer_unit_vals), 0xe0,
8254                     NULL, HFILL }
8255                 },
8256                 { &hf_gsm_a_gm_gprs_timer_value,
8257                   { "Timer value", "gsm_a.gm.gmm.gprs_timer_value",
8258                     FT_UINT8, BASE_DEC, NULL, 0x1f,
8259                     NULL, HFILL }
8260                 },
8261                 { &hf_gsm_a_gm_gprs_timer2,
8262                   { "GPRS Timer", "gsm_a.gm.gmm.gprs_timer2",
8263                     FT_UINT8, BASE_HEX, NULL, 0x0,
8264                     NULL, HFILL }
8265                 },
8266                 { &hf_gsm_a_gm_gprs_timer2_unit,
8267                   { "Unit", "gsm_a.gm.gmm.gprs_timer2_unit",
8268                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_gprs_timer_unit_vals), 0xe0,
8269                     NULL, HFILL }
8270                 },
8271                 { &hf_gsm_a_gm_gprs_timer2_value,
8272                   { "Timer value", "gsm_a.gm.gmm.gprs_timer2_value",
8273                     FT_UINT8, BASE_DEC, NULL, 0x1f,
8274                     NULL, HFILL }
8275                 },
8276                 { &hf_gsm_a_gm_gprs_timer3,
8277                   { "GPRS Timer", "gsm_a.gm.gmm.gprs_timer3",
8278                     FT_UINT8, BASE_HEX, NULL, 0x0,
8279                     NULL, HFILL }
8280                 },
8281                 { &hf_gsm_a_gm_gprs_timer3_unit,
8282                   { "Unit", "gsm_a.gm.gmm.gprs_timer3_unit",
8283                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_gprs_timer3_unit_vals), 0xe0,
8284                     NULL, HFILL }
8285                 },
8286                 { &hf_gsm_a_gm_gprs_timer3_value,
8287                   { "Timer value", "gsm_a.gm.gmm.gprs_timer3_value",
8288                     FT_UINT8, BASE_DEC, NULL, 0x1f,
8289                     NULL, HFILL }
8290                 },
8291                 { &hf_gsm_a_gm_nsapi_5_ul_stat,
8292                   { "NSAPI(5) uplink status", "gsm_a.gm.gmm.nsapi_5_ul_stat",
8293                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8294                     NULL, HFILL }
8295                 },
8296                 { &hf_gsm_a_gm_nsapi_6_ul_stat,
8297                   { "NSAPI(6) uplink status", "gsm_a.gm.gmm.nsapi_6_ul_stat",
8298                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8299                     NULL, HFILL }
8300                 },
8301                 { &hf_gsm_a_gm_nsapi_7_ul_stat,
8302                   { "NSAPI(7) uplink status", "gsm_a.gm.gmm.nsapi_7_ul_stat",
8303                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8304                     NULL, HFILL }
8305                 },
8306                 { &hf_gsm_a_gm_nsapi_8_ul_stat,
8307                   { "NSAPI(8) uplink status", "gsm_a.gm.gmm.nsapi_8_ul_stat",
8308                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8309                     NULL, HFILL }
8310                 },
8311                 { &hf_gsm_a_gm_nsapi_9_ul_stat,
8312                   { "NSAPI(9) uplink status", "gsm_a.gm.gmm.nsapi_9_ul_stat",
8313                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8314                     NULL, HFILL }
8315                 },
8316                 { &hf_gsm_a_gm_nsapi_10_ul_stat,
8317                   { "NSAPI(10) uplink status", "gsm_a.gm.gmm.nsapi_10_ul_stat",
8318                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8319                     NULL, HFILL }
8320                 },
8321                 { &hf_gsm_a_gm_nsapi_11_ul_stat,
8322                   { "NSAPI(11) uplink status", "gsm_a.gm.gmm.nsapi_11_ul_stat",
8323                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8324                     NULL, HFILL }
8325                 },
8326                 { &hf_gsm_a_gm_nsapi_12_ul_stat,
8327                   { "NSAPI(12) uplink status", "gsm_a.gm.gmm.nsapi_12_ul_stat",
8328                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8329                     NULL, HFILL }
8330                 },
8331                 { &hf_gsm_a_gm_nsapi_13_ul_stat,
8332                   { "NSAPI(13) uplink status", "gsm_a.gm.gmm.nsapi_13_ul_stat",
8333                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8334                     NULL, HFILL }
8335                 },
8336                 { &hf_gsm_a_gm_nsapi_14_ul_stat,
8337                   { "NSAPI(14) uplink status", "gsm_a.gm.gmm.nsapi_14_ul_stat",
8338                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8339                     NULL, HFILL }
8340                 },
8341                 { &hf_gsm_a_gm_nsapi_15_ul_stat,
8342                   { "NSAPI(15) uplink status", "gsm_a.gm.gmm.nsapi_15_ul_stat",
8343                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
8344                     NULL, HFILL }
8345                 },
8346                 { &hf_gsm_a_gm_device_prop_low_prio,
8347                   { "Low priority", "gsm_a.gm.gmm.device_prop_low_prio",
8348                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_device_prop_low_prio_value), 0x0,
8349                     NULL, HFILL }
8350                 },
8351                 { &hf_gsm_a_gm_apn,
8352                   { "APN", "gsm_a.gm.sm.apn",
8353                     FT_STRING,BASE_NONE, NULL,0x0,
8354                     NULL, HFILL }
8355                 },
8356                 { &hf_gsm_a_gm_pco_pid,
8357                   { "Protocol or Container ID", "gsm_a.gm.sm.pco_pid",
8358                     FT_UINT16, BASE_HEX, NULL, 0x0,
8359                     NULL, HFILL }
8360                 },
8361                 { &hf_gsm_a_gm_pco_app_spec_info,
8362                   { "Application specific information", "gsm_a.gm.sm.app_spec_info",
8363                     FT_BYTES, BASE_NONE, NULL, 0x0,
8364                     NULL, HFILL }
8365                 },
8366                 { &hf_gsm_a_gm_type_of_identity,
8367                   { "Type of identity", "gsm_a.gm.gmm.type_of_identity",
8368                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_identity_vals), 0x07,
8369                     NULL, HFILL }
8370                 },
8371                 { &hf_gsm_a_gm_rac,
8372                   { "Routing Area Code (RAC)", "gsm_a.gm.gmm.rac",
8373                     FT_UINT8, BASE_HEX_DEC, NULL, 0x00,
8374                     NULL, HFILL }
8375                 },
8376                 { &hf_gsm_a_gm_mta_e,
8377                   { "MTA-E", "gsm_a.gm.gmm.mta_e",
8378                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_mta_e_vals), 0x80,
8379                     NULL, HFILL }
8380                 },
8381                 { &hf_gsm_a_gm_mta_r,
8382                   { "MTA-R", "gsm_a.gm.gmm.mta_r",
8383                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_mta_r_vals), 0x40,
8384                     NULL, HFILL }
8385                 },
8386                 { &hf_gsm_a_gm_apc,
8387                   { "APC", "gsm_a.gm.gmm.apc",
8388                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_apc_vals), 0x20,
8389                     NULL, HFILL }
8390                 },
8391                 { &hf_gsm_a_gm_otd_a,
8392                   { "OTD-A", "gsm_a.gm.gmm.otd_a",
8393                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_otd_a_vals), 0x10,
8394                     NULL, HFILL }
8395                 },
8396                 { &hf_gsm_a_gm_otd_b,
8397                   { "OTD-B", "gsm_a.gm.gmm.otd_b",
8398                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_otd_b_vals), 0x08,
8399                     NULL, HFILL }
8400                 },
8401                 { &hf_gsm_a_gm_gps_a,
8402                   { "GPS-A", "gsm_a.gm.gmm.gps_a",
8403                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_gps_a_vals), 0x04,
8404                     NULL, HFILL }
8405                 },
8406                 { &hf_gsm_a_gm_gps_b,
8407                   { "GPS-B", "gsm_a.gm.gmm.gps_b",
8408                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_gps_b_vals), 0x02,
8409                     NULL, HFILL }
8410                 },
8411                 { &hf_gsm_a_gm_gps_c,
8412                   { "GPS-C", "gsm_a.gm.gmm.gps_c",
8413                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_gps_c_vals), 0x01,
8414                     NULL, HFILL }
8415                 },
8416                 { &hf_gsm_a_gm_motd,
8417                   { "MOTD", "gsm_a.gm.gmm.motd",
8418                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_motd_vals), 0x02,
8419                     NULL, HFILL }
8420                 },
8421                 { &hf_gsm_a_gm_mta_a,
8422                   { "MTA-A", "gsm_a.gm.gmm.mta_a",
8423                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_mta_a_vals), 0x01,
8424                     NULL, HFILL }
8425                 },
8426                 { &hf_gsm_a_gm_lcs_molr,
8427                   { "LCS-MOLR", "gsm_a.gm.gmm.lcs_molr",
8428                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_lcs_molr_value), 0x08,
8429                     NULL, HFILL }
8430                 },
8431                 { &hf_gsm_a_gm_mbms,
8432                   { "MBMS", "gsm_a.gm.gmm.mbms",
8433                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
8434                     NULL, HFILL }
8435                 },
8436                 { &hf_gsm_a_gm_ims_vops,
8437                   { "IMS VoPS", "gsm_a.gm.gmm.ims_vops",
8438                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_ims_vops_value), 0x02,
8439                     "IMS voice over PS session indicator", HFILL }
8440                 },
8441                 { &hf_gsm_a_gm_emc_bs,
8442                   { "EMC BS", "gsm_a.gm.gmm.emc_bs",
8443                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_emc_bs_value), 0x01,
8444                     "Emergency bearer services indicator", HFILL }
8445                 },
8446                 { &hf_gsm_a_gm_epco,
8447                   { "ePCO", "gsm_a.gm.gmm.epco",
8448                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_epco_value), 0x04,
8449                     NULL, HFILL }
8450                 },
8451                 { &hf_gsm_a_gm_restrict_ec,
8452                   { "RestrictEC", "gsm_a.gm.gmm.restrict_ec",
8453                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_restrict_ec_value), 0x02,
8454                     NULL, HFILL }
8455                 },
8456                 { &hf_gsm_a_gm_gprs_sms,
8457                   { "GPRS-SMS", "gsm_a.gm.gmm.gprs_sms",
8458                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_gprs_sms_value), 0x01,
8459                     NULL, HFILL }
8460                 },
8461                 { &hf_gsm_a_gm_req_ms_info_irat,
8462                   { "I-RAT", "gsm_a.gm.gmm.req_ms_info_irat",
8463                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_req_ms_info_irat_vals), 0x0,
8464                     NULL, HFILL }
8465                 },
8466                 { &hf_gsm_a_gm_req_ms_info_irat2,
8467                   { "I-RAT2", "gsm_a.gm.gmm.req_ms_info_irat2",
8468                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_req_ms_info_irat2_vals), 0x0,
8469                     NULL, HFILL }
8470                 },
8471                 { &hf_gsm_a_gm_ue_usage_setting,
8472                   { "UE's usage setting", "gsm_a.gm.gmm.ue_usage_setting",
8473                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_ue_usage_setting_vals), 0x0,
8474                     NULL, HFILL }
8475                 },
8476                 { &hf_gsm_a_gm_voice_domain_pref_for_eutran,
8477                   { "Voice domain preference for E-UTRAN", "gsm_a.gm.gmm.voice_domain_pref_for_eutran",
8478                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_voice_domain_pref_for_eutran_vals), 0x0,
8479                     NULL, HFILL }
8480                 },
8481                 { &hf_gsm_a_gm_ptmsi_type,
8482                   { "P-TMSI type", "gsm_a.gm.gmm.ptmsi_type",
8483                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_ptmsi_type_value), 0x0,
8484                     NULL, HFILL }
8485                 },
8486                 { &hf_gsm_a_gm_nri_cont,
8487                   { "NRI container value", "gsm_a.gm.gmm.nri_cont_value",
8488                     FT_UINT16, BASE_HEX, NULL, 0xffc0,
8489                     NULL, HFILL }
8490                 },
8491                 { &hf_gsm_a_gm_paging_time_window,
8492                   { "Paging Time Window", "gsm_a.gm.gmm.paging_time_window",
8493                     FT_UINT8, BASE_HEX, VALS(gsm_a_gm_paging_time_window_vals), 0xf0,
8494                     NULL, HFILL }
8495                 },
8496                 { &hf_gsm_a_gm_edrx_value,
8497                   { "eDRX value", "gsm_a.gm.gmm.edrx_value",
8498                     FT_UINT8, BASE_HEX, VALS(gsm_a_gm_edrx_vals), 0x0f,
8499                     NULL, HFILL }
8500                 },
8501                 { &hf_gsm_a_gm_mac,
8502                   { "Message authentication code value", "gsm_a.gm.gmm.mac",
8503                     FT_UINT32, BASE_HEX, NULL, 0x0,
8504                     NULL, HFILL }
8505                 },
8506                 { &hf_gsm_a_gm_up_integ_ind,
8507                   { "Integrity indicator", "gsm_a.gm.gmm.up_integ_ind",
8508                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_up_integ_ind_value), 0x01,
8509                     NULL, HFILL }
8510                 },
8511                 { &hf_gsm_a_gm_dcn_id,
8512                   { "DCN-ID", "gsm_a.gm.gmm.dcn_id",
8513                     FT_UINT16, BASE_HEX, NULL, 0x0,
8514                     NULL, HFILL }
8515                 },
8516                 { &hf_gsm_a_gm_n3en_ind,
8517                   { "N3EN indicator", "gsm_a.gm.gmm.n3en_ind",
8518                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_n3en_ind_value), 0x01,
8519                     NULL, HFILL }
8520                 },
8521                 { &hf_gsm_a_sm_pdp_type_org,
8522                   { "PDP type organization", "gsm_a.gm.sm.pdp_type_org",
8523                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_pdp_type_org_vals), 0x0f,
8524                     NULL, HFILL }
8525                 },
8526                 { &hf_gsm_a_sm_qos_mean_thr,
8527                   { "Mean throughput", "gsm_a.gm.sm.qos.mean_throughput",
8528                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_sm_qos_mean_thr_vals), 0x1f,
8529                     NULL, HFILL }
8530                 },
8531                 { &hf_gsm_a_sm_qos_peak_thr,
8532                   { "Peak throughput", "gsm_a.gm.sm.qos.peak_throughput",
8533                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_sm_qos_peak_thr_vals), 0xf0,
8534                     NULL, HFILL }
8535                 },
8536                 { &hf_gsm_a_sm_qos_prec_class,
8537                   { "Precedence class", "gsm_a.gm.sm.qos.prec_class",
8538                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_sm_qos_prec_class_vals), 0x07,
8539                     NULL, HFILL }
8540                 },
8541                 { &hf_gsm_a_sm_qos_trans_delay,
8542                   { "Transfer delay", "gsm_a.gm.sm.qos.trans_delay",
8543                     FT_UINT8, BASE_DEC, NULL, 0xfc,
8544                     NULL, HFILL }
8545                 },
8546                 { &hf_gsm_a_sm_qos_signalling_ind,
8547                   { "Signalling indication", "gsm_a.gm.sm.qos.signalling_ind",
8548                     FT_BOOLEAN, 8, TFS(&gsm_a_sm_qos_signalling_ind_value), 0x10,
8549                     NULL, HFILL }
8550                 },
8551                 { &hf_gsm_a_sm_qos_source_stat_desc,
8552                   { "Source statistics description", "gsm_a.gm.sm.qos.source_stat_desc",
8553                     FT_UINT8, BASE_DEC, NULL, 0x0f,
8554                     NULL, HFILL }
8555                 },
8556                 { &hf_gsm_a_sm_qos_max_bitrate_upl,
8557                   { "Maximum bitrate for uplink", "gsm_a.gm.sm.qos.max_bitrate_upl",
8558                     FT_UINT8, BASE_DEC, NULL, 0x0,
8559                     NULL, HFILL }
8560                 },
8561                 { &hf_gsm_a_sm_qos_max_bitrate_downl,
8562                   { "Maximum bitrate for downlink", "gsm_a.gm.sm.qos.max_bitrate_downl",
8563                     FT_UINT8, BASE_DEC, NULL, 0x0,
8564                     NULL, HFILL }
8565                 },
8566                 { &hf_gsm_a_sm_qos_guar_bitrate_upl,
8567                   { "Guaranteed bitrate for uplink", "gsm_a.gm.sm.qos.guar_bitrate_upl",
8568                     FT_UINT8, BASE_DEC, NULL, 0x0,
8569                     NULL, HFILL }
8570                 },
8571                 { &hf_gsm_a_sm_qos_guar_bitrate_downl,
8572                   { "Guaranteed bitrate for downlink", "gsm_a.gm.sm.qos.guar_bitrate_downl",
8573                     FT_UINT8, BASE_DEC, NULL, 0x0,
8574                     NULL, HFILL }
8575                 },
8576                 { &hf_gsm_a_sm_qos_max_bitrate_upl_ext,
8577                   { "Maximum bitrate for uplink (extended)", "gsm_a.gm.sm.qos.max_bitrate_upl_ext",
8578                     FT_UINT8, BASE_DEC, NULL, 0x0,
8579                     NULL, HFILL }
8580                 },
8581                 { &hf_gsm_a_sm_qos_max_bitrate_downl_ext,
8582                   { "Maximum bitrate for downlink (extended)", "gsm_a.gm.sm.qos.max_bitrate_downl_ext",
8583                     FT_UINT8, BASE_DEC, NULL, 0x0,
8584                     NULL, HFILL }
8585                 },
8586                 { &hf_gsm_a_sm_qos_guar_bitrate_upl_ext,
8587                   { "Guaranteed bitrate for uplink (extended)", "gsm_a.gm.sm.qos.guar_bitrate_upl_ext",
8588                     FT_UINT8, BASE_DEC, NULL, 0x0,
8589                     NULL, HFILL }
8590                 },
8591                 { &hf_gsm_a_sm_qos_guar_bitrate_downl_ext,
8592                   { "Guaranteed bitrate for downlink (extended)", "gsm_a.gm.sm.qos.guar_bitrate_downl_ext",
8593                     FT_UINT8, BASE_DEC, NULL, 0x0,
8594                     NULL, HFILL }
8595                 },
8596                 { &hf_gsm_a_sm_qos_max_bitrate_upl_ext2,
8597                   { "Maximum bitrate for uplink (extended-2)", "gsm_a.gm.sm.qos.max_bitrate_upl_ext2",
8598                     FT_UINT8, BASE_DEC, NULL, 0x0,
8599                     NULL, HFILL }
8600                 },
8601                 { &hf_gsm_a_sm_qos_max_bitrate_downl_ext2,
8602                   { "Maximum bitrate for downlink (extended-2)", "gsm_a.gm.sm.qos.max_bitrate_downl_ext2",
8603                     FT_UINT8, BASE_DEC, NULL, 0x0,
8604                     NULL, HFILL }
8605                 },
8606                 { &hf_gsm_a_sm_qos_guar_bitrate_upl_ext2,
8607                   { "Guaranteed bitrate for uplink (extended-2)", "gsm_a.gm.sm.qos.guar_bitrate_upl_ext2",
8608                     FT_UINT8, BASE_DEC, NULL, 0x0,
8609                     NULL, HFILL }
8610                 },
8611                 { &hf_gsm_a_sm_qos_guar_bitrate_downl_ext2,
8612                   { "Guaranteed bitrate for downlink (extended-2)", "gsm_a.gm.sm.qos.guar_bitrate_downl_ext2",
8613                     FT_UINT8, BASE_DEC, NULL, 0x0,
8614                     NULL, HFILL }
8615                 },
8616                 { &hf_gsm_a_sm_eplmnc,
8617                   { "EPLMNC", "gsm_a.gm.sm.re_attempt_ind.eplmnc",
8618                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_eplmnc_value), 0x02,
8619                     NULL, HFILL }
8620                 },
8621                 { &hf_gsm_a_sm_ratc,
8622                   { "RATC", "gsm_a.gm.sm.re_attempt_ind.ratc",
8623                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_ratc_value), 0x01,
8624                     NULL, HFILL }
8625                 },
8626                 { &hf_gsm_a_sm_cause,
8627                   { "SM Cause", "gsm_a.gm.sm.cause",
8628                     FT_UINT8, BASE_DEC, NULL, 0x0,
8629                     NULL, HFILL }
8630                 },
8631                 { &hf_gsm_a_sm_cause_2,
8632                   { "SM Cause 2", "gsm_a.gm.sm.cause_2",
8633                     FT_UINT8, BASE_DEC, NULL, 0x0,
8634                     NULL, HFILL }
8635                 },
8636                 { &hf_gsm_a_sm_llc_sapi,
8637                   { "LLC SAPI", "gsm_a.gm.sm.llc_sapi",
8638                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_llc_sapi_vals), 0x0f,
8639                     NULL, HFILL }
8640                 },
8641                 { &hf_gsm_a_sm_tdi,
8642                   { "Tear Down Indicator (TDI)", "gsm_a.gm.sm.tdi",
8643                     FT_BOOLEAN, 8, TFS(&gsm_a_sm_tdi_value), 0x01,
8644                     NULL, HFILL }
8645                 },
8646                 { &hf_gsm_a_sm_packet_flow_id,
8647                   { "Packet Flow Identifier (PFI)", "gsm_a.gm.sm.packet_flow_id",
8648                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_sm_packet_flow_id_vals), 0x7f,
8649                     NULL, HFILL }
8650                 },
8651                 { &hf_gsm_a_gmm_net_cap_gea1,
8652                   { "GEA/1", "gsm_a.gm.gmm.net_cap.gea1",
8653                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x80,
8654                     NULL, HFILL }
8655                 },
8656                 { &hf_gsm_a_gmm_net_cap_smdch,
8657                   { "SM capabilities via dedicated channels", "gsm_a.gm.gmm.net_cap.smdch",
8658                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_smdch_vals), 0x40,
8659                     NULL, HFILL }
8660                 },
8661                 { &hf_gsm_a_gmm_net_cap_smgprs,
8662                   { "SM capabilities via GPRS channels", "gsm_a.gm.gmm.net_cap.smgprs",
8663                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_smgprs_vals), 0x20,
8664                     NULL, HFILL }
8665                 },
8666                 { &hf_gsm_a_gmm_net_cap_ucs2,
8667                   { "UCS2 support", "gsm_a.gm.gmm.net_cap.ucs2",
8668                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_ucs2_vals), 0x10,
8669                     NULL, HFILL }
8670                 },
8671                 { &hf_gsm_a_gmm_net_cap_ss_scr_ind,
8672                   { "SS Screening Indicator", "gsm_a.gm.gmm.net_cap.ss_scr_ind",
8673                     FT_UINT8, BASE_HEX, VALS(gsm_a_gmm_net_cap_ss_scr_ind_vals), 0x0c,
8674                     NULL, HFILL }
8675                 },
8676                 { &hf_gsm_a_gmm_net_cap_solsa,
8677                   { "SoLSA Capability", "gsm_a.gm.gmm.net_cap.solsa",
8678                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_solsa_vals), 0x02,
8679                     NULL, HFILL }
8680                 },
8681                 { &hf_gsm_a_gmm_net_cap_rev,
8682                   { "Revision level indicator", "gsm_a.gm.gmm.net_cap.rev",
8683                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_rev_vals), 0x01,
8684                     NULL, HFILL }
8685                 },
8686                 { &hf_gsm_a_gmm_net_cap_pfc,
8687                   { "PFC feature mode", "gsm_a.gm.gmm.net_cap.pfc",
8688                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_pfc_vals), 0x80,
8689                     NULL, HFILL }
8690                 },
8691                 { &hf_gsm_a_gmm_net_cap_ext_gea_bits,
8692                   { "Extended GEA bits", "gsm_a.gm.gmm.net_cap.ext_gea_bits",
8693                     FT_UINT8, BASE_HEX, NULL, 0x7e,
8694                     NULL, HFILL }
8695                 },
8696                 { &hf_gsm_a_gmm_net_cap_gea2,
8697                   { "GEA/2", "gsm_a.gm.gmm.net_cap.gea2",
8698                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x40,
8699                     NULL, HFILL }
8700                 },
8701                 { &hf_gsm_a_gmm_net_cap_gea3,
8702                   { "GEA/3", "gsm_a.gm.gmm.net_cap.gea3",
8703                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x20,
8704                     NULL, HFILL }
8705                 },
8706                 { &hf_gsm_a_gmm_net_cap_gea4,
8707                   { "GEA/4", "gsm_a.gm.gmm.net_cap.gea4",
8708                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x10,
8709                     NULL, HFILL }
8710                 },
8711                 { &hf_gsm_a_gmm_net_cap_gea5,
8712                   { "GEA/5", "gsm_a.gm.gmm.net_cap.gea5",
8713                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x08,
8714                     NULL, HFILL }
8715                 },
8716                 { &hf_gsm_a_gmm_net_cap_gea6,
8717                   { "GEA/6", "gsm_a.gm.gmm.net_cap.gea6",
8718                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x04,
8719                     NULL, HFILL }
8720                 },
8721                 { &hf_gsm_a_gmm_net_cap_gea7,
8722                   { "GEA/7", "gsm_a.gm.gmm.net_cap.gea7",
8723                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x02,
8724                     NULL, HFILL }
8725                 },
8726                 { &hf_gsm_a_gmm_net_cap_lcs,
8727                   { "LCS VA capability", "gsm_a.gm.gmm.net_cap.lcs",
8728                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_lcs_vals), 0x01,
8729                     NULL, HFILL }
8730                 },
8731                 { &hf_gsm_a_gmm_net_cap_ps_irat_iu,
8732                   { "PS inter-RAT HO from GERAN to UTRAN Iu mode capability", "gsm_a.gm.gmm.net_cap.ps_irat_iu",
8733                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_ps_irat_iu_vals), 0x80,
8734                     NULL, HFILL }
8735                 },
8736                 { &hf_gsm_a_gmm_net_cap_ps_irat_s1,
8737                   { "PS inter-RAT HO from GERAN to E-UTRAN S1 mode capability", "gsm_a.gm.gmm.net_cap.ps_irat_s1",
8738                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_ps_irat_s1_vals), 0x40,
8739                     NULL, HFILL }
8740                 },
8741                 { &hf_gsm_a_gmm_net_cap_comb_proc,
8742                   { "EMM Combined procedures capability", "gsm_a.gm.gmm.net_cap.comb_proc",
8743                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_comb_proc_vals), 0x20,
8744                     NULL, HFILL }
8745                 },
8746                 { &hf_gsm_a_gmm_net_cap_isr,
8747                   { "ISR support", "gsm_a.gm.gmm.net_cap.isr",
8748                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_isr_vals), 0x10,
8749                     NULL, HFILL }
8750                 },
8751                 { &hf_gsm_a_gmm_net_cap_srvcc_to_geran,
8752                   { "SRVCC to GERAN/UTRAN capability", "gsm_a.gm.gmm.net_cap.srvcc_to_geran",
8753                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_srvcc_to_geran_vals), 0x08,
8754                     NULL, HFILL }
8755                 },
8756                 { &hf_gsm_a_gmm_net_cap_epc,
8757                   { "EPC capability", "gsm_a.gm.gmm.net_cap.epc",
8758                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_epc_vals), 0x04,
8759                     NULL, HFILL }
8760                 },
8761                 { &hf_gsm_a_gmm_net_cap_nf,
8762                   { "NF capability", "gsm_a.gm.gmm.net_cap.nf",
8763                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_nf_vals), 0x02,
8764                     NULL, HFILL }
8765                 },
8766                 { &hf_gsm_a_gmm_net_geran_net_sharing,
8767                   { "GERAN network sharing capability", "gsm_a.gm.gmm.net_cap.geran_net_sharing",
8768                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_geran_net_vals), 0x01,
8769                     NULL, HFILL }
8770                 },
8771                 { &hf_gsm_a_gmm_net_cap_up_int_prot,
8772                   { "User plane integrity protection support", "gsm_a.gm.gmm.net_cap.up_int_prot",
8773                     FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
8774                     NULL, HFILL }
8775                 },
8776                 { &hf_gsm_a_gmm_net_cap_up_gia4,
8777                   { "GIA/4", "gsm_a.gm.gmm.net_cap.gia4",
8778                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gia_vals), 0x40,
8779                     NULL, HFILL }
8780                 },
8781                 { &hf_gsm_a_gmm_net_cap_up_gia5,
8782                   { "GIA/5", "gsm_a.gm.gmm.net_cap.gia5",
8783                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gia_vals), 0x20,
8784                     NULL, HFILL }
8785                 },
8786                 { &hf_gsm_a_gmm_net_cap_up_gia6,
8787                   { "GIA/6", "gsm_a.gm.gmm.net_cap.gia6",
8788                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gia_vals), 0x10,
8789                     NULL, HFILL }
8790                 },
8791                 { &hf_gsm_a_gmm_net_cap_up_gia7,
8792                   { "GIA/7", "gsm_a.gm.gmm.net_cap.gia7",
8793                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gia_vals), 0x08,
8794                     NULL, HFILL }
8795                 },
8796                 { &hf_gsm_a_gmm_net_cap_epco_ie_ind,
8797                   { "ePCO IE indicator", "gsm_a.gm.gmm.net_cap.epco_ie_ind",
8798                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_epco_ie_ind_vals), 0x04,
8799                     NULL, HFILL }
8800                 },
8801                 { &hf_gsm_a_gmm_net_cap_restrict_use_enh_cov,
8802                   { "Restriction on use of enhanced coverage capability", "gsm_a.gm.gmm.net_cap.restrict_use_enh_cov",
8803                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_restrict_use_enh_cov_vals), 0x02,
8804                     NULL, HFILL }
8805                 },
8806                 { &hf_gsm_a_gmm_net_cap_dc_eutra_nr_cap,
8807                   { "Dual connectivity of E-UTRA with NR capability", "gsm_a.gm.gmm.net_cap.dc_eutra_nr_cap",
8808                     FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_dc_eutra_nr_cap_vals), 0x01,
8809                     NULL, HFILL }
8810                 },
8811                 { &hf_gsm_a_sm_tmgi,
8812                   { "Temporary Mobile Group Identity (TMGI)", "gsm_a.gm.sm.tmgi",
8813                     FT_UINT24, BASE_HEX, NULL, 0x0,
8814                     NULL, HFILL }
8815                 },
8816                 { &hf_gsm_a_sm_enh_nsapi,
8817                   { "Enhanced NSAPI", "gsm_a.gm.sm.enh_nsapi",
8818                     FT_UINT8, BASE_DEC, NULL, 0x0,
8819                     NULL, HFILL }
8820                 },
8821                 { &hf_gsm_a_sm_req_type,
8822                   { "Request type", "gsm_a.gm.sm.req_type",
8823                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_req_type_vals), 0x07,
8824                     NULL, HFILL }
8825                 },
8826                 { &hf_gsm_a_sm_notif_ind,
8827                   { "Notification indicator", "gsm_a.gm.sm.notif_ind",
8828                     FT_UINT8, BASE_DEC, VALS(gsm_a_sm_notif_ind_vals), 0x0,
8829                     NULL, HFILL }
8830                 },
8831                 { &hf_gsm_a_sm_connectivity_type,
8832                   { "Connectivity type", "gsm_a.gm.sm.connectivity_type",
8833                     FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_sm_connectivity_type_vals), 0x0F,
8834                     NULL, HFILL }
8835                 },
8836                 { &hf_gsm_a_sm_wlan_utran_offload_accept,
8837                   { "WLAN UTRAN offload acceptability", "gsm_a.gm.sm.wlan_utran_offload_accept",
8838                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_sm_wlan_utran_offload_accept_value), 0x0,
8839                     NULL, HFILL }
8840                 },
8841                 { &hf_gsm_a_sm_wlan_eutran_offload_accept,
8842                   { "WLAN E-UTRAN offload acceptability", "gsm_a.gm.sm.wlan_eutran_offload_accept",
8843                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_sm_wlan_eutran_offload_accept_value), 0x0,
8844                     NULL, HFILL }
8845                 },
8846                 { &hf_gsm_a_sm_nbifom_cont,
8847                   { "NBIFOM container content", "gsm_a.gm.sm.nbifom_cont",
8848                     FT_BYTES, BASE_NONE, NULL, 0x0,
8849                     NULL, HFILL }
8850                 },
8851                 { &hf_gsm_a_gm_rac_ctrled_early_cm_sending,
8852                   { "Controlled early Classmark Sending", "gsm_a.gm.gmm.rac.ctrled_early_cm_sending",
8853                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_implemented_not_implemented), 0x0,
8854                     NULL, HFILL }
8855                 },
8856                 { &hf_gsm_a_gm_rac_pseudo_sync,
8857                   { "Pseudo Synchronisation", "gsm_a.gm.gmm.rac.pseudo_sync",
8858                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_present_not_present), 0x0,
8859                     NULL, HFILL }
8860                 },
8861                 { &hf_gsm_a_gm_rac_vgcs,
8862                   { "Voice Group Call Service", "gsm_a.gm.gmm.rac.vgcs",
8863                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_vgcs), 0x0,
8864                     NULL, HFILL }
8865                 },
8866                 { &hf_gsm_a_gm_rac_vbs,
8867                   { "Voice Broadcast Service", "gsm_a.gm.gmm.rac.vbs",
8868                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_vbs), 0x0,
8869                     NULL, HFILL }
8870                 },
8871                 { &hf_gsm_a_gm_rac_multislot_capability,
8872                   { "Multislot capability struct", "gsm_a.gm.gmm.rac.multislot_capability",
8873                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_present_not_present), 0x0,
8874                     NULL, HFILL }
8875                 },
8876                 { &hf_gsm_a_gm_rac_hscsd_multi_slot_class,
8877                   { "HSCSD multislot class", "gsm_a.gm.gmm.rac.hscsd_multi_slot_class",
8878                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
8879                     NULL, HFILL }
8880                 },
8881                 { &hf_gsm_a_gm_rac_gprs_multi_slot_class,
8882                   { "GPRS multislot class", "gsm_a.gm.gmm.rac.gprs_multi_slot_class",
8883                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
8884                     NULL, HFILL }
8885                 },
8886                 { &hf_gsm_a_gm_rac_gprs_ext_dyn_alloc_cap,
8887                   { "GPRS Extended Dynamic Allocation Capability", "gsm_a.gm.gmm.rac.gprs_ext_dyn_alloc_cap",
8888                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_implemented_not_implemented), 0x0,
8889                     NULL, HFILL }
8890                 },
8891                 { &hf_gsm_a_gm_rac_ecsd_multi_slot_class,
8892                   { "ECSD multislot class", "gsm_a.gm.gmm.rac.ecsd_multi_slot_class",
8893                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
8894                     NULL, HFILL }
8895                 },
8896                 { &hf_gsm_a_gm_rac_egprs_multi_slot_class,
8897                   { "EGPRS multislot class", "gsm_a.gm.gmm.rac.egprs_multi_slot_class",
8898                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
8899                     NULL, HFILL }
8900                 },
8901                 { &hf_gsm_a_gm_rac_egprs_ext_dyn_alloc_cap,
8902                   { "EGPRS Extended Dynamic Allocation Capability", "gsm_a.gm.gmm.rac.egprs_ext_dyn_alloc_cap",
8903                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_implemented_not_implemented), 0x0,
8904                     NULL, HFILL }
8905                 },
8906                 { &hf_gsm_a_gm_rac_dtm_gprs_multi_slot_class,
8907                   { "DTM GPRS Multi Slot Class", "gsm_a.gm.gmm.rac.dtm_gprs_multi_slot_class",
8908                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_multi_slot_class_vals), 0x0,
8909                     NULL, HFILL }
8910                 },
8911                 { &hf_gsm_a_gm_rac_single_slt_dtm,
8912                   { "Single Slot DTM", "gsm_a.gm.gmm.rac.single_slt_dtm",
8913                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8914                     NULL, HFILL }
8915                 },
8916                 { &hf_gsm_a_gm_rac_dtm_egprs_multi_slot_cls_pres,
8917                   { "DTM EGPRS Multi Slot Class", "gsm_a.gm.gmm.rac.dtm_egprs_multi_slot_cls_pres",
8918                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_present_not_present), 0x0,
8919                     NULL, HFILL }
8920                 },
8921                 { &hf_gsm_a_gm_rac_dtm_egprs_multi_slot_class,
8922                   { "DTM EGPRS Multi Slot Class", "gsm_a.gm.gmm.rac.dtm_egprs_multi_slot_class",
8923                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_multi_slot_class_vals), 0x0,
8924                     NULL, HFILL }
8925                 },
8926                 { &hf_gsm_a_gm_rac_8psk_pow_cap_pres,
8927                   { "8PSK Power Capability Bits", "gsm_a.gm.gmm.rac.8psk_pow_cap_pres",
8928                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_present_not_present), 0x0,
8929                     NULL, HFILL }
8930                 },
8931                 { &hf_gsm_a_gm_rac_comp_int_meas_cap,
8932                   { "COMPACT Interference Measurement Capability", "gsm_a.gm.gmm.rac.comp_int_meas_cap",
8933                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_implemented_not_implemented), 0x0,
8934                     NULL, HFILL }
8935                 },
8936                 { &hf_gsm_a_gm_rel_lev_ind,
8937                   { "Revision Level Indicator", "gsm_a.gm.gmm.rel_lev_ind",
8938                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_revision_level_indicator), 0x0,
8939                     NULL, HFILL }
8940                 },
8941                 { &hf_gsm_a_gm_rac_umts_fdd_cap,
8942                   { "UMTS FDD Radio Access Technology Capability", "gsm_a.gm.gmm.rac.umts_fdd_cap",
8943                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8944                     NULL, HFILL }
8945                 },
8946                 { &hf_gsm_a_gm_rac_umts_384_tdd_ra_cap,
8947                   { "UMTS 3.84 Mcps TDD Radio Access Technology Capability", "gsm_a.gm.gmm.rac.umts_384_tdd_ra_cap",
8948                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8949                     NULL, HFILL }
8950                 },
8951                 { &hf_gsm_a_gm_rac_cdma2000_cap,
8952                   { "CDMA 2000 Radio Access Technology Capability", "gsm_a.gm.gmm.rac.cdma2000_cap",
8953                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8954                     NULL, HFILL }
8955                 },
8956                 { &hf_gsm_a_gm_rac_umts_128_tdd_ra_cap,
8957                   { "UMTS 1.28 Mcps TDD Radio Access Technology Capability", "gsm_a.gm.gmm.rac.umts_128_tdd_ra_cap",
8958                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8959                     NULL, HFILL }
8960                 },
8961                 { &hf_gsm_a_gm_rac_geran_feat_pkg,
8962                   { "GERAN Feature Package 1", "gsm_a.gm.gmm.rac.geran_feat_pkg",
8963                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8964                     NULL, HFILL }
8965                 },
8966                 { &hf_gsm_a_gm_rac_mod_based_multi_slot_class_support,
8967                   { "Modulation based multislot class support", "gsm_a.gm.gmm.rac.mod_based_multi_slot_class_support",
8968                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8969                     NULL, HFILL }
8970                 },
8971                 { &hf_gsm_a_gm_rac_geran_iu_mode_cap,
8972                   { "GERAN Iu mode", "gsm_a.gm.gmm.rac.geran_iu_mode_cap",
8973                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8974                     NULL, HFILL }
8975                 },
8976                 { &hf_gsm_a_gm_rac_flo_iu_cap,
8977                   { "FLO Iu Capability", "gsm_a.gm.gmm.rac.flo_iu_cap",
8978                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8979                     NULL, HFILL }
8980                 },
8981                 { &hf_gsm_a_gm_rac_mult_tbf_cap,
8982                   { "Multiple TBF Capability", "gsm_a.gm.gmm.rac.mult_tbf_cap",
8983                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8984                     NULL, HFILL }
8985                 },
8986                 { &hf_gsm_a_gm_rac_down_adv_rec_perf,
8987                   { "Downlink Advanced Receiver Performance", "gsm_a.gm.gmm.rac.down_adv_rec_perf",
8988                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_down_adv_rec_perf_vals), 0x0,
8989                     NULL, HFILL }
8990                 },
8991                 { &hf_gsm_a_gm_rac_ext_rlc_mac_ctrl_msg_seg_cap,
8992                   { "Extended RLC/MAC Control Message Segmentation Capability", "gsm_a.gm.gmm.rac.ext_rlc_mac_ctrl_msg_seg_cap",
8993                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
8994                     NULL, HFILL }
8995                 },
8996                 { &hf_gsm_a_gm_rac_dtm_enh_cap,
8997                   { "DTM Enhancements Capability", "gsm_a.gm.gmm.rac.dtm_enh_cap",
8998                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_dtm_enh_cap), 0x0,
8999                     NULL, HFILL }
9000                 },
9001                 { &hf_gsm_a_gm_rac_dtm_gprs_high_multi_slot_class,
9002                   { "DTM GPRS High Multi Slot Class", "gsm_a.gm.gmm.rac.dtm_gprs_high_multi_slot_class",
9003                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_high_multi_slot_class_vals), 0x0,
9004                     NULL, HFILL }
9005                 },
9006                 { &hf_gsm_a_gm_rac_dtm_egprs_high_multi_slot_class,
9007                   { "DTM EGPRS High Multi Slot Class", "gsm_a.gm.gmm.rac.dtm_egprs_high_multi_slot_class",
9008                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_high_multi_slot_class_vals), 0x0,
9009                     NULL, HFILL }
9010                 },
9011                 { &hf_gsm_a_gm_rac_ps_ho_cap,
9012                   { "PS Handover Capability", "gsm_a.gm.gmm.rac.ps_ho_cap",
9013                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9014                     NULL, HFILL }
9015                 },
9016                 { &hf_gsm_a_gm_rac_dtm_ho_cap,
9017                   { "DTM Handover Capability", "gsm_a.gm.gmm.rac.dtm_ho_cap",
9018                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9019                     NULL, HFILL }
9020                 },
9021                 { &hf_gsm_a_gm_rac_multi_slot_cap_red_down_dual_carrier,
9022                   { "Multislot Capability Reduction for Downlink Dual Carrier", "gsm_a.gm.gmm.rac.multi_slot_cap_red_down_dual_carrier",
9023                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_cap_red_down_dual_carrier_vals), 0x0,
9024                     NULL, HFILL }
9025                 },
9026                 { &hf_gsm_a_gm_rac_down_dual_carrier_dtm_cap,
9027                   { "Downlink Dual Carrier for DTM Capability", "gsm_a.gm.gmm.rac.down_dual_carrier_dtm_cap",
9028                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9029                     NULL, HFILL }
9030                 },
9031                 { &hf_gsm_a_gm_rac_flex_ts_assign,
9032                   { "Flexible Timeslot Assignment", "gsm_a.gm.gmm.rac.flex_ts_assign",
9033                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9034                     NULL, HFILL }
9035                 },
9036                 { &hf_gsm_a_gm_rac_gan_ps_ho_cap,
9037                   { "GAN PS Handover Capability", "gsm_a.gm.gmm.rac.gan_ps_ho_cap",
9038                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9039                     NULL, HFILL }
9040                 },
9041                 { &hf_gsm_a_gm_rac_rlc_non_pers_mode,
9042                   { "RLC Non-persistent Mode", "gsm_a.gm.gmm.rac.rlc_non_pers_mode",
9043                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9044                     NULL, HFILL }
9045                 },
9046                 { &hf_gsm_a_gm_rac_reduced_lat_cap,
9047                   { "Reduced Latency Capability", "gsm_a.gm.gmm.rac.reduced_lat_cap",
9048                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9049                     NULL, HFILL }
9050                 },
9051                 { &hf_gsm_a_gm_rac_ul_egprs2,
9052                   { "Uplink EGPRS2", "gsm_a.gm.gmm.rac.ul_egprs2",
9053                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_ul_egprs2_vals), 0x0,
9054                     NULL, HFILL }
9055                 },
9056                 { &hf_gsm_a_gm_rac_dl_egprs2,
9057                   { "Downlink EGPRS2", "gsm_a.gm.gmm.rac.dl_egprs2",
9058                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dl_egprs2_vals), 0x0,
9059                     NULL, HFILL }
9060                 },
9061                 { &hf_gsm_a_gm_rac_eutra_fdd_support,
9062                   { "E-UTRA FDD support", "gsm_a.gm.gmm.rac.eutra_fdd_support",
9063                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9064                     NULL, HFILL }
9065                 },
9066                 { &hf_gsm_a_gm_rac_eutra_tdd_support,
9067                   { "E-UTRA TDD support", "gsm_a.gm.gmm.rac.eutra_tdd_support",
9068                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9069                     NULL, HFILL }
9070                 },
9071                 { &hf_gsm_a_gm_rac_geran_to_eutra_support_in_geran_ptm,
9072                   { "GERAN to E-UTRA support in GERAN packet transfer mode", "gsm_a.gm.gmm.rac.geran_to_eutra_support_in_geran_ptm",
9073                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_geran_to_eutra_support_in_geran_ptm_vals), 0x0,
9074                     NULL, HFILL }
9075                 },
9076                 { &hf_gsm_a_gm_rac_prio_based_resel_support,
9077                   { "Priority-based reselection support", "gsm_a.gm.gmm.rac.prio_based_resel_support",
9078                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9079                     NULL, HFILL }
9080                 },
9081                 { &hf_gsm_a_gm_rac_alt_efta_multi_slot_class,
9082                   { "Alternative EFTA Multislot Class", "gsm_a.gm.gmm.rac.alt_efta_multi_slot_class",
9083                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_alt_efta_multi_slot_class_vals), 0x0,
9084                     NULL, HFILL }
9085                 },
9086                 { &hf_gsm_a_gm_rac_efta_multi_slot_cap_red_down_dual_carrier,
9087                   { "EFTA Multislot Capability Reduction for Downlink Dual Carrier", "gsm_a.gm.gmm.rac.efta_multi_slot_cap_red_down_dual_carrier",
9088                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_cap_red_down_dual_carrier_vals), 0x0,
9089                     NULL, HFILL }
9090                 },
9091                 { &hf_gsm_a_gm_rac_ind_up_layer_pdu_start_cap_for_rlc_um,
9092                   { "Indication of Upper Layer PDU Start Capability for RLC UM", "gsm_a.gm.gmm.rac.ind_up_layer_pdu_start_cap_for_rlc_um",
9093                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9094                     NULL, HFILL }
9095                 },
9096                 { &hf_gsm_a_gm_rac_emst_cap,
9097                   { "Enhanced Multiplexing for Single TBF Capability", "gsm_a.gm.gmm.rac.emst_cap",
9098                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9099                     NULL, HFILL }
9100                 },
9101                 { &hf_gsm_a_gm_rac_mtti_cap,
9102                   { "Multiple TTI Capability", "gsm_a.gm.gmm.rac.mtti_cap",
9103                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9104                     NULL, HFILL }
9105                 },
9106                 { &hf_gsm_a_gm_rac_utra_csg_cell_report,
9107                   { "Reporting of UTRAN CSG cells in packet transfer mode", "gsm_a.gm.gmm.rac.utra_csg_cell_report",
9108                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9109                     NULL, HFILL }
9110                 },
9111                 { &hf_gsm_a_gm_rac_eutra_csg_cell_report,
9112                   { "Reporting of E-UTRAN CSG cells in packet transfer mode", "gsm_a.gm.gmm.rac.eutra_csg_cell_report",
9113                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9114                     NULL, HFILL }
9115                 },
9116                 { &hf_gsm_a_gm_rac_dtr_cap,
9117                   { "Dynamic Timeslot Reduction Capability", "gsm_a.gm.gmm.rac.dtr_cap",
9118                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9119                     NULL, HFILL }
9120                 },
9121                 { &hf_gsm_a_gm_rac_emsr_cap,
9122                   { "Enhanced Multiplexing for Single RLC Entity Capability", "gsm_a.gm.gmm.rac.emsr_cap",
9123                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9124                     NULL, HFILL }
9125                 },
9126                 { &hf_gsm_a_gm_rac_fast_down_freq_switch_cap,
9127                   { "Fast Downlink Frequency Switching Capability", "gsm_a.gm.gmm.rac.fast_down_freq_switch_cap",
9128                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9129                     NULL, HFILL }
9130                 },
9131                 { &hf_gsm_a_gm_rac_tighter_cap,
9132                   { "TIGHTER Capability", "gsm_a.gm.gmm.rac.tighter_cap",
9133                     FT_UINT8, BASE_DEC, VALS(tighter_cap_level_vals), 0x0,
9134                     NULL, HFILL }
9135                 },
9136                 { &hf_gsm_a_gm_rac_fanr_cap,
9137                   { "Fast Ack/Nack Reporting Capability", "gsm_a.gm.gmm.rac.fanr_cap",
9138                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9139                     NULL, HFILL }
9140                 },
9141                 { &hf_gsm_a_gm_rac_ipa_cap,
9142                   { "Immediate Packet Assignment Capability", "gsm_a.gm.gmm.rac.ipa_cap",
9143                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9144                     NULL, HFILL }
9145                 },
9146                 { &hf_gsm_a_gm_rac_geran_nw_sharing_support,
9147                   { "GERAN Network Sharing support", "gsm_a.gm.gmm.rac.geran_nw_sharing_support",
9148                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9149                     NULL, HFILL }
9150                 },
9151                 { &hf_gsm_a_gm_rac_eutra_wb_rsrq_support,
9152                   { "E-UTRA Wideband RSRQ measurements support", "gsm_a.gm.gmm.rac.eutra_wb_rsrq_support",
9153                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9154                     NULL, HFILL }
9155                 },
9156                 { &hf_gsm_a_gm_rac_utra_mfbi_support,
9157                   { "UTRA Multiple Frequency Band Indicators support", "gsm_a.gm.gmm.rac.utra_mfbi_support",
9158                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9159                     NULL, HFILL }
9160                 },
9161                 { &hf_gsm_a_gm_rac_eutra_mfbi_support,
9162                   { "E-UTRA Multiple Frequency Band Indicators support", "gsm_a.gm.gmm.rac.eutra_mfbi_support",
9163                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9164                     NULL, HFILL }
9165                 },
9166                 { &hf_gsm_a_gm_rac_dlmc_non_contig_intra_band_recep,
9167                   { "DLMC - Non-contiguous intra-band reception", "gsm_a.gm.gmm.rac.dlmc.non_contig_intra_band_recep",
9168                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dlmc_non_contig_intra_band_recep_vals), 0x0,
9169                     NULL, HFILL }
9170                 },
9171                 { &hf_gsm_a_gm_rac_dlmc_inter_band_recep,
9172                   { "DLMC - Inter-band reception", "gsm_a.gm.gmm.rac.dlmc.inter_band_recep",
9173                     FT_BOOLEAN, BASE_NONE, TFS(&gsm_a_gm_dlmc_inter_band_recep_val), 0x0,
9174                     NULL, HFILL }
9175                 },
9176                 { &hf_gsm_a_gm_rac_dlmc_max_bandwidth,
9177                   { "DLMC - Maximum Bandwidth", "gsm_a.gm.gmm.rac.dlmc.max_bandwidth",
9178                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dlmc_max_bandwidth_vals), 0x0,
9179                     NULL, HFILL }
9180                 },
9181                 { &hf_gsm_a_gm_rac_dlmc_max_nb_dl_ts,
9182                   { "DLMC - Maximum Number of Downlink Timeslots", "gsm_a.gm.gmm.rac.dlmc.max_nb_dl_ts",
9183                     FT_UINT8, BASE_CUSTOM, CF_FUNC(gsm_a_gm_dlmc_max_nb_dl_ts_fmt), 0x0,
9184                     NULL, HFILL }
9185                 },
9186                 { &hf_gsm_a_gm_rac_dlmc_max_nb_dl_carriers,
9187                   { "DLMC - Maximum Number of Downlink Carriers", "gsm_a.gm.gmm.rac.dlmc.max_nb_dl_carriers",
9188                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dlmc_max_nb_dl_carriers_vals), 0x0,
9189                     NULL, HFILL }
9190                 },
9191                 { &hf_gsm_a_gm_rac_ext_tsc_set_cap_support,
9192                   { "Extended TSC Set Capability support", "gsm_a.gm.gmm.rac.ext_tsc_set_cap_support",
9193                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_yes_no), 0x0,
9194                     NULL, HFILL }
9195                 },
9196                 { &hf_gsm_a_gm_rac_ext_earfcn_value_range,
9197                   { "Extended EARFCN value range", "gsm_a.gm.gmm.rac.ext_earfcn_value_range",
9198                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9199                     NULL, HFILL }
9200                 },
9201                 { &hf_gsm_a_gm_rac_ec_pch_mon_support,
9202                   { "(EC-)PCH monitoring support", "gsm_a.gm.gmm.rac.ec_pch_mon_support",
9203                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_ec_pch_mon_support_vals), 0x0,
9204                     NULL, HFILL }
9205                 },
9206                 { &hf_gsm_a_gm_rac_ms_sync_accuracy,
9207                   { "MS Sync Accuracy", "gsm_a.gm.gmm.rac.ms_sync_accuracy",
9208                     FT_UINT8, BASE_DEC, NULL, 0x0,
9209                     NULL, HFILL }
9210                 },
9211                 { &hf_gsm_a_gm_rac_ext_ec_ul_cov_enh_support,
9212                   { "EC uplink coverage enhancement support", "gsm_a.gm.gmm.rac.ec_ul_cov_enh_support",
9213                     FT_BOOLEAN, BASE_NONE, TFS(&tfs_supported_not_supported), 0x0,
9214                     NULL, HFILL }
9215                 },
9216                 { &hf_gsm_a_sm_ti_flag,
9217                   { "TI Flag", "gsm_a.gm.sm.ti_flag",
9218                     FT_BOOLEAN, 8, TFS(&gsm_a_sm_ti_flag_vals), 0x80,
9219                     NULL, HFILL }
9220                 },
9221                 { &hf_gsm_a_sm_ext,
9222                   { "Extension", "gsm_a.gm.sm.ext",
9223                     FT_BOOLEAN, 8, NULL, 0x80,
9224                     NULL, HFILL }
9225                 },
9226                 { &hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_aer,
9227                   { "AER", "gsm_a.gm.sm.pco.apn_rate_ctrl_params.aer",
9228                     FT_BOOLEAN, 8, TFS(&gsm_a_gm_apn_rate_ctrl_params_aer_value), 0x08,
9229                     NULL, HFILL }
9230                 },
9231                 { &hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_ul_time_unit,
9232                   { "Uplink time unit", "gsm_a.gm.sm.pco.apn_rate_ctrl_params.ul_time_unit",
9233                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_apn_rate_ctrl_ul_time_unit_vals), 0x07,
9234                     NULL, HFILL }
9235                 },
9236                 { &hf_gsm_a_gm_sm_pco_apn_rate_ctrl_params_max_ul_rate,
9237                   { "Maximum uplink rate", "gsm_a.gm.sm.pco.apn_rate_ctrl_params.max_ul_rate",
9238                     FT_UINT24, BASE_DEC|BASE_UNIT_STRING, &units_message_messages, 0x0,
9239                     NULL, HFILL }
9240                 },
9241                 { &hf_gsm_a_gm_sm_pco_3gpp_data_off_ue_status,
9242                   { "3GPP PS data off UE status", "gsm_a.gm.sm.pco.3gpp_data_off_ue_status",
9243                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_sm_pco_3gpp_data_off_ue_status_vals), 0x0,
9244                     NULL, HFILL }
9245                 },
9246                 { &hf_gsm_a_gm_sm_pco_add_apn_rate_ctrl_params_ul_time_unit,
9247                   { "Uplink time unit", "gsm_a.gm.sm.pco.add_apn_rate_ctrl_params.ul_time_unit",
9248                     FT_UINT8, BASE_DEC, VALS(gsm_a_gm_apn_rate_ctrl_ul_time_unit_vals), 0x07,
9249                     NULL, HFILL }
9250                 },
9251                 { &hf_gsm_a_gm_sm_pco_add_apn_rate_ctrl_params_max_ul_rate,
9252                   { "Additional uplink rate for exception data", "gsm_a.gm.sm.pco.add_apn_rate_ctrl_params.max_ul_rate",
9253                     FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_message_messages, 0x0,
9254                     NULL, HFILL }
9255                 },
9256                 { &hf_gsm_a_gm_sm_pco_pdu_session_id,
9257                   { "PDU session identity", "gsm_a.gm.sm.pco.pdu_session_id",
9258                     FT_UINT8, BASE_DEC, VALS(nas_5gs_pdu_session_id_vals), 0x0,
9259                     NULL, HFILL }
9260                 },
9261                 { &hf_gsm_a_gm_sm_pco_pdu_session_address_lifetime,
9262                   { "PDU session address lifetime", "gsm_a.gm.sm.pco.pdu_session_address_lifetime",
9263                     FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_second_seconds, 0x0,
9264                     NULL, HFILL }
9265                 },
9266                 /* Generated from convert_proto_tree_add_text.pl */
9267                 { &hf_gsm_a_gm_presence, { "Presence", "gsm_a.gm.gmm.presence", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9268                 { &hf_gsm_a_gm_8psk_power_class, { "8PSK Power Class", "gsm_a.gm.8psk_power_class", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_8psk_power_class_vals), 0x0, NULL, HFILL }},
9269                 { &hf_gsm_a_gm_rf_power_capability, { "RF Power Capability", "gsm_a.gm.rf_power_capability", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9270                 { &hf_gsm_a_gm_a5_bits, { "A5 Bits", "gsm_a.gm.a5_bits", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9271                 { &hf_gsm_a_gm_8psk_power_capability, { "8PSK Power Capability", "gsm_a.gm.8psk_power_capability", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_8psk_power_cap_vals), 0x0, NULL, HFILL }},
9272                 { &hf_gsm_a_gm_extended_dtm_gprs_multi_slot_class, { "Extended DTM GPRS Multi Slot Class", "gsm_a.gm.extended_dtm_gprs_multi_slot_class", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_extended_dtm_gprs_multi_slot_class_vals), 0x0, NULL, HFILL }},
9273                 { &hf_gsm_a_gm_extended_dtm_egprs_multi_slot_class, { "Extended DTM EGPRS Multi Slot Class", "gsm_a.gm.extended_dtm_egprs_multi_slot_class", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_extended_dtm_gprs_multi_slot_class_vals), 0x0, NULL, HFILL }},
9274                 { &hf_gsm_a_gm_high_multislot_capability, { "High Multislot Capability", "gsm_a.gm.high_multislot_capability", FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
9275                 { &hf_gsm_a_gm_gmsk_multislot_power_profile, { "GMSK Multislot Power Profile", "gsm_a.gm.gmsk_multislot_power_profile", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_gmsk_multislot_power_profile_vals), 0x0, NULL, HFILL }},
9276                 { &hf_gsm_a_gm_8psk_multislot_power_profile, { "8-PSK Multislot Power Profile", "gsm_a.gm.8psk_multislot_power_profile", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_8psk_multislot_power_profile_vals), 0x0, NULL, HFILL }},
9277                 { &hf_gsm_a_gm_update_result, { "Update Result", "gsm_a.gm.gmm.update_result", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_update_res_vals), 0x70, NULL, HFILL }},
9278                 { &hf_gsm_a_gm_radio_priority_pdp, { "Radio Priority (PDP or SMS)", "gsm_a.gm.radio_priority_pdp", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_radio_prio_vals), 0x07, NULL, HFILL }},
9279                 { &hf_gsm_a_gm_radio_priority_tom8, { "Radio Priority (TOM8)", "gsm_a.gm.radio_priority_tom8", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_radio_prio_vals), 0x70, NULL, HFILL }},
9280                 { &hf_gsm_a_gm_configuration_protocol, { "Configuration Protocol", "gsm_a.gm.configuration_protocol", FT_UINT8, BASE_DEC, NULL, 0x7, NULL, HFILL }},
9281                 { &hf_gsm_a_gm_sm_pco_length, { "Length", "gsm_a.gm.sm.pco.length", FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
9282                 { &hf_gsm_a_gm_sm_pco_pcscf_ipv6, { "IPv6", "gsm_a.gm.sm.pco.pcscf.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9283                 { &hf_gsm_a_gm_sm_pco_dns_ipv6, { "IPv6", "gsm_a.gm.sm.pco.dns.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9284                 { &hf_gsm_a_gm_sm_pco_dsmipv6_home_agent_ipv6, { "IPv6", "gsm_a.gm.sm.pco.dsmipv6_home_agent.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9285                 { &hf_gsm_a_gm_sm_pco_dsmipv6_home_network_ipv6, { "IPv6", "gsm_a.gm.sm.pco.dsmipv6_home_network.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9286                 { &hf_gsm_a_gm_sm_pco_dsmipv6_home_network_prefix_length, { "Prefix length", "gsm_a.gm.sm.pco.dsmipv6_home_network.ipv6_prefix_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9287                 { &hf_gsm_a_gm_sm_pco_reject_code, { "Reject Code", "gsm_a.gm.sm.pco.reject_code", FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
9288                 { &hf_gsm_a_gm_sm_pco_dsmipv6_home_agent_ipv4, { "IPv4", "gsm_a.gm.sm.pco.dsmipv6_home_agent.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9289                 { &hf_gsm_a_gm_sm_pco_pcscf_ipv4, { "IPv4", "gsm_a.gm.sm.pco.pcscf.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9290                 { &hf_gsm_a_gm_sm_pco_dns_ipv4, { "IPv4", "gsm_a.gm.sm.pco.dns.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9291                 { &hf_gsm_a_gm_sm_pco_ipv4_link_mtu_size, { "IPv4 link MTU size", "gsm_a.gm.sm.pco.ipv4_link_mtu_size", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }},
9292                 { &hf_gsm_a_gm_sm_pco_nbifom_mode, { "NBIFOM mode", "gsm_a.gm.sm.pco.nbifom_mode", FT_UINT8, BASE_HEX, VALS(gsm_a_gm_nbifom_mode_vals), 0x0, NULL, HFILL }},
9293                 { &hf_gsm_a_gm_sm_pco_non_ip_link_mtu_size, { "Non-IP link MTU size", "gsm_a.gm.sm.pco.non_ip_link_mtu_size", FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, NULL, HFILL }},
9294                 { &hf_gsm_a_gm_sm_pco_sel_bearer_ctrl_mode, { "Selected Bearer Control Mode", "gsm_a.gm.sm.pco.sel_bearer_ctrl_mode", FT_UINT8, BASE_DEC, VALS(gsm_a_gm_sel_bearer_ctrl_mode_vals), 0x0, NULL, HFILL }},
9295                 { &hf_gsm_a_sm_pdp_type_number, { "PDP type number", "gsm_a.gm.sm.pdp_type_number", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9296                 { &hf_gsm_a_sm_pdp_address, { "PDP address", "gsm_a.gm.sm.pdp_address", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9297                 { &hf_gsm_a_sm_qos_maximum_sdu_size, { "Maximum SDU size", "gsm_a.gm.sm.qos.maximum_sdu_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9298                 { &hf_gsm_a_gm_ti_value, { "TI value", "gsm_a.gm.ti_value", FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
9299                 { &hf_gsm_a_sm_tft_packet_filter, { "Packet filter", "gsm_a.gm.sm.tft.packet_filter", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9300                 { &hf_gsm_a_sm_tft_packet_evaluation_precedence, { "Packet evaluation precedence", "gsm_a.gm.sm.tft.packet_evaluation_precedence", FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
9301                 { &hf_gsm_a_sm_tft_packet_filter_length, { "Packet filter length", "gsm_a.gm.sm.tft.packet_filter_length", FT_UINT8, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
9302                 { &hf_gsm_a_sm_tft_authorization_token_value, { "Authorization token value", "gsm_a.gm.sm.tft.authorization_token_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9303                 { &hf_gsm_a_sm_tft_media_component_number_value, { "Media Component number value", "gsm_a.gm.sm.tft.media_component_number_value", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
9304                 { &hf_gsm_a_sm_tft_ip_flow_number, { "IP flow number", "gsm_a.gm.sm.tft.ip_flow_number", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
9305                 { &hf_gsm_a_sm_tft_packet_filter_identifier, { "Packet filter identifier", "gsm_a.gm.sm.tft.packet_filter_identifier", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
9306                 { &hf_gsm_a_sm_tft_parameter_content, { "Parameter content", "gsm_a.gm.sm.tft.parameter_content", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
9307                 { &hf_gsm_a_sm_tft_packet_filter_component_type_id, { "Packet filter component type identifier", "gsm_a.gm.sm.tft.packet_filter_component_type_id", FT_UINT8, BASE_DEC, VALS(packet_filter_component_type_vals), 0x0, NULL, HFILL }},
9308         };
9309
9310         static ei_register_info ei[] = {
9311                 { &ei_gsm_a_gm_extraneous_data, { "gsm_a.gm.extraneous_data", PI_PROTOCOL, PI_NOTE, "Extraneous Data, dissector bug or later version spec (report to wireshark.org)", EXPFILL }},
9312                 { &ei_gsm_a_gm_not_enough_data, { "gsm_a.gm.not_enough_data", PI_PROTOCOL, PI_WARN, "Not enough data", EXPFILL }},
9313                 { &ei_gsm_a_gm_undecoded, { "gsm_a.gm.undecoded", PI_UNDECODED, PI_WARN, "Not decoded", EXPFILL }},
9314                 { &ei_gsm_a_gm_apn_too_long, { "gsm_a.gm.apn_to_long", PI_PROTOCOL, PI_ERROR, "APN encoding has more than 100 octets", EXPFILL }},
9315                 { &ei_gsm_a_gm_missing_mandatory_element, { "gsm_a.gm.missing_mandatory_element", PI_PROTOCOL, PI_ERROR, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }},
9316         };
9317
9318         expert_module_t* expert_gsm_a_gm;
9319
9320         /* Setup protocol subtree array */
9321 #define NUM_INDIVIDUAL_ELEMS    7
9322         gint *ett[NUM_INDIVIDUAL_ELEMS +
9323                   NUM_GSM_DTAP_MSG_GMM + NUM_GSM_DTAP_MSG_SM +
9324                   NUM_GSM_GM_ELEM];
9325
9326         ett[0]  = &ett_gmm_radio_cap;
9327         ett[1]  = &ett_gmm_rai;
9328         ett[2]  = &ett_sm_tft;
9329         ett[3]  = &ett_gmm_gprs_timer;
9330         ett[4]  = &ett_gmm_network_cap;
9331         ett[5]  = &ett_gsm_a_gm_msrac_multislot_capability;
9332         ett[6]  = &ett_sm_pco;
9333
9334         last_offset = NUM_INDIVIDUAL_ELEMS;
9335
9336         for (i=0; i<NUM_GSM_DTAP_MSG_GMM; i++, last_offset++)
9337         {
9338                 ett_gsm_dtap_msg_gmm[i] = -1;
9339                 ett[last_offset] = &ett_gsm_dtap_msg_gmm[i];
9340         }
9341
9342         for (i=0; i<NUM_GSM_DTAP_MSG_SM; i++, last_offset++)
9343         {
9344                 ett_gsm_dtap_msg_sm[i] = -1;
9345                 ett[last_offset] = &ett_gsm_dtap_msg_sm[i];
9346         }
9347
9348         for (i=0; i<NUM_GSM_GM_ELEM; i++, last_offset++)
9349         {
9350                 ett_gsm_gm_elem[i] = -1;
9351                 ett[last_offset] = &ett_gsm_gm_elem[i];
9352         }
9353
9354         proto_a_gm =
9355                 proto_register_protocol("GSM A-I/F GPRS Mobility and Session Management", "GSM Management", "gsm_a.gm");
9356
9357         proto_register_field_array(proto_a_gm, hf, array_length(hf));
9358
9359         proto_register_subtree_array(ett, array_length(ett));
9360         expert_gsm_a_gm = expert_register_protocol(proto_a_gm);
9361         expert_register_field_array(expert_gsm_a_gm, ei, array_length(ei));
9362
9363         /* subdissector code */
9364         gprs_sm_pco_subdissector_table = register_dissector_table("sm_pco.protocol",
9365                 "GPRS SM PCO PPP protocol", proto_a_gm, FT_UINT16, BASE_HEX);
9366 }
9367
9368 void
9369 proto_reg_handoff_gsm_a_gm(void)
9370 {
9371         rrc_irat_ho_info_handle = find_dissector_add_dependency("rrc.irat.irat_ho_info", proto_a_gm);
9372         lte_rrc_ue_eutra_cap_handle = find_dissector_add_dependency("lte-rrc.ue_eutra_cap", proto_a_gm);
9373         nbifom_handle = find_dissector_add_dependency("nbifom", proto_a_gm);
9374 }
9375
9376 /*
9377  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
9378  *
9379  * Local variables:
9380  * c-basic-offset: 8
9381  * tab-width: 8
9382  * indent-tabs-mode: t
9383  * End:
9384  *
9385  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
9386  * :indentSize=8:tabSize=8:noTabs=false:
9387  */