c1b3f8ac5199d5f23f676c983dee04ad8f40cc53
[obnox/wireshark/wip.git] / epan / dissectors / packet-gsm_a_gm.c
1 /* packet-gsm_a_gm.c
2  * Routines for GSM A Interface GPRS Mobilty 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 Managment Protocol and
8  * the GPRS Session Managment 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  * $Id$
39  *
40  * Wireshark - Network traffic analyzer
41  * By Gerald Combs <gerald@wireshark.org>
42  * Copyright 1998 Gerald Combs
43  *
44  * This program is free software; you can redistribute it and/or
45  * modify it under the terms of the GNU General Public License
46  * as published by the Free Software Foundation; either version 2
47  * of the License, or (at your option) any later version.
48  *
49  * This program is distributed in the hope that it will be useful,
50  * but WITHOUT ANY WARRANTY; without even the implied warranty of
51  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
52  * GNU General Public License for more details.
53  *
54  * You should have received a copy of the GNU General Public License
55  * along with this program; if not, write to the Free Software
56  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
57  */
58
59 #ifdef HAVE_CONFIG_H
60 # include "config.h"
61 #endif
62
63 #include <string.h>
64
65 #include <epan/packet.h>
66 #include <epan/expert.h>
67 #include <epan/prefs.h>
68 #include <epan/tap.h>
69 #include <epan/asn1.h>
70
71 #include "packet-bssap.h"
72 #include "packet-sccp.h"
73 #include "packet-ber.h"
74 #include "packet-q931.h"
75 #include "packet-gsm_a_common.h"
76 #include "packet-e212.h"
77 #include "packet-ppp.h"
78
79 /* PROTOTYPES/FORWARDS */
80
81 const value_string gsm_a_dtap_msg_gmm_strings[] = {
82         { 0x01, "Attach Request" },
83         { 0x02, "Attach Accept" },
84         { 0x03, "Attach Complete" },
85         { 0x04, "Attach Reject" },
86         { 0x05, "Detach Request" },
87         { 0x06, "Detach Accept" },
88         { 0x08, "Routing Area Update Request" },
89         { 0x09, "Routing Area Update Accept" },
90         { 0x0a, "Routing Area Update Complete" },
91         { 0x0b, "Routing Area Update Reject" },
92         { 0x0c, "Service Request" },
93         { 0x0d, "Service Accept" },
94         { 0x0e, "Service Reject" },
95         { 0x10, "P-TMSI Reallocation Command" },
96         { 0x11, "P-TMSI Reallocation Complete" },
97         { 0x12, "Authentication and Ciphering Req" },
98         { 0x13, "Authentication and Ciphering Resp" },
99         { 0x14, "Authentication and Ciphering Rej" },
100         { 0x1c, "Authentication and Ciphering Failure" },
101         { 0x15, "Identity Request" },
102         { 0x16, "Identity Response" },
103         { 0x20, "GMM Status" },
104         { 0x21, "GMM Information" },
105         { 0, NULL }
106 };
107
108 const value_string gsm_a_dtap_msg_sm_strings[] = {
109         { 0x41, "Activate PDP Context Request" },
110         { 0x42, "Activate PDP Context Accept" },
111         { 0x43, "Activate PDP Context Reject" },
112         { 0x44, "Request PDP Context Activation" },
113         { 0x45, "Request PDP Context Activation rej." },
114         { 0x46, "Deactivate PDP Context Request" },
115         { 0x47, "Deactivate PDP Context Accept" },
116         { 0x48, "Modify PDP Context Request(Network to MS direction)" },
117         { 0x49, "Modify PDP Context Accept (MS to network direction)" },
118         { 0x4a, "Modify PDP Context Request(MS to network direction)" },
119         { 0x4b, "Modify PDP Context Accept (Network to MS direction)" },
120         { 0x4c, "Modify PDP Context Reject" },
121         { 0x4d, "Activate Secondary PDP Context Request" },
122         { 0x4e, "Activate Secondary PDP Context Accept" },
123         { 0x4f, "Activate Secondary PDP Context Reject" },
124         { 0x50, "Reserved: was allocated in earlier phases of the protocol" },
125         { 0x51, "Reserved: was allocated in earlier phases of the protocol" },
126         { 0x52, "Reserved: was allocated in earlier phases of the protocol" },
127         { 0x53, "Reserved: was allocated in earlier phases of the protocol" },
128         { 0x54, "Reserved: was allocated in earlier phases of the protocol" },
129         { 0x55, "SM Status" },
130         { 0x56, "Activate MBMS Context Request" },
131         { 0x57, "Activate MBMS Context Accept" },
132         { 0x58, "Activate MBMS Context Reject" },
133         { 0x59, "Request MBMS Context Activation" },
134         { 0x5a, "Request MBMS Context Activation Reject" },
135         { 0x5b, "Request Secondary PDP Context Activation" },
136         { 0x5c, "Request Secondary PDP Context Activation Reject" },
137         { 0x5d, "Notification" },
138         { 0, NULL }
139 };
140
141 const value_string gsm_gm_elem_strings[] = {
142         /* GPRS Mobility Management Information Elements 10.5.5 */
143         { 0x00, "Attach Result" },
144         { 0x00, "Attach Type" },
145         { 0x00, "Cipher Algorithm" },
146         { 0x00, "TMSI Status" },
147         { 0x00, "Detach Type" },
148         { 0x00, "DRX Parameter" },
149         { 0x00, "Force to Standby" },
150         { 0x00, "Force to Standby" },
151         { 0x00, "P-TMSI Signature" },
152         { 0x00, "P-TMSI Signature 2" },
153         { 0x00, "Identity Type 2" },
154         { 0x00, "IMEISV Request" },
155         { 0x00, "Receive N-PDU Numbers List" },
156         { 0x00, "MS Network Capability" },
157         { 0x00, "MS Radio Access Capability" },
158         { 0x00, "GMM Cause" },
159         { 0x00, "Routing Area Identification" },
160         { 0x00, "Routing Area Identification 2" },
161         { 0x00, "Update Result" },
162         { 0x00, "Update Type" },
163         { 0x00, "A&C Reference Number" },
164         { 0x00, "A&C Reference Number" },
165         { 0x00, "Service Type" },
166         { 0x00, "Cell Notification" },
167         { 0x00, "PS LCS Capability" },
168         { 0x00, "Network Feature Support" },
169         { 0x00, "Inter RAT information container" },
170         { 0x00, "Requested MS information" },
171         { 0x00, "UE network capability" },
172         { 0x00, "E-UTRAN inter RAT information container" },
173         { 0x00, "Voice domain preference and UE's usage setting" },
174         /* Session Management Information Elements 10.5.6 */
175         { 0x00, "Access Point Name" },
176         { 0x00, "Network Service Access Point Identifier" },
177         { 0x00, "Protocol Configuration Options" },
178         { 0x00, "Packet Data Protocol Address" },
179         { 0x00, "Quality Of Service" },
180         { 0x00, "SM Cause" },
181         { 0x00, "SM Cause 2" },
182         { 0x00, "Linked TI" },
183         { 0x00, "LLC Service Access Point Identifier" },
184         { 0x00, "Tear Down Indicator" },
185         { 0x00, "Packet Flow Identifier" },
186         { 0x00, "Traffic Flow Template" },
187         { 0x00, "Temporary Mobile Group Identity (TMGI)" },
188         { 0x00, "MBMS bearer capabilities" },
189         { 0x00, "MBMS protocol configuration options" },
190         { 0x00, "Enhanced network service access point identifier" },
191         { 0x00, "Request type" },
192         { 0x00, "Notification indicator" },
193         /* GPRS Common Information Elements 10.5.7 */
194         { 0x00, "PDP Context Status" },
195         { 0x00, "Radio Priority" },
196         { 0x00, "GPRS Timer" },
197         { 0x00, "GPRS Timer 2" },
198         { 0x00, "Radio Priority 2"},
199         { 0x00, "MBMS context status"},
200         { 0x00, "Uplink data status"},
201         { 0x00, "Spare Nibble"},
202         { 0, NULL }
203 };
204
205 #define DTAP_GMM_IEI_MASK       0xff
206 #define DTAP_SM_IEI_MASK        0xff
207
208 /* Initialize the protocol and registered fields */
209 static int proto_a_gm = -1;
210
211 static int hf_gsm_a_dtap_msg_gmm_type = -1;
212 static int hf_gsm_a_dtap_msg_sm_type = -1;
213 int hf_gsm_a_gm_elem_id = -1;
214 static int hf_gsm_a_qos_delay_cls       = -1;
215 static int hf_gsm_a_qos_reliability_cls = -1;
216 static int hf_gsm_a_qos_traffic_cls = -1;
217 static int hf_gsm_a_qos_del_order = -1;
218 static int hf_gsm_a_qos_del_of_err_sdu = -1;
219 static int hf_gsm_a_qos_ber = -1;
220 static int hf_gsm_a_qos_sdu_err_rat = -1;
221 static int hf_gsm_a_qos_traff_hdl_pri = -1;
222
223 static int hf_gsm_a_gmm_split_on_ccch = -1;
224 static int hf_gsm_a_gmm_non_drx_timer = -1;
225 static int hf_gsm_a_gmm_cn_spec_drs_cycle_len_coef = -1;
226
227 static int hf_gsm_a_ptmsi_sig =-1;
228 static int hf_gsm_a_ptmsi_sig2 =-1;
229
230 static int hf_gsm_a_tft_op_code = -1;
231 static int hf_gsm_a_tft_e_bit = -1;
232 static int hf_gsm_a_tft_pkt_flt = -1;
233 static int hf_gsm_a_tft_pkt_flt_id = -1;
234 static int hf_gsm_a_tft_pkt_flt_dir = -1;
235 static int hf_gsm_a_sm_ip4_address = -1;
236 static int hf_gsm_a_sm_ip4_mask = -1;
237 static int hf_gsm_a_sm_ip6_address = -1;
238 static int hf_gsm_a_sm_ip6_mask = -1;
239 static int hf_gsm_a_tft_protocol_header = -1;
240 static int hf_gsm_a_tft_port = -1;
241 static int hf_gsm_a_tft_port_low = -1;
242 static int hf_gsm_a_tft_port_high = -1;
243 static int hf_gsm_a_tft_security = -1;
244 static int hf_gsm_a_tft_traffic_mask = -1;
245 static int hf_gsm_a_tft_flow_label_type = -1;
246 static int hf_gsm_a_tft_param_id = -1;
247 static int hf_gsm_a_gm_acc_tech_type = -1;
248 static int hf_gsm_a_gm_acc_cap_struct_len = -1;
249 static int hf_gsm_a_gm_sms_value = -1;
250 static int hf_gsm_a_gm_sm_value = -1;
251 static int hf_gsm_a_gm_sm_ext = -1;
252 static int hf_gsm_a_gm_link_dir = -1;
253 static int hf_gsm_a_gm_cause = -1;
254
255 static int hf_gsm_a_gm_fop = -1;
256 static int hf_gsm_a_gm_res_of_attach = -1;
257 static int hf_gsm_a_gm_type_of_ciph_alg = -1;
258 static int hf_gsm_a_gm_imeisv_req = -1;
259 static int hf_gsm_a_gm_ac_ref_nr = -1;
260 static int hf_gsm_a_gm_force_to_standby = -1;
261 static int hf_gsm_a_gm_serv_type = -1;
262 static int hf_gsm_a_gm_ciph_key_seq_num = -1;
263 static int hf_gsm_a_gm_for = -1;
264 static int hf_gsm_a_gm_type_of_attach = -1;
265 static int hf_gsm_a_gm_tmsi_flag = -1;
266 static int hf_gsm_a_gm_update_type = -1;
267 static int hf_gsm_a_gm_gprs_timer_unit = -1;
268 static int hf_gsm_a_gm_gprs_timer_value = -1;
269 static int hf_gsm_a_gm_nsapi_5_ul_stat = -1;
270 static int hf_gsm_a_gm_nsapi_6_ul_stat = -1;
271 static int hf_gsm_a_gm_nsapi_7_ul_stat = -1;
272 static int hf_gsm_a_gm_nsapi_8_ul_stat = -1;
273 static int hf_gsm_a_gm_nsapi_9_ul_stat = -1;
274 static int hf_gsm_a_gm_nsapi_10_ul_stat = -1;
275 static int hf_gsm_a_gm_nsapi_11_ul_stat = -1;
276 static int hf_gsm_a_gm_nsapi_12_ul_stat = -1;
277 static int hf_gsm_a_gm_nsapi_13_ul_stat = -1;
278 static int hf_gsm_a_gm_nsapi_14_ul_stat = -1;
279 static int hf_gsm_a_gm_nsapi_15_ul_stat = -1;
280 static int hf_gsm_a_gm_pco_pid = -1;
281 static int hf_gsm_a_gm_type_of_identity = -1;
282 static int hf_gsm_a_gm_rac = -1;
283 static int hf_gsm_a_gm_apc = -1;
284 static int hf_gsm_a_gm_otd_a = -1;
285 static int hf_gsm_a_gm_otd_b = -1;
286 static int hf_gsm_a_gm_gps_a = -1;
287 static int hf_gsm_a_gm_gps_b = -1;
288 static int hf_gsm_a_gm_gps_c = -1;
289 static int hf_gsm_a_gm_req_ms_info_irat = -1;
290 static int hf_gsm_a_gm_req_ms_info_irat2 = -1;
291 static int hf_gsm_a_gm_ue_usage_setting = -1;
292 static int hf_gsm_a_gm_voice_domain_pref_for_eutran = -1;
293 static int hf_gsm_a_sm_pdp_type_org = -1;
294 static int hf_gsm_a_qos_mean_thr = -1;
295 static int hf_gsm_a_qos_peak_thr = -1;
296 static int hf_gsm_a_qos_prec_class = -1;
297 static int hf_gsm_a_qos_traf_handl_prio = -1;
298 static int hf_gsm_a_qos_trans_delay = -1;
299 static int hf_gsm_a_qos_signalling_ind = -1;
300 static int hf_gsm_a_qos_source_stat_desc = -1;
301 static int hf_gsm_a_qos_max_bitrate_upl = -1;
302 static int hf_gsm_a_qos_max_bitrate_downl = -1;
303 static int hf_gsm_a_qos_guar_bitrate_upl = -1;
304 static int hf_gsm_a_qos_guar_bitrate_downl = -1;
305 static int hf_gsm_a_qos_max_bitrate_upl_ext = -1;
306 static int hf_gsm_a_qos_max_bitrate_downl_ext = -1;
307 static int hf_gsm_a_qos_guar_bitrate_upl_ext = -1;
308 static int hf_gsm_a_qos_guar_bitrate_downl_ext = -1;
309 static int hf_gsm_a_sm_cause = -1;
310 static int hf_gsm_a_sm_cause_2 = -1;
311 static int hf_gsm_a_sm_llc_sapi = -1;
312 static int hf_gsm_a_sm_tdi = -1;
313 static int hf_gsm_a_sm_packet_flow_id = -1;
314 static int hf_gsm_a_sm_tmgi = -1;
315 static int hf_gsm_a_sm_enh_nsapi = -1;
316 static int hf_gsm_a_sm_req_type = -1;
317 static int hf_gsm_a_sm_notif_ind = -1;
318 static int hf_gsm_a_gm_rac_ctrled_early_cm_sending = -1;
319 static int hf_gsm_a_gm_rac_pseudo_sync = -1;
320 static int hf_gsm_a_gm_rac_vgcs = -1;
321 static int hf_gsm_a_gm_rac_vbs = -1;
322 static int hf_gsm_a_gm_rac_multislot_capability = -1;
323 static int hf_gsm_a_gm_rac_hscsd_multi_slot_class = -1;
324 static int hf_gsm_a_gm_rac_gprs_multi_slot_class = -1;
325 static int hf_gsm_a_gm_rac_gprs_ext_dyn_alloc_cap = -1;
326 static int hf_gsm_a_gm_rac_ecsd_multi_slot_class = -1;
327 static int hf_gsm_a_gm_rac_egprs_multi_slot_class = -1;
328 static int hf_gsm_a_gm_rac_egprs_ext_dyn_alloc_cap = -1;
329 static int hf_gsm_a_gm_rac_dtm_gprs_multi_slot_class = -1;
330 static int hf_gsm_a_gm_rac_single_slt_dtm = -1;
331 static int hf_gsm_a_gm_rac_dtm_egprs_multi_slot_cls_pres = -1;
332 static int hf_gsm_a_gm_rac_dtm_egprs_multi_slot_class = -1;
333 static int hf_gsm_a_gm_rac_8psk_pow_cap_pres = -1;
334 static int hf_gsm_a_gm_rac_comp_int_meas_cap = -1;
335 static int hf_gsm_a_gm_rel_lev_ind = -1;
336 static int hf_gsm_a_gm_rac_geran_feat_pkg = -1;
337 static int hf_gsm_a_gm_rac_umts_fdd_cap = -1;
338 static int hf_gsm_a_gm_rac_umts_384_tdd_ra_cap = -1;
339 static int hf_gsm_a_gm_rac_cdma2000_cap = -1;
340 static int hf_gsm_a_gm_rac_umts_128_tdd_ra_cap = -1;
341 static int hf_gsm_a_gm_rac_mod_based_multi_slot_class_support = -1;
342 static int hf_gsm_a_gm_rac_geran_iu_mode_cap = -1;
343 static int hf_gsm_a_gm_rac_flo_iu_cap = -1;
344 static int hf_gsm_a_gm_rac_mult_tbf_cap = -1;
345 static int hf_gsm_a_gm_rac_down_adv_rec_perf = -1;
346 static int hf_gsm_a_gm_rac_ext_rlc_mac_ctrl_msg_seg_cap = -1;
347 static int hf_gsm_a_gm_rac_dtm_enh_cap = -1;
348 static int hf_gsm_a_gm_rac_dtm_gprs_high_multi_slot_class = -1;
349 static int hf_gsm_a_gm_rac_dtm_egprs_high_multi_slot_class = -1;
350 static int hf_gsm_a_gm_rac_ps_ho_cap = -1;
351 static int hf_gsm_a_gm_rac_dtm_ho_cap = -1;
352 static int hf_gsm_a_gm_rac_multi_slot_cap_red_down_dual_carrier = -1;
353 static int hf_gsm_a_gm_rac_down_dual_carrier_dtm_cap = -1;
354 static int hf_gsm_a_gm_rac_flex_ts_assign = -1;
355 static int hf_gsm_a_gm_rac_gan_ps_ho_cap = -1;
356 static int hf_gsm_a_gm_rac_rlc_non_pers_mode = -1;
357 static int hf_gsm_a_gm_rac_reduced_lat_cap = -1;
358 static int hf_gsm_a_gm_rac_ul_egprs2 = -1;
359 static int hf_gsm_a_gm_rac_dl_egprs2 = -1;
360 static int hf_gsm_a_gm_rac_eutra_fdd_support = -1;
361 static int hf_gsm_a_gm_rac_eutra_tdd_support = -1;
362 static int hf_gsm_a_gm_rac_geran_to_eutra_support_in_geran_ptm = -1;
363 static int hf_gsm_a_gm_rac_prio_based_resel_support = -1;
364 static int hf_gsm_a_gm_rac_alt_efta_multi_slot_class = -1;
365 static int hf_gsm_a_gm_rac_efta_multi_slot_cap_red_down_dual_carrier = -1;
366 static int hf_gsm_a_gm_rac_ind_up_layer_pdu_start_cap_for_rlc_um = -1;
367 static int hf_gsm_a_gm_rac_emst_cap = -1;
368 static int hf_gsm_a_gm_rac_mtti_cap = -1;
369 static int hf_gsm_a_gm_rac_utra_csg_cell_report = -1;
370 static int hf_gsm_a_gm_rac_eutra_csg_cell_report = -1;
371 static int hf_gsm_a_sm_ti_flag = -1;
372 static int hf_gsm_a_sm_ext = -1;
373
374 static int hf_gsm_a_gmm_net_cap_gea1 = -1;
375 static int hf_gsm_a_gmm_net_cap_smdch = -1;
376 static int hf_gsm_a_gmm_net_cap_smgprs = -1;
377 static int hf_gsm_a_gmm_net_cap_ucs2 = -1;
378 static int hf_gsm_a_gmm_net_cap_ss_scr_ind = -1;
379 static int hf_gsm_a_gmm_net_cap_solsa = -1;
380 static int hf_gsm_a_gmm_net_cap_rev = -1;
381 static int hf_gsm_a_gmm_net_cap_pfc = -1;
382 static int hf_gsm_a_gmm_net_cap_ext_gea_bits = -1;
383 static int hf_gsm_a_gmm_net_cap_gea2 = -1;
384 static int hf_gsm_a_gmm_net_cap_gea3 = -1;
385 static int hf_gsm_a_gmm_net_cap_gea4 = -1;
386 static int hf_gsm_a_gmm_net_cap_gea5 = -1;
387 static int hf_gsm_a_gmm_net_cap_gea6 = -1;
388 static int hf_gsm_a_gmm_net_cap_gea7 = -1;
389 static int hf_gsm_a_gmm_net_cap_lcs = -1;
390 static int hf_gsm_a_gmm_net_cap_ps_irat_iu = -1;
391 static int hf_gsm_a_gmm_net_cap_ps_irat_s1 = -1;
392 static int hf_gsm_a_gmm_net_cap_comb_proc = -1;
393 static int hf_gsm_a_gmm_net_cap_isr = -1;
394 static int hf_gsm_a_gmm_net_cap_srvcc_to_geran = -1;
395 static int hf_gsm_a_gmm_net_cap_epc = -1;
396 static int hf_gsm_a_gmm_net_cap_nf = -1;
397
398 /* Initialize the subtree pointers */
399 static gint ett_tc_component = -1;
400 static gint ett_tc_invoke_id = -1;
401 static gint ett_tc_linked_id = -1;
402 static gint ett_tc_opr_code = -1;
403 static gint ett_tc_err_code = -1;
404 static gint ett_tc_prob_code = -1;
405 static gint ett_tc_sequence = -1;
406
407 static gint ett_gmm_drx = -1;
408 static gint ett_gmm_detach_type = -1;
409 static gint ett_gmm_attach_type = -1;
410 static gint ett_gmm_context_stat = -1;
411 static gint ett_gmm_update_type = -1;
412 static gint ett_gmm_radio_cap = -1;
413 static gint ett_gmm_network_cap = -1;
414 static gint ett_gsm_a_gm_msrac_multislot_capability = -1;
415 static gint ett_gmm_rai = -1;
416 static gint ett_gmm_gprs_timer = -1;
417
418 static gint ett_sm_tft = -1;
419
420 static dissector_handle_t data_handle;
421 static dissector_handle_t rrc_irat_ho_info_handle;
422 static dissector_handle_t lte_rrc_ue_eutra_cap_handle;
423
424 static dissector_table_t gprs_sm_pco_subdissector_table; /* GPRS SM PCO PPP Protocols */
425
426 #define NUM_GSM_GM_ELEM (sizeof(gsm_gm_elem_strings)/sizeof(value_string))
427 gint ett_gsm_gm_elem[NUM_GSM_GM_ELEM];
428
429 static const gchar *pdp_str[2]={ "PDP-INACTIVE", "PDP-ACTIVE" };
430
431 /*
432  * [9] 10.5.5.1 Attach result
433  */
434 static const value_string gsm_a_gm_res_of_attach_vals[] = {
435         { 0x01, "GPRS only attached" },
436         { 0x03, "Combined GPRS/IMSI attached" },
437         { 0, NULL }
438 };
439
440 static guint16
441 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_)
442 {
443         proto_tree_add_item(tree, hf_gsm_a_gm_fop, tvb, offset, 1, ENC_BIG_ENDIAN);
444         proto_tree_add_item(tree, hf_gsm_a_gm_res_of_attach, tvb, offset, 1, ENC_BIG_ENDIAN);
445
446         /* no length check possible */
447         return(1);
448 }
449
450 /*
451  * [9] 10.5.5.2 Attach type
452  */
453 static const value_string gsm_a_gm_type_of_attach_vals[] = {
454         { 0x01, "GPRS attach" },
455         { 0x02, "Not used (In earlier versions: GPRS attach while IMSI attached)" },
456         { 0x03, "Combined GPRS/IMSI attached" },
457         { 0, NULL }
458 };
459
460 static guint16
461 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_)
462 {
463         proto_item   *tf = NULL;
464         proto_tree   *tf_tree = NULL;
465
466         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ciph_key_seq_num, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
467
468         tf = proto_tree_add_text(tree,
469                 tvb, offset, 1,
470                 "Attach Type");
471
472         tf_tree = proto_item_add_subtree(tf, ett_gmm_attach_type );
473
474         proto_tree_add_item(tf_tree, hf_gsm_a_gm_for, tvb, offset, 1, ENC_BIG_ENDIAN);
475         proto_tree_add_item(tf_tree, hf_gsm_a_gm_type_of_attach, tvb, offset, 1, ENC_BIG_ENDIAN);
476
477         /* no length check possible */
478         return(1);
479 }
480
481 /*
482  * [9] 10.5.5.3 Ciphering algorithm
483  */
484 const value_string gsm_a_gm_type_of_ciph_alg_vals[] = {
485         { 0x00, "ciphering not used" },
486         { 0x01, "GPRS Encryption Algorithm GEA/1" },
487         { 0x02, "GPRS Encryption Algorithm GEA/2" },
488         { 0x03, "GPRS Encryption Algorithm GEA/3" },
489         { 0x04, "GPRS Encryption Algorithm GEA/4" },
490         { 0x05, "GPRS Encryption Algorithm GEA/5" },
491         { 0x06, "GPRS Encryption Algorithm GEA/6" },
492         { 0x07, "GPRS Encryption Algorithm GEA/7" },
493         { 0, NULL }
494 };
495
496 static guint16
497 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_)
498 {
499         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 1, ENC_BIG_ENDIAN);
500         proto_tree_add_item(tree, hf_gsm_a_gm_type_of_ciph_alg, tvb, offset, 1, ENC_BIG_ENDIAN);
501
502         /* no length check possible */
503         return(1);
504 }
505
506 /*
507  * [9] 10.5.5.4 TMSI status
508  */
509 const true_false_string gsm_a_gm_tmsi_flag_value = {
510         "valid TMSI available",
511         "no valid TMSI available"
512 };
513
514 static guint16
515 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_)
516 {
517         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 3, ENC_BIG_ENDIAN);
518         proto_tree_add_item(tree, hf_gsm_a_gm_tmsi_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
519
520         /* no length check possible */
521         return(1);
522 }
523
524 /*
525  * [7] 10.5.5.5
526  */
527 static guint16
528 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_)
529 {
530         guint8        oct;
531         guint32       curr_offset;
532         const gchar  *str;
533         const gchar  *str_power;
534         proto_item   *tf = NULL;
535         proto_tree   *tf_tree = NULL;
536
537         curr_offset = offset;
538
539         oct = tvb_get_guint8(tvb, curr_offset);
540
541         switch(oct&7)
542         {
543                 case 1:  str="GPRS detach/re-attach required";                            break;
544                 case 2:  str="IMSI detach/re-attach not required";                        break;
545                 case 3:  str="Combined GPRS/IMSI detach/IMSI detach (after VLR failure)"; break;
546                 default: str="Combined GPRS/IMSI detach/re-attach not required";
547         }
548
549         switch(oct&8)
550         {
551                 case 8:  str_power="power switched off"; break;
552                 default: str_power="normal detach";      break;
553         }
554
555         tf = proto_tree_add_text(tree,
556                 tvb, curr_offset, 1,
557                 "Detach Type");
558
559         tf_tree = proto_item_add_subtree(tf, ett_gmm_detach_type );
560
561         proto_tree_add_text(tf_tree,
562                 tvb, curr_offset, 1,
563                 "Type: %s (%u)",
564                 str,
565                 oct&7);
566
567         proto_tree_add_text(tf_tree,
568                 tvb, curr_offset, 1,
569                 "Power: %s (%u)",
570                 str_power,
571                 (oct>>3)&1);
572
573         curr_offset++;
574
575         /* no length check possible */
576
577         return(curr_offset - offset);
578 }
579
580 /*
581  * [7] 10.5.5.6
582  *
583  * SPLIT on CCCH, octet 3 (bit 4)
584  * 0 Split pg cycle on CCCH is not supported by the mobile station
585  * 1 Split pg cycle on CCCH is supported by the mobile station
586  */
587 static const true_false_string gsm_a_gmm_split_on_ccch_value  = {
588         "Split pg cycle on CCCH is supported by the mobile station",
589         "Split pg cycle on CCCH is not supported by the mobile station"
590 };
591
592 /* non-DRX timer, octet 3
593  * bit
594  * 3 2 1
595  */
596 static const value_string gsm_a_gmm_non_drx_timer_strings[] = {
597         { 0x00, "no non-DRX mode after transfer state" },
598         { 0x01, "max. 1 sec non-DRX mode after transfer state" },
599         { 0x02, "max. 2 sec non-DRX mode after transfer state" },
600         { 0x03, "max. 4 sec non-DRX mode after transfer state" },
601         { 0x04, "max. 8 sec non-DRX mode after transfer state" },
602         { 0x05, "max. 16 sec non-DRX mode after transfer state" },
603         { 0x06, "max. 32 sec non-DRX mode after transfer state" },
604         { 0x07, "max. 64 sec non-DRX mode after transfer state" },
605         { 0, NULL },
606 };
607 /*
608  * CN Specific DRX cycle length coefficient, octet 3
609  * bit
610  * 8 7 6 5 Iu and S1 mode specific
611  * 0 0 0 0 For Iu mode, CN Specific DRX cycle length coefficient not specified by the MS, ie. the
612  * system information value 'CN domain specific DRX cycle length' is used.
613  * For S1 mode, DRX value not specified by the MS.
614  * (Ref 3GPP TS 25.331 and 36.304)
615  * 0 1 1 0 CN Specific DRX cycle length coefficient 6 and T = 32
616  * 0 1 1 1 CN Specific DRX cycle length coefficient 7 and T = 64
617  * 1 0 0 0 CN Specific DRX cycle length coefficient 8 and T = 128
618  * 1 0 0 1 CN Specific DRX cycle length coefficient 9 and T = 256
619  * All other values shall be interpreted as "CN Specific DRX cycle length coefficient not
620  * specified by the MS" and "DRX value not specified by the MS" by this version of the protocol.
621  * NOTE: For Iu mode and S1 mode, this field (octet 3 bits 8 to 5) is used, but was spare in earlier
622  * versions of this protocol.
623  */
624 static const range_string gsm_a_gmm_cn_spec_drs_cycle_len_coef_strings[] = {
625         { 0x00, 0x05, "CN Specific DRX cycle length coefficient / value not specified by the MS" },
626         { 0x06, 0x06, "CN Specific DRX cycle length coefficient 6 and T = 32" },
627         { 0x07, 0x07, "CN Specific DRX cycle length coefficient 7 and T = 64" },
628         { 0x08, 0x08, "CN Specific DRX cycle length coefficient 8 and T = 128" },
629         { 0x09, 0x09, "CN Specific DRX cycle length coefficient 9 and T = 256" },
630         { 0x0a, 0x0f, "CN Specific DRX cycle length coefficient / value not specified by the MS" },
631         { 0, 0, NULL },
632 };
633 guint16
634 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_)
635 {
636         guint8        oct;
637         guint32       curr_offset;
638         const gchar  *str;
639         proto_item   *tf = NULL;
640         proto_tree   *tf_tree = NULL;
641
642         curr_offset = offset;
643
644         tf = proto_tree_add_text(tree,
645                 tvb, curr_offset, 2,
646                 "DRX Parameter");
647
648         tf_tree = proto_item_add_subtree(tf, ett_gmm_drx );
649
650         oct = tvb_get_guint8(tvb, curr_offset);
651
652         switch(oct)
653         {
654                 case 0:  str="704"; break;
655                 case 65: str="71";  break;
656                 case 66: str="72";  break;
657                 case 67: str="74";  break;
658                 case 68: str="75";  break;
659                 case 69: str="77";  break;
660                 case 70: str="79";  break;
661                 case 71: str="80";  break;
662                 case 72: str="83";  break;
663                 case 73: str="86";  break;
664                 case 74: str="88";  break;
665                 case 75: str="90";  break;
666                 case 76: str="92";  break;
667                 case 77: str="96";  break;
668                 case 78: str="101"; break;
669                 case 79: str="103"; break;
670                 case 80: str="107"; break;
671                 case 81: str="112"; break;
672                 case 82: str="116"; break;
673                 case 83: str="118"; break;
674                 case 84: str="128"; break;
675                 case 85: str="141"; break;
676                 case 86: str="144"; break;
677                 case 87: str="150"; break;
678                 case 88: str="160"; break;
679                 case 89: str="171"; break;
680                 case 90: str="176"; break;
681                 case 91: str="192"; break;
682                 case 92: str="214"; break;
683                 case 93: str="224"; break;
684                 case 94: str="235"; break;
685                 case 95: str="256"; break;
686                 case 96: str="288"; break;
687                 case 97: str="320"; break;
688                 case 98: str="352"; break;
689                 default: str="Reserved, interpreted as 1";
690         }
691
692         proto_tree_add_text(tf_tree,
693                 tvb, curr_offset, 1,
694                 "Split PG Cycle Code: %s (%u)",
695                 str,
696                 oct);
697
698         curr_offset++;
699         proto_tree_add_item(tf_tree, hf_gsm_a_gmm_cn_spec_drs_cycle_len_coef, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
700         proto_tree_add_item(tf_tree, hf_gsm_a_gmm_split_on_ccch, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
701         proto_tree_add_item(tf_tree, hf_gsm_a_gmm_non_drx_timer, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
702
703         curr_offset++;
704
705         /* no length check possible */
706
707         return(curr_offset - offset);
708 }
709
710 /*
711  * [9] 10.5.5.7 Force to standby (lower nibble)
712  */
713 static const range_string gsm_a_gm_force_to_standby_vals[] = {
714         { 0x00, 0x00, "Force to standby not indicated" },
715         { 0x01, 0x01, "Force to standby indicated" },
716         { 0x02, 0x07, "Unknown, interpreted as Force to standby not indicated" },
717         { 0, 0, NULL }
718 };
719
720 static guint16
721 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_)
722 {
723         guint32 bit_offset;
724
725         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE LOWER NIBBLE */
726         bit_offset = (offset << 3) + 4;
727         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
728         proto_tree_add_bits_item(tree, hf_gsm_a_gm_force_to_standby, tvb, bit_offset + 1, 3, ENC_BIG_ENDIAN);
729
730         /* no length check possible */
731         return(1);
732 }
733
734 /*
735  * [9] 10.5.5.7 Force to standby (higher nibble)
736  */
737 static guint16
738 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_)
739 {
740         guint32 bit_offset;
741
742         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
743         bit_offset = offset << 3;
744         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
745         proto_tree_add_bits_item(tree, hf_gsm_a_gm_force_to_standby, tvb, bit_offset + 1, 3, ENC_BIG_ENDIAN);
746
747         /* no length check possible */
748         return(1);
749 }
750
751 /*
752  * [7] 10.5.5.8
753  */
754 static guint16
755 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_)
756 {
757         guint32       curr_offset;
758         proto_item   *curr_item;
759
760         curr_offset = offset;
761
762         curr_item= proto_tree_add_item(tree,hf_gsm_a_ptmsi_sig,tvb,curr_offset,3,ENC_BIG_ENDIAN);
763         proto_item_append_text(curr_item,"%s",add_string ? add_string : "");
764
765         curr_offset+=3;
766
767         /* no length check possible */
768
769         return(curr_offset - offset);
770 }
771
772 /*
773  * [7] 10.5.5.8a
774  */
775 static guint16
776 de_gmm_ptmsi_sig2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len _U_)
777 {
778         guint32       curr_offset;
779         proto_item   *curr_item;
780
781         curr_offset = offset;
782
783         curr_item= proto_tree_add_item(tree,hf_gsm_a_ptmsi_sig2,tvb,curr_offset,3,ENC_BIG_ENDIAN);
784         proto_item_append_text(curr_item,"%s",add_string ? add_string : "");
785         curr_offset+=3;
786
787         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
788
789         return(curr_offset - offset);
790 }
791
792 /*
793  * [9] 10.5.5.9 Identity type 2
794  */
795 static const value_string gsm_a_gm_type_of_identity_vals[] = {
796         { 0x01, "IMSI" },
797         { 0x02, "IMEI" },
798         { 0x03, "IMEISV" },
799         { 0x04, "TMSI" },
800         { 0, NULL }
801 };
802
803 static guint16
804 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_)
805 {
806         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 1, ENC_BIG_ENDIAN);
807         proto_tree_add_item(tree, hf_gsm_a_gm_type_of_identity, tvb, offset, 1, ENC_BIG_ENDIAN);
808
809         /* no length check possible */
810         return(1);
811 }
812
813 /*
814  * [9] 10.5.5.10 IMEISV request
815  */
816 static const range_string gsm_a_gm_imeisv_req_vals[] = {
817         { 0x00, 0x00, "IMEISV not requested" },
818         { 0x01, 0x01, "IMEISV requested" },
819         { 0x02, 0x07, "Unknown, interpreted as IMEISV not requested" },
820         { 0, 0, NULL }
821 };
822
823 static guint16
824 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_)
825 {
826         guint32 bit_offset;
827
828         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
829         bit_offset = offset << 3;
830         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
831         proto_tree_add_bits_item(tree, hf_gsm_a_gm_imeisv_req, tvb, bit_offset + 1, 3, ENC_BIG_ENDIAN);
832
833         /* no length check possible */
834         return(1);
835 }
836
837 /*
838  * [7] 10.5.5.11
839  */
840 static guint16
841 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_)
842 {
843         guint32 curr_offset;
844         guint   curr_len;
845
846         curr_len = len;
847         curr_offset = offset;
848
849         if ( len == 0 ) return 0;
850
851         do
852         {
853                 guint32 oct;
854                 oct = tvb_get_guint8(tvb, curr_offset);
855                 oct <<=8;
856                 oct |= tvb_get_guint8(tvb, curr_offset+1);
857                 curr_len -= 2;
858                 oct <<=8;
859
860                 proto_tree_add_text(tree,
861                         tvb, curr_offset, 2,
862                         "NSAPI %d: 0x%02x (%u)",
863                         oct>>20,
864                         (oct>>12)&0xff,
865                         (oct>>12)&0xff);
866                 curr_offset+= 2;
867
868                 if ( curr_len > 2 )
869                 {
870                         oct |= tvb_get_guint8(tvb, curr_offset+2);
871                         curr_len--;
872                         oct <<= 12;
873
874                         proto_tree_add_text(tree,
875                                 tvb, curr_offset-1, 2,
876                                 "NSAPI %d: 0x%02x (%u)",
877                                 oct>>20,
878                                 (oct>>12)&0xff,
879                                 (oct>>12)&0xff);
880                         curr_offset++;
881                 }
882
883         } while ( curr_len > 1 );
884
885         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
886
887         return(curr_offset - offset);
888 }
889
890 /*
891  * [9] 10.5.5.12 MS network capability
892  */
893 static const true_false_string gsm_a_gmm_net_cap_gea_vals = {
894         "Encryption algorithm available",
895         "Encryption algorithm not available"
896 };
897
898 static const true_false_string gsm_a_gmm_net_cap_smdch_vals = {
899         "Mobile station supports mobile terminated point to point SMS via dedicated signalling channels",
900         "Mobile station does not support mobile terminated point to point SMS via dedicated signalling channels"
901 };
902
903 static const true_false_string gsm_a_gmm_net_cap_smgprs_vals = {
904         "Mobile station supports mobile terminated point to point SMS via GPRS packet data channels",
905         "Mobile station does not support mobile terminated point to point SMS via GPRS packet data channels"
906 };
907
908 static const true_false_string gsm_a_gmm_net_cap_ucs2_vals = {
909         "The ME has no preference between the use of the default alphabet and the use of UCS2",
910         "The ME has a preference for the default alphabet (defined in 3GPP TS 23.038 [8b]) over UCS2"
911 };
912
913 static const value_string gsm_a_gmm_net_cap_ss_scr_ind_vals[]={
914         { 0x00, "Default value of phase 1" },
915         { 0x01, "capability of handling of ellipsis notation and phase 2 error handling" },
916         { 0x02, "For future use, interpreted as Capability of handling of ellipsis notation and phase 2 error handling" },
917         { 0x03, "For future use, interpreted as Capability of handling of ellipsis notation and phase 2 error handling" },
918         { 0x00, NULL }
919 };
920
921 static const true_false_string gsm_a_gmm_net_cap_solsa_vals = {
922         "The ME supports SoLSA",
923         "The ME does not support SoLSA"
924 };
925
926 static const true_false_string gsm_a_gmm_net_cap_rev_vals = {
927         "Used by a mobile station supporting R99 or later versions of the protocol",
928         "Used by a mobile station not supporting R99 or later versions of the protocol"
929 };
930
931 static const true_false_string gsm_a_gmm_net_cap_pfc_vals = {
932         "Mobile station does support BSS packet flow procedures",
933         "Mobile station does not support BSS packet flow procedures"
934 };
935
936 static const true_false_string gsm_a_gmm_net_cap_lcs_vals = {
937         "LCS value added location request notification capability supported",
938         "LCS value added location request notification capability not supported"
939 };
940
941 static const true_false_string gsm_a_gmm_net_cap_ps_irat_iu_vals = {
942         "PS inter-RAT HO to UTRAN Iu mode supported",
943         "PS inter-RAT HO to UTRAN Iu mode not supported"
944 };
945
946 static const true_false_string gsm_a_gmm_net_cap_ps_irat_s1_vals = {
947         "PS inter-RAT HO to E-UTRAN S1 mode supported",
948         "PS inter-RAT HO to E-UTRAN S1 mode not supported"
949 };
950
951 static const true_false_string gsm_a_gmm_net_cap_comb_proc_vals = {
952         "Mobile station supports EMM combined procedures",
953         "Mobile station does not support EMM combined procedures"
954 };
955
956 static const true_false_string gsm_a_gmm_net_cap_isr_vals = {
957         "The mobile station supports ISR",
958         "The mobile station does not support ISR"
959 };
960
961 static const true_false_string gsm_a_gmm_net_cap_srvcc_to_geran_vals = {
962         "SRVCC from UTRAN HSPA or E-UTRAN to GERAN/UTRAN supported",
963         "SRVCC from UTRAN HSPA or E-UTRAN to GERAN/UTRAN not supported"
964 };
965
966 static const true_false_string gsm_a_gmm_net_cap_epc_vals = {
967         "EPC supported",
968         "EPC not supported"
969 };
970
971 static const true_false_string gsm_a_gmm_net_cap_nf_vals = {
972         "Mobile station supports the notification procedure",
973         "Mobile station does not support the notification procedure"
974 };
975
976 guint16
977 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_)
978 {
979         guint32 curr_offset;
980         proto_tree      *subtree;
981         proto_item      *item;
982
983         curr_offset = offset;
984
985         /* bit 8: GEA1 */
986         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_gea1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
987
988         /* bit 7: SM capabilities via dedicated channels */
989         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_smdch, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
990
991         /* bit 6: SM capabilities via GPRS channels */
992         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_smgprs, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
993
994         /* bit 5: UCS2 support */
995         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ucs2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
996
997         /* bits 4 3: SS Screening Indicator */
998         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ss_scr_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
999
1000         /* bit 2: SoLSA Capability */
1001         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_solsa, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1002
1003         /* bit 1 */
1004         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_rev, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1005
1006         curr_offset++;
1007         NO_MORE_DATA_CHECK(len);
1008
1009         /* bit 8: PFC feature mode */
1010         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_pfc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1011
1012         /* bits 7 6 5 4 3 2: Extended GEA bits */
1013         item = proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ext_gea_bits, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1014         subtree = proto_item_add_subtree(item, ett_gmm_network_cap);
1015         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1016         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1017         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1018         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1019         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1020         proto_tree_add_item(subtree, hf_gsm_a_gmm_net_cap_gea7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1021
1022         /* bit 1: LCS VA capability */
1023         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_lcs, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1024
1025         curr_offset++;
1026         NO_MORE_DATA_CHECK(len);
1027
1028         /* bit 8: PS inter-RAT HO to UTRAN Iu mode capability */
1029         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ps_irat_iu, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1030
1031         /* bit 7: PS inter-RAT HO to E-UTRAN S1 mode capability */
1032         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_ps_irat_s1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1033
1034         /* bit 6: EMM Combined procedures capability */
1035         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_comb_proc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1036
1037         /* bit 5: ISR support */
1038         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_isr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1039
1040         /* bit 4: SRVCC to GERAN/UTRAN capability */
1041         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_srvcc_to_geran, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1042
1043         /* bit 3: EPC capability */
1044         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_epc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1045
1046         /* bit 3: NF capability */
1047         proto_tree_add_item(tree, hf_gsm_a_gmm_net_cap_nf, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1048
1049         /* bits 1: Spare bit */
1050         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3)+7, 1, ENC_BIG_ENDIAN);
1051
1052         curr_offset++;
1053         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
1054
1055         return(curr_offset - offset);
1056 }
1057
1058 /*
1059  * [7] 10.5.5.12a
1060  */
1061 #define GET_DATA                                /* check if we have enough bits left */ \
1062         if ( curr_bits_length < bits_needed ) \
1063                 continue; \
1064         /* check if oct has enougth bits */ \
1065         if ( bits_in_oct < bits_needed ) \
1066         { \
1067                 guint32 tmp_oct; \
1068                 if ( curr_len == 0 ) \
1069                 { \
1070                         proto_tree_add_text(tf_tree, \
1071                                 tvb, curr_offset, 1, \
1072                                 "Not enough data available"); \
1073                 } \
1074                 tmp_oct = tvb_get_guint8(tvb, curr_offset); \
1075                 oct |= tmp_oct<<(32-8-bits_in_oct); \
1076                 curr_len--; \
1077                 curr_offset++; \
1078                 if ( bits_in_oct != 0 ) \
1079                         add_ocetets = 1; \
1080                 else \
1081                         add_ocetets = 0; \
1082                 bits_in_oct += 8; \
1083         } \
1084         else \
1085                 add_ocetets = 0;
1086
1087 /* Access Technology Type */
1088
1089 static const value_string gsm_a_gm_acc_tech_type_vals[] = {
1090         { 0x00, "GSM P" },
1091         { 0x01, "GSM E --note that GSM E covers GSM P" },
1092         { 0x02, "GSM R --note that GSM R covers GSM E and GSM P" },
1093         { 0x03, "GSM 1800" },
1094         { 0x04, "GSM 1900" },
1095         { 0x05, "GSM 450" },
1096         { 0x06, "GSM 480" },
1097         { 0x07, "GSM 850" },
1098         { 0x08, "GSM 750" },
1099         { 0x09, "GSM T 380" },
1100         { 0x0a, "GSM T 410" },
1101         { 0x0b, "GSM T 900" },
1102         { 0x0c, "GSM 710" },
1103         { 0x0d, "GSM T 810" },
1104         { 0x0f, "Indicates the presence of a list of Additional access technologies" },
1105         { 0, NULL }
1106 };
1107
1108 static const true_false_string gsm_a_gm_vgcs = {
1109         "VGCS capability and notifications wanted",
1110         "no VGCS capability or no notifications wanted"
1111 };
1112
1113 static const true_false_string gsm_a_gm_vbs = {
1114         "VBS capability and notifications wanted",
1115         "no VBS capability or no notifications wanted"
1116 };
1117
1118 static const value_string gsm_a_gm_multi_slot_vals[] = {
1119         { 0x00, "Not specified" },
1120         { 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" },
1121         { 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" },
1122         { 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" },
1123         { 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" },
1124         { 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" },
1125         { 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" },
1126         { 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" },
1127         { 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" },
1128         { 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" },
1129         { 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" },
1130         { 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" },
1131         { 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" },
1132         { 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)" },
1133         { 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)" },
1134         { 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)" },
1135         { 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)" },
1136         { 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)" },
1137         { 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" },
1138         { 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" },
1139         { 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" },
1140         { 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" },
1141         { 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" },
1142         { 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" },
1143         { 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" },
1144         { 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" },
1145         { 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" },
1146         { 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" },
1147         { 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" },
1148         { 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" },
1149         { 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" },
1150         { 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" },
1151         { 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" },
1152         { 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" },
1153         { 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" },
1154         { 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))" },
1155         { 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))" },
1156         { 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))" },
1157         { 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))" },
1158         { 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))" },
1159         { 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))" },
1160         { 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))" },
1161         { 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))" },
1162         { 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))" },
1163         { 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))" },
1164         { 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))" },
1165         { 0, NULL }
1166 };
1167
1168 static const value_string gsm_a_gm_dtm_gprs_multi_slot_class_vals[] = {
1169         { 0x00, "Unused. If received, the network shall interpret this as Multislot class 5" },
1170         { 0x01, "Multislot class 5 supported" },
1171         { 0x02, "Multislot class 9 supported" },
1172         { 0x03, "Multislot class 11 supported" },
1173         { 0, NULL }
1174 };
1175
1176 static const true_false_string gsm_a_gm_revision_level_indicator = {
1177         "The ME is Release '99 onwards",
1178         "The ME is Release '98 or older"
1179 };
1180
1181 static const value_string gsm_a_gm_down_adv_rec_perf_vals[] = {
1182         { 0x00, "Downlink Advanced Receiver Performance not supported" },
1183         { 0x01, "Downlink Advanced Receiver Performance - phase I supported" },
1184         { 0x02, "Downlink Advanced Receiver Performance - phase II supported" },
1185         { 0, NULL }
1186 };
1187
1188 static const true_false_string gsm_a_gm_dtm_enh_cap = {
1189         "The mobile station supports enhanced DTM CS establishment and enhanced DTM CS release procedures",
1190         "The mobile station does not support enhanced DTM CS establishment and enhanced DTM CS release procedures"
1191 };
1192
1193 static const value_string gsm_a_gm_dtm_gprs_high_multi_slot_class_vals[] = {
1194         { 0x00, "Unused. If received, the network shall interpret this as 'Multislot class 31 or 36 supported'" },
1195         { 0x01, "Multislot class 31 or 36 supported" },
1196         { 0x02, "Multislot class 32 or 37 supported" },
1197         { 0x03, "Multislot class 33 or 38 supported" },
1198         { 0x04, "Multislot class 41 supported" },
1199         { 0x05, "Multislot class 42 supported" },
1200         { 0x06, "Multislot class 43 supported" },
1201         { 0x07, "Multislot class 44 supported" },
1202         { 0, NULL }
1203 };
1204
1205 static const value_string gsm_a_gm_multi_slot_cap_red_down_dual_carrier_vals[] = {
1206         { 0x00, "No reduction" },
1207         { 0x01, "The MS supports 1 timeslot fewer than the maximum number of receive timeslots" },
1208         { 0x02, "The MS supports 2 timeslots fewer than the maximum number of receive timeslots" },
1209         { 0x03, "The MS supports 3 timeslots fewer than the maximum number of receive timeslots" },
1210         { 0x04, "The MS supports 4 timeslots fewer than the maximum number of receive timeslots" },
1211         { 0x05, "The MS supports 5 timeslots fewer than the maximum number of receive timeslots" },
1212         { 0x06, "The MS supports 6 timeslots fewer than the maximum number of receive timeslots" },
1213         { 0x07, "Reserved for future use" },
1214         { 0, NULL }
1215 };
1216
1217 static const value_string gsm_a_gm_ul_egprs2_vals[] = {
1218         { 0x00, "The mobile station does not support either EGPRS2-A or EGPRS2-B in the uplink" },
1219         { 0x01, "The mobile station supports EGPRS2-A in the uplink" },
1220         { 0x02, "The mobile station supports both EGPRS2-A and EGPRS2-B in the uplink" },
1221         { 0x03, "This value is not used in this release/version of the specifications. If received it shall be interpreted as 'The mobile station supports both EGPRS2-A and EGPRS2-B in the uplink'" },
1222         { 0, NULL }
1223 };
1224
1225 static const value_string gsm_a_gm_dl_egprs2_vals[] = {
1226         { 0x00, "The mobile station does not support either EGPRS2-A or EGPRS2-B in the downlink" },
1227         { 0x01, "The mobile station supports EGPRS2-A in the downlink" },
1228         { 0x02, "The mobile station supports both EGPRS2-A and EGPRS2-B in the downlink" },
1229         { 0x03, "This value is not used in this release/version of the specifications. If received it shall be interpreted as 'The mobile station supports both EGPRS2-A and EGPRS2-B in the downlink'" },
1230         { 0, NULL }
1231 };
1232
1233 static const value_string gsm_a_gm_geran_to_eutra_support_in_geran_ptm_vals[] = {
1234         { 0x00, "None" },
1235         { 0x01, "E-UTRAN Neighbour Cell measurements and MS autonomous cell reselection to E-UTRAN supported" },
1236         { 0x02, "CCN towards E-UTRAN, E-UTRAN Neighbour Cell measurement reporting and Network controlled cell reselection to E-UTRAN supported in addition to capabilities indicated by '01'" },
1237         { 0x03, "PS Handover to E-UTRAN supported in addition to capabilities indicated by '01' and '10'" },
1238         { 0, NULL }
1239 };
1240
1241 static const value_string gsm_a_gm_alt_efta_multi_slot_class_vals[] = {
1242         { 0x00, "No Alternative EFTA multislot class is indicated. Use (DTM) EGPRS (high) multislot class only" },
1243         { 0x01, "Alternative EFTA multislot class is Multislot class 19" },
1244         { 0x02, "Alternative EFTA multislot class is Multislot class 20" },
1245         { 0x03, "Alternative EFTA multislot class is Multislot class 21" },
1246         { 0x04, "Alternative EFTA multislot class is Multislot class 22" },
1247         { 0x05, "Alternative EFTA multislot class is Multislot class 23" },
1248         { 0x06, "Alternative EFTA multislot class is Multislot class 24" },
1249         { 0x07, "Alternative EFTA multislot class is Multislot class 25" },
1250         { 0x08, "Alternative EFTA multislot class is Multislot class 26" },
1251         { 0x09, "Alternative EFTA multislot class is Multislot class 27" },
1252         { 0x0a, "Alternative EFTA multislot class is Multislot class 28" },
1253         { 0x0b, "Alternative EFTA multislot class is Multislot class 29" },
1254         { 0x0c, "Unused" },
1255         { 0x0d, "Unused" },
1256         { 0x0e, "Unused" },
1257         { 0x0f, "Unused" },
1258         { 0, NULL }
1259 };
1260
1261 guint16
1262 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_)
1263 {
1264         guint32      curr_offset;
1265         guint        curr_len;
1266         int          bit_offset;
1267         proto_item  *tf = NULL, *mc_item = NULL;
1268         proto_tree  *tf_tree = NULL, *mc_tree = NULL;
1269         guint32      oct;
1270         guchar       bits_in_oct;
1271         guchar       bits_needed;
1272         guint        bits_length;
1273         guint        add_ocetets;       /* octets which are covered by one element -1 */
1274         guint        curr_bits_length;
1275         guchar       acc_type;
1276         guint        value;
1277         const gchar *str;
1278         guint indx = 0;
1279         guchar dtm_gprs_mslot = 0;
1280         guchar dtm_egprs_mslot = 4;
1281         gboolean finished = TRUE;
1282
1283         curr_len = len;
1284         curr_offset = offset;
1285         bit_offset = offset<<3;
1286
1287         bits_in_oct = 0;
1288         oct = 0;
1289
1290
1291         do
1292         {
1293                 /* check for a new round */
1294                 if (( curr_len*8 + bits_in_oct ) < 11 )
1295                         break;
1296
1297                 /* now read the first 11 bits */
1298                 curr_bits_length = 11;
1299                 /*
1300                  *
1301                  */
1302                 if ( curr_len != len )
1303                 {
1304                         bits_needed = 1;
1305                         GET_DATA;
1306
1307                         if (( oct>>(32-bits_needed) ) == 1 )
1308                         {
1309                                 curr_bits_length -= bits_needed;
1310                                 oct <<= bits_needed;
1311                                 bits_in_oct -= bits_needed;
1312                                 bit_offset++;
1313
1314                                 if (( curr_len*8 + bits_in_oct ) < 11 )
1315                                         break;
1316                                 curr_bits_length = 11;
1317                         }
1318                         else
1319                         {
1320                                 curr_bits_length -= bits_needed;
1321                                 oct <<= bits_needed;
1322                                 bits_in_oct -= bits_needed;
1323                                 bit_offset++;
1324                                 break;
1325                         }
1326                 }
1327
1328                 indx++;
1329                 tf = proto_tree_add_text(tree,
1330                                 tvb, curr_offset, 1,
1331                                 "MS RA capability %d",indx);
1332
1333                 tf_tree = proto_item_add_subtree(tf, ett_gmm_radio_cap );
1334
1335                 /*
1336                  * Access Technology
1337                  */
1338                 bits_needed = 4;
1339                 GET_DATA;
1340
1341                 acc_type = oct>>(32-bits_needed);
1342
1343                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_acc_tech_type, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1344                 bit_offset+=4;
1345
1346                 curr_bits_length -= bits_needed;
1347                 oct <<= bits_needed;
1348                 bits_in_oct -= bits_needed;
1349
1350                 /* < Access capabilities struct > ::= */
1351                 /*
1352                  * get bits_length
1353                  */
1354                 bits_needed = 7;
1355                 GET_DATA;
1356
1357                 bits_length = curr_bits_length = oct>>(32-bits_needed);
1358
1359                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_acc_cap_struct_len, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
1360                 proto_item_set_len(tf, (bits_length>>3)+1);
1361                 /* This is already done - length doesn't contain this field
1362                  curr_bits_length -= bits_needed;
1363                 */
1364                 bit_offset+=7;
1365                 oct <<= bits_needed;
1366                 bits_in_oct -= bits_needed;
1367
1368                 if ( acc_type == 0x0f )
1369                 {
1370                         do
1371                         {
1372                                 /*
1373                                  * Additional access technologies:
1374                                  */
1375                                 finished = TRUE; /* Break out of the loop unless proven unfinished */
1376
1377                                 /*
1378                                  * Presence bit
1379                                  */
1380                                 bits_needed = 1;
1381                                 GET_DATA;
1382
1383                                 /* analyse bits */
1384                                 switch ( oct>>(32-bits_needed) )
1385                                 {
1386                                         case 0x00: str="Not Present"; finished = TRUE; break;
1387                                         case 0x01: str="Present"; finished = FALSE;    break;
1388                                         default:   str="This should not happen";
1389                                 }
1390
1391                                 proto_tree_add_text(tf_tree,
1392                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1393                                         "Presence: %s (%u)", str, oct>>(32-bits_needed));
1394                                 bit_offset++;
1395                                 curr_bits_length -= bits_needed;
1396                                 oct <<= bits_needed;
1397                                 bits_in_oct -= bits_needed;
1398
1399                                 if (finished)
1400                                 {
1401                                         /*
1402                                          * No more valid data, get spare bits if any
1403                                          */
1404                                         while ( curr_bits_length > 0 )
1405                                         {
1406                                                 if ( curr_bits_length > 8 )
1407                                                         bits_needed = 8;
1408                                                 else
1409                                                         bits_needed = curr_bits_length;
1410                                                 GET_DATA;
1411                                                 curr_bits_length -= bits_needed;
1412                                                 oct <<= bits_needed;
1413                                                 bits_in_oct -= bits_needed;
1414                                                 bit_offset+= bits_needed;
1415                                         }
1416                                         continue;
1417                                 }
1418
1419                                 /*
1420                                  * Access Technology
1421                                  */
1422                                 bits_needed = 4;
1423                                 GET_DATA;
1424
1425                                 acc_type = oct>>(32-bits_needed);
1426
1427                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_acc_cap_struct_len, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
1428                                 bit_offset+=4;
1429
1430                                 curr_bits_length -= bits_needed;
1431                                 oct <<= bits_needed;
1432                                 bits_in_oct -= bits_needed;
1433
1434                                 /*
1435                                  * RF Power
1436                                  */
1437                                 bits_needed = 3;
1438                                 GET_DATA;
1439
1440                                 value = tvb_get_bits8(tvb, bit_offset, 3);
1441                                 /* analyse bits */
1442                                 if ( acc_type == 0x04 ) /* GSM 1900 */
1443                                 {
1444                                         switch ( value )
1445                                         {
1446                                                 case 0x01: str="1 W (30 dBm)";    break;
1447                                                 case 0x02: str="0,25 W (24 dBm)"; break;
1448                                                 case 0x03: str="2 W (33 dBm)";    break;
1449                                                 default:   str="Not specified";
1450                                         }
1451                                 }
1452                                 else if ( acc_type == 0x03 )
1453                                 {
1454                                         /*
1455                                          * 3 GSM 1800
1456                                          */
1457                                         switch ( value )
1458                                         {
1459                                                 case 0x01: str="1 W (30 dBm)";    break;
1460                                                 case 0x02: str="0,25 W (24 dBm)"; break;
1461                                                 case 0x03: str="4 W (36 dBm)";    break;
1462                                                 default:   str="Not specified";
1463                                         }
1464                                 }
1465                                 else if ( acc_type <= 0x08 )
1466                                 {
1467                                         /* 0 GSM P
1468                                          * 1 GSM E
1469                                          * 2 GSM R
1470                                          * 5 GSM 450
1471                                          * 6 GSM 480
1472                                          * 7 GSM 850
1473                                          */
1474
1475                                         switch ( value )
1476                                         {
1477                                                 case 0x02: str="8 W (39 dBm)";   break;
1478                                                 case 0x03: str="5 W (37 dBm)";   break;
1479                                                 case 0x04: str="2 W (33 dBm)";   break;
1480                                                 case 0x05: str="0,8 W (29 dBm)"; break;
1481                                                 default:   str="Not specified";
1482                                         }
1483                                 }
1484                                 else
1485                                         str="Not specified??";
1486
1487                                 /* decode_bits_in_field(gint bit_offset, gint no_of_bits, guint64 value)*/
1488                                 proto_tree_add_text(tf_tree,
1489                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1490                                         "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value), str, value);
1491                                 bit_offset+=3;
1492                                 curr_bits_length -= bits_needed;
1493                                 oct <<= bits_needed;
1494                                 bits_in_oct -= bits_needed;
1495
1496                                 /*
1497                                  * 8PSK Power Class
1498                                  */
1499                                 bits_needed = 2;
1500                                 GET_DATA;
1501
1502                                 value = tvb_get_bits8(tvb, bit_offset, 2);
1503                                 /* analyse bits */
1504                                 switch ( value )
1505                                 {
1506                                         case 0x00: str="8PSK modulation not supported for uplink"; break;
1507                                         case 0x01: str="Power class E1"; break;
1508                                         case 0x02: str="Power class E2"; break;
1509                                         case 0x03: str="Power class E3"; break;
1510                                         default:   str="This should not happen";
1511                                 }
1512
1513                                 proto_tree_add_text(tf_tree,
1514                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1515                                         "8PSK Power Class: %s (%u)",str,value);
1516                                 bit_offset+=2;
1517                                 curr_bits_length -= bits_needed;
1518                                 oct <<= bits_needed;
1519                                 bits_in_oct -= bits_needed;
1520
1521                         } while (!finished);
1522
1523                         /* goto next one */
1524                         continue;
1525                 }
1526                 /*
1527                  * RF Power
1528                  */
1529                 bits_needed = 3;
1530                 GET_DATA;
1531
1532                 value = tvb_get_bits8(tvb, bit_offset, 3);
1533                 /* analyse bits */
1534                 if ( acc_type == 0x04 ) /* GSM 1900 */
1535                 {
1536                         switch ( value )
1537                         {
1538                                 case 0x01: str="1 W (30 dBm)";    break;
1539                                 case 0x02: str="0,25 W (24 dBm)"; break;
1540                                 case 0x03: str="2 W (33 dBm)";    break;
1541                                 default:   str="Not specified";
1542                         }
1543                 }
1544                 else if ( acc_type == 0x03 )
1545                 {
1546                         switch ( value )
1547                         {
1548                                 case 0x01: str="1 W (30 dBm)";    break;
1549                                 case 0x02: str="0,25 W (24 dBm)"; break;
1550                                 case 0x03: str="4 W (36 dBm)";    break;
1551                                 default:   str="Not specified";
1552                         }
1553                 }
1554                 else if ( acc_type <= 0x08 )
1555                 {
1556                         switch ( value )
1557                         {
1558                                 case 0x02: str="8 W (39 dBm)";   break;
1559                                 case 0x03: str="5 W (37 dBm)";   break;
1560                                 case 0x04: str="2 W (33 dBm)";   break;
1561                                 case 0x05: str="0,8 W (29 dBm)"; break;
1562                                 default:   str="Not specified";
1563                         }
1564                 }
1565                 else
1566                         str="Not specified??";
1567
1568                 proto_tree_add_text(tf_tree,
1569                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1570                         "%s RF Power Capability, GMSK Power Class: %s (%u)", decode_bits_in_field(bit_offset, 3, value),str,value);
1571
1572                 bit_offset+=3;
1573                 curr_bits_length -= bits_needed;
1574                 oct <<= bits_needed;
1575                 bits_in_oct -= bits_needed;
1576
1577                 /*
1578                  * A5 Bits?
1579                  */
1580                 bits_needed = 1;
1581                 GET_DATA;
1582
1583                 /* analyse bits */
1584                 if ((oct>>(32-bits_needed))==0)
1585                 {
1586                         proto_tree_add_text(tf_tree,
1587                                 tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1588                                 "A5 Bits: Same values apply for parameters as in the immediately preceding Access capabilities field within this IE (%u)",oct>>(32-bits_needed));
1589                         bit_offset++;
1590                         curr_bits_length -= bits_needed;
1591                         oct <<= bits_needed;
1592                         bits_in_oct -= bits_needed;
1593                 }
1594                 else
1595                 {
1596                         int i;
1597
1598                         proto_tree_add_text(tf_tree,
1599                                 tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1600                                 "A5 Bits: A5 bits follow (%u)",oct>>(32-bits_needed));
1601
1602                         bit_offset++;
1603                         curr_bits_length -= bits_needed;
1604                         oct <<= bits_needed;
1605                         bits_in_oct -= bits_needed;
1606
1607                         for (i=1; i<= 7 ; i++ )
1608                         {
1609                                 /*
1610                                  * A5 Bits decoding
1611                                  */
1612                                 bits_needed = 1;
1613                                 GET_DATA;
1614
1615                                 /* analyse bits */
1616                                 switch ( oct>>(32-bits_needed) )
1617                                 {
1618                                         case 0x00: str="encryption algorithm not available"; break;
1619                                         case 0x01: str="encryption algorithm available";     break;
1620                                         default:   str="This should not happen";
1621                                 }
1622
1623                                 proto_tree_add_text(tf_tree,
1624                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1625                                         "A5/%d: %s (%u)",i,str,oct>>(32-bits_needed));
1626                                 bit_offset++;
1627                                 curr_bits_length -= bits_needed;
1628                                 oct <<= bits_needed;
1629                                 bits_in_oct -= bits_needed;
1630                         }
1631                 }
1632
1633                 /*
1634                  * ES IND
1635                  */
1636                 bits_needed = 1;
1637                 GET_DATA;
1638
1639                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ctrled_early_cm_sending, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1640                 bit_offset++;
1641                 curr_bits_length -= bits_needed;
1642                 oct <<= bits_needed;
1643                 bits_in_oct -= bits_needed;
1644
1645                 /*
1646                  * PS
1647                  */
1648                 bits_needed = 1;
1649                 GET_DATA;
1650
1651                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_pseudo_sync, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1652                 bit_offset++;
1653                 curr_bits_length -= bits_needed;
1654                 oct <<= bits_needed;
1655                 bits_in_oct -= bits_needed;
1656
1657                 /*
1658                  * VGCS
1659                  */
1660                 bits_needed = 1;
1661                 GET_DATA;
1662
1663                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_vgcs, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1664                 bit_offset++;
1665                 curr_bits_length -= bits_needed;
1666                 oct <<= bits_needed;
1667                 bits_in_oct -= bits_needed;
1668
1669                 /*
1670                  * VBS
1671                  */
1672                 bits_needed = 1;
1673                 GET_DATA;
1674
1675                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_vbs, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1676                 bit_offset++;
1677                 curr_bits_length -= bits_needed;
1678                 oct <<= bits_needed;
1679                 bits_in_oct -= bits_needed;
1680
1681                 /*
1682                  * Multislot capability?
1683                  */
1684                 bits_needed = 1;
1685                 GET_DATA;
1686
1687                 value = oct>>(32-bits_needed);
1688
1689                 mc_item = proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_multislot_capability, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1690                 bit_offset++;
1691
1692                 curr_bits_length -= bits_needed;
1693                 oct <<= bits_needed;
1694                 bits_in_oct -= bits_needed;
1695
1696                 /* analyse bits */
1697                 if (value==1)
1698                 {
1699                         mc_tree = proto_item_add_subtree(mc_item, ett_gsm_a_gm_msrac_multislot_capability);
1700                         /*
1701                          * HSCSD multislot class?
1702                          */
1703                         bits_needed = 1;
1704                         GET_DATA;
1705
1706                         /* analyse bits */
1707                         if ((oct>>(32-bits_needed))==0)
1708                         {
1709                                 proto_tree_add_text(mc_tree,
1710                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1711                                         "HSCSD multislot class: Bits are not available (%u)",oct>>(32-bits_needed));
1712                                 bit_offset++;
1713                                 curr_bits_length -= bits_needed;
1714                                 oct <<= bits_needed;
1715                                 bits_in_oct -= bits_needed;
1716                         }
1717                         else
1718                         {
1719                                 curr_bits_length -= bits_needed;
1720                                 oct <<= bits_needed;
1721                                 bits_in_oct -= bits_needed;
1722                                 bit_offset++;
1723
1724                                 /*
1725                                  * HSCSD multislot class
1726                                  */
1727                                 bits_needed = 5;
1728                                 GET_DATA;
1729
1730                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_hscsd_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
1731                                 bit_offset+=5;
1732                                 curr_bits_length -= bits_needed;
1733                                 oct <<= bits_needed;
1734                                 bits_in_oct -= bits_needed;
1735                         }
1736
1737                         /*
1738                          * GPRS multislot class?
1739                          */
1740                         bits_needed = 1;
1741                         GET_DATA;
1742
1743                         /* analyse bits */
1744                         if ((oct>>(32-bits_needed))==0)
1745                         {
1746                                 proto_tree_add_text(mc_tree,
1747                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1748                                         "GPRS multislot class: Bits are not available (%u)",oct>>(32-bits_needed));
1749                                 bit_offset++;
1750                                 curr_bits_length -= bits_needed;
1751                                 oct <<= bits_needed;
1752                                 bits_in_oct -= bits_needed;
1753                         }
1754                         else
1755                         {
1756                                 curr_bits_length -= bits_needed;
1757                                 oct <<= bits_needed;
1758                                 bits_in_oct -= bits_needed;
1759                                 bit_offset++;
1760
1761                                 /*
1762                                  * GPRS multislot class
1763                                  */
1764                                 bits_needed = 5;
1765                                 GET_DATA;
1766
1767                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_gprs_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
1768                                 bit_offset+=5;
1769                                 curr_bits_length -= bits_needed;
1770                                 oct <<= bits_needed;
1771                                 bits_in_oct -= bits_needed;
1772
1773                                 /*
1774                                  * GPRS Extended Dynamic Allocation Capability
1775                                  */
1776                                 bits_needed = 1;
1777                                 GET_DATA;
1778
1779                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_gprs_ext_dyn_alloc_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1780                                 bit_offset++;
1781                                 curr_bits_length -= bits_needed;
1782                                 oct <<= bits_needed;
1783                                 bits_in_oct -= bits_needed;
1784                         }
1785
1786                         /*
1787                          * SMS/SM values
1788                          */
1789                         bits_needed = 1;
1790                         GET_DATA;
1791
1792                         /* analyse bits */
1793                         if ((oct>>(32-bits_needed))==0)
1794                         {
1795                                 proto_tree_add_text(mc_tree,
1796                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1797                                         "SMS/SM values: Bits are not available (%u)",oct>>(32-bits_needed));
1798                                 bit_offset++;
1799                                 curr_bits_length -= bits_needed;
1800                                 oct <<= bits_needed;
1801                                 bits_in_oct -= bits_needed;
1802                         }
1803                         else
1804                         {
1805                                 curr_bits_length -= bits_needed;
1806                                 oct <<= bits_needed;
1807                                 bits_in_oct -= bits_needed;
1808                                 bit_offset++;
1809
1810                                 /*
1811                                  * Switch-Measure-Switch value
1812                                  */
1813                                 bits_needed = 4;
1814                                 GET_DATA;
1815
1816                                 /* analyse bits */
1817                                 proto_tree_add_bits_item(mc_tree, hf_gsm_a_gm_sms_value, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1818                                 bit_offset+=4;
1819                                 curr_bits_length -= bits_needed;
1820                                 oct <<= bits_needed;
1821                                 bits_in_oct -= bits_needed;
1822
1823                                 /*
1824                                  * Switch-Measure value
1825                                  */
1826                                 bits_needed = 4;
1827                                 GET_DATA;
1828
1829                                 /* analyse bits */
1830                                 proto_tree_add_bits_item(mc_tree, hf_gsm_a_gm_sm_value, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
1831                                 bit_offset+=4;
1832                                 curr_bits_length -= bits_needed;
1833                                 oct <<= bits_needed;
1834                                 bits_in_oct -= bits_needed;
1835                         }
1836
1837                         /*
1838                          * ECSD multislot class?
1839                          */
1840                         bits_needed = 1;
1841                         GET_DATA;
1842
1843                         /* analyse bits */
1844                         if ((oct>>(32-bits_needed))==0)
1845                         {
1846                                 proto_tree_add_text(mc_tree,
1847                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1848                                         "ECSD multislot class: Bits are not available (%u)",oct>>(32-bits_needed));
1849                                 bit_offset++;
1850                                 curr_bits_length -= bits_needed;
1851                                 oct <<= bits_needed;
1852                                 bits_in_oct -= bits_needed;
1853                         }
1854                         else
1855                         {
1856                                 curr_bits_length -= bits_needed;
1857                                 oct <<= bits_needed;
1858                                 bits_in_oct -= bits_needed;
1859                                 bit_offset++;
1860
1861                                 /*
1862                                  * ECSD multislot class
1863                                  */
1864                                 bits_needed = 5;
1865                                 GET_DATA;
1866
1867                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ecsd_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
1868                                 bit_offset+=5;
1869                                 curr_bits_length -= bits_needed;
1870                                 oct <<= bits_needed;
1871                                 bits_in_oct -= bits_needed;
1872                         }
1873
1874                         /*
1875                          * EGPRS multislot class?
1876                          */
1877                         bits_needed = 1;
1878                         GET_DATA;
1879
1880                         /* analyse bits */
1881                         if ((oct>>(32-bits_needed))==0)
1882                         {
1883                                 proto_tree_add_text(mc_tree,
1884                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1885                                         "EGPRS multislot class: Bits are not available (%u)",oct>>(32-bits_needed));
1886                                 curr_bits_length -= bits_needed;
1887                                 oct <<= bits_needed;
1888                                 bits_in_oct -= bits_needed;
1889                                 bit_offset++;
1890                         }
1891                         else
1892                         {
1893                                 curr_bits_length -= bits_needed;
1894                                 oct <<= bits_needed;
1895                                 bits_in_oct -= bits_needed;
1896                                 bit_offset++;
1897
1898                                 /*
1899                                  * EGPRS multislot class
1900                                  */
1901                                 bits_needed = 5;
1902                                 GET_DATA;
1903
1904                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_egprs_multi_slot_class, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
1905                                 bit_offset+=5;
1906                                 curr_bits_length -= bits_needed;
1907                                 oct <<= bits_needed;
1908                                 bits_in_oct -= bits_needed;
1909
1910                                 /*
1911                                  * EGPRS Extended Dynamic Allocation Capability
1912                                  */
1913                                 bits_needed = 1;
1914                                 GET_DATA;
1915
1916                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_egprs_ext_dyn_alloc_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1917                                 bit_offset++;
1918                                 curr_bits_length -= bits_needed;
1919                                 oct <<= bits_needed;
1920                                 bits_in_oct -= bits_needed;
1921                         }
1922
1923                         /*
1924                          * DTM GPRS Multi Slot Class ?
1925                         */
1926                         bits_needed = 1;
1927                         GET_DATA;
1928
1929                         /* analyse bits */
1930                         if ((oct>>(32-bits_needed))==0)
1931                         {
1932                                 proto_tree_add_text(mc_tree,
1933                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
1934                                         "DTM GPRS Multi Slot Class: Bits are not available (%u)",oct>>(32-bits_needed));
1935                                 bit_offset++;
1936                                 curr_bits_length -= bits_needed;
1937                                 oct <<= bits_needed;
1938                                 bits_in_oct -= bits_needed;
1939                         }
1940                         else
1941                         {
1942                                 curr_bits_length -= bits_needed;
1943                                 oct <<= bits_needed;
1944                                 bits_in_oct -= bits_needed;
1945                                 bit_offset++;
1946
1947                                 /*
1948                                  * DTM GPRS Multi Slot Class
1949                                  */
1950                                 bits_needed = 2;
1951                                 GET_DATA;
1952
1953                                 /* analyse bits */
1954                                 dtm_gprs_mslot = oct>>(32-bits_needed);
1955
1956                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_gprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
1957                                 bit_offset+=2;
1958                                 curr_bits_length -= bits_needed;
1959                                 oct <<= bits_needed;
1960                                 bits_in_oct -= bits_needed;
1961
1962                                 /*
1963                                  * Single Slot DTM
1964                                  */
1965                                 bits_needed = 1;
1966                                 GET_DATA;
1967
1968                                 proto_tree_add_bits_item(mc_tree, hf_gsm_a_gm_rac_single_slt_dtm, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1969                                 bit_offset++;
1970                                 curr_bits_length -= bits_needed;
1971                                 oct <<= bits_needed;
1972                                 bits_in_oct -= bits_needed;
1973
1974                                 /*
1975                                  * DTM EGPRS Multi Slot Class ?
1976                                 */
1977                                 bits_needed = 1;
1978                                 GET_DATA;
1979
1980                                 /* analyse bits */
1981                                 dtm_egprs_mslot = oct>>(32-bits_needed);
1982                                 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);
1983                                 bit_offset++;
1984                                 curr_bits_length -= bits_needed;
1985                                 oct <<= bits_needed;
1986                                 bits_in_oct -= bits_needed;
1987
1988                                 if ((oct>>(32-bits_needed))==1)
1989                                 {
1990                                         /*
1991                                          * DTM EGPRS Multi Slot Class
1992                                          */
1993                                         bits_needed = 2;
1994                                         GET_DATA;
1995
1996                                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_egprs_multi_slot_class, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
1997                                         bit_offset+=2;
1998                                         curr_bits_length -= bits_needed;
1999                                         oct <<= bits_needed;
2000                                         bits_in_oct -= bits_needed;
2001                                 }
2002                         }
2003                 }
2004
2005                 /*
2006                  * 8PSK Power Capability?
2007                  */
2008                 bits_needed = 1;
2009                 GET_DATA;
2010
2011                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_8psk_pow_cap_pres, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2012                 bit_offset++;
2013                 curr_bits_length -= bits_needed;
2014                 oct <<= bits_needed;
2015                 bits_in_oct -= bits_needed;
2016
2017                 /* analyse bits */
2018                 if ((oct>>(32-bits_needed))==1)
2019                 {
2020                         /*
2021                          * 8PSK Power Capability
2022                          */
2023                         bits_needed = 2;
2024                         GET_DATA;
2025
2026                         /* analyse bits */
2027                         switch ( oct>>(32-bits_needed) )
2028                         {
2029                                 case 0x00: str="Reserved";       break;
2030                                 case 0x01: str="Power class E1"; break;
2031                                 case 0x02: str="Power class E2"; break;
2032                                 case 0x03: str="Power class E3"; break;
2033                                 default:   str="This should not happen";
2034                         }
2035
2036                         proto_tree_add_text(tf_tree,
2037                                 tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2038                                 "8PSK Power Capability: %s (%u)",str,oct>>(32-bits_needed));
2039                         bit_offset+=2;
2040                         curr_bits_length -= bits_needed;
2041                         oct <<= bits_needed;
2042                         bits_in_oct -= bits_needed;
2043                 }
2044
2045                 /*
2046                  * COMPACT Interference Measurement Capability
2047                  */
2048                 bits_needed = 1;
2049                 GET_DATA;
2050
2051                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_comp_int_meas_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2052                 bit_offset++;
2053                 curr_bits_length -= bits_needed;
2054                 oct <<= bits_needed;
2055                 bits_in_oct -= bits_needed;
2056
2057                 /*
2058                  * Revision Level Indicator
2059                  */
2060                 bits_needed = 1;
2061                 GET_DATA;
2062
2063                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rel_lev_ind, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2064                 bit_offset++;
2065                 curr_bits_length -= bits_needed;
2066                 oct <<= bits_needed;
2067                 bits_in_oct -= bits_needed;
2068
2069                 /*
2070                  * UMTS FDD Radio Access Technology Capability
2071                  */
2072                 bits_needed = 1;
2073                 GET_DATA;
2074
2075                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_umts_fdd_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2076                 bit_offset++;
2077                 curr_bits_length -= bits_needed;
2078                 oct <<= bits_needed;
2079                 bits_in_oct -= bits_needed;
2080
2081                 /*
2082                  * UMTS 3.84 Mcps TDD Radio Access Technology Capability
2083                  */
2084                 bits_needed = 1;
2085                 GET_DATA;
2086
2087                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_umts_384_tdd_ra_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2088                 bit_offset++;
2089                 curr_bits_length -= bits_needed;
2090                 oct <<= bits_needed;
2091                 bits_in_oct -= bits_needed;
2092
2093                 /*
2094                  * CDMA 2000 Radio Access Technology Capability
2095                  */
2096                 bits_needed = 1;
2097                 GET_DATA;
2098
2099                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_cdma2000_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2100                 bit_offset++;
2101                 curr_bits_length -= bits_needed;
2102                 oct <<= bits_needed;
2103                 bits_in_oct -= bits_needed;
2104
2105                 /*
2106                  * UMTS 1.28 Mcps TDD Radio Access Technology Capability
2107                  */
2108                 bits_needed = 1;
2109                 GET_DATA;
2110
2111                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_umts_128_tdd_ra_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2112                 bit_offset++;
2113                 curr_bits_length -= bits_needed;
2114                 oct <<= bits_needed;
2115                 bits_in_oct -= bits_needed;
2116
2117                 /*
2118                  * GERAN Feature Package 1
2119                  */
2120                 bits_needed = 1;
2121                 GET_DATA;
2122
2123                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_geran_feat_pkg, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2124                 bit_offset++;
2125                 curr_bits_length -= bits_needed;
2126                 oct <<= bits_needed;
2127                 bits_in_oct -= bits_needed;
2128
2129                 /*
2130                  * Extended DTM (E)GPRS Multi Slot Class
2131                  */
2132
2133                 bits_needed = 1;
2134                 GET_DATA;
2135
2136                 /* analyse bits */
2137                 if ((oct>>(32-bits_needed))==0)
2138                 {
2139                         proto_tree_add_text(tf_tree,
2140                                 tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2141                                 "Extended DTM (E)GPRS Multi Slot Class: Bits are not available (%u)",oct>>(32-bits_needed));
2142                         curr_bits_length -= bits_needed;
2143                         oct <<= bits_needed;
2144                         bits_in_oct -= bits_needed;
2145                         bit_offset++;
2146                 }
2147                 else
2148                 {
2149                         curr_bits_length -= bits_needed;
2150                         oct <<= bits_needed;
2151                         bits_in_oct -= bits_needed;
2152                         bit_offset++;
2153
2154                         /*
2155                          * Extended DTM GPRS Multi Slot Class
2156                          */
2157                         bits_needed = 2;
2158                         GET_DATA;
2159
2160                         /* analyse bits */
2161                         switch ( (oct>>(32-bits_needed))|(dtm_gprs_mslot<<4) )
2162                         {
2163                                 case 0x00: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2164                                 case 0x01: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2165                                 case 0x02: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2166                                 case 0x03: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2167                                 case 0x10: str="Multislot class 5 supported";  break;
2168                                 case 0x11: str="Multislot class 6 supported";  break;
2169                                 case 0x12: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2170                                 case 0x13: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2171                                 case 0x20: str="Multislot class 9 supported";  break;
2172                                 case 0x21: str="Multislot class 10 supported"; break;
2173                                 case 0x22: str="Unused. If received, it shall be interpreted as Multislot class 9 supported";  break;
2174                                 case 0x23: str="Unused. If received, it shall be interpreted as Multislot class 9 supported";  break;
2175                                 case 0x30: str="Multislot class 11 supported"; break;
2176                                 case 0x31: str="Unused. If received, it shall be interpreted as Multislot class 11 supported"; break;
2177                                 case 0x32: str="Unused. If received, it shall be interpreted as Multislot class 11 supported"; break;
2178                                 case 0x33: str="Unused. If received, it shall be interpreted as Multislot class 11 supported"; break;
2179                                 default:   str="This should not happen";
2180                         }
2181
2182                         proto_tree_add_text(tf_tree,
2183                                 tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2184                                 "Extended DTM GPRS Multi Slot Class: %s (%u)",str,oct>>(32-bits_needed));
2185                         bit_offset+=2;
2186                         curr_bits_length -= bits_needed;
2187                         oct <<= bits_needed;
2188                         bits_in_oct -= bits_needed;
2189
2190                         if ( dtm_egprs_mslot <= 3 )
2191                         {
2192                                 /*
2193                                  * Extended DTM EGPRS Multi Slot Class
2194                                  */
2195                                 bits_needed = 2;
2196                                 GET_DATA;
2197
2198                                 /* analyse bits */
2199                                 switch ( (oct>>(32-bits_needed))|(dtm_egprs_mslot<<4) )
2200                                 {
2201                                         case 0x00: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2202                                         case 0x01: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2203                                         case 0x02: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2204                                         case 0x03: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2205                                         case 0x10: str="Multislot class 5 supported";  break;
2206                                         case 0x11: str="Multislot class 6 supported";  break;
2207                                         case 0x12: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2208                                         case 0x13: str="Unused. If received, it shall be interpreted as Multislot class 5 supported";  break;
2209                                         case 0x20: str="Multislot class 9 supported";  break;
2210                                         case 0x21: str="Multislot class 10 supported"; break;
2211                                         case 0x22: str="Unused. If received, it shall be interpreted as Multislot class 9 supported";  break;
2212                                         case 0x23: str="Unused. If received, it shall be interpreted as Multislot class 9 supported";  break;
2213                                         case 0x30: str="Multislot class 11 supported"; break;
2214                                         case 0x31: str="Unused. If received, it shall be interpreted as Multislot class 11 supported"; break;
2215                                         case 0x32: str="Unused. If received, it shall be interpreted as Multislot class 11 supported"; break;
2216                                         case 0x33: str="Unused. If received, it shall be interpreted as Multislot class 11 supported"; break;
2217                                         default:   str="This should not happen";
2218                                 }
2219
2220                                 proto_tree_add_text(tf_tree,
2221                                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2222                                         "Extended DTM EGPRS Multi Slot Class: %s (%u)",str, oct>>(32-bits_needed));
2223                                 bit_offset+=2;
2224                                 curr_bits_length -= bits_needed;
2225                                 oct <<= bits_needed;
2226                                 bits_in_oct -= bits_needed;
2227                         }
2228                 }
2229
2230                 /*
2231                  * Modulation based multislot class support
2232                  */
2233                 bits_needed = 1;
2234                 GET_DATA;
2235
2236                 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);
2237                 bit_offset++;
2238                 curr_bits_length -= bits_needed;
2239                 oct <<= bits_needed;
2240                 bits_in_oct -= bits_needed;
2241
2242                 /*
2243                  * High Multislot Capability
2244                  */
2245                 bits_needed = 1;
2246                 GET_DATA;
2247
2248                 /* analyse bits */
2249                 if ((oct>>(32-bits_needed))==0)
2250                 {
2251                         proto_tree_add_text(tf_tree,
2252                                 tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2253                                 "High Multislot Capability: Bits are not available (%u)",oct>>(32-bits_needed));
2254                         bit_offset++;
2255                         curr_bits_length -= bits_needed;
2256                         oct <<= bits_needed;
2257                         bits_in_oct -= bits_needed;
2258                 }
2259                 else
2260                 {
2261                         curr_bits_length -= bits_needed;
2262                         oct <<= bits_needed;
2263                         bits_in_oct -= bits_needed;
2264                         bit_offset++;
2265
2266                         /*
2267                          * High Multislot Capability
2268                          */
2269                         bits_needed = 2;
2270                         GET_DATA;
2271
2272                         /* analyse bits */
2273                         proto_tree_add_text(tf_tree,
2274                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2275                                             "High Multislot Capability: 0x%02x (%u)"
2276                                             " - This field effect all other multislot fields."
2277                                             " To understand the value please read TS 24.008 5.6.0"
2278                                             " Release 5 Chap 10.5.5.12 Page 406",
2279                                             oct>>(32-bits_needed),
2280                                             oct>>(32-bits_needed));
2281                         bit_offset+=2;
2282                         curr_bits_length -= bits_needed;
2283                         oct <<= bits_needed;
2284                         bits_in_oct -= bits_needed;
2285                 }
2286
2287                 /*
2288                  * GERAN Iu Mode Capability
2289                  */
2290                 bits_needed = 1;
2291                 GET_DATA;
2292
2293                 value = tvb_get_bits8(tvb, bit_offset, 1);
2294                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_geran_iu_mode_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2295                 bit_offset+=bits_needed;
2296                 curr_bits_length -= bits_needed;
2297                 oct <<= bits_needed;
2298                 bits_in_oct -= bits_needed;
2299                 if (value)
2300                 {
2301                         /* GERAN Iu Mode Capabilities struct present */
2302                         bits_needed = 4;
2303                         GET_DATA;
2304                         value = tvb_get_bits8(tvb, bit_offset, 4);
2305                         bit_offset+=bits_needed;
2306                         curr_bits_length -= bits_needed;
2307                         oct <<= bits_needed;
2308                         bits_in_oct -= bits_needed;
2309                         if (value)
2310                         {
2311                                 /*
2312                                  * FLO Iu Capability
2313                                  */
2314                                 bits_needed = 1;
2315                                 GET_DATA;
2316                                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_flo_iu_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2317                                 bit_offset+=bits_needed;
2318                                 curr_bits_length -= bits_needed;
2319                                 oct <<= bits_needed;
2320                                 bits_in_oct -= bits_needed;
2321                                 value--;
2322                                 
2323                                 /* skip spare bits */
2324                                 bit_offset+=value;
2325                                 curr_bits_length -= value;
2326                                 oct <<= value;
2327                                 bits_in_oct -= value;
2328                         }
2329                 }
2330
2331                 /*
2332                  * GMSK Multislot Power Profile
2333                  */
2334                 bits_needed = 2;
2335                 GET_DATA;
2336
2337                 /* analyse bits */
2338                 switch ( oct>>(32-bits_needed) )
2339                 {
2340                         case 0x00: str="GMSK_MULTISLOT_POWER_PROFILE 0"; break;
2341                         case 0x01: str="GMSK_MULTISLOT_POWER_PROFILE 1"; break;
2342                         case 0x02: str="GMSK_MULTISLOT_POWER_PROFILE 2"; break;
2343                         case 0x03: str="GMSK_MULTISLOT_POWER_PROFILE 3"; break;
2344                         default:   str="This should not happen";
2345                 }
2346
2347                 proto_tree_add_text(tf_tree,
2348                         tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2349                         "GMSK Multislot Power Profile: %s (%u)",str,oct>>(32-bits_needed));
2350                 bit_offset+=2;
2351                 curr_bits_length -= bits_needed;
2352                 oct <<= bits_needed;
2353                 bits_in_oct -= bits_needed;
2354
2355                 /*
2356                  * 8-PSK Multislot Power Profile
2357                  */
2358                 bits_needed = 2;
2359                 GET_DATA;
2360
2361                 /* analyse bits */
2362                 switch ( oct>>(32-bits_needed) )
2363                 {
2364                         case 0x00: str="8-PSK_MULTISLOT_POWER_PROFILE 0"; break;
2365                         case 0x01: str="8-PSK_MULTISLOT_POWER_PROFILE 1"; break;
2366                         case 0x02: str="8-PSK_MULTISLOT_POWER_PROFILE 2"; break;
2367                         case 0x03: str="8-PSK_MULTISLOT_POWER_PROFILE 3"; break;
2368                         default:   str="This should not happen";
2369                 }
2370
2371                 proto_tree_add_text(tf_tree,
2372                 tvb, curr_offset-1-add_ocetets, 1+add_ocetets,
2373                 "8-PSK Multislot Power Profile: %s (%u)",str,oct>>(32-bits_needed));
2374                 bit_offset+=2;
2375                 curr_bits_length -= bits_needed;
2376                 oct <<= bits_needed;
2377                 bits_in_oct -= bits_needed;
2378
2379                 /*
2380                  * Release 6
2381                  */
2382                  
2383                 /*
2384                  * Multiple TBF Capability
2385                  */
2386                 bits_needed = 1;
2387                 GET_DATA;
2388                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_mult_tbf_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2389                 bit_offset+=bits_needed;
2390                 curr_bits_length -= bits_needed;
2391                 oct <<= bits_needed;
2392                 bits_in_oct -= bits_needed;
2393                 
2394                 /*
2395                  * Downlink Advanced Receiver Performance
2396                  */
2397                 bits_needed = 2;
2398                 GET_DATA;
2399                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_down_adv_rec_perf, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2400                 bit_offset+=bits_needed;
2401                 curr_bits_length -= bits_needed;
2402                 oct <<= bits_needed;
2403                 bits_in_oct -= bits_needed;
2404                 
2405                 /*
2406                  * Extended RLC/MAC Control Message Segmentation Capability
2407                  */
2408                 bits_needed = 1;
2409                 GET_DATA;
2410                 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);
2411                 bit_offset+=bits_needed;
2412                 curr_bits_length -= bits_needed;
2413                 oct <<= bits_needed;
2414                 bits_in_oct -= bits_needed;
2415
2416                 /*
2417                  * DTM Enhancements Capability
2418                  */
2419                 bits_needed = 1;
2420                 GET_DATA;
2421                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_enh_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2422                 bit_offset+=bits_needed;
2423                 curr_bits_length -= bits_needed;
2424                 oct <<= bits_needed;
2425                 bits_in_oct -= bits_needed;
2426
2427                 /*
2428                  * DTM GPRS High Multi Slot Class & DTM EGPRS High Multi Slot Class
2429                  */
2430                 bits_needed = 1;
2431                 GET_DATA;
2432                 if ((oct>>(32-bits_needed))==0)
2433                 {
2434                         bit_offset+=bits_needed;
2435                         curr_bits_length -= bits_needed;
2436                         oct <<= bits_needed;
2437                         bits_in_oct -= bits_needed;
2438                 }
2439                 else
2440                 {
2441                         bit_offset+=bits_needed;
2442                         curr_bits_length -= bits_needed;
2443                         oct <<= bits_needed;
2444                         bits_in_oct -= bits_needed;
2445
2446                         /*
2447                          * DTM GPRS High Multi Slot Class
2448                          */
2449                         bits_needed = 3;
2450                         GET_DATA;
2451                         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);
2452                         bit_offset+=bits_needed;
2453                         curr_bits_length -= bits_needed;
2454                         oct <<= bits_needed;
2455                         bits_in_oct -= bits_needed;
2456
2457                         bits_needed = 1;
2458                         GET_DATA;
2459                         if ((oct>>(32-bits_needed))==0)
2460                         {
2461                                 bit_offset+=bits_needed;
2462                                 curr_bits_length -= bits_needed;
2463                                 oct <<= bits_needed;
2464                                 bits_in_oct -= bits_needed;
2465                         }
2466                         else
2467                         {
2468                                 bit_offset+=bits_needed;
2469                                 curr_bits_length -= bits_needed;
2470                                 oct <<= bits_needed;
2471                                 bits_in_oct -= bits_needed;
2472
2473                                 /*
2474                                  * DTM EGPRS High Multi Slot Class
2475                                  */
2476                                 bits_needed = 3;
2477                                 GET_DATA;
2478                                 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);
2479                                 bit_offset+=bits_needed;
2480                                 curr_bits_length -= bits_needed;
2481                                 oct <<= bits_needed;
2482                                 bits_in_oct -= bits_needed;
2483                         }
2484                 }
2485                 
2486                 /*
2487                  * PS Handover Capability
2488                  */
2489                 bits_needed = 1;
2490                 GET_DATA;
2491                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ps_ho_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2492                 bit_offset+=bits_needed;
2493                 curr_bits_length -= bits_needed;
2494                 oct <<= bits_needed;
2495                 bits_in_oct -= bits_needed;
2496                         
2497                 /*
2498                  * Release 7
2499                  */
2500  
2501                 /*
2502                  * DTM Handover Capability
2503                  */
2504                 bits_needed = 1;
2505                 GET_DATA;
2506                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dtm_ho_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2507                 bit_offset+=bits_needed;
2508                 curr_bits_length -= bits_needed;
2509                 oct <<= bits_needed;
2510                 bits_in_oct -= bits_needed;
2511
2512                 /*
2513                  * Multislot Capability Reduction for Downlink Dual Carrier & Downlink Dual Carrier for DTM Capability
2514                  */
2515                 bits_needed = 1;
2516                 GET_DATA;
2517                 if ((oct>>(32-bits_needed))==0)
2518                 {
2519                         bit_offset+=bits_needed;
2520                         curr_bits_length -= bits_needed;
2521                         oct <<= bits_needed;
2522                         bits_in_oct -= bits_needed;
2523                 }
2524                 else
2525                 {
2526                         bit_offset+=bits_needed;
2527                         curr_bits_length -= bits_needed;
2528                         oct <<= bits_needed;
2529                         bits_in_oct -= bits_needed;
2530
2531                         /*
2532                          * Multislot Capability Reduction for Downlink Dual Carrier
2533                          */
2534                         bits_needed = 3;
2535                         GET_DATA;
2536                         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);
2537                         bit_offset+=bits_needed;
2538                         curr_bits_length -= bits_needed;
2539                         oct <<= bits_needed;
2540                         bits_in_oct -= bits_needed;
2541
2542                         /*
2543                          * Downlink Dual Carrier for DTM Capability
2544                          */
2545                         bits_needed = 1;
2546                         GET_DATA;
2547                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_down_dual_carrier_dtm_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2548                         bit_offset+=bits_needed;
2549                         curr_bits_length -= bits_needed;
2550                         oct <<= bits_needed;
2551                         bits_in_oct -= bits_needed;
2552                 }
2553
2554                 /*
2555                  * Flexible Timeslot Assignment
2556                  */
2557                 bits_needed = 1;
2558                 GET_DATA;
2559                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_flex_ts_assign, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2560                 bit_offset+=bits_needed;
2561                 curr_bits_length -= bits_needed;
2562                 oct <<= bits_needed;
2563                 bits_in_oct -= bits_needed;
2564  
2565                 /*
2566                  * GAN PS Handover Capability
2567                  */
2568                 bits_needed = 1;
2569                 GET_DATA;
2570                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_gan_ps_ho_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2571                 bit_offset+=bits_needed;
2572                 curr_bits_length -= bits_needed;
2573                 oct <<= bits_needed;
2574                 bits_in_oct -= bits_needed;
2575  
2576                 /*
2577                  * RLC Non-persistent Mode
2578                  */
2579                 bits_needed = 1;
2580                 GET_DATA;
2581                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_rlc_non_pers_mode, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2582                 bit_offset+=bits_needed;
2583                 curr_bits_length -= bits_needed;
2584                 oct <<= bits_needed;
2585                 bits_in_oct -= bits_needed;
2586  
2587                 /*
2588                  * Reduced Latency Capability
2589                  */
2590                 bits_needed = 1;
2591                 GET_DATA;
2592                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_reduced_lat_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2593                 bit_offset+=bits_needed;
2594                 curr_bits_length -= bits_needed;
2595                 oct <<= bits_needed;
2596                 bits_in_oct -= bits_needed;
2597  
2598                 /*
2599                  * Uplink EGPRS2
2600                  */
2601                 bits_needed = 2;
2602                 GET_DATA;
2603                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_ul_egprs2, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2604                 bit_offset+=bits_needed;
2605                 curr_bits_length -= bits_needed;
2606                 oct <<= bits_needed;
2607                 bits_in_oct -= bits_needed;
2608  
2609                 /*
2610                  * Downlink EGPRS2
2611                  */
2612                 bits_needed = 2;
2613                 GET_DATA;
2614                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_dl_egprs2, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
2615                 bit_offset+=bits_needed;
2616                 curr_bits_length -= bits_needed;
2617                 oct <<= bits_needed;
2618                 bits_in_oct -= bits_needed;
2619  
2620                 /*
2621                  * Release 8
2622                  */
2623  
2624                 /*
2625                  * E-UTRA FDD support
2626                  */
2627                 bits_needed = 1;
2628                 GET_DATA;
2629                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_fdd_support, 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                  * E-UTRA TDD support
2637                  */
2638                 bits_needed = 1;
2639                 GET_DATA;
2640                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_tdd_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2641                 bit_offset+=bits_needed;
2642                 curr_bits_length -= bits_needed;
2643                 oct <<= bits_needed;
2644                 bits_in_oct -= bits_needed;
2645  
2646                 /*
2647                  * GERAN to E-UTRA support in GERAN packet transfer mode
2648                  */
2649                 bits_needed = 2;
2650                 GET_DATA;
2651                 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);
2652                 bit_offset+=bits_needed;
2653                 curr_bits_length -= bits_needed;
2654                 oct <<= bits_needed;
2655                 bits_in_oct -= bits_needed;
2656  
2657                 /*
2658                  * Priority-based reselection support
2659                  */
2660                 bits_needed = 1;
2661                 GET_DATA;
2662                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_prio_based_resel_support, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2663                 bit_offset+=bits_needed;
2664                 curr_bits_length -= bits_needed;
2665                 oct <<= bits_needed;
2666                 bits_in_oct -= bits_needed;
2667  
2668                 /*
2669                  * Release 9
2670                  */
2671
2672                 /*
2673                  * Enhanced Flexible Timeslot Assignment
2674                  */
2675                 bits_needed = 1;
2676                 GET_DATA;
2677                 if ((oct>>(32-bits_needed))==0)
2678                 {
2679                         bit_offset+=bits_needed;
2680                         curr_bits_length -= bits_needed;
2681                         oct <<= bits_needed;
2682                         bits_in_oct -= bits_needed;
2683                 }
2684                 else
2685                 {
2686                         bit_offset+=bits_needed;
2687                         curr_bits_length -= bits_needed;
2688                         oct <<= bits_needed;
2689                         bits_in_oct -= bits_needed;
2690
2691                         /*
2692                          * Alternative EFTA Multislot Class
2693                          */
2694                         bits_needed = 4;
2695                         GET_DATA;
2696                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_alt_efta_multi_slot_class, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2697                         bit_offset+=bits_needed;
2698                         curr_bits_length -= bits_needed;
2699                         oct <<= bits_needed;
2700                         bits_in_oct -= bits_needed;
2701  
2702                         /*
2703                          * EFTA Multislot Capability Reduction for Downlink Dual Carrier
2704                          */
2705                         bits_needed = 3;
2706                         GET_DATA;
2707                         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);
2708                         bit_offset+=bits_needed;
2709                         curr_bits_length -= bits_needed;
2710                         oct <<= bits_needed;
2711                         bits_in_oct -= bits_needed;
2712                 }
2713  
2714                 /*
2715                  * Indication of Upper Layer PDU Start Capability for RLC UM
2716                  */
2717                 bits_needed = 1;
2718                 GET_DATA;
2719                 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);
2720                 bit_offset+=bits_needed;
2721                 curr_bits_length -= bits_needed;
2722                 oct <<= bits_needed;
2723                 bits_in_oct -= bits_needed;
2724
2725                 /*
2726                  * EMST Capability
2727                  */
2728                 bits_needed = 1;
2729                 GET_DATA;
2730                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_emst_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2731                 bit_offset+=bits_needed;
2732                 curr_bits_length -= bits_needed;
2733                 oct <<= bits_needed;
2734                 bits_in_oct -= bits_needed;
2735
2736                 /*
2737                  * MTTI Capability
2738                  */
2739                 bits_needed = 1;
2740                 GET_DATA;
2741                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_mtti_cap, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2742                 bit_offset+=bits_needed;
2743                 curr_bits_length -= bits_needed;
2744                 oct <<= bits_needed;
2745                 bits_in_oct -= bits_needed;
2746
2747                 /*
2748                  * UTRA CSG Cells Reporting
2749                  */
2750                 bits_needed = 1;
2751                 GET_DATA;
2752                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_utra_csg_cell_report, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2753                 bit_offset+=bits_needed;
2754                 curr_bits_length -= bits_needed;
2755                 oct <<= bits_needed;
2756                 bits_in_oct -= bits_needed;
2757
2758                 /*
2759                  * E-UTRA CSG Cells Reporting
2760                  */
2761                 bits_needed = 1;
2762                 GET_DATA;
2763                 proto_tree_add_bits_item(tf_tree, hf_gsm_a_gm_rac_eutra_csg_cell_report, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2764                 bit_offset+=bits_needed;
2765                 curr_bits_length -= bits_needed;
2766                 oct <<= bits_needed;
2767                 bits_in_oct -= bits_needed;
2768
2769                 /*
2770                  * we are too long ... so jump over it
2771                  */
2772                 while ( curr_bits_length > 0 )
2773                 {
2774                         if ( curr_bits_length > 8 )
2775                                 bits_needed = 8;
2776                         else
2777                                 bits_needed = curr_bits_length;
2778                         GET_DATA;
2779                         curr_bits_length -= bits_needed;
2780                         oct <<= bits_needed;
2781                         bits_in_oct -= bits_needed;
2782                 }
2783
2784
2785         } while ( 1 );
2786
2787         curr_offset+= curr_len;
2788
2789         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
2790
2791         return(curr_offset - offset);
2792 }
2793
2794 /*
2795  * [9] 10.5.5.14
2796  */
2797 static const range_string gmm_cause_vals[] = {
2798         { 0x00, 0x01, "Protocol error, unspecified(Not def in v8.6.0)"},
2799         { 0x02, 0x02, "IMSI unknown in HLR"},
2800         { 0x03, 0x03, "Illegal MS"},
2801         { 0x04, 0x04, "IMSI unknown in VLR"}, /* Annex G.1 */
2802         { 0x05, 0x05, "IMEI not accepted"}, /* Annex G.1 */
2803         { 0x06, 0x06, "Illegal ME"},
2804         { 0x07, 0x07, "GPRS services not allowed"},
2805         { 0x08, 0x08, "GPRS services and non-GPRS services not allowed"},
2806         { 0x09, 0x09, "MS identity cannot be derived by the network"},
2807         { 0x0a, 0x0a, "Implicitly detached"},
2808         { 0x0b, 0x0b, "PLMN not allowed"},
2809         { 0x0c, 0x0c, "Location Area not allowed"},
2810         { 0x0d, 0x0d, "Roaming not allowed in this location area"},
2811         { 0x0e, 0x0e, "GPRS services not allowed in this PLMN"},
2812         { 0x0f, 0x0f, "No Suitable Cells In Location Area"},
2813         { 0x10, 0x10, "MSC temporarily not reachable"},
2814         { 0x11, 0x11, "Network failure"},
2815         { 0x12, 0x13, "Protocol error, unspecified(Not def in v8.6.0)"},
2816         { 0x14, 0x14, "MAC failure"},
2817         { 0x15, 0x15, "Synch failure"},
2818         { 0x16, 0x16, "Congestion"},
2819         { 0x17, 0x17, "GSM authentication unacceptable"},
2820         { 0x18, 0x18, "Protocol error, unspecified(Not def in v8.6.0)"},
2821         { 0x19, 0x19, "Not authorized for this CSG"},
2822         { 0x20, 0x20, "Service option not supported"},                                          /* Annex G.4 */
2823         { 0x21, 0x21, "Requested service option not subscribed"},                       /* Annex G.4 */
2824         { 0x22, 0x22, "Service option temporarily out of order"},                       /* Annex G.4 */
2825
2826         { 0x23, 0x25, "Protocol error, unspecified(Not def in v8.6.0)"},
2827
2828         { 0x26, 0x26, "Call cannot be identified(non-GPRS services only)"},     /* Annex G.4 */
2829         { 0x27, 0x27, "Protocol error, unspecified(Not def in v8.6.0)"},
2830         { 0x28, 0x28, "No PDP context activated"},
2831         { 0x29, 0x2f, "Protocol error, unspecified(Not def in v8.6.0)"},
2832         { 0x30, 0x3f, "Retry upon entry into a new cell"},
2833
2834         { 0x40, 0x5e, "Protocol error, unspecified(Not def in v8.6.0)"},
2835
2836         { 0x5f, 0x5f, "Semantically incorrect message"},
2837         { 0x60, 0x60, "Invalid mandatory information"},
2838         { 0x61, 0x61, "Message type non-existent or not implemented"},
2839         { 0x62, 0x62, "Message type not compatible with the protocol state"},
2840         { 0x63, 0x63, "Information element non-existent or notimplemented"},
2841         { 0x64, 0x64, "Conditional IE error"},
2842         { 0x65, 0x65, "Message not compatible with the protocol state"},
2843
2844         { 0x66, 0x6e, "Protocol error, unspecified(Not def in v8.6.0)"},
2845
2846         { 0x6f, 0x6f, "Protocol error, unspecified"},
2847         { 0x70, 0xff, "Protocol error, unspecified(Not def in v8.6.0)"},
2848         { 0, 0, NULL }
2849 };
2850 /* NOTE 1 TS 124 008 V8.6.0 (2009-07)
2851         "Any other value received by the mobile station shall be treated as 0110 1111, "Protocol
2852         error, unspecified". Any other value received by the network shall be treated as
2853         0110 1111, "Protocol error, unspecified".
2854  */
2855
2856 /* NOTE: The listed reject cause values are defined in annex G. */
2857
2858 static guint16
2859 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_)
2860 {
2861         guint32       curr_offset;
2862
2863         curr_offset = offset;
2864
2865         proto_tree_add_item(tree, hf_gsm_a_gm_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2866
2867         curr_offset++;
2868
2869         /* no length check possible */
2870
2871         return(curr_offset - offset);
2872 }
2873
2874 /*
2875  * [7] 10.5.5.15 Routing area identification
2876  */
2877 guint16
2878 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_)
2879 {
2880         proto_tree   *subtree;
2881         proto_item   *item;
2882         guint32       mcc;
2883         guint32       mnc;
2884         guint32       lac;
2885         guint32       rac;
2886         guint32       curr_offset;
2887
2888         curr_offset = offset;
2889
2890         mcc = (tvb_get_guint8(tvb, curr_offset) & 0x0f) <<8;
2891         mcc |= (tvb_get_guint8(tvb, curr_offset) & 0xf0);
2892         mcc |= (tvb_get_guint8(tvb, curr_offset+1) & 0x0f);
2893         mnc = (tvb_get_guint8(tvb, curr_offset+2) & 0x0f) <<8;
2894         mnc |= (tvb_get_guint8(tvb, curr_offset+2) & 0xf0);
2895         mnc |= (tvb_get_guint8(tvb, curr_offset+1) & 0xf0) >>4;
2896         if ((mnc&0x000f) == 0x000f)
2897                  mnc = mnc>>4;
2898
2899         lac = tvb_get_ntohs(tvb, curr_offset+3);
2900         rac = tvb_get_guint8(tvb, curr_offset+5);
2901
2902         item = proto_tree_add_text(tree,
2903                 tvb, curr_offset, 6,
2904                 "Routing area identification: %x-%x-%u-%u",
2905                 mcc,mnc,lac,rac);
2906
2907         subtree = proto_item_add_subtree(item, ett_gmm_rai);
2908         dissect_e212_mcc_mnc(tvb, pinfo, subtree, offset, TRUE);
2909
2910         proto_tree_add_item(subtree, hf_gsm_a_lac, tvb, curr_offset+3, 2, ENC_BIG_ENDIAN);
2911         proto_tree_add_item(subtree, hf_gsm_a_gm_rac, tvb, curr_offset+5, 1, ENC_BIG_ENDIAN);
2912
2913         curr_offset+=6;
2914     if (add_string)
2915     {
2916         if (add_string[0] == '\0')
2917         {
2918             g_snprintf(add_string, string_len, " - RAI: %x-%x-%u-%u", mcc,mnc,lac,rac);
2919         }
2920     }
2921
2922
2923         /* no length check possible */
2924
2925         return(curr_offset - offset);
2926 }
2927
2928 /*
2929  * [7] 10.5.5.15a Routing area identification 2
2930  */
2931 static guint16
2932 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_)
2933 {
2934         /* The routing area identification 2 value is coded as octet 2 to 7 of the Routing area identification information element. */
2935         return de_gmm_rai(tvb, tree, pinfo, offset, len, add_string, string_len);
2936 }
2937
2938 /*
2939  * [7] 10.5.5.17
2940  */
2941 static guint16
2942 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_)
2943 {
2944         guint8        oct;
2945         guint32       curr_offset;
2946         const gchar  *str;
2947
2948         curr_offset = offset;
2949
2950         oct = tvb_get_guint8(tvb, curr_offset);
2951
2952         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
2953         oct >>= 4;
2954
2955         switch(oct&7)
2956         {
2957                 case 0:  str="RA updated";              break;
2958                 case 1:  str="combined RA/LA updated";  break;
2959                 default: str="reserved";
2960         }
2961
2962         proto_tree_add_text(tree,
2963                 tvb, curr_offset, 1,
2964                 "Update Result: %s (%u)",
2965                 str,
2966                 oct&7);
2967
2968         curr_offset++;
2969
2970         /* no length check possible */
2971
2972         return(curr_offset - offset);
2973 }
2974
2975 /*
2976  * [9] 10.5.5.18 Update Type
2977  */
2978 static const value_string gsm_a_gm_update_type_vals[] = {
2979         { 0x00, "RA updating" },
2980         { 0x01, "combined RA/LA updating" },
2981         { 0x02, "combined RA/LA updating with IMSI attach" },
2982         { 0x03, "Periodic updating" },
2983         { 0, NULL }
2984 };
2985
2986 static guint16
2987 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_)
2988 {
2989         proto_item   *tf = NULL;
2990         proto_tree   *tf_tree = NULL;
2991
2992         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ciph_key_seq_num, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
2993
2994         tf = proto_tree_add_text(tree,
2995                 tvb, offset, 1,
2996                 "Update Type");
2997
2998         tf_tree = proto_item_add_subtree(tf, ett_gmm_update_type );
2999
3000         proto_tree_add_item(tf_tree, hf_gsm_a_gm_for, tvb, offset, 1, ENC_BIG_ENDIAN);
3001         proto_tree_add_item(tf_tree, hf_gsm_a_gm_update_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3002
3003         /* no length check possible */
3004         return(1);
3005 }
3006
3007 /*
3008  * [9] 10.5.5.19 A&C reference number (lower nibble)
3009  */
3010 static guint16
3011 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_)
3012 {
3013         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE LOWER NIBBLE */
3014         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ac_ref_nr, tvb, (offset << 3) + 4, 4, ENC_BIG_ENDIAN);
3015
3016         /* no length check possible */
3017         return(1);
3018 }
3019
3020 /*
3021  * [9] 10.5.5.19 A&C reference number (higher nibble)
3022  */
3023 static guint16
3024 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_)
3025 {
3026         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
3027         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ac_ref_nr, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
3028
3029         /* no length check possible */
3030         return(1);
3031 }
3032
3033 /*
3034  * [9] 10.5.5.20 Service type
3035  */
3036 static const value_string gsm_a_gm_serv_type_vals[] = {
3037         { 0x00, "Signalling" },
3038         { 0x01, "Data" },
3039         { 0x02, "Paging response" },
3040         { 0x03, "MBMS Multicast Service Reception" },
3041         { 0x04, "MBMS Broadcast Service Reception" },
3042         { 0, NULL }
3043 };
3044
3045 static guint16
3046 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_)
3047 {
3048         guint32 bit_offset;
3049
3050         bit_offset = offset << 3;
3051         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3052         bit_offset += 1;
3053         proto_tree_add_bits_item(tree, hf_gsm_a_gm_serv_type, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3054         bit_offset += 3;
3055         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3056         bit_offset += 1;
3057         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ciph_key_seq_num, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3058
3059         /* no length check possible */
3060         return(1);
3061 }
3062
3063 /*
3064  * [9] 10.5.5.21 Cell Notification
3065  * No data
3066  */
3067
3068 /*
3069  * [9] 10.5.5.22 PS LCS Capability
3070  */
3071 static const true_false_string gsm_a_gm_apc_vals = {
3072         "Additional Positioning Capabilities which can be retrieved by RRLP are supported",
3073         "Additional Positioning Capabilities which can be retrieved by RRLP are not supported"
3074 };
3075
3076 static const true_false_string gsm_a_gm_otd_a_vals = {
3077         "MS assisted E-OTD supported",
3078         "MS assisted E-OTD not supported"
3079 };
3080
3081 static const true_false_string gsm_a_gm_otd_b_vals = {
3082         "MS based E-OTD supported",
3083         "MS based E-OTD not supported"
3084 };
3085
3086 static const true_false_string gsm_a_gm_gps_a_vals = {
3087         "MS assisted GPS supported",
3088         "MS assisted GPS not supported"
3089 };
3090
3091 static const true_false_string gsm_a_gm_gps_b_vals = {
3092         "MS based GPS supported",
3093         "MS based GPS not supported"
3094 };
3095
3096 static const true_false_string gsm_a_gm_gps_c_vals = {
3097         "Conventional GPS supported",
3098         "Conventional GPS not supported"
3099 };
3100
3101 static guint16
3102 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_)
3103 {
3104         guint32 curr_offset;
3105
3106         curr_offset = offset;
3107         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, curr_offset << 3, 2, ENC_BIG_ENDIAN);
3108         proto_tree_add_item(tree, hf_gsm_a_gm_apc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3109         proto_tree_add_item(tree, hf_gsm_a_gm_otd_a, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3110         proto_tree_add_item(tree, hf_gsm_a_gm_otd_b, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3111         proto_tree_add_item(tree, hf_gsm_a_gm_gps_a, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3112         proto_tree_add_item(tree, hf_gsm_a_gm_gps_b, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3113         proto_tree_add_item(tree, hf_gsm_a_gm_gps_c, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3114
3115         curr_offset++;
3116
3117         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
3118
3119         return(curr_offset - offset);
3120 }
3121
3122 /*
3123  * [7] 10.5.5.23
3124  */
3125 static guint16
3126 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_)
3127 {
3128         guint8  oct;
3129         guint32 curr_offset;
3130         const gchar     *str;
3131
3132         curr_offset = offset;
3133
3134         oct = tvb_get_guint8(tvb, curr_offset);
3135
3136         switch(oct&8)
3137         {
3138                 case 8: str="LCS-MOLR via PS domain not supported"; break;
3139                 default: str="LCS-MOLR via PS domain supported";
3140         }
3141
3142         proto_tree_add_text(tree,
3143                 tvb, curr_offset, 1,
3144                 "Network Feature Support: %s (%u)",
3145                 str,
3146                 (oct>>3)&1);
3147
3148         curr_offset++;
3149
3150         /* no length check possible */
3151
3152         return(curr_offset - offset);
3153 }
3154
3155 /* [7] 10.5.5.24 Inter RAT information container */
3156 static guint16
3157 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_)
3158 {
3159         guint32 curr_offset;
3160         tvbuff_t *rrc_irat_ho_info_tvb;
3161
3162         curr_offset = offset;
3163
3164 /* The value part of the Inter RAT information container information element is the INTER RAT HANDOVER INFO as
3165 defined in 3GPP TS 25.331 [23c]. If this field includes padding bits, they are defined in 3GPP TS 25.331 [23c].*/
3166         rrc_irat_ho_info_tvb = tvb_new_subset(tvb, curr_offset, len, len);
3167         if (rrc_irat_ho_info_handle)
3168                 call_dissector(rrc_irat_ho_info_handle, rrc_irat_ho_info_tvb,pinfo , tree);
3169         else
3170                 proto_tree_add_text(tree, tvb, curr_offset, len,"INTER RAT HANDOVER INFO - Not decoded");
3171
3172         return len;
3173
3174 }
3175
3176 /* [7] 10.5.5.25 Requested MS information */
3177 static const true_false_string gsm_a_gm_req_ms_info_irat_vals = {
3178         "Inter RAT information container IE requested",
3179         "Inter RAT information container IE not requested"
3180 };
3181 static const true_false_string gsm_a_gm_req_ms_info_irat2_vals = {
3182         "E-UTRAN inter RAT information container IE requested",
3183         "E-UTRAN inter RAT information container IE not requested"
3184 };
3185
3186 static guint16
3187 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_)
3188 {
3189         guint32 curr_offset;
3190         guint32 bit_offset;
3191
3192         curr_offset = offset;
3193         bit_offset = (curr_offset<<3)+4;
3194
3195         proto_tree_add_bits_item(tree, hf_gsm_a_gm_req_ms_info_irat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3196         bit_offset++;
3197         proto_tree_add_bits_item(tree, hf_gsm_a_gm_req_ms_info_irat2, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3198         bit_offset++;
3199         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3200         bit_offset+=2;
3201         curr_offset++;
3202
3203         return len;
3204 }
3205
3206 /* [7] 10.5.5.26 UE network capability
3207  * See subclause 9.9.3.x in 3GPP TS 24.301 [120].
3208  */
3209
3210 /* [7] 10.5.5.27 E-UTRAN inter RAT information container */
3211 static guint16
3212 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_)
3213 {
3214         guint32 curr_offset;
3215         tvbuff_t *lte_rrc_ue_eutra_cap_tvb;
3216
3217         curr_offset = offset;
3218
3219 /* The value part of the E-UTRAN inter RAT information container information element
3220    is formatted and coded according to the UE-EUTRA-Capability IE defined in 3GPP TS 36.331 [129]*/
3221         lte_rrc_ue_eutra_cap_tvb = tvb_new_subset(tvb, curr_offset, len, len);
3222         if (lte_rrc_ue_eutra_cap_handle)
3223                 call_dissector(lte_rrc_ue_eutra_cap_handle, lte_rrc_ue_eutra_cap_tvb, pinfo, tree);
3224         else
3225                 proto_tree_add_text(tree, tvb, curr_offset, len,"E-UTRAN Inter RAT information container - Not decoded");
3226
3227         return len;
3228 }
3229
3230 /* [7] 10.5.5.28 Voice domain preference and UE's usage setting */
3231 static const true_false_string gsm_a_gm_ue_usage_setting_vals = {
3232         "Data centric",
3233         "Voice centric"
3234 };
3235 static const value_string gsm_a_gm_voice_domain_pref_for_eutran_vals[] = {
3236         {0x0,   "CS Voice only"},
3237         {0x1,   "IMS PS Voice only"},
3238         {0x2,   "CS voice preferred, IMS PS Voice as secondary"},
3239         {0x3,   "IMS PS voice preferred, CS Voice as secondary"},
3240         {  0,   NULL }
3241 };
3242
3243 guint16
3244 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_)
3245 {
3246         guint32 curr_offset;
3247         guint32 bit_offset;
3248
3249         curr_offset = offset;
3250         bit_offset = curr_offset<<3;
3251
3252         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
3253         bit_offset+=5;
3254         proto_tree_add_bits_item(tree, hf_gsm_a_gm_ue_usage_setting, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3255         bit_offset++;
3256         proto_tree_add_bits_item(tree, hf_gsm_a_gm_voice_domain_pref_for_eutran, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
3257         bit_offset+=2;
3258         curr_offset++;
3259
3260         return len;
3261 }
3262
3263 /*
3264  * [7] 10.5.7.1
3265  */
3266 static guint16
3267 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_)
3268 {
3269         guint8  oct;
3270         guint16 pdp_nr;
3271         guint32 curr_offset;
3272         proto_item  *tf = NULL;
3273         proto_tree  *tf_tree = NULL;
3274
3275         curr_offset = offset;
3276
3277         oct = tvb_get_guint8(tvb, curr_offset);
3278
3279         tf = proto_tree_add_text(tree,
3280                 tvb, curr_offset, 1,
3281                 "PDP Context Status");
3282
3283         tf_tree = proto_item_add_subtree(tf, ett_gmm_context_stat );
3284
3285         oct = tvb_get_guint8(tvb, curr_offset);
3286
3287         for ( pdp_nr=0;pdp_nr<16; pdp_nr++ )
3288         {
3289                 if ( pdp_nr == 8 )
3290                 {
3291                         curr_offset++;
3292                         oct = tvb_get_guint8(tvb, curr_offset);
3293                 }
3294                 proto_tree_add_text(tf_tree,
3295                         tvb, curr_offset, 1,
3296                         "NSAPI %d: %s (%u)",pdp_nr,
3297                         pdp_str[oct&1],
3298                         oct&1);
3299                 oct>>=1;
3300         }
3301
3302         curr_offset++;
3303
3304         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
3305
3306         return(curr_offset - offset);
3307 }
3308
3309 /*
3310  * [7] 10.5.7.2
3311  */
3312 static guint16
3313 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_)
3314 {
3315         guint8  oct;
3316         guint32 curr_offset;
3317         const gchar     *str;
3318
3319         curr_offset = offset;
3320
3321         oct = tvb_get_guint8(tvb, curr_offset);
3322
3323         switch ( oct&7 )
3324         {
3325                 case 1: str="priority level 1 (highest)"; break;
3326                 case 2: str="priority level 2"; break;
3327                 case 3: str="priority level 3"; break;
3328                 case 4: str="priority level 4 (lowest)"; break;
3329                 default: str="priority level 4 (lowest)";
3330         }
3331
3332         proto_tree_add_text(tree,
3333                 tvb, curr_offset, 1,
3334                 "Radio Priority (PDP or SMS): %s (%u)",
3335                 str,
3336                 oct&7);
3337
3338         curr_offset++;
3339
3340         return(curr_offset - offset);
3341 }
3342
3343 /*
3344  * [9] 10.5.7.3 GPRS Timer
3345  */
3346 static const value_string gsm_a_gm_gprs_timer_unit_vals[] = {
3347         { 0x00, "value is incremented in multiples of 2 seconds" },
3348         { 0x01, "value is incremented in multiples of 1 minute" },
3349         { 0x02, "value is incremented in multiples of decihours" },
3350         { 0x07, "value indicates that the timer is deactivated" },
3351         { 0, NULL }
3352 };
3353
3354 static guint16
3355 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_)
3356 {
3357         guint8  oct;
3358         guint16 val;
3359         const gchar     *str;
3360         proto_tree      *subtree;
3361         proto_item      *item;
3362
3363         oct = tvb_get_guint8(tvb, offset);
3364         val = oct&0x1f;
3365
3366         switch(oct>>5)
3367         {
3368                 case 0: str="sec"; val*=2; break;
3369                 case 1: str="min"; break;
3370                 case 2: str="min"; val*=6; break;
3371                 case 7:
3372                         proto_tree_add_text(tree,
3373                                 tvb, offset, 1,
3374                                 "GPRS Timer: timer is deactivated");
3375
3376                 default: str="min";
3377         }
3378
3379         item = proto_tree_add_text(tree,
3380                 tvb, offset, 1,
3381                 "GPRS Timer: %u %s",
3382                 val,
3383                 str);
3384
3385         subtree = proto_item_add_subtree(item, ett_gmm_gprs_timer);
3386         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
3387         proto_tree_add_item(subtree, hf_gsm_a_gm_gprs_timer_value, tvb, offset, 1, ENC_BIG_ENDIAN);
3388
3389         /* no length check possible */
3390         return(1);
3391 }
3392
3393 /*
3394  * [7] 10.5.7.4
3395  */
3396 static guint16
3397 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_)
3398 {
3399         guint8  oct;
3400         guint16 val;
3401         guint32 curr_offset;
3402         const gchar     *str;
3403
3404         curr_offset = offset;
3405
3406         oct = tvb_get_guint8(tvb, curr_offset);
3407
3408         val = oct&0x1f;
3409
3410         switch(oct>>5)
3411         {
3412                 case 0: str="sec"; val*=2; break;
3413                 case 1: str="min"; break;
3414                 case 2: str="min"; val*=6; break;
3415                 case 7:
3416                         proto_tree_add_text(tree,
3417                         tvb, curr_offset, 1,
3418                         "GPRS Timer: timer is deactivated");
3419
3420                 default: str="min";
3421         }
3422
3423         proto_tree_add_text(tree,
3424                 tvb, curr_offset, 1,
3425                 "GPRS Timer: %u %s %s (%u)",
3426                 val,
3427                 str, add_string ? add_string : "", oct);
3428
3429         curr_offset++;
3430
3431         return(curr_offset - offset);
3432 }
3433
3434 /*
3435  * [7] 10.5.7.5
3436  */
3437 static guint16
3438 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_)
3439 {
3440         guint8  oct;
3441         guint32 curr_offset;
3442         const gchar     *str;
3443
3444         curr_offset = offset;
3445
3446         oct = tvb_get_guint8(tvb, curr_offset);
3447
3448         /* IMPORTANT - IT'S ASSUMED THAT THE INFORMATION IS IN THE HIGHER NIBBLE */
3449         oct >>= 4;
3450
3451         switch ( oct&7 )
3452         {
3453                 case 1: str="priority level 1 (highest)"; break;
3454                 case 2: str="priority level 2"; break;
3455                 case 3: str="priority level 3"; break;
3456                 case 4: str="priority level 4 (lowest)"; break;
3457                 default: str="priority level 4 (lowest)";
3458         }
3459
3460         proto_tree_add_text(tree,
3461                 tvb, curr_offset, 1,
3462                 "Radio Priority (TOM8): %s (%u)",
3463                 str,
3464                 oct&7);
3465
3466         curr_offset++;
3467
3468         return(curr_offset - offset);
3469 }
3470
3471 /*
3472  * [8] 10.5.7.6 MBMS context status
3473  */
3474 static guint16
3475 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_)
3476 {
3477         guint32 curr_offset;
3478         guint   i;
3479         guint8  oct, j;
3480         proto_item  *tf = NULL;
3481         proto_tree  *tf_tree = NULL;
3482
3483         curr_offset = offset;
3484
3485         oct = tvb_get_guint8(tvb, curr_offset);
3486
3487         tf = proto_tree_add_text(tree,
3488                 tvb, curr_offset, 1,
3489                 "MBMS Context Status");
3490
3491         tf_tree = proto_item_add_subtree(tf, ett_gmm_context_stat );
3492
3493         for (i=0; i<len; i++)
3494         {
3495                 oct = tvb_get_guint8(tvb, curr_offset);
3496
3497                 for (j=0; j<8; j++)
3498                 {
3499                         proto_tree_add_text(tf_tree,
3500                                 tvb, curr_offset, 1,
3501                                 "NSAPI %d: %s (%u)",128+i*8+j,
3502                                 pdp_str[oct&1],
3503                                 oct&1);
3504                         oct>>=1;
3505                 }
3506                 curr_offset++;
3507         }
3508
3509         return(len);
3510 }
3511
3512 /*
3513  * [8] 10.5.7.7 Uplink data status
3514  */
3515 static const true_false_string gsm_a_gm_nsapi_ul_stat_vals = {
3516         "uplink data are pending for the preserved PDP context",
3517         "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"
3518 };
3519
3520 static guint16
3521 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_)
3522 {
3523         guint32 curr_offset;
3524         guint32 bit_offset;
3525
3526         curr_offset = offset;
3527         bit_offset = curr_offset<<3;
3528
3529         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_7_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3530         bit_offset++;
3531         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_6_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3532         bit_offset++;
3533         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_5_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3534         bit_offset++;
3535         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
3536         bit_offset+=5;
3537         curr_offset++;
3538         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_15_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3539         bit_offset++;
3540         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_14_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3541         bit_offset++;
3542         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_13_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3543         bit_offset++;
3544         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_12_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3545         bit_offset++;
3546         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_11_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3547         bit_offset++;
3548         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_10_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3549         bit_offset++;
3550         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_9_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3551         bit_offset++;
3552         proto_tree_add_bits_item(tree, hf_gsm_a_gm_nsapi_8_ul_stat, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3553         bit_offset++;
3554         curr_offset++;
3555
3556         return(len);
3557 }
3558
3559 /*
3560  * [7] 10.5.6.1
3561  */
3562 #define MAX_APN_LENGTH          100
3563
3564 guint16
3565 de_sm_apn(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len _U_)
3566 {
3567         guint32 curr_offset;
3568         guint   curr_len;
3569         guint8    str[MAX_APN_LENGTH+1];
3570
3571         curr_offset = offset;
3572
3573         /* init buffer and copy it */
3574         memset ( str , 0 , MAX_APN_LENGTH );
3575         tvb_memcpy(tvb, str, offset, len<MAX_APN_LENGTH?len:MAX_APN_LENGTH);
3576
3577         curr_len = 0;
3578         while (( curr_len < len ) && ( curr_len < MAX_APN_LENGTH ))
3579         {
3580                 guint step = str[curr_len];
3581                 str[curr_len]='.';
3582                 curr_len += step+1;
3583         }
3584
3585         proto_tree_add_text(tree,
3586                 tvb, curr_offset, len,
3587                 "APN: %s %s", str+1 , add_string ? add_string : "");
3588
3589         curr_offset+= len;
3590
3591         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
3592
3593         return(curr_offset - offset);
3594 }
3595
3596 /*
3597  * [7] 10.5.6.2
3598  */
3599 static guint16
3600 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_)
3601 {
3602         guint8  oct;
3603         guint32 curr_offset;
3604
3605         curr_offset = offset;
3606
3607         oct = tvb_get_guint8(tvb, curr_offset);
3608
3609         proto_tree_add_text(tree,
3610                 tvb, curr_offset, 1,
3611                 "NSAPI: 0x%02x (%u) %s",
3612                 oct&0x0f, oct&0x0f,add_string ? add_string : "");
3613
3614         curr_offset++;
3615
3616         return(curr_offset - offset);
3617 }
3618
3619 /*
3620  * [7] 10.5.6.3 Protocol configuration options
3621  */
3622 static const value_string gsm_a_sm_pco_ms2net_prot_vals[] = {
3623         { 0x01, "P-CSCF IPv6 Address Request" },
3624         { 0x02, "IM CN Subsystem Signaling Flag" },
3625         { 0x03, "DNS Server IPv6 Address Request" },
3626         { 0x04, "Not Supported" },
3627         { 0x05, "MS Support of Network Requested Bearer Control indicator" },
3628         { 0x06, "Reserved" },
3629         { 0x07, "DSMIPv6 Home Agent Address Request" },
3630         { 0x08, "DSMIPv6 Home Network Prefix Request" },
3631         { 0x09, "DSMIPv6 IPv4 Home Agent Address Request" },
3632         { 0x0a, "IP address allocation via NAS signalling" },
3633         { 0x0b, "IPv4 address allocation via DHCPv4" },
3634         { 0x0c, "P-CSCF IPv4 Address Request" },
3635         { 0x0d, "DNS Server IPv4 Address Request" },
3636         { 0x0e, "MSISDN Request" },
3637         { 0, NULL }
3638 };
3639 static const value_string gsm_a_sm_pco_net2ms_prot_vals[] = {
3640         { 0x01, "P-CSCF IPv6 Address" },
3641         { 0x02, "IM CN Subsystem Signaling Flag" },
3642         { 0x03, "DNS Server IPv6 Address" },
3643         { 0x04, "Policy Control rejection code" },
3644         { 0x05, "Selected Bearer Control Mode" },
3645         { 0x06, "Reserved" },
3646         { 0x07, "DSMIPv6 Home Agent Address" },
3647         { 0x08, "DSMIPv6 Home Network Prefix" },
3648         { 0x09, "DSMIPv6 IPv4 Home Agent Address" },
3649         { 0x0a, "Reserved" },
3650         { 0x0b, "Reserved" },
3651         { 0x0c, "P-CSCF IPv4 Address" },
3652         { 0x0d, "DNS Server IPv4 Address" },
3653         { 0x0e, "MSISDN" },
3654         { 0, NULL }
3655 };
3656
3657 static const value_string gsm_a_gm_link_dir_vals[] = {
3658         { -1, "Unknown" },
3659         { 0x0, "MS to network" },
3660         { 0x1, "Network to MS" },
3661         { 0, NULL }
3662 };
3663
3664 guint16
3665 de_sm_pco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
3666 {
3667         proto_item   *generated_item = NULL;
3668         guint32 curr_offset;
3669         guint   curr_len;
3670         guchar  oct;
3671         struct e_in6_addr ipv6_addr;
3672         int     link_dir;
3673         guint32 ipv4_addr;
3674
3675         curr_len = len;
3676         curr_offset = offset;
3677
3678         oct = tvb_get_guint8(tvb, curr_offset);
3679
3680         link_dir = pinfo->link_dir;
3681         generated_item =proto_tree_add_int(tree, hf_gsm_a_gm_link_dir, tvb, curr_offset, 0, link_dir);
3682         PROTO_ITEM_SET_GENERATED(generated_item);
3683
3684
3685         /* 1 ext 0 0 0 0 Spare  Configuration protocol */
3686         proto_tree_add_item(tree, hf_gsm_a_gm_sm_ext, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3687         /* Configuration protocol (octet 3)
3688          * Bits
3689          * 3 2 1
3690          * 0 0 0 PPP for use with IP PDP type or IP PDN type (see 3GPP TS 24.301 [120])
3691          *
3692          * All other values are interpreted as PPP in this version of the protocol.
3693          * (3GPP TS 24.008 version 9.4.0 Release 9)
3694          */
3695         proto_tree_add_text(tree,tvb, curr_offset, 1, "Configuration Protocol: PPP (%u)",oct&0x07);
3696         curr_len--;
3697         curr_offset++;
3698
3699         while ( curr_len > 0 )
3700         {
3701                 guchar e_len;
3702                 guint16 prot;
3703                 tvbuff_t *l3_tvb;
3704                 dissector_handle_t handle = NULL;
3705
3706                 /* Protocol ID 1                    octet 4
3707                  *                                  octet 5
3708                  * Length of protocol ID 1 contents octet 6
3709                  * Protocol ID 1 contents           octet 7
3710                  */
3711
3712                 prot = tvb_get_ntohs(tvb,curr_offset);
3713                 proto_tree_add_uint_format(tree, hf_gsm_a_gm_pco_pid, tvb, curr_offset, 2, (guint32)prot,
3714                                 "Protocol or Container ID: %s (%u)",
3715                                 link_dir ?
3716                                         val_to_str_const((guint32)prot, gsm_a_sm_pco_net2ms_prot_vals, val_to_str_ext_const(prot, &ppp_vals_ext, "Unknown")) :
3717                                         val_to_str_const((guint32)prot, gsm_a_sm_pco_ms2net_prot_vals, val_to_str_ext_const(prot, &ppp_vals_ext, "Unknown")),
3718                                 (guint32)prot);
3719
3720                 curr_len-=2;
3721                 curr_offset+=2;
3722                 e_len = tvb_get_guint8(tvb, curr_offset);
3723                 proto_tree_add_text(tree,tvb, curr_offset, 1, "Length: 0x%02x (%u)", e_len , e_len);
3724                 curr_len-=1;
3725                 curr_offset+=1;
3726
3727                 switch ( prot )
3728                 {
3729                         case 0x0001:
3730                         case 0x0003:
3731                         case 0x0007:
3732                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
3733                                         tvb_get_ipv6(tvb, curr_offset, &ipv6_addr);
3734                                         proto_tree_add_text(tree, tvb, curr_offset, 16, "IPv6: %s", ip6_to_str(&ipv6_addr));
3735                                 }
3736                                 break;
3737                         case 0x0002:
3738                         case 0x0006:
3739                         case 0x000A:
3740                         case 0x000B:
3741                                 break;
3742                         case 0x0004:
3743                                 if (link_dir == P2P_DIR_DL) {
3744                                         oct = tvb_get_guint8(tvb, curr_offset);
3745                                         proto_tree_add_text(tree,tvb, curr_offset, 1, "Reject Code: 0x%02x (%u)", e_len , e_len);
3746                                 }
3747                                 break;
3748                         case 0x0005:
3749                                 if ((link_dir == P2P_DIR_DL) && (e_len == 1)) {
3750                                         oct = tvb_get_guint8(tvb, curr_offset);
3751                                         proto_tree_add_text(tree, tvb, curr_offset, 1, "%s", (oct == 1) ? "MS only" :
3752                                                                                 ((oct == 2) ? "MS/NW" : "Unknown"));
3753                                 }
3754                                 break;
3755                         case 0x0008:
3756                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
3757                                         tvb_get_ipv6(tvb, curr_offset, &ipv6_addr);
3758                                         proto_tree_add_text(tree, tvb, curr_offset, 16, "IPv6: %s", ip6_to_str(&ipv6_addr));
3759                                         oct = tvb_get_guint8(tvb, curr_offset+16);
3760                                         proto_tree_add_text(tree, tvb, curr_offset+16, 1, "Prefix length: %u", oct);
3761                                 }
3762                                 break;
3763                         case 0x0009:
3764                         case 0x000C:
3765                         case 0x000D:
3766                                 if ((link_dir == P2P_DIR_DL) && (e_len > 0)) {
3767                                         ipv4_addr = tvb_get_ipv4(tvb, curr_offset);
3768                                         proto_tree_add_text(tree, tvb, curr_offset, 4,  "IPv4: %s",
3769                                                                                 ip_to_str((guint8 *)&ipv4_addr));
3770                                 }
3771                                 break;
3772                         default:
3773                         {
3774                                 handle = dissector_get_uint_handle ( gprs_sm_pco_subdissector_table , prot );
3775                                 if ( handle != NULL )
3776                                 {
3777                                         /*
3778                                          * dissect the embedded message
3779                                          */
3780                                         l3_tvb = tvb_new_subset(tvb, curr_offset, e_len, e_len);
3781                                         /* In this case we do not want the columns updated */
3782                                         col_set_writable(pinfo->cinfo, FALSE);
3783                                         call_dissector(handle, l3_tvb , pinfo  , tree );
3784                                         col_set_writable(pinfo->cinfo, TRUE);
3785                                 }
3786                                 else
3787                                 {
3788                                         /*
3789                                         * dissect the embedded DATA message
3790                                         */
3791                                         l3_tvb = tvb_new_subset(tvb, curr_offset, e_len, e_len);
3792                                         call_dissector(data_handle, l3_tvb, pinfo , tree);
3793                                 }
3794                         }
3795                 }
3796
3797                 curr_len-= e_len;
3798                 curr_offset+= e_len;
3799         }
3800         curr_offset+= curr_len;
3801
3802         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
3803
3804         return(curr_offset - offset);
3805 }
3806
3807 /*
3808  * [9] 10.5.6.4 Packet data protocol address
3809  */
3810 static const value_string gsm_a_sm_pdp_type_org_vals[] = {
3811         { 0x00, "ETSI allocated address" },
3812         { 0x01, "IETF allocated address" },
3813         { 0x0f, "Empty PDP type" },
3814         { 0, NULL }
3815 };
3816
3817 static guint16
3818 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_)
3819 {
3820         guint32 curr_offset;
3821         const gchar     *str;
3822         guchar    pdp_type_org, pdp_type_num;
3823
3824         curr_offset = offset;
3825
3826         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 4, ENC_BIG_ENDIAN);
3827         proto_tree_add_item(tree, hf_gsm_a_sm_pdp_type_org, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3828
3829         pdp_type_org = tvb_get_guint8(tvb, curr_offset) & 0x0f;
3830         curr_offset += 1;
3831         pdp_type_num = tvb_get_guint8(tvb, curr_offset);
3832
3833         if (pdp_type_org == 0 )
3834         {
3835                 /* ETSI allocated address */
3836                 switch (pdp_type_num)
3837                 {
3838                         case 0x00: str="Reserved, used in earlier version of this protocol"; break;
3839                         case 0x01: str="PDP-type PPP"; break;
3840                         default: str="reserved";
3841                 }
3842         }
3843         else if (pdp_type_org == 1)
3844         {
3845                 /* IETF allocated address */
3846                 switch (pdp_type_num)
3847                 {
3848                         case 0x21: str="IPv4 address"; break;
3849                         case 0x57: str="IPv6 address"; break;
3850                         case 0x8d: str="IPv4v6 address"; break;
3851                         default: str="Unknown, interpreted as IPv4 address";
3852                 }
3853         }
3854         else if ((pdp_type_num == 0) && (pdp_type_org == 0x0f))
3855                 str="Empty";
3856         else
3857                 str="Not specified";
3858
3859         proto_tree_add_text(tree,
3860                 tvb, curr_offset, 1,
3861                 "PDP type number: %s (%u)",str,pdp_type_num);
3862
3863         if (( len == 2 ) && (( pdp_type_num == 0x21 ) || ( pdp_type_num == 0x57 ) || (pdp_type_num == 0x8d)))
3864         {
3865                 proto_tree_add_text(tree,
3866                         tvb, curr_offset, 1,
3867                         "Dynamic addressing");
3868                 curr_offset += 1;
3869                 return(curr_offset - offset);
3870         }
3871         else if ( len == 2 )
3872         {
3873                 proto_tree_add_text(tree,
3874                         tvb, curr_offset, 1,
3875                         "No PDP address is included");
3876                 curr_offset += 1;
3877                 return(curr_offset - offset);
3878         }
3879
3880         curr_offset += 1;
3881         if (pdp_type_org == 1)
3882         switch (pdp_type_num)
3883         {
3884                 case 0x57:
3885                         proto_tree_add_item(tree,hf_gsm_a_sm_ip6_address,tvb,curr_offset,16,ENC_NA);
3886                         curr_offset+=16;
3887                         break;
3888
3889                 case 0x8d:
3890                         proto_tree_add_item(tree,hf_gsm_a_sm_ip4_address,tvb,curr_offset,4,ENC_BIG_ENDIAN);
3891                         curr_offset+=4;
3892                         proto_tree_add_item(tree,hf_gsm_a_sm_ip6_address,tvb,curr_offset,16,ENC_NA);
3893                         curr_offset+=16;
3894                         break;
3895
3896                 default:
3897                         proto_tree_add_item(tree,hf_gsm_a_sm_ip4_address,tvb,curr_offset,4,ENC_BIG_ENDIAN);
3898                         curr_offset+=4;
3899         }
3900
3901         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
3902
3903         return(curr_offset - offset);
3904 }
3905
3906 /*
3907  * [9] 10.5.6.5 Quality of service
3908  */
3909 static const value_string gsm_a_qos_delay_cls_vals[] = {
3910         { 0x00, "Subscribed delay class (in MS to network direction)" },
3911         { 0x01, "Delay class 1" },
3912         { 0x02, "Delay class 2" },
3913         { 0x03, "Delay class 3" },
3914         { 0x04, "Delay class 4 (best effort)" },
3915         { 0x07, "Reserved" },
3916         { 0, NULL }
3917 };
3918
3919 static const value_string gsm_a_qos_reliability_vals[] = {
3920         { 0x00, "Subscribed reliability class (in MS to network direction)" },
3921         { 0x01, "Acknowledged GTP, LLC, and RLC; Protected data" },
3922         { 0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data" },
3923         { 0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data" },
3924         { 0x04, "Unacknowledged GTP/LLC/RLC, Protected data" },
3925         { 0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data" },
3926         { 0x07, "Reserved" },
3927         { 0, NULL }
3928 };
3929  /* Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107) Bits 3 2 1 */
3930 const value_string gsm_a_qos_del_of_err_sdu_vals[] = {
3931         { 0, "Subscribed delivery of erroneous SDUs/Reserved" },
3932         { 1, "No detect('-')" },
3933         { 2, "Erroneous SDUs are delivered('yes')" },
3934         { 3, "Erroneous SDUs are not delivered('No')" },
3935         { 7, "Reserved" },
3936         { 0, NULL }
3937 };
3938
3939  /* Delivery order, octet 6 (see 3GPP TS 23.107) Bits 5 4 3 */
3940 const value_string gsm_a_qos_del_order_vals[] = {
3941         { 0, "Subscribed delivery order/Reserved" },
3942         { 1, "With delivery order ('yes')" },
3943         { 2, "Without delivery order ('no')" },
3944         { 3, "Reserved" },
3945         { 0, NULL }
3946 };
3947 /* Traffic class, octet 6 (see 3GPP TS 23.107) Bits 8 7 6 */
3948 const value_string gsm_a_qos_traffic_cls_vals[] = {
3949         { 0, "Subscribed traffic class/Reserved" },
3950         { 1, "Conversational class" },
3951         { 2, "Streaming class" },
3952         { 3, "Interactive class" },
3953         { 4, "Background class" },
3954         { 7, "Reserved" },
3955         { 0, NULL }
3956 };
3957
3958 /* Residual Bit Error Rate (BER), octet 10 (see 3GPP TS 23.107) Bits 8 7 6 5 */
3959 const value_string gsm_a_qos_ber_vals[] = {
3960         { 0, "Subscribed residual BER/Reserved" },
3961         { 1, "5*10-2" },
3962         { 2, "1*10-2" },
3963         { 3, "5*10-3" },
3964         { 4, "4*10-3" },
3965         { 5, "1*10-3" },
3966         { 6, "1*10-4" },
3967         { 7, "1*10-5" },
3968         { 8, "1*10-6" },
3969         { 9, "6*10-8" },
3970         { 10, "Reserved" },
3971         { 0, NULL }
3972 };
3973
3974 /* SDU error ratio, octet 10 (see 3GPP TS 23.107) Bits 4 3 2 1 */
3975 const value_string gsm_a_qos_sdu_err_rat_vals[] = {
3976         { 0, "Subscribed SDU error ratio/Reserved" },
3977         { 1, "1*10-2" },
3978         { 2, "7*10-3" },
3979         { 3, "1*10-3" },
3980         { 4, "1*10-4" },
3981         { 5, "1*10-5" },
3982         { 6, "1*10-6" },
3983         { 7, "1*10-1" },
3984         { 15, "Reserved" },
3985         { 0, NULL }
3986 };
3987
3988 /* Traffic handling priority, octet 11 (see 3GPP TS 23.107) Bits 2 1 */
3989 const value_string gsm_a_qos_traff_hdl_pri_vals[] = {
3990         { 0, "Subscribed traffic handling priority/Reserved" },
3991         { 1, "Priority level 1" },
3992         { 2, "Priority level 2" },
3993         { 3, "Priority level 3" },
3994         { 0, NULL }
3995 };
3996
3997 const range_string gsm_a_qos_peak_thr_vals[] = {
3998         { 0x00, 0x00, "Subscribed peak throughput/reserved" },
3999         { 0x01, 0x01, "Up to 1 000 octet/s" },
4000         { 0x02, 0x02, "Up to 2 000 octet/s" },
4001         { 0x03, 0x03, "Up to 4 000 octet/s" },
4002         { 0x04, 0x04, "Up to 8 000 octet/s" },
4003         { 0x05, 0x05, "Up to 16 000 octet/s" },
4004         { 0x06, 0x06, "Up to 32 000 octet/s" },
4005         { 0x07, 0x07, "Up to 64 000 octet/s" },
4006         { 0x08, 0x08, "Up to 128 000 octet/s" },
4007         { 0x09, 0x09, "Up to 256 000 octet/s" },
4008         { 0x0a, 0x0e, "Interpreted as Up to 1 000 octet/s" },
4009         { 0x0f, 0x0f, "Reserved" },
4010         { 0, 0, NULL }
4011 };
4012
4013 const range_string gsm_a_qos_mean_thr_vals[] = {
4014         { 0x00, 0x00, "Subscribed peak throughput/reserved" },
4015         { 0x01, 0x01, "100 octet/h" },
4016         { 0x02, 0x02, "200 octet/h" },
4017         { 0x03, 0x03, "500 octet/h" },
4018         { 0x04, 0x04, "1 000 octet/h" },
4019         { 0x05, 0x05, "2 000 octet/h" },
4020         { 0x06, 0x06, "5 000 octet/h" },
4021         { 0x07, 0x07, "10 000 octet/h" },
4022         { 0x08, 0x08, "20 000 octet/h" },
4023         { 0x09, 0x09, "50 000 octet/h" },
4024         { 0x0a, 0x0a, "100 000 octet/h" },
4025         { 0x0b, 0x0b, "200 000 octet/h" },
4026         { 0x0c, 0x0c, "500 000 octet/h" },
4027         { 0x0d, 0x0d, "1 000 000 octet/h" },
4028         { 0x0e, 0x0e, "2 000 000 octet/h" },
4029         { 0x0f, 0x0f, "5 000 000 octet/h" },
4030         { 0x10, 0x10, "10 000 000 octet/h" },
4031         { 0x11, 0x11, "20 000 000 octet/h" },
4032         { 0x12, 0x12, "50 000 000 octet/h" },
4033         { 0x13, 0x1d, "Interpreted as Best effort" },
4034         { 0x1e, 0x1e, "Reserved" },
4035         { 0x1f, 0x1f, "Best effort" },
4036         { 0, 0, NULL }
4037 };
4038
4039 const range_string gsm_a_qos_prec_class_vals[] = {
4040         { 0x00, 0x00, "Subscribed precedence/reserved" },
4041         { 0x01, 0x01, "High priority" },
4042         { 0x02, 0x02, "Normal priority" },
4043         { 0x03, 0x03, "Low priority" },
4044         { 0x04, 0x06, "Interpreted as Normal priority" },
4045         { 0x07, 0x07, "Reserved" },
4046         { 0, 0, NULL }
4047 };
4048
4049 const true_false_string gsm_a_qos_signalling_ind_value = {
4050         "Optimised for signalling traffic",
4051         "Not optimised for signalling traffic"
4052 };
4053
4054 /* Helper function returning the main bitrates in kbps */
4055 static guint32
4056 qos_calc_bitrate(guint8 oct)
4057 {
4058         if (oct <= 0x3f)
4059                 return oct;
4060         if (oct <= 0x7f)
4061                 return 64 + (oct-0x40) * 8;
4062
4063         return 576 + (oct-0x80) * 64;
4064 }
4065
4066 /* Helper function returning the extended bitrates in kbps */
4067 static guint32
4068 qos_calc_ext_bitrate(guint8 oct)
4069 {
4070         if (oct <= 0x4a)
4071                 return 8600 + oct * 100;
4072         if (oct <= 0xba)
4073                 return 16000 + (oct-0x4a) * 1000;
4074
4075         return 128000 + (oct - 0xba) * 2000;
4076 }
4077
4078 guint16
4079 de_sm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4080 {
4081         guint32 curr_offset;
4082         guchar     oct, tmp_oct;
4083         const gchar     *str;
4084         guint32 temp32;
4085
4086         curr_offset = offset;
4087
4088         /* Octet 3 */
4089         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 2, ENC_BIG_ENDIAN);
4090         proto_tree_add_item(tree, hf_gsm_a_qos_delay_cls, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4091         proto_tree_add_item(tree, hf_gsm_a_qos_reliability_cls, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4092         curr_offset+= 1;
4093
4094         /* Octet 4 */
4095         oct = tvb_get_guint8(tvb, curr_offset);
4096         proto_tree_add_item(tree, hf_gsm_a_qos_peak_thr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4097         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3) + 4, 1, ENC_BIG_ENDIAN);
4098         proto_tree_add_item(tree, hf_gsm_a_qos_prec_class, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4099         curr_offset+= 1;
4100
4101         /* Octet 5 */
4102         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 3, ENC_BIG_ENDIAN);
4103         proto_tree_add_item(tree, hf_gsm_a_qos_mean_thr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4104         curr_offset+= 1;
4105
4106         NO_MORE_DATA_CHECK(len);
4107
4108         /* Octet 6 */
4109         proto_tree_add_item(tree, hf_gsm_a_qos_traffic_cls, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4110         proto_tree_add_item(tree, hf_gsm_a_qos_del_order, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4111         proto_tree_add_item(tree, hf_gsm_a_qos_del_of_err_sdu, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4112         curr_offset+= 1;
4113
4114         NO_MORE_DATA_CHECK(len);
4115
4116         /* Octet 7 */
4117         oct = tvb_get_guint8(tvb, curr_offset);
4118
4119         switch ( oct )
4120         {
4121                 case 0x00: str="Subscribed maximum SDU size/reserved"; break;
4122                 case 0x97: str="1502 octets"; break;
4123                 case 0x98: str="1510 octets"; break;
4124                 case 0x99: str="1520 octets"; break;
4125                 case 0xff: str="Reserved"; break;
4126                 default: str="Unspecified";
4127         }
4128
4129         if (( oct >= 1 ) && ( oct <= 0x96 ))
4130                 proto_tree_add_text(tree,
4131                         tvb, curr_offset, 1,
4132                         "Maximum SDU size: %u octets (%u)",oct*10, oct);
4133         else
4134                 proto_tree_add_text(tree,
4135                         tvb, curr_offset, 1,
4136                         "Maximum SDU size: %s (%u)",str, oct);
4137
4138         curr_offset+= 1;
4139
4140         NO_MORE_DATA_CHECK(len);
4141
4142         /* Octet 8 */
4143         oct = tvb_get_guint8(tvb, curr_offset);
4144
4145         switch (oct)
4146         {
4147                 case 0x00: str = "Subscribed maximum bit rate for uplink/reserved"; break;
4148                 case 0xff: str = "0 kbps"; break;
4149                 default: str = ep_strdup_printf("%u kbps", qos_calc_bitrate(oct));
4150         }
4151
4152         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_max_bitrate_upl, tvb,
4153                 curr_offset, 1, oct, "%s (%u)", str, oct);
4154         curr_offset+= 1;
4155
4156         NO_MORE_DATA_CHECK(len);
4157
4158         /* Octet 9 */
4159         oct = tvb_get_guint8(tvb, curr_offset);
4160
4161         switch ( oct )
4162         {
4163                 case 0x00: str="Subscribed maximum bit rate for downlink/reserved"; break;
4164                 case 0xff: str="0 kbps"; break;
4165                 default: str = ep_strdup_printf("%u kbps", qos_calc_bitrate(oct));
4166         }
4167
4168         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_max_bitrate_downl, tvb,
4169                 curr_offset, 1, oct, "%s (%u)", str, oct);
4170         curr_offset+= 1;
4171
4172         NO_MORE_DATA_CHECK(len);
4173
4174         /* Octet 10 */
4175         proto_tree_add_item(tree, hf_gsm_a_qos_ber, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4176         proto_tree_add_item(tree, hf_gsm_a_qos_sdu_err_rat, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4177
4178         curr_offset+= 1;
4179         NO_MORE_DATA_CHECK(len);
4180
4181         /* Octet 11 */
4182         oct = tvb_get_guint8(tvb, curr_offset);
4183
4184         tmp_oct = oct >> 2;
4185         switch (tmp_oct)
4186         {
4187                 case 0x00: str="Subscribed transfer delay/reserved"; break;
4188                 case 0x3f: str="Reserved"; break;
4189                 default:
4190                         if (tmp_oct <= 0x0f)
4191                                 temp32 = tmp_oct * 10;
4192                         else if (tmp_oct <= 0x1f)
4193                                 temp32 = (tmp_oct - 0x10) * 50 + 200;
4194                         else
4195                                 temp32 = (tmp_oct - 0x20) * 100 + 1000;
4196                         str = ep_strdup_printf("%u ms", temp32);
4197         }
4198
4199         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_trans_delay, tvb,
4200                 curr_offset, 1, oct, "%s (%u)", str, tmp_oct);
4201
4202         tmp_oct = oct & 0x03;
4203         if (tmp_oct == 0)
4204                 str = "Subscribed traffic handling priority/reserved";
4205         else
4206                 str = ep_strdup_printf("Priority level %u", tmp_oct);
4207
4208         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_traf_handl_prio, tvb,
4209                 curr_offset, 1, oct, "%s (%u)", str, tmp_oct);
4210
4211         curr_offset+= 1;
4212         NO_MORE_DATA_CHECK(len);
4213
4214         /* Octet 12 */
4215         oct = tvb_get_guint8(tvb, curr_offset);
4216
4217         switch ( oct )
4218         {
4219                 case 0x00: str="Subscribed guaranteed bit rate for uplink/reserved"; break;
4220                 case 0xff: str="0 kbps"; break;
4221                 default: str = ep_strdup_printf("%u kbps", qos_calc_bitrate(oct));
4222         }
4223
4224         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_guar_bitrate_upl, tvb,
4225                 curr_offset, 1, oct, "%s (%u)", str, oct);
4226
4227         curr_offset+= 1;
4228         NO_MORE_DATA_CHECK(len);
4229
4230         /* Octet 13 */
4231         oct = tvb_get_guint8(tvb, curr_offset);
4232
4233         switch ( oct )
4234         {
4235                 case 0x00: str="Subscribed guaranteed bit rate for downlink/reserved"; break;
4236                 case 0xff: str="0 kbps"; break;
4237                 default: str = ep_strdup_printf("%u kbps", qos_calc_bitrate(oct));
4238         }
4239
4240         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_guar_bitrate_downl, tvb,
4241                 curr_offset, 1, oct, "%s (%u)", str, oct);
4242
4243         curr_offset+= 1;
4244         NO_MORE_DATA_CHECK(len);
4245
4246         /* Ocet 14 */
4247         oct = tvb_get_guint8(tvb, curr_offset);
4248         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset << 3), 3, ENC_BIG_ENDIAN);
4249         proto_tree_add_item(tree, hf_gsm_a_qos_signalling_ind, tvb , curr_offset, 1, ENC_BIG_ENDIAN);
4250
4251         tmp_oct = oct & 7;
4252         if (tmp_oct == 0x01)
4253                 str = "speech";
4254         else
4255                 str = "unknown";
4256
4257         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_source_stat_desc, tvb,
4258                 curr_offset, 1, oct, "%s (%u)", str, tmp_oct);
4259
4260         curr_offset+= 1;
4261         NO_MORE_DATA_CHECK(len);
4262
4263         /* Octet 15 */
4264         oct = tvb_get_guint8(tvb, curr_offset);
4265
4266         if (oct == 0x00)
4267                 str = "Use the value indicated by the Maximum bit rate for downlink";
4268         else
4269         {
4270                 temp32 = qos_calc_ext_bitrate(oct);
4271                 if (temp32 % 1000 == 0)
4272                         str = ep_strdup_printf("%u Mbps", temp32 / 1000);
4273                 else
4274                         str = ep_strdup_printf("%u kbps", temp32);
4275         }
4276         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_max_bitrate_downl_ext, tvb,
4277                 curr_offset, 1, oct, "%s (%u)", str, oct);
4278
4279         curr_offset+= 1;
4280         NO_MORE_DATA_CHECK(len);
4281
4282         /* Octet 16 */
4283         oct = tvb_get_guint8(tvb, curr_offset);
4284
4285         if (oct == 0x00)
4286                 str = "Use the value indicated by the Guaranteed bit rate for downlink";
4287         else
4288         {
4289                 temp32 = qos_calc_ext_bitrate(oct);
4290                 if (temp32 % 1000 == 0)
4291                         str = ep_strdup_printf("%u Mbps", temp32 / 1000);
4292                 else
4293                         str = ep_strdup_printf("%u kbps", temp32);
4294         }
4295         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_guar_bitrate_downl_ext, tvb,
4296                 curr_offset, 1, oct, "%s (%u)", str, oct);
4297
4298         curr_offset+= 1;
4299         NO_MORE_DATA_CHECK(len);
4300
4301         /* Maximum bit rate for uplink (extended) Octet 17 */
4302         oct = tvb_get_guint8(tvb, curr_offset);
4303
4304         if (oct == 0x00)
4305                 str = "Use the value indicated by the Maximum bit rate for uplink";
4306         else
4307         {
4308                 temp32 = qos_calc_ext_bitrate(oct);
4309                 if (temp32 % 1000 == 0)
4310                         str = ep_strdup_printf("%u Mbps", temp32 / 1000);
4311                 else
4312                         str = ep_strdup_printf("%u kbps", temp32);
4313         }
4314         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_max_bitrate_upl_ext, tvb,
4315                 curr_offset, 1, oct, "%s (%u)", str, oct);
4316
4317         curr_offset+= 1;
4318         NO_MORE_DATA_CHECK(len);
4319
4320         /* Guaranteed bit rate for uplink (extended) Octet 18 */
4321         oct = tvb_get_guint8(tvb, curr_offset);
4322
4323         if (oct == 0x00)
4324                 str = "Use the value indicated by the Guaranteed bit rate for uplink";
4325         else
4326         {
4327                 temp32 = qos_calc_ext_bitrate(oct);
4328                 if (temp32 % 1000 == 0)
4329                         str = ep_strdup_printf("%u Mbps", temp32 / 1000);
4330                 else
4331                         str = ep_strdup_printf("%u kbps", temp32);
4332         }
4333         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_guar_bitrate_upl_ext, tvb,
4334                 curr_offset, 1, oct, "%s (%u)", str, oct);
4335
4336         curr_offset+= 1;
4337
4338         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
4339
4340         return(curr_offset - offset);
4341 }
4342
4343 /*
4344  * [9] 10.5.6.6 SM cause
4345  */
4346 static const value_string gsm_a_sm_cause_vals[] = {
4347         { 0x08, "Operator Determined Barring" },
4348         { 0x18, "MBMS bearer capabilities insufficient for the service" },
4349         { 0x19, "LLC or SNDCP failure(GSM only)" },
4350         { 0x1a, "Insufficient resources" },
4351         { 0x1b, "Missing or unknown APN" },
4352         { 0x1c, "Unknown PDP address or PDP type" },
4353         { 0x1d, "User Authentication failed" },
4354         { 0x1e, "Activation rejected by GGSN" },
4355         { 0x1f, "Activation rejected, unspecified" },
4356         { 0x20, "Service option not supported" },
4357         { 0x21, "Requested service option not subscribed" },
4358         { 0x22, "Service option temporarily out of order" },
4359         { 0x23, "NSAPI already used (not sent)" },
4360         { 0x24, "Regular deactivation" },
4361         { 0x25, "QoS not accepted" },
4362         { 0x26, "Network failure" },
4363         { 0x27, "Reactivation required" },
4364         { 0x28, "Feature not supported" },
4365         { 0x29, "Semantic error in the TFT operation" },
4366         { 0x2a, "Syntactical error in the TFT operation" },
4367         { 0x2b, "Unknown PDP context" },
4368         { 0x2c, "Semantic errors in packet filter(s)" },
4369         { 0x2d, "Syntactical errors in packet filter(s)" },
4370         { 0x2e, "PDP context without TFT already activated" },
4371         { 0x2f, "Multicast group membership time-out" },
4372         { 0x2c, "Semantic errors in packet filter(s)" },
4373         { 0x2d, "Syntactical errors in packet filter(s)" },
4374         { 0x30, "Activation rejected, BCM violation" },
4375         { 0x32, "PDP type IPv4 only allowed" },
4376         { 0x33, "PDP type IPv6 only allowed" },
4377         { 0x34, "Single address bearers only allowed" },
4378         { 0x51, "Invalid transaction identifier value" },
4379         { 0x5f, "Semantically incorrect message" },
4380         { 0x60, "Invalid mandatory information" },
4381         { 0x61, "Message type non-existent or not implemented" },
4382         { 0x62, "Message type not compatible with the protocol state" },
4383         { 0x63, "Information element non-existent or not implemented" },
4384         { 0x64, "Conditional IE error" },
4385         { 0x65, "Message not compatible with the protocol state" },
4386         { 0x6f, "Protocol error, unspecified" },
4387         { 0x70, "APN restriction value incompatible with active PDP context" },
4388         { 0, NULL }
4389 };
4390
4391 static guint16
4392 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_)
4393 {
4394         guint8  oct;
4395         const gchar     *str;
4396
4397         oct = tvb_get_guint8(tvb, offset);
4398
4399         /* SM Cause can be sent in both directions */
4400         str = val_to_str_const(oct, gsm_a_sm_cause_vals,
4401                                "Protocol error, unspecified / Service option temporarily out of order");
4402
4403         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_cause, tvb,
4404                                 offset, 1, oct, "%s (%u)", str, oct);
4405
4406         /* no length check possible */
4407         return(1);
4408 }
4409
4410 /*
4411  * [9] 10.5.6.6a SM cause 2
4412  */
4413 static guint16
4414 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_)
4415 {
4416         guint8  oct;
4417         const gchar     *str;
4418
4419         oct = tvb_get_guint8(tvb, offset);
4420
4421         /* SM Cause 2 is sent only in the Network-to-MS direction */
4422         str = val_to_str_const(oct, gsm_a_sm_cause_vals,
4423                                "Service option temporarily out of order");
4424
4425         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_cause_2, tvb,
4426                                 offset, 1, oct, "%s (%u)", str, oct);
4427
4428         /* no length check possible */
4429         return(1);
4430 }
4431 /*
4432  * [7] 10.5.6.7
4433  */
4434
4435 static const true_false_string gsm_a_sm_ti_flag_vals = {
4436         "The message is sent to the side that originates the TI",
4437         "The message is sent from the side that originates the TI"
4438 };
4439
4440 static guint16
4441 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_)
4442 {
4443         guint32 curr_offset;
4444         guint   curr_len;
4445         gchar   oct;
4446         curr_len = len;
4447         curr_offset = offset;
4448
4449         oct = tvb_get_guint8(tvb, curr_offset);
4450
4451         proto_tree_add_item(tree, hf_gsm_a_sm_ti_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
4452
4453         /* The TI value and the TI flag occupy bits 5 - 7 and bit 8 of the first octet respectively.
4454          * The extended TI shall not be used unless TI values of 7 or greater are needed.
4455          * 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
4456          * value is encoded in bits 7-1 of the second octet.
4457          */
4458
4459         if ( curr_len > 1 )
4460         {
4461                 curr_offset++;
4462                 oct = tvb_get_guint8(tvb, curr_offset);
4463
4464                 proto_tree_add_text(tree,
4465                         tvb, curr_offset, 1,
4466                         "TI value: 0x%02x (%u)",oct&0x7f,oct&0x7f);
4467
4468                 proto_tree_add_item(tree, hf_gsm_a_sm_ext, tvb, offset, 1, ENC_BIG_ENDIAN);
4469
4470                 curr_offset++;
4471         }
4472         else
4473         {
4474                 proto_tree_add_text(tree,
4475                         tvb, curr_offset, 1,
4476                         "TI value: 0x%02x (%u)",(oct>>4)&7,(oct>>4)&7);
4477                 curr_offset++;
4478         }
4479
4480
4481         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
4482
4483         return(curr_offset - offset);
4484 }
4485
4486 /*
4487  * [9] 10.5.6.9 LLC service access point identifier
4488  */
4489 static const value_string gsm_a_sm_llc_sapi_vals[] = {
4490         { 0, "LLC SAPI not assigned" },
4491         { 3, "SAPI 3" },
4492         { 5, "SAPI 5" },
4493         { 9, "SAPI 9" },
4494         { 11, "SAPI 11" },
4495         { 0, NULL }
4496 };
4497
4498 static guint16
4499 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_)
4500 {
4501         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, offset << 3, 4, ENC_BIG_ENDIAN);
4502         proto_tree_add_item(tree, hf_gsm_a_sm_llc_sapi, tvb, offset, 1, ENC_BIG_ENDIAN);
4503
4504         /* no length check possible */
4505         return(1);
4506 }
4507
4508 /*
4509  * [9] 10.5.6.10 Tear down indicator
4510  */
4511 const true_false_string gsm_a_sm_tdi_value = {
4512         "Tear down requested",
4513         "Tear down not requested"
4514 };
4515
4516 static guint16
4517 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_)
4518 {
4519         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset << 3) + 4, 3, ENC_BIG_ENDIAN);
4520         proto_tree_add_item(tree, hf_gsm_a_sm_tdi, tvb, offset, 1, ENC_BIG_ENDIAN);
4521
4522         /* no length check possible */
4523         return(1);
4524 }
4525
4526 /*
4527  * [9] 10.5.6.11 Packet Flow Identifier
4528  */
4529 static const range_string gsm_a_sm_packet_flow_id_vals[] = {
4530         { 0x00, 0x00, "Best Effort"},
4531         { 0x01, 0x01, "Signaling"},
4532         { 0x02, 0x02, "SMS"},
4533         { 0x03, 0x03, "TOM8"},
4534         { 0x04, 0x07, "Reserved"},
4535         { 0x08, 0x7f, "Dynamically assigned"},
4536         { 0x00, 0x00, NULL }
4537 };
4538
4539 guint16
4540 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_)
4541 {
4542         guint32 curr_offset;
4543         guint value;
4544
4545         curr_offset = offset;
4546         value = tvb_get_guint8(tvb,curr_offset);
4547         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, curr_offset << 3, 1, ENC_BIG_ENDIAN);
4548         proto_tree_add_item(tree, hf_gsm_a_sm_packet_flow_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4549         curr_offset++;
4550
4551     if (add_string)
4552         g_snprintf(add_string, string_len, " - %s", rval_to_str(value, gsm_a_sm_packet_flow_id_vals, "Unknown"));
4553
4554         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
4555
4556         return(curr_offset - offset);
4557 }
4558
4559 /*
4560  * [7] 10.5.6.12     TFT - Traffic Flow Template
4561  */
4562 /* TFT operation code (octet 3) */
4563 static const value_string gsm_a_tft_op_code_vals[] = {
4564         { 0,            "Spare"},
4565         { 1,            "Create new TFT"},
4566         { 2,            "Delete existing TFT"},
4567         { 3,            "Add packet filters to existing TFT"},
4568         { 4,            "Replace packet filters in existing TFT"},
4569         { 5,            "Delete packet filters from existing TFT"},
4570         { 6,            "No TFT operation"},
4571         { 7,            "Reserved"},
4572         { 0,    NULL }
4573 };
4574
4575 static const true_false_string gsm_a_tft_e_bit  = {
4576   "Parameters list is included",
4577   "Parameters list is not included"
4578 };
4579
4580 static const value_string gsm_a_tft_pkt_flt_dir_vals[] = {
4581         { 0,    "Pre Rel-7 TFT filter"},
4582         { 1,    "Downlink only"},
4583         { 2,    "Uplink only"},
4584         { 3,    "Bidirectional"},
4585         { 0,    NULL }
4586 };
4587
4588 static const value_string gsm_a_tft_param_id_vals[] = {
4589         { 1,    "Authorization Token"},
4590         { 2,    "Flow Identifier"},
4591         { 3,    "Packet Filter Identifier"},
4592         { 0,    NULL }
4593 };
4594
4595 guint16
4596 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_)
4597 {
4598         guint32       curr_offset;
4599         guint         curr_len;
4600         proto_item   *tf = NULL;
4601         proto_tree   *tf_tree = NULL;
4602         proto_tree   *comp_tree = NULL;
4603         guchar        op_code;
4604         guchar        pkt_fil_count;
4605         guchar        e_bit;
4606         const gchar  *str;
4607         guchar        count;
4608         guchar        oct;
4609         gint          pf_length;
4610         gint          i;
4611         gint          pack_component_type;
4612         gint          param;
4613
4614         curr_len = len;
4615         curr_offset = offset;
4616
4617         /*
4618          * parse first octet. It contain TFT operation code, E bit and Number of packet filters
4619          */
4620         oct = tvb_get_guint8(tvb, curr_offset);
4621
4622         op_code = oct>>5;
4623         pkt_fil_count = oct&0x0f;
4624         e_bit = (oct>>4)&1;
4625
4626         proto_tree_add_item(tree,hf_gsm_a_tft_op_code,tvb,curr_offset,1,ENC_BIG_ENDIAN);
4627         proto_tree_add_item(tree,hf_gsm_a_tft_e_bit,tvb,curr_offset,1,ENC_BIG_ENDIAN);
4628         proto_tree_add_item(tree,hf_gsm_a_tft_pkt_flt,tvb,curr_offset,1,ENC_BIG_ENDIAN);
4629
4630         curr_offset++;
4631         curr_len--;
4632
4633         /* Packet filter list dissect */
4634
4635         count = 0;
4636         if ( op_code == 2 )                     /* delete TFT contains no packet filters. so we will jump over it */
4637                 count = pkt_fil_count;
4638         while ( count < pkt_fil_count )
4639         {
4640                 tf = proto_tree_add_text(tree,
4641                         tvb, curr_offset, 1,
4642                         "Packet filter %d",count);   /* 0-> 7 */
4643
4644                 tf_tree = proto_item_add_subtree(tf, ett_sm_tft );
4645
4646                 if ( op_code == 5 )  /* Delete packet filters from existing TFT - just a list of identifiers */
4647                 {
4648                         if ((curr_offset-offset)<1) {
4649                                 proto_tree_add_text(tf_tree,tvb, curr_offset, 1,"Not enough data");
4650                                 return(len);
4651                         }
4652                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 4, ENC_BIG_ENDIAN);
4653                         proto_tree_add_item(tf_tree, hf_gsm_a_tft_pkt_flt_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4654                         curr_offset++;
4655                         curr_len--;
4656                         count++;
4657                 }
4658                 else                            /* create new, Add packet filters or Replace packet filters */
4659                 {
4660
4661                         if ((curr_offset-offset)<1) {
4662                                 proto_tree_add_text(tf_tree,tvb, curr_offset, 1,"Not enough data");
4663                                 return(len);
4664                         }
4665                         proto_tree_add_bits_item(tf_tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 2, ENC_BIG_ENDIAN);
4666                         proto_tree_add_item(tf_tree, hf_gsm_a_tft_pkt_flt_dir, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4667                         proto_tree_add_item(tf_tree, hf_gsm_a_tft_pkt_flt_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4668                         curr_offset++;
4669                         curr_len--;
4670
4671                         if ((curr_offset-offset)<1) {
4672                                 proto_tree_add_text(tf_tree,tvb, curr_offset, 1,"Not enough data");
4673                                 return(len);
4674                         }
4675                         oct = tvb_get_guint8(tvb, curr_offset);
4676                         curr_offset++;
4677                         curr_len--;
4678
4679                         proto_tree_add_text(tf_tree,
4680                                 tvb, curr_offset-1, 1,
4681                                 "Packet evaluation precedence: 0x%02x (%u)",oct,oct );
4682
4683                         if ((curr_offset-offset)<1) { proto_tree_add_text(tf_tree,tvb, curr_offset, 1,"Not enough data"); return(len);}
4684                         pf_length = tvb_get_guint8(tvb, curr_offset);
4685                         curr_offset++;
4686                         curr_len--;
4687
4688                         proto_tree_add_text(tf_tree,
4689                                 tvb, curr_offset-1, 1,
4690                                 "Packet filter length: 0x%02x (%u)",pf_length,pf_length );
4691                         /* New tree for component */
4692
4693                         /* Dissect Packet filter Component */
4694                         /* while ( filter_len > 1 ) */
4695                         /* packet filter component type identifier: */
4696
4697                         while (pf_length > 0 ){
4698                                 if ((curr_offset-offset)<1) {
4699                                         proto_tree_add_text(tf_tree,tvb, curr_offset, 1,"Not enough data");
4700                                         return(len);
4701                                 }
4702                                 pack_component_type = tvb_get_guint8(tvb, curr_offset);
4703                                 curr_offset++;
4704                                 curr_len--;
4705                                 pf_length--;
4706
4707                                 tf=proto_tree_add_text(tf_tree,tvb, curr_offset-1, 1,"Packet filter component type identifier: ");
4708                                 comp_tree = proto_item_add_subtree(tf, ett_sm_tft );
4709
4710                                 switch ( pack_component_type ){
4711
4712                                 case 0x10:
4713                                         str="IPv4 remote address type";
4714                                         proto_tree_add_item(comp_tree,hf_gsm_a_sm_ip4_address,tvb,curr_offset,4,ENC_BIG_ENDIAN);
4715                                         curr_offset+=4;
4716                                         curr_len-=4;
4717                                         proto_tree_add_item(comp_tree,hf_gsm_a_sm_ip4_mask,tvb,curr_offset,4,ENC_BIG_ENDIAN);
4718                                         curr_offset+=4;
4719                                         curr_len-=4;
4720                                         pf_length-=8;
4721                                         break;
4722
4723                                 case 0x20:
4724                                         str="IPv6 remote address type";
4725                                         proto_tree_add_item(comp_tree,hf_gsm_a_sm_ip6_address,tvb,curr_offset,16,ENC_NA);
4726                                         curr_offset+=16;
4727                                         curr_len-=16;
4728                                         proto_tree_add_item(comp_tree,hf_gsm_a_sm_ip6_mask,tvb,curr_offset,16,ENC_NA);
4729                                         curr_offset+=16;
4730                                         curr_len-=16;
4731                                         pf_length-=32;
4732                                         break;
4733
4734                                 case 0x30:
4735                                         str="Protocol identifier/Next header type";
4736                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_protocol_header,tvb,curr_offset,1,ENC_BIG_ENDIAN);
4737                                         curr_offset+=1;
4738                                         curr_len-=1;
4739                                         pf_length-=1;
4740                                         break;
4741
4742                                 case 0x40:
4743                                         str="Single local port type";
4744                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_port,tvb,curr_offset,2,ENC_BIG_ENDIAN);
4745                                         curr_offset+=2;
4746                                         curr_len-=2;
4747                                         pf_length-=2;
4748                                         break;
4749
4750                                 case 0x41:
4751                                         str="Local port range type";
4752                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_port_low,tvb,curr_offset,2,ENC_BIG_ENDIAN);
4753                                         curr_offset+=2;
4754                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_port_high,tvb,curr_offset,2,ENC_BIG_ENDIAN);
4755                                         curr_offset+=2;
4756                                         curr_len-=4;
4757                                         pf_length-=4;
4758                                         break;
4759
4760                                 case 0x50:
4761                                         str="Single remote port type";
4762                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_port,tvb,curr_offset,2,ENC_BIG_ENDIAN);
4763                                         curr_offset+=2;
4764                                         curr_len-=2;
4765                                         pf_length-=2;
4766                                         break;
4767
4768                                 case 0x51:
4769                                         str="Remote port range type";
4770                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_port_low,tvb,curr_offset,2,ENC_BIG_ENDIAN);
4771                                         curr_offset+=2;
4772                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_port_high,tvb,curr_offset,2,ENC_BIG_ENDIAN);
4773                                         curr_offset+=2;
4774                                         curr_len-=4;
4775                                         pf_length-=4;
4776                                         break;
4777
4778                                 case 0x60:
4779                                         str="Security parameter index type";
4780                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_security,tvb,curr_offset,4,ENC_BIG_ENDIAN);
4781                                         curr_offset+=4;
4782                                         curr_len-=4;
4783                                         pf_length-=4;
4784                                         break;
4785
4786
4787                                 case 0x70:
4788                                         str="Type of service/Traffic class type";
4789                                         proto_tree_add_item(comp_tree,hf_gsm_a_qos_traffic_cls,tvb,curr_offset,1,ENC_BIG_ENDIAN);
4790                                         curr_offset++;
4791                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_traffic_mask,tvb,curr_offset,1,ENC_BIG_ENDIAN);
4792                                         curr_offset++;
4793                                         curr_len-=2;
4794                                         pf_length-=2;
4795                                         break;
4796
4797                                 case 0x80:
4798                                         str="Flow label type";
4799                                         proto_tree_add_bits_item(comp_tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 4, ENC_BIG_ENDIAN);
4800                                         proto_tree_add_item(comp_tree,hf_gsm_a_tft_flow_label_type,tvb,curr_offset,3,ENC_BIG_ENDIAN);
4801                                         curr_offset+=3;
4802                                         curr_len-=3;
4803                                         pf_length-=3;
4804                                         break;
4805
4806                                 default:
4807                                         str="not specified";
4808                                         curr_offset+=pf_length;
4809                                         curr_len-=pf_length;
4810                                         pf_length=0;
4811                                 }
4812                                 proto_item_append_text(tf, "%s (%u)", str, pack_component_type);
4813                         }
4814                         count++;
4815                 }
4816         }
4817
4818         /* The parameters list contains a variable number of parameters that might need to be
4819          * transferred in addition to the packet filters. If the parameters list is included, the E
4820          * bit is set to 1; otherwise, the E bit is set to 0.
4821          */
4822         if ((e_bit == 1) && curr_len) {
4823                 count = 0;
4824                 while (curr_len) {
4825                         pf_length = tvb_get_guint8(tvb, curr_offset+1);
4826                         tf = proto_tree_add_text(tree, tvb, curr_offset, pf_length+2, "Parameter %d" ,count);
4827                         tf_tree = proto_item_add_subtree(tf, ett_sm_tft );
4828                         param = tvb_get_guint8(tvb, curr_offset);
4829                         proto_tree_add_item(tf_tree, hf_gsm_a_tft_param_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
4830                         curr_offset += 2;
4831                         curr_len -= 2;
4832                         switch (param) {
4833                         case 0x01:
4834                                 proto_tree_add_text(tf_tree, tvb, curr_offset, pf_length, "Authorization token value: 0x%s",
4835                                                 tvb_bytes_to_str(tvb, curr_offset, pf_length));
4836                                 break;
4837
4838                         case 0x02:
4839                                 proto_tree_add_text(tf_tree, tvb, curr_offset, 2, "Media Component number value: 0x%x",
4840                                                 tvb_get_bits16(tvb, curr_offset<<3, 16, ENC_BIG_ENDIAN));
4841                                 proto_tree_add_text(tf_tree, tvb, curr_offset+2, 2, "IP flow number: 0x%x",
4842                                                 tvb_get_bits16(tvb, (curr_offset+2)<<3, 16, ENC_BIG_ENDIAN));
4843                                 break;
4844
4845                         case 0x03:
4846                                 for (i = 0; i < pf_length; i++) {
4847                                         proto_tree_add_text(tf_tree, tvb, curr_offset+i, 1, "Packet filter identifier %d: %d",
4848                                                     i, tvb_get_guint8(tvb, curr_offset+i));
4849                                 }
4850                                 break;
4851
4852                         default:
4853                                 proto_tree_add_text(tf_tree, tvb, curr_offset, pf_length, "Parameter content: 0x%s",
4854                                                     tvb_bytes_to_str(tvb, curr_offset, pf_length));
4855                                 break;
4856                         }
4857                         curr_offset += pf_length;
4858                         curr_len -= pf_length;
4859                         count++;
4860                 }
4861         }
4862
4863         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
4864
4865         return(len);
4866 }
4867
4868 /*
4869  * [9] 10.5.6.13 Temporary Mobile Group Identity (TMGI)
4870  */
4871 static guint16
4872 de_sm_tmgi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
4873 {
4874         guint32 curr_offset;
4875
4876         curr_offset = offset;
4877
4878         proto_tree_add_item(tree, hf_gsm_a_sm_tmgi, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
4879         curr_offset += 3;
4880
4881         NO_MORE_DATA_CHECK(len);
4882         curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, TRUE);
4883
4884         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
4885
4886         return(curr_offset - offset);
4887 }
4888
4889 /*
4890  * [9] 10.5.6.14 MBMS bearer capabilities
4891  */
4892 static guint16
4893 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_)
4894 {
4895         guint32 curr_offset, temp32;
4896         guint8 oct;
4897         const gchar *str;
4898
4899         curr_offset = offset;
4900
4901         oct = tvb_get_guint8(tvb, curr_offset);
4902
4903         switch (oct)
4904         {
4905                 case 0x00: str="Subscribed maximum bit rate for downlink/reserved"; break;
4906                 case 0xff: str="0 kbps"; break;
4907                 default: str = ep_strdup_printf("%u kbps", qos_calc_bitrate(oct));
4908         }
4909
4910         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_max_bitrate_downl, tvb,
4911                 curr_offset, 1, oct, "%s (%u)", str, oct);
4912         curr_offset+= 1;
4913
4914         NO_MORE_DATA_CHECK(len);
4915
4916         oct = tvb_get_guint8(tvb, curr_offset);
4917
4918         if (oct == 0x00)
4919                 str = "Use the value indicated by the Maximum bit rate for downlink";
4920         else
4921         {
4922                 temp32 = qos_calc_ext_bitrate(oct);
4923                 if (temp32 % 1000 == 0)
4924                         str = ep_strdup_printf("%u Mbps", temp32 / 1000);
4925                 else
4926                         str = ep_strdup_printf("%u kbps", temp32);
4927         }
4928         proto_tree_add_uint_format_value(tree, hf_gsm_a_qos_max_bitrate_downl_ext, tvb,
4929                 curr_offset, 1, oct, "%s (%u)", str, oct);
4930
4931         curr_offset+= 1;
4932
4933         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
4934
4935         return(curr_offset - offset);
4936 }
4937
4938 /*
4939  * [9] 10.5.6.15 MBMS protocol configuration options
4940  */
4941 static guint16
4942 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_)
4943 {
4944         guint32 curr_offset;
4945
4946         curr_offset = offset;
4947         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (curr_offset<<3), 8, ENC_BIG_ENDIAN);
4948         curr_offset++;
4949
4950         EXTRANEOUS_DATA_CHECK_EXPERT(len, curr_offset - offset, pinfo);
4951
4952         return(curr_offset - offset);
4953 }
4954
4955 /*
4956  * [9] 10.5.6.16 Enhanced network service access point identifier
4957  */
4958 static guint16
4959 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_)
4960 {
4961         guint8  oct;
4962         const gchar *str;
4963
4964         oct = tvb_get_guint8(tvb, offset);
4965
4966         if(oct < 0x80)
4967                 str = "Reserved";
4968         else if (oct < 0xff)
4969                         str = ep_strdup_printf("NSAPI %u for Multimedia Broadcast/Multicast Service (MBMS) Multicast mode", oct);
4970                 else
4971                         str = "Reserved for use by lower layers in the p2p radio bearer allocation message for MBMS Broadcast mode";
4972
4973
4974         proto_tree_add_uint_format_value(tree, hf_gsm_a_sm_enh_nsapi, tvb,
4975                 offset, 1, oct, "%s (%u)", str, oct);
4976
4977         /* no length check possible */
4978         return(1);
4979 }
4980
4981 /*
4982  * [9] 10.5.6.17 Request type
4983  */
4984 static const value_string gsm_a_sm_req_type_vals[] = {
4985         { 0x01, "Initial request" },
4986         { 0x02, "Handover" },
4987         { 0x03, "Unused. If received, the network shall interpret this as \"Initial request\"." },
4988         { 0, NULL }
4989 };
4990
4991 static guint16
4992 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_)
4993 {
4994         proto_tree_add_bits_item(tree, hf_gsm_a_spare_bits, tvb, (offset<<3) + 4, 1, ENC_BIG_ENDIAN);
4995         proto_tree_add_item(tree, hf_gsm_a_sm_req_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4996
4997         /* no length check possible */
4998         return(1);
4999 }
5000
5001 /*
5002  * [9] 10.5.6.18 Notification indicator
5003  */
5004 static const value_string gsm_a_sm_notif_ind_vals[] = {
5005         { 0x0,  "Reserved"},
5006         { 0x1,  "SRVCC handover cancelled, IMS session re-establishment required"},
5007         { 0, NULL }
5008 };
5009
5010 static guint16
5011 de_sm_notif_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
5012 {
5013         guint32 curr_offset;
5014
5015         curr_offset = offset;
5016
5017         proto_tree_add_item(tree, hf_gsm_a_sm_notif_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
5018
5019         return(len);
5020 }
5021
5022
5023 guint16 (*gm_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) = {
5024         /* GPRS Mobility Management Information Elements 10.5.5 */
5025         de_gmm_attach_res,      /* Attach Result */
5026         de_gmm_attach_type,     /* Attach Type */
5027         de_gmm_ciph_alg,        /* Cipher Algorithm */
5028         de_gmm_tmsi_stat,       /* TMSI Status */
5029         de_gmm_detach_type,     /* Detach Type */
5030         de_gmm_drx_param,       /* DRX Parameter */
5031         de_gmm_ftostby,         /* Force to Standby */
5032         de_gmm_ftostby_h,       /* Force to Standby - Info is in the high nibble */
5033         de_gmm_ptmsi_sig,       /* P-TMSI Signature */
5034         de_gmm_ptmsi_sig2,      /* P-TMSI Signature 2 */
5035         de_gmm_ident_type2,     /* Identity Type 2 */
5036         de_gmm_imeisv_req,      /* IMEISV Request */
5037         de_gmm_rec_npdu_lst,    /* Receive N-PDU Numbers List */
5038         de_gmm_ms_net_cap,      /* MS Network Capability */
5039         de_gmm_ms_radio_acc_cap,/* MS Radio Access Capability */
5040         de_gmm_cause,           /* GMM Cause */
5041         de_gmm_rai,             /* Routing Area Identification */
5042         de_gmm_rai2,    /* Routing Area Identification 2 */
5043         de_gmm_update_res,      /* Update Result */
5044         de_gmm_update_type,     /* Update Type */
5045         de_gmm_ac_ref_nr,       /* A&C Reference Number */
5046         de_gmm_ac_ref_nr_h,     /* A&C Reference Numer - Info is in the high nibble */
5047         de_gmm_service_type,    /* Service Type */
5048         NULL /* no associated data */,  /* Cell Notification */
5049         de_gmm_ps_lcs_cap,      /* PS LCS Capability */
5050         de_gmm_net_feat_supp,   /* Network Feature Support */
5051         de_gmm_rat_info_container, /* Inter RAT information container */
5052         de_gmm_req_ms_info, /* Requested MS information */
5053     NULL, /* UE network capability */
5054     de_gmm_eutran_irat_info_container, /* E-UTRAN inter RAT information container */
5055     de_gmm_voice_domain_pref, /* Voice domain preference and UE's usage setting */
5056         /* Session Management Information Elements 10.5.6 */
5057         de_sm_apn,              /* Access Point Name */
5058         de_sm_nsapi,            /* Network Service Access Point Identifier */
5059         de_sm_pco,              /* Protocol Configuration Options */
5060         de_sm_pdp_addr,         /* Packet Data Protocol Address */
5061         de_sm_qos,              /* Quality Of Service */
5062         de_sm_cause,            /* SM Cause */
5063         de_sm_cause_2,          /* SM Cause 2 */
5064         de_sm_linked_ti,        /* Linked TI */
5065         de_sm_sapi,             /* LLC Service Access Point Identifier */
5066         de_sm_tear_down,        /* Tear Down Indicator */
5067         de_sm_pflow_id,         /* Packet Flow Identifier */
5068         de_sm_tflow_temp,       /* Traffic Flow Template */
5069         de_sm_tmgi,             /* Temporary Mobile Group Identity (TMGI) */
5070         de_sm_mbms_bearer_cap,  /* MBMS bearer capabilities */
5071         de_sm_mbms_prot_conf_opt,       /* MBMS protocol configuration options */
5072         de_sm_enh_nsapi,        /* Enhanced network service access point identifier */
5073         de_sm_req_type,         /* Request type */
5074         de_sm_notif_ind,        /* Notification indicator */
5075         /* GPRS Common Information Elements 10.5.7 */
5076         de_gc_context_stat,     /* PDP Context Status */
5077         de_gc_radio_prio,       /* Radio Priority */
5078         de_gc_timer,            /* GPRS Timer */
5079         de_gc_timer2,           /* GPRS Timer 2 */
5080         de_gc_radio_prio2,      /* Radio Priority 2 */
5081         de_gc_mbms_context_stat,/* 10.5.7.6 MBMS context status */
5082         de_gc_uplink_data_stat, /* 10.5.7.7 Uplink data status */
5083         NULL,   /* NONE */
5084 };
5085
5086 /* MESSAGE FUNCTIONS */
5087
5088 /*
5089  * [7] 9.4.1
5090  */
5091 static void
5092 dtap_gmm_attach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5093 {
5094         guint32 curr_offset;
5095         guint32 consumed;
5096         guint   curr_len;
5097
5098         curr_offset = offset;
5099         curr_len = len;
5100
5101         pinfo->p2p_dir = P2P_DIR_RECV;
5102
5103         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP, NULL);
5104
5105         /* Included in attach type
5106
5107         ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, NULL);
5108         curr_offset--;
5109         curr_len++;
5110         */
5111
5112         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_ATTACH_TYPE, NULL);
5113
5114         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_DRX_PARAM, NULL);
5115
5116         ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MID , NULL);
5117
5118         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAI, " - Old routing area identification");
5119
5120         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
5121
5122         ELEM_OPT_TV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, " - Old P-TMSI Signature");
5123
5124         ELEM_OPT_TV( 0x17 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER , " - Ready Timer" );
5125
5126         ELEM_OPT_TV_SHORT( 0x90 , GSM_A_PDU_TYPE_GM, DE_TMSI_STAT , NULL);
5127
5128         ELEM_OPT_TLV( 0x33 , GSM_A_PDU_TYPE_GM, DE_PS_LCS_CAP , NULL);
5129
5130         ELEM_OPT_TLV(0x11, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL);
5131
5132         ELEM_OPT_TLV(0x20, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_3, NULL);
5133
5134         ELEM_OPT_TLV(0x40, GSM_A_PDU_TYPE_DTAP, DE_SUP_CODEC_LIST, NULL);
5135
5136         ELEM_OPT_TLV(0x58, NAS_PDU_TYPE_EMM, DE_EMM_UE_NET_CAP, NULL);
5137
5138         ELEM_OPT_TLV(0x1A, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Additional mobile identity");
5139
5140         ELEM_OPT_TLV(0x1B, GSM_A_PDU_TYPE_GM, DE_RAI_2, " - Additional old routing area identification");
5141
5142         ELEM_OPT_TLV(0x5D, GSM_A_PDU_TYPE_GM, DE_VOICE_DOMAIN_PREF, NULL);
5143
5144         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5145 }
5146
5147 /*
5148  * [7] 9.4.2
5149  */
5150 static void
5151 dtap_gmm_attach_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5152 {
5153         guint32 curr_offset;
5154         guint32 consumed;
5155         guint   curr_len;
5156
5157         curr_offset = offset;
5158         curr_len = len;
5159
5160         pinfo->p2p_dir = P2P_DIR_SENT;
5161
5162         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND_H, NULL);
5163         curr_len++;
5164         curr_offset--;
5165
5166         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_ATTACH_RES, NULL);
5167
5168         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, NULL);
5169
5170         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAD_PRIO_2, " - Radio priority for TOM8");
5171         curr_len++;
5172         curr_offset--;
5173
5174         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, " - Radio priority for SMS");
5175
5176         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
5177
5178         ELEM_OPT_TV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, NULL);
5179
5180         ELEM_OPT_TV( 0x17 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER , " - Negotiated Ready Timer" );
5181
5182         ELEM_OPT_TLV( 0x18 , GSM_A_PDU_TYPE_COMMON, DE_MID , " - Allocated P-TMSI" );
5183
5184         ELEM_OPT_TLV( 0x23 , GSM_A_PDU_TYPE_COMMON, DE_MID , NULL);
5185
5186         ELEM_OPT_TV( 0x25 , GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE , NULL);
5187
5188         ELEM_OPT_TLV( 0x2A , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3302" );
5189
5190         ELEM_OPT_T( 0x8C , GSM_A_PDU_TYPE_GM, DE_CELL_NOT , NULL);
5191
5192         ELEM_OPT_TLV( 0x4A , GSM_A_PDU_TYPE_COMMON, DE_PLMN_LIST , NULL);
5193
5194         ELEM_OPT_TV_SHORT( 0xB0 , GSM_A_PDU_TYPE_GM, DE_NET_FEAT_SUP , NULL);
5195
5196         ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_DTAP, DE_EMERGENCY_NUM_LIST , NULL);
5197
5198         ELEM_OPT_TV_SHORT( 0xA0 , GSM_A_PDU_TYPE_GM , DE_REQ_MS_INFO , NULL);
5199
5200         ELEM_OPT_TLV( 0x37 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3319" );
5201
5202         ELEM_OPT_TLV( 0x38 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3323" );
5203
5204         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5205 }
5206
5207 /*
5208  * [7] 9.4.3
5209  */
5210 static void
5211 dtap_gmm_attach_com(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5212 {
5213
5214         guint32 curr_offset;
5215         guint32 consumed;
5216         guint   curr_len;
5217
5218         curr_offset = offset;
5219         curr_len = len;
5220
5221         pinfo->p2p_dir = P2P_DIR_RECV;
5222
5223         ELEM_OPT_TLV(0x27, GSM_A_PDU_TYPE_GM, DE_RAT_INFO_CONTAINER, " - Inter RAT handover information");
5224
5225         ELEM_OPT_TLV(0x2B, GSM_A_PDU_TYPE_GM, DE_EUTRAN_IRAT_INFO_CONTAINER, " - E-UTRAN inter RAT handover information");
5226
5227         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5228 }
5229
5230 /*
5231  * [7] 9.4.4
5232  */
5233 static void
5234 dtap_gmm_attach_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5235 {
5236         guint32 curr_offset;
5237         guint32 consumed;
5238         guint   curr_len;
5239
5240         curr_offset = offset;
5241         curr_len = len;
5242
5243         pinfo->p2p_dir = P2P_DIR_SENT;
5244
5245         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
5246
5247         ELEM_OPT_TLV( 0x2A , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3302" );
5248
5249         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5250 }
5251
5252 /*
5253  * [7] 9.4.5
5254  */
5255 static void
5256 dtap_gmm_detach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5257 {
5258         guint32 curr_offset;
5259         guint32 consumed;
5260         guint   curr_len;
5261
5262         curr_offset = offset;
5263         curr_len = len;
5264
5265         pinfo->p2p_dir = P2P_DIR_SENT;
5266
5267         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND_H, NULL);
5268         /* Force to standy might be wrong - To decode it correct, we need the direction */
5269         curr_len++;
5270         curr_offset--;
5271
5272         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_DETACH_TYPE, NULL);
5273
5274         ELEM_OPT_TV( 0x25 , GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE , NULL);
5275
5276         ELEM_OPT_TLV( 0x18 , GSM_A_PDU_TYPE_COMMON, DE_MID , " - P-TMSI" );
5277
5278         ELEM_OPT_TLV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG_2 , NULL);
5279
5280         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5281 }
5282
5283 /*
5284  * [7] 9.4.6
5285  */
5286 static void
5287 dtap_gmm_detach_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5288 {
5289         guint32 curr_offset;
5290         guint32 consumed;
5291         guint   curr_len;
5292
5293         curr_offset = offset;
5294         curr_len = len;
5295
5296         pinfo->p2p_dir = P2P_DIR_RECV;
5297
5298         if ( curr_len != 0 )
5299         {
5300                 ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, NULL);
5301                 curr_len++;
5302                 curr_offset--;
5303
5304                 ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, NULL);
5305         }
5306
5307         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5308 }
5309
5310 /*
5311  * [7] 9.4.7
5312  */
5313 static void
5314 dtap_gmm_ptmsi_realloc_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5315 {
5316         guint32 curr_offset;
5317         guint32 consumed;
5318         guint   curr_len;
5319
5320         curr_offset = offset;
5321         curr_len = len;
5322
5323         pinfo->p2p_dir = P2P_DIR_SENT;
5324
5325         ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MID , " - Allocated P-TMSI" );
5326
5327         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
5328
5329         ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, NULL);
5330         curr_len++;
5331         curr_offset--;
5332
5333         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, NULL);
5334
5335         ELEM_OPT_TV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG , " - P-TMSI Signature" );
5336
5337         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5338 }
5339
5340 /*
5341  * [7] 9.4.8
5342  */
5343 static void
5344 dtap_gmm_ptmsi_realloc_com(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5345 {
5346         guint32 curr_offset;
5347 /*    guint32   consumed; */
5348         guint   curr_len;
5349
5350         curr_offset = offset;
5351         curr_len = len;
5352
5353         pinfo->p2p_dir = P2P_DIR_RECV;
5354
5355         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5356 }
5357
5358 /*
5359  * [7] 9.4.9
5360  */
5361 static void
5362 dtap_gmm_auth_ciph_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5363 {
5364         guint32 curr_offset;
5365         guint32 consumed;
5366         guint   curr_len;
5367         guint8  oct;
5368
5369         curr_offset = offset;
5370         curr_len = len;
5371
5372         pinfo->p2p_dir = P2P_DIR_SENT;
5373
5374         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_IMEISV_REQ, NULL);
5375         curr_offset--;
5376         curr_len++;
5377
5378         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_CIPH_ALG, NULL);
5379
5380         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_AC_REF_NUM_H, NULL);
5381         curr_offset--;
5382         curr_len++;
5383
5384         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, NULL);
5385
5386         ELEM_OPT_TV( 0x21 , GSM_A_PDU_TYPE_DTAP, DE_AUTH_PARAM_RAND , NULL);
5387
5388 #if 0
5389         ELEM_OPT_TV_SHORT( 0x08 , GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM , NULL);
5390 #else
5391         if ( curr_len > 0 )
5392         {
5393                 oct = tvb_get_guint8(tvb, curr_offset);
5394                 if (( oct & 0xf0 ) == 0x80 )
5395                 {
5396                         /* The ciphering key sequence number is added here */
5397                         proto_tree_add_text(tree,
5398                                 tvb, curr_offset, 1,
5399                                 "Ciphering key sequence number: 0x%02x (%u)",
5400                                 oct&7,
5401                                 oct&7);
5402                         curr_offset++;
5403                         curr_len--;
5404                 }
5405         }
5406 #endif
5407
5408         if ( curr_len == 0  )
5409         {
5410                 EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5411         return;
5412         }
5413
5414         ELEM_OPT_TLV( 0x28 , GSM_A_PDU_TYPE_DTAP, DE_AUTH_PARAM_AUTN , NULL);
5415
5416         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5417 }
5418
5419 /*
5420  * [7] 9.4.10
5421  */
5422 static void
5423 dtap_gmm_auth_ciph_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5424 {
5425         guint32 curr_offset;
5426         guint32 consumed;
5427         guint   curr_len;
5428
5429         curr_offset = offset;
5430         curr_len = len;
5431
5432         pinfo->p2p_dir = P2P_DIR_RECV;
5433
5434         ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, NULL);
5435         curr_offset--;
5436         curr_len++;
5437
5438         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_AC_REF_NUM, NULL);
5439
5440         ELEM_OPT_TV( 0x22 , GSM_A_PDU_TYPE_DTAP, DE_AUTH_RESP_PARAM , NULL);
5441
5442         ELEM_OPT_TLV( 0x23 , GSM_A_PDU_TYPE_COMMON, DE_MID , " - IMEISV" );
5443
5444         ELEM_OPT_TLV( 0x29 , GSM_A_PDU_TYPE_DTAP, DE_AUTH_RESP_PARAM_EXT , NULL);
5445
5446         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5447 }
5448
5449 /*
5450  * [7] 9.4.11
5451  */
5452 static void
5453 dtap_gmm_auth_ciph_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5454 {
5455         guint32 curr_offset;
5456         guint   curr_len;
5457
5458         curr_offset = offset;
5459         curr_len = len;
5460
5461         pinfo->p2p_dir = P2P_DIR_SENT;
5462
5463         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5464 }
5465
5466 /*
5467  * [7] 9.4.10a
5468  */
5469 static void
5470 dtap_gmm_auth_ciph_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5471 {
5472         guint32 curr_offset;
5473         guint32 consumed;
5474         guint   curr_len;
5475
5476         curr_offset = offset;
5477         curr_len = len;
5478
5479         pinfo->p2p_dir = P2P_DIR_RECV;
5480
5481         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
5482
5483         ELEM_OPT_TLV( 0x30 , GSM_A_PDU_TYPE_DTAP, DE_AUTH_FAIL_PARAM , NULL);
5484
5485         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5486 }
5487
5488 /*
5489  * [7] 9.4.12
5490  */
5491 static void
5492 dtap_gmm_ident_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5493 {
5494         guint32 curr_offset;
5495         guint   curr_len;
5496
5497         curr_offset = offset;
5498         curr_len = len;
5499
5500         pinfo->p2p_dir = P2P_DIR_SENT;
5501
5502 /*  If the half octect that are about to get decoded is the LAST in the octetstream, the macro will call return BEFORE we get a chance to fix the index. The end result will be that the first half-octet will be decoded but not the last. */
5503 #if 0
5504         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_ID_TYPE_2, NULL);
5505         curr_offset--;
5506         curr_len++;
5507         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND_H, NULL);
5508 #endif
5509
5510         elem_v(tvb, tree, pinfo, GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND_H, curr_offset, NULL);
5511         elem_v(tvb, tree, pinfo, GSM_A_PDU_TYPE_GM, DE_ID_TYPE_2, curr_offset, NULL);
5512
5513         curr_offset+=1;
5514         curr_len-=1;
5515
5516         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5517 }
5518
5519 /*
5520  * [7] 9.4.13
5521  */
5522 static void
5523 dtap_gmm_ident_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5524 {
5525         guint32 curr_offset;
5526         guint32 consumed;
5527         guint   curr_len;
5528
5529         curr_offset = offset;
5530         curr_len = len;
5531
5532         pinfo->p2p_dir = P2P_DIR_RECV;
5533
5534         ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MID , NULL);
5535
5536         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5537 }
5538
5539 /*
5540  * [7] 9.4.14
5541  */
5542 static void
5543 dtap_gmm_rau_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5544 {
5545         guint32 curr_offset;
5546         guint32 consumed;
5547         guint   curr_len;
5548
5549         curr_offset = offset;
5550         curr_len = len;
5551
5552         pinfo->p2p_dir = P2P_DIR_RECV;
5553
5554         /* is included in update type
5555         ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, NULL);
5556         curr_offset--;
5557         curr_len++;
5558         */
5559
5560         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_UPD_TYPE, NULL);
5561
5562         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAI, " - Old routing area identification");
5563
5564         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
5565
5566         ELEM_OPT_TV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG , " - Old P-TMSI Signature" );
5567
5568         ELEM_OPT_TV( 0x17 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER , " - Requested Ready Timer" );
5569
5570         ELEM_OPT_TV( 0x27 , GSM_A_PDU_TYPE_GM, DE_DRX_PARAM , NULL);
5571
5572         ELEM_OPT_TV_SHORT( 0x90 , GSM_A_PDU_TYPE_GM, DE_TMSI_STAT , NULL);
5573
5574         ELEM_OPT_TLV( 0x18 , GSM_A_PDU_TYPE_COMMON, DE_MID , " - P-TMSI" );
5575
5576         ELEM_OPT_TLV( 0x31 , GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP , NULL);
5577
5578         ELEM_OPT_TLV( 0x32 , GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT , NULL);
5579
5580         ELEM_OPT_TLV( 0x33 , GSM_A_PDU_TYPE_GM, DE_PS_LCS_CAP , NULL);
5581
5582         ELEM_OPT_TLV(0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS, NULL);
5583
5584         ELEM_OPT_TLV(0x58, NAS_PDU_TYPE_EMM, DE_EMM_UE_NET_CAP, NULL);
5585
5586         ELEM_OPT_TLV(0x1A, GSM_A_PDU_TYPE_COMMON, DE_MID, " - Additional mobile identity");
5587
5588         ELEM_OPT_TLV(0x1B, GSM_A_PDU_TYPE_GM, DE_RAI_2, " - Additional old routing area identification");
5589
5590         ELEM_OPT_TLV(0x11, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL);
5591
5592         ELEM_OPT_TLV(0x20, GSM_A_PDU_TYPE_COMMON, DE_MS_CM_3, NULL);
5593
5594         ELEM_OPT_TLV(0x40, GSM_A_PDU_TYPE_DTAP, DE_SUP_CODEC_LIST, NULL);
5595
5596         ELEM_OPT_TLV(0x5D, GSM_A_PDU_TYPE_GM, DE_VOICE_DOMAIN_PREF, NULL);
5597
5598         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5599 }
5600
5601 /*
5602  * [7] 9.4.15
5603  */
5604 static void
5605 dtap_gmm_rau_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5606 {
5607         guint32 curr_offset;
5608         guint32 consumed;
5609         guint   curr_len;
5610
5611         curr_offset = offset;
5612         curr_len = len;
5613
5614         pinfo->p2p_dir = P2P_DIR_SENT;
5615
5616         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_UPD_RES, NULL);
5617         curr_offset--;
5618         curr_len++;
5619
5620         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, NULL);
5621
5622         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - Periodic RA update timer");
5623
5624         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
5625
5626         ELEM_OPT_TV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG , NULL);
5627
5628         ELEM_OPT_TLV( 0x18 , GSM_A_PDU_TYPE_COMMON, DE_MID , " - Allocated P-TMSI");
5629
5630         ELEM_OPT_TLV( 0x23 , GSM_A_PDU_TYPE_COMMON, DE_MID , " - MS identity");
5631
5632         ELEM_OPT_TLV( 0x26 , GSM_A_PDU_TYPE_GM, DE_REC_N_PDU_NUM_LIST , NULL);
5633
5634         ELEM_OPT_TV( 0x17 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER , " - Negotiated Ready Timer" );
5635
5636         ELEM_OPT_TV( 0x25 , GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE , NULL);
5637
5638         ELEM_OPT_TLV( 0x2A , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3302" );
5639
5640         ELEM_OPT_T( 0x8C , GSM_A_PDU_TYPE_GM, DE_CELL_NOT , NULL);
5641
5642         ELEM_OPT_TLV( 0x4A , GSM_A_PDU_TYPE_COMMON, DE_PLMN_LIST , NULL);
5643
5644         ELEM_OPT_TLV( 0x32 , GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT , NULL);
5645
5646         ELEM_OPT_TV_SHORT ( 0xB0 , GSM_A_PDU_TYPE_GM, DE_NET_FEAT_SUP , NULL);
5647
5648         ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_DTAP, DE_EMERGENCY_NUM_LIST , NULL);
5649
5650         ELEM_OPT_TLV(0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS , NULL);
5651
5652         ELEM_OPT_TV_SHORT(0xA0 , GSM_A_PDU_TYPE_GM , DE_REQ_MS_INFO , NULL);
5653
5654         ELEM_OPT_TLV(0x37 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3319");
5655
5656         ELEM_OPT_TLV(0x38 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3323");
5657
5658         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5659 }
5660
5661 /*
5662  * [7] 9.4.16
5663  */
5664 static void
5665 dtap_gmm_rau_com(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5666 {
5667         guint32 curr_offset;
5668         guint32 consumed;
5669         guint   curr_len;
5670
5671         curr_offset = offset;
5672         curr_len = len;
5673
5674         pinfo->p2p_dir = P2P_DIR_RECV;
5675         /* [7] 10.5.5.11 */
5676         ELEM_OPT_TLV( 0x26 , GSM_A_PDU_TYPE_GM, DE_REC_N_PDU_NUM_LIST , NULL);
5677         /* Inter RAT information container 10.5.5.24 TS 24.008 version 6.8.0 Release 6 */
5678         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_RAT_INFO_CONTAINER , " - Inter RAT handover information");
5679
5680         ELEM_OPT_TLV(0x2B, GSM_A_PDU_TYPE_GM, DE_EUTRAN_IRAT_INFO_CONTAINER, " - E-UTRAN inter RAT handover information");
5681
5682         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5683 }
5684
5685 /*
5686  * [7] 9.4.17
5687  */
5688 static void
5689 dtap_gmm_rau_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5690 {
5691         guint32 curr_offset;
5692         guint32 consumed;
5693         guint   curr_len;
5694
5695         curr_offset = offset;
5696         curr_len = len;
5697
5698         pinfo->p2p_dir = P2P_DIR_SENT;
5699
5700         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
5701
5702         ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_SPARE_NIBBLE, NULL);
5703         curr_offset--;
5704         curr_len++;
5705
5706         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_FORCE_TO_STAND, NULL);
5707
5708         ELEM_OPT_TLV( 0x26 , GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2 , " - T3302" );
5709
5710         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5711 }
5712
5713 /*
5714  * [7] 9.4.18
5715  */
5716 static void
5717 dtap_gmm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5718 {
5719         guint32 curr_offset;
5720         guint32 consumed;
5721         guint   curr_len;
5722
5723         curr_offset = offset;
5724         curr_len = len;
5725
5726         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
5727
5728         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
5729
5730         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5731 }
5732
5733 /*
5734  * [8] 9.4.19 GMM Information
5735  */
5736 static void
5737 dtap_gmm_information(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5738 {
5739         guint32 curr_offset;
5740         guint32 consumed;
5741         guint   curr_len;
5742
5743         curr_offset = offset;
5744         curr_len = len;
5745
5746         pinfo->p2p_dir = P2P_DIR_SENT;
5747
5748         ELEM_OPT_TLV( 0x43 , GSM_A_PDU_TYPE_DTAP, DE_NETWORK_NAME , " - Full Name" );
5749
5750         ELEM_OPT_TLV( 0x45 , GSM_A_PDU_TYPE_DTAP, DE_NETWORK_NAME , " - Short Name" );
5751
5752         ELEM_OPT_TV( 0x46 , GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE , NULL);
5753
5754         ELEM_OPT_TV( 0x47 , GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE_TIME , NULL);
5755
5756         ELEM_OPT_TLV( 0x48 , GSM_A_PDU_TYPE_DTAP, DE_LSA_ID , NULL);
5757
5758         ELEM_OPT_TLV( 0x49 , GSM_A_PDU_TYPE_DTAP, DE_DAY_SAVING_TIME , NULL);
5759
5760         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5761 }
5762
5763 /*
5764  * [7] 9.4.20
5765  */
5766 static void
5767 dtap_gmm_service_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5768 {
5769         guint32 curr_offset;
5770         guint32 consumed;
5771         guint   curr_len;
5772
5773         curr_offset = offset;
5774         curr_len = len;
5775
5776         pinfo->p2p_dir = P2P_DIR_RECV;
5777
5778         /* Is included in SRVC TYPE
5779         ELEM_MAND_V(GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, NULL);
5780         curr_offset--;
5781         curr_len++;
5782         */
5783
5784         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SRVC_TYPE, NULL);
5785
5786         /* P-TMSI Mobile station identity 10.5.1.4 M LV 6 */
5787         ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MID, NULL);
5788
5789         ELEM_OPT_TLV( 0x32 , GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT , NULL);
5790
5791         /* MBMS context status 10.5.7.6 TLV 2 - 18 */
5792         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS , NULL);
5793
5794         ELEM_OPT_TLV(0x36, GSM_A_PDU_TYPE_GM, DE_UPLINK_DATA_STATUS, NULL);
5795
5796         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5797 }
5798
5799 /*
5800  * [7] 9.4.21
5801  */
5802 static void
5803 dtap_gmm_service_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5804 {
5805         guint32 curr_offset;
5806         guint32 consumed;
5807         guint   curr_len;
5808
5809         curr_offset = offset;
5810         curr_len = len;
5811
5812         pinfo->p2p_dir = P2P_DIR_SENT;
5813
5814         ELEM_OPT_TLV( 0x32 , GSM_A_PDU_TYPE_GM, DE_PDP_CONTEXT_STAT , NULL);
5815
5816         /* MBMS context status 10.5.7.6 TLV 2 - 18 */
5817         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS , NULL);
5818
5819         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5820 }
5821
5822 /*
5823  * [7] 9.4.22
5824  */
5825 static void
5826 dtap_gmm_service_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5827 {
5828         guint32 curr_offset;
5829         guint32 consumed;
5830         guint   curr_len;
5831
5832         curr_offset = offset;
5833         curr_len = len;
5834
5835         pinfo->p2p_dir = P2P_DIR_SENT;
5836
5837         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GMM_CAUSE, NULL);
5838
5839         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5840 }
5841
5842 /*
5843  * [8] 9.5.1 Activate PDP context request
5844  * Direction:                   MS to network
5845  */
5846 static void
5847 dtap_sm_act_pdp_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5848 {
5849         guint32 curr_offset;
5850         guint32 consumed;
5851         guint   curr_len;
5852
5853         curr_offset = offset;
5854         curr_len = len;
5855
5856         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
5857         /* MS to network */
5858         pinfo->link_dir = P2P_DIR_UL;
5859
5860         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_NET_SAPI, " - Requested NSAPI");
5861
5862         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI");
5863
5864         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_QOS , " - Requested QoS" );
5865
5866         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR , " - Requested PDP address" );
5867
5868         ELEM_OPT_TLV( 0x28 , GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME , NULL);
5869
5870         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
5871
5872         ELEM_OPT_TV_SHORT(0xA0, GSM_A_PDU_TYPE_GM, DE_REQ_TYPE, NULL);
5873
5874         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5875 }
5876
5877 /*
5878  * [9] 9.5.2 Activate PDP context accept
5879  * Direction:                   network to MS
5880  */
5881 static void
5882 dtap_sm_act_pdp_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5883 {
5884         guint32 curr_offset;
5885         guint32 consumed;
5886         guint   curr_len;
5887
5888         curr_offset = offset;
5889         curr_len = len;
5890
5891         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
5892         /* Network to MS*/
5893         pinfo->link_dir = P2P_DIR_DL;
5894
5895         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Negotiated LLC SAPI");
5896
5897         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_QOS , " - Negotiated QoS" );
5898
5899 #if 0
5900         /* This is done automatically */
5901         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SPARE, NULL);
5902         curr_offset--;
5903         curr_len++;
5904 #endif
5905
5906         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, NULL);
5907
5908         ELEM_OPT_TLV( 0x2B , GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR , " - PDP address");
5909
5910         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
5911
5912         ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
5913
5914         ELEM_OPT_TLV( 0x39 , GSM_A_PDU_TYPE_GM, DE_SM_CAUSE_2, " - SM cause");
5915
5916         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5917 }
5918
5919 /*
5920  * [8] 9.5.3 Activate PDP context reject
5921  * Direction:                   network to MS
5922  */
5923 static void
5924 dtap_sm_act_pdp_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5925 {
5926         guint32 curr_offset;
5927         guint32 consumed;
5928         guint   curr_len;
5929
5930         curr_offset = offset;
5931         curr_len = len;
5932
5933         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
5934         /* Network to MS*/
5935         pinfo->link_dir = P2P_DIR_DL;
5936
5937         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
5938
5939         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
5940
5941         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5942 }
5943
5944 /*
5945  * [8] 9.5.4 Activate Secondary PDP Context Request
5946  * Direction:                   MS to network
5947  */
5948 static void
5949 dtap_sm_act_sec_pdp_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5950 {
5951         guint32 curr_offset;
5952         guint32 consumed;
5953         guint   curr_len;
5954
5955         curr_offset = offset;
5956         curr_len = len;
5957
5958         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
5959         /* MS to Network */
5960         pinfo->link_dir = P2P_DIR_UL;
5961
5962         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_NET_SAPI, " - Requested NSAPI");
5963
5964         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI");
5965
5966         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_QOS , " - Requested QoS" );
5967
5968         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_LINKED_TI , NULL);
5969
5970         /* 3GPP TS 24.008 version 6.8.0 Release 6, 36 TFT Traffic Flow Template 10.5.6.12 O TLV 3-257 */
5971         ELEM_OPT_TLV( 0x36 , GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE , NULL);
5972
5973         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
5974
5975         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5976 }
5977
5978 /*
5979  * [7] 9.5.5    Activate Secondary PDP Context Accept
5980  * Direction:                   network to MS
5981  */
5982 static void
5983 dtap_sm_act_sec_pdp_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5984 {
5985         guint32 curr_offset;
5986         guint32 consumed;
5987         guint   curr_len;
5988
5989         curr_offset = offset;
5990         curr_len = len;
5991
5992         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
5993         /* Network to MS*/
5994         pinfo->link_dir = P2P_DIR_DL;
5995
5996         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Negotiated LLC SAPI");
5997
5998         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_QOS , " - Negotiated QoS" );
5999
6000         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_RAD_PRIO, NULL);
6001
6002 #if 0
6003         /* This is done automatically */
6004         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SPARE, NULL);
6005         curr_offset--;
6006         curr_len++;
6007 #endif
6008
6009         ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
6010
6011         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6012
6013         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6014 }
6015
6016 /*
6017  * [8] 9.5.6 Activate Secondary PDP Context Reject
6018  * Direction:                   network to MS
6019  */
6020 static void
6021 dtap_sm_act_sec_pdp_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6022 {
6023         guint32 curr_offset;
6024         guint32 consumed;
6025         guint   curr_len;
6026
6027         curr_offset = offset;
6028         curr_len = len;
6029
6030         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6031         /* Network to MS*/
6032         pinfo->link_dir = P2P_DIR_DL;
6033
6034         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6035
6036         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6037
6038         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6039 }
6040
6041 /*
6042  * [8] 9.5.7 Request PDP context activation
6043  * Direction:                   network to MS
6044  */
6045 static void
6046 dtap_sm_req_pdp_act(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6047 {
6048         guint32 curr_offset;
6049         guint32 consumed;
6050         guint   curr_len;
6051
6052         curr_offset = offset;
6053         curr_len = len;
6054
6055         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6056         /* Network to MS*/
6057         pinfo->link_dir = P2P_DIR_DL;
6058
6059         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR , " - Offered PDP address" );
6060
6061         ELEM_OPT_TLV( 0x28 , GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME , NULL);
6062
6063         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6064
6065         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6066 }
6067
6068 /*
6069  * [8] 9.5.8 Request PDP context activation reject
6070  * Direction:                   MS to network
6071  */
6072 static void
6073 dtap_sm_req_pdp_act_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6074 {
6075         guint32 curr_offset;
6076         guint32 consumed;
6077         guint   curr_len;
6078
6079         curr_offset = offset;
6080         curr_len = len;
6081
6082         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6083         /* MS to  Network */
6084         pinfo->link_dir = P2P_DIR_UL;
6085
6086         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6087
6088         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6089
6090         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6091 }
6092
6093 /*
6094  * [8] 9.5.9 Modify PDP context request (Network to MS direction)
6095  * Direction:                   network to MS
6096  */
6097 static void
6098 dtap_sm_mod_pdp_req_net(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6099 {
6100         guint32 curr_offset;
6101         guint32 consumed;
6102         guint   curr_len;
6103
6104         curr_offset = offset;
6105         curr_len = len;
6106
6107         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6108         /* Network to MS */
6109         pinfo->link_dir = P2P_DIR_DL;
6110
6111         ELEM_MAND_V(GSM_A_PDU_TYPE_GM,DE_RAD_PRIO, NULL);
6112 #if 0
6113         /* This is done automatically */
6114         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SPARE, NULL);
6115         curr_offset--;
6116         curr_len++;
6117 #endif
6118
6119         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI");
6120
6121         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_QOS , " - New QoS" );
6122
6123         ELEM_OPT_TLV( 0x2B , GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR , " - PDP address");
6124
6125         ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
6126
6127         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6128
6129         ELEM_OPT_TLV(0x36 , GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE , NULL);
6130
6131         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6132 }
6133
6134 /*
6135  * [8] 9.5.10 Modify PDP context request (MS to network direction)
6136  * Direction:                   MS to network
6137  */
6138 static void
6139 dtap_sm_mod_pdp_req_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6140 {
6141         guint32 curr_offset;
6142         guint32 consumed;
6143         guint   curr_len;
6144
6145         curr_offset = offset;
6146         curr_len = len;
6147
6148         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6149         /* MS to Network */
6150         pinfo->link_dir = P2P_DIR_UL;
6151
6152         ELEM_OPT_TV( 0x32 , GSM_A_PDU_TYPE_GM, DE_LLC_SAPI , " - Requested LLC SAPI" );
6153
6154         ELEM_OPT_TLV( 0x30 , GSM_A_PDU_TYPE_GM, DE_QOS , " - Requested new QoS" );
6155
6156         ELEM_OPT_TLV( 0x31 , GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE , " - New TFT" );
6157
6158         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6159
6160         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6161 }
6162
6163 /*
6164  * [8] 9.5.11 Modify PDP context accept (MS to network direction)
6165  * Direction:                   MS to network
6166  */
6167 static void
6168 dtap_sm_mod_pdp_acc_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6169 {
6170         guint32 curr_offset;
6171         guint32 consumed;
6172         guint   curr_len;
6173
6174         curr_offset = offset;
6175         curr_len = len;
6176
6177         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6178         /* MS to Network */
6179         pinfo->link_dir = P2P_DIR_UL;
6180
6181         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6182
6183         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6184 }
6185
6186 /*
6187  * [8] 9.5.12 Modify PDP context accept (Network to MS direction)
6188  * Direction:                   Network to MS
6189  */
6190 static void
6191 dtap_sm_mod_pdp_acc_net(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6192 {
6193         guint32 curr_offset;
6194         guint32 consumed;
6195         guint   curr_len;
6196
6197         curr_offset = offset;
6198         curr_len = len;
6199
6200         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6201         /* Network to MS */
6202         pinfo->link_dir = P2P_DIR_DL;
6203
6204         ELEM_OPT_TLV( 0x30 , GSM_A_PDU_TYPE_GM, DE_QOS , " - Negotiated QoS" );
6205
6206         ELEM_OPT_TV( 0x32 , GSM_A_PDU_TYPE_GM, DE_LLC_SAPI , " - Negotiated LLC SAPI" );
6207
6208         ELEM_OPT_TV_SHORT ( 0x80 , GSM_A_PDU_TYPE_GM , DE_RAD_PRIO , " - New radio priority" );
6209
6210         ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
6211
6212         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6213
6214         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6215 }
6216
6217 /*
6218  * [8] 9.5.13 Modify PDP Context Reject
6219  * Direction:                   both
6220  */
6221 static void
6222 dtap_sm_mod_pdp_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6223 {
6224         guint32 curr_offset;
6225         guint32 consumed;
6226         guint   curr_len;
6227
6228         curr_offset = offset;
6229         curr_len = len;
6230
6231         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6232         /* Network or the MS */
6233         pinfo->link_dir = LINK_DIR_UNKNOWN;
6234
6235
6236         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6237
6238         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6239
6240         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6241 }
6242
6243 /*
6244  * [8] 9.5.14 Deactivate PDP context request
6245  * Direction:                   both
6246  */
6247 static void
6248 dtap_sm_deact_pdp_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6249 {
6250         guint32 curr_offset;
6251         guint32 consumed;
6252         guint   curr_len;
6253
6254         curr_offset = offset;
6255         curr_len = len;
6256
6257         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6258         pinfo->link_dir = LINK_DIR_UNKNOWN;
6259
6260         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6261
6262         ELEM_OPT_TV_SHORT( 0x90 , GSM_A_PDU_TYPE_GM , DE_TEAR_DOWN_IND , NULL);
6263
6264         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6265
6266         /* MBMS context status 10.5.7.6 TLV 2 - 18 */
6267         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS , NULL);
6268
6269         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6270 }
6271
6272 /*
6273  * [8] 9.5.15 Deactivate PDP context accept
6274  * Direction:                   both
6275  */
6276 static void
6277 dtap_sm_deact_pdp_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6278 {
6279         guint32 curr_offset;
6280         guint32 consumed;
6281         guint   curr_len;
6282
6283         curr_offset = offset;
6284         curr_len = len;
6285
6286         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6287         pinfo->link_dir = LINK_DIR_UNKNOWN;
6288
6289         ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL);
6290
6291         /* MBMS context status 10.5.7.6 TLV 2 - 18 */
6292         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_CTX_STATUS , NULL);
6293
6294         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6295 }
6296
6297 /*
6298  * [8] 9.5.15a Request Secondary PDP Context Activation
6299  * Direction:                   network to MS
6300  */
6301 static void
6302 dtap_sm_req_sec_pdp_act(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6303 {
6304         guint32 curr_offset;
6305         guint32 consumed;
6306         guint   curr_len;
6307
6308         curr_offset = offset;
6309         curr_len = len;
6310
6311         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6312         pinfo->link_dir = P2P_DIR_DL;
6313
6314         /* Required QoS Quality of service 10.5.6.5 M LV 13-17 */
6315         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_QOS , " - Required QoS");
6316
6317         /* Linked TI Linked TI 10.5.6.7 M LV 2-3 */
6318         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_LINKED_TI , NULL);
6319
6320         /* 36 TFT Traffic Flow Template 10.5.6.12 O TLV 3-257 */
6321         ELEM_OPT_TLV(0x36, GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE, NULL);
6322
6323         /* 27 Protocol configuration options Protocol configuration options 10.5.6.3 O TLV 3 - 253 */
6324         ELEM_OPT_TLV(0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
6325
6326         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6327 }
6328
6329 /*
6330  * [8] 9.5.15b Request Secondary PDP Context Activation Reject
6331  * Direction:                   MS to network
6332  */
6333 static void
6334 dtap_sm_req_sec_pdp_act_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6335 {
6336         guint32 curr_offset;
6337         guint32 consumed;
6338         guint   curr_len;
6339
6340         curr_offset = offset;
6341         curr_len = len;
6342
6343         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6344         pinfo->link_dir = P2P_DIR_UL;
6345
6346         /* SM cause SM cause 10.5.6.6 M V 1 */
6347         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6348
6349         /* 27 Protocol configuration options Protocol configuration options 10.5.6.3 O TLV 3 - 253 */
6350         ELEM_OPT_TLV(0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
6351
6352         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6353 }
6354
6355 /*
6356  * [8] 9.5.16a Notification
6357  * Direction:                   network to MS
6358  */
6359 static void
6360 dtap_sm_notif(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6361 {
6362         guint32 curr_offset;
6363         guint32 consumed;
6364         guint   curr_len;
6365
6366         curr_offset = offset;
6367         curr_len = len;
6368
6369         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6370         pinfo->link_dir = P2P_DIR_DL;
6371
6372         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_SM_NOTIF_IND, NULL);
6373
6374         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6375 }
6376
6377 /*
6378  * [8] 9.5.21 SM Status
6379  * Direction:                   both
6380  */
6381 static void
6382 dtap_sm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6383 {
6384         guint32 curr_offset;
6385         guint32 consumed;
6386         guint   curr_len;
6387
6388         curr_offset = offset;
6389         curr_len = len;
6390
6391         pinfo->p2p_dir = P2P_DIR_UNKNOWN;
6392         pinfo->link_dir = LINK_DIR_UNKNOWN;
6393
6394         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6395
6396         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6397 }
6398
6399 /*
6400  * [9] 9.5.22 Activate MBMS Context Request
6401  * Direction:                   MS to network
6402  */
6403 static void
6404 dtap_sm_act_mbms_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6405 {
6406         guint32 curr_offset;
6407         guint32 consumed;
6408         guint   curr_len;
6409
6410         curr_offset = offset;
6411         curr_len = len;
6412
6413         pinfo->p2p_dir = P2P_DIR_RECV;
6414
6415         /* Requested MBMS NSAPI Enhanced Network service access point identifier 10.5.6.16 M V */
6416         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_ENH_NSAPI, " - Requested MBMS NSAPI");
6417
6418         /* Requested LLC SAPI LLC service access point identifier 10.5.6.9 M V 1 */
6419         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Requested LLC SAPI");
6420
6421         /* Supported MBMS bearer capabilities MBMS bearer capabilities 10.5.6.14 M LV 2 - 3 */
6422         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_MBMS_BEARER_CAP , NULL );
6423
6424         /* Requested multicast address Packet data protocol address 10.5.6.4 M LV 3 - 19 */
6425         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR , " - Requested multicast address" );
6426
6427         /* Access point name Access point name 10.5.6.1 M LV 2 - 101 */
6428         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME , NULL );
6429
6430         /* 35 MBMS protocol configuration options MBMS protocol configuration options 10.5.6.15 O TLV 3 - 253 */
6431         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT , NULL);
6432
6433         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6434 }
6435
6436 /*
6437  * [9] 9.5.23 Activate MBMS Context Accept
6438  * Direction:                   network to MS
6439  */
6440 static void
6441 dtap_sm_act_mbms_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6442 {
6443         guint32 curr_offset;
6444         guint32 consumed;
6445         guint   curr_len;
6446
6447         curr_offset = offset;
6448         curr_len = len;
6449
6450         pinfo->p2p_dir = P2P_DIR_SENT;
6451
6452         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
6453
6454         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_LLC_SAPI, " - Negotiated LLC SAPI");
6455
6456         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT , NULL);
6457
6458         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6459 }
6460
6461 /*
6462  * [9] 9.5.24 Activate MBMS Context Reject
6463  * Direction:                   network to MS
6464  */
6465 static void
6466 dtap_sm_act_mbms_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6467 {
6468         guint32 curr_offset;
6469         guint32 consumed;
6470         guint   curr_len;
6471
6472         curr_offset = offset;
6473         curr_len = len;
6474
6475         pinfo->p2p_dir = P2P_DIR_SENT;
6476
6477         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6478
6479         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT , NULL);
6480
6481         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6482 }
6483
6484 /*
6485  * [9] 9.5.25 Request MBMS Context Activation
6486  * Direction:                   network to MS
6487  */
6488 static void
6489 dtap_sm_req_mbms_act(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6490 {
6491         guint32 curr_offset;
6492         guint32 consumed;
6493         guint   curr_len;
6494
6495         curr_offset = offset;
6496         curr_len = len;
6497
6498         pinfo->p2p_dir = P2P_DIR_SENT;
6499
6500         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_NET_SAPI, " - Linked NSAPI");
6501
6502         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_PD_PRO_ADDR , " - Offered multicast address" );
6503
6504         ELEM_MAND_LV(GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME , NULL );
6505
6506         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT , NULL);
6507
6508         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6509 }
6510
6511 /*
6512  * [8] 9.5.26 Request MBMS Context Activation Reject
6513  * Direction:                   MS to network
6514  */
6515 static void
6516 dtap_sm_req_mbms_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
6517 {
6518         guint32 curr_offset;
6519         guint32 consumed;
6520         guint   curr_len;
6521
6522         curr_offset = offset;
6523         curr_len = len;
6524
6525         pinfo->p2p_dir = P2P_DIR_RECV;
6526
6527         ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
6528
6529         ELEM_OPT_TLV( 0x35 , GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT , NULL);
6530
6531         EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
6532 }
6533
6534 #define NUM_GSM_DTAP_MSG_GMM (sizeof(gsm_a_dtap_msg_gmm_strings)/sizeof(value_string))
6535 static gint ett_gsm_dtap_msg_gmm[NUM_GSM_DTAP_MSG_GMM];
6536 static void (*dtap_msg_gmm_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) = {
6537         dtap_gmm_attach_req,            /* Attach Request */
6538         dtap_gmm_attach_acc,            /* Attach Accept */
6539         dtap_gmm_attach_com,            /* Attach Complete */
6540         dtap_gmm_attach_rej,            /* Attach Reject */
6541         dtap_gmm_detach_req,            /* Detach Request */
6542         dtap_gmm_detach_acc,            /* Detach Accept */
6543         dtap_gmm_rau_req,                       /* Routing Area Update Request */
6544         dtap_gmm_rau_acc,                       /* Routing Area Update Accept */
6545         dtap_gmm_rau_com,                       /* Routing Area Update Complete */
6546         dtap_gmm_rau_rej,                       /* Routing Area Update Reject */
6547         dtap_gmm_service_req,           /* Service Request */
6548         dtap_gmm_service_acc,           /* Service Accept */
6549         dtap_gmm_service_rej,           /* Service Reject */
6550         dtap_gmm_ptmsi_realloc_cmd,     /* P-TMSI Reallocation Command */
6551         dtap_gmm_ptmsi_realloc_com,     /* P-TMSI Reallocation Complete */
6552         dtap_gmm_auth_ciph_req,         /* Authentication and Ciphering Req */
6553         dtap_gmm_auth_ciph_resp,        /* Authentication and Ciphering Resp */
6554         dtap_gmm_auth_ciph_rej,         /* Authentication and Ciphering Rej */
6555         dtap_gmm_auth_ciph_fail,        /* Authentication and Ciphering Failure */
6556         dtap_gmm_ident_req,                     /* Identity Request */
6557         dtap_gmm_ident_res,                     /* Identity Response */
6558         dtap_gmm_status,                        /* GMM Status */
6559         dtap_gmm_information,           /* GMM Information */
6560         NULL,   /* NONE */
6561 };
6562
6563 #define NUM_GSM_DTAP_MSG_SM (sizeof(gsm_a_dtap_msg_sm_strings)/sizeof(value_string))
6564 static gint ett_gsm_dtap_msg_sm[NUM_GSM_DTAP_MSG_SM];
6565 static void (*dtap_msg_sm_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) = {
6566         dtap_sm_act_pdp_req,            /* Activate PDP Context Request */
6567         dtap_sm_act_pdp_acc,            /* Activate PDP Context Accept */
6568         dtap_sm_act_pdp_rej,            /* Activate PDP Context Reject */
6569         dtap_sm_req_pdp_act,            /* Request PDP Context Activation */
6570         dtap_sm_req_pdp_act_rej,        /* Request PDP Context Activation rej. */
6571         dtap_sm_deact_pdp_req,          /* Deactivate PDP Context Request */
6572         dtap_sm_deact_pdp_acc,          /* Deactivate PDP Context Accept */
6573         dtap_sm_mod_pdp_req_net,        /* Modify PDP Context Request(Network to MS direction) */
6574         dtap_sm_mod_pdp_acc_ms,         /* Modify PDP Context Accept (MS to network direction) */
6575         dtap_sm_mod_pdp_req_ms,         /* Modify PDP Context Request(MS to network direction) */
6576         dtap_sm_mod_pdp_acc_net,        /* Modify PDP Context Accept (Network to MS direction) */
6577         dtap_sm_mod_pdp_rej,            /* Modify PDP Context Reject */
6578         dtap_sm_act_sec_pdp_req,        /* Activate Secondary PDP Context Request */
6579         dtap_sm_act_sec_pdp_acc,        /* Activate Secondary PDP Context Accept */
6580         dtap_sm_act_sec_pdp_rej,        /* Activate Secondary PDP Context Reject */
6581         NULL,                                           /* Reserved: was allocated in earlier phases of the protocol */
6582         NULL,                                           /* Reserved: was allocated in earlier phases of the protocol */
6583         NULL,                                           /* Reserved: was allocated in earlier phases of the protocol */
6584         NULL,                                           /* Reserved: was allocated in earlier phases of the protocol */
6585         NULL,                                           /* Reserved: was allocated in earlier phases of the protocol */
6586         dtap_sm_status,                         /* SM Status */
6587         dtap_sm_act_mbms_req,           /* Activate MBMS Context Request */
6588         dtap_sm_act_mbms_acc,           /* Activate MBMS Context Accept */
6589         dtap_sm_act_mbms_rej,           /* Activate MBMS Context Reject */
6590         dtap_sm_req_mbms_act,           /* Request MBMS Context Activation */
6591         dtap_sm_req_mbms_rej,           /* Request MBMS Context Activation Reject */
6592         dtap_sm_req_sec_pdp_act,        /* Request Secondary PDP Context Activation */
6593         dtap_sm_req_sec_pdp_act_rej,/* Request Secondary PDP Context Activation Reject */
6594         dtap_sm_notif,              /* Notification */
6595         NULL,   /* NONE */
6596 };
6597
6598 void get_gmm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *dtap_msg_fcn)
6599 {
6600         gint                    idx;
6601
6602         *msg_str = match_strval_idx((guint32) (oct & DTAP_GMM_IEI_MASK), gsm_a_dtap_msg_gmm_strings, &idx);
6603         *ett_tree = ett_gsm_dtap_msg_gmm[idx];
6604         *hf_idx = hf_gsm_a_dtap_msg_gmm_type;
6605         *dtap_msg_fcn = dtap_msg_gmm_fcn[idx];
6606
6607         return;
6608 }
6609
6610 void get_sm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *dtap_msg_fcn)
6611 {
6612         gint                    idx;
6613
6614         *msg_str = match_strval_idx((guint32) (oct & DTAP_SM_IEI_MASK), gsm_a_dtap_msg_sm_strings, &idx);
6615         *ett_tree = ett_gsm_dtap_msg_sm[idx];
6616         *hf_idx = hf_gsm_a_dtap_msg_sm_type;
6617         *dtap_msg_fcn = dtap_msg_sm_fcn[idx];
6618
6619         return;
6620 }
6621
6622 /* Register the protocol with Wireshark */
6623 void
6624 proto_register_gsm_a_gm(void)
6625 {
6626         guint           i;
6627         guint           last_offset;
6628
6629         /* Setup list of header fields */
6630
6631         static hf_register_info hf[] =
6632         {
6633         { &hf_gsm_a_dtap_msg_gmm_type,
6634                 { "DTAP GPRS Mobility Management Message Type", "gsm_a.dtap_msg_gmm_type",
6635                   FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_gmm_strings), 0x0,
6636                   NULL, HFILL }
6637         },
6638         { &hf_gsm_a_dtap_msg_sm_type,
6639                 { "DTAP GPRS Session Management Message Type",  "gsm_a.dtap_msg_sm_type",
6640                   FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_sm_strings), 0x0,
6641                   NULL, HFILL }
6642         },
6643         { &hf_gsm_a_gm_elem_id,
6644                 { "Element ID", "gsm_a_gm.elem_id",
6645                 FT_UINT8, BASE_DEC, NULL, 0,
6646                 NULL, HFILL }
6647         },
6648         { &hf_gsm_a_qos_delay_cls,
6649                 { "Quality of Service Delay class", "gsm_a.qos.delay_cls",
6650                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_delay_cls_vals), 0x38,
6651                   NULL, HFILL }
6652         },
6653         { &hf_gsm_a_qos_reliability_cls,
6654                 { "Reliability class", "gsm_a.qos.delay_cls",
6655                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_delay_cls_vals), 0x07,
6656                   NULL, HFILL }
6657         },
6658         { &hf_gsm_a_qos_traffic_cls,
6659                 { "Traffic class", "gsm_a.qos.traffic_cls",
6660                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traffic_cls_vals), 0xe0,
6661                   NULL, HFILL }
6662         },
6663         { &hf_gsm_a_qos_del_order,
6664                 { "Delivery order", "gsm_a.qos.del_order",
6665                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_del_order_vals), 0x18,
6666                   NULL, HFILL }
6667         },
6668         { &hf_gsm_a_qos_del_of_err_sdu,
6669                 { "Delivery of erroneous SDUs", "gsm_a.qos.del_of_err_sdu",
6670                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_del_of_err_sdu_vals), 0x07,
6671                   NULL, HFILL }
6672         },
6673         { &hf_gsm_a_qos_ber,
6674                 { "Residual Bit Error Rate (BER)", "gsm_a.qos.ber",
6675                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_ber_vals), 0xf0,
6676                   NULL, HFILL }
6677         },
6678         { &hf_gsm_a_qos_sdu_err_rat,
6679                 { "SDU error ratio", "gsm_a.qos.sdu_err_rat",
6680                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_sdu_err_rat_vals), 0x0f,
6681                   NULL, HFILL }
6682         },
6683         { &hf_gsm_a_qos_traff_hdl_pri,
6684                 { "Traffic handling priority", "gsm_a.qos.traff_hdl_pri",
6685                   FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traff_hdl_pri_vals), 0x03,
6686                   NULL, HFILL }
6687         },
6688         { &hf_gsm_a_gmm_split_on_ccch,
6689                 { "SPLIT on CCCH","gsm_a.gmm.split_on_ccch",
6690                   FT_BOOLEAN, 8, TFS(&gsm_a_gmm_split_on_ccch_value), 0x08,
6691                   NULL, HFILL }
6692         },
6693         { &hf_gsm_a_gmm_non_drx_timer,
6694                 { "Non-DRX timer","gsm_a.gmm.non_drx_timer",
6695                   FT_UINT8, BASE_DEC, VALS(gsm_a_gmm_non_drx_timer_strings), 0x07,
6696                   NULL, HFILL }
6697         },
6698         { &hf_gsm_a_gmm_cn_spec_drs_cycle_len_coef,
6699                 { "CN Specific DRX cycle length coefficient","gsm_a.gmm.cn_spec_drs_cycle_len_coef",
6700                   FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_gmm_cn_spec_drs_cycle_len_coef_strings), 0xf0,
6701                   NULL, HFILL }
6702         },
6703         { &hf_gsm_a_tft_op_code,
6704                 { "TFT operation code", "gsm_a.tft.op_code",
6705                   FT_UINT8, BASE_DEC, VALS(gsm_a_tft_op_code_vals), 0xe0,
6706                   NULL, HFILL }
6707         },
6708         { &hf_gsm_a_tft_e_bit,
6709                 { "E bit","gsm_a.tft.e_bit",
6710                   FT_BOOLEAN, 8, TFS(&gsm_a_tft_e_bit), 0x10,
6711                   NULL, HFILL }
6712         },
6713         { &hf_gsm_a_tft_pkt_flt,
6714                 { "Number of packet filters", "gsm_a.tft.pkt_flt",
6715                   FT_UINT8, BASE_DEC, NULL, 0x0f,
6716                   NULL, HFILL }
6717         },
6718         { &hf_gsm_a_tft_pkt_flt_dir,
6719                 { "Packet filter direction", "gsm_a.tft.pkt_flt_dir",
6720                   FT_UINT8, BASE_DEC, VALS(gsm_a_tft_pkt_flt_dir_vals), 0x30,
6721                   NULL, HFILL }
6722         },
6723         { &hf_gsm_a_tft_pkt_flt_id,
6724                 { "Packet filter identifier", "gsm_a.tft.pkt_flt_id",
6725                   FT_UINT8, BASE_DEC, NULL, 0x0f,
6726                   NULL, HFILL }
6727         },
6728         { &hf_gsm_a_sm_ip4_address,
6729                 { "IPv4 address", "gsm_a.sm.ip4_address",
6730                   FT_IPv4, BASE_NONE, NULL, 0x0,
6731                 NULL, HFILL }
6732         },
6733         { &hf_gsm_a_sm_ip4_mask,
6734                 { "IPv4 address mask", "gsm_a.sm.ip4_mask",
6735                   FT_IPv4, BASE_NONE, NULL, 0x0,
6736                 NULL, HFILL }
6737         },
6738         { &hf_gsm_a_sm_ip6_address,
6739                 { "IPv6 address", "gsm_a.sm.ip6_address",
6740                   FT_IPv6, BASE_NONE, NULL, 0x0,
6741                 NULL, HFILL }
6742         },
6743         { &hf_gsm_a_sm_ip6_mask,
6744                 { "IPv6 address mask", "gsm_a.sm.ip6_mask",
6745                   FT_IPv6, BASE_NONE, NULL, 0x0,
6746                 NULL, HFILL }
6747         },
6748         { &hf_gsm_a_tft_protocol_header,
6749                 { "Protocol/header", "gsm_a.tft.protocol_header",
6750                   FT_UINT8, BASE_HEX, NULL, 0x0,
6751                 NULL, HFILL }
6752         },
6753         { &hf_gsm_a_tft_port,
6754                 { "Port", "gsm_a.tft.port",
6755                   FT_UINT16, BASE_DEC, NULL, 0x0,
6756                 NULL, HFILL }
6757         },
6758         { &hf_gsm_a_tft_port_low,
6759                 { "Low limit port", "gsm_a.tft.port_low",
6760                   FT_UINT16, BASE_DEC, NULL, 0x0,
6761                 NULL, HFILL }
6762         },
6763         { &hf_gsm_a_tft_port_high,
6764                 { "High limit port", "gsm_a.tft.port_high",
6765                   FT_UINT16, BASE_DEC, NULL, 0x0,
6766                 NULL, HFILL }
6767         },
6768         { &hf_gsm_a_tft_security,
6769                 { "IPSec security parameter index", "gsm_a.tft.security",
6770                   FT_UINT32, BASE_HEX, NULL, 0x0,
6771                 NULL, HFILL }
6772         },
6773         { &hf_gsm_a_tft_traffic_mask,
6774                 { "Mask field", "gsm_a.tft.traffic_mask",
6775                   FT_UINT8, BASE_HEX, NULL, 0x0,
6776                 NULL, HFILL }
6777         },
6778         { &hf_gsm_a_tft_flow_label_type,
6779                 { "Flow Label Type", "gsm_a.tft.flow_label_type",
6780                   FT_UINT24, BASE_HEX, NULL, 0x0FFFFF,
6781                 NULL, HFILL }
6782         },
6783         { &hf_gsm_a_tft_param_id,
6784                 { "Parameter identifier", "gsm_a.tft.param_id",
6785                   FT_UINT8, BASE_DEC, VALS(gsm_a_tft_param_id_vals), 0x0,
6786                   NULL, HFILL }
6787         },
6788         { &hf_gsm_a_ptmsi_sig,
6789                 { "P-TMSI Signature", "gsm_a.ptmsi_sig",
6790                   FT_UINT24, BASE_HEX, NULL, 0x0,
6791                 NULL, HFILL }
6792         },
6793         { &hf_gsm_a_ptmsi_sig2,
6794                 { "P-TMSI Signature 2", "gsm_a.ptmsi_sig2",
6795                   FT_UINT24, BASE_HEX, NULL, 0x0,
6796                 NULL, HFILL }
6797         },
6798         { &hf_gsm_a_gm_acc_tech_type,
6799                 { "Access Technology Type", "gsm_a.gm.acc_tech_type",
6800                   FT_UINT8, BASE_DEC, VALS(gsm_a_gm_acc_tech_type_vals), 0x0,
6801                 NULL, HFILL }
6802         },
6803         { &hf_gsm_a_gm_acc_cap_struct_len,
6804                 { "Length in bits", "gsm_a.gm.acc_cap_struct_len",
6805                   FT_UINT8, BASE_HEX_DEC,NULL, 0x0,
6806                 NULL, HFILL }
6807         },
6808         { &hf_gsm_a_gm_sms_value,
6809                 { "SMS_VALUE (Switch-Measure-Switch)", "gsm_a.gm.sms",
6810                   FT_UINT8, BASE_DEC, VALS(gsm_a_sms_vals), 0x0,
6811                 NULL, HFILL }
6812         },
6813         { &hf_gsm_a_gm_sm_value,
6814                 { "(SM_VALUE) Switch-Measure", "gsm_a.gm.sm",
6815                   FT_UINT8, BASE_DEC, VALS(gsm_a_sms_vals), 0x0,
6816                 NULL, HFILL }
6817         },
6818         { &hf_gsm_a_gm_sm_ext,
6819                 { "Ext", "gsm_a.gm.sm.ext",
6820                   FT_UINT8, BASE_HEX, NULL, 0x80,
6821                 NULL, HFILL }
6822         },
6823         { &hf_gsm_a_gm_link_dir,
6824                 { "Link direction", "gsm_a.gm.link_dir",
6825                   FT_INT32, BASE_DEC, VALS(gsm_a_gm_link_dir_vals), 0x0,
6826                 NULL, HFILL }
6827         },
6828         { &hf_gsm_a_gm_cause,
6829                 { "gmm Cause", "gsm_a.gm.cause",
6830                   FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gmm_cause_vals), 0x0,
6831                 NULL, HFILL }
6832         },
6833         { &hf_gsm_a_gm_fop,
6834                 { "Follow-on proceed", "gsm_a.gm.fop",
6835                 FT_BOOLEAN, 8, NULL, 0x08,
6836                 NULL, HFILL }
6837         },
6838         { &hf_gsm_a_gm_res_of_attach,
6839                 { "Result of attach", "gsm_a.gm.res_of_attach",
6840                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_res_of_attach_vals), 0x07,
6841                 NULL, HFILL }
6842         },
6843         { &hf_gsm_a_gm_type_of_ciph_alg,
6844                 { "Type of ciphering algorithm", "gsm_a.gm.type_of_ciph_alg",
6845                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_ciph_alg_vals), 0x07,
6846                 NULL, HFILL }
6847         },
6848         { &hf_gsm_a_gm_imeisv_req,
6849                 { "IMEISV request", "gsm_a.gm.imeisv_req",
6850                 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_gm_imeisv_req_vals), 0x00,
6851                 NULL, HFILL }
6852         },
6853         { &hf_gsm_a_gm_ac_ref_nr,
6854                 { "A&C reference number", "gsm_a.gm.ac_ref_nr",
6855                   FT_UINT8, BASE_DEC, NULL, 0x0,
6856                 NULL, HFILL }
6857         },
6858         { &hf_gsm_a_gm_force_to_standby,
6859                 { "Force to standby", "gsm_a.gm.force_to_standby",
6860                 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_gm_force_to_standby_vals), 0x00,
6861                 NULL, HFILL }
6862         },
6863         { &hf_gsm_a_gm_ciph_key_seq_num,
6864                 { "Ciphering key sequence number", "gsm_a.gm.ciph_key_seq_num",
6865                 FT_UINT8, BASE_DEC, NULL, 0x00,
6866                 NULL, HFILL }
6867         },
6868         { &hf_gsm_a_gm_serv_type,
6869                 { "Service type", "gsm_a.gm.serv_type",
6870                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_serv_type_vals), 0x00,
6871                 NULL, HFILL }
6872         },
6873         { &hf_gsm_a_gm_for,
6874                 { "Follow-on request pending", "gsm_a.gm.for",
6875                 FT_BOOLEAN, 8, NULL, 0x08,
6876                 NULL, HFILL }
6877         },
6878         { &hf_gsm_a_gm_type_of_attach,
6879                 { "Type of attach", "gsm_a.gm.type_of_attach",
6880                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_attach_vals), 0x07,
6881                 NULL, HFILL }
6882         },
6883         { &hf_gsm_a_gm_tmsi_flag,
6884                 { "TMSI flag", "gsm_a.gm.tmsi_flag",
6885                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_tmsi_flag_value), 0x01,
6886                 NULL, HFILL }
6887         },
6888         { &hf_gsm_a_gm_update_type,
6889                 { "Update type", "gsm_a.gm.update_type",
6890                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_update_type_vals), 0x07,
6891                 NULL, HFILL }
6892         },
6893         { &hf_gsm_a_gm_gprs_timer_unit,
6894                 { "Unit", "gsm_a.gm.gprs_timer_unit",
6895                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_gprs_timer_unit_vals), 0xe0,
6896                 NULL, HFILL }
6897         },
6898         { &hf_gsm_a_gm_gprs_timer_value,
6899                 { "Timer value", "gsm_a.gm.gprs_timer_value",
6900                 FT_UINT8, BASE_DEC, NULL, 0x1f,
6901                 NULL, HFILL }
6902         },
6903         { &hf_gsm_a_gm_nsapi_5_ul_stat,
6904                 { "NSAPI(5) uplink status", "gsm_a.gm.nsapi_5_ul_stat",
6905                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6906                 NULL, HFILL }
6907         },
6908         { &hf_gsm_a_gm_nsapi_6_ul_stat,
6909                 { "NSAPI(6) uplink status", "gsm_a.gm.nsapi_6_ul_stat",
6910                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6911                 NULL, HFILL }
6912         },
6913         { &hf_gsm_a_gm_nsapi_7_ul_stat,
6914                 { "NSAPI(7) uplink status", "gsm_a.gm.nsapi_7_ul_stat",
6915                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6916                 NULL, HFILL }
6917         },
6918         { &hf_gsm_a_gm_nsapi_8_ul_stat,
6919                 { "NSAPI(8) uplink status", "gsm_a.gm.nsapi_8_ul_stat",
6920                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6921                 NULL, HFILL }
6922         },
6923         { &hf_gsm_a_gm_nsapi_9_ul_stat,
6924                 { "NSAPI(9) uplink status", "gsm_a.gm.nsapi_9_ul_stat",
6925                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6926                 NULL, HFILL }
6927         },
6928         { &hf_gsm_a_gm_nsapi_10_ul_stat,
6929                 { "NSAPI(10) uplink status", "gsm_a.gm.nsapi_10_ul_stat",
6930                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6931                 NULL, HFILL }
6932         },
6933         { &hf_gsm_a_gm_nsapi_11_ul_stat,
6934                 { "NSAPI(11) uplink status", "gsm_a.gm.nsapi_11_ul_stat",
6935                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6936                 NULL, HFILL }
6937         },
6938         { &hf_gsm_a_gm_nsapi_12_ul_stat,
6939                 { "NSAPI(12) uplink status", "gsm_a.gm.nsapi_12_ul_stat",
6940                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6941                 NULL, HFILL }
6942         },
6943         { &hf_gsm_a_gm_nsapi_13_ul_stat,
6944                 { "NSAPI(13) uplink status", "gsm_a.gm.nsapi_13_ul_stat",
6945                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6946                 NULL, HFILL }
6947         },
6948         { &hf_gsm_a_gm_nsapi_14_ul_stat,
6949                 { "NSAPI(14) uplink status", "gsm_a.gm.nsapi_14_ul_stat",
6950                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6951                 NULL, HFILL }
6952         },
6953         { &hf_gsm_a_gm_nsapi_15_ul_stat,
6954                 { "NSAPI(15) uplink status", "gsm_a.gm.nsapi_15_ul_stat",
6955                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_nsapi_ul_stat_vals), 0x0,
6956                 NULL, HFILL }
6957         },
6958         { &hf_gsm_a_gm_pco_pid,
6959                 { "Protocol or Container ID", "gsm_a.gm.pco_pid",
6960                 FT_UINT16, BASE_DEC, NULL, 0x0,
6961                 NULL, HFILL }
6962         },
6963         { &hf_gsm_a_gm_type_of_identity,
6964                 { "Type of identity", "gsm_a.gm.type_of_identity",
6965                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_type_of_identity_vals), 0x07,
6966                 NULL, HFILL }
6967         },
6968         { &hf_gsm_a_gm_rac,
6969                 { "Routing Area Code (RAC)","gsm_a.gm.rac",
6970                 FT_UINT8, BASE_HEX_DEC, NULL, 0x00,
6971                 NULL, HFILL }
6972         },
6973         { &hf_gsm_a_gm_apc,
6974                 { "APC","gsm_a.gm.apc",
6975                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_apc_vals), 0x20,
6976                 NULL, HFILL }
6977         },
6978         { &hf_gsm_a_gm_otd_a,
6979                 { "OTD-A","gsm_a.gm.otd_a",
6980                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_otd_a_vals), 0x10,
6981                 NULL, HFILL }
6982         },
6983         { &hf_gsm_a_gm_otd_b,
6984                 { "OTD-B","gsm_a.gm.otd_b",
6985                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_otd_b_vals), 0x08,
6986                 NULL, HFILL }
6987         },
6988         { &hf_gsm_a_gm_gps_a,
6989                 { "GPS-A","gsm_a.gm.gps_a",
6990                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_gps_a_vals), 0x04,
6991                 NULL, HFILL }
6992         },
6993         { &hf_gsm_a_gm_gps_b,
6994                 { "GPS-B","gsm_a.gm.gps_b",
6995                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_gps_b_vals), 0x02,
6996                 NULL, HFILL }
6997         },
6998         { &hf_gsm_a_gm_gps_c,
6999                 { "GPS-C","gsm_a.gm.gps_c",
7000                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_gps_c_vals), 0x01,
7001                 NULL, HFILL }
7002         },
7003         { &hf_gsm_a_gm_req_ms_info_irat,
7004                 { "I-RAT","gsm_a.gm.req_ms_info_irat",
7005                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_req_ms_info_irat_vals), 0x0,
7006                 NULL, HFILL }
7007         },
7008         { &hf_gsm_a_gm_req_ms_info_irat2,
7009                 { "I-RAT2","gsm_a.gm.req_ms_info_irat2",
7010                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_req_ms_info_irat2_vals), 0x0,
7011                 NULL, HFILL }
7012         },
7013         { &hf_gsm_a_gm_ue_usage_setting,
7014                 { "UE's usage setting","gsm_a.gm.ue_usage_setting",
7015                 FT_BOOLEAN, 8, TFS(&gsm_a_gm_ue_usage_setting_vals), 0x0,
7016                 NULL, HFILL }
7017         },
7018         { &hf_gsm_a_gm_voice_domain_pref_for_eutran,
7019                 { "Voice domain preference for E-UTRAN","gsm_a.gm.voice_domain_pref_for_eutran",
7020                 FT_UINT8, BASE_DEC, VALS(gsm_a_gm_voice_domain_pref_for_eutran_vals), 0x0,
7021                 NULL, HFILL }
7022         },
7023         { &hf_gsm_a_sm_pdp_type_org,
7024                 { "PDP type organization", "gsm_a.sm.pdp_type_org",
7025                 FT_UINT8, BASE_DEC, VALS(gsm_a_sm_pdp_type_org_vals), 0x0f,
7026                 NULL, HFILL }
7027         },
7028         { &hf_gsm_a_qos_mean_thr,
7029                 { "Mean throughput", "gsm_a.qos.mean_throughput",
7030                 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_qos_mean_thr_vals), 0x1f,
7031                 NULL, HFILL }
7032         },
7033         { &hf_gsm_a_qos_peak_thr,
7034                 { "Peak throughput", "gsm_a.qos.peak_throughput",
7035                 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_qos_peak_thr_vals), 0xf0,
7036                 NULL, HFILL }
7037         },
7038         { &hf_gsm_a_qos_prec_class,
7039                 { "Precedence class", "gsm_a.qos.prec_class",
7040                 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_qos_prec_class_vals), 0x07,
7041                 NULL, HFILL }
7042         },
7043         { &hf_gsm_a_qos_traf_handl_prio,
7044                 { "Traffic handling priority", "gsm_a.qos.traf_handl_prio",
7045                 FT_UINT8, BASE_DEC, NULL, 0x03,
7046                 NULL, HFILL }
7047         },
7048         { &hf_gsm_a_qos_trans_delay,
7049                 { "Transfer delay", "gsm_a.qos.trans_delay",
7050                 FT_UINT8, BASE_DEC, NULL, 0xfc,
7051                 NULL, HFILL }
7052         },
7053         { &hf_gsm_a_qos_signalling_ind,
7054                 { "Signalling indication", "gsm_a.qos.signalling_ind",
7055                 FT_BOOLEAN, 8, TFS(&gsm_a_qos_signalling_ind_value), 0x10,
7056                 NULL, HFILL }
7057         },
7058         { &hf_gsm_a_qos_source_stat_desc,
7059                 { "Source statistics description", "gsm_a.qos.source_stat_desc",
7060                 FT_UINT8, BASE_DEC, NULL, 0x0f,
7061                 NULL, HFILL }
7062         },
7063         { &hf_gsm_a_qos_max_bitrate_upl,
7064                 { "Maximum bitrate for uplink", "gsm_a.qos.max_bitrate_upl",
7065                   FT_UINT8, BASE_DEC, NULL, 0x0,
7066                 NULL, HFILL }
7067         },
7068         { &hf_gsm_a_qos_max_bitrate_downl,
7069                 { "Maximum bitrate for downlink", "gsm_a.qos.max_bitrate_downl",
7070                   FT_UINT8, BASE_DEC, NULL, 0x0,
7071                 NULL, HFILL }
7072         },
7073         { &hf_gsm_a_qos_guar_bitrate_upl,
7074                 { "Guaranteed bitrate for uplink", "gsm_a.qos.guar_bitrate_upl",
7075                   FT_UINT8, BASE_DEC, NULL, 0x0,
7076                 NULL, HFILL }
7077         },
7078         { &hf_gsm_a_qos_guar_bitrate_downl,
7079                 { "Guaranteed bitrate for downlink", "gsm_a.qos.guar_bitrate_downl",
7080                   FT_UINT8, BASE_DEC, NULL, 0x0,
7081                 NULL, HFILL }
7082         },
7083         { &hf_gsm_a_qos_max_bitrate_upl_ext,
7084                 { "Maximum bitrate for uplink (extended)", "gsm_a.qos.max_bitrate_upl_ext",
7085                   FT_UINT8, BASE_DEC, NULL, 0x0,
7086                 NULL, HFILL }
7087         },
7088         { &hf_gsm_a_qos_max_bitrate_downl_ext,
7089                 { "Maximum bitrate for downlink (extended)", "gsm_a.qos.max_bitrate_downl_ext",
7090                   FT_UINT8, BASE_DEC, NULL, 0x0,
7091                 NULL, HFILL }
7092         },
7093         { &hf_gsm_a_qos_guar_bitrate_upl_ext,
7094                 { "Guaranteed bitrate for uplink (extended)", "gsm_a.qos.guar_bitrate_upl_ext",
7095                   FT_UINT8, BASE_DEC, NULL, 0x0,
7096                 NULL, HFILL }
7097         },
7098         { &hf_gsm_a_qos_guar_bitrate_downl_ext,
7099                 { "Guaranteed bitrate for downlink (extended)", "gsm_a.qos.guar_bitrate_downl_ext",
7100                   FT_UINT8, BASE_DEC, NULL, 0x0,
7101                 NULL, HFILL }
7102         },
7103         { &hf_gsm_a_sm_cause,
7104                 { "SM Cause", "gsm_a.sm.cause",
7105                   FT_UINT8, BASE_DEC, NULL, 0x0,
7106                 NULL, HFILL }
7107         },
7108         { &hf_gsm_a_sm_cause_2,
7109                 { "SM Cause 2", "gsm_a.sm.cause_2",
7110                   FT_UINT8, BASE_DEC, NULL, 0x0,
7111                 NULL, HFILL }
7112         },
7113         { &hf_gsm_a_sm_llc_sapi,
7114                 { "LLC SAPI", "gsm_a.sm.llc_sapi",
7115                 FT_UINT8, BASE_DEC, VALS(gsm_a_sm_llc_sapi_vals), 0x0f,
7116                 NULL, HFILL }
7117         },
7118         { &hf_gsm_a_sm_tdi,
7119                 { "Tear Down Indicator (TDI)", "gsm_a.sm.tdi",
7120                 FT_BOOLEAN, 8, TFS(&gsm_a_sm_tdi_value), 0x01,
7121                 NULL, HFILL }
7122         },
7123         { &hf_gsm_a_sm_packet_flow_id,
7124                 { "Packet Flow Identifier (PFI)", "gsm_a.sm.packet_flow_id",
7125                 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(gsm_a_sm_packet_flow_id_vals), 0x7f,
7126                 NULL, HFILL }
7127         },
7128         { &hf_gsm_a_gmm_net_cap_gea1,
7129                 { "GEA/1", "gsm_a.gmm.net_cap.gea1",
7130                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x80,
7131                 NULL, HFILL }
7132         },
7133         { &hf_gsm_a_gmm_net_cap_smdch,
7134                 { "SM capabilities via dedicated channels", "gsm_a.gmm.net_cap.smdch",
7135                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_smdch_vals), 0x40,
7136                 NULL, HFILL }
7137         },
7138         { &hf_gsm_a_gmm_net_cap_smgprs,
7139                 { "SM capabilities via GPRS channels", "gsm_a.gmm.net_cap.smgprs",
7140                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_smgprs_vals), 0x20,
7141                 NULL, HFILL }
7142         },
7143         { &hf_gsm_a_gmm_net_cap_ucs2,
7144                 { "UCS2 support", "gsm_a.gmm.net_cap.ucs2",
7145                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_smgprs_vals), 0x10,
7146                 NULL, HFILL }
7147         },
7148         { &hf_gsm_a_gmm_net_cap_ss_scr_ind,
7149                 { "SS Screening Indicator", "gsm_a.gmm.net_cap.ss_scr_ind",
7150                 FT_UINT8, BASE_HEX, VALS(gsm_a_gmm_net_cap_ss_scr_ind_vals), 0x0c,
7151                 NULL, HFILL }
7152         },
7153         { &hf_gsm_a_gmm_net_cap_solsa,
7154                 { "SoLSA Capability", "gsm_a.gmm.net_cap.solsa",
7155                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_solsa_vals), 0x02,
7156                 NULL, HFILL }
7157         },
7158         { &hf_gsm_a_gmm_net_cap_rev,
7159                 { "Revision level indicator", "gsm_a.gmm.net_cap.rev",
7160                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_rev_vals), 0x01,
7161                 NULL, HFILL }
7162         },
7163         { &hf_gsm_a_gmm_net_cap_pfc,
7164                 { "PFC feature mode", "gsm_a.gmm.net_cap.pfc",
7165                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_pfc_vals), 0x80,
7166                 NULL, HFILL }
7167         },
7168         { &hf_gsm_a_gmm_net_cap_ext_gea_bits,
7169                 { "Extended GEA bits", "gsm_a.gmm.net_cap.ext_gea_bits",
7170                 FT_UINT8, BASE_HEX, NULL, 0x7e,
7171                 NULL, HFILL }
7172         },
7173         { &hf_gsm_a_gmm_net_cap_gea2,
7174                 { "GEA/2", "gsm_a.gmm.net_cap.gea2",
7175                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x40,
7176                 NULL, HFILL }
7177         },
7178         { &hf_gsm_a_gmm_net_cap_gea3,
7179                 { "GEA/3", "gsm_a.gmm.net_cap.gea3",
7180                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x20,
7181                 NULL, HFILL }
7182         },
7183         { &hf_gsm_a_gmm_net_cap_gea4,
7184                 { "GEA/4", "gsm_a.gmm.net_cap.gea4",
7185                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x10,
7186                 NULL, HFILL }
7187         },
7188         { &hf_gsm_a_gmm_net_cap_gea5,
7189                 { "GEA/5", "gsm_a.gmm.net_cap.gea5",
7190                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x08,
7191                 NULL, HFILL }
7192         },
7193         { &hf_gsm_a_gmm_net_cap_gea6,
7194                 { "GEA/6", "gsm_a.gmm.net_cap.gea6",
7195                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x04,
7196                 NULL, HFILL }
7197         },
7198         { &hf_gsm_a_gmm_net_cap_gea7,
7199                 { "GEA/7", "gsm_a.gmm.net_cap.gea7",
7200                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_gea_vals), 0x02,
7201                 NULL, HFILL }
7202         },
7203         { &hf_gsm_a_gmm_net_cap_lcs,
7204                 { "LCS VA capability", "gsm_a.gmm.net_cap.lcs",
7205                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_lcs_vals), 0x01,
7206                 NULL, HFILL }
7207         },
7208         { &hf_gsm_a_gmm_net_cap_ps_irat_iu,
7209                 { "PS inter-RAT HO to UTRAN Iu mode capability", "gsm_a.gmm.net_cap.ps_irat_iu",
7210                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_ps_irat_iu_vals), 0x80,
7211                 NULL, HFILL }
7212         },
7213         { &hf_gsm_a_gmm_net_cap_ps_irat_s1,
7214                 { "PS inter-RAT HO to E-UTRAN S1 mode capability", "gsm_a.gmm.net_cap.ps_irat_s1",
7215                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_ps_irat_s1_vals), 0x40,
7216                 NULL, HFILL }
7217         },
7218         { &hf_gsm_a_gmm_net_cap_comb_proc,
7219                 { "EMM Combined procedures capability", "gsm_a.gmm.net_cap.comb_proc",
7220                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_comb_proc_vals), 0x20,
7221                 NULL, HFILL }
7222         },
7223         { &hf_gsm_a_gmm_net_cap_isr,
7224                 { "ISR support", "gsm_a.gmm.net_cap.isr",
7225                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_isr_vals), 0x10,
7226                 NULL, HFILL }
7227         },
7228         { &hf_gsm_a_gmm_net_cap_srvcc_to_geran,
7229                 { "SRVCC to GERAN/UTRAN capability", "gsm_a.gmm.net_cap.srvcc_to_geran",
7230                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_srvcc_to_geran_vals), 0x08,
7231                 NULL, HFILL }
7232         },
7233         { &hf_gsm_a_gmm_net_cap_epc,
7234                 { "EPC Capability", "gsm_a.gmm.net_cap.epc",
7235                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_epc_vals), 0x04,
7236                 NULL, HFILL }
7237         },
7238         { &hf_gsm_a_gmm_net_cap_nf,
7239                 { "NF Capability", "gsm_a.gmm.net_cap.nf",
7240                 FT_BOOLEAN, 8, TFS(&gsm_a_gmm_net_cap_nf_vals), 0x02,
7241                 NULL, HFILL }
7242         },
7243         { &hf_gsm_a_sm_tmgi,
7244                 { "Temporary Mobile Group Identity (TMGI)", "gsm_a.sm.tmgi",
7245                   FT_UINT24, BASE_HEX, NULL, 0x0,
7246                 NULL, HFILL }
7247         },
7248         { &hf_gsm_a_sm_enh_nsapi,
7249                 { "Enhanced NSAPI", "gsm_a.sm.enh_nsapi",
7250                   FT_UINT8, BASE_DEC, NULL, 0x0,
7251                 NULL, HFILL }
7252         },
7253         { &hf_gsm_a_sm_req_type,
7254                 { "Request type", "gsm_a.sm.req_type",
7255                   FT_UINT8, BASE_DEC, VALS(gsm_a_sm_req_type_vals), 0x07,
7256                 NULL, HFILL }
7257         },
7258         { &hf_gsm_a_sm_notif_ind,
7259                 { "Notification indicator value", "gsm_a.sm.notif_ind",
7260                   FT_UINT8, BASE_DEC, VALS(gsm_a_sm_notif_ind_vals), 0x0,
7261                 NULL, HFILL }
7262         },
7263         { &hf_gsm_a_gm_rac_ctrled_early_cm_sending,
7264                 { "Controlled early Classmark Sending", "gsm_a.gm.rac.comp_int_meas_cap",
7265                    FT_BOOLEAN, 8, TFS(&tfs_implemented_not_implemented), 0x0,
7266                 NULL, HFILL }
7267         },
7268         { &hf_gsm_a_gm_rac_pseudo_sync,
7269                 { "Pseudo Synchronisation", "gsm_a.gm.rac.pseudo_sync",
7270                    FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
7271                 NULL, HFILL }
7272         },
7273         { &hf_gsm_a_gm_rac_vgcs,
7274                 { "Voice Group Call Service", "gsm_a.gm.rac.vgcs",
7275                    FT_BOOLEAN, 8, TFS(&gsm_a_gm_vgcs), 0x0,
7276                 NULL, HFILL }
7277         },
7278         { &hf_gsm_a_gm_rac_vbs,
7279                 { "Voice Broadcast Service", "gsm_a.gm.rac.vbs",
7280                    FT_BOOLEAN, 8, TFS(&gsm_a_gm_vbs), 0x0,
7281                 NULL, HFILL }
7282         },
7283         { &hf_gsm_a_gm_rac_multislot_capability,
7284                 { "Multislot capability struct", "gsm_a.gm.rac.multislot_capability",
7285                    FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
7286                 NULL, HFILL }
7287         },
7288         { &hf_gsm_a_gm_rac_hscsd_multi_slot_class,
7289                 { "HSCSD multislot class", "gsm_a.gm.rac.hscsd_multi_slot_class",
7290                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
7291                 NULL, HFILL }
7292         },
7293         { &hf_gsm_a_gm_rac_gprs_multi_slot_class,
7294                 { "GPRS multislot class", "gsm_a.gm.rac.gprs_multi_slot_class",
7295                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
7296                 NULL, HFILL }
7297         },
7298         { &hf_gsm_a_gm_rac_gprs_ext_dyn_alloc_cap,
7299                 { "GPRS Extended Dynamic Allocation Capability", "gsm_a.gm.rac.gprs_ext_dyn_alloc_cap",
7300                    FT_BOOLEAN, 8, TFS(&tfs_implemented_not_implemented), 0x0,
7301                 NULL, HFILL }
7302         },
7303         { &hf_gsm_a_gm_rac_ecsd_multi_slot_class,
7304                 { "ECSD multislot class", "gsm_a.gm.rac.ecsd_multi_slot_class",
7305                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
7306                 NULL, HFILL }
7307         },
7308         { &hf_gsm_a_gm_rac_egprs_multi_slot_class,
7309                 { "EGPRS multislot class", "gsm_a.gm.rac.egprs_multi_slot_class",
7310                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_vals), 0x0,
7311                 NULL, HFILL }
7312         },
7313         { &hf_gsm_a_gm_rac_egprs_ext_dyn_alloc_cap,
7314                 { "EGPRS Extended Dynamic Allocation Capability", "gsm_a.gm.rac.egprs_ext_dyn_alloc_cap",
7315                    FT_BOOLEAN, 8, TFS(&tfs_implemented_not_implemented), 0x0,
7316                 NULL, HFILL }
7317         },
7318         { &hf_gsm_a_gm_rac_dtm_gprs_multi_slot_class,
7319                 { "DTM GPRS Multi Slot Class", "gsm_a.gm.rac.dtm_gprs_multi_slot_class",
7320                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_multi_slot_class_vals), 0x0,
7321                 NULL, HFILL }
7322         },
7323         { &hf_gsm_a_gm_rac_single_slt_dtm,
7324                 { "Single Slot DTM", "gsm_a.gm.rac.single_slt_dtm",
7325                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7326                 NULL, HFILL }
7327         },
7328         { &hf_gsm_a_gm_rac_dtm_egprs_multi_slot_cls_pres,
7329                 { "DTM EGPRS Multi Slot Class", "gsm_a.gm.rac.dtm_egprs_multi_slot_cls_pres",
7330                    FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
7331                 NULL, HFILL }
7332         },
7333         { &hf_gsm_a_gm_rac_dtm_egprs_multi_slot_class,
7334                 { "DTM EGPRS Multi Slot Class", "gsm_a.gm.rac.dtm_egprs_multi_slot_class",
7335                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_multi_slot_class_vals), 0x0,
7336                 NULL, HFILL }
7337         },
7338         { &hf_gsm_a_gm_rac_8psk_pow_cap_pres,
7339                 { "8PSK Power Capability Bits", "gsm_a.gm.rac.8psk_pow_cap_pres",
7340                    FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x0,
7341                 NULL, HFILL }
7342         },
7343         { &hf_gsm_a_gm_rac_comp_int_meas_cap,
7344                 { "COMPACT Interference Measurement Capability", "gsm_a.gm.rac.comp_int_meas_cap",
7345                    FT_BOOLEAN, 8, TFS(&tfs_implemented_not_implemented), 0x0,
7346                 NULL, HFILL }
7347         },
7348         { &hf_gsm_a_gm_rel_lev_ind,
7349                 { "Revision Level Indicator", "gsm_a.gm.rel_lev_ind",
7350                    FT_BOOLEAN, 8, TFS(&gsm_a_gm_revision_level_indicator), 0x0,
7351                 NULL, HFILL }
7352         },
7353         { &hf_gsm_a_gm_rac_umts_fdd_cap,
7354                 { "UMTS FDD Radio Access Technology Capability", "gsm_a.gm.rac.umts_fdd_cap",
7355                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7356                 NULL, HFILL }
7357         },
7358         { &hf_gsm_a_gm_rac_umts_384_tdd_ra_cap,
7359                 { "UMTS 3.84 Mcps TDD Radio Access Technology Capability", "gsm_a.gm.rac.umts_384_tdd_ra_cap",
7360                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7361                 NULL, HFILL }
7362         },
7363         { &hf_gsm_a_gm_rac_cdma2000_cap,
7364                 { "CDMA 2000 Radio Access Technology Capability", "gsm_a.gm.rac.cdma2000_cap",
7365                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7366                 NULL, HFILL }
7367         },
7368         { &hf_gsm_a_gm_rac_umts_128_tdd_ra_cap,
7369                 { "UMTS 1.28 Mcps TDD Radio Access Technology Capability", "gsm_a.gm.rac.umts_128_tdd_ra_cap",
7370                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7371                 NULL, HFILL }
7372         },
7373         { &hf_gsm_a_gm_rac_geran_feat_pkg,
7374                 { "GERAN Feature Package 1", "gsm_a.gm.rac.geran_feat_pkg",
7375                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7376                 NULL, HFILL }
7377         },
7378         { &hf_gsm_a_gm_rac_mod_based_multi_slot_class_support,
7379                 { "Modulation based multislot class support", "gsm_a.gm.rac.mod_based_multi_slot_class_support",
7380                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7381                 NULL, HFILL }
7382         },
7383         { &hf_gsm_a_gm_rac_geran_iu_mode_cap,
7384                 { "GERAN Iu mode", "gsm_a.gm.rac.geran_iu_mode_cap",
7385                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7386                 NULL, HFILL }
7387         },
7388         { &hf_gsm_a_gm_rac_flo_iu_cap,
7389                 { "FLO Iu Capability", "gsm_a.gm.rac.flo_iu_cap",
7390                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7391                 NULL, HFILL }
7392         },
7393         { &hf_gsm_a_gm_rac_mult_tbf_cap,
7394                 { "Multiple TBF Capability", "gsm_a.gm.rac.mult_tbf_cap",
7395                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7396                 NULL, HFILL }
7397         },
7398         { &hf_gsm_a_gm_rac_down_adv_rec_perf,
7399                 { "Downlink Advanced Receiver Performance", "gsm_a.gm.rac.down_adv_rec_perf",
7400                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_down_adv_rec_perf_vals), 0x0,
7401                 NULL, HFILL }
7402         },
7403         { &hf_gsm_a_gm_rac_ext_rlc_mac_ctrl_msg_seg_cap,
7404                 { "Extended RLC/MAC Control Message Segmentation Capability", "gsm_a.gm.rac.ext_rlc_mac_ctrl_msg_seg_cap",
7405                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7406                 NULL, HFILL }
7407         },
7408         { &hf_gsm_a_gm_rac_dtm_enh_cap,
7409                 { "DTM Enhancements Capability", "gsm_a.gm.rac.dtm_enh_cap",
7410                    FT_BOOLEAN, 8, TFS(&gsm_a_gm_dtm_enh_cap), 0x0,
7411                 NULL, HFILL }
7412         },
7413         { &hf_gsm_a_gm_rac_dtm_gprs_high_multi_slot_class,
7414                 { "DTM GPRS High Multi Slot Class", "gsm_a.gm.rac.dtm_gprs_high_multi_slot_class",
7415                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_high_multi_slot_class_vals), 0x0,
7416                 NULL, HFILL }
7417         },
7418         { &hf_gsm_a_gm_rac_dtm_egprs_high_multi_slot_class,
7419                 { "DTM EGPRS High Multi Slot Class", "gsm_a.gm.rac.dtm_egprs_high_multi_slot_class",
7420                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dtm_gprs_high_multi_slot_class_vals), 0x0,
7421                 NULL, HFILL }
7422         },
7423         { &hf_gsm_a_gm_rac_ps_ho_cap,
7424                 { "PS Handover Capability", "gsm_a.gm.rac.ps_ho_cap",
7425                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7426                 NULL, HFILL }
7427         },
7428         { &hf_gsm_a_gm_rac_dtm_ho_cap,
7429                 { "DTM Handover Capability", "gsm_a.gm.rac.dtm_ho_cap",
7430                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7431                 NULL, HFILL }
7432         },
7433         { &hf_gsm_a_gm_rac_multi_slot_cap_red_down_dual_carrier,
7434                 { "Multislot Capability Reduction for Downlink Dual Carrier", "gsm_a.gm.rac.multi_slot_cap_red_down_dual_carrier",
7435                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_cap_red_down_dual_carrier_vals), 0x0,
7436                 NULL, HFILL }
7437         },
7438         { &hf_gsm_a_gm_rac_down_dual_carrier_dtm_cap,
7439                 { "Downlink Dual Carrier for DTM Capability", "gsm_a.gm.rac.down_dual_carrier_dtm_cap",
7440                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7441                 NULL, HFILL }
7442         },
7443         { &hf_gsm_a_gm_rac_flex_ts_assign,
7444                 { "Flexible Timeslot Assignment", "gsm_a.gm.rac.flex_ts_assign",
7445                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7446                 NULL, HFILL }
7447         },
7448         { &hf_gsm_a_gm_rac_gan_ps_ho_cap,
7449                 { "GAN PS Handover Capability", "gsm_a.gm.rac.gan_ps_ho_cap",
7450                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7451                 NULL, HFILL }
7452         },
7453         { &hf_gsm_a_gm_rac_rlc_non_pers_mode,
7454                 { "RLC Non-persistent Mode", "gsm_a.gm.rac.rlc_non_pers_mode",
7455                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7456                 NULL, HFILL }
7457         },
7458         { &hf_gsm_a_gm_rac_reduced_lat_cap,
7459                 { "Reduced Latency Capability", "gsm_a.gm.rac.reduced_lat_cap",
7460                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7461                 NULL, HFILL }
7462         },
7463         { &hf_gsm_a_gm_rac_ul_egprs2,
7464                 { "Uplink EGPRS2", "gsm_a.gm.rac.ul_egprs2",
7465                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_ul_egprs2_vals), 0x0,
7466                 NULL, HFILL }
7467         },
7468         { &hf_gsm_a_gm_rac_dl_egprs2,
7469                 { "Downlink EGPRS2", "gsm_a.gm.rac.dl_egprs2",
7470                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_dl_egprs2_vals), 0x0,
7471                 NULL, HFILL }
7472         },
7473         { &hf_gsm_a_gm_rac_eutra_fdd_support,
7474                 { "E-UTRA FDD support", "gsm_a.gm.rac.eutra_fdd_support",
7475                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7476                 NULL, HFILL }
7477         },
7478         { &hf_gsm_a_gm_rac_eutra_tdd_support,
7479                 { "E-UTRA TDD support", "gsm_a.gm.rac.eutra_tdd_support",
7480                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7481                 NULL, HFILL }
7482         },
7483         { &hf_gsm_a_gm_rac_geran_to_eutra_support_in_geran_ptm,
7484                 { "GERAN to E-UTRA support in GERAN packet transfer mode", "gsm_a.gm.rac.geran_to_eutra_support_in_geran_ptm",
7485                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_geran_to_eutra_support_in_geran_ptm_vals), 0x0,
7486                 NULL, HFILL }
7487         },
7488         { &hf_gsm_a_gm_rac_prio_based_resel_support,
7489                 { "Priority-based reselection support", "gsm_a.gm.rac.prio_based_resel_support",
7490                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7491                 NULL, HFILL }
7492         },
7493         { &hf_gsm_a_gm_rac_alt_efta_multi_slot_class,
7494                 { "Alternative EFTA Multislot Class", "gsm_a.gm.rac.alt_efta_multi_slot_class",
7495                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_alt_efta_multi_slot_class_vals), 0x0,
7496                 NULL, HFILL }
7497         },
7498         { &hf_gsm_a_gm_rac_efta_multi_slot_cap_red_down_dual_carrier,
7499                 { "EFTA Multislot Capability Reduction for Downlink Dual Carrier", "gsm_a.gm.rac.efta_multi_slot_cap_red_down_dual_carrier",
7500                    FT_UINT8, BASE_DEC, VALS(gsm_a_gm_multi_slot_cap_red_down_dual_carrier_vals), 0x0,
7501                 NULL, HFILL }
7502         },
7503         { &hf_gsm_a_gm_rac_ind_up_layer_pdu_start_cap_for_rlc_um,
7504                 { "Indication of Upper Layer PDU Start Capability for RLC UM", "gsm_a.gm.rac.ind_up_layer_pdu_start_cap_for_rlc_um",
7505                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7506                 NULL, HFILL }
7507         },
7508         { &hf_gsm_a_gm_rac_emst_cap,
7509                 { "Enhanced Multiplexing for Single TBF Capability", "gsm_a.gm.rac.emst_cap",
7510                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7511                 NULL, HFILL }
7512         },
7513         { &hf_gsm_a_gm_rac_mtti_cap,
7514                 { "Multiple TTI Capability", "gsm_a.gm.rac.mtti_cap",
7515                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7516                 NULL, HFILL }
7517         },
7518         { &hf_gsm_a_gm_rac_utra_csg_cell_report,
7519                 { "UTRA CSG Cells Reporting", "gsm_a.gm.rac.utra_csg_cell_report",
7520                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7521                 NULL, HFILL }
7522         },
7523         { &hf_gsm_a_gm_rac_eutra_csg_cell_report,
7524                 { "E-UTRA CSG Cells Reporting", "gsm_a.gm.rac.mtti_cap",
7525                    FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x0,
7526                 NULL, HFILL }
7527         },
7528         { &hf_gsm_a_sm_ti_flag,
7529                 { "TI Flag", "gsm_a.sm.ti_flag",
7530                    FT_BOOLEAN, 8, TFS(&gsm_a_sm_ti_flag_vals), 0x80,
7531                 NULL, HFILL }
7532         },
7533         { &hf_gsm_a_sm_ext,
7534                 { "Extension", "gsm_a.sm.ext",
7535                    FT_BOOLEAN, 8, NULL, 0x80,
7536                 NULL, HFILL }
7537         },
7538 };              
7539
7540         /* Setup protocol subtree array */
7541 #define NUM_INDIVIDUAL_ELEMS    18
7542         gint *ett[NUM_INDIVIDUAL_ELEMS +
7543                   NUM_GSM_DTAP_MSG_GMM + NUM_GSM_DTAP_MSG_SM +
7544                   NUM_GSM_GM_ELEM];
7545
7546         ett[0]  = &ett_tc_component;
7547         ett[1]  = &ett_tc_invoke_id;
7548         ett[2]  = &ett_tc_linked_id;
7549         ett[3]  = &ett_tc_opr_code;
7550         ett[4]  = &ett_tc_err_code;
7551         ett[5]  = &ett_tc_prob_code;
7552         ett[6]  = &ett_tc_sequence;
7553         ett[7]  = &ett_gmm_drx;
7554         ett[8]  = &ett_gmm_detach_type;
7555         ett[9]  = &ett_gmm_attach_type;
7556         ett[10] = &ett_gmm_context_stat;
7557         ett[11] = &ett_gmm_update_type;
7558         ett[12] = &ett_gmm_radio_cap;
7559         ett[13] = &ett_gmm_rai;
7560         ett[14] = &ett_sm_tft;
7561         ett[15] = &ett_gmm_gprs_timer;
7562         ett[16] = &ett_gmm_network_cap;
7563         ett[17] = &ett_gsm_a_gm_msrac_multislot_capability;
7564
7565         last_offset = NUM_INDIVIDUAL_ELEMS;
7566
7567         for (i=0; i < NUM_GSM_DTAP_MSG_GMM; i++, last_offset++)
7568         {
7569                 ett_gsm_dtap_msg_gmm[i] = -1;
7570                 ett[last_offset] = &ett_gsm_dtap_msg_gmm[i];
7571         }
7572
7573         for (i=0; i < NUM_GSM_DTAP_MSG_SM; i++, last_offset++)
7574         {
7575                 ett_gsm_dtap_msg_sm[i] = -1;
7576                 ett[last_offset] = &ett_gsm_dtap_msg_sm[i];
7577         }
7578
7579         for (i=0; i < NUM_GSM_GM_ELEM; i++, last_offset++)
7580         {
7581                 ett_gsm_gm_elem[i] = -1;
7582                 ett[last_offset] = &ett_gsm_gm_elem[i];
7583         }
7584
7585         proto_a_gm =
7586                 proto_register_protocol("GSM A-I/F GPRS Mobility and Session Management", "GSM Management", "gsm_a_gm");
7587
7588         proto_register_field_array(proto_a_gm, hf, array_length(hf));
7589
7590         proto_register_subtree_array(ett, array_length(ett));
7591
7592         /* subdissector code */
7593         gprs_sm_pco_subdissector_table = register_dissector_table("sm_pco.protocol",
7594                 "GPRS SM PCO PPP protocol", FT_UINT16, BASE_HEX);
7595 }
7596
7597 void
7598 proto_reg_handoff_gsm_a_gm(void)
7599 {
7600         data_handle = find_dissector("data");
7601         rrc_irat_ho_info_handle = find_dissector("rrc.irat.irat_ho_info");
7602         lte_rrc_ue_eutra_cap_handle = find_dissector("lte-rrc.ue_eutra_cap");
7603 }