HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-nas_eps.c
blobe2b8ec0818a75c49537652a5c40b204735253f11
1 /* packet-nas_eps.c
2 * Routines for Non-Access-Stratum (NAS) protocol for Evolved Packet System (EPS) dissection
4 * Copyright 2008 - 2010, Anders Broman <anders.broman@ericsson.com>
6 * $Id$
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * References: 3GPP TS 24.301 V11.5.0 (2012-12)
29 #include "config.h"
31 #include <glib.h>
32 #include <epan/packet.h>
33 #include <epan/asn1.h>
34 #include <epan/prefs.h>
35 #include <epan/wmem/wmem.h>
37 #include "packet-gsm_map.h"
38 #include "packet-gsm_a_common.h"
39 #include "packet-e212.h"
40 #include "packet-lcsap.h"
42 #define PNAME "Non-Access-Stratum (NAS)PDU"
43 #define PSNAME "NAS-EPS"
44 #define PFNAME "nas-eps"
46 /* Initialize the protocol and registered fields */
47 static int proto_nas_eps = -1;
49 /* Dissector handles */
50 static dissector_handle_t gsm_a_dtap_handle;
51 static dissector_handle_t lpp_handle;
53 /* Forward declaration */
54 static void disect_nas_eps_esm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
56 static int hf_nas_eps_msg_emm_type = -1;
57 int hf_nas_eps_common_elem_id = -1;
58 int hf_nas_eps_emm_elem_id = -1;
59 static int hf_nas_eps_bearer_id = -1;
60 static int hf_nas_eps_spare_bits = -1;
61 static int hf_nas_eps_security_header_type = -1;
62 static int hf_nas_eps_msg_auth_code = -1;
63 static int hf_nas_eps_seq_no = -1;
64 static int hf_nas_eps_seq_no_short = -1;
65 static int hf_nas_eps_emm_ebi0 = -1;
66 static int hf_nas_eps_emm_ebi1 = -1;
67 static int hf_nas_eps_emm_ebi2 = -1;
68 static int hf_nas_eps_emm_ebi3 = -1;
69 static int hf_nas_eps_emm_ebi4 = -1;
70 static int hf_nas_eps_emm_ebi5 = -1;
71 static int hf_nas_eps_emm_ebi6 = -1;
72 static int hf_nas_eps_emm_ebi7 = -1;
73 static int hf_nas_eps_emm_ebi8 = -1;
74 static int hf_nas_eps_emm_ebi9 = -1;
75 static int hf_nas_eps_emm_ebi10 = -1;
76 static int hf_nas_eps_emm_ebi11 = -1;
77 static int hf_nas_eps_emm_ebi12 = -1;
78 static int hf_nas_eps_emm_ebi13 = -1;
79 static int hf_nas_eps_emm_ebi14 = -1;
80 static int hf_nas_eps_emm_ebi15 = -1;
81 static int hf_nas_eps_emm_dl_nas_cnt = -1;
82 static int hf_nas_eps_emm_nonce_mme = -1;
83 static int hf_nas_eps_emm_nonce = -1;
84 static int hf_nas_eps_emm_paging_id = -1;
85 static int hf_nas_eps_emm_eps_att_type = -1;
86 static int hf_nas_eps_emm_esr_ps = -1;
87 static int hf_nas_eps_emm_cs_lcs = -1;
88 static int hf_nas_eps_emm_epc_lcs = -1;
89 static int hf_nas_eps_emm_emc_bs = -1;
90 static int hf_nas_eps_emm_ims_vops = -1;
91 static int hf_nas_eps_emm_nas_key_set_id = -1;
92 static int hf_nas_eps_tsc = -1;
93 static int hf_nas_eps_emm_odd_even = -1;
94 static int hf_nas_eps_emm_type_of_id = -1;
95 static int hf_nas_eps_emm_mme_grp_id = -1;
96 static int hf_nas_eps_emm_imsi = -1;
97 static int hf_nas_eps_emm_imei = -1;
98 static int hf_nas_eps_emm_mme_code = -1;
99 static int hf_nas_eps_emm_m_tmsi = -1;
100 static int hf_nas_eps_esm_msg_cont = -1;
101 static int hf_nas_eps_esm_imeisv_req = -1;
102 static int hf_nas_eps_emm_toi = -1;
103 static int hf_nas_eps_emm_toc = -1;
104 static int hf_nas_eps_emm_EPS_attach_result = -1;
105 static int hf_nas_eps_emm_spare_half_octet = -1;
106 static int hf_nas_eps_emm_add_upd_res = -1;
107 static int hf_nas_eps_emm_add_upd_type = -1;
108 static int hf_nas_eps_emm_res = -1;
109 static int hf_nas_eps_emm_csfb_resp = -1;
110 static int hf_nas_eps_emm_cause = -1;
111 static int hf_nas_eps_emm_id_type2 = -1;
112 static int hf_nas_eps_emm_short_mac = -1;
113 static int hf_nas_eps_emm_tai_tol = -1;
114 static int hf_nas_eps_emm_tai_n_elem = -1;
115 static int hf_nas_eps_emm_tai_tac = -1;
116 static int hf_nas_eps_emm_eea0 = -1;
117 static int hf_nas_eps_emm_128eea1 = -1;
118 static int hf_nas_eps_emm_128eea2 = -1;
119 static int hf_nas_eps_emm_eea3 = -1;
120 static int hf_nas_eps_emm_eea4 = -1;
121 static int hf_nas_eps_emm_eea5 = -1;
122 static int hf_nas_eps_emm_eea6 = -1;
123 static int hf_nas_eps_emm_eea7 = -1;
124 static int hf_nas_eps_emm_eia0 = -1;
125 static int hf_nas_eps_emm_128eia1 = -1;
126 static int hf_nas_eps_emm_128eia2 = -1;
127 static int hf_nas_eps_emm_eia3 = -1;
128 static int hf_nas_eps_emm_eia4 = -1;
129 static int hf_nas_eps_emm_eia5 = -1;
130 static int hf_nas_eps_emm_eia6 = -1;
131 static int hf_nas_eps_emm_eia7 = -1;
132 static int hf_nas_eps_emm_uea0 = -1;
133 static int hf_nas_eps_emm_uea1 = -1;
134 static int hf_nas_eps_emm_uea2 = -1;
135 static int hf_nas_eps_emm_uea3 = -1;
136 static int hf_nas_eps_emm_uea4 = -1;
137 static int hf_nas_eps_emm_uea5 = -1;
138 static int hf_nas_eps_emm_uea6 = -1;
139 static int hf_nas_eps_emm_uea7 = -1;
140 static int hf_nas_eps_emm_ucs2_supp = -1;
141 static int hf_nas_eps_emm_uia1 = -1;
142 static int hf_nas_eps_emm_uia2 = -1;
143 static int hf_nas_eps_emm_uia3 = -1;
144 static int hf_nas_eps_emm_uia4 = -1;
145 static int hf_nas_eps_emm_uia5 = -1;
146 static int hf_nas_eps_emm_uia6 = -1;
147 static int hf_nas_eps_emm_uia7 = -1;
148 static int hf_nas_eps_emm_gea1 = -1;
149 static int hf_nas_eps_emm_gea2 = -1;
150 static int hf_nas_eps_emm_gea3 = -1;
151 static int hf_nas_eps_emm_gea4 = -1;
152 static int hf_nas_eps_emm_gea5 = -1;
153 static int hf_nas_eps_emm_gea6 = -1;
154 static int hf_nas_eps_emm_gea7 = -1;
155 static int hf_nas_eps_emm_h245_ash_cap = -1;
156 static int hf_nas_eps_emm_acc_csfb_cap = -1;
157 static int hf_nas_eps_emm_lpp_cap = -1;
158 static int hf_nas_eps_emm_lcs_cap = -1;
159 static int hf_nas_eps_emm_1xsrvcc_cap = -1;
160 static int hf_nas_eps_emm_nf_cap = -1;
161 static int hf_nas_eps_emm_ue_ra_cap_inf_upd_need_flg = -1;
162 static int hf_nas_eps_emm_ss_code = -1;
163 static int hf_nas_eps_emm_lcs_ind = -1;
164 static int hf_nas_eps_emm_gen_msg_cont_type = -1;
165 static int hf_nas_eps_emm_apn_ambr_ul = -1;
166 static int hf_nas_eps_emm_apn_ambr_dl = -1;
167 static int hf_nas_eps_emm_apn_ambr_ul_ext = -1;
168 static int hf_nas_eps_emm_apn_ambr_dl_ext = -1;
169 static int hf_nas_eps_emm_apn_ambr_ul_ext2 = -1;
170 static int hf_nas_eps_emm_apn_ambr_dl_ext2 = -1;
171 static int hf_nas_eps_emm_guti_type = -1;
172 static int hf_nas_eps_emm_switch_off = -1;
173 static int hf_nas_eps_emm_detach_type_UL = -1;
174 static int hf_nas_eps_emm_detach_type_DL = -1;
176 static int hf_nas_eps_qci = -1;
177 static int hf_nas_eps_mbr_ul = -1;
178 static int hf_nas_eps_mbr_dl = -1;
179 static int hf_nas_eps_gbr_ul = -1;
180 static int hf_nas_eps_gbr_dl = -1;
181 static int hf_nas_eps_embr_ul = -1;
182 static int hf_nas_eps_embr_dl = -1;
183 static int hf_nas_eps_egbr_ul = -1;
184 static int hf_nas_eps_egbr_dl = -1;
186 static int hf_nas_eps_esm_cause = -1;
187 static int hf_nas_eps_esm_eit = -1;
188 static int hf_nas_eps_esm_notif_ind = -1;
189 static int hf_nas_eps_esm_pdn_type = -1;
190 static int hf_nas_eps_esm_pdn_ipv4 = -1;
191 static int hf_nas_eps_esm_pdn_ipv6_if_id = -1;
193 static int hf_nas_eps_esm_linked_bearer_id = -1;
195 static int hf_nas_eps_active_flg = -1;
196 static int hf_nas_eps_eps_update_result_value = -1;
197 static int hf_nas_eps_eps_update_type_value = -1;
198 static int hf_nas_eps_service_type = -1;
200 static int hf_nas_eps_nas_msg_cont = -1;
201 static int hf_nas_eps_gen_msg_cont = -1;
203 static int hf_nas_eps_cmn_add_info = -1;
204 static int hf_nas_eps_esm_request_type = -1;
206 /* ESM */
207 static int hf_nas_eps_msg_esm_type = -1;
208 int hf_nas_eps_esm_elem_id = -1;
209 static int hf_nas_eps_esm_proc_trans_id = -1;
211 /* Initialize the subtree pointers */
212 static int ett_nas_eps = -1;
213 static int ett_nas_eps_esm_msg_cont = -1;
214 static int ett_nas_eps_nas_msg_cont = -1;
215 static int ett_nas_eps_gen_msg_cont = -1;
216 static int ett_nas_eps_cmn_add_info = -1;
218 /* Global variables */
219 static gboolean g_nas_eps_dissect_plain = FALSE;
221 guint8 eps_nas_gen_msg_cont_type = 0;
223 /* Table 9.8.1: Message types for EPS mobility management
224 * 0 1 - - - - - - EPS mobility management messages
226 static const value_string nas_msg_emm_strings[] = {
227 { 0x41, "Attach request"},
228 { 0x42, "Attach accept"},
229 { 0x43, "Attach complete"},
230 { 0x44, "Attach reject"},
231 { 0x45, "Detach request"},
232 { 0x46, "Detach accept"},
234 { 0x48, "Tracking area update request"},
235 { 0x49, "Tracking area update accept"},
236 { 0x4a, "Tracking area update complete"},
237 { 0x4b, "Tracking area update reject"},
239 { 0x4c, "Extended service request"},
240 { 0x4e, "Service reject"},
242 { 0x50, "GUTI reallocation command"},
243 { 0x51, "GUTI reallocation complete"},
244 { 0x52, "Authentication request"},
245 { 0x53, "Authentication response"},
246 { 0x54, "Authentication reject"},
247 { 0x55, "Identity request"},
248 { 0x56, "Identity response"},
249 { 0x5c, "Authentication failure"},
250 { 0x5d, "Security mode command"},
251 { 0x5e, "Security mode complete"},
252 { 0x5f, "Security mode reject"},
254 { 0x60, "EMM status"},
255 { 0x61, "EMM information"},
256 { 0x62, "Downlink NAS transport"},
257 { 0x63, "Uplink NAS transport"},
258 { 0x64, "CS Service notification"},
259 { 0x68, "Downlink generic NAS transport"},
260 { 0x69, "Uplink generic NAS transport"},
261 { 0, NULL }
263 static value_string_ext nas_msg_emm_strings_ext = VALUE_STRING_EXT_INIT(nas_msg_emm_strings);
265 /* Table 9.8.2: Message types for EPS session management */
267 static const value_string nas_msg_esm_strings[] = {
268 { 0xc1, "Activate default EPS bearer context request"},
269 { 0xc2, "Activate default EPS bearer context accept"},
270 { 0xc3, "Activate default EPS bearer context reject"},
271 { 0xc5, "Activate dedicated EPS bearer context request"},
272 { 0xc6, "Activate dedicated EPS bearer context accept"},
273 { 0xc7, "Activate dedicated EPS bearer context reject"},
274 { 0xc9, "Modify EPS bearer context request"},
275 { 0xca, "Modify EPS bearer context accept"},
276 { 0xcb, "Modify EPS bearer context reject"},
277 { 0xcd, "Deactivate EPS bearer context request"},
278 { 0xce, "Deactivate EPS bearer context accept"},
279 { 0xd0, "PDN connectivity request"},
280 { 0xd1, "PDN connectivity reject"},
281 { 0xd2, "PDN disconnect request"},
282 { 0xd3, "PDN disconnect reject"},
283 { 0xd4, "Bearer resource allocation request"},
284 { 0xd5, "Bearer resource allocation reject"},
285 { 0xd6, "Bearer resource modification request"},
286 { 0xd7, "Bearer resource modification reject"},
287 { 0xd9, "ESM information request"},
288 { 0xda, "ESM information response"},
289 { 0xdb, "Notification"},
290 { 0xe8, "ESM status"},
291 { 0, NULL }
293 static value_string_ext nas_msg_esm_strings_ext = VALUE_STRING_EXT_INIT(nas_msg_esm_strings);
295 static const value_string security_header_type_vals[] = {
296 { 0, "Plain NAS message, not security protected"},
297 { 1, "Integrity protected"},
298 { 2, "Integrity protected and ciphered"},
299 { 3, "Integrity protected with new EPS security context"},
300 { 4, "Integrity protected and ciphered with new EPS security context"},
301 { 5, "Reserved"},
302 { 6, "Reserved"},
303 { 7, "Reserved"},
304 { 8, "Reserved"},
305 { 9, "Reserved"},
306 { 10, "Reserved"},
307 { 11, "Reserved"},
308 { 12, "Security header for the SERVICE REQUEST message"},
309 { 13, "These values are not used in this version of the protocol."
310 " If received they shall be interpreted as security header for the SERVICE REQUEST message"},
311 { 14, "These values are not used in this version of the protocol."
312 " If received they shall be interpreted as Security header for the SERVICE REQUEST message"},
313 { 15, "These values are not used in this version of the protocol."
314 " If received they shall be interpreted as Security header for the SERVICE REQUEST message"},
315 { 0, NULL }
317 static value_string_ext security_header_type_vals_ext = VALUE_STRING_EXT_INIT(security_header_type_vals);
319 typedef enum
321 DE_EPS_CMN_ADD_INFO, /* 9.9.2.0 Additional information */
322 DE_EPS_CMN_DEVICE_PROPERTIES, /* 9.9.2.0A Device properties */
323 DE_EPS_CMN_EPS_BE_CTX_STATUS, /* 9.9.2.1 EPS bearer context status */
324 DE_EPS_CMN_LOC_AREA_ID, /* 9.9.2.2 Location area identification */
325 DE_EPS_CMN_MOB_ID, /* 9.9.2.3 Mobile identity */
326 DE_EPS_MS_CM_2, /* 9.9.2.4 Mobile station classmark 2 */
327 DE_EPS_MS_CM_3, /* 9.9.2.5 Mobile station classmark 3 */
328 DE_EPS_NAS_SEC_PAR_FROM_EUTRA, /* 9.9.2.6 NAS security parameters from E-UTRA */
329 DE_EPS_NAS_SEC_PAR_TO_EUTRA, /* 9.9.2.7 NAS security parameters to E-UTRA */
331 DE_EPS_CMN_PLM_LST, /* 9.9.2.8 PLMN list */
332 DE_EPS_CMN_SUP_CODEC_LST, /* 9.9.2.6 9.9.2.10 Supported codec list */
333 DE_EPS_COMMON_NONE /* NONE */
335 nas_eps_common_elem_idx_t;
337 static const value_string nas_eps_common_elem_strings[] = {
338 { DE_EPS_CMN_ADD_INFO, "Additional information" }, /* 9.9.2.0 Additional information */
339 { DE_EPS_CMN_DEVICE_PROPERTIES, "Device properties" }, /* 9.9.2.0A Device properties */
340 { DE_EPS_CMN_EPS_BE_CTX_STATUS, "EPS bearer context status" }, /* 9.9.2.1 EPS bearer context status */
341 { DE_EPS_CMN_LOC_AREA_ID, "Location area identification" }, /* 9.9.2.2 Location area identification */
342 { DE_EPS_CMN_MOB_ID, "Mobile identity" }, /* 9.9.2.3 Mobile identity */
343 { DE_EPS_MS_CM_2, "Mobile station classmark 2" }, /* 9.9.2.4 Mobile station classmark 2 */
344 { DE_EPS_MS_CM_3, "Mobile station classmark 3" }, /* 9.9.2.5 Mobile station classmark 3 */
345 { DE_EPS_NAS_SEC_PAR_FROM_EUTRA, "NAS security parameters from E-UTRA" },/* 9.9.2.6 NAS security parameters from E-UTRA */
346 { DE_EPS_NAS_SEC_PAR_TO_EUTRA, "NAS security parameters to E-UTRA" }, /* 9.9.2.7 NAS security parameters to E-UTRA */
347 { DE_EPS_CMN_PLM_LST, "PLMN list" }, /* 9.9.2.8 PLMN list */
348 /* 9.9.2.9 Spare half octet */
349 { DE_EPS_CMN_SUP_CODEC_LST, "Supported codec list" }, /* 9.9.2.10 Supported codec list */
350 { 0, NULL }
352 value_string_ext nas_eps_common_elem_strings_ext = VALUE_STRING_EXT_INIT(nas_eps_common_elem_strings);
354 /* Utility functions */
355 static guint16
356 calc_bitrate(guint8 value) {
357 guint16 return_value = value;
359 if ((value > 63) && (value <= 127)) {
360 return_value = 64 + (value - 64) * 8;
362 else if ((value > 127) && (value <= 254)) {
363 return_value = 576 + (value - 128) * 64;
365 else if (value == 0xff) {
366 return_value = 0;
368 return return_value;
370 static guint32
371 calc_bitrate_ext(guint8 value) {
372 guint32 return_value = 0;
374 if ((value > 0) && (value <= 0x4a)) {
375 return_value = 8600 + value * 100;
377 else if ((value > 0x4a) && (value <= 0xba)) {
378 return_value = 16 + (value-0x4a);
380 else if ((value > 0xba) && (value <= 0xfa)) {
381 return_value = 128 + (value-0xba)*2;
383 else {
384 return_value = 256;
387 return return_value;
389 static guint32
390 calc_bitrate_ext2(guint8 value) {
391 guint32 return_value = 0;
393 if ((value > 0) && (value <= 0x3d)) {
394 return_value = 256 + value * 4;
396 else if ((value > 0x3d) && (value <= 0xa1)) {
397 return_value = 500 + (value-0x3d) * 10;
399 else if ((value > 0xa1) && (value <= 0xf6)) {
400 return_value = 1500 + (value-0xa1) * 100;
402 else {
403 return_value = 10000;
406 return return_value;
409 #define NUM_NAS_EPS_COMMON_ELEM (sizeof(nas_eps_common_elem_strings)/sizeof(value_string))
410 gint ett_nas_eps_common_elem[NUM_NAS_EPS_COMMON_ELEM];
413 * 9.9.2 Common information elements
416 /* 9.9.2.0 Additional information */
417 static guint16
418 de_eps_cmn_add_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
419 guint32 offset, guint len,
420 gchar *add_string _U_, int string_len _U_)
422 proto_item *item;
423 proto_tree *sub_tree;
424 tvbuff_t *new_tvb;
426 item = proto_tree_add_item(tree, hf_nas_eps_cmn_add_info, tvb, offset, len, ENC_NA);
427 sub_tree = proto_item_add_subtree(item, ett_nas_eps_cmn_add_info);
429 new_tvb = tvb_new_subset(tvb, offset, len, len);
431 switch (eps_nas_gen_msg_cont_type) {
432 case 1:
433 /* LPP */
434 dissect_lcsap_Correlation_ID_PDU(new_tvb, pinfo, sub_tree, NULL);
435 break;
436 default:
437 break;
440 return(len);
444 * 9.9.2.1 EPS bearer context status
446 static const true_false_string nas_eps_emm_ebi_vals = {
447 "BEARER CONTEXT-ACTIVE",
448 "BEARER CONTEXT-INACTIVE"
451 static guint16
452 de_eps_cmn_eps_be_ctx_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
453 guint32 offset, guint len _U_,
454 gchar *add_string _U_, int string_len _U_)
456 guint32 curr_offset;
458 curr_offset = offset;
460 /* EBI(7) EBI(6) EBI(5) EBI(4) EBI(3) EBI(2) EBI(1) EBI(0) octet 3 */
461 proto_tree_add_item(tree, hf_nas_eps_emm_ebi7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
462 proto_tree_add_item(tree, hf_nas_eps_emm_ebi6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
463 proto_tree_add_item(tree, hf_nas_eps_emm_ebi5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
464 /* EBI(0) - EBI(4): Bits 0 to 4 of octet 3 are spare and shall be coded as zero. */
465 proto_tree_add_item(tree, hf_nas_eps_emm_ebi4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
466 proto_tree_add_item(tree, hf_nas_eps_emm_ebi3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
467 proto_tree_add_item(tree, hf_nas_eps_emm_ebi2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
468 proto_tree_add_item(tree, hf_nas_eps_emm_ebi1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
469 proto_tree_add_item(tree, hf_nas_eps_emm_ebi0, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
470 curr_offset++;
471 /* EBI(15) EBI(14) EBI(13) EBI(12) EBI(11) EBI(10) EBI(9) EBI(8) octet 4 */
472 proto_tree_add_item(tree, hf_nas_eps_emm_ebi15, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
473 proto_tree_add_item(tree, hf_nas_eps_emm_ebi14, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
474 proto_tree_add_item(tree, hf_nas_eps_emm_ebi13, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
475 proto_tree_add_item(tree, hf_nas_eps_emm_ebi12, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
476 proto_tree_add_item(tree, hf_nas_eps_emm_ebi11, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
477 proto_tree_add_item(tree, hf_nas_eps_emm_ebi10, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
478 proto_tree_add_item(tree, hf_nas_eps_emm_ebi9, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
479 proto_tree_add_item(tree, hf_nas_eps_emm_ebi8, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
481 return len;
484 * 9.9.2.2 Location area identification
485 * See subclause 10.5.1.3 in 3GPP TS 24.008 [6].
488 * 9.9.2.3 Mobile identity
489 * See subclause 10.5.1.4 in 3GPP TS 24.008 [6].
490 * exported from gsm_a_common
494 * 9.9.2.4 Mobile station classmark 2
495 * See subclause 10.5.1.6 in 3GPP TS 24.008 [13].
498 * 9.9.2.5 Mobile station classmark 3
499 * See subclause 10.5.1.7 in 3GPP TS 24.008 [13].
503 * 9.9.2.6 NAS security parameters from E-UTRA
505 guint16
506 de_emm_sec_par_from_eutra(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
507 guint32 offset, guint len _U_,
508 gchar *add_string _U_, int string_len _U_)
510 guint32 curr_offset;
512 curr_offset = offset;
514 /* DL NAS COUNT value (short) (octet 2, bit 1 to 4)
515 * This field contains the 4 least significant bits of the binary representation of the downlink
516 * NAS COUNT value applicable when this information element is sent.
518 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, curr_offset<<3, 4, ENC_BIG_ENDIAN);
519 proto_tree_add_item(tree, hf_nas_eps_emm_dl_nas_cnt, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
521 return len;
525 * 9.9.2.7 NAS security parameters to E-UTRA
527 guint16
528 de_emm_sec_par_to_eutra(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
529 guint32 offset, guint len _U_,
530 gchar *add_string _U_, int string_len _U_)
532 guint32 curr_offset;
534 curr_offset = offset;
535 /* NonceMME value (octet 1 to 5)
536 * This field is coded as the nonce value in the Nonce information element (see subclause 9.9.3.25).
538 proto_tree_add_item(tree, hf_nas_eps_emm_nonce_mme, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
539 curr_offset+=4;
540 /* type of ciphering algorithm (octet 6, bit 5 to 7)
541 * These fields are coded as the type of integrity protection algorithm and type of ciphering algorithm
542 * in the NAS security algorithms information element (see subclause 9.9.3.23).
543 * Bit 4 and 8 of octet 6 are spare and shall be coded as zero.
545 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, curr_offset<<3, 1, ENC_BIG_ENDIAN);
546 proto_tree_add_item(tree, hf_nas_eps_emm_toc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
547 /* Type of integrity protection algorithm (octet 6, bit 1 to 3)*/
548 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, (curr_offset<<3)+4, 1, ENC_BIG_ENDIAN);
549 proto_tree_add_item(tree, hf_nas_eps_emm_toi, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
550 curr_offset++;
552 * NAS key set identifier (octet 7, bit 1 to 3) and
553 * type of security context flag (TSC) (octet 7, bit 4)
554 * These fields are coded as the NAS key set identifier and type of security context flag in the
555 * NAS key set identifier information element (see subclause 9.9.3.21).
556 * Bit 5 to 8 of octet 7 are spare and shall be coded as zero.
558 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, curr_offset<<3, 4, ENC_BIG_ENDIAN);
559 /* Type of security context flag (TSC) V 1/2 */
560 proto_tree_add_bits_item(tree, hf_nas_eps_tsc, tvb, (curr_offset<<3)+4, 1, ENC_BIG_ENDIAN);
561 /* NAS key set identifier */
562 proto_tree_add_bits_item(tree, hf_nas_eps_emm_nas_key_set_id, tvb, (curr_offset<<3)+5, 3, ENC_BIG_ENDIAN);
563 curr_offset++;
564 return len;
568 * 9.9.2.8 PLMN list
569 * See subclause 10.5.1.13 in 3GPP TS 24.008 [6].
572 * 9.9.2.9 Spare half octet
573 * This element is used in the description of EMM and ESM messages when an odd number of
574 * half octet type 1 information elements are used. This element is filled with spare bits
575 * set to zero and is placed in bits 5 to 8 of the octet unless otherwise specified.
576 * Coded Inline
580 * 9.9.2.10 Supported codec list
581 * See subclause 10.5.4.32 in 3GPP TS 24.008 [13].
582 * Dissected in packet-gsm_a_dtap.c
585 guint16 (*nas_eps_common_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
586 guint32 offset, guint len,
587 gchar *add_string, int string_len) = {
588 /* 9.9.2 Common information elements */
589 de_eps_cmn_add_info, /* 9.9.2.0 Additional information */
590 NULL, /* 9.9.2.0A Device properties */
591 de_eps_cmn_eps_be_ctx_status, /* 9.9.2.1 EPS bearer context status */
592 de_lai, /* 9.9.2.2 Location area identification */
593 de_mid, /* 9.9.2.3 Mobile identity See subclause 10.5.1.4 in 3GPP TS 24.008*/
594 de_ms_cm_2, /* 9.9.2.4 Mobile station classmark 2 */
595 de_ms_cm_3, /* 9.9.2.5 Mobile station classmark 3 */
596 de_emm_sec_par_from_eutra, /* 9.9.2.6 NAS security parameters from E-UTRA */
597 de_emm_sec_par_to_eutra, /* 9.9.2.7 NAS security parameters to E-UTRA */
599 de_plmn_list, /* 9.9.2.8 PLMN list */
600 NULL, /* 9.9.2.10 Supported codec list (packet-gsm_a_dtap.c) */
601 NULL, /* NONE */
604 static const value_string nas_emm_elem_strings[] = {
605 /* 9.9.3 EPS Mobility Management (EMM) information elements */
606 { DE_EMM_ADD_UPD_RES, "Additional update result" }, /* 9.9.3.0A Additional update result */
607 { DE_EMM_ADD_UPD_TYPE, "Additional update type" }, /* 9.9.3.0B Additional update type */
608 { DE_EMM_AUTH_FAIL_PAR, "Authentication failure parameter" }, /* 9.9.3.1 Authentication failure parameter */
609 { DE_EMM_AUTN, "Authentication parameter AUTN" }, /* 9.9.3.2 Authentication parameter AUTN */
610 { DE_EMM_AUTH_PAR_RAND, "Authentication parameter RAND" }, /* 9.9.3.3 Authentication parameter RAND */
611 { DE_EMM_AUTH_RESP_PAR, "Authentication response parameter" }, /* 9.9.3.4 Authentication response parameter */
612 { DE_EMM_CSFB_RESP, "CSFB response" }, /* 9.9.3.5 CSFB response */
613 { DE_EMM_DAYL_SAV_T, "Daylight saving time" }, /* 9.9.3.6 Daylight saving time */
614 { DE_EMM_DET_TYPE, "Detach type" }, /* 9.9.3.7 Detach type */
615 { DE_EMM_DRX_PAR, "DRX parameter" }, /* 9.9.3.8 DRX parameter */
616 { DE_EMM_CAUSE, "EMM cause" }, /* 9.9.3.9 EMM cause */
617 { DE_EMM_ATT_RES, "EPS attach result" }, /* 9.9.3.10 EPS attach result */
618 { DE_EMM_ATT_TYPE, "EPS attach type" }, /* 9.9.3.11 EPS attach type */
619 { DE_EMM_EPS_MID, "EPS mobile identity" }, /* 9.9.3.12 EPS mobile identity */
620 { DE_EMM_EPS_NET_FEATURE_SUP, "EPS network feature support" }, /* 9.9.3.12A EPS network feature support */
621 { DE_EMM_EPS_UPD_RES, "EPS update result" }, /* 9.9.3.13 EPS update result */
622 { DE_EMM_EPS_UPD_TYPE, "EPS update type" }, /* 9.9.3.14 EPS update type */
623 { DE_EMM_ESM_MSG_CONT, "ESM message container" }, /* 9.9.3.15 ESM message conta */
624 { DE_EMM_GPRS_TIMER, "GPRS timer" }, /* 9.9.3.16 GPRS timer ,See subclause 10.5.7.3 in 3GPP TS 24.008 [6]. */
625 { DE_EMM_GPRS_TIMER_2, "GPRS timer 2" }, /* 9.9.3.16A GPRS timer 2, See subclause 10.5.7.4 in 3GPP TS 24.008. */
626 { DE_EMM_GPRS_TIMER_3, "GPRS timer 3" }, /* 9.9.3.16B GPRS timer 3, See subclause 10.5.7.4a in 3GPP TS 24.008. */
627 { DE_EMM_ID_TYPE_2, "Identity type 2" }, /* 9.9.3.17 Identity type 2 ,See subclause 10.5.5.9 in 3GPP TS 24.008 [6]. */
628 { DE_EMM_IMEISV_REQ, "IMEISV request" }, /* 9.9.3.18 IMEISV request ,See subclause 10.5.5.10 in 3GPP TS 24.008 [6]. */
629 { DE_EMM_KSI_AND_SEQ_NO, "KSI and sequence number" }, /* 9.9.3.19 KSI and sequence number */
630 { DE_EMM_MS_NET_CAP, "MS network capability" }, /* 9.9.3.20 MS network capability ,See subclause 10.5.5.12 in 3GPP TS 24.008 [6]. */
631 { DE_EMM_MS_NET_FEAT_SUP, "MS network feature support" }, /* 9.9.3.20A MS network feature support, See subclause 10.5.1.15 in 3GPP TS 24.008. */
632 { DE_EMM_NAS_KEY_SET_ID, "NAS key set identifier" }, /* 9.9.3.21 NAS key set identifier */
633 { DE_EMM_NAS_MSG_CONT, "NAS message container" }, /* 9.9.3.22 NAS message container */
634 { DE_EMM_NAS_SEC_ALGS, "NAS security algorithms" }, /* 9.9.3.23 NAS security algorithms */
635 { DE_EMM_NET_NAME, "Network name" }, /* 9.9.3.24 Network name, See subclause 10.5.3.5a in 3GPP TS 24.008 [6]. */
636 { DE_EMM_NONCE, "Nonce" }, /* 9.9.3.25 Nonce */
637 { DE_EMM_PAGING_ID, "Paging identity" }, /* 9.9.3.25A Paging identity */
638 { DE_EMM_P_TMSI_SIGN, "P-TMSI signature" }, /* 9.9.3.26 P-TMSI signature, See subclause 10.5.5.8 in 3GPP TS 24.008 [6]. */
639 { DE_EMM_SERV_TYPE, "Service type" }, /* 9.9.3.27 Service type ,See subclause 10.5.5.15 in 3GPP TS 24.008 [6]. */
640 { DE_EMM_SHORT_MAC, "Short MAC" }, /* 9.9.3.28 Short MAC */
641 { DE_EMM_TZ, "Time zone" }, /* 9.9.3.29 Time zone, See subclause 10.5.3.8 in 3GPP TS 24.008 [6]. */
642 { DE_EMM_TZ_AND_T, "Time zone and time" }, /* 9.9.3.30 Time zone and time, See subclause 10.5.3.9 in 3GPP TS 24.008 [6]. */
643 { DE_EMM_TMSI_STAT, "TMSI status" }, /* 9.9.3.31 TMSI status, See subclause 10.5.5.4 in 3GPP TS 24.008 [6]. */
644 { DE_EMM_TRAC_AREA_ID, "Tracking area identity" }, /* 9.9.3.32 Tracking area identity */
645 { DE_EMM_TRAC_AREA_ID_LST, "Tracking area identity list" }, /* 9.9.3.33 Tracking area identity list */
646 { DE_EMM_UE_NET_CAP, "UE network capability" }, /* 9.9.3.34 UE network capability */
647 { DE_EMM_UE_RA_CAP_INF_UPD_NEED, "UE radio capability information update needed" },/* 9.9.3.35 UE radio capability information update needed */
648 { DE_EMM_UE_SEC_CAP, "UE security capability" }, /* 9.9.3.36 UE security capability */
649 { DE_EMM_EMERG_NUM_LST, "Emergency Number List" }, /* 9.9.3.37 Emergency Number List */
650 { DE_EMM_CLI, "CLI" }, /* 9.9.3.38 CLI */
651 { DE_EMM_SS_CODE, "SS Code" }, /* 9.9.3.39 SS Code */
652 { DE_EMM_LCS_IND, "LCS indicator" }, /* 9.9.3.40 LCS indicator */
653 { DE_EMM_LCS_CLIENT_ID, "LCS client identity" }, /* 9.9.3.41 LCS client identity */
654 { DE_EMM_GEN_MSG_CONT_TYPE, "Generic message container type" }, /* 9.9.3.42 Generic message container type */
655 { DE_EMM_GEN_MSG_CONT, "Generic message container" }, /* 9.9.3.43 Generic message container */
656 { DE_EMM_VOICE_DMN_PREF, "Voice domain preference and UEs usage setting" },/* 9.9.3.44 Voice domain preference and UEs usage setting */
657 { DE_EMM_GUTI_TYPE, "GUTI type" }, /* 9.9.3.45 GUTI type */
658 { 0, NULL }
660 value_string_ext nas_emm_elem_strings_ext = VALUE_STRING_EXT_INIT(nas_emm_elem_strings);
662 #define NUM_NAS_EMM_ELEM (sizeof(nas_emm_elem_strings)/sizeof(value_string))
663 gint ett_nas_eps_emm_elem[NUM_NAS_EMM_ELEM];
665 #if 0
666 /* This enum has been moved to packet-gsm_a_common to
667 make it possible to use element dissection from this dissector
668 in other dissectors.
669 It is left here as a comment for easier reference.
672 Note this enum must be of the same size as the element decoding list
674 typedef enum
676 /* 9.9.3 EPS Mobility Management (EMM) information elements */
677 DE_EMM_ADD_UPD_RES, /* 9.9.3.0A Additional update result */
678 DE_EMM_ADD_UPD_TYPE, /* 9.9.3.0B Additional update type */
679 DE_EMM_AUTH_FAIL_PAR, /* 9.9.3.1 Authentication failure parameter (dissected in packet-gsm_a_dtap.c)*/
680 DE_EMM_AUTN, /* 9.9.3.2 Authentication parameter AUTN */
681 DE_EMM_AUTH_PAR_RAND, /* 9.9.3.3 Authentication parameter RAND */
682 DE_EMM_AUTH_RESP_PAR, /* 9.9.3.4 Authentication response parameter */
683 DE_EMM_CSFB_RESP, /* 9.9.3.5 CSFB response */
684 DE_EMM_DAYL_SAV_T, /* 9.9.3.6 Daylight saving time */
685 DE_EMM_DET_TYPE, /* 9.9.3.7 Detach type */
686 DE_EMM_DRX_PAR, /* 9.9.3.8 DRX parameter (dissected in packet-gsm_a_gm.c)*/
687 DE_EMM_CAUSE, /* 9.9.3.9 EMM cause */
688 DE_EMM_ATT_RES, /* 9.9.3.10 EPS attach result (Coded inline */
689 DE_EMM_ATT_TYPE, /* 9.9.3.11 EPS attach type (Coded Inline)*/
690 DE_EMM_EPS_MID, /* 9.9.3.12 EPS mobile identity */
691 DE_EMM_EPS_NET_FEATURE_SUP, /* 9.9.3.12A EPS network feature support */
692 DE_EMM_EPS_UPD_RES, /* 9.9.3.13 EPS update result ( Coded inline)*/
693 DE_EMM_EPS_UPD_TYPE, /* 9.9.3.14 EPS update type */
694 DE_EMM_ESM_MSG_CONT, /* 9.9.3.15 ESM message conta */
695 DE_EMM_GPRS_TIMER, /* 9.9.3.16 GPRS timer ,See subclause 10.5.7.3 in 3GPP TS 24.008 [6]. */
696 DE_EMM_GPRS_TIMER_2, /* 9.9.3.16A GPRS timer 2, See subclause 10.5.7.4 in 3GPP TS 24.008. */
697 DE_EMM_GPRS_TIMER_3, /* 9.9.3.16B GPRS timer 3, See subclause 10.5.7.4a in 3GPP TS 24.008. */
698 DE_EMM_ID_TYPE_2, /* 9.9.3.17 Identity type 2 ,See subclause 10.5.5.9 in 3GPP TS 24.008 [6]. */
699 DE_EMM_IMEISV_REQ, /* 9.9.3.18 IMEISV request ,See subclause 10.5.5.10 in 3GPP TS 24.008 [6]. */
700 DE_EMM_KSI_AND_SEQ_NO, /* 9.9.3.19 KSI and sequence number */
701 DE_EMM_MS_NET_CAP, /* 9.9.3.20 MS network capability ,See subclause 10.5.5.12 in 3GPP TS 24.008 [6]. */
702 DE_EMM_MS_NET_FEAT_SUP, /* 9.9.3.20A MS network feature support, See subclause 10.5.1.15 in 3GPP TS 24.008. */
703 DE_EMM_NAS_KEY_SET_ID, /* 9.9.3.21 NAS key set identifier (coded inline)*/
704 DE_EMM_NAS_MSG_CONT, /* 9.9.3.22 NAS message container */
705 DE_EMM_NAS_SEC_ALGS, /* 9.9.3.23 NAS security algorithms */
706 DE_EMM_NET_NAME, /* 9.9.3.24 Network name, See subclause 10.5.3.5a in 3GPP TS 24.008 [6]. */
707 DE_EMM_NONCE, /* 9.9.3.25 Nonce */
708 DE_EMM_PAGING_ID, /* 9.9.3.25A Paging identity */
709 DE_EMM_P_TMSI_SIGN, /* 9.9.3.26 P-TMSI signature, See subclause 10.5.5.8 in 3GPP TS 24.008 [6]. */
710 DE_EMM_SERV_TYPE, /* 9.9.3.27 Service type */
711 DE_EMM_SHORT_MAC, /* 9.9.3.28 Short MAC */
712 DE_EMM_TZ, /* 9.9.3.29 Time zone, See subclause 10.5.3.8 in 3GPP TS 24.008 [6]. */
713 DE_EMM_TZ_AND_T, /* 9.9.3.30 Time zone and time, See subclause 10.5.3.9 in 3GPP TS 24.008 [6]. */
714 DE_EMM_TMSI_STAT, /* 9.9.3.31 TMSI status, See subclause 10.5.5.4 in 3GPP TS 24.008 [6]. */
715 DE_EMM_TRAC_AREA_ID, /* 9.9.3.32 Tracking area identity */
716 DE_EMM_TRAC_AREA_ID_LST, /* 9.9.3.33 Tracking area identity list */
717 DE_EMM_UE_NET_CAP, /* 9.9.3.34 UE network capability */
718 DE_EMM_UE_RA_CAP_INF_UPD_NEED, /* 9.9.3.35 UE radio capability information update needed */
719 DE_EMM_UE_SEC_CAP, /* 9.9.3.36 UE security capability */
720 DE_EMM_EMERG_NUM_LST, /* 9.9.3.37 Emergency Number List */
721 DE_EMM_CLI, /* 9.9.3.38 CLI */
722 DE_EMM_SS_CODE, /* 9.9.3.39 SS Code */
723 DE_EMM_LCS_IND, /* 9.9.3.40 LCS indicator */
724 DE_EMM_LCS_CLIENT_ID, /* 9.9.3.41 LCS client identity */
725 DE_EMM_GEN_MSG_CONT_TYPE, /* 9.9.3.42 Generic message container type */
726 DE_EMM_GEN_MSG_CONT, /* 9.9.3.43 Generic message container */
727 DE_EMM_VOICE_DMN_PREF, /* 9.9.3.44 Voice domain preference and UEs usage setting */
728 DE_EMM_GUTI_TYPE, /* 9.9.3.45 GUTI type */
729 DE_EMM_NONE /* NONE */
731 nas_emm_elem_idx_t;
732 #endif
734 /* TODO: Update to latest spec */
735 /* 9.9.3 EPS Mobility Management (EMM) information elements
738 * 9.9.3.0A Additional update result
740 static const value_string nas_eps_emm_add_upd_res_vals[] = {
741 { 0x0, "no additional information"},
742 { 0x1, "CS Fallback not preferred"},
743 { 0x2, "SMS only"},
744 { 0x3, "reserved"},
745 { 0, NULL }
747 static guint16
748 de_emm_add_upd_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
749 guint32 offset, guint len _U_,
750 gchar *add_string _U_, int string_len _U_)
752 guint32 curr_offset, bit_offset;
754 curr_offset = offset;
755 bit_offset = (curr_offset<<3)+4;
757 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
758 bit_offset += 2;
759 proto_tree_add_bits_item(tree, hf_nas_eps_emm_add_upd_res, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
760 curr_offset++;
762 return (curr_offset - offset);
765 * 9.9.3.0B Additional update type
767 static const value_string nas_eps_emm_add_upd_type_vals[] = {
768 { 0x0, "no additional information (shall be interpreted as request for"
769 " combined attach or combined tracking area updating)"},
770 { 0x1, "SMS only"},
771 { 0, NULL }
773 static guint16
774 de_emm_add_upd_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
775 guint32 offset, guint len _U_,
776 gchar *add_string _U_, int string_len _U_)
778 guint32 curr_offset, bit_offset;
780 curr_offset = offset;
781 bit_offset = (curr_offset<<3)+4;
783 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
784 bit_offset += 3;
785 proto_tree_add_bits_item(tree, hf_nas_eps_emm_add_upd_type, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
786 curr_offset++;
788 return (curr_offset - offset);
791 * 9.9.3.1 Authentication failure parameter
792 * See subclause 10.5.3.2.2 in 3GPP TS 24.008 [6].
793 * (dissected in packet-gsm_a_dtap.c)
796 * 9.9.3.2 Authentication parameter AUTN
797 * See subclause 10.5.3.1.1 in 3GPP TS 24.008 [6].
800 * 9.9.3.3 Authentication parameter RAND
801 * See subclause 10.5.3.1 in 3GPP TS 24.008 [6].
804 * 9.9.3.4 Authentication response parameter
806 static guint16
807 de_emm_auth_resp_par(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
808 guint32 offset, guint len _U_,
809 gchar *add_string _U_, int string_len _U_)
811 guint32 curr_offset;
813 curr_offset = offset;
815 proto_tree_add_item(tree, hf_nas_eps_emm_res, tvb, curr_offset, len, ENC_NA);
817 return len;
820 * 9.9.3.4A Ciphering key sequence number
821 * See subclause 9.9.3.19 in 3GPP TS 24.008 [13].
825 * 9.9.3.5 CSFB response
829 * CSFB response value (octet 1)
832 static const value_string nas_eps_emm_csfb_resp_vals[] = {
833 { 0x0, "CS fallback rejected by the UE"},
834 { 0x1, "CS fallback accepted by the UE"},
835 { 0, NULL }
838 static guint16
839 de_emm_csfb_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
840 guint32 offset, guint len _U_,
841 gchar *add_string _U_, int string_len _U_)
843 guint32 curr_offset, bit_offset;
845 curr_offset = offset;
847 /* bit 4 Spare */
848 bit_offset = curr_offset<<3;
849 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset+4, 1, ENC_BIG_ENDIAN);
851 proto_tree_add_item(tree, hf_nas_eps_emm_csfb_resp, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
852 curr_offset++;
854 return(curr_offset-offset);
857 * 9.9.3.6 Daylight saving time
858 * See subclause 10.5.3.12 in 3GPP TS 24.008 [6].
861 * 9.9.3.7 Detach type
862 * Coded inline
864 static const value_string nas_eps_emm_switch_off_vals[] = {
865 { 0x0, "Normal detach"},
866 { 0x1, "Switch off"},
867 { 0x2, "Reserved"},
868 { 0x3, "Reserved"},
869 { 0x4, "Reserved"},
870 { 0x5, "Reserved"},
871 { 0x6, "Reserved"},
872 { 0x7, "Reserved"},
873 { 0, NULL }
875 /* Type of detach (octet 1)
876 * In the UE to network direction:
878 static const value_string nas_eps_emm_type_of_dtatch_UL_vals[] = {
879 { 0x1, "EPS detach"},
880 { 0x2, "IMSI detach"},
881 { 0x3, "Combined EPS/IMSI detach"},
882 { 0x4, "Combined EPS/IMSI detach"}, /* All other values are interpreted as
883 "combined EPS/IMSI detach" in this version of the protocol.*/
884 { 0x5, "Combined EPS/IMSI detach"}, /* -"- */
885 { 0x6, "Reserved"},
886 { 0x7, "Reserved"},
887 { 0, NULL }
891 * In the network to UE direction:
894 static const value_string nas_eps_emm_type_of_dtatch_DL_vals[] = {
895 { 0x1, "Re-attach required"},
896 { 0x2, "Re-attach not required"},
897 { 0x3, "IMSI detach"},
898 { 0x4, "Re-attach not required"}, /* All other values are interpreted as
899 "re-attach not required" in this version of the protocol.*/
900 { 0x5, "Re-attach not required"}, /* -"- */
901 { 0x6, "Reserved"},
902 { 0x7, "Reserved"},
903 { 0, NULL }
907 * 9.9.3.8 DRX parameter
908 * See subclause 10.5.5.6 in 3GPP TS 24.008 [13].
911 * 9.9.3.9 EMM cause
913 const value_string nas_eps_emm_cause_values[] = {
914 { 0x2, "IMSI unknown in HSS"},
915 { 0x3, "Illegal UE"},
916 { 0x5, "IMEI not accepted"},
917 { 0x6, "Illegal ME"},
918 { 0x7, "EPS services not allowed"},
919 { 0x8, "EPS services and non-EPS services not allowed"},
920 { 0x9, "UE identity cannot be derived by the network"},
921 { 0xa, "Implicitly detached"},
922 { 0xb, "PLMN not allowed"},
923 { 0xc, "Tracking Area not allowed"},
924 { 0xd, "Roaming not allowed in this tracking area"},
925 { 0xe, "EPS services not allowed in this PLMN"},
926 { 0xf, "No Suitable Cells In tracking area"},
927 { 0x10, "MSC temporarily not reachable"},
928 { 0x11, "Network failure"},
929 { 0x12, "CS domain not available"},
930 { 0x13, "ESM failure"},
931 { 0x14, "MAC failure"},
932 { 0x15, "Synch failure"},
933 { 0x16, "Congestion"},
934 { 0x17, "UE security capabilities mismatch"},
935 { 0x18, "Security mode rejected, unspecified"},
936 { 0x19, "Not authorized for this CSG"},
937 { 0x1a, "Non-EPS authentication unacceptable"},
938 { 0x23, "Requested service option not authorized in this PLMN"},
939 { 0x27, "CS service temporarily not available"},
940 { 0x28, "No EPS bearer context activated"},
941 { 0x2a, "Severe network failure"},
942 { 0x5f, "Semantically incorrect message"},
943 { 0x60, "Invalid mandatory information"},
944 { 0x61, "Message type non-existent or not implemented"},
945 { 0x62, "Message type not compatible with the protocol state"},
946 { 0x63, "Information element non-existent or not implemented"},
947 { 0x64, "Conditional IE error"},
948 { 0x65, "Message not compatible with the protocol state"},
949 { 0x6f, "Protocol error, unspecified"},
950 { 0, NULL }
952 value_string_ext nas_eps_emm_cause_values_ext = VALUE_STRING_EXT_INIT(nas_eps_emm_cause_values);
954 static guint16
955 de_emm_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
956 guint32 offset, guint len _U_,
957 gchar *add_string _U_, int string_len _U_)
959 guint32 curr_offset;
961 curr_offset = offset;
963 proto_tree_add_item(tree, hf_nas_eps_emm_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
964 curr_offset++;
966 return curr_offset-offset;}
968 * 9.9.3.10 EPS attach result
971 static const value_string nas_eps_emm_EPS_attach_result_values[] = {
972 { 0, "reserved"},
973 { 1, "EPS only"},
974 { 2, "Combined EPS/IMSI attach"},
975 { 3, "reserved"},
976 { 4, "reserved"},
977 { 5, "reserved"},
978 { 6, "reserved"},
979 { 7, "reserved"},
980 { 0, NULL }
982 /* Coded inline */
985 * 9.9.3.11 EPS attach type
988 static const value_string nas_eps_emm_eps_att_type_vals[] = {
989 { 0, "EPS attach(unused)"},
990 { 1, "EPS attach"},
991 { 2, "Combined EPS/IMSI attach"},
992 { 3, "EPS attach(unused)"},
993 { 4, "EPS attach(unused)"},
994 { 5, "EPS attach(unused)"},
995 { 6, "EPS emergency attach"},
996 { 7, "Reserved"},
997 { 0, NULL }
999 /* Coded inline */
1002 * 9.9.3.12 EPS mobile identity
1004 static char *
1005 unpack_eps_mid_digits(tvbuff_t *tvb) {
1007 int length;
1008 guint8 octet;
1009 int i = 0;
1010 int offset = 0;
1011 char *digit_str;
1013 length = tvb_length(tvb);
1015 digit_str = (char *)wmem_alloc(wmem_packet_scope(), length*2);
1017 /* Get identity digit 1 */
1018 octet = tvb_get_guint8(tvb,offset);
1019 digit_str[i++] = (((octet>>4) & 0x0f) + '0');
1020 offset++;
1022 /* Loop on following octets to retrieve other identity digits */
1023 while ( offset < length ) {
1025 octet = tvb_get_guint8(tvb,offset);
1026 digit_str[i] = ((octet & 0x0f) + '0');
1027 i++;
1030 * unpack second value in byte
1032 octet = octet >> 4;
1034 if (octet == 0x0f) /* odd number bytes - hit filler */
1035 break;
1037 digit_str[i] = ((octet & 0x0f) + '0');
1038 i++;
1039 offset++;
1042 digit_str[i]= '\0';
1043 return digit_str;
1046 static const value_string nas_eps_emm_type_of_id_vals[] = {
1047 { 0, "reserved"},
1048 { 1, "IMSI"},
1049 { 2, "reserved"},
1050 { 3, "IMEI"},
1051 { 4, "reserved"},
1052 { 5, "reserved"},
1053 { 6, "GUTI"},
1054 { 7, "reserved"},
1055 { 0, NULL }
1057 static guint16
1058 de_emm_eps_mid(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
1059 guint32 offset, guint len _U_,
1060 gchar *add_string _U_, int string_len _U_)
1062 guint32 curr_offset;
1063 guint8 octet;
1064 char *digit_str;
1065 tvbuff_t *new_tvb;
1067 curr_offset = offset;
1069 octet = tvb_get_guint8(tvb,offset);
1070 /* Type of identity (octet 3) */
1071 proto_tree_add_item(tree, hf_nas_eps_emm_odd_even, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1072 proto_tree_add_item(tree, hf_nas_eps_emm_type_of_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1073 switch (octet&0x7) {
1074 case 1:
1075 /* IMSI */
1076 new_tvb = tvb_new_subset(tvb, curr_offset, len, len );
1077 digit_str = unpack_eps_mid_digits(new_tvb);
1078 proto_tree_add_string(tree, hf_nas_eps_emm_imsi, new_tvb, 0, -1, digit_str);
1079 break;
1080 case 3:
1081 /* IMEI */
1082 new_tvb = tvb_new_subset(tvb, curr_offset, len, len );
1083 digit_str = unpack_eps_mid_digits(new_tvb);
1084 proto_tree_add_string(tree, hf_nas_eps_emm_imei, new_tvb, 0, -1, digit_str);
1085 break;
1086 case 6:
1087 /* GUTI */
1088 curr_offset++;
1089 curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, TRUE);
1090 /* MME Group ID octet 7 - 8 */
1091 proto_tree_add_item(tree, hf_nas_eps_emm_mme_grp_id, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1092 curr_offset+=2;
1093 /* MME Code Octet 9 */
1094 proto_tree_add_item(tree, hf_nas_eps_emm_mme_code, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1095 curr_offset++;
1096 /* M-TMSI Octet 10 - 13 */
1097 proto_tree_add_item(tree, hf_nas_eps_emm_m_tmsi, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
1098 /*curr_offset+=4;*/
1099 break;
1100 default:
1101 proto_tree_add_text(tree, tvb, curr_offset, len - 1, "Type of identity not known");
1102 break;
1105 return(len);
1109 * 9.9.3.12A EPS network feature support
1111 static const true_false_string nas_eps_emm_esr_ps_value = {
1112 "network supports use of EXTENDED SERVICE REQUEST to request for packet services",
1113 "network does not support use of EXTENDED SERVICE REQUEST to request for packet services"
1115 static const value_string nas_eps_emm_cs_lcs_vals[] = {
1116 { 0, "no information about support of location services via CS domain is available"},
1117 { 1, "location services via CS domain not supported"},
1118 { 2, "location services via CS domain supported"},
1119 { 3, "reserved"},
1120 { 0, NULL }
1122 static const true_false_string nas_eps_emm_epc_lcs_value = {
1123 "location services via EPC supported",
1124 "location services via EPC not supported"
1126 static const true_false_string nas_eps_emm_emc_bs_value = {
1127 "emergency bearer services in S1 mode supported",
1128 "emergency bearer services in S1 mode not supported"
1130 static const true_false_string nas_eps_emm_ims_vops_value = {
1131 "IMS voice over PS session in S1 mode supported",
1132 "IMS voice over PS session in S1 mode not supported"
1135 static guint16
1136 de_emm_eps_net_feature_sup(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1137 guint32 offset, guint len _U_,
1138 gchar *add_string _U_, int string_len _U_)
1140 guint32 curr_offset, bit_offset;
1142 curr_offset = offset;
1143 bit_offset = curr_offset << 3;
1144 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
1145 bit_offset += 2;
1146 proto_tree_add_bits_item(tree, hf_nas_eps_emm_esr_ps, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1147 bit_offset += 1;
1148 proto_tree_add_bits_item(tree, hf_nas_eps_emm_cs_lcs, tvb, bit_offset, 2, ENC_BIG_ENDIAN);
1149 bit_offset += 2;
1150 proto_tree_add_bits_item(tree, hf_nas_eps_emm_epc_lcs, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1151 bit_offset += 1;
1152 proto_tree_add_bits_item(tree, hf_nas_eps_emm_emc_bs, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1153 bit_offset += 1;
1154 proto_tree_add_bits_item(tree, hf_nas_eps_emm_ims_vops, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1155 /*bit_offset += 1;*/
1157 return len;
1160 * 9.9.3.13 EPS update result
1162 static const value_string nas_eps_emm_eps_update_result_vals[] = {
1163 { 0, "TA updated"},
1164 { 1, "Combined TA/LA updated"},
1165 { 2, "Reserved"},
1166 { 3, "Reserved"},
1167 { 4, "TA updated and ISR activated"},
1168 { 5, "Combined TA/LA updated and ISR activated"},
1169 { 6, "Reserved"},
1170 { 7, "Reserved"},
1171 { 0, NULL }
1175 * 9.9.3.14 EPS update type
1177 static const true_false_string nas_eps_emm_active_flg_value = {
1178 "Bearer establishment requested",
1179 "No bearer establishment requested"
1182 static const value_string nas_eps_emm_eps_update_type_vals[] = {
1183 { 0, "TA updating"},
1184 { 1, "Combined TA/LA updating"},
1185 { 2, "Combined TA/LA updating with IMSI attach"},
1186 { 3, "Periodic updating"},
1187 { 4, "Unused; shall be interpreted as 'TA updating', if received by the network"},
1188 { 5, "Unused; shall be interpreted as 'TA updating', if received by the network"},
1189 { 6, "Reserved"},
1190 { 7, "Reserved"},
1191 { 0, NULL }
1195 * 9.9.3.15 ESM message container
1197 static guint16
1198 de_emm_esm_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
1199 guint32 offset, guint len,
1200 gchar *add_string _U_, int string_len _U_)
1202 proto_item *item;
1203 proto_tree *sub_tree;
1204 tvbuff_t *new_tvb;
1205 guint32 curr_offset;
1207 curr_offset = offset;
1210 item = proto_tree_add_item(tree, hf_nas_eps_esm_msg_cont, tvb, curr_offset, len, ENC_NA);
1211 sub_tree = proto_item_add_subtree(item, ett_nas_eps_esm_msg_cont);
1213 /* This IE can contain any ESM PDU as defined in subclause 8.3. */
1214 new_tvb = tvb_new_subset(tvb, curr_offset, len, len );
1215 /* Plain NAS message */
1216 disect_nas_eps_esm_msg(new_tvb, pinfo, sub_tree, 0/* offset */);
1218 return(len);
1221 * 9.9.3.16 GPRS timer
1222 * See subclause 10.5.7.3 in 3GPP TS 24.008 [6].
1223 * packet-gsm_a_gm.c
1226 * 9.9.3.16A GPRS timer 2
1227 * See subclause 10.5.7.4 in 3GPP TS 24.008.
1228 * packet-gsm_a_gm.c
1231 * 9.9.3.16B GPRS timer 3
1232 * See subclause 10.5.7.4a in 3GPP TS 24.008.
1233 * packet-gsm_a_gm.c
1236 * 9.9.3.17 Identity type 2
1237 * See subclause 10.5.5.9 in 3GPP TS 24.008 [6].
1239 static const value_string nas_eps_emm_id_type2_vals[] = {
1240 { 1, "IMSI"},
1241 { 2, "IMEI"},
1242 { 3, "IMEISV"},
1243 { 4, "TMSI"},
1244 { 0, NULL }
1248 * 9.9.3.18 IMEISV request
1249 * See subclause 10.5.5.10 in 3GPP TS 24.008 [6].
1251 /* IMEISV request value (octet 1) */
1252 static const value_string nas_eps_emm_imeisv_req_vals[] = {
1253 { 0, "IMEISV not requested"},
1254 { 1, "IMEISV requested"},
1255 { 2, "IMEISV not requested"},
1256 { 3, "IMEISV not requested"},
1257 { 4, "IMEISV not requested"},
1258 { 5, "IMEISV not requested"},
1259 { 6, "IMEISV not requested"},
1260 { 7, "IMEISV not requested"},
1261 { 0, NULL }
1263 static guint16
1264 de_emm_nas_imeisv_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1265 guint32 offset, guint len _U_,
1266 gchar *add_string _U_, int string_len _U_)
1268 guint32 curr_offset;
1269 int bit_offset;
1271 curr_offset = offset;
1273 bit_offset = curr_offset<<3;
1274 bit_offset+=4;
1275 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1276 proto_tree_add_item(tree, hf_nas_eps_esm_imeisv_req, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1277 curr_offset++;
1279 return(curr_offset - offset);
1282 * 9.9.3.19 KSI and sequence number
1284 static guint16
1285 de_emm_nas_ksi_and_seq_no(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1286 guint32 offset, guint len _U_,
1287 gchar *add_string _U_, int string_len _U_)
1289 guint32 curr_offset;
1290 int bit_offset;
1292 curr_offset = offset;
1293 bit_offset = curr_offset<<3;
1295 proto_tree_add_bits_item(tree, hf_nas_eps_emm_nas_key_set_id, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
1296 bit_offset += 3;
1297 proto_tree_add_bits_item(tree, hf_nas_eps_seq_no_short, tvb, bit_offset, 5, ENC_BIG_ENDIAN);
1298 curr_offset++;
1300 return(curr_offset - offset);
1304 * 9.9.3.20 MS network capability
1305 * See subclause 10.5.5.12 in 3GPP TS 24.008 [6].
1306 * packet-gsm_a_gm.c
1309 * 9.9.3.20A MS network feature support
1310 * See subclause 10.5.1.15 in 3GPP TS 24.008.
1311 * packet-gsm_a_gm.c
1314 * 9.9.3.21 NAS key set identifier
1317 * Type of security context flag (TSC) (octet 1)
1319 static const true_false_string nas_eps_tsc_value = {
1320 "Mapped security context (for KSIsgsn)",
1321 "Native security context (for KSIasme)"
1324 /* NAS key set identifier (octet 1) Bits 3 2 1 */
1326 static const value_string nas_eps_emm_NAS_key_set_identifier_vals[] = {
1327 { 0, ""},
1328 { 1, ""},
1329 { 2, ""},
1330 { 3, ""},
1331 { 4, ""},
1332 { 5, ""},
1333 { 6, ""},
1334 { 7, "No key is available"},
1335 { 0, NULL }
1338 /* Takes bit offset as input and consumes 4 bits */
1339 static void
1340 de_emm_nas_key_set_id_bits(tvbuff_t *tvb, proto_tree *tree, guint32 bit_offset, const gchar *add_string)
1342 proto_item *item;
1344 /* Type of security context flag (TSC) (octet 1) V 1/2 */
1345 proto_tree_add_bits_item(tree, hf_nas_eps_tsc, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1346 bit_offset++;
1347 /* NAS key set identifier (octet 1) */
1348 item = proto_tree_add_bits_item(tree, hf_nas_eps_emm_nas_key_set_id, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
1349 if (add_string) {
1350 proto_item_append_text(item, "%s", add_string);
1352 /*bit_offset+=3;*/
1355 * Note used for TV Short
1357 static guint16
1358 de_emm_nas_key_set_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1359 guint32 offset, guint len _U_,
1360 gchar *add_string _U_, int string_len _U_)
1362 guint32 curr_offset, bit_offset;
1364 curr_offset = offset;
1366 /* Get the bit offset of the lover half of the octet bits 4 - 1 */
1367 bit_offset = curr_offset<<3;
1368 bit_offset+=4;
1370 /* Type of security context flag (TSC) (octet 1) V 1/2 */
1371 proto_tree_add_bits_item(tree, hf_nas_eps_tsc, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1372 bit_offset++;
1373 /* NAS key set identifier (octet 1) */
1374 proto_tree_add_bits_item(tree, hf_nas_eps_emm_nas_key_set_id, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
1375 /*bit_offset+=3;*/
1376 curr_offset++;
1378 return(curr_offset - offset);
1382 * 9.9.3.22 NAS message container
1384 static guint16
1385 de_emm_nas_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
1386 guint32 offset, guint len _U_,
1387 gchar *add_string _U_, int string_len _U_)
1389 proto_item *item;
1390 proto_tree *sub_tree;
1391 tvbuff_t *new_tvb;
1392 guint32 curr_offset;
1394 curr_offset = offset;
1396 /* NAS message container contents (octet 3 to octet n)
1397 * This IE can contain an SMS message (i.e. CP-DATA, CP-ACK or CP-ERROR)
1398 * as defined in subclause 7.2 in 3GPP TS 24.011 [13A].
1401 item = proto_tree_add_item(tree, hf_nas_eps_nas_msg_cont, tvb, curr_offset, len, ENC_NA);
1402 sub_tree = proto_item_add_subtree(item, ett_nas_eps_nas_msg_cont);
1404 new_tvb = tvb_new_subset(tvb, curr_offset, len, len );
1405 if (gsm_a_dtap_handle)
1406 call_dissector(gsm_a_dtap_handle, new_tvb, pinfo, sub_tree);
1408 return(len);
1411 * 9.9.3.23 NAS security algorithms
1413 /* Type of integrity protection algorithm (octet 2, bit 1 to 3) */
1414 static const value_string nas_eps_emm_toi_vals[] = {
1415 { 0, "EPS integrity algorithm EIA0 (null integrity protection algorithm)"},
1416 { 1, "EPS integrity algorithm 128-EIA1"},
1417 { 2, "EPS integrity algorithm 128-EIA2"},
1418 { 3, "EPS integrity algorithm 128-EIA3"},
1419 { 4, "EPS integrity algorithm EIA4"},
1420 { 5, "EPS integrity algorithm EIA5"},
1421 { 6, "EPS integrity algorithm EIA6"},
1422 { 7, "EPS integrity algorithm EIA7"},
1423 { 0, NULL }
1426 /* Type of ciphering algorithm (octet 2, bit 5 to 7) */
1428 static const value_string nas_eps_emm_toc_vals[] = {
1429 { 0, "EPS encryption algorithm EEA0 (null ciphering algorithm)"},
1430 { 1, "EPS encryption algorithm 128-EEA1"},
1431 { 2, "EPS encryption algorithm 128-EEA2"},
1432 { 3, "EPS encryption algorithm 128-EEA3"},
1433 { 4, "EPS encryption algorithm EEA4"},
1434 { 5, "EPS encryption algorithm EEA5"},
1435 { 6, "EPS encryption algorithm EEA6"},
1436 { 7, "EPS encryption algorithm EEA7"},
1437 { 0, NULL }
1439 static guint16
1440 de_emm_nas_sec_alsgs(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1441 guint32 offset, guint len _U_,
1442 gchar *add_string _U_, int string_len _U_)
1444 int bit_offset;
1445 guint32 curr_offset;
1447 curr_offset = offset;
1449 bit_offset = offset<<3;
1450 /* Bit 4 and 8 of octet 2 are spare and shall be coded as zero. */
1451 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1452 /* Type of ciphering algorithm (octet 2, bit 5 to 7) */
1453 proto_tree_add_item(tree, hf_nas_eps_emm_toc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1454 bit_offset+=4;
1455 /* Bit 4 and 8 of octet 2 are spare and shall be coded as zero. */
1456 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
1457 /* Type of integrity protection algorithm (octet 2, bit 1 to 3) */
1458 proto_tree_add_item(tree, hf_nas_eps_emm_toi, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1460 curr_offset++;
1462 return(curr_offset-offset);
1465 * 9.9.3.24 Network name
1466 * See subclause 10.5.3.5a in 3GPP TS 24.008 [6].
1469 * 9.9.3.25 Nonce
1471 static guint16
1472 de_emm_nonce(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1473 guint32 offset, guint len _U_,
1474 gchar *add_string _U_, int string_len _U_)
1476 guint32 curr_offset;
1478 curr_offset = offset;
1480 proto_tree_add_item(tree, hf_nas_eps_emm_nonce, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
1481 curr_offset+=4;
1483 return(curr_offset-offset);
1486 * 9.9.3.25A Paging identity
1488 static const true_false_string nas_eps_emm_paging_id_vals = {
1489 "TMSI",
1490 "IMSI"
1493 static guint16
1494 de_emm_paging_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1495 guint32 offset, guint len _U_,
1496 gchar *add_string _U_, int string_len _U_)
1498 guint32 curr_offset;
1500 curr_offset = offset;
1502 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, curr_offset<<3, 7, ENC_BIG_ENDIAN);
1503 proto_tree_add_bits_item(tree, hf_nas_eps_emm_paging_id, tvb, (curr_offset<<3)+7, 1, ENC_BIG_ENDIAN);
1504 /*curr_offset+=len;*/
1506 return(len);
1509 * 9.9.3.26 P-TMSI signature
1510 * See subclause 10.5.5.8 in 3GPP TS 24.008 [6].
1513 * 9.9.3.27 Service type
1515 static const range_string nas_eps_service_type_vals[] = {
1516 { 0, 0, "Mobile originating CS fallback or 1xCS fallback"},
1517 { 1, 1, "Mobile terminating CS fallback or 1xCS fallback"},
1518 { 2, 2, "Mobile originating CS fallback emergency call or 1xCS fallback emergency call"},
1519 { 3, 4, "Mobile originating CS fallback or 1xCS fallback"},
1520 { 8, 11, "packet services via S1"},
1521 { 0, 0, NULL }
1525 * 9.9.3.28 Short MAC
1527 static guint16
1528 de_emm_nas_short_mac(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1529 guint32 offset, guint len _U_,
1530 gchar *add_string _U_, int string_len _U_)
1532 guint32 curr_offset;
1534 curr_offset = offset;
1537 proto_tree_add_item(tree, hf_nas_eps_emm_short_mac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1538 curr_offset+=2;
1540 return(curr_offset-offset);
1543 * 9.9.3.29 Time zone
1544 * See subclause 10.5.3.8 in 3GPP TS 24.008 [6].
1547 * 9.9.3.30 Time zone and time
1548 * See subclause 10.5.3.9 in 3GPP TS 24.008 [6].
1551 * 9.9.3.31 TMSI status
1552 * See subclause 10.5.5.4 in 3GPP TS 24.008 [6].
1555 * 9.9.3.32 Tracking area identity
1558 guint16
1559 de_emm_trac_area_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
1560 guint32 offset, guint len _U_,
1561 gchar *add_string _U_, int string_len _U_)
1563 guint32 curr_offset;
1565 curr_offset = offset;
1567 curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, TRUE);
1568 proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1569 curr_offset+=2;
1571 return(curr_offset-offset);
1574 * 9.9.3.33 Tracking area identity list
1576 /* Type of list (octet 1)
1577 * Bits 7 6
1579 static const value_string nas_eps_emm_tai_tol_vals[] = {
1580 { 0, "list of TACs belonging to one PLMN, with non-consecutive TAC values"},
1581 { 1, "list of TACs belonging to one PLMN, with consecutive TAC values"},
1582 { 2, "list of TAIs belonging to different PLMNs"},
1583 { 0, NULL }
1586 static guint16
1587 de_emm_trac_area_id_lst(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
1588 guint32 offset, guint len _U_,
1589 gchar *add_string _U_, int string_len _U_)
1591 proto_item *item;
1592 guint32 curr_offset;
1593 guint8 octet, tol, n_elem;
1594 int i;
1596 curr_offset = offset;
1598 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, curr_offset<<3, 1, ENC_BIG_ENDIAN);
1599 /* Type of list (octet 1) Bits 7 6 */
1600 proto_tree_add_item(tree, hf_nas_eps_emm_tai_tol, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1601 /* Number of elements (octet 1) Bits 5 4 3 2 1 */
1602 octet = tvb_get_guint8(tvb,curr_offset)& 0x7f;
1603 tol = octet >> 5;
1604 n_elem = (octet & 0x1f)+1;
1605 item = proto_tree_add_item(tree, hf_nas_eps_emm_tai_n_elem, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1606 if (n_elem<16)
1607 proto_item_append_text(item, " [+1 = %u element(s)]", n_elem);
1609 curr_offset++;
1610 if (tol>2) {
1611 proto_tree_add_text(tree, tvb, curr_offset, len-(curr_offset-offset) , "Unknown type of list ( Not in 3GPP TS 24.301 version 8.1.0 Release 8 )");
1612 return len;
1615 switch (tol) {
1616 case 0:
1617 /* MCC digit 2 MCC digit 1 octet 2
1618 * MNC digit 3 MCC digit 3 octet 3
1619 * MNC digit 2 MNC digit 1 octet 4
1621 curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, TRUE);
1622 /* type of list = "000" */
1623 /* TAC 1 octet 5
1624 * TAC 1 (continued) octet 6
1625 * ...
1626 * ...
1627 * TAC k octet 2k+3*
1628 * TAC k (continued) octet 2k+4*
1630 if (len < (guint)(4+(n_elem*2))) {
1631 proto_tree_add_text(tree, tvb, curr_offset, len-1 , "[Wrong number of elements?]");
1632 return len;
1634 for (i=0; i < n_elem; i++, curr_offset+=2)
1635 proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1636 break;
1637 case 1:
1639 /* type of list = "010" */
1640 /* MCC digit 2 MCC digit 1 octet 2
1641 * MNC digit 3 MCC digit 3 octet 3
1642 * MNC digit 2 MNC digit 1 octet 4
1644 curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, TRUE);
1645 proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1646 curr_offset+=2;
1647 break;
1648 case 2:
1649 if (len< (guint)(1+(n_elem*5))) {
1650 proto_tree_add_text(tree, tvb, curr_offset, len-1 , "[Wrong number of elements?]");
1651 return len;
1654 for (i=0; i < n_elem; i++) {
1655 /* type of list = "001" */
1656 /* MCC digit 2 MCC digit 1 octet 2
1657 * MNC digit 3 MCC digit 3 octet 3
1658 * MNC digit 2 MNC digit 1 octet 4
1660 curr_offset = dissect_e212_mcc_mnc(tvb, pinfo, tree, curr_offset, TRUE);
1661 proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1662 curr_offset+=2;
1664 break;
1665 default:
1666 /* Unknown ( Not in 3GPP TS 24.301 version 8.1.0 Release 8 ) */
1667 break;
1669 EXTRANEOUS_DATA_CHECK(len, curr_offset - offset);
1671 return(curr_offset-offset);
1674 * 9.9.3.34 UE network capability
1677 static const true_false_string nas_eps_emm_supported_flg_value = {
1678 "Supported",
1679 "Not Supported"
1681 static const true_false_string nas_eps_emm_ucs2_supp_flg_value = {
1682 "The UE has no preference between the use of the default alphabet and the use of UCS2",
1683 "The UE has a preference for the default alphabet"
1685 /* H.245-ASH capability (octet 7, bit 6) */
1686 static const true_false_string nas_eps_emm_h245_ash_cap_flg = {
1687 "H.245 after SRVCC handover capability supported",
1688 "H.245 after SRVCC handover capability not supported"
1690 /* ACC-CSFB capability (octet 7, bit 5) */
1691 static const true_false_string nas_eps_emm_acc_csfb_cap_flg = {
1692 "eNodeB-based access class control for CSFB supported",
1693 "eNodeB-based access class control for CSFB not supported"
1695 /* LPP capability (octet 7, bit 4) */
1696 static const true_false_string nas_eps_emm_lpp_cap_flg = {
1697 "LTE Positioning Protocol supported",
1698 "LTE Positioning Protocol not supported"
1700 /* LCS capability (octet 7, bit 3) */
1701 static const true_false_string nas_eps_emm_lcs_cap_flg = {
1702 "Location services notification mechanisms supported",
1703 "Location services notification mechanisms not supported"
1705 /* 1xSRVCC capability (octet 7, bit 2) */
1706 static const true_false_string nas_eps_emm_1xsrvcc_cap_flg = {
1707 "SRVCC from E-UTRAN to cdma2000 1xCS supported",
1708 "SRVCC from E-UTRAN to cdma2000 1x CS not supported"
1710 /* NF capability (octet 7, bit 1) */
1711 static const true_false_string nas_eps_emm_nf_cap_flg = {
1712 "Notification procedure supported",
1713 "Notification procedure not supported"
1716 guint16
1717 de_emm_ue_net_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1718 guint32 offset, guint len,
1719 gchar *add_string _U_, int string_len _U_)
1721 guint32 curr_offset;
1723 curr_offset = offset;
1726 /* EPS encryption algorithms supported (octet 3) */
1727 /* EPS encryption algorithm EEA0 supported (octet 3, bit 8) */
1728 proto_tree_add_item(tree, hf_nas_eps_emm_eea0, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1729 /* EPS encryption algorithm 128-EEA1 supported (octet 3, bit 7) */
1730 proto_tree_add_item(tree, hf_nas_eps_emm_128eea1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1731 /* EPS encryption algorithm 128-EEA2 supported (octet 3, bit 6) */
1732 proto_tree_add_item(tree, hf_nas_eps_emm_128eea2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1733 /* EPS encryption algorithm 128-EEA3 supported (octet 3, bit 5) */
1734 proto_tree_add_item(tree, hf_nas_eps_emm_eea3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1735 /* EPS encryption algorithm EEA4 supported (octet 3, bit 4) */
1736 proto_tree_add_item(tree, hf_nas_eps_emm_eea4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1737 /* EPS encryption algorithm EEA5 supported (octet 3, bit 3) */
1738 proto_tree_add_item(tree, hf_nas_eps_emm_eea5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1739 /* EPS encryption algorithm EEA6 supported (octet 3, bit 2) */
1740 proto_tree_add_item(tree, hf_nas_eps_emm_eea6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1741 /* EPS encryption algorithm EEA7 supported (octet 3, bit 1) */
1742 proto_tree_add_item(tree, hf_nas_eps_emm_eea7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1743 curr_offset++;
1746 /* EPS integrity algorithms supported (octet 4) */
1747 /* EPS integrity algorithm EIA0 supported (octet 4, bit 8) */
1748 proto_tree_add_item(tree, hf_nas_eps_emm_eia0, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1749 /* EPS integrity algorithm 128-EIA1 supported (octet 4, bit 7) */
1750 proto_tree_add_item(tree, hf_nas_eps_emm_128eia1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1751 /* EPS integrity algorithm 128-EIA2 supported (octet 4, bit 6) */
1752 proto_tree_add_item(tree, hf_nas_eps_emm_128eia2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1753 /* EPS integrity algorithm 128-EIA3 supported (octet 4, bit 5) */
1754 proto_tree_add_item(tree, hf_nas_eps_emm_eia3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1755 /* EPS integrity algorithm EIA4 supported (octet 4, bit 4) */
1756 proto_tree_add_item(tree, hf_nas_eps_emm_eia4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1757 /* EPS integrity algorithm EIA5 supported (octet 4, bit 3) */
1758 proto_tree_add_item(tree, hf_nas_eps_emm_eia5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1759 /* EPS integrity algorithm EIA6 supported (octet 4, bit 2) */
1760 proto_tree_add_item(tree, hf_nas_eps_emm_eia6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1761 /* EPS integrity algorithm EIA7 supported (octet 4, bit 1) */
1762 proto_tree_add_item(tree, hf_nas_eps_emm_eia7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1763 curr_offset++;
1766 /* Following octets are optional */
1767 if ((curr_offset - offset) >= len)
1768 return (len);
1770 /* UMTS encryption algorithms supported (octet 5)
1771 * UMTS encryption algorithm UEA0 supported (octet 5, bit 8)
1773 /* UMTS encryption algorithm 128-UEA0 supported (octet 5, bit 8) */
1774 proto_tree_add_item(tree, hf_nas_eps_emm_uea0, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1775 /* UMTS encryption algorithm 128-UEA1 supported (octet 5, bit 7) */
1776 proto_tree_add_item(tree, hf_nas_eps_emm_uea1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1777 /* UMTS encryption algorithm 128-UEA2 supported (octet 5, bit 6) */
1778 proto_tree_add_item(tree, hf_nas_eps_emm_uea2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1779 /* UMTS encryption algorithm 128-UEA3 supported (octet 5, bit 5) */
1780 proto_tree_add_item(tree, hf_nas_eps_emm_uea3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1781 /* UMTS encryption algorithm 128-UEA4 supported (octet 5, bit 4) */
1782 proto_tree_add_item(tree, hf_nas_eps_emm_uea4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1783 /* UMTS encryption algorithm 128-UEA5 supported (octet 5, bit 3) */
1784 proto_tree_add_item(tree, hf_nas_eps_emm_uea5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1785 /* UMTS encryption algorithm 128-UEA6 supported (octet 5, bit 2) */
1786 proto_tree_add_item(tree, hf_nas_eps_emm_uea6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1787 /* UMTS encryption algorithm 128-UEA7 supported (octet 5, bit 1) */
1788 proto_tree_add_item(tree, hf_nas_eps_emm_uea7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1789 curr_offset++;
1791 if ((curr_offset - offset) >= len)
1792 return (len);
1794 /* UCS2 support (UCS2) (octet 6, bit 8)
1795 * This information field indicates the likely treatment of UCS2 encoded character strings
1796 * by the UE.
1798 proto_tree_add_item(tree, hf_nas_eps_emm_ucs2_supp, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1799 /* UMTS integrity algorithms supported (octet 6) */
1800 /* UMTS integrity algorithm UIA1 supported (octet 6, bit 7) */
1801 proto_tree_add_item(tree, hf_nas_eps_emm_uia1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1802 /* UMTS integrity algorithm UIA2 supported (octet 6, bit 6) */
1803 proto_tree_add_item(tree, hf_nas_eps_emm_uia2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1804 /* UMTS integrity algorithm UIA3 supported (octet 6, bit 5) */
1805 proto_tree_add_item(tree, hf_nas_eps_emm_uia3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1806 /* UMTS integrity algorithm UIA4 supported (octet 6, bit 4) */
1807 proto_tree_add_item(tree, hf_nas_eps_emm_uia4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1808 /* UMTS integrity algorithm UIA5 supported (octet 6, bit 3) */
1809 proto_tree_add_item(tree, hf_nas_eps_emm_uia5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1810 /* UMTS integrity algorithm UIA6 supported (octet 6, bit 2) */
1811 proto_tree_add_item(tree, hf_nas_eps_emm_uia6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1812 /* UMTS integrity algorithm UIA7 supported (octet 6, bit 1) */
1813 proto_tree_add_item(tree, hf_nas_eps_emm_uia7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1814 curr_offset++;
1816 if ((curr_offset - offset) >= len)
1817 return (len);
1819 /* Bits 8 to 7 of octet 7 are spare and shall be coded as zero. */
1820 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, (curr_offset<<3), 2, ENC_BIG_ENDIAN);
1821 /* H.245-ASH capability (octet 7, bit 6) */
1822 proto_tree_add_item(tree, hf_nas_eps_emm_h245_ash_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1823 /* ACC-CSFB capability (octet 7, bit 5) */
1824 proto_tree_add_item(tree, hf_nas_eps_emm_acc_csfb_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1825 /* LPP capability (octet 7, bit 4) */
1826 proto_tree_add_item(tree, hf_nas_eps_emm_lpp_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1827 /* LCS capability (octet 7, bit 3) */
1828 proto_tree_add_item(tree, hf_nas_eps_emm_lcs_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1829 /* 1xSRVCC capability (octet 7, bit 2) */
1830 proto_tree_add_item(tree, hf_nas_eps_emm_1xsrvcc_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1831 /* NF capability (octet 7, bit 1) */
1832 proto_tree_add_item(tree, hf_nas_eps_emm_nf_cap, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1833 curr_offset++;
1835 while ((curr_offset - offset) < len) {
1836 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, (curr_offset<<3), 8, ENC_BIG_ENDIAN);
1837 curr_offset++;
1840 return(len);
1842 /* UE radio capability information update needed flag (URC upd) (octet 1) */
1843 static const true_false_string nas_eps_emm_ue_ra_cap_inf_upd_need_flg = {
1844 "UE radio capability information update needed",
1845 "UE radio capability information update not needed"
1849 * 9.9.3.35 UE radio capability information update needed
1852 static guint16
1853 de_emm_ue_ra_cap_inf_upd_need(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1854 guint32 offset, guint len _U_,
1855 gchar *add_string _U_, int string_len _U_)
1857 guint32 curr_offset;
1859 curr_offset = offset;
1861 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, (curr_offset<<3)+4, 3, ENC_BIG_ENDIAN);
1862 proto_tree_add_item(tree, hf_nas_eps_emm_ue_ra_cap_inf_upd_need_flg, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1864 return(len);
1867 * 9.9.3.36 UE security capability
1870 static guint16
1871 de_emm_ue_sec_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
1872 guint32 offset, guint len _U_,
1873 gchar *add_string _U_, int string_len _U_)
1875 guint32 curr_offset;
1877 curr_offset = offset;
1879 /* EPS encryption algorithms supported (octet 3) */
1880 /* EPS encryption algorithm EEA0 supported (octet 3, bit 8) */
1881 proto_tree_add_item(tree, hf_nas_eps_emm_eea0, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1882 /* EPS encryption algorithm 128-EEA1 supported (octet 3, bit 7) */
1883 proto_tree_add_item(tree, hf_nas_eps_emm_128eea1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1884 /* EPS encryption algorithm 128-EEA2 supported (octet 3, bit 6) */
1885 proto_tree_add_item(tree, hf_nas_eps_emm_128eea2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1886 /* EPS encryption algorithm 128-EEA3 supported (octet 3, bit 5) */
1887 proto_tree_add_item(tree, hf_nas_eps_emm_eea3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1888 /* EPS encryption algorithm EEA4 supported (octet 3, bit 4) */
1889 proto_tree_add_item(tree, hf_nas_eps_emm_eea4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1890 /* EPS encryption algorithm EEA5 supported (octet 3, bit 3) */
1891 proto_tree_add_item(tree, hf_nas_eps_emm_eea5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1892 /* EPS encryption algorithm EEA6 supported (octet 3, bit 2) */
1893 proto_tree_add_item(tree, hf_nas_eps_emm_eea6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1894 /* EPS encryption algorithm EEA7 supported (octet 3, bit 1) */
1895 proto_tree_add_item(tree, hf_nas_eps_emm_eea7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1896 curr_offset++;
1899 /* EPS integrity algorithms supported (octet 4) */
1900 /* EPS integrity algorithm EIA0 supported (octet 4, bit 8) */
1901 proto_tree_add_item(tree, hf_nas_eps_emm_eia0, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1902 /* EPS integrity algorithm 128-EIA1 supported (octet 4, bit 7) */
1903 proto_tree_add_item(tree, hf_nas_eps_emm_128eia1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1904 /* EPS integrity algorithm 128-EIA2 supported (octet 4, bit 6) */
1905 proto_tree_add_item(tree, hf_nas_eps_emm_128eia2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1906 /* EPS integrity algorithm 128-EIA3 supported (octet 4, bit 5) */
1907 proto_tree_add_item(tree, hf_nas_eps_emm_eia3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1908 /* EPS integrity algorithm EIA4 supported (octet 4, bit 4) */
1909 proto_tree_add_item(tree, hf_nas_eps_emm_eia4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1910 /* EPS integrity algorithm EIA5 supported (octet 4, bit 3) */
1911 proto_tree_add_item(tree, hf_nas_eps_emm_eia5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1912 /* EPS integrity algorithm EIA6 supported (octet 4, bit 2) */
1913 proto_tree_add_item(tree, hf_nas_eps_emm_eia6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1914 /* EPS integrity algorithm EIA7 supported (octet 4, bit 1) */
1915 proto_tree_add_item(tree, hf_nas_eps_emm_eia7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1916 curr_offset++;
1919 /* Octets 5, 6, and 7 are optional. If octet 5 is included,
1920 * then also octet 6 shall be included and octet 7 may be included.
1922 if (len == 2)
1923 return(len);
1925 /* UMTS encryption algorithms supported (octet 5) */
1926 /* UMTS encryption algorithm UEA0 supported (octet 5, bit 8) */
1927 proto_tree_add_item(tree, hf_nas_eps_emm_uea0, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1928 /* UMTS encryption algorithm UEA1 supported (octet 5, bit 7) */
1929 proto_tree_add_item(tree, hf_nas_eps_emm_uea1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1930 /* UMTS encryption algorithm UEA2 supported (octet 5, bit 6) */
1931 proto_tree_add_item(tree, hf_nas_eps_emm_uea2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1932 /* UMTS encryption algorithm UEA3 supported (octet 5, bit 5) */
1933 proto_tree_add_item(tree, hf_nas_eps_emm_uea3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1934 /* UMTS encryption algorithm UEA4 supported (octet 5, bit 4) */
1935 proto_tree_add_item(tree, hf_nas_eps_emm_uea4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1936 /* UMTS encryption algorithm UEA5 supported (octet 5, bit 3) */
1937 proto_tree_add_item(tree, hf_nas_eps_emm_uea5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1938 /* UMTS encryption algorithm UEA6 supported (octet 5, bit 2) */
1939 proto_tree_add_item(tree, hf_nas_eps_emm_uea6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1940 /* UMTS encryption algorithm UEA7 supported (octet 5, bit 1) */
1941 proto_tree_add_item(tree, hf_nas_eps_emm_uea7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1942 curr_offset++;
1944 /* UMTS integrity algorithms supported (octet 6) */
1945 /* Bit 8 of octet 6 is spare and shall be coded as zero. */
1946 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, (curr_offset<<3), 1, ENC_BIG_ENDIAN);
1947 /* UMTS integrity algorithm UIA1 supported (octet 6, bit 7) */
1948 proto_tree_add_item(tree, hf_nas_eps_emm_uia1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1949 /* UMTS integrity algorithm UIA2 supported (octet 6, bit 6) */
1950 proto_tree_add_item(tree, hf_nas_eps_emm_uia2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1951 /* UMTS integrity algorithm UIA3 supported (octet 6, bit 5) */
1952 proto_tree_add_item(tree, hf_nas_eps_emm_uia3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1953 /* UMTS integrity algorithm UIA4 supported (octet 6, bit 4) */
1954 proto_tree_add_item(tree, hf_nas_eps_emm_uia4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1955 /* UMTS integrity algorithm UIA5 supported (octet 6, bit 3) */
1956 proto_tree_add_item(tree, hf_nas_eps_emm_uia5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1957 /* UMTS integrity algorithm UIA6 supported (octet 6, bit 2) */
1958 proto_tree_add_item(tree, hf_nas_eps_emm_uia6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1959 /* UMTS integrity algorithm UIA7 supported (octet 6, bit 1) */
1960 proto_tree_add_item(tree, hf_nas_eps_emm_uia7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1961 curr_offset++;
1963 if (len == 4)
1964 return(len);
1966 /* Bit 8 of octet 7 is spare and shall be coded as zero. */
1967 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, (curr_offset<<3), 1, ENC_BIG_ENDIAN);
1968 /* GPRS encryption algorithm GEA1 supported (octet 7, bit 7) */
1969 proto_tree_add_item(tree, hf_nas_eps_emm_gea1, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1970 /* GPRS encryption algorithm GEA2 supported (octet 7, bit 6) */
1971 proto_tree_add_item(tree, hf_nas_eps_emm_gea2, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1972 /* GPRS encryption algorithm GEA3 supported (octet 7, bit 5) */
1973 proto_tree_add_item(tree, hf_nas_eps_emm_gea3, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1974 /* GPRS encryption algorithm GEA4 supported (octet 7, bit 4) */
1975 proto_tree_add_item(tree, hf_nas_eps_emm_gea4, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1976 /* GPRS encryption algorithm GEA5 supported (octet 7, bit 3) */
1977 proto_tree_add_item(tree, hf_nas_eps_emm_gea5, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1978 /* GPRS encryption algorithm GEA6 supported (octet 7, bit 2) */
1979 proto_tree_add_item(tree, hf_nas_eps_emm_gea6, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1980 /* GPRS encryption algorithm GEA7 supported (octet 7, bit 1) */
1981 proto_tree_add_item(tree, hf_nas_eps_emm_gea7, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1982 curr_offset++;
1984 return(len);
1987 * 9.9.3.37 Emergency Number List
1988 * See subclause 10.5.3.13 in 3GPP TS 24.008 [13].
1989 * packet-gsm_a_dtap.c
1993 * 9.9.3.38 CLI
1997 * The coding of the CLI value part is the same as for octets 3 to 14
1998 * of the Calling party BCD number information element defined in
1999 * subclause 10.5.4.9 of 3GPP TS 24.008
2003 * 9.9.3.39 SS Code
2005 static guint16
2006 de_emm_ss_code(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2007 guint32 offset, guint len _U_,
2008 gchar *add_string _U_, int string_len _U_)
2010 guint32 curr_offset;
2012 curr_offset = offset;
2015 * SS Code value
2016 * The coding of the SS Code value is given in subclause 17.7.5 of 3GPP TS 29.002 [15B].
2017 * value string imported from gsm map
2019 proto_tree_add_item(tree, hf_nas_eps_emm_ss_code, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2021 return(len);
2025 * 9.9.3.40 LCS indicator
2027 /* LCS indicator value */
2028 static const value_string nas_eps_emm_lcs_ind_vals[] = {
2029 { 0, "Normal, unspecified"},
2030 { 1, "MT-LR"},
2031 { 0, NULL }
2035 static guint16
2036 de_emm_lcs_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2037 guint32 offset, guint len _U_,
2038 gchar *add_string _U_, int string_len _U_)
2040 guint32 curr_offset;
2042 curr_offset = offset;
2045 proto_tree_add_item(tree, hf_nas_eps_emm_lcs_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2047 return(len);
2050 * 9.9.3.41 LCS client identity
2052 static guint16
2053 de_emm_lcs_client_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
2054 guint32 offset, guint len _U_,
2055 gchar *add_string _U_, int string_len _U_)
2057 guint32 curr_offset;
2058 tvbuff_t *new_tvb;
2060 curr_offset = offset;
2062 /* LCS client identity (value part)
2063 * The coding of the value part of the LCS client identity is given
2064 * in subclause 17.7.13 of 3GPP TS 29.002 [15B](GSM MAP).
2066 new_tvb = tvb_new_subset(tvb, curr_offset, len, len );
2067 dissect_gsm_map_lcs_LCS_ClientID_PDU( new_tvb, pinfo, tree, NULL );
2069 return(len);
2073 * 9.9.3.42 Generic message container type
2075 static const range_string nas_eps_emm_gen_msg_cont_type_vals[] = {
2076 { 0, 0, "Reserved"},
2077 { 1, 1, "LTE Positioning Protocol (LPP) message container"},
2078 { 2, 2, "Location services message container"},
2079 { 3, 127, "Unused"},
2080 { 128, 255, "Reserved"},
2081 { 0, 0, NULL }
2084 static guint16
2085 de_emm_gen_msg_cont_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2086 guint32 offset, guint len _U_,
2087 gchar *add_string _U_, int string_len _U_)
2089 guint32 curr_offset;
2091 curr_offset = offset;
2093 eps_nas_gen_msg_cont_type = tvb_get_guint8(tvb, curr_offset);
2094 proto_tree_add_item(tree, hf_nas_eps_emm_gen_msg_cont_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2095 curr_offset++;
2097 return(curr_offset - offset);
2100 * 9.9.3.43 Generic message container
2102 static guint16
2103 de_emm_gen_msg_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
2104 guint32 offset, guint len,
2105 gchar *add_string _U_, int string_len _U_)
2107 proto_item *item;
2108 proto_tree *sub_tree;
2109 tvbuff_t *new_tvb;
2111 item = proto_tree_add_item(tree, hf_nas_eps_gen_msg_cont, tvb, offset, len, ENC_NA);
2112 sub_tree = proto_item_add_subtree(item, ett_nas_eps_gen_msg_cont);
2114 new_tvb = tvb_new_subset(tvb, offset, len, len);
2116 switch (eps_nas_gen_msg_cont_type) {
2117 case 1:
2118 /* LPP */
2119 if (lpp_handle) {
2120 call_dissector(lpp_handle, new_tvb, pinfo, sub_tree);
2122 break;
2123 case 2:
2124 /* Location services */
2125 if (gsm_a_dtap_handle) {
2126 call_dissector(gsm_a_dtap_handle, new_tvb, pinfo, sub_tree);
2128 break;
2129 default:
2130 break;
2133 return(len);
2136 * 9.9.3.44 Voice domain preference and UE's usage setting
2137 * See subclause 10.5.5.28 in 3GPP TS 24.008 [13].
2138 * packet-gsm_a_dtap.c
2141 * 9.9.3.45 GUTI type
2143 static const true_false_string nas_eps_emm_guti_type_value = {
2144 "Mapped GUTI",
2145 "Native GUTI"
2148 static guint16
2149 de_emm_guti_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2150 guint32 offset, guint len _U_,
2151 gchar *add_string _U_, int string_len _U_)
2153 guint32 curr_offset, bit_offset;
2155 curr_offset = offset;
2156 bit_offset = (curr_offset<<3)+4;
2158 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2159 bit_offset += 3;
2160 proto_tree_add_bits_item(tree, hf_nas_eps_emm_guti_type, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2161 curr_offset++;
2163 return (curr_offset - offset);
2167 * 9.9.4 EPS Session Management (ESM) information elements
2171 * 9.9.4.1 Access point name
2172 * See subclause 10.5.6.1 in 3GPP TS 24.008 [6].
2175 * 9.9.4.2 APN aggregate maximum bit rate
2178 static guint16
2179 de_esm_apn_aggr_max_br(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2180 guint32 offset, guint len _U_,
2181 gchar *add_string _U_, int string_len _U_)
2183 guint32 curr_offset;
2184 guint8 octet;
2185 guint32 dl_total = 0;
2186 guint32 ul_total = 0;
2187 guint32 bitrate = 0;
2189 curr_offset = offset;
2190 /* APN-AMBR for downlink octet 3 */
2191 octet = tvb_get_guint8(tvb,curr_offset);
2192 if (octet == 0) {
2193 proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl, tvb, curr_offset, 1, octet,
2194 "Reserved");
2195 } else {
2196 bitrate = calc_bitrate(octet);
2197 dl_total += bitrate;
2198 proto_tree_add_uint_format_value(tree, hf_nas_eps_emm_apn_ambr_dl, tvb, curr_offset, 1, octet,
2199 "%u kbps", bitrate);
2201 curr_offset++;
2203 /* APN-AMBR for uplink octet 4 */
2204 octet = tvb_get_guint8(tvb,curr_offset);
2205 if (octet == 0) {
2206 proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul, tvb, curr_offset, 1, octet,
2207 "Reserved");
2208 } else {
2209 bitrate = calc_bitrate(octet);
2210 ul_total += bitrate;
2211 proto_tree_add_uint_format_value(tree, hf_nas_eps_emm_apn_ambr_ul, tvb, curr_offset, 1, octet,
2212 "%u kbps", bitrate);
2214 curr_offset++;
2215 if ((curr_offset - offset) >= len)
2216 return(len);
2217 /* APN-AMBR for downlink (extended) octet 5 */
2218 octet = tvb_get_guint8(tvb,curr_offset);
2219 if (octet == 0) {
2220 proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl_ext, tvb, curr_offset, 1, octet,
2221 "Use the value indicated by the APN-AMBR for downlink");
2222 } else {
2223 bitrate = calc_bitrate_ext(octet);
2224 dl_total += (octet > 0x4a) ? bitrate*1000 : bitrate;
2225 proto_tree_add_uint_format_value(tree, hf_nas_eps_emm_apn_ambr_dl_ext, tvb, curr_offset, 1, octet,
2226 "%u %s", bitrate, (octet > 0x4a) ? "Mbps" : "kbps");
2228 if (len < 5) {
2229 /* APN-AMBR for downlink (extended-2) is not present; display total now */
2230 if (octet != 0) {
2231 /* Ignore value indicated by the APN-AMBR for downlink */
2232 dl_total = (octet > 0x4a) ? bitrate*1000 : bitrate;
2234 if (dl_total >= 1000) {
2235 proto_tree_add_text(tree, tvb, curr_offset, 1,"Total APN-AMBR for downlink : %.3f Mbps", (gfloat)dl_total / 1000);
2236 } else {
2237 proto_tree_add_text(tree, tvb, curr_offset, 1,"Total APN-AMBR for downlink : %u kbps", dl_total);
2240 curr_offset++;
2241 if ((curr_offset - offset) >= len)
2242 return(len);
2243 /* APN-AMBR for uplink (extended) octet 6 */
2244 octet = tvb_get_guint8(tvb,curr_offset);
2245 if (octet == 0) {
2246 proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul_ext, tvb, curr_offset, 1, octet,
2247 "Use the value indicated by the APN-AMBR for uplink");
2248 } else {
2249 bitrate = calc_bitrate_ext(octet);
2250 ul_total += (octet > 0x4a) ? bitrate*1000 : bitrate;
2251 proto_tree_add_uint_format_value(tree, hf_nas_eps_emm_apn_ambr_ul_ext, tvb, curr_offset, 1, octet,
2252 "%u %s", bitrate, (octet > 0x4a) ? "Mbps" : "kbps");
2254 if (len < 6) {
2255 /* APN-AMBR for uplink (extended-2) is not present; display total now */
2256 if (octet != 0) {
2257 /* Ignore value indicated by the APN-AMBR for uplink */
2258 ul_total = (octet > 0x4a) ? bitrate*1000 : bitrate;
2260 if (ul_total >= 1000) {
2261 proto_tree_add_text(tree, tvb, curr_offset, 1,"Total APN-AMBR for uplink : %.3f Mbps", (gfloat)ul_total / 1000);
2262 } else {
2263 proto_tree_add_text(tree, tvb, curr_offset, 1,"Total APN-AMBR for uplink : %u kbps", ul_total);
2266 curr_offset++;
2267 if ((curr_offset - offset) >= len)
2268 return(len);
2269 /* APN-AMBR for downlink (extended-2) octet 7 */
2270 octet = tvb_get_guint8(tvb,curr_offset);
2271 if ((octet == 0)||(octet == 0xff)) {
2272 proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_dl_ext2, tvb, curr_offset, 1, octet,
2273 "Use the value indicated by the APN-AMBR for downlink and APN-AMBR for downlink (extended)");
2274 } else {
2275 dl_total += octet*256*1000;
2276 proto_tree_add_uint_format_value(tree, hf_nas_eps_emm_apn_ambr_dl_ext2, tvb, curr_offset, 1, octet,
2277 "%u Mbps", (octet* 256));
2279 proto_tree_add_text(tree, tvb, curr_offset, 1,"Total APN-AMBR for downlink : %.3f Mbps", (gfloat)dl_total / 1000);
2280 curr_offset++;
2281 if ((curr_offset - offset) >= len)
2282 return(len);
2283 /* APN-AMBR for uplink (extended-2) octet 8 */
2284 octet = tvb_get_guint8(tvb,curr_offset);
2285 if ((octet == 0)||(octet == 0xff)) {
2286 proto_tree_add_uint_format(tree, hf_nas_eps_emm_apn_ambr_ul_ext2, tvb, curr_offset, 1, octet,
2287 "Use the value indicated by the APN-AMBR for uplink and APN-AMBR for uplink (extended)");
2288 } else {
2289 ul_total += octet*256*1000;
2290 proto_tree_add_uint_format_value(tree, hf_nas_eps_emm_apn_ambr_ul_ext2, tvb, curr_offset, 1, octet,
2291 "%u Mbps", (octet* 256));
2293 proto_tree_add_text(tree, tvb, curr_offset, 1,"Total APN-AMBR for uplink : %.3f Mbps", (gfloat)ul_total / 1000);
2294 curr_offset++;
2296 return(len);
2299 * 9.9.4.2A Connectivity type
2300 * See subclause 10.5.6.19 in 3GPP TS 24.008.
2301 * packet-gsm_a_gm.c
2304 * 9.9.4.3 EPS quality of service
2307 /* Quality of Service Class Identifier (QCI), octet 3 (see 3GPP TS 23.203 [7]) */
2308 static const range_string nas_eps_qci_vals[] = {
2309 { 0x00, 0x00, "UE -> NW Network selects the QCI / NW -> UE Reserved"},
2310 { 0x01, 0x01, "QCI 1"},
2311 { 0x02, 0x02, "QCI 2"},
2312 { 0x03, 0x03, "QCI 3"},
2313 { 0x04, 0x04, "QCI 4"},
2314 { 0x05, 0x05, "QCI 5"},
2315 { 0x06, 0x06, "QCI 6"},
2316 { 0x07, 0x07, "QCI 7"},
2317 { 0x08, 0x08, "QCI 8"},
2318 { 0x09, 0x09, "QCI 9"},
2319 { 0x0A, 0x7F, "Reserved"},
2320 { 0x80, 0xFE, "Operator-specific QCI"},
2321 { 0xFF, 0xFF, "Reserved"},
2322 { 0, 0, NULL }
2327 guint16
2328 de_esm_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2329 guint32 offset, guint len,
2330 gchar *add_string _U_, int string_len _U_)
2332 guint32 curr_offset;
2333 guint8 octet;
2335 curr_offset = offset;
2337 /* QCI octet 3 */
2338 proto_tree_add_item(tree, hf_nas_eps_qci, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2339 curr_offset++;
2340 if ((curr_offset - offset) >= len)
2341 return(len);
2342 /* Maximum bit rate for uplink octet 4 */
2343 octet = tvb_get_guint8(tvb,curr_offset);
2344 if (octet == 0) {
2345 proto_tree_add_uint_format(tree, hf_nas_eps_mbr_ul, tvb, curr_offset, 1, octet,
2346 "UE->NW Subscribed maximum bit rate for uplink/ NW->UE Reserved");
2347 } else {
2348 proto_tree_add_uint_format_value(tree, hf_nas_eps_mbr_ul, tvb, curr_offset, 1, octet,
2349 "%u kbps", calc_bitrate(octet));
2351 curr_offset++;
2352 if ((curr_offset - offset) >= len)
2353 return(len);
2354 /* Maximum bit rate for downlink octet 5 */
2355 octet = tvb_get_guint8(tvb,curr_offset);
2356 if (octet == 0) {
2357 proto_tree_add_uint_format(tree, hf_nas_eps_mbr_dl, tvb, curr_offset, 1, octet,
2358 "UE->NW Subscribed maximum bit rate for downlink/ NW->UE Reserved");
2359 } else {
2360 proto_tree_add_uint_format_value(tree, hf_nas_eps_mbr_dl, tvb, curr_offset, 1, octet,
2361 "%u kbps", calc_bitrate(octet));
2363 curr_offset++;
2364 if ((curr_offset - offset) >= len)
2365 return(len);
2366 /* Guaranteed bit rate for uplink octet 6 */
2367 octet = tvb_get_guint8(tvb,curr_offset);
2368 proto_tree_add_uint_format_value(tree, hf_nas_eps_gbr_ul, tvb, curr_offset, 1, octet,
2369 "%u kbps", calc_bitrate(octet));
2371 curr_offset++;
2372 if ((curr_offset - offset) >= len)
2373 return(len);
2374 /* Guaranteed bit rate for downlink octet 7 */
2375 octet = tvb_get_guint8(tvb,curr_offset);
2376 proto_tree_add_uint_format_value(tree, hf_nas_eps_gbr_dl, tvb, curr_offset, 1, octet,
2377 "%u kbps", calc_bitrate(octet));
2379 curr_offset++;
2380 if ((curr_offset - offset) >= len)
2381 return(len);
2382 /* Maximum bit rate for uplink (extended) octet 8 */
2383 octet = tvb_get_guint8(tvb,curr_offset);
2384 if (octet == 0) {
2385 proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet,
2386 "Use the value indicated by the maximum bit rate for uplink in octet 4");
2387 } else {
2388 proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet,
2389 "Maximum bit rate for uplink (extended) : %u %s",
2390 calc_bitrate_ext(octet),
2391 (octet > 0x4a) ? "Mbps" : "kbps");
2393 curr_offset++;
2394 if ((curr_offset - offset) >= len)
2395 return(len);
2396 /* Maximum bit rate for downlink (extended) octet 9 */
2397 octet = tvb_get_guint8(tvb,curr_offset);
2398 if (octet == 0) {
2399 proto_tree_add_uint_format(tree, hf_nas_eps_embr_dl, tvb, curr_offset, 1, octet,
2400 "Use the value indicated by the maximum bit rate for downlink in octet 5");
2401 } else {
2402 proto_tree_add_uint_format(tree, hf_nas_eps_embr_dl, tvb, curr_offset, 1, octet,
2403 "Maximum bit rate for downlink (extended) : %u %s",
2404 calc_bitrate_ext(octet),
2405 (octet > 0x4a) ? "Mbps" : "kbps");
2407 curr_offset++;
2408 if ((curr_offset - offset) >= len)
2409 return(len);
2410 /* Guaranteed bit rate for uplink (extended) octet 10 */
2411 octet = tvb_get_guint8(tvb,curr_offset);
2412 if (octet == 0) {
2413 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_ul, tvb, curr_offset, 1, octet,
2414 "Use the value indicated by the guaranteed bit rate for uplink in octet 6");
2415 } else {
2416 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_ul, tvb, curr_offset, 1, octet,
2417 "Guaranteed bit rate for uplink (extended) : %u %s",
2418 calc_bitrate_ext(octet),
2419 (octet > 0x4a) ? "Mbps" : "kbps");
2421 curr_offset++;
2422 if ((curr_offset - offset) >= len)
2423 return(len);
2424 /* Guaranteed bit rate for downlink (extended) octet 11 */
2425 octet = tvb_get_guint8(tvb,curr_offset);
2426 if (octet == 0) {
2427 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_dl, tvb, curr_offset, 1, octet,
2428 "Use the value indicated by the guaranteed bit rate for downlink in octet 7");
2429 } else {
2430 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_dl, tvb, curr_offset, 1, octet,
2431 "Guaranteed bit rate for downlink (extended) : %u %s",
2432 calc_bitrate_ext(octet),
2433 (octet > 0x4a) ? "Mbps" : "kbps");
2435 curr_offset++;
2436 if ((curr_offset - offset) >= len)
2437 return(len);
2438 /* Maximum bit rate for uplink (extended-2) octet 12 */
2439 octet = tvb_get_guint8(tvb,curr_offset);
2440 if (octet == 0) {
2441 proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet,
2442 "Use the value indicated by the maximum bit rate for uplink in octet 4 and octet 8");
2443 } else {
2444 proto_tree_add_uint_format(tree, hf_nas_eps_embr_ul, tvb, curr_offset, 1, octet,
2445 "Maximum bit rate for uplink (extended-2) : %u Mbps",
2446 calc_bitrate_ext2(octet));
2448 curr_offset++;
2449 /* Maximum bit rate for downlink (extended-2) octet 13 */
2450 octet = tvb_get_guint8(tvb,curr_offset);
2451 if (octet == 0) {
2452 proto_tree_add_uint_format(tree, hf_nas_eps_embr_dl, tvb, curr_offset, 1, octet,
2453 "Use the value indicated by the maximum bit rate for downlink in octet 5 and octet 9");
2454 } else {
2455 proto_tree_add_uint_format(tree, hf_nas_eps_embr_dl, tvb, curr_offset, 1, octet,
2456 "Maximum bit rate for downlink (extended-2) : %u Mbps",
2457 calc_bitrate_ext2(octet));
2459 curr_offset++;
2460 /* Guaranteed bit rate for uplink (extended-2) octet 14 */
2461 octet = tvb_get_guint8(tvb,curr_offset);
2462 if (octet == 0) {
2463 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_ul, tvb, curr_offset, 1, octet,
2464 "Use the value indicated by the guaranted bit rate for uplink in octet 6 and octet 10");
2465 } else {
2466 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_ul, tvb, curr_offset, 1, octet,
2467 "Guaranteed bit rate for uplink (extended-2) : %u Mbps",
2468 calc_bitrate_ext2(octet));
2470 curr_offset++;
2471 /* Guaranted bit rate for downlink (extended-2) octet 15 */
2472 octet = tvb_get_guint8(tvb,curr_offset);
2473 if (octet == 0) {
2474 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_dl, tvb, curr_offset, 1, octet,
2475 "Use the value indicated by the guaranteed bit rate for downlink in octet 7 and octet 11");
2476 } else {
2477 proto_tree_add_uint_format(tree, hf_nas_eps_egbr_dl, tvb, curr_offset, 1, octet,
2478 "Guaranteed bit rate for downlink (extended-2) : %u Mbps",
2479 calc_bitrate_ext2(octet));
2482 return(len);
2485 * 9.9.4.4 ESM cause
2488 static const value_string nas_eps_esm_cause_vals[] = {
2489 { 0x08, "Operator Determined Barring"},
2490 { 0x1a, "Insufficient resources"},
2491 { 0x1b, "Missing or unknown APN"},
2492 { 0x1c, "Unknown PDN type"},
2493 { 0x1d, "User authentication failed"},
2494 { 0x1e, "Request rejected by Serving GW or PDN GW"},
2495 { 0x1f, "Request rejected, unspecified"},
2496 { 0x20, "Service option not supported"},
2497 { 0x21, "Requested service option not subscribed"},
2498 { 0x22, "Service option temporarily out of order"},
2499 { 0x23, "PTI already in use"},
2500 { 0x24, "Regular deactivation"},
2501 { 0x25, "EPS QoS not accepted"},
2502 { 0x26, "Network failure"},
2503 { 0x27, "Reactivation requested"},
2504 { 0x29, "Semantic error in the TFT operation"},
2505 { 0x2a, "Syntactical error in the TFT operation"},
2506 { 0x2b, "Invalid EPS bearer identity"},
2507 { 0x2c, "Semantic errors in packet filter(s)"},
2508 { 0x2d, "Syntactical errors in packet filter(s)"},
2509 { 0x2e, "Unused"},
2510 { 0x2f, "PTI mismatch"},
2511 { 0x31, "Last PDN disconnection not allowed"},
2512 { 0x32, "PDN type IPv4 only allowed"},
2513 { 0x33, "PDN type IPv6 only allowed"},
2514 { 0x34, "Single address bearers only allowed"},
2515 { 0x35, "ESM information not received"},
2516 { 0x36, "PDN connection does not exist"},
2517 { 0x37, "Multiple PDN connections for a given APN not allowed"},
2518 { 0x38, "Collision with network initiated request"},
2519 { 0x3b, "Unsupported QCI value"},
2520 { 0x3c, "Bearer handling not supported"},
2521 { 0x41, "Maximum number of EPS bearers reached"},
2522 { 0x42, "Requested APN not supported in current RAT and PLMN combination"},
2523 { 0x51, "Invalid PTI value"},
2524 { 0x5f, "Semantically incorrect message"},
2525 { 0x60, "Invalid mandatory information"},
2526 { 0x61, "Message type non-existent or not implemented"},
2527 { 0x62, "Message type not compatible with the protocol state"},
2528 { 0x63, "Information element non-existent or not implemented"},
2529 { 0x64, "Conditional IE error"},
2530 { 0x65, "Message not compatible with the protocol state"},
2531 { 0x6f, "Protocol error, unspecified"},
2532 { 0x70, "APN restriction value incompatible with active EPS bearer context"},
2533 { 0, NULL }
2535 static value_string_ext nas_eps_esm_cause_vals_ext = VALUE_STRING_EXT_INIT(nas_eps_esm_cause_vals);
2537 static guint16
2538 de_esm_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2539 guint32 offset, guint len _U_,
2540 gchar *add_string _U_, int string_len _U_)
2542 guint32 curr_offset;
2544 curr_offset = offset;
2546 proto_tree_add_item(tree, hf_nas_eps_esm_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2547 curr_offset++;
2549 return(curr_offset - offset);
2552 * 9.9.4.5 ESM information transfer flag
2554 /* EIT (ESM information transfer) */
2555 static const true_false_string nas_eps_emm_eit_vals = {
2556 "Security protected ESM information transfer required",
2557 "Security protected ESM information transfer not required"
2559 static guint16
2560 de_esm_inf_trf_flg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2561 guint32 offset, guint len _U_,
2562 gchar *add_string _U_, int string_len _U_)
2564 guint32 curr_offset;
2566 curr_offset = offset;
2569 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, (curr_offset<<3)+4, 3, ENC_BIG_ENDIAN);
2570 proto_tree_add_item(tree, hf_nas_eps_esm_eit, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2571 curr_offset++;
2572 return(curr_offset-offset);
2575 * 9.9.4.6 Linked EPS bearer identity
2578 * Linked EPS bearer identity (bits 1-4)
2581 static const value_string nas_eps_esm_linked_bearer_id_vals[] = {
2582 { 0x0, "Reserved"},
2583 { 0x1, "Reserved"},
2584 { 0x2, "Reserved"},
2585 { 0x3, "Reserved"},
2586 { 0x4, "Reserved"},
2587 { 0x5, "EPS bearer identity value 5"},
2588 { 0x6, "EPS bearer identity value 6"},
2589 { 0x7, "EPS bearer identity value 7"},
2590 { 0x8, "EPS bearer identity value 8"},
2591 { 0x9, "EPS bearer identity value 9"},
2592 { 0xa, "EPS bearer identity value 10"},
2593 { 0xb, "EPS bearer identity value 11"},
2594 { 0xc, "EPS bearer identity value 12"},
2595 { 0xd, "EPS bearer identity value 13"},
2596 { 0xe, "EPS bearer identity value 14"},
2597 { 0xf, "EPS bearer identity value 15"},
2598 { 0, NULL }
2602 * 9.9.4.7 LLC service access point identifier
2603 * See subclause 10.5.6.9 in 3GPP TS 24.008
2607 * 9.9.4.7a Notification indicator
2609 static const value_string nas_eps_esm_notif_ind_vals[] = {
2610 { 0x0, "Reserved"},
2611 { 0x1, "SRVCC handover cancelled, IMS session re-establishment required"},
2612 { 0, NULL }
2615 static guint16
2616 de_esm_notif_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2617 guint32 offset, guint len _U_,
2618 gchar *add_string _U_, int string_len _U_)
2620 guint32 curr_offset;
2622 curr_offset = offset;
2624 proto_tree_add_item(tree, hf_nas_eps_esm_notif_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2626 return(len);
2630 * 9.9.4.8 Packet flow identifier
2631 * See subclause 10.5.6.11 in 3GPP TS 24.008
2634 * 9.9.4.9 PDN address
2636 static guint16
2637 de_esm_pdn_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_,
2638 guint32 offset, guint len _U_,
2639 gchar *add_string _U_, int string_len _U_)
2641 guint32 curr_offset;
2642 guint8 pdn_type;
2644 curr_offset = offset;
2647 pdn_type = tvb_get_guint8(tvb, offset) & 0x7;
2648 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, curr_offset<<3, 5, ENC_BIG_ENDIAN);
2649 proto_tree_add_item(tree, hf_nas_eps_esm_pdn_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2650 curr_offset++;
2652 switch (pdn_type) {
2653 case 1:
2654 /* IPv4 */
2655 proto_tree_add_item(tree, hf_nas_eps_esm_pdn_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
2656 curr_offset+=4;
2657 break;
2658 case 2:
2659 /* IPv6 3GPP TS 24.301 version 9.4.0 Release 9
2660 * If PDN type value indicates IPv6, the PDN address information in octet 4 to octet 11
2661 * contains an IPv6 interface identifier. Bit 8 of octet 4 represents the most significant bit
2662 * of the IPv6 interface identifier and bit 1 of octet 11 the least significant bit.
2664 proto_tree_add_item(tree, hf_nas_eps_esm_pdn_ipv6_if_id, tvb, curr_offset, 8, ENC_NA);
2665 curr_offset+=8;
2666 break;
2667 case 3:
2668 /* IPv4/IPv6 3GPP TS 24.301 version 9.4.0 Release 9
2669 * If PDN type value indicates IPv4v6, the PDN address information in octet 4 to octet 15
2670 * contains an IPv6 interface identifier and an IPv4 address. Bit 8 of octet 4 represents
2671 * the most significant bit of the IPv6 interface identifier and bit 1 of octet 11 the least
2672 * significant bit. Bit 8 of octet 12 represents the most significant bit of the IPv4 address
2673 * and bit 1 of octet 15 the least significant bit.
2675 proto_tree_add_item(tree, hf_nas_eps_esm_pdn_ipv6_if_id, tvb, curr_offset, 8, ENC_NA);
2676 curr_offset+=8;
2677 proto_tree_add_item(tree, hf_nas_eps_esm_pdn_ipv4, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
2678 curr_offset+=4;
2679 break;
2680 default:
2681 break;
2684 return(curr_offset-offset);
2688 * 9.9.4.10 PDN type
2689 * Coded inline 1/2 octet
2691 static const value_string nas_eps_esm_pdn_type_values[] = {
2692 { 0x1, "IPv4" },
2693 { 0x2, "IPv6" },
2694 { 0x3, "IPv4v6" },
2695 { 0x4, "Unused; shall be interpreted as IPv6 if received by the network" },
2696 { 0, NULL }
2700 * 9.9.4.11 Protocol configuration options
2701 * See subclause 10.5.6.3 in 3GPP TS 24.008
2704 * 9.9.4.12 Quality of service
2705 * See subclause 10.5.6.5 in 3GPP TS 24.008
2706 * Coded inline 1/2 octet
2709 * 9.9.4.13 Radio priority
2710 * See subclause 10.5.7.2 in 3GPP TS 24.008
2713 * 9.9.4.14 Request type
2714 * See subclause 10.5.6.17 in 3GPP TS 24.008
2716 static const value_string nas_eps_esm_request_type_values[] = {
2717 { 0x1, "initial request" },
2718 { 0x2, "Handover" },
2719 { 0x3, "Unused; shall be interpreted as initial request if received by the network" },
2720 { 0x4, "emergency" },
2721 { 0, NULL }
2725 * 9.9.4.15 Traffic flow aggregate description
2726 * The Traffic flow aggregate description information element is encoded using the same format as the Traffic flow
2727 * template information element (see subclause 10.5.6.12 in 3GPP TS 24.008 [13]). When sending this IE, the UE shall
2728 * assign the packet filter identifier values so that they are unique across all packet filters for the PDN connection.
2731 * 9.9.4.16 Traffic flow template
2732 * See subclause 10.5.6.12 in 3GPP TS 24.008
2733 * packet-gsm_a_gm.c
2736 * 9.9.4.17 Transaction identifier
2737 * The Transaction identifier information element is coded as the Linked TI information element in 3GPP TS 24.008 [13],
2738 * subclause 10.5.6.7.
2739 * The coding of the TI flag, the TI value and the EXT bit is defined in 3GPP TS 24.007[20].
2742 guint16 (*emm_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) = {
2743 /* 9.9.3 EPS Mobility Management (EMM) information elements */
2744 de_emm_add_upd_res, /* 9.9.3.0A Additional update result */
2745 de_emm_add_upd_type, /* 9.9.3.0B Additional update type */
2746 NULL, /* 9.9.3.1 Authentication failure parameter(dissected in packet-gsm_a_dtap.c) */
2747 NULL, /* 9.9.3.2 Authentication parameter AUTN(packet-gsm_a_dtap.c) */
2748 NULL, /* 9.9.3.3 Authentication parameter RAND */
2749 de_emm_auth_resp_par, /* 9.9.3.4 Authentication response parameter */
2750 de_emm_csfb_resp, /* 9.9.3.5 CSFB response */
2751 NULL, /* 9.9.3.6 Daylight saving time (packet-gsm_a_dtap.c)*/
2752 NULL, /* 9.9.3.7 Detach type */
2753 NULL, /* 9.9.3.8 DRX parameter */
2754 de_emm_cause, /* 9.9.3.9 EMM cause */
2755 NULL, /* 9.9.3.10 EPS attach result (coded inline) */
2756 NULL, /* 9.9.3.11 EPS attach type(Coded Inline) */
2757 de_emm_eps_mid, /* 9.9.3.12 EPS mobile identity */
2758 de_emm_eps_net_feature_sup, /* 9.9.3.12A EPS network feature support */
2759 NULL, /* 9.9.3.13 EPS update result (Coded Inline)*/
2760 NULL, /* 9.9.3.14 EPS update type (Inline)*/
2761 de_emm_esm_msg_cont, /* 9.9.3.15 ESM message conta */
2762 NULL, /* 9.9.3.16 GPRS timer ,See subclause 10.5.7.3 in 3GPP TS 24.008 [6]. (packet-gsm_a_gm.c)*/
2763 NULL, /* 9.9.3.16A GPRS timer 2, See subclause 10.5.7.4 in 3GPP TS 24.008. (packet-gsm_a_gm.c)*/
2764 NULL, /* 9.9.3.16B GPRS timer 3, See subclause 10.5.7.4a in 3GPP TS 24.008. (packet-gsm_a_gm.c)*/
2765 NULL, /* 9.9.3.17 Identity type 2 ,See subclause 10.5.5.9 in 3GPP TS 24.008 [6]. */
2766 de_emm_nas_imeisv_req, /* 9.9.3.18 IMEISV request ,See subclause 10.5.5.10 in 3GPP TS 24.008 [6]. */
2767 de_emm_nas_ksi_and_seq_no, /* 9.9.3.19 KSI and sequence number */
2768 NULL, /* 9.9.3.20 MS network capability ,See subclause 10.5.5.12 in 3GPP TS 24.008 [6].(packet-gsm_a_gm.c) */
2769 NULL, /* 9.9.3.20A MS network feature support, See subclause 10.5.1.15 in 3GPP TS 24.008.(packet-gsm_a_gm.c) */
2770 de_emm_nas_key_set_id, /* 9.9.3.21 NAS key set identifier (Coded Inline) */
2771 de_emm_nas_msg_cont, /* 9.9.3.22 NAS message container */
2772 de_emm_nas_sec_alsgs, /* 9.9.3.23 NAS security algorithms */
2773 NULL, /* 9.9.3.24 Network name, See subclause 10.5.3.5a in 3GPP TS 24.008 [6]. (packet-gsm_a_dtap.c)*/
2774 de_emm_nonce, /* 9.9.3.25 Nonce */
2775 de_emm_paging_id, /* 9.9.3.25A Paging identity */
2776 NULL, /* 9.9.3.26 P-TMSI signature, See subclause 10.5.5.8 in 3GPP TS 24.008 [6]. (packet-gsm_a_gm.c)*/
2777 NULL, /* 9.9.3.27 Service type */
2778 de_emm_nas_short_mac, /* 9.9.3.28 Short MAC */
2779 NULL, /* 9.9.3.29 Time zone, See subclause 10.5.3.8 in 3GPP TS 24.008 [6]. (packet-gsm_a_dtap.c)*/
2780 NULL, /* 9.9.3.30 Time zone and time, See subclause 10.5.3.9 in 3GPP TS 24.008 [6]. (packet-gsm_a_dtap.c)*/
2781 NULL, /* 9.9.3.31 TMSI status, See subclause 10.5.5.4 in 3GPP TS 24.008 [6]. (packet-gsm_a_gm.c)*/
2782 de_emm_trac_area_id, /* 9.9.3.32 Tracking area identity */
2783 de_emm_trac_area_id_lst, /* 9.9.3.33 Tracking area identity list */
2784 de_emm_ue_net_cap, /* 9.9.3.34 UE network capability */
2785 de_emm_ue_ra_cap_inf_upd_need, /* 9.9.3.35 UE radio capability information update needed */
2786 de_emm_ue_sec_cap, /* 9.9.3.36 UE security capability */
2787 NULL, /* 9.9.3.37 Emergency Number List (packet-gsm_A_dtap.c) */
2788 NULL, /* 9.9.3.38 CLI */
2789 de_emm_ss_code, /* 9.9.3.39 SS Code */
2790 de_emm_lcs_ind, /* 9.9.3.40 LCS indicator */
2791 de_emm_lcs_client_id, /* 9.9.3.41 LCS client identity */
2792 de_emm_gen_msg_cont_type, /* 9.9.3.42 Generic message container type */
2793 de_emm_gen_msg_cont, /* 9.9.3.43 Generic message container */
2794 NULL, /* 9.9.3.44 Voice domain preference and UE's usage setting */
2795 de_emm_guti_type, /* 9.9.3.45 GUTI type */
2796 NULL, /* NONE */
2799 /* 9.9.4 EPS Session Management (ESM) information elements */
2800 typedef enum
2802 DE_ESM_APN, /* 9.9.4.1 Access point name */
2803 DE_ESM_APN_AGR_MAX_BR, /* 9.9.4.2 APN aggregate maximum bit rate */
2804 DE_ESM_CONNECTIVITY_TYPE, /* 9.9.4.2A Connectivity type */
2805 DE_ESM_EPS_QOS, /* 9.9.4.3 EPS quality of service */
2806 DE_ESM_CAUSE, /* 9.9.4.4 ESM cause */
2807 DE_ESM_INF_TRF_FLG, /* 9.9.4.5 ESM information transfer flag */
2808 DE_ESM_LNKED_EPS_B_ID, /* 9.9.4.6 Linked EPS bearer identity */
2809 DE_ESM_LLC_SAPI, /* 9.9.4.7 LLC service access point identifier */
2810 DE_ESM_NOTIF_IND, /* 9.9.4.7a Notification indicator */
2811 DE_ESM_P_FLW_ID, /* 9.9.4.8 Packet flow identifier */
2812 DE_ESM_PDN_ADDR, /* 9.9.4.9 PDN address */
2813 DE_ESM_PDN_TYPE, /* 9.9.4.10 PDN type */
2814 DE_ESM_PROT_CONF_OPT, /* 9.9.4.11 Protocol configuration options */
2815 DE_ESM_QOS, /* 9.9.4.12 Quality of service */
2816 DE_ESM_RA_PRI, /* 9.9.4.13 Radio priority */
2817 DE_ESM_REQ_TYPE, /* 9.9.4.14 Request type */
2818 DE_ESM_TRAF_FLOW_AGR_DESC, /* 9.9.4.15 Traffic flow aggregate description */
2819 DE_ESM_TRAF_FLOW_TEMPL, /* 9.9.4.16 Traffic flow template */
2820 DE_ESM_TID, /* 9.9.4.17 Transaction identifier */
2821 DE_ESM_NONE /* NONE */
2823 nas_esm_elem_idx_t;
2825 static const value_string nas_esm_elem_strings[] = {
2826 { DE_ESM_APN, "Access point name" }, /* 9.9.4.1 Access point name */
2827 { DE_ESM_APN_AGR_MAX_BR, "APN aggregate maximum bit rate" }, /* 9.9.4.2 APN aggregate maximum bit rate */
2828 { DE_ESM_CONNECTIVITY_TYPE, "Connectivity type" }, /* 9.9.4.2A Connectivity type */
2829 { DE_ESM_EPS_QOS, "EPS quality of service" }, /* 9.9.4.3 EPS quality of service */
2830 { DE_ESM_CAUSE, "ESM cause" }, /* 9.9.4.4 ESM cause */
2831 { DE_ESM_INF_TRF_FLG, "ESM information transfer flag" }, /* 9.9.4.5 ESM information transfer flag */
2832 { DE_ESM_LNKED_EPS_B_ID, "Linked EPS bearer identity" }, /* 9.9.4.6 Linked EPS bearer identity */
2833 { DE_ESM_LLC_SAPI, "LLC service access point identifier" }, /* 9.9.4.7 LLC service access point identifier */
2834 { DE_ESM_NOTIF_IND, "Notification indicator" }, /* 9.9.4.7a Notification indicator */
2835 { DE_ESM_P_FLW_ID, "Packet flow identifier" }, /* 9.9.4.8 Packet flow identifier */
2836 { DE_ESM_PDN_ADDR, "PDN address" }, /* 9.9.4.9 PDN address */
2837 { DE_ESM_PDN_TYPE, "PDN type" }, /* 9.9.4.10 PDN type */
2838 { DE_ESM_PROT_CONF_OPT, "Protocol configuration options" }, /* 9.9.4.11 Protocol configuration options */
2839 { DE_ESM_QOS, "Quality of service" }, /* 9.9.4.12 Quality of service */
2840 { DE_ESM_RA_PRI, "Radio priority" }, /* 9.9.4.13 Radio priority */
2841 { DE_ESM_REQ_TYPE, "Request type" }, /* 9.9.4.14 Request type */
2842 { DE_ESM_TRAF_FLOW_AGR_DESC, "Traffic flow aggregate description" },/* 9.9.4.15 Traffic flow aggregate description */
2843 { DE_ESM_TRAF_FLOW_TEMPL, "Traffic flow template" }, /* 9.9.4.16 Traffic flow template */
2844 { DE_ESM_TID, "Transaction identifier" }, /* 9.9.4.17 Transaction identifier */
2845 { 0, NULL }
2847 value_string_ext nas_esm_elem_strings_ext = VALUE_STRING_EXT_INIT(nas_esm_elem_strings);
2849 #define NUM_NAS_ESM_ELEM (sizeof(nas_esm_elem_strings)/sizeof(value_string))
2850 gint ett_nas_eps_esm_elem[NUM_NAS_ESM_ELEM];
2852 guint16 (*esm_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) = {
2853 NULL, /* 9.9.4.1 Access point name */
2854 de_esm_apn_aggr_max_br, /* 9.9.4.2 APN aggregate maximum bit rate */
2855 NULL, /* 9.9.4.2A Connectivity type */
2856 de_esm_qos, /* 9.9.4.3 EPS quality of service */
2857 de_esm_cause, /* 9.9.4.4 ESM cause */
2858 de_esm_inf_trf_flg, /* 9.9.4.5 ESM information transfer flag */
2859 NULL, /* 9.9.4.6 Linked EPS bearer identity */
2860 NULL, /* 9.9.4.7 LLC service access point identifier */
2861 de_esm_notif_ind, /* 9.9.4.7a Notification indicator */
2862 NULL, /* 9.9.4.8 Packet flow identifier */
2863 de_esm_pdn_addr, /* 9.9.4.9 PDN address */
2864 NULL, /* 9.9.4.10 PDN type */
2865 NULL, /* 9.9.4.11 Protocol configuration options */
2866 NULL, /* 9.9.4.12 Quality of service */
2867 NULL, /* 9.9.4.13 Radio priority */
2868 NULL, /* 9.9.4.14 Request type */
2869 NULL, /* 9.9.4.15 Traffic flow aggregate description */
2870 NULL, /* 9.9.4.16 Traffic flow template */
2871 NULL, /* 9.9.4.17 Transaction identifier */
2872 NULL, /* NONE */
2875 /* MESSAGE FUNCTIONS */
2878 * 8.2.1 Attach accept
2881 static void
2882 nas_emm_attach_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
2884 guint32 curr_offset, bit_offset;
2885 guint32 consumed;
2886 guint curr_len;
2888 curr_offset = offset;
2889 curr_len = len;
2891 /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */
2892 bit_offset = curr_offset<<3;
2893 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
2894 bit_offset+=4;
2895 /* EPS attach result EPS attach result 9.9.3.10 M V 1/2 */
2896 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2897 bit_offset++;
2898 proto_tree_add_bits_item(tree, hf_nas_eps_emm_EPS_attach_result, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
2899 /*bit_offset+=3;*/
2900 /* Fix up the lengths */
2901 curr_len--;
2902 curr_offset++;
2903 /* T3412 value GPRS timer 9.9.3.16 M V 1 */
2904 ELEM_MAND_V(GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3412 value");
2905 /* Tracking area identity list 9.9.3.33 M LV 7-97 */
2906 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID_LST, " - TAI list");
2907 /* ESM message container 9.9.3.15 M LV-E 2-n */
2908 ELEM_MAND_LV_E(NAS_PDU_TYPE_EMM, DE_EMM_ESM_MSG_CONT, NULL);
2909 /* 50 GUTI EPS mobile identity 9.9.3.12 O TLV 13 */
2910 ELEM_OPT_TLV(0x50, NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, " - GUTI");
2911 /* 13 Location area identification Location area identification 9.9.2.2 O TV 6 */
2912 ELEM_OPT_TV(0x13, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_LOC_AREA_ID, NULL);
2913 /* 23 MS identity Mobile identity 9.9.2.3 O TLV 7-10 */
2914 ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_MOB_ID, " - MS identity");
2915 /* 53 EMM cause EMM cause 9.9.3.9 O TV 2 */
2916 ELEM_OPT_TV(0x53, NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
2917 /* 17 T3402 value GPRS timer 9.9.3.16 O TV 2 */
2918 ELEM_OPT_TV(0x17, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3402 value");
2919 /* 59 T3423 value GPRS timer 9.9.3.16 O TV 2 */
2920 ELEM_OPT_TV(0x59, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3423 value");
2921 /* 4A Equivalent PLMNs PLMN list 9.9.2.8 O TLV 5-47 */
2922 ELEM_OPT_TLV(0x4a, GSM_A_PDU_TYPE_COMMON, DE_PLMN_LIST, " - Equivalent PLMNs");
2923 /* 34 Emergency Number List 9.9.3.37 O TLV 5-50 */
2924 ELEM_OPT_TLV(0x34, GSM_A_PDU_TYPE_DTAP, DE_EMERGENCY_NUM_LIST, NULL);
2925 /* 64 EPS network feature support EPS network feature support 9.9.3.12A O TLV 3 */
2926 ELEM_OPT_TLV(0x64, NAS_PDU_TYPE_EMM, DE_EMM_EPS_NET_FEATURE_SUP, NULL);
2927 /* F- Additional update result Additional update result 9.9.3.0A O TV 1 */
2928 ELEM_OPT_TV_SHORT( 0xF0 , NAS_PDU_TYPE_EMM, DE_EMM_ADD_UPD_RES, NULL );
2929 /* 5E T3412 extended value GPRS timer 3 9.9.3.16B O TLV 3 */
2930 ELEM_OPT_TLV(0x5E, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3412 extended value");
2932 EXTRANEOUS_DATA_CHECK(curr_len, 0);
2935 * 8.2.2 Attach complete
2937 static void
2938 nas_emm_attach_comp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
2940 guint32 curr_offset;
2941 guint32 consumed;
2942 guint curr_len;
2944 curr_offset = offset;
2945 curr_len = len;
2947 /* ESM message container ESM message container 9.9.3.15 M LV-E 2-n */
2948 ELEM_MAND_LV_E(NAS_PDU_TYPE_EMM, DE_EMM_ESM_MSG_CONT, NULL);
2950 EXTRANEOUS_DATA_CHECK(curr_len, 0);
2955 * 8.2.3 Attach reject
2957 static void
2958 nas_emm_attach_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
2960 guint32 curr_offset;
2961 guint32 consumed;
2962 guint curr_len;
2964 curr_offset = offset;
2965 curr_len = len;
2967 /* * EMM cause EMM cause 9.9.3.9 M V 1 */
2968 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
2969 /* 78 ESM message container ESM message container 9.9.3.15 O TLV-E 4-n */
2970 ELEM_OPT_TLV_E(0x78, NAS_PDU_TYPE_EMM, DE_EMM_ESM_MSG_CONT, NULL);
2971 /* 5F T3346 value GPRS timer 2 9.9.3.16A O TLV 3 */
2972 ELEM_OPT_TLV(0x5F, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3346 value");
2973 /* 16 T3402 value GPRS timer 2 9.9.3.16A O TLV 3 */
2974 ELEM_OPT_TLV(0x16, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3402 value");
2976 EXTRANEOUS_DATA_CHECK(curr_len, 0);
2980 * 8.2.4 Attach request
2982 static void
2983 nas_emm_attach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
2985 guint32 curr_offset, bit_offset;
2986 guint32 consumed;
2987 guint curr_len;
2989 curr_offset = offset;
2990 curr_len = len;
2992 bit_offset = curr_offset<<3;
2994 /* NAS key set identifier NAS key set identifier 9.9.3.21 M V 1/2 */
2995 de_emm_nas_key_set_id_bits(tvb, tree, bit_offset, NULL);
2996 bit_offset+=4;
2998 /* EPS attach type EPS attach type 9.9.3.11 M V 1/2
2999 * Inline:
3001 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3002 bit_offset++;
3003 proto_tree_add_bits_item(tree, hf_nas_eps_emm_eps_att_type, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3004 /*bit_offset+=3;*/
3006 /* Fix the lengths */
3007 curr_len--;
3008 curr_offset++;
3009 /* Old GUTI or IMSI EPS mobile identity 9.9.3.12 M LV 5-12 */
3010 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, NULL);
3011 /* UE network capability UE network capability 9.9.3.34 M LV 3-14 */
3012 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_UE_NET_CAP, NULL);
3013 /* ESM message container ESM message container 9.9.3.15 M LV-E 2-n */
3014 ELEM_MAND_LV_E(NAS_PDU_TYPE_EMM, DE_EMM_ESM_MSG_CONT, NULL);
3015 /* 19 Old P-TMSI signature P-TMSI signature 10.5.5.8 O TV 4 */
3016 ELEM_OPT_TV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, " - Old P-TMSI Signature");
3017 /* 50 Additional GUTI EPS mobile identity 9.9.3.12 O TLV 13 */
3018 ELEM_OPT_TLV( 0x50 , NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, " - Additional GUTI");
3019 /* 52 Last visited registered TAI Tracking area identity 9.9.3.32 O TV 6 */
3020 ELEM_OPT_TV(0x52, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, " - Last visited registered TAI");
3021 /* 5c DRX parameter DRX parameter 9.9.3.8 O TV 3 */
3022 ELEM_OPT_TV(0x5c, GSM_A_PDU_TYPE_GM, DE_DRX_PARAM, NULL );
3023 /* 31 MS network capability MS network capability 9.9.3.20 M LV 3-9 */
3024 ELEM_OPT_TLV( 0x31, GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP , NULL );
3025 /* 13 Old location area identification Location area identification 9.9.2.2 O TV 6 */
3026 ELEM_OPT_TV(0x13, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_LOC_AREA_ID, " - Old location area identification");
3027 /* 9- TMSI status TMSI status 9.9.3.31 O TV 1 */
3028 ELEM_OPT_TV_SHORT( 0x90 , GSM_A_PDU_TYPE_GM, DE_TMSI_STAT , NULL );
3029 /* 11 Mobile station classmark 2 Mobile station classmark 2 9.9.2.5 O TLV 5 */
3030 ELEM_OPT_TLV( 0x11, NAS_PDU_TYPE_COMMON, DE_EPS_MS_CM_2 , NULL );
3031 /* 20 Mobile station classmark 3 Mobile station classmark 3 9.9.2.5 O TLV 2-34 */
3032 ELEM_OPT_TLV( 0x20, NAS_PDU_TYPE_COMMON, DE_EPS_MS_CM_3 , NULL );
3033 /* 40 Supported Codecs Supported Codec List 9.9.2.10 O TLV 5-n */
3034 ELEM_OPT_TLV(0x40, GSM_A_PDU_TYPE_DTAP, DE_SUP_CODEC_LIST, " - Supported Codecs");
3035 /* F- Additional update type Additional update type 9.9.3.0B O TV 1 */
3036 ELEM_OPT_TV_SHORT( 0xF0 , NAS_PDU_TYPE_EMM, DE_EMM_ADD_UPD_TYPE, NULL );
3037 /* 5D Voice domain preference and UE's usage setting Voice domain preference and UE's usage setting 9.9.3.44 O TLV 3 */
3038 ELEM_OPT_TLV(0x5D, GSM_A_PDU_TYPE_GM, DE_VOICE_DOMAIN_PREF, NULL);
3039 /* D- Device properties Device properties 9.9.2.0A O TV 1 */
3040 ELEM_OPT_TV_SHORT(0xD0 , GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
3041 /* E- Old GUTI type GUTI type 9.9.3.45 O TV 1 */
3042 ELEM_OPT_TV_SHORT(0xE0 , NAS_PDU_TYPE_EMM, DE_EMM_GUTI_TYPE, " - Old GUTI type");
3043 /* C- MS network feature support MS network feature support 9.9.3.20A 0 TV 1 */
3044 ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_COMMON, DE_MS_NET_FEAT_SUP, NULL);
3045 /* 10 TMSI based NRI container Network resource identifier container 9.9.3.24A 0 TLV 4 */
3046 ELEM_OPT_TLV(0x10, GSM_A_PDU_TYPE_GM, DE_NET_RES_ID_CONT, " - TMSI based NRI container");
3048 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3051 * 8.2.5 Authentication failure
3053 static void
3054 nas_emm_auth_fail(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3056 guint32 curr_offset;
3057 guint32 consumed;
3058 guint curr_len;
3060 curr_offset = offset;
3061 curr_len = len;
3063 /* EMM cause EMM cause 9.9.3.9 M V 1 */
3064 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
3065 /* 30 Authentication failure parameter Authentication failure parameter 9.9.3.1 O TLV 1 */
3066 ELEM_OPT_TLV(0x30, GSM_A_PDU_TYPE_DTAP, DE_AUTH_FAIL_PARAM, NULL);
3068 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3071 * 8.2.6 Authentication reject
3072 * No IE:s
3075 * 8.2.7 Authentication request
3078 static void
3079 nas_emm_auth_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3081 guint32 curr_offset, bit_offset;
3082 guint32 consumed;
3083 guint curr_len;
3085 curr_offset = offset;
3086 curr_len = len;
3088 bit_offset = curr_offset<<3;
3089 /* H1 */
3090 /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */
3091 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3092 bit_offset+=4;
3093 /* H0 */
3095 * NAS key set identifierASME NAS key set identifier 9.9.3.21 M V 1/2
3097 de_emm_nas_key_set_id_bits(tvb, tree, bit_offset, " ASME");
3098 /*bit_offset+=4;*/
3100 /* Fix the lengths */
3101 curr_len--;
3102 curr_offset++;
3105 * Authentication parameter RAND (EPS challenge) 9.9.3.3 M V 16
3107 ELEM_MAND_V(GSM_A_PDU_TYPE_DTAP, DE_AUTH_PARAM_RAND, " - EPS challenge");
3109 * Authentication parameter AUTN (EPS challenge) 9.9.3.2 M LV 17
3111 ELEM_MAND_LV(GSM_A_PDU_TYPE_DTAP, DE_AUTH_PARAM_AUTN, " - EPS challenge");
3113 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3117 * 8.2.8 Authentication response
3119 static void
3120 nas_emm_auth_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3122 guint32 curr_offset;
3123 guint32 consumed;
3124 guint curr_len;
3126 curr_offset = offset;
3127 curr_len = len;
3130 * Authentication response parameter 9.9.3.4 M LV 5-17
3132 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_AUTH_RESP_PAR, NULL);
3134 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3138 * 8.2.9 CS service notification
3141 static void
3142 nas_emm_cs_serv_not(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3144 guint32 curr_offset;
3145 guint32 consumed;
3146 guint curr_len;
3148 curr_offset = offset;
3149 curr_len = len;
3151 /* Paging identity Paging identity 9.9.3.25A M V 1 */
3152 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_PAGING_ID, NULL);
3153 /* 60 CLI CLI 9.9.3.38 O TLV 3-12 */
3154 ELEM_OPT_TLV(0x60, GSM_A_PDU_TYPE_DTAP, DE_CLD_PARTY_BCD_NUM, " - CLI");
3155 /* 61 SS Code SS Code 9.9.3.39 O TV 2 */
3156 ELEM_OPT_TV(0x61, NAS_PDU_TYPE_EMM, DE_EMM_SS_CODE, NULL);
3157 /* 62 LCS indicator LCS indicator 9.9.3.40 O TV 2 */
3158 ELEM_OPT_TV(0x62, NAS_PDU_TYPE_EMM, DE_EMM_LCS_IND, NULL);
3159 /* 63 LCS client identity LCS client identity 9.9.3.41 O TLV 3-257 */
3160 ELEM_OPT_TLV(0x63, NAS_PDU_TYPE_EMM, DE_EMM_LCS_CLIENT_ID, NULL);
3162 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3165 * 8.2.10 Detach accept
3166 * 8.2.10.1 Detach accept (UE originating detach)
3167 * No further IE's
3168 * 8.2.10.2 Detach accept (UE terminated detach)
3169 * No further IE's
3172 * 8.2.11 Detach request
3173 * 8.2.11.1 Detach request (UE originating detach)
3176 static void
3177 nas_emm_detach_req_UL(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3179 guint32 curr_offset,bit_offset;
3180 guint32 consumed;
3181 guint curr_len;
3183 curr_offset = offset;
3184 curr_len = len;
3186 proto_tree_add_text(tree, tvb, curr_offset, len, "Uplink");
3187 /* NAS key set identifier NAS key set identifier 9.9.3.21 M V 1/2 */
3188 bit_offset = curr_offset<<3;
3189 de_emm_nas_key_set_id_bits(tvb, tree, bit_offset, NULL);
3190 bit_offset+=4;
3191 /* Detach type Detach type 9.9.3.6 M V 1/2 */
3192 proto_tree_add_bits_item(tree, hf_nas_eps_emm_switch_off, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3193 bit_offset++;
3194 proto_tree_add_bits_item(tree, hf_nas_eps_emm_detach_type_UL, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3195 /* bit_offset+=3;*/
3197 /* Fix the lengths */
3198 curr_len--;
3199 curr_offset++;
3201 /* GUTI or IMSI EPS mobile identity 9.9.3.12 M LV 5-12 */
3202 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, NULL);
3205 * 8.2.11.2 Detach request (UE terminated detach)
3207 static void
3208 nas_emm_detach_req_DL(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3210 guint32 curr_offset, bit_offset;
3211 guint32 consumed;
3212 guint curr_len;
3214 curr_offset = offset;
3215 curr_len = len;
3217 proto_tree_add_text(tree, tvb, curr_offset, len, "Downlink");
3218 /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */
3219 bit_offset = curr_offset<<3;
3220 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3221 bit_offset+=4;
3222 /* Detach type Detach type 9.9.3.6 M V 1/2 */
3223 /* In the network to UE direction bit 4 is spare. The network shall set this bit to zero. */
3224 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3225 bit_offset++;
3226 proto_tree_add_bits_item(tree, hf_nas_eps_emm_detach_type_DL, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3227 /*bit_offset+=3;*/
3229 /* Fix the lengths */
3230 curr_len--;
3231 curr_offset++;
3233 /* No more mandatory elements */
3234 if (curr_len == 0)
3235 return;
3237 /* EMM cause EMM cause 9.9.3.9 O TV 2 */
3238 ELEM_OPT_TV(0x53, NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
3240 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3242 static void
3243 nas_emm_detach_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3245 if (pinfo) {
3246 if (pinfo->link_dir == P2P_DIR_UL) {
3247 nas_emm_detach_req_UL(tvb, tree, pinfo, offset, len);
3248 return;
3249 }else if (pinfo->link_dir == P2P_DIR_DL) {
3250 nas_emm_detach_req_DL(tvb, tree, pinfo, offset, len);
3251 return;
3254 if (len >= 8) {
3255 nas_emm_detach_req_UL(tvb, tree, pinfo, offset, len);
3256 } else {
3257 nas_emm_detach_req_DL(tvb, tree, pinfo, offset, len);
3262 * 8.2.12 Downlink NAS Transport
3264 static void
3265 nas_emm_dl_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3267 guint32 curr_offset;
3268 guint32 consumed;
3269 guint curr_len;
3271 curr_offset = offset;
3272 curr_len = len;
3274 pinfo->link_dir = P2P_DIR_DL;
3276 /* NAS message container NAS message container 9.9.3.22 M LV 3-252 */
3277 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_NAS_MSG_CONT, NULL);
3279 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3282 * 8.2.13 EMM information
3284 static void
3285 nas_emm_emm_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3287 guint32 curr_offset;
3288 guint32 consumed;
3289 guint curr_len;
3291 curr_offset = offset;
3292 curr_len = len;
3294 /* 43 Full name for network Network name 9.9.3.24 O TLV 3-? */
3295 ELEM_OPT_TLV(0x43, GSM_A_PDU_TYPE_DTAP, DE_NETWORK_NAME, " - Full name for network");
3296 /* 45 Short name for network Network name 9.9.3.24 O TLV 3-? */
3297 ELEM_OPT_TLV(0x45, GSM_A_PDU_TYPE_DTAP, DE_NETWORK_NAME, " - Short Name");
3298 /* 46 Local time zone Time zone 9.9.3.29 O TV 2 */
3299 ELEM_OPT_TV(0x46, GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE, " - Local");
3300 /* 47 Universal time and local time zone Time zone and time 9.9.3.30 O TV 8 */
3301 ELEM_OPT_TV(0x47, GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE_TIME, " - Universal Time and Local Time Zone");
3302 /* 49 Network daylight saving time Daylight saving time 9.9.3.6 O TLV 3 */
3303 ELEM_OPT_TLV(0x49, GSM_A_PDU_TYPE_DTAP, DE_DAY_SAVING_TIME, NULL);
3305 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3310 * 8.2.14 EMM status
3312 static void
3313 nas_emm_emm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3315 guint32 curr_offset;
3316 guint32 consumed;
3317 guint curr_len;
3319 curr_offset = offset;
3320 curr_len = len;
3322 /* EMM cause EMM cause 9.9.3.9 M V 1 */
3323 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
3325 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3329 * 8.2.15 Extended service request
3331 static void
3332 nas_emm_ext_serv_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3334 guint32 curr_offset,bit_offset;
3335 guint32 consumed;
3336 guint curr_len;
3338 curr_offset = offset;
3339 curr_len = len;
3341 bit_offset = curr_offset<<3;
3343 /* NAS key set identifier NAS key set identifier 9.9.3.21 M V 1/2 */
3344 de_emm_nas_key_set_id_bits(tvb, tree, bit_offset, NULL);
3345 bit_offset+=4;
3346 /* Service type Service type 9.9.3.27 M V 1/2 Service type*/
3347 proto_tree_add_bits_item(tree, hf_nas_eps_service_type, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3348 /*bit_offset+=4;*/
3349 /* Fix up the lengths */
3350 curr_len--;
3351 curr_offset++;
3353 /* M-TMSI Mobile identity 9.9.2.3 M LV 6 */
3354 ELEM_MAND_LV(NAS_PDU_TYPE_COMMON, DE_EPS_CMN_MOB_ID, " - M-TMSI");
3355 /* B- CSFB response CSFB response 9.9.3.5 C TV 1 */
3356 ELEM_OPT_TV_SHORT(0xb0, NAS_PDU_TYPE_EMM, DE_EMM_CSFB_RESP, NULL);
3357 /* 57 EPS bearer context status EPS bearer context status 9.9.2.1 O TLV 4 */
3358 ELEM_OPT_TLV(0x57, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_EPS_BE_CTX_STATUS, NULL);
3359 /* D- Device properties Device properties 9.9.2.0A O TV 1 */
3360 ELEM_OPT_TV_SHORT(0xD0 , GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
3362 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3365 * 8.2.16 GUTI reallocation command
3367 static void
3368 nas_emm_guti_realloc_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3370 guint32 curr_offset;
3371 guint32 consumed;
3372 guint curr_len;
3374 curr_offset = offset;
3375 curr_len = len;
3377 /* GUTI EPS mobile identity 9.9.3.12 M LV 12 */
3378 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, " - GUTI");
3380 /* 54 TAI list Tracking area identity list 9.9.3.33 O TLV 8-98 */
3381 ELEM_OPT_TLV(0x54, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID_LST, NULL);
3383 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3387 * 8.2.17 GUTI reallocation complete
3388 * No more IE's
3391 * 8.2.18 Identity request
3394 static void
3395 nas_emm_id_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3397 guint32 curr_offset, bit_offset;
3398 /*guint32 consumed;*/
3399 guint curr_len;
3401 curr_offset = offset;
3402 curr_len = len;
3405 bit_offset=curr_offset<<3;
3407 /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */
3408 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3409 bit_offset+=4;
3411 /* Identity type Identity type 2 9.9.3.17 M V 1/2 */
3412 proto_tree_add_bits_item(tree, hf_nas_eps_emm_id_type2, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3413 /*bit_offset+=4;*/
3414 /*consumed = 1;*/
3417 /* Fix up the lengths */
3418 curr_len--;
3419 curr_offset++;
3421 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3424 * 8.2.19 Identity response
3426 static void
3427 nas_emm_id_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3429 guint32 curr_offset;
3430 guint32 consumed;
3431 guint curr_len;
3433 curr_offset = offset;
3434 curr_len = len;
3436 /* Mobile identity Mobile identity 9.9.2.3 M LV 4-10 */
3437 ELEM_MAND_LV(NAS_PDU_TYPE_COMMON, DE_EPS_CMN_MOB_ID, NULL);
3439 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3445 * 8.2.20 Security mode command
3447 static void
3448 nas_emm_sec_mode_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3450 guint32 curr_offset, bit_offset;
3451 guint32 consumed;
3452 guint curr_len;
3454 curr_offset = offset;
3455 curr_len = len;
3457 /* Selected NAS security algorithms NAS security algorithms 9.9.3.23 M V 1 */
3458 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_NAS_SEC_ALGS, " - Selected NAS security algorithms");
3460 bit_offset = curr_offset<<3;
3461 /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */
3462 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3463 bit_offset+=4;
3464 /* NAS key set identifierASME NAS key set identifier 9.9.3.21 M V 1/2 */
3465 de_emm_nas_key_set_id_bits(tvb, tree, bit_offset, " ASME");
3466 /*bit_offset+=4;*/
3468 /* Fix up the lengths */
3469 curr_len--;
3470 curr_offset++;
3472 /* Replayed UE security capabilities UE security capability 9.9.3.36 M LV 3-6 */
3473 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_UE_SEC_CAP, " - Replayed UE security capabilities");
3474 /* C- IMEISV request IMEISV request 9.9.3.18 O TV 1 */
3475 ELEM_OPT_TV_SHORT( 0xC0 , NAS_PDU_TYPE_EMM, DE_EMM_IMEISV_REQ , NULL );
3476 /* 55 Replayed NonceUE Nonce 9.9.3.25 O TV 5 */
3477 ELEM_OPT_TV(0x55, NAS_PDU_TYPE_EMM, DE_EMM_NONCE, " - Replayed NonceUE");
3478 /* 56 NonceMME Nonce 9.9.3.25 O TV 5 */
3479 ELEM_OPT_TV(0x56, NAS_PDU_TYPE_EMM, DE_EMM_NONCE, " - NonceMME");
3481 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3484 * 8.2.21 Security mode complete
3486 static void
3487 nas_emm_sec_mode_comp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3489 guint32 curr_offset;
3490 guint32 consumed;
3491 guint curr_len;
3493 curr_offset = offset;
3494 curr_len = len;
3496 if (curr_len == 0)
3497 return;
3499 /* 23 IMEISV Mobile identity 9.9.2.3 O TLV 11 */
3500 ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_MOB_ID, " - IMEISV");
3502 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3505 * 8.2.22 Security mode reject
3507 static void
3508 nas_emm_sec_mode_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3510 guint32 curr_offset;
3511 guint32 consumed;
3512 guint curr_len;
3514 curr_offset = offset;
3515 curr_len = len;
3517 /* EMM cause EMM cause 9.9.3.9 M V 1 */
3518 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
3520 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3523 * 8.2.23 Security protected NAS message
3525 #if 0
3526 static int
3527 nas_emm_sec_prot_msg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3529 guint32 curr_offset;
3530 guint curr_len;
3531 guint8 security_header_type;
3533 curr_offset = offset;
3534 curr_len = len;
3536 /* Security header type Security header type 9.3.1 M V 1/2 */
3537 security_header_type = tvb_get_guint8(tvb,offset)>>4;
3538 proto_tree_add_item(tree, hf_nas_eps_security_header_type, tvb, 0, 1, ENC_BIG_ENDIAN);
3539 /* Protocol discriminator Protocol discriminator 9.2 M V 1/2 */
3540 proto_tree_add_item(tree, hf_gsm_a_L3_protocol_discriminator, tvb, 0, 1, ENC_BIG_ENDIAN);
3541 offset++;
3542 /* Message authentication code Message authentication code 9.5 M V 4 */
3543 if (security_header_type != 0) {
3544 /* Message authentication code */
3545 proto_tree_add_item(tree, hf_nas_eps_msg_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN);
3546 offset+=4;
3547 if ((security_header_type == 2)||(security_header_type == 4)) {
3548 /* Integrity protected and ciphered = 2, Integrity protected and ciphered with new EPS security context = 4 */
3549 proto_tree_add_text(tree, tvb, offset, len-5,"Ciphered message");
3550 return offset;
3552 } else {
3553 proto_tree_add_text(tree, tvb, offset, len,"Not a security protected message");
3554 return offset;
3556 /* Sequence number Sequence number 9.6 M V 1 */
3557 proto_tree_add_item(tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN);
3558 offset++;
3559 /* NAS message NAS message 9.7 M V 1-n */
3560 return offset;
3562 #endif
3564 * 8.2.24 Service reject
3566 static void
3567 nas_emm_serv_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3569 guint32 curr_offset;
3570 guint32 consumed;
3571 guint curr_len;
3573 curr_offset = offset;
3574 curr_len = len;
3576 /* EMM cause EMM cause 9.9.3.9 M V 1 */
3577 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
3578 /* 5B T3442 value GPRS timer 9.9.3.16 C TV 2 */
3579 ELEM_OPT_TV(0x5b, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3442 value");
3580 /* 5F T3346 value GPRS timer 2 9.9.3.16A O TLV 3 */
3581 ELEM_OPT_TLV(0x5F, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3346 value");
3583 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3586 * 8.2.25 Service request
3587 * This message is sent by the UE to the network to request the establishment
3588 * of a NAS signalling connection and of the radio and S1 bearers.
3589 * Its structure does not follow the structure of a standard layer 3 message. See table 8.2.25.1.
3591 /* Table 8.2.25.1
3592 * Protocol discriminator Protocol discriminator 9.2 M V 1/2
3593 * Security header type Security header type 9.3.1 M V 1/2
3594 * KSI and sequence number KSI and sequence number 9.9.3.19 M V 1
3595 * Message authentication code (short) Short MAC 9.9.3.28 M V 2
3597 static void
3598 nas_emm_service_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3600 guint32 curr_offset;
3601 guint32 consumed;
3602 guint curr_len;
3604 curr_offset = offset;
3605 curr_len = len;
3607 /* KSI and sequence number 9.9.3.19 M V 1 */
3608 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_KSI_AND_SEQ_NO, NULL);
3610 /* Short MAC 9.9.3.28 M V 2 */
3611 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_SHORT_MAC, " - Message authentication code (short)");
3613 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3617 * 8.2.26 Tracking area update accept
3619 static void
3620 nas_emm_trac_area_upd_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3622 guint32 curr_offset, bit_offset;
3623 guint32 consumed;
3624 guint curr_len;
3626 curr_offset = offset;
3627 curr_len = len;
3629 /* Spare half octet Spare half octet 9.9.2.7 M V 1/2 */
3630 bit_offset = curr_offset<<3;
3631 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3632 bit_offset+=4;
3633 /* EPS update result EPS update result 9.9.3.13 M V 1/2 */
3634 proto_tree_add_bits_item(tree, hf_nas_eps_spare_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3635 bit_offset++;
3636 proto_tree_add_bits_item(tree, hf_nas_eps_eps_update_result_value, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3637 /*bit_offset+=3;*/
3638 /* Fix up the lengths */
3639 curr_len--;
3640 curr_offset++;
3641 /* No more mandatory elements */
3642 if (curr_len == 0)
3643 return;
3644 /* 5A T3412 value GPRS timer 9.9.3.16 O TV 2 */
3645 ELEM_OPT_TV(0x5a, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3412 value");
3646 /* 50 GUTI EPS mobile identity 9.9.3.12 O TLV 13 */
3647 ELEM_OPT_TLV(0x50, NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, " - GUTI");
3648 /* 54 TAI list Tracking area identity list 9.9.3.33 O TLV 8-98 */
3649 ELEM_OPT_TLV(0x54, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID_LST, NULL);
3650 /* 57 EPS bearer context status EPS bearer context status 9.9.2.1 O TLV 4 */
3651 ELEM_OPT_TLV(0x57, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_EPS_BE_CTX_STATUS, NULL);
3652 /* 13 Location area identification Location area identification 9.9.2.2 O TV 6 */
3653 ELEM_OPT_TV(0x13, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_LOC_AREA_ID, NULL);
3654 /* 23 MS identity Mobile identity 9.9.2.3 O TLV 7-10 */
3655 ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_MOB_ID, " - MS identity");
3656 /* 53 EMM cause EMM cause 9.9.3.9 O TV 2 */
3657 ELEM_OPT_TV(0x53, NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
3658 /* 17 T3402 value GPRS timer 9.9.3.16 O TV 2 */
3659 ELEM_OPT_TV(0x17, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3402 value");
3660 /* 59 T3423 value GPRS timer 9.9.3.16 O TV 2 */
3661 ELEM_OPT_TV(0x59, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER, " - T3423 value");
3662 /* 4A Equivalent PLMNs PLMN list 9.9.2.8 O TLV 5-47 */
3663 ELEM_OPT_TLV(0x4a, GSM_A_PDU_TYPE_COMMON, DE_PLMN_LIST, " - PLMN list");
3664 /* 34 Emergency Number List Emergency Number List 9.9.3.37 O TLV 5-50 */
3665 ELEM_OPT_TLV(0x34, GSM_A_PDU_TYPE_DTAP, DE_EMERGENCY_NUM_LIST, NULL);
3666 /* 64 EPS network feature support EPS network feature support 9.9.3.12A O TLV 3 */
3667 ELEM_OPT_TLV(0x64, NAS_PDU_TYPE_EMM, DE_EMM_EPS_NET_FEATURE_SUP, NULL);
3668 /* F- Additional update result Additional update result 9.9.3.0A O TV 1 */
3669 ELEM_OPT_TV_SHORT( 0xF0 , NAS_PDU_TYPE_EMM, DE_EMM_ADD_UPD_RES, NULL );
3670 /* 5E T3412 extended value GPRS timer 3 9.9.3.16B O TLV 3 */
3671 ELEM_OPT_TLV(0x5E, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3412 extended value");
3673 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3676 * 8.2.27 Tracking area update complete
3677 * No more IE's
3680 * 8.2.28 Tracking area update reject
3682 static void
3683 nas_emm_trac_area_upd_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3685 guint32 curr_offset;
3686 guint32 consumed;
3687 guint curr_len;
3689 curr_offset = offset;
3690 curr_len = len;
3692 /* EMM cause EMM cause 9.9.3.9 M V 1 */
3693 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_CAUSE, NULL);
3694 /* 5F T3346 value GPRS timer 2 9.9.3.16A O TLV 3 */
3695 ELEM_OPT_TLV(0x5F, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_2, " - T3346 value");
3697 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3700 * 8.2.29 Tracking area update request
3702 static void
3703 nas_emm_trac_area_upd_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3706 guint32 curr_offset, bit_offset;
3707 guint32 consumed;
3708 guint curr_len;
3710 curr_offset = offset;
3711 curr_len = len;
3713 bit_offset = curr_offset<<3;
3715 /* NAS key set identifierASME NAS key set identifier 9.9.3.21 M V 1/2 */
3716 de_emm_nas_key_set_id_bits(tvb, tree, bit_offset, " ASME");
3717 bit_offset+=4;
3719 /* EPS update type EPS update type 9.9.3.14 M V 1/2 */
3720 proto_tree_add_bits_item(tree, hf_nas_eps_active_flg, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
3721 bit_offset++;
3722 proto_tree_add_bits_item(tree, hf_nas_eps_eps_update_type_value, tvb, bit_offset, 3, ENC_BIG_ENDIAN);
3723 /*bit_offset+=3;*/
3725 /* Fix the lengths */
3726 curr_len--;
3727 curr_offset++;
3728 /* Old GUTI EPS mobile identity 9.9.3.12 M LV 12 */
3729 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, " - Old GUTI");
3730 /* No more Mandatory elements */
3732 /* B- NAS key set identifier Non-current native NAS key set identifier 9.9.3.21 O TV 1 */
3733 ELEM_OPT_TV_SHORT( 0xb0 , NAS_PDU_TYPE_EMM, DE_EMM_NAS_KEY_SET_ID , " - Non-current native NAS key set identifier" );
3734 /* 8- GPRS ciphering key sequence number Ciphering key sequence number 9.9.3.4a O TV 1 */
3735 ELEM_OPT_TV_SHORT(0x80, GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM, " - GPRS ciphering key sequence number");
3736 /* 19 Old P-TMSI signature P-TMSI signature 9.9.3.26 O TV 4 */
3737 ELEM_OPT_TV( 0x19 , GSM_A_PDU_TYPE_GM, DE_P_TMSI_SIG, " - Old P-TMSI Signature");
3738 /* 50 Additional GUTI EPS mobile identity 9.9.3.12 O TLV 13 */
3739 ELEM_OPT_TLV(0x50, NAS_PDU_TYPE_EMM, DE_EMM_EPS_MID, " - Additional GUTI");
3740 /* 55 NonceUE Nonce 9.9.3.25 O TV 5 */
3741 ELEM_OPT_TV(0x55, NAS_PDU_TYPE_EMM, DE_EMM_NONCE, " - NonceUE");
3742 /* 58 UE network capability UE network capability 9.9.3.34 O TLV 4-15 */
3743 ELEM_OPT_TLV(0x58, NAS_PDU_TYPE_EMM, DE_EMM_UE_NET_CAP, NULL);
3744 /* 52 Last visited registered TAI Tracking area identity 9.9.3.32 O TV 6 */
3745 ELEM_OPT_TV(0x52, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, " - Last visited registered TAI");
3746 /* 5C DRX parameter DRX parameter 9.9.3.8 O TV 3 */
3747 ELEM_OPT_TV(0x5c, GSM_A_PDU_TYPE_GM, DE_DRX_PARAM, NULL );
3748 /* A- UE radio capability information update needed UE radio capability information update needed 9.9.3.35 O TV 1 */
3749 ELEM_OPT_TV_SHORT( 0xA0 , NAS_PDU_TYPE_EMM, DE_EMM_UE_RA_CAP_INF_UPD_NEED , NULL );
3750 /* 57 EPS bearer context status EPS bearer context status 9.9.2.1 O TLV 4 */
3751 ELEM_OPT_TLV(0x57, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_EPS_BE_CTX_STATUS, NULL);
3752 /* 31 MS network capability MS network capability 9.9.3.20 O TLV 4-10 */
3753 ELEM_OPT_TLV( 0x31 , GSM_A_PDU_TYPE_GM, DE_MS_NET_CAP , NULL );
3754 /* 13 Old location area identification Location area identification 9.9.2.2 O TV 6 */
3755 ELEM_OPT_TV(0x13, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_LOC_AREA_ID, " - Old location area identification");
3756 /* 9- TMSI status TMSI status 9.9.3.31 O TV 1 */
3757 ELEM_OPT_TV_SHORT( 0x90 , GSM_A_PDU_TYPE_GM, DE_TMSI_STAT , NULL );
3758 /* 11 Mobile station classmark 2 Mobile station classmark 2 9.9.2.5 O TLV 5 */
3759 ELEM_OPT_TLV( 0x11, NAS_PDU_TYPE_COMMON, DE_EPS_MS_CM_2 , NULL );
3760 /* 20 Mobile station classmark 3 Mobile station classmark 3 9.9.2.5 O TLV 2-34 */
3761 ELEM_OPT_TLV( 0x20, NAS_PDU_TYPE_COMMON, DE_EPS_MS_CM_3 , NULL );
3762 /* 40 Supported Codecs Supported Codec List 9.9.2.10 O TLV 5-n */
3763 ELEM_OPT_TLV(0x40, GSM_A_PDU_TYPE_DTAP, DE_SUP_CODEC_LIST, " - Supported Codecs");
3764 /* F- Additional update type Additional update type 9.9.3.0B O TV 1 */
3765 ELEM_OPT_TV_SHORT( 0xF0 , NAS_PDU_TYPE_EMM, DE_EMM_ADD_UPD_TYPE, NULL );
3766 /* 5D Voice domain preference and UE's usage setting Voice domain preference and UE's usage setting 9.9.3.44 O TLV 3 */
3767 ELEM_OPT_TLV(0x5D, GSM_A_PDU_TYPE_GM, DE_VOICE_DOMAIN_PREF, NULL);
3768 /* E- Old GUTI type GUTI type 9.9.3.45 O TV 1 */
3769 ELEM_OPT_TV_SHORT(0xE0 , NAS_PDU_TYPE_EMM, DE_EMM_GUTI_TYPE, " - Old GUTI type");
3770 /* D- Device properties Device properties 9.9.2.0A O TV 1 */
3771 ELEM_OPT_TV_SHORT(0xD0 , GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
3772 /* C- MS network feature support MS network feature support 9.9.3.20A 0 TV 1 */
3773 ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_COMMON, DE_MS_NET_FEAT_SUP, NULL);
3774 /* 10 TMSI based NRI container Network resource identifier container 9.9.3.24A 0 TLV 4 */
3775 ELEM_OPT_TLV(0x10, GSM_A_PDU_TYPE_GM, DE_NET_RES_ID_CONT, " - TMSI based NRI container");
3777 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3781 * 8.2.30 Uplink NAS Transport
3783 static void
3784 nas_emm_ul_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3786 guint32 curr_offset;
3787 guint32 consumed;
3788 guint curr_len;
3790 curr_offset = offset;
3791 curr_len = len;
3793 pinfo->link_dir = P2P_DIR_UL;
3795 /* NAS message container NAS message container 9.9.3.22 M LV 3-252*/
3796 ELEM_MAND_LV(NAS_PDU_TYPE_EMM, DE_EMM_NAS_MSG_CONT, NULL);
3798 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3802 * 8.2.31 Downlink generic NAS transport
3804 static void
3805 nas_emm_dl_gen_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3807 guint32 curr_offset;
3808 guint32 consumed;
3809 guint curr_len;
3811 curr_offset = offset;
3812 curr_len = len;
3814 pinfo->link_dir = P2P_DIR_DL;
3816 /* Generic message container type Generic message container type 9.9.3.42 M V 1 */
3817 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_GEN_MSG_CONT_TYPE, NULL);
3818 /* Generic message container Generic message container 9.9.3.43 M LV-E 3-n */
3819 ELEM_MAND_LV_E(NAS_PDU_TYPE_EMM, DE_EMM_GEN_MSG_CONT, NULL)
3820 /* 65 Additional information Additional information 9.9.2.0 O TLV 3-n */
3821 ELEM_OPT_TLV(0x65, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_ADD_INFO, NULL);
3823 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3825 eps_nas_gen_msg_cont_type = 0;
3829 * 8.2.32 Uplink generic NAS transport
3831 static void
3832 nas_emm_ul_gen_nas_trans(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
3834 guint32 curr_offset;
3835 guint32 consumed;
3836 guint curr_len;
3838 curr_offset = offset;
3839 curr_len = len;
3841 pinfo->link_dir = P2P_DIR_UL;
3843 /* Generic message container type Generic message container type 9.9.3.42 M V 1 */
3844 ELEM_MAND_V(NAS_PDU_TYPE_EMM, DE_EMM_GEN_MSG_CONT_TYPE, NULL);
3845 /* Generic message container Generic message container 9.9.3.43 M LV-E 3-n */
3846 ELEM_MAND_LV_E(NAS_PDU_TYPE_EMM, DE_EMM_GEN_MSG_CONT, NULL)
3847 /* 65 Additional information Additional information 9.9.2.0 O TLV 3-n */
3848 ELEM_OPT_TLV(0x65, NAS_PDU_TYPE_COMMON, DE_EPS_CMN_ADD_INFO, NULL);
3850 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3852 eps_nas_gen_msg_cont_type = 0;
3856 * 8.3 EPS session management messages
3860 * 8.3.1 Activate dedicated EPS bearer context accept
3862 static void
3863 nas_esm_act_ded_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3865 guint32 curr_offset;
3866 guint32 consumed;
3867 guint curr_len;
3869 if (len == 0)
3870 return;
3872 curr_offset = offset;
3873 curr_len = len;
3875 /* This message is sent by the UE to the network */
3876 pinfo->link_dir = P2P_DIR_UL;
3878 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
3879 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
3881 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3885 * 8.3.2 Activate dedicated EPS bearer context reject
3887 static void
3888 nas_esm_act_ded_eps_bearer_ctx_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3890 guint32 curr_offset;
3891 guint32 consumed;
3892 guint curr_len;
3894 curr_offset = offset;
3895 curr_len = len;
3897 /* This message is sent by UE to the network to reject activation of a dedicated EPS bearer context */
3898 pinfo->link_dir = P2P_DIR_UL;
3900 /* ESM cause ESM cause 9.9.4.2 M V 1 */
3901 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
3902 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
3903 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
3905 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3908 * 8.3.3 Activate dedicated EPS bearer context request
3910 static void
3911 nas_esm_act_ded_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3913 guint32 curr_offset, bit_offset;
3914 guint32 consumed;
3915 guint curr_len;
3917 curr_offset = offset;
3918 curr_len = len;
3920 /* This message is sent by the network to the UE to request activation of a dedicated EPS bearer context... */
3921 pinfo->link_dir = P2P_DIR_DL;
3924 /* Spare half octet Spare half octet 9.9.2.9 M V 1/2 */
3925 bit_offset = curr_offset<<3;
3926 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3927 bit_offset+=4;
3928 /* Linked EPS bearer identity Linked EPS bearer identity 9.9.4.6 M V 1/2 */
3929 proto_tree_add_bits_item(tree, hf_nas_eps_esm_linked_bearer_id, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
3930 /*bit_offset+=4;*/
3931 /* Fix the lengths */
3932 curr_len--;
3933 curr_offset++;
3935 /* EPS QoS EPS quality of service 9.9.4.3 M LV 2-10 */
3936 ELEM_MAND_LV(NAS_PDU_TYPE_ESM, DE_ESM_EPS_QOS, NULL);
3937 /* TFT Traffic flow template 9.9.4.16 M LV 2-256 */
3938 ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE , NULL );
3939 /* 5D Transaction identifier Transaction identifier 9.9.4.17 O TLV 3-4 */
3940 ELEM_OPT_TLV( 0x5d , GSM_A_PDU_TYPE_GM, DE_LINKED_TI , " - Transaction identifier" );
3941 /* 30 Negotiated QoS Quality of service 9.9.4.12 O TLV 14-18 */
3942 ELEM_OPT_TLV( 0x30 , GSM_A_PDU_TYPE_GM, DE_QOS , " - Negotiated QoS" );
3943 /* 32 Negotiated LLC SAPI LLC service access point identifier 9.9.4.7 O TV 2 */
3944 ELEM_OPT_TV( 0x32 , GSM_A_PDU_TYPE_GM, DE_LLC_SAPI , " - Negotiated LLC SAPI" );
3945 /* 8- Radio priority Radio priority 9.9.4.13 O TV 1 */
3946 ELEM_OPT_TV_SHORT ( 0x80 , GSM_A_PDU_TYPE_GM , DE_RAD_PRIO , NULL );
3947 /* 34 Packet flow Identifier Packet flow Identifier 9.9.4.8 O TLV 3 */
3948 ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL );
3949 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
3950 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
3952 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3956 * 8.3.4 Activate default EPS bearer context accept
3958 static void
3959 nas_esm_act_def_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3961 guint32 curr_offset;
3962 guint32 consumed;
3963 guint curr_len;
3965 curr_offset = offset;
3966 curr_len = len;
3968 if (len == 0)
3969 return;
3971 /* This message is sent by the UE to the network to acknowledge activation of a default EPS bearer context */
3972 pinfo->link_dir = P2P_DIR_UL;
3974 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
3975 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
3977 EXTRANEOUS_DATA_CHECK(curr_len, 0);
3981 * 8.3.5 Activate default EPS bearer context reject
3983 static void
3984 nas_esm_act_def_eps_bearer_ctx_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3986 guint32 curr_offset;
3987 guint32 consumed;
3988 guint curr_len;
3990 curr_offset = offset;
3991 curr_len = len;
3993 /* This message is sent by UE to the network to reject activation of a default EPS bearer context. */
3994 pinfo->link_dir = P2P_DIR_UL;
3996 /* ESM cause ESM cause 9.9.4.4 M V 1 */
3997 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
3998 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
3999 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4001 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4005 * 8.3.6 Activate default EPS bearer context request
4007 static void
4008 nas_esm_act_def_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4010 guint32 curr_offset;
4011 guint32 consumed;
4012 guint curr_len;
4014 curr_offset = offset;
4015 curr_len = len;
4017 /* This message is sent by the network to the UE to request activation of a default EPS bearer context. */
4018 pinfo->link_dir = P2P_DIR_DL;
4020 /* EPS QoS EPS quality of service 9.9.4.3 M LV 2-10 */
4021 ELEM_MAND_LV(NAS_PDU_TYPE_ESM, DE_ESM_EPS_QOS, NULL);
4022 /* Access point name Access point name 9.9.4.1 M LV 2-101 */
4023 ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME , NULL );
4024 /* PDN address PDN address 9.9.4.9 M LV 6-14 DE_ESM_PDN_ADDR*/
4025 ELEM_MAND_LV( NAS_PDU_TYPE_ESM, DE_ESM_PDN_ADDR , NULL );
4026 /* 5D Transaction identifier Transaction identifier 9.9.4.17 O TLV 3-4 */
4027 ELEM_OPT_TLV( 0x5d , GSM_A_PDU_TYPE_GM, DE_LINKED_TI , " - Transaction identifier" );
4028 /* 30 Negotiated QoS Quality of service 9.9.4.12 O TLV 14-18 */
4029 ELEM_OPT_TLV( 0x30 , GSM_A_PDU_TYPE_GM, DE_QOS , " - Negotiated QoS" );
4030 /* 32 Negotiated LLC SAPI LLC service access point identifier 9.9.4.7 O TV 2 */
4031 ELEM_OPT_TV( 0x32 , GSM_A_PDU_TYPE_GM, DE_LLC_SAPI , " - Negotiated LLC SAPI" );
4032 /* 8- Radio priority Radio priority 9.9.4.13 O TV 1 */
4033 ELEM_OPT_TV_SHORT ( 0x80 , GSM_A_PDU_TYPE_GM , DE_RAD_PRIO , NULL );
4034 /* 34 Packet flow Identifier Packet flow Identifier 9.9.4.8 O TLV 3 */
4035 ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL );
4036 /* 5E APN-AMBR APN aggregate maximum bit rate 9.9.4.2 O TLV 4-8 DE_ESM_APN_AGR_MAX_BR*/
4037 ELEM_OPT_TLV( 0x5e , NAS_PDU_TYPE_ESM, DE_ESM_APN_AGR_MAX_BR , NULL );
4038 /* 58 ESM cause ESM cause 9.9.4.4 O TV 2 */
4039 ELEM_OPT_TV( 0x58 , NAS_PDU_TYPE_ESM, DE_ESM_CAUSE , NULL );
4040 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4041 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4042 /* B- Connectivity type Connectivity type 9.9.4.2A 0 TV 1 */
4043 ELEM_OPT_TV_SHORT(0xB0 , GSM_A_PDU_TYPE_GM, DE_SM_CONNECTIVITY_TYPE, NULL);
4045 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4049 * 8.3.7 Bearer resource allocation reject
4051 static void
4052 nas_esm_bearer_res_all_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4054 guint32 curr_offset;
4055 guint32 consumed;
4056 guint curr_len;
4058 curr_offset = offset;
4059 curr_len = len;
4061 /* This message is sent by the network to the UE to reject the allocation of a dedicated bearer resource. */
4062 pinfo->link_dir = P2P_DIR_DL;
4064 /* ESM cause ESM cause 9.9.4.4 M V 1 */
4065 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
4066 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4067 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4068 /* 37 T3396 value GPRS timer 3 9.9.3.16B O TLV 3 */
4069 ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3396 value");
4071 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4075 * 8.3.8 Bearer resource allocation request
4077 static void
4078 nas_esm_bearer_res_all_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4080 guint32 curr_offset, bit_offset;
4081 guint32 consumed;
4082 guint curr_len;
4084 curr_offset = offset;
4085 curr_len = len;
4087 /* This message is sent by the UE to the network to request the allocation of a dedicated bearer resource. */
4088 pinfo->link_dir = P2P_DIR_UL;
4090 /* Spare half octet Spare half octet 9.9.2.9 M V 1/2 */
4091 bit_offset = curr_offset<<3;
4092 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4093 bit_offset+=4;
4094 /* Linked EPS bearer identity Linked EPS bearer identity 9.9.4.6 M V 1/2 */
4095 proto_tree_add_bits_item(tree, hf_nas_eps_esm_linked_bearer_id, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4096 /*bit_offset+=4;*/
4097 /* Fix the lengths */
4098 curr_len--;
4099 curr_offset++;
4101 /* Traffic flow aggregate Traffic flow aggregate description 9.9.4.15 M LV 2-256 */
4102 ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE , " - Traffic flow aggregate" );
4103 /* Required traffic flow QoS EPS quality of service 9.9.4.3 M LV 2-10 */
4104 ELEM_MAND_LV(NAS_PDU_TYPE_ESM, DE_ESM_EPS_QOS, " - Required traffic flow QoS");
4105 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4106 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4107 /* C- Device properties Device properties 9.9.2.0A O TV 1 */
4108 ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
4110 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4113 * 8.3.9 Bearer resource modification reject
4115 static void
4116 nas_esm_bearer_res_mod_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4118 guint32 curr_offset;
4119 guint32 consumed;
4120 guint curr_len;
4122 curr_offset = offset;
4123 curr_len = len;
4125 /* This message is sent by the network to the UE to reject the modification of a dedicated bearer resource. */
4126 pinfo->link_dir = P2P_DIR_DL;
4128 /* ESM cause ESM cause 9.9.4.4 M V 1 */
4129 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
4130 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4131 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4132 /* 37 T3396 value GPRS timer 3 9.9.3.16B O TLV 3 */
4133 ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3396 value");
4135 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4138 * 8.3.10 Bearer resource modification request
4140 static void
4141 nas_esm_bearer_res_mod_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4143 guint32 curr_offset, bit_offset;
4144 guint32 consumed;
4145 guint curr_len;
4147 curr_offset = offset;
4148 curr_len = len;
4150 /* This message is sent by the UE to the network to request the modification of a dedicated bearer resource. */
4151 pinfo->link_dir = P2P_DIR_UL;
4153 /* Spare half octet Spare half octet 9.9.2.9 M V 1/2 */
4154 bit_offset = curr_offset<<3;
4155 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4156 bit_offset+=4;
4157 /* EPS bearer identity for packet filter Linked EPS bearer identity 9.9.4.6 M V 1/2 */
4158 proto_tree_add_bits_item(tree, hf_nas_eps_esm_linked_bearer_id, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4159 /*bit_offset+=4;*/
4160 /* Fix the lengths */
4161 curr_len--;
4162 curr_offset++;
4163 /* Traffic flow aggregate Traffic flow aggregate description 9.9.4.15 M LV 2-256 */
4164 ELEM_MAND_LV( GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE , " - Traffic flow aggregate" );
4165 /* 5B Required traffic flow QoS EPS quality of service 9.9.4.3 O TLV 3-11 */
4166 ELEM_OPT_TLV( 0x5B , NAS_PDU_TYPE_ESM, DE_ESM_EPS_QOS , " - Required traffic flow QoS" );
4167 /* 58 ESM cause ESM cause 9.9.4.4 O TV 2 */
4168 ELEM_OPT_TV( 0x58 , NAS_PDU_TYPE_ESM, DE_ESM_CAUSE , NULL );
4169 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4170 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4171 /* C- Device properties Device properties 9.9.2.0A O TV 1 */
4172 ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
4174 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4177 * 8.3.11 Deactivate EPS bearer context accept
4179 static void
4180 nas_esm_deact_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4182 guint32 curr_offset;
4183 guint32 consumed;
4184 guint curr_len;
4186 curr_offset = offset;
4187 curr_len = len;
4189 if (len == 0)
4190 return;
4192 /* This message is sent by the UE to acknowledge deactivation of the EPS bearer context... */
4193 pinfo->link_dir = P2P_DIR_UL;
4195 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV */
4196 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4198 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4201 * 8.3.12 Deactivate EPS bearer context request
4203 static void
4204 nas_esm_deact_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4206 guint32 curr_offset;
4207 guint32 consumed;
4208 guint curr_len;
4210 curr_offset = offset;
4211 curr_len = len;
4213 /* This message is sent by the network to request deactivation of an active EPS bearer context. */
4214 pinfo->link_dir = P2P_DIR_DL;
4216 /* ESM cause ESM cause 9.9.4.4 M V 1 */
4217 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
4218 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV */
4219 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4220 /* 37 T3396 value GPRS timer 3 9.9.3.16B O TLV 3 */
4221 ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3396 value");
4223 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4227 * 8.3.13 ESM information request
4228 * No IE:s
4230 static void
4231 nas_esm_inf_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
4233 guint32 curr_offset;
4234 guint curr_len;
4236 curr_offset = offset;
4237 curr_len = len;
4239 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4242 * 8.3.14 ESM information response
4244 static void
4245 nas_esm_inf_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4247 guint32 curr_offset;
4248 guint32 consumed;
4249 guint curr_len;
4251 curr_offset = offset;
4252 curr_len = len;
4254 if (len == 0)
4255 return;
4257 /* This message is sent by the UE to the network in response to an ESM INFORMATION REQUEST... */
4258 pinfo->link_dir = P2P_DIR_UL;
4260 /* 28 Access point name Access point name 9.9.4.1 O TLV 3-102 */
4261 ELEM_OPT_TLV( 0x28 , GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME , NULL );
4262 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4263 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4265 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4268 * 8.3.15 ESM status
4270 static void
4271 nas_esm_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
4273 guint32 curr_offset;
4274 guint32 consumed;
4275 guint curr_len;
4277 curr_offset = offset;
4278 curr_len = len;
4280 /* ESM cause ESM cause 9.9.4.4 M V 1 */
4281 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
4283 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4286 * 8.3.16 Modify EPS bearer context accept
4288 static void
4289 nas_esm_mod_eps_bearer_ctx_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4291 guint32 curr_offset;
4292 guint32 consumed;
4293 guint curr_len;
4295 curr_offset = offset;
4296 curr_len = len;
4298 if (len == 0)
4299 return;
4301 /* This message is sent by the UE to the network to acknowledge the modification of an active EPS bearer context. */
4302 pinfo->link_dir = P2P_DIR_UL;
4304 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4305 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4307 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4310 * 8.3.17 Modify EPS bearer context reject
4312 static void
4313 nas_esm_mod_eps_bearer_ctx_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4315 guint32 curr_offset;
4316 guint32 consumed;
4317 guint curr_len;
4319 curr_offset = offset;
4320 curr_len = len;
4322 /* This message is sent by the UE or the network to reject a modification of an active EPS bearer context. */
4323 pinfo->link_dir = P2P_DIR_UL;
4325 /* ESM cause ESM cause 9.9.4.4 M V 1 */
4326 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
4327 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4328 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4330 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4333 * 8.3.18 Modify EPS bearer context request
4335 static void
4336 nas_esm_mod_eps_bearer_ctx_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4338 guint32 curr_offset;
4339 guint32 consumed;
4340 guint curr_len;
4342 curr_offset = offset;
4343 curr_len = len;
4345 if (len == 0)
4346 return;
4348 /*This message is sent by the network to inform the UE about events which are relevant for the upper layer... */
4349 pinfo->link_dir = P2P_DIR_DL;
4351 /* 5B New EPS QoS EPS quality of service 9.9.4.3 O TLV 3-11 */
4352 ELEM_OPT_TLV( 0x5B , NAS_PDU_TYPE_ESM, DE_ESM_EPS_QOS , " - New EPS QoS" );
4353 /* 36 TFT Traffic flow template 9.9.4.16 O TLV 3-257 */
4354 ELEM_OPT_TLV( 0x36 , GSM_A_PDU_TYPE_GM, DE_TRAFFIC_FLOW_TEMPLATE , NULL );
4355 /* 30 New QoS Quality of service 9.9.4.12 O TLV 14-18 */
4356 ELEM_OPT_TLV( 0x30 , GSM_A_PDU_TYPE_GM, DE_QOS , " - New QoS" );
4357 /* 32 Negotiated LLC SAPI LLC service access point identifier 9.9.4.7 O TV 2 */
4358 ELEM_OPT_TV( 0x32 , GSM_A_PDU_TYPE_GM, DE_LLC_SAPI , " - Negotiated LLC SAPI" );
4359 /* 8- Radio priority Radio priority 9.9.4.13 O TV 1 */
4360 ELEM_OPT_TV_SHORT ( 0x80 , GSM_A_PDU_TYPE_GM , DE_RAD_PRIO , NULL );
4361 /* 34 Packet flow Identifier Packet flow Identifier 9.9.4.8 O TLV 3 */
4362 ELEM_OPT_TLV( 0x34 , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL );
4363 /* 5E APN-AMBR APN aggregate maximum bit rate 9.9.4.2 O TLV 4-8 */
4364 ELEM_OPT_TLV( 0x5E , NAS_PDU_TYPE_ESM, DE_ESM_APN_AGR_MAX_BR , NULL );
4365 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4366 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4368 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4371 * 8.3.18A Notification
4373 static void
4374 nas_esm_notification(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
4376 guint32 curr_offset;
4377 guint32 consumed;
4378 guint curr_len;
4380 curr_offset = offset;
4381 curr_len = len;
4383 /* Notification indicator Notification indicator 9.9.4.7A M LV 2 */
4384 ELEM_MAND_LV(NAS_PDU_TYPE_ESM, DE_ESM_NOTIF_IND, NULL);
4386 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4390 * 8.3.19 PDN connectivity reject
4392 static void
4393 nas_esm_pdn_con_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4395 guint32 curr_offset;
4396 guint32 consumed;
4397 guint curr_len;
4399 curr_offset = offset;
4400 curr_len = len;
4402 /*This message is sent by the network to the UE to reject establishment of a PDN connection. */
4403 pinfo->link_dir = P2P_DIR_DL;
4405 /* ESM cause ESM cause 9.9.4.4 M V 1 */
4406 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
4407 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4408 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4409 /* 37 T3396 value GPRS timer 3 9.9.3.16B O TLV 3 */
4410 ELEM_OPT_TLV(0x37, GSM_A_PDU_TYPE_GM, DE_GPRS_TIMER_3, " - T3396 value");
4412 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4416 * 8.3.20 PDN connectivity request
4418 void
4419 nas_esm_pdn_con_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4421 guint32 curr_offset;
4422 guint32 consumed;
4423 guint curr_len;
4424 int bit_offset;
4426 curr_offset = offset;
4427 curr_len = len;
4429 /*This message is sent by the UE to the network to initiate establishment of a PDN connection. */
4430 pinfo->link_dir = P2P_DIR_UL;
4432 /* PDN type PDN type 9.9.4.10 M V 1/2 */
4433 bit_offset = curr_offset<<3;
4434 proto_tree_add_bits_item(tree, hf_nas_eps_esm_pdn_type, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4435 bit_offset+=4;
4437 /* Request type 9.9.4.14 M V 1/2 */
4438 proto_tree_add_bits_item(tree, hf_nas_eps_esm_request_type, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4439 /*bit_offset+=4;*/
4440 /* Fix the lengths */
4441 curr_len--;
4442 curr_offset++;
4443 if (curr_len == 0)
4444 return;
4446 /* D- ESM information transfer flag 9.9.4.5 O TV 1 */
4447 ELEM_OPT_TV_SHORT( 0xd0 , NAS_PDU_TYPE_ESM, DE_ESM_INF_TRF_FLG , NULL );
4448 /* 28 Access point name 9.9.4.1 O TLV 3-102 */
4449 ELEM_OPT_TLV( 0x28 , GSM_A_PDU_TYPE_GM, DE_ACC_POINT_NAME , NULL );
4450 /* 27 Protocol configuration options 9.9.4.11 O TLV 3-253 */
4451 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4452 /* C- Device properties Device properties 9.9.2.0A O TV 1 */
4453 ELEM_OPT_TV_SHORT(0xC0 , GSM_A_PDU_TYPE_GM, DE_DEVICE_PROPERTIES, NULL);
4455 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4458 * 8.3.20 PDN disconnect reject
4460 static void
4461 nas_esm_pdn_disc_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4463 guint32 curr_offset;
4464 guint32 consumed;
4465 guint curr_len;
4467 curr_offset = offset;
4468 curr_len = len;
4470 /*This message is sent by the UE to the network to initiate establishment of a PDN connection. */
4471 pinfo->link_dir = P2P_DIR_UL;
4473 /* ESM cause ESM cause 9.9.4.4 M V 1 */
4474 ELEM_MAND_V(NAS_PDU_TYPE_ESM, DE_ESM_CAUSE, NULL);
4475 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4476 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4478 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4481 * 8.3.21 PDN disconnect request
4483 static void
4484 nas_esm_pdn_disc_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4486 guint32 curr_offset, bit_offset;
4487 guint32 consumed;
4488 guint curr_len;
4490 curr_offset = offset;
4491 curr_len = len;
4493 /* This message is sent by the network to the UE to reject release of a PDN connection. */
4494 pinfo->link_dir = P2P_DIR_DL;
4496 /* Spare half octet Spare half octet 9.9.2.9 M V 1/2 */
4497 bit_offset = curr_offset<<3;
4498 proto_tree_add_bits_item(tree, hf_nas_eps_emm_spare_half_octet, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4499 bit_offset+=4;
4500 /* Linked EPS bearer identity Linked EPS bearer identity 9.9.4.6 M V 1/2 */
4501 proto_tree_add_bits_item(tree, hf_nas_eps_esm_linked_bearer_id, tvb, bit_offset, 4, ENC_BIG_ENDIAN);
4502 /*bit_offset+=4;*/
4503 /* Fix the lengths */
4504 curr_len--;
4505 curr_offset++;
4506 if (curr_len == 0)
4507 return;
4508 /* 27 Protocol configuration options Protocol configuration options 9.9.4.11 O TLV 3-253 */
4509 ELEM_OPT_TLV( 0x27 , GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT , NULL );
4511 EXTRANEOUS_DATA_CHECK(curr_len, 0);
4515 #define NUM_NAS_MSG_ESM (sizeof(nas_msg_esm_strings)/sizeof(value_string))
4516 static gint ett_nas_msg_esm[NUM_NAS_MSG_ESM];
4517 static void (*nas_msg_esm_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) = {
4518 nas_esm_act_def_eps_bearer_ctx_req, /* Activate default EPS bearer context request*/
4519 nas_esm_act_def_eps_bearer_ctx_acc, /* Activate default EPS bearer context accept*/
4520 nas_esm_act_def_eps_bearer_ctx_rej, /* Activate default EPS bearer context reject*/
4521 nas_esm_act_ded_eps_bearer_ctx_req, /* Activate dedicated EPS bearer context request*/
4522 nas_esm_act_ded_eps_bearer_ctx_acc, /* Activate dedicated EPS bearer context accept*/
4523 nas_esm_act_ded_eps_bearer_ctx_rej, /* Activate dedicated EPS bearer context reject*/
4524 nas_esm_mod_eps_bearer_ctx_req, /* Modify EPS bearer context request*/
4525 nas_esm_mod_eps_bearer_ctx_acc, /* Modify EPS bearer context accept*/
4526 nas_esm_mod_eps_bearer_ctx_rej, /* Modify EPS bearer context reject*/
4527 nas_esm_deact_eps_bearer_ctx_req, /* Deactivate EPS bearer context request*/
4528 nas_esm_deact_eps_bearer_ctx_acc, /* Deactivate EPS bearer context accept*/
4529 nas_esm_pdn_con_req, /* 8.3.18 PDN connectivity request */
4530 nas_esm_pdn_con_rej, /* PDN connectivity reject*/
4531 nas_esm_pdn_disc_req, /* PDN disconnect request*/
4532 nas_esm_pdn_disc_rej, /* PDN disconnect reject*/
4533 nas_esm_bearer_res_all_req, /* Bearer resource allocation request*/
4534 nas_esm_bearer_res_all_rej, /* Bearer resource allocation reject*/
4535 nas_esm_bearer_res_mod_req, /* Bearer resource modification request*/
4536 nas_esm_bearer_res_mod_rej, /* Bearer resource modification reject*/
4537 nas_esm_inf_req, /* ESM information request, No IE:s*/
4538 nas_esm_inf_resp, /* ESM information response*/
4539 nas_esm_notification, /* Notification */
4540 nas_esm_status, /* ESM status */
4542 NULL, /* NONE */
4545 static void
4546 get_nas_esm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn_p)
4548 gint idx;
4550 *msg_str = try_val_to_str_idx_ext((guint32) (oct & 0xff), &nas_msg_esm_strings_ext, &idx);
4551 *hf_idx = hf_nas_eps_msg_esm_type;
4552 if (*msg_str != NULL) {
4553 *ett_tree = ett_nas_msg_esm[idx];
4554 *msg_fcn_p = nas_msg_esm_fcn[idx];
4557 return;
4562 #define NUM_NAS_MSG_EMM (sizeof(nas_msg_emm_strings)/sizeof(value_string))
4563 static gint ett_nas_msg_emm[NUM_NAS_MSG_EMM];
4564 static void (*nas_msg_emm_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) = {
4565 nas_emm_attach_req, /* Attach request */
4566 nas_emm_attach_acc, /* Attach accept */
4567 nas_emm_attach_comp, /* Attach complete */
4568 nas_emm_attach_rej, /* Attach reject */
4569 nas_emm_detach_req, /* Detach request */
4570 NULL, /* 8.2.10 Detach accept */
4572 nas_emm_trac_area_upd_req, /* Tracking area update request */
4573 nas_emm_trac_area_upd_acc, /* Tracking area update accept */
4574 NULL, /* Tracking area update complete (No IE's)*/
4575 nas_emm_trac_area_upd_rej, /* Tracking area update reject */
4577 nas_emm_ext_serv_req, /* Extended service request */
4578 nas_emm_serv_rej, /* Service reject */
4580 nas_emm_guti_realloc_cmd, /* GUTI reallocation command */
4581 NULL, /* GUTI reallocation complete (No IE's) */
4582 nas_emm_auth_req, /* Authentication request */
4583 nas_emm_auth_resp, /* Authentication response */
4584 NULL, /* Authentication reject (No IE:s)*/
4585 nas_emm_id_req, /* Identity request */
4586 nas_emm_id_res, /* Identity response */
4587 nas_emm_auth_fail, /* Authentication failure */
4588 nas_emm_sec_mode_cmd, /* Security mode command */
4589 nas_emm_sec_mode_comp, /* Security mode complete */
4590 nas_emm_sec_mode_rej, /* Security mode reject */
4592 nas_emm_emm_status, /* EMM status */
4593 nas_emm_emm_inf, /* EMM information */
4594 nas_emm_dl_nas_trans, /* Downlink NAS transport */
4595 nas_emm_ul_nas_trans, /* Uplink NAS transport */
4596 nas_emm_cs_serv_not, /* 8.2.9 CS service notification */
4597 nas_emm_dl_gen_nas_trans, /* Downlink generic NAS transport */
4598 nas_emm_ul_gen_nas_trans, /* Uplink generic NAS transport */
4599 NULL, /* NONE */
4603 static void
4604 get_nas_emm_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn_p)
4606 gint idx;
4608 *msg_str = try_val_to_str_idx_ext((guint32) (oct & 0xff), &nas_msg_emm_strings_ext, &idx);
4609 *hf_idx = hf_nas_eps_msg_emm_type;
4610 if (*msg_str != NULL) {
4611 *ett_tree = ett_nas_msg_emm[idx];
4612 *msg_fcn_p = nas_msg_emm_fcn[idx];
4615 return;
4618 static const value_string nas_eps_esm_bearer_id_vals[] = {
4619 { 0x0, "No EPS bearer identity assigned"},
4620 { 0x1, "Reserved"},
4621 { 0x2, "Reserved"},
4622 { 0x3, "Reserved"},
4623 { 0x4, "Reserved"},
4624 { 0x5, "EPS bearer identity value 5"},
4625 { 0x6, "EPS bearer identity value 6"},
4626 { 0x7, "EPS bearer identity value 7"},
4627 { 0x8, "EPS bearer identity value 8"},
4628 { 0x9, "EPS bearer identity value 9"},
4629 { 0xa, "EPS bearer identity value 10"},
4630 { 0xb, "EPS bearer identity value 11"},
4631 { 0xc, "EPS bearer identity value 12"},
4632 { 0xd, "EPS bearer identity value 13"},
4633 { 0xe, "EPS bearer identity value 14"},
4634 { 0xf, "EPS bearer identity value 15"},
4635 { 0, NULL }
4639 * EPS session management messages.
4640 * A plain NAS message is pased to this function
4642 static void
4643 disect_nas_eps_esm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
4645 const gchar *msg_str;
4646 guint32 len;
4647 gint ett_tree;
4648 int hf_idx;
4649 void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
4650 guint8 oct;
4652 len = tvb_length(tvb);
4654 * EPS bearer identity 9.3.2
4656 proto_tree_add_item(tree, hf_nas_eps_bearer_id, tvb, offset, 1, ENC_BIG_ENDIAN);
4657 /* Protocol discriminator 9.2 */
4658 proto_tree_add_item(tree, hf_gsm_a_L3_protocol_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN);
4659 offset++;
4661 /* Procedure transaction identity 9.4
4662 * The procedure transaction identity and its use are defined in 3GPP TS 24.007
4664 proto_tree_add_item(tree, hf_nas_eps_esm_proc_trans_id, tvb, offset, 1, ENC_BIG_ENDIAN);
4665 offset++;
4667 /*messge type IE*/
4668 oct = tvb_get_guint8(tvb,offset);
4669 msg_fcn_p = NULL;
4670 ett_tree = -1;
4671 hf_idx = -1;
4672 msg_str = NULL;
4674 get_nas_esm_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p);
4676 if (msg_str) {
4677 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, msg_str);
4678 } else {
4679 proto_tree_add_text(tree, tvb, offset, 1,"Unknown message 0x%x",oct);
4680 return;
4684 * Add NAS message name
4686 proto_tree_add_item(tree, hf_idx, tvb, offset, 1, ENC_BIG_ENDIAN);
4687 offset++;
4691 * decode elements
4693 if (msg_fcn_p == NULL)
4695 proto_tree_add_text(tree, tvb, offset, len - offset,
4696 "Message Elements");
4698 else
4700 (*msg_fcn_p)(tvb, tree, pinfo, offset, len - offset);
4705 * The "real" security header has been dissected or if dissect_header = TRUE
4707 static void
4708 dissect_nas_eps_emm_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean second_header)
4710 const gchar *msg_str;
4711 guint32 len;
4712 gint ett_tree;
4713 int hf_idx;
4714 void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
4715 guint8 security_header_type, oct;
4717 len = tvb_length(tvb);
4719 /* 9.3.1 Security header type */
4720 if (second_header) {
4721 security_header_type = tvb_get_guint8(tvb,offset)>>4;
4722 proto_tree_add_item(tree, hf_nas_eps_security_header_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4723 proto_tree_add_item(tree, hf_gsm_a_L3_protocol_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN);
4724 offset++;
4725 if (security_header_type != 0) {
4726 /* Message authentication code */
4727 proto_tree_add_item(tree, hf_nas_eps_msg_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN);
4728 offset+=4;
4729 /* Sequence number */
4730 proto_tree_add_item(tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN);
4731 offset++;
4732 if ((security_header_type == 2)||(security_header_type == 4))
4733 /* Integrity protected and ciphered = 2, Integrity protected and ciphered with new EPS security context = 4 */
4734 return;
4735 proto_tree_add_item(tree, hf_nas_eps_security_header_type, tvb, offset, 1, ENC_BIG_ENDIAN);
4736 proto_tree_add_item(tree, hf_gsm_a_L3_protocol_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN);
4737 offset++;
4740 /* Messge type IE*/
4741 oct = tvb_get_guint8(tvb,offset);
4742 msg_fcn_p = NULL;
4743 ett_tree = -1;
4744 hf_idx = -1;
4745 msg_str = NULL;
4747 get_nas_emm_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p);
4749 if (msg_str) {
4750 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, msg_str);
4751 } else {
4752 proto_tree_add_text(tree, tvb, offset, 1,"Unknown message 0x%x",oct);
4753 return;
4757 * Add NAS message name
4759 proto_tree_add_item(tree, hf_idx, tvb, offset, 1, ENC_BIG_ENDIAN);
4760 offset++;
4764 * decode elements
4766 if (msg_fcn_p == NULL)
4768 proto_tree_add_text(tree, tvb, offset, len - offset,
4769 "Message Elements");
4771 else
4773 (*msg_fcn_p)(tvb, tree, pinfo, offset, len - offset);
4778 static void
4779 dissect_nas_eps_plain(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4781 proto_item *item;
4782 proto_tree *nas_eps_tree;
4783 guint8 pd;
4784 int offset = 0;
4786 /* make entry in the Protocol column on summary display */
4787 col_append_sep_str(pinfo->cinfo, COL_PROTOCOL, "/", "NAS-EPS");
4789 item = proto_tree_add_item(tree, proto_nas_eps, tvb, 0, -1, ENC_NA);
4790 nas_eps_tree = proto_item_add_subtree(item, ett_nas_eps);
4792 /* SERVICE REQUEST (security header type equal to 12 or greater) is not a plain NAS message */
4793 pd = tvb_get_guint8(tvb,offset);
4794 if (((pd&0x0f) == 0x07) && ((pd&0xf0) >= 0xc0)) {
4795 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Service request");
4796 /* Security header type Security header type 9.3.1 M V 1/2 */
4797 proto_tree_add_item(nas_eps_tree, hf_nas_eps_security_header_type, tvb, 0, 1, ENC_BIG_ENDIAN);
4798 /* Protocol discriminator Protocol discriminator 9.2 M V 1/2 */
4799 proto_tree_add_item(nas_eps_tree, hf_gsm_a_L3_protocol_discriminator, tvb, 0, 1, ENC_BIG_ENDIAN);
4800 offset++;
4801 nas_emm_service_req(tvb, nas_eps_tree, pinfo, offset, tvb_length(tvb)-offset);
4802 return;
4805 pd &= 0x0f;
4806 switch (pd) {
4807 case 2:
4808 /* EPS session management messages.
4809 * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values
4811 disect_nas_eps_esm_msg(tvb, pinfo, nas_eps_tree, offset);
4812 break;
4813 case 7:
4814 /* EPS mobility management messages.
4815 * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values
4817 dissect_nas_eps_emm_msg(tvb, pinfo, nas_eps_tree, offset, TRUE);
4818 break;
4819 case 15:
4820 /* Special conformance testing functions for User Equipment messages.
4821 * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values
4823 if (gsm_a_dtap_handle) {
4824 tvbuff_t *new_tvb = tvb_new_subset_remaining(tvb, offset);
4825 call_dissector(gsm_a_dtap_handle, new_tvb,pinfo, nas_eps_tree);
4826 break;
4827 } /* else fall through default */
4828 default:
4829 proto_tree_add_text(nas_eps_tree, tvb, offset, -1, "Not a NAS EPS PD %u(%s)",
4831 val_to_str_const(pd, protocol_discriminator_vals, "unknown"));
4832 break;
4837 /* TS 24.301 8.2.1
4838 * 9 General message format and information elements coding
4839 * 9.1 Overview
4840 * Within the protocols defined in the present document, every message, except the SERVICE REQUEST message,
4841 * is a standard L3 message as defined in 3GPP TS 24.007 [12]. This means that the message consists of the following parts:
4842 * 1) if the message is a plain NAS message:
4843 * a) protocol discriminator;
4844 * b) EPS bearer identity or security header type;
4845 * c) procedure transaction identity;
4846 * d) message type;
4847 * e) other information elements, as required.
4848 * 2) if the message is a security protected NAS message:
4849 * a) protocol discriminator;
4850 * b) security header type;
4851 * c) message authentication code;
4852 * d) sequence number;
4853 * e) plain NAS message, as defined in item 1.
4855 * The EPS bearer identity and the procedure transaction identity are only used in messages
4856 * with protocol discriminator EPS session management. Octet 1a with the procedure transaction
4857 * identity shall only be included in these messages.
4861 * All messages recived here will have the security header:
4862 * Figure 9.1.2: General message organization example for a security protected NAS message
4863 * 9.3.1 Bits 5 to 8 of the first octet of every EPS Mobility Management (EMM)
4864 * message contain the Security header type IE.
4865 * 4.4.4.2 All ESM messages are integrity protected.
4868 static void
4869 dissect_nas_eps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4871 proto_item *item;
4872 proto_tree *nas_eps_tree;
4873 guint8 pd, security_header_type;
4874 int offset = 0;
4875 guint32 len;
4876 guint32 msg_auth_code;
4878 len = tvb_length(tvb);
4879 /* The protected NAS message header is 6 octets long, and the NAS message header is at least 2 octets long. */
4880 /* If the length of the tvbuffer is less than 8 octets, we can safely conclude the message is not protected. */
4881 if (len < 8) {
4882 dissect_nas_eps_plain(tvb, pinfo, tree);
4883 return;
4886 if (g_nas_eps_dissect_plain) {
4887 dissect_nas_eps_plain(tvb, pinfo, tree);
4888 return;
4891 /* make entry in the Protocol column on summary display */
4892 col_append_sep_str(pinfo->cinfo, COL_PROTOCOL, "/", "NAS-EPS");
4894 item = proto_tree_add_item(tree, proto_nas_eps, tvb, 0, -1, ENC_NA);
4895 nas_eps_tree = proto_item_add_subtree(item, ett_nas_eps);
4897 /* Security header type Security header type 9.3.1 M V 1/2 */
4898 security_header_type = tvb_get_guint8(tvb,offset)>>4;
4899 proto_tree_add_item(nas_eps_tree, hf_nas_eps_security_header_type, tvb, 0, 1, ENC_BIG_ENDIAN);
4900 /* Protocol discriminator Protocol discriminator 9.2 M V 1/2 */
4901 proto_tree_add_item(nas_eps_tree, hf_gsm_a_L3_protocol_discriminator, tvb, 0, 1, ENC_BIG_ENDIAN);
4902 pd = tvb_get_guint8(tvb,offset)&0x0f;
4903 offset++;
4904 /* Message authentication code Message authentication code 9.5 M V 4 */
4905 if (security_header_type == 0) {
4906 if (pd == 7) {
4907 /* Plain EPS mobility management messages. */
4908 dissect_nas_eps_emm_msg(tvb, pinfo, nas_eps_tree, offset, FALSE);
4909 return;
4910 } else {
4911 proto_tree_add_text(nas_eps_tree, tvb, offset, len, "All ESM / Test Procedures messages should be integrity protected");
4912 return;
4914 } else {
4915 /* SERVICE REQUEST (12 or greater) is not a plain NAS message treat separately */
4916 if (security_header_type >= 12) {
4917 col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Service request");
4918 nas_emm_service_req(tvb, nas_eps_tree, pinfo, offset, len-offset);
4919 return;
4921 /* Message authentication code */
4922 proto_tree_add_item(nas_eps_tree, hf_nas_eps_msg_auth_code, tvb, offset, 4, ENC_BIG_ENDIAN);
4923 msg_auth_code = tvb_get_ntohl(tvb, offset);
4924 offset+=4;
4925 if ((security_header_type == 2)||(security_header_type == 4)) {
4926 /* Possible ciphered message */
4927 if (msg_auth_code != 0) {
4928 /* Sequence number Sequence number 9.6 M V 1 */
4929 proto_tree_add_item(nas_eps_tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN);
4930 offset++;
4931 /* Integrity protected and ciphered = 2, Integrity protected and ciphered with new EPS security context = 4 */
4932 /* Read security_header_type / EPS bearer id AND pd */
4933 pd = tvb_get_guint8(tvb,offset);
4934 /* If pd is in plaintext this message probably isn't ciphered */
4935 if ((pd != 7) && (pd != 15) &&
4936 (((pd&0x0f) != 2) || (((pd&0x0f) == 2) && ((pd&0xf0) > 0) && ((pd&0xf0) < 0x50)))) {
4937 proto_tree_add_text(nas_eps_tree, tvb, offset, len-6,"Ciphered message");
4938 return;
4940 } else {
4941 /* msg_auth_code == 0, probably not ciphered */
4942 /* Sequence number Sequence number 9.6 M V 1 */
4943 proto_tree_add_item(nas_eps_tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN);
4944 offset++;
4946 } else {
4947 /* Sequence number Sequence number 9.6 M V 1 */
4948 proto_tree_add_item(nas_eps_tree, hf_nas_eps_seq_no, tvb, offset, 1, ENC_BIG_ENDIAN);
4949 offset++;
4952 /* NAS message NAS message 9.7 M V 1-n */
4954 pd = tvb_get_guint8(tvb,offset)&0x0f;
4955 switch (pd) {
4956 case 2:
4957 /* EPS session management messages.
4958 * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values
4960 disect_nas_eps_esm_msg(tvb, pinfo, nas_eps_tree, offset);
4961 break;
4962 case 7:
4963 /* EPS mobility management messages.
4964 * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values
4966 dissect_nas_eps_emm_msg(tvb, pinfo, nas_eps_tree, offset, TRUE);
4967 break;
4968 case 15:
4969 /* Special conformance testing functions for User Equipment messages.
4970 * Ref 3GPP TS 24.007 version 8.0.0 Release 8, Table 11.2: Protocol discriminator values
4972 if (gsm_a_dtap_handle) {
4973 tvbuff_t *new_tvb = tvb_new_subset_remaining(tvb, offset);
4974 call_dissector(gsm_a_dtap_handle, new_tvb, pinfo, nas_eps_tree);
4975 break;
4976 } /* else fall through default */
4977 default:
4978 proto_tree_add_text(nas_eps_tree, tvb, offset, -1, "Not a NAS EPS PD %u(%s)",
4980 val_to_str_const(pd, protocol_discriminator_vals, "unknown"));
4981 break;
4986 void
4987 proto_register_nas_eps(void) {
4988 guint i;
4989 guint last_offset;
4990 module_t *nas_eps_module;
4992 /* List of fields */
4994 static hf_register_info hf[] = {
4995 { &hf_nas_eps_msg_emm_type,
4996 { "NAS EPS Mobility Management Message Type", "nas_eps.nas_msg_emm_type",
4997 FT_UINT8, BASE_HEX|BASE_EXT_STRING, &nas_msg_emm_strings_ext, 0x0,
4998 NULL, HFILL }
5000 { &hf_nas_eps_common_elem_id,
5001 { "Element ID", "nas_eps.common.elem_id",
5002 FT_UINT8, BASE_HEX, NULL, 0,
5003 NULL, HFILL }
5005 { &hf_nas_eps_emm_elem_id,
5006 { "Element ID", "nas_eps.emm.elem_id",
5007 FT_UINT8, BASE_HEX, NULL, 0,
5008 NULL, HFILL }
5010 { &hf_nas_eps_bearer_id,
5011 { "EPS bearer identity", "nas_eps.bearer_id",
5012 FT_UINT8, BASE_DEC, VALS(nas_eps_esm_bearer_id_vals), 0xf0,
5013 NULL, HFILL }
5015 { &hf_nas_eps_spare_bits,
5016 { "Spare bit(s)", "nas_eps.spare_bits",
5017 FT_UINT8, BASE_HEX, NULL, 0x0,
5018 NULL, HFILL }
5020 { &hf_nas_eps_security_header_type,
5021 { "Security header type","nas_eps.security_header_type",
5022 FT_UINT8,BASE_DEC|BASE_EXT_STRING, &security_header_type_vals_ext, 0xf0,
5023 NULL, HFILL }
5025 { &hf_nas_eps_msg_auth_code,
5026 { "Message authentication code","nas_eps.msg_auth_code",
5027 FT_UINT32,BASE_HEX, NULL, 0x0,
5028 NULL, HFILL }
5030 { &hf_nas_eps_seq_no,
5031 { "Sequence number","nas_eps.seq_no",
5032 FT_UINT8,BASE_DEC, NULL, 0x0,
5033 NULL, HFILL }
5035 { &hf_nas_eps_seq_no_short,
5036 { "Sequence number (short)","nas_eps.seq_no_short",
5037 FT_UINT8,BASE_DEC, NULL, 0x0,
5038 NULL, HFILL }
5040 { &hf_nas_eps_emm_ebi0,
5041 { "EBI(0) spare","nas_eps.emm.ebi0",
5042 FT_BOOLEAN, 8, NULL, 0x01,
5043 NULL, HFILL }
5045 { &hf_nas_eps_emm_ebi1,
5046 { "EBI(1) spare","nas_eps.emm.ebi1",
5047 FT_BOOLEAN, 8, NULL, 0x02,
5048 NULL, HFILL }
5050 { &hf_nas_eps_emm_ebi2,
5051 { "EBI(2) spare","nas_eps.emm.ebi2",
5052 FT_BOOLEAN, 8, NULL, 0x04,
5053 NULL, HFILL }
5055 { &hf_nas_eps_emm_ebi3,
5056 { "EBI(3) spare","nas_eps.emm.ebi3",
5057 FT_BOOLEAN, 8, NULL, 0x08,
5058 NULL, HFILL }
5060 { &hf_nas_eps_emm_ebi4,
5061 { "EBI(4) spare","nas_eps.emm.ebi4",
5062 FT_BOOLEAN, 8, NULL, 0x10,
5063 NULL, HFILL }
5065 { &hf_nas_eps_emm_ebi5,
5066 { "EBI(5)","nas_eps.emm.ebi5",
5067 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x20,
5068 NULL, HFILL }
5070 { &hf_nas_eps_emm_ebi6,
5071 { "EBI(6)","nas_eps.emm.ebi6",
5072 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x40,
5073 NULL, HFILL }
5075 { &hf_nas_eps_emm_ebi7,
5076 { "EBI(7)","nas_eps.emm.ebi7",
5077 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x80,
5078 NULL, HFILL }
5080 { &hf_nas_eps_emm_ebi8,
5081 { "EBI(8)","nas_eps.emm.ebi8",
5082 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x01,
5083 NULL, HFILL }
5085 { &hf_nas_eps_emm_ebi9,
5086 { "EBI(9)","nas_eps.emm.ebi9",
5087 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x02,
5088 NULL, HFILL }
5090 { &hf_nas_eps_emm_ebi10,
5091 { "EBI(10)","nas_eps.emm.ebi10",
5092 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x04,
5093 NULL, HFILL }
5095 { &hf_nas_eps_emm_ebi11,
5096 { "EBI(11)","nas_eps.emm.ebi11",
5097 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x08,
5098 NULL, HFILL }
5100 { &hf_nas_eps_emm_ebi12,
5101 { "EBI(12)","nas_eps.emm.ebi12",
5102 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x10,
5103 NULL, HFILL }
5105 { &hf_nas_eps_emm_ebi13,
5106 { "EBI(13)","nas_eps.emm.ebi13",
5107 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x20,
5108 NULL, HFILL }
5110 { &hf_nas_eps_emm_ebi14,
5111 { "EBI(14)","nas_eps.emm.ebi14",
5112 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x40,
5113 NULL, HFILL }
5115 { &hf_nas_eps_emm_ebi15,
5116 { "EBI(15)","nas_eps.emm.ebi15",
5117 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ebi_vals), 0x80,
5118 NULL, HFILL }
5120 { &hf_nas_eps_emm_dl_nas_cnt,
5121 { "DL NAS COUNT value","nas_eps.emm.dl_nas_cnt",
5122 FT_UINT8,BASE_DEC, NULL, 0x0f,
5123 NULL, HFILL }
5125 {&hf_nas_eps_emm_nonce_mme,
5126 { "NonceMME","nas_eps.emm.nonce_mme",
5127 FT_UINT32,BASE_HEX, NULL, 0x0,
5128 NULL, HFILL }
5130 {&hf_nas_eps_emm_nonce,
5131 { "Nonce","nas_eps.emm.nonce",
5132 FT_UINT32,BASE_HEX, NULL, 0x0,
5133 NULL, HFILL }
5135 { &hf_nas_eps_emm_paging_id,
5136 { "Paging identity value","nas_eps.emm.paging_id",
5137 FT_BOOLEAN, BASE_NONE, TFS(&nas_eps_emm_paging_id_vals), 0x0,
5138 NULL, HFILL }
5140 { &hf_nas_eps_emm_eps_att_type,
5141 { "EPS attach type","nas_eps.emm.eps_att_type",
5142 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_eps_att_type_vals), 0x0,
5143 NULL, HFILL }
5145 { &hf_nas_eps_emm_esr_ps,
5146 { "ESRPS","nas_eps.emm.esr_ps",
5147 FT_BOOLEAN ,BASE_NONE, TFS(&nas_eps_emm_esr_ps_value), 0x0,
5148 "Support of EXTENDED SERVICE REQUEST for packet services", HFILL }
5150 { &hf_nas_eps_emm_cs_lcs,
5151 { "CS-LCS","nas_eps.emm.cs_lcs",
5152 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_cs_lcs_vals), 0x0,
5153 "Location services indicator in CS", HFILL }
5155 { &hf_nas_eps_emm_epc_lcs,
5156 { "EPC-LCS","nas_eps.emm.epc_lcs",
5157 FT_BOOLEAN ,BASE_NONE, TFS(&nas_eps_emm_epc_lcs_value), 0x0,
5158 "Location services indicator in EPC", HFILL }
5160 { &hf_nas_eps_emm_emc_bs,
5161 { "EMC BS","nas_eps.emm.emc_bs",
5162 FT_BOOLEAN, BASE_NONE, TFS(&nas_eps_emm_emc_bs_value), 0x0,
5163 "Emergency bearer services indicator", HFILL }
5165 { &hf_nas_eps_emm_ims_vops,
5166 { "IMS VoPS","nas_eps.emm.ims_vops",
5167 FT_BOOLEAN, BASE_NONE, TFS(&nas_eps_emm_ims_vops_value), 0x0,
5168 "IMS voice over PS session indicator", HFILL }
5170 { &hf_nas_eps_tsc,
5171 { "Type of security context flag (TSC)","nas_eps.emm.tsc",
5172 FT_BOOLEAN,BASE_DEC, TFS(&nas_eps_tsc_value), 0x0,
5173 NULL, HFILL }
5175 { &hf_nas_eps_emm_nas_key_set_id,
5176 { "NAS key set identifier","nas_eps.emm.nas_key_set_id",
5177 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_NAS_key_set_identifier_vals), 0x0,
5178 NULL, HFILL }
5180 { &hf_nas_eps_emm_odd_even,
5181 { "odd/even indic","nas_eps.emm.odd_even",
5182 FT_UINT8,BASE_DEC, NULL, 0x8,
5183 NULL, HFILL }
5185 { &hf_nas_eps_emm_type_of_id,
5186 { "Type of identity","nas_eps.emm.type_of_id",
5187 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_type_of_id_vals), 0x07,
5188 NULL, HFILL }
5190 { &hf_nas_eps_emm_mme_grp_id,
5191 { "MME Group ID","nas_eps.emm.mme_grp_id",
5192 FT_UINT16, BASE_DEC, NULL, 0x0,
5193 NULL, HFILL }
5195 { &hf_nas_eps_emm_imsi,
5196 { "IMSI", "nas_eps.emm.imsi",
5197 FT_STRING, BASE_NONE, NULL, 0,
5198 NULL, HFILL }
5200 { &hf_nas_eps_emm_imei,
5201 { "IMEI", "nas_eps.emm.imei",
5202 FT_STRING, BASE_NONE, NULL, 0,
5203 NULL, HFILL }
5205 { &hf_nas_eps_emm_mme_code,
5206 { "MME Code","nas_eps.emm.mme_code",
5207 FT_UINT8, BASE_DEC, NULL, 0x0,
5208 NULL, HFILL }
5210 { &hf_nas_eps_emm_m_tmsi,
5211 { "M-TMSI","nas_eps.emm.m_tmsi",
5212 FT_UINT32, BASE_HEX, NULL, 0x0,
5213 NULL, HFILL }
5215 { &hf_nas_eps_esm_msg_cont,
5216 { "ESM message container contents","nas_eps.emm.esm_msg_cont",
5217 FT_BYTES, BASE_NONE, NULL, 0x0,
5218 NULL, HFILL }
5220 { &hf_nas_eps_esm_imeisv_req,
5221 { "IMEISV request","nas_eps.emm.imeisv_req",
5222 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_imeisv_req_vals), 0x07,
5223 NULL, HFILL }
5225 { &hf_nas_eps_emm_toi,
5226 { "Type of integrity protection algorithm","nas_eps.emm.toi",
5227 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_toi_vals), 0x07,
5228 NULL, HFILL }
5230 { &hf_nas_eps_emm_toc,
5231 { "Type of ciphering algorithm","nas_eps.emm.toc",
5232 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_toc_vals), 0x70,
5233 NULL, HFILL }
5235 { &hf_nas_eps_emm_EPS_attach_result,
5236 { "Attach result","nas_eps.emm.EPS_attach_result",
5237 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_EPS_attach_result_values), 0x0,
5238 NULL, HFILL }
5240 { &hf_nas_eps_emm_spare_half_octet,
5241 { "Spare half octet","nas_eps.emm.spare_half_octet",
5242 FT_UINT8,BASE_DEC, NULL, 0x0,
5243 NULL, HFILL }
5245 { &hf_nas_eps_emm_add_upd_res,
5246 { "AURV","nas_eps.emm.add_upd_res",
5247 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_add_upd_res_vals), 0x0,
5248 "Additional update result value", HFILL }
5250 { &hf_nas_eps_emm_add_upd_type,
5251 { "AUTV","nas_eps.emm.add_upd_type",
5252 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_add_upd_type_vals), 0x0,
5253 "Additional update type value", HFILL }
5255 { &hf_nas_eps_emm_res,
5256 { "RES","nas_eps.emm.res",
5257 FT_BYTES, BASE_NONE, NULL, 0x0,
5258 NULL, HFILL }
5260 { &hf_nas_eps_emm_csfb_resp,
5261 { "CSFB response","nas_eps.emm.csfb_resp",
5262 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_csfb_resp_vals), 0x03,
5263 NULL, HFILL }
5265 { &hf_nas_eps_emm_cause,
5266 { "Cause","nas_eps.emm.cause",
5267 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &nas_eps_emm_cause_values_ext, 0x0,
5268 NULL, HFILL }
5270 { &hf_nas_eps_emm_id_type2,
5271 { "Identity type 2","nas_eps.emm.id_type2",
5272 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_id_type2_vals), 0x0,
5273 NULL, HFILL }
5275 { &hf_nas_eps_emm_short_mac,
5276 { "Message authentication code (short)","nas_eps.emm.short_mac",
5277 FT_UINT16, BASE_HEX, NULL, 0x0,
5278 NULL, HFILL }
5280 { &hf_nas_eps_emm_tai_tol,
5281 { "Type of list","nas_eps.emm.tai_tol",
5282 FT_UINT8, BASE_DEC, VALS(nas_eps_emm_tai_tol_vals), 0x60,
5283 NULL, HFILL }
5285 { &hf_nas_eps_emm_tai_n_elem,
5286 { "Number of elements","nas_eps.emm.tai_n_elem",
5287 FT_UINT8, BASE_DEC, NULL, 0x1f,
5288 NULL, HFILL }
5290 { &hf_nas_eps_emm_tai_tac,
5291 { "Tracking area code(TAC)","nas_eps.emm.tai_tac",
5292 FT_UINT16, BASE_HEX, NULL, 0x0,
5293 NULL, HFILL }
5295 { &hf_nas_eps_emm_eea0,
5296 { "EEA0","nas_eps.emm.eea0",
5297 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x80,
5298 NULL, HFILL }
5300 { &hf_nas_eps_emm_128eea1,
5301 { "128-EEA1","nas_eps.emm.128eea1",
5302 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x40,
5303 NULL, HFILL }
5305 { &hf_nas_eps_emm_128eea2,
5306 { "128-EEA2","nas_eps.emm.128eea2",
5307 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x20,
5308 NULL, HFILL }
5310 { &hf_nas_eps_emm_eea3,
5311 { "128-EEA3","nas_eps.emm.eea3",
5312 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x10,
5313 NULL, HFILL }
5315 { &hf_nas_eps_emm_eea4,
5316 { "EEA4","nas_eps.emm.eea4",
5317 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x08,
5318 NULL, HFILL }
5320 { &hf_nas_eps_emm_eea5,
5321 { "EEA5","nas_eps.emm.eea5",
5322 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x04,
5323 NULL, HFILL }
5325 { &hf_nas_eps_emm_eea6,
5326 { "EEA6","nas_eps.emm.eea6",
5327 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x02,
5328 NULL, HFILL }
5330 { &hf_nas_eps_emm_eea7,
5331 { "EEA7","nas_eps.emm.eea7",
5332 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x01,
5333 NULL, HFILL }
5335 { &hf_nas_eps_emm_eia0,
5336 { "EIA0","nas_eps.emm.eia0",
5337 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x80,
5338 NULL, HFILL }
5340 { &hf_nas_eps_emm_128eia1,
5341 { "128-EIA1","nas_eps.emm.128eia1",
5342 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x40,
5343 NULL, HFILL }
5345 { &hf_nas_eps_emm_128eia2,
5346 { "128-EIA2","nas_eps.emm.128eia2",
5347 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x20,
5348 NULL, HFILL }
5350 { &hf_nas_eps_emm_eia3,
5351 { "128-EIA3","nas_eps.emm.eia3",
5352 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x10,
5353 NULL, HFILL }
5355 { &hf_nas_eps_emm_eia4,
5356 { "EIA4","nas_eps.emm.eia4",
5357 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x08,
5358 NULL, HFILL }
5360 { &hf_nas_eps_emm_eia5,
5361 { "EIA5","nas_eps.emm.eia5",
5362 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x04,
5363 NULL, HFILL }
5365 { &hf_nas_eps_emm_eia6,
5366 { "EIA6","nas_eps.emm.eia6",
5367 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x02,
5368 NULL, HFILL }
5370 { &hf_nas_eps_emm_eia7,
5371 { "EIA7","nas_eps.emm.eia7",
5372 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x01,
5373 NULL, HFILL }
5377 { &hf_nas_eps_emm_uea0,
5378 { "UEA0","nas_eps.emm.uea0",
5379 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x80,
5380 NULL, HFILL }
5382 { &hf_nas_eps_emm_uea1,
5383 { "UEA1","nas_eps.emm.uea1",
5384 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x40,
5385 NULL, HFILL }
5387 { &hf_nas_eps_emm_uea2,
5388 { "UEA2","nas_eps.emm.uea2",
5389 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x20,
5390 NULL, HFILL }
5392 { &hf_nas_eps_emm_uea3,
5393 { "UEA3","nas_eps.emm.uea3",
5394 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x10,
5395 NULL, HFILL }
5397 { &hf_nas_eps_emm_uea4,
5398 { "UEA4","nas_eps.emm.uea4",
5399 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x08,
5400 NULL, HFILL }
5402 { &hf_nas_eps_emm_uea5,
5403 { "UEA5","nas_eps.emm.uea5",
5404 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x04,
5405 NULL, HFILL }
5407 { &hf_nas_eps_emm_uea6,
5408 { "UEA6","nas_eps.emm.uea6",
5409 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x02,
5410 NULL, HFILL }
5412 { &hf_nas_eps_emm_uea7,
5413 { "UEA7","nas_eps.emm.uea7",
5414 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x01,
5415 NULL, HFILL }
5417 { &hf_nas_eps_emm_ucs2_supp,
5418 { "UCS2 support (UCS2)","nas_eps.emm.emm_ucs2_supp",
5419 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ucs2_supp_flg_value), 0x80,
5420 NULL, HFILL }
5422 { &hf_nas_eps_emm_uia1,
5423 { "UMTS integrity algorithm UIA1","nas_eps.emm.uia1",
5424 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x40,
5425 NULL, HFILL }
5427 { &hf_nas_eps_emm_uia2,
5428 { "UMTS integrity algorithm UIA2","nas_eps.emm.uia2",
5429 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x20,
5430 NULL, HFILL }
5432 { &hf_nas_eps_emm_uia3,
5433 { "UMTS integrity algorithm UIA3","nas_eps.emm.uia3",
5434 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x10,
5435 NULL, HFILL }
5437 { &hf_nas_eps_emm_uia4,
5438 { "UMTS integrity algorithm UIA4","nas_eps.emm.uia4",
5439 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x08,
5440 NULL, HFILL }
5442 { &hf_nas_eps_emm_uia5,
5443 { "UMTS integrity algorithm UIA5","nas_eps.emm.uia5",
5444 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x04,
5445 NULL, HFILL }
5447 { &hf_nas_eps_emm_uia6,
5448 { "UMTS integrity algorithm UIA6","nas_eps.emm.uia6",
5449 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x02,
5450 NULL, HFILL }
5452 { &hf_nas_eps_emm_uia7,
5453 { "UMTS integrity algorithm UIA7","nas_eps.emm.uia7",
5454 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x01,
5455 NULL, HFILL }
5457 { &hf_nas_eps_emm_gea1,
5458 { "GPRS encryption algorithm GEA1","nas_eps.emm.gea1",
5459 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x40,
5460 NULL, HFILL }
5462 { &hf_nas_eps_emm_gea2,
5463 { "GPRS encryption algorithm GEA2","nas_eps.emm.gea2",
5464 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x20,
5465 NULL, HFILL }
5467 { &hf_nas_eps_emm_gea3,
5468 { "GPRS encryption algorithm GEA3","nas_eps.emm.gea3",
5469 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x10,
5470 NULL, HFILL }
5472 { &hf_nas_eps_emm_gea4,
5473 { "GPRS encryption algorithm GEA4","nas_eps.emm.gea4",
5474 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x08,
5475 NULL, HFILL }
5477 { &hf_nas_eps_emm_gea5,
5478 { "GPRS encryption algorithm GEA5","nas_eps.emm.gea5",
5479 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x04,
5480 NULL, HFILL }
5482 { &hf_nas_eps_emm_gea6,
5483 { "GPRS encryption algorithm GEA6","nas_eps.emm.gea6",
5484 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x02,
5485 NULL, HFILL }
5487 { &hf_nas_eps_emm_gea7,
5488 { "GPRS encryption algorithm GEA7","nas_eps.emm.gea7",
5489 FT_BOOLEAN, 8, TFS(&nas_eps_emm_supported_flg_value), 0x01,
5490 NULL, HFILL }
5492 { &hf_nas_eps_emm_h245_ash_cap,
5493 { "H.245-ASH capability","nas_eps.emm.h245_ash_cap",
5494 FT_BOOLEAN, 8, TFS(&nas_eps_emm_h245_ash_cap_flg), 0x20,
5495 "H.245 after SRVCC handover capability", HFILL }
5497 { &hf_nas_eps_emm_acc_csfb_cap,
5498 { "ACC-CSFB capability","nas_eps.emm.acc_csfb_cap",
5499 FT_BOOLEAN, 8, TFS(&nas_eps_emm_acc_csfb_cap_flg), 0x10,
5500 "Access class control for CSFB capability", HFILL }
5502 { &hf_nas_eps_emm_lpp_cap,
5503 { "LPP capability","nas_eps.emm.lpp_cap",
5504 FT_BOOLEAN, 8, TFS(&nas_eps_emm_lpp_cap_flg), 0x08,
5505 "LTE Positioning Protocol capability", HFILL }
5507 { &hf_nas_eps_emm_lcs_cap,
5508 { "LCS capability","nas_eps.emm.lcs_cap",
5509 FT_BOOLEAN, 8, TFS(&nas_eps_emm_lcs_cap_flg), 0x04,
5510 "Location services notification mechanisms capability", HFILL }
5512 { &hf_nas_eps_emm_1xsrvcc_cap,
5513 { "1xSRVCC capability","nas_eps.emm.1xsrvcc_cap",
5514 FT_BOOLEAN, 8, TFS(&nas_eps_emm_1xsrvcc_cap_flg), 0x02,
5515 NULL, HFILL }
5517 { &hf_nas_eps_emm_nf_cap,
5518 { "NF capability","nas_eps.emm.nf_cap",
5519 FT_BOOLEAN, 8, TFS(&nas_eps_emm_nf_cap_flg), 0x01,
5520 NULL, HFILL }
5522 { &hf_nas_eps_emm_ue_ra_cap_inf_upd_need_flg,
5523 { "URC upd","nas_eps.emm.ue_ra_cap_inf_upd_need_flg",
5524 FT_BOOLEAN, 8, TFS(&nas_eps_emm_ue_ra_cap_inf_upd_need_flg), 0x01,
5525 "UE radio capability information update needed flag", HFILL }
5527 { &hf_nas_eps_emm_ss_code,
5528 { "SS Code","nas_eps.emm.ss_code",
5529 FT_UINT8,BASE_DEC, VALS(ssCode_vals), 0x0,
5530 NULL, HFILL }
5532 { &hf_nas_eps_emm_lcs_ind,
5533 { "LCS indicator","nas_eps.emm.emm_lcs_ind",
5534 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_lcs_ind_vals), 0x0,
5535 NULL, HFILL }
5537 { &hf_nas_eps_emm_gen_msg_cont_type,
5538 { "Container type","nas_eps.emm.gen_msg_cont_type",
5539 FT_UINT8,BASE_DEC|BASE_RANGE_STRING, RVALS(nas_eps_emm_gen_msg_cont_type_vals), 0x0,
5540 NULL, HFILL }
5542 { &hf_nas_eps_emm_apn_ambr_ul,
5543 { "APN-AMBR for uplink","nas_eps.emm.apn_ambr_ul",
5544 FT_UINT8,BASE_DEC, NULL, 0x0,
5545 NULL, HFILL }
5547 { &hf_nas_eps_emm_apn_ambr_dl,
5548 { "APN-AMBR for downlink","nas_eps.emm.apn_ambr_dl",
5549 FT_UINT8,BASE_DEC, NULL, 0x0,
5550 NULL, HFILL }
5552 { &hf_nas_eps_emm_apn_ambr_ul_ext,
5553 { "APN-AMBR for uplink (extended)","nas_eps.emm.apn_ambr_ul_ext",
5554 FT_UINT8,BASE_DEC, NULL, 0x0,
5555 NULL, HFILL }
5557 { &hf_nas_eps_emm_apn_ambr_dl_ext,
5558 { "APN-AMBR for downlink (extended)","nas_eps.emm.apn_ambr_dl_ext",
5559 FT_UINT8,BASE_DEC, NULL, 0x0,
5560 NULL, HFILL }
5562 { &hf_nas_eps_emm_apn_ambr_ul_ext2,
5563 { "APN-AMBR for uplink (extended-2)","nas_eps.emm.apn_ambr_ul_ext2",
5564 FT_UINT8,BASE_DEC, NULL, 0x0,
5565 NULL, HFILL }
5567 { &hf_nas_eps_emm_apn_ambr_dl_ext2,
5568 { "APN-AMBR for downlink (extended-2)","nas_eps.emm.apn_ambr_dl_ext2",
5569 FT_UINT8,BASE_DEC, NULL, 0x0,
5570 NULL, HFILL }
5572 { &hf_nas_eps_emm_guti_type,
5573 { "GUTI type", "nas_eps.emm.guti_type",
5574 FT_BOOLEAN, BASE_NONE, TFS(&nas_eps_emm_guti_type_value), 0x0,
5575 NULL, HFILL }
5577 { &hf_nas_eps_emm_switch_off,
5578 { "Switch off","nas_eps.emm.switch_off",
5579 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_switch_off_vals), 0x0,
5580 NULL, HFILL }
5582 { &hf_nas_eps_emm_detach_type_UL,
5583 { "Detach Type","nas_eps.emm.detach_type_ul",
5584 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_type_of_dtatch_UL_vals), 0x0,
5585 NULL, HFILL }
5587 { &hf_nas_eps_emm_detach_type_DL,
5588 { "Detach Type","nas_eps.emm.detach_type_dl",
5589 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_type_of_dtatch_DL_vals), 0x0,
5590 NULL, HFILL }
5592 { &hf_nas_eps_qci,
5593 { "Quality of Service Class Identifier (QCI)","nas_eps.emm.qci",
5594 FT_UINT8,(BASE_DEC|BASE_RANGE_STRING), RVALS(nas_eps_qci_vals), 0x0,
5595 NULL, HFILL }
5597 { &hf_nas_eps_mbr_ul,
5598 { "Maximum bit rate for uplink","nas_eps.emm.mbr_ul",
5599 FT_UINT8,BASE_DEC, NULL, 0x0,
5600 NULL, HFILL }
5602 { &hf_nas_eps_mbr_dl,
5603 { "Maximum bit rate for downlink","nas_eps.emm.mbr_dl",
5604 FT_UINT8,BASE_DEC, NULL, 0x0,
5605 NULL, HFILL }
5607 { &hf_nas_eps_gbr_ul,
5608 { "Guaranteed bit rate for uplink","nas_eps.emm.gbr_ul",
5609 FT_UINT8,BASE_DEC, NULL, 0x0,
5610 NULL, HFILL }
5612 { &hf_nas_eps_gbr_dl,
5613 { "Guaranteed bit rate for downlink","nas_eps.emm.gbr_dl",
5614 FT_UINT8,BASE_DEC, NULL, 0x0,
5615 NULL, HFILL }
5617 { &hf_nas_eps_embr_ul,
5618 { "Maximum bit rate for uplink(ext)","nas_eps.emm.embr_ul",
5619 FT_UINT8,BASE_DEC, NULL, 0x0,
5620 NULL, HFILL }
5622 { &hf_nas_eps_embr_dl,
5623 { "Maximum bit rate for downlink(ext)","nas_eps.emm.embr_dl",
5624 FT_UINT8,BASE_DEC, NULL, 0x0,
5625 NULL, HFILL }
5627 { &hf_nas_eps_egbr_ul,
5628 { "Guaranteed bit rate for uplink(ext)","nas_eps.emm.egbr_ul",
5629 FT_UINT8,BASE_DEC, NULL, 0x0,
5630 NULL, HFILL }
5632 { &hf_nas_eps_egbr_dl,
5633 { "Guaranteed bit rate for downlink(ext)","nas_eps.emm.egbr_dl",
5634 FT_UINT8,BASE_DEC, NULL, 0x0,
5635 NULL, HFILL }
5637 { &hf_nas_eps_esm_cause,
5638 { "Cause","nas_eps.esm.cause",
5639 FT_UINT8,BASE_DEC|BASE_EXT_STRING, &nas_eps_esm_cause_vals_ext, 0x0,
5640 NULL, HFILL }
5642 { &hf_nas_eps_esm_eit,
5643 { "EIT (ESM information transfer)", "nas_eps.emm.eit",
5644 FT_BOOLEAN, 8, TFS(&nas_eps_emm_eit_vals), 0x01,
5645 NULL, HFILL }
5647 { &hf_nas_eps_esm_notif_ind,
5648 { "Notification indicator value","nas_eps.esm.notif_ind",
5649 FT_UINT8,BASE_DEC, VALS(nas_eps_esm_notif_ind_vals), 0x0,
5650 NULL, HFILL }
5652 { &hf_nas_eps_esm_pdn_ipv4,
5653 {"PDN IPv4", "nas_eps.esm.pdn_ipv4",
5654 FT_IPv4, BASE_NONE, NULL, 0x0,
5655 NULL, HFILL}
5657 { &hf_nas_eps_esm_pdn_ipv6_if_id,
5658 {"PDN IPv6 if id", "nas_eps.esm.pdn_ipv6_if_id",
5659 FT_BYTES, BASE_NONE, NULL, 0x0,
5660 NULL, HFILL}
5662 { &hf_nas_eps_esm_linked_bearer_id,
5663 { "Linked EPS bearer identity","nas_eps.esm.linked_bearer_id",
5664 FT_UINT8,BASE_DEC, VALS(nas_eps_esm_linked_bearer_id_vals), 0x0,
5665 NULL, HFILL }
5667 { &hf_nas_eps_active_flg,
5668 { "Active flag", "nas_eps.emm.active_flg",
5669 FT_BOOLEAN, BASE_NONE, TFS(&nas_eps_emm_active_flg_value), 0x0,
5670 NULL, HFILL }
5672 { &hf_nas_eps_eps_update_result_value,
5673 { "EPS update result value","nas_eps.emm.eps_update_result_value",
5674 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_eps_update_result_vals), 0x0,
5675 NULL, HFILL }
5677 { &hf_nas_eps_eps_update_type_value,
5678 { "EPS update type value", "nas_eps.emm.update_type_value",
5679 FT_UINT8,BASE_DEC, VALS(nas_eps_emm_eps_update_type_vals), 0x0,
5680 NULL, HFILL }
5682 { &hf_nas_eps_service_type,
5683 { "Service type", "nas_eps.emm.service_type",
5684 FT_UINT8,BASE_DEC|BASE_RANGE_STRING, RVALS(nas_eps_service_type_vals), 0x0,
5685 NULL, HFILL }
5687 { &hf_nas_eps_nas_msg_cont,
5688 { "NAS message container content", "nas_eps.emm.nas_msg_cont",
5689 FT_BYTES, BASE_NONE, NULL, 0x0,
5690 NULL, HFILL }
5692 { &hf_nas_eps_gen_msg_cont,
5693 { "Generic message container content", "nas_eps.emm.gen_msg_cont",
5694 FT_BYTES, BASE_NONE, NULL, 0x0,
5695 NULL, HFILL }
5697 { &hf_nas_eps_cmn_add_info,
5698 { "Additional information content", "nas_eps.cmn.add_info",
5699 FT_BYTES, BASE_NONE, NULL, 0x0,
5700 NULL, HFILL }
5702 /* ESM hf cvariables */
5703 { &hf_nas_eps_msg_esm_type,
5704 { "NAS EPS session management messages", "nas_eps.nas_msg_esm_type",
5705 FT_UINT8, BASE_HEX|BASE_EXT_STRING, &nas_msg_esm_strings_ext, 0x0,
5706 NULL, HFILL }
5708 { &hf_nas_eps_esm_elem_id,
5709 { "Element ID", "nas_eps.esm.elem_id",
5710 FT_UINT8, BASE_HEX, NULL, 0,
5711 NULL, HFILL }
5713 { &hf_nas_eps_esm_proc_trans_id,
5714 { "Procedure transaction identity", "nas_eps.esm.proc_trans_id",
5715 FT_UINT8, BASE_DEC, NULL, 0,
5716 NULL, HFILL }
5718 { &hf_nas_eps_esm_pdn_type,
5719 { "PDN type", "nas_eps.esm_pdn_type",
5720 FT_UINT8, BASE_DEC, VALS(nas_eps_esm_pdn_type_values), 0x0,
5721 NULL, HFILL }
5723 { &hf_nas_eps_esm_request_type,
5724 { "Request type", "nas_eps.esm_request_type",
5725 FT_UINT8, BASE_DEC, VALS(nas_eps_esm_request_type_values), 0x0,
5726 NULL, HFILL }
5730 /* Setup protocol subtree array */
5731 #define NUM_INDIVIDUAL_ELEMS 5
5732 gint *ett[NUM_INDIVIDUAL_ELEMS +
5733 NUM_NAS_EPS_COMMON_ELEM +
5734 NUM_NAS_MSG_EMM + NUM_NAS_EMM_ELEM+
5735 NUM_NAS_MSG_ESM + NUM_NAS_ESM_ELEM];
5737 ett[0] = &ett_nas_eps;
5738 ett[1] = &ett_nas_eps_esm_msg_cont;
5739 ett[2] = &ett_nas_eps_nas_msg_cont;
5740 ett[3] = &ett_nas_eps_gen_msg_cont;
5741 ett[4] = &ett_nas_eps_cmn_add_info;
5743 last_offset = NUM_INDIVIDUAL_ELEMS;
5745 for (i=0; i < NUM_NAS_EPS_COMMON_ELEM; i++, last_offset++)
5747 ett_nas_eps_common_elem[i] = -1;
5748 ett[last_offset] = &ett_nas_eps_common_elem[i];
5751 /* EMM */
5752 for (i=0; i < NUM_NAS_MSG_EMM; i++, last_offset++)
5754 ett_nas_msg_emm[i] = -1;
5755 ett[last_offset] = &ett_nas_msg_emm[i];
5758 for (i=0; i < NUM_NAS_EMM_ELEM; i++, last_offset++)
5760 ett_nas_eps_emm_elem[i] = -1;
5761 ett[last_offset] = &ett_nas_eps_emm_elem[i];
5763 /* EPS */
5764 for (i=0; i < NUM_NAS_MSG_ESM; i++, last_offset++)
5766 ett_nas_msg_esm[i] = -1;
5767 ett[last_offset] = &ett_nas_msg_esm[i];
5770 for (i=0; i < NUM_NAS_ESM_ELEM; i++, last_offset++)
5772 ett_nas_eps_esm_elem[i] = -1;
5773 ett[last_offset] = &ett_nas_eps_esm_elem[i];
5776 /* Register protocol */
5777 proto_nas_eps = proto_register_protocol(PNAME, PSNAME, PFNAME);
5778 /* Register fields and subtrees */
5779 proto_register_field_array(proto_nas_eps, hf, array_length(hf));
5780 proto_register_subtree_array(ett, array_length(ett));
5782 /* Register dissector */
5783 register_dissector(PFNAME, dissect_nas_eps, proto_nas_eps);
5785 /* Register dissector */
5786 register_dissector("nas-eps_plain", dissect_nas_eps_plain, proto_nas_eps);
5788 /* Register configuration options to always dissect as plain messages */
5789 nas_eps_module = prefs_register_protocol(proto_nas_eps, NULL);
5791 prefs_register_bool_preference(nas_eps_module,
5792 "dissect_plain",
5793 "Force dissect as plain NAS EPS",
5794 "Always dissect NAS EPS messages as plain",
5795 &g_nas_eps_dissect_plain);
5798 void
5799 proto_reg_handoff_nas_eps(void)
5801 gsm_a_dtap_handle = find_dissector("gsm_a_dtap");
5802 lpp_handle = find_dissector("lpp");