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