3 * Routines for GTP dissection
4 * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
5 * Nicolas Balkota <balkota@mac.com>
7 * Updates and corrections:
8 * Copyright 2006 - 2009, Anders Broman <anders.broman@ericsson.com>
12 * Control Plane Request-Response tracking code Largely based on similar routines in
13 * packet-ldap.c by Ronnie Sahlberg
14 * Added by Kari Tiirikainen <kari.tiirikainen@nsn.com>
17 * Wireshark - Network traffic analyzer
18 * By Gerald Combs <gerald@wireshark.org>
19 * Copyright 1998 Gerald Combs
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation; either version 2
24 * of the License, or (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 * Ref: 3GPP TS 29.060 version 6.8.0 Release 6
45 #include <epan/conversation.h>
46 #include <epan/packet.h>
47 #include <epan/prefs.h>
48 #include <epan/expert.h>
49 #include <epan/sminmpec.h>
50 #include <epan/asn1.h>
52 #include "packet-ipv6.h"
53 #include "packet-ppp.h"
54 #include "packet-radius.h"
55 #include "packet-bssap.h"
56 #include "packet-gsm_a_common.h"
57 #include "packet-gsm_map.h"
58 #include "packet-per.h"
59 #include "packet-ranap.h"
60 #include "packet-bssgp.h"
61 #include "packet-gtp.h"
63 static dissector_table_t ppp_subdissector_table;
65 #define GTPv0_PORT 3386
66 #define GTPv1C_PORT 2123 /* 3G Control PDU */
67 #define GTPv1U_PORT 2152 /* 3G T-PDU */
69 #define GTPv0_HDR_LENGTH 20
70 #define GTPv1_HDR_LENGTH 12
71 #define GTP_PRIME_HDR_LENGTH 6
73 /* to check compliance with ETSI */
74 #define GTP_MANDATORY 1
75 #define GTP_OPTIONAL 2
76 #define GTP_CONDITIONAL 4
78 static gboolean g_gtp_over_tcp = TRUE;
79 static guint g_gtpv0_port = GTPv0_PORT;
80 static guint g_gtpv1c_port = GTPv1C_PORT;
81 static guint g_gtpv1u_port = GTPv1U_PORT;
83 void proto_reg_handoff_gtp(void);
85 static int proto_gtp = -1;
88 static int hf_gtp_response_in = -1;
89 static int hf_gtp_response_to = -1;
90 static int hf_gtp_time = -1;
91 static int hf_gtp_apn = -1;
92 static int hf_gtp_cause = -1;
93 static int hf_gtp_chrg_char = -1;
94 static int hf_gtp_chrg_char_s = -1;
95 static int hf_gtp_chrg_char_n = -1;
96 static int hf_gtp_chrg_char_p = -1;
97 static int hf_gtp_chrg_char_f = -1;
98 static int hf_gtp_chrg_char_h = -1;
99 static int hf_gtp_chrg_char_r = -1;
100 static int hf_gtp_chrg_id = -1;
101 static int hf_gtp_chrg_ipv4 = -1;
102 static int hf_gtp_chrg_ipv6 = -1;
103 static int hf_gtp_ext_flow_label = -1;
104 static int hf_gtp_ext_id = -1;
105 static int hf_gtp_ext_val = -1;
106 static int hf_gtp_flags = -1;
107 static int hf_gtp_flags_ver = -1;
108 static int hf_gtp_prime_flags_ver = -1;
109 static int hf_gtp_flags_pt = -1;
110 static int hf_gtp_flags_spare1 = -1;
111 static int hf_gtp_flags_snn = -1;
112 static int hf_gtp_flags_spare2 = -1;
113 static int hf_gtp_flags_e = -1;
114 static int hf_gtp_flags_s = -1;
115 static int hf_gtp_flags_pn = -1;
116 static int hf_gtp_flow_ii = -1;
117 static int hf_gtp_flow_label = -1;
118 static int hf_gtp_flow_sig = -1;
119 static int hf_gtp_gsn_addr_len = -1;
120 static int hf_gtp_gsn_addr_type = -1;
121 static int hf_gtp_gsn_ipv4 = -1;
122 static int hf_gtp_gsn_ipv6 = -1;
123 static int hf_gtp_imsi = -1;
124 static int hf_gtp_length = -1;
125 static int hf_gtp_map_cause = -1;
126 static int hf_gtp_message_type = -1;
127 static int hf_gtp_ms_reason = -1;
128 static int hf_gtp_ms_valid = -1;
129 static int hf_gtp_msisdn = -1;
130 static int hf_gtp_next = -1;
131 static int hf_gtp_npdu_number = -1;
132 static int hf_gtp_node_ipv4 = -1;
133 static int hf_gtp_node_ipv6 = -1;
134 static int hf_gtp_nsapi = -1;
135 static int hf_gtp_ptmsi = -1;
136 static int hf_gtp_ptmsi_sig = -1;
137 static int hf_gtp_qos_version = -1;
138 static int hf_gtp_qos_spare1 = -1;
139 static int hf_gtp_qos_delay = -1;
140 static int hf_gtp_qos_mean = -1;
141 static int hf_gtp_qos_peak = -1;
142 static int hf_gtp_qos_spare2 = -1;
143 static int hf_gtp_qos_precedence = -1;
144 static int hf_gtp_qos_spare3 = -1;
145 static int hf_gtp_qos_reliability = -1;
146 static int hf_gtp_qos_al_ret_priority = -1;
147 static int hf_gtp_qos_traf_class = -1;
148 static int hf_gtp_qos_del_order = -1;
149 static int hf_gtp_qos_del_err_sdu = -1;
150 static int hf_gtp_qos_max_sdu_size = -1;
151 static int hf_gtp_qos_max_ul = -1;
152 static int hf_gtp_qos_max_dl = -1;
153 static int hf_gtp_qos_res_ber = -1;
154 static int hf_gtp_qos_sdu_err_ratio = -1;
155 static int hf_gtp_qos_trans_delay = -1;
156 static int hf_gtp_qos_traf_handl_prio = -1;
157 static int hf_gtp_qos_guar_ul = -1;
158 static int hf_gtp_qos_guar_dl = -1;
159 static int hf_gtp_qos_src_stat_desc = -1;
160 static int hf_gtp_qos_sig_ind = -1;
161 static int hf_gtp_pkt_flow_id = -1;
162 static int hf_gtp_rab_gtpu_dn = -1;
163 static int hf_gtp_rab_gtpu_up = -1;
164 static int hf_gtp_rab_pdu_dn = -1;
165 static int hf_gtp_rab_pdu_up = -1;
166 static int hf_gtp_rai_mcc = -1;
167 static int hf_gtp_rai_mnc = -1;
168 static int hf_gtp_rai_rac = -1;
169 static int hf_gtp_rai_lac = -1;
170 static int hf_gtp_ranap_cause = -1;
171 static int hf_gtp_recovery = -1;
172 static int hf_gtp_reorder = -1;
173 static int hf_gtp_rnc_ipv4 = -1;
174 static int hf_gtp_rnc_ipv6 = -1;
175 static int hf_gtp_rp = -1;
176 static int hf_gtp_rp_nsapi = -1;
177 static int hf_gtp_rp_sms = -1;
178 static int hf_gtp_rp_spare = -1;
179 static int hf_gtp_sel_mode = -1;
180 static int hf_gtp_seq_number = -1;
181 static int hf_gtp_sndcp_number = -1;
182 static int hf_gtp_tear_ind = -1;
183 static int hf_gtp_teid = -1;
184 static int hf_gtp_teid_cp = -1;
185 static int hf_gtp_ulink_teid_cp = -1;
186 static int hf_gtp_teid_data = -1;
187 static int hf_gtp_ulink_teid_data = -1;
188 static int hf_gtp_teid_ii = -1;
189 static int hf_gtp_tft_code = -1;
190 static int hf_gtp_tft_spare = -1;
191 static int hf_gtp_tft_number = -1;
192 static int hf_gtp_tft_eval = -1;
193 static int hf_gtp_tid = -1;
194 static int hf_gtp_tlli = -1;
195 static int hf_gtp_tr_comm = -1;
196 static int hf_gtp_trace_ref = -1;
197 static int hf_gtp_trace_type = -1;
198 static int hf_gtp_unknown = -1;
199 static int hf_gtp_user_addr_pdp_org = -1;
200 static int hf_gtp_user_addr_pdp_type = -1;
201 static int hf_gtp_user_ipv4 = -1;
202 static int hf_gtp_user_ipv6 = -1;
203 static int hf_gtp_security_mode = -1;
204 static int hf_gtp_no_of_vectors = -1;
205 static int hf_gtp_cipher_algorithm = -1;
206 static int hf_gtp_cksn_ksi = -1;
207 static int hf_gtp_cksn = -1;
208 static int hf_gtp_ksi = -1;
209 static int hf_gtp_ext_length = -1;
210 static int hf_gtp_ext_apn_res = -1;
211 static int hf_gtp_ext_rat_type = -1;
212 static int hf_gtp_ext_geo_loc_type = -1;
213 static int hf_gtp_ext_sac = -1;
214 static int hf_gtp_ext_imeisv = -1;
215 static int hf_gtp_targetRNC_ID = -1;
216 static int hf_gtp_bssgp_cause = -1;
217 static int hf_gtp_sapi = -1;
218 static int hf_gtp_xid_par_len = -1;
219 static int hf_gtp_cmn_flg_ppc = -1;
220 static int hf_gtp_cmn_flg_mbs_srv_type = -1;
221 static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy = -1;
222 static int hf_gtp_cmn_flg_mbs_cnt_inf = -1;
223 static int hf_gtp_cmn_flg_nrsn = -1;
224 static int hf_gtp_cmn_flg_no_qos_neg = -1;
225 static int hf_gtp_cmn_flg_upgrd_qos_sup = -1;
226 static int hf_gtp_tmgi = -1;
227 static int hf_gtp_mbms_ses_dur_days = -1;
228 static int hf_gtp_mbms_ses_dur_s = -1;
229 static int hf_gtp_no_of_mbms_sa_codes = -1;
230 static int hf_gtp_mbms_sa_code = -1;
231 static int hf_gtp_mbs_2g_3g_ind = -1;
232 static int hf_gtp_time_2_dta_tr = -1;
233 static int hf_gtp_ext_ei = -1;
234 static int hf_gtp_ext_gcsi = -1;
235 static int hf_gtp_ext_dti = -1;
237 /* Initialize the subtree pointers */
238 static gint ett_gtp = -1;
239 static gint ett_gtp_flags = -1;
240 static gint ett_gtp_ext = -1;
241 static gint ett_gtp_rai = -1;
242 static gint ett_gtp_qos = -1;
243 static gint ett_gtp_auth_tri = -1;
244 static gint ett_gtp_flow_ii = -1;
245 static gint ett_gtp_rab_cntxt = -1;
246 static gint ett_gtp_rp = -1;
247 static gint ett_gtp_pkt_flow_id = -1;
248 static gint ett_gtp_chrg_char = -1;
249 static gint ett_gtp_user = -1;
250 static gint ett_gtp_mm = -1;
251 static gint ett_gtp_trip = -1;
252 static gint ett_gtp_quint = -1;
253 static gint ett_gtp_pdp = -1;
254 static gint ett_gtp_apn = -1;
255 static gint ett_gtp_proto = -1;
256 static gint ett_gtp_gsn_addr = -1;
257 static gint ett_gtp_tft = -1;
258 static gint ett_gtp_tft_pf = -1;
259 static gint ett_gtp_tft_flags = -1;
260 static gint ett_gtp_rab_setup = -1;
261 static gint ett_gtp_hdr_list = -1;
262 static gint ett_gtp_chrg_addr = -1;
263 static gint ett_gtp_node_addr = -1;
264 static gint ett_gtp_rel_pack = -1;
265 static gint ett_gtp_can_pack = -1;
266 static gint ett_gtp_data_resp = -1;
267 static gint ett_gtp_priv_ext = -1;
268 static gint ett_gtp_net_cap = -1;
269 static gint ett_gtp_ext_tree_apn_res = -1;
270 static gint ett_gtp_ext_rat_type = -1;
271 static gint ett_gtp_ext_imeisv = -1;
272 static gint ett_gtp_ext_ran_tr_cont = -1;
273 static gint ett_gtp_ext_pdp_cont_prio = -1;
274 static gint ett_gtp_ext_ssgn_no = -1;
275 static gint ett_gtp_ext_rab_setup_inf = -1;
276 static gint ett_gtp_ext_common_flgs = -1;
277 static gint ett_gtp_ext_usr_loc_inf = -1;
278 static gint ett_gtp_ext_ms_time_zone = -1;
279 static gint ett_gtp_ext_camel_chg_inf_con = -1;
280 static gint ett_GTP_EXT_MBMS_UE_CTX = -1;
281 static gint ett_gtp_ext_tmgi = -1;
282 static gint ett_gtp_tmgi = -1;
283 static gint ett_gtp_ext_rim_ra = -1;
284 static gint ett_gtp_ext_mbms_prot_conf_opt = -1;
285 static gint ett_gtp_ext_mbms_sa = -1;
286 static gint ett_gtp_ext_bms_ses_dur = -1;
287 static gint ett_gtp_ext_src_rnc_pdp_ctx_inf = -1;
288 static gint ett_gtp_ext_add_trs_inf = -1;
289 static gint ett_gtp_ext_hop_count = -1;
290 static gint ett_gtp_ext_sel_plmn_id = -1;
291 static gint ett_gtp_ext_mbms_ses_id = -1;
292 static gint ett_gtp_ext_mbms_2g_3g_ind = -1;
293 static gint ett_gtp_ext_enh_nsapi = -1;
294 static gint ett_gtp_ext_ad_mbms_trs_inf = -1;
295 static gint ett_gtp_ext_mbms_ses_id_rep_no = -1;
296 static gint ett_gtp_ext_mbms_time_to_data_tr = -1;
297 static gint ett_gtp_ext_ps_ho_req_ctx = -1;
298 static gint ett_gtp_ext_bss_cont = -1;
299 static gint ett_gtp_ext_cell_id = -1;
300 static gint ett_gtp_ext_pdu_no = -1;
301 static gint ett_gtp_ext_bssgp_cause = -1;
302 static gint ett_gtp_ext_ra_prio_lcs = -1;
303 static gint ett_gtp_ext_ps_handover_xid = -1;
304 static gint ett_gtp_target_id = -1;
305 static gint ett_gtp_utran_cont = -1;
307 static gboolean g_gtp_tpdu = TRUE;
308 static gboolean g_gtp_etsi_order = FALSE;
310 static int gtp_tap = -1;
312 /* Definition of flags masks */
313 #define GTP_VER_MASK 0xE0
315 static const value_string ver_types[] = {
316 {0, "GTP release 97/98 version"},
317 {1, "GTP release 99 version"},
327 static const value_string pt_types[] = {
333 #define GTP_PT_MASK 0x10
334 #define GTP_SPARE1_MASK 0x0E
335 #define GTP_SPARE2_MASK 0x08
336 #define GTP_E_MASK 0x04
337 #define GTP_S_MASK 0x02
338 #define GTP_SNN_MASK 0x01
339 #define GTP_PN_MASK 0x01
341 static const value_string next_extension_header_fieldvals[] = {
342 { 0, "No more extension headers"},
343 { 1, "MBMS support indication"},
344 { 2, "MS Info Change Reporting support indication"},
345 {0xc0, "PDCP PDU number"},
346 {0xc1, "Suspend Request"},
347 {0xc2, "Suspend Response"},
351 /* Definition of 3G charging characteristics masks */
352 #define GTP_MASK_CHRG_CHAR_S 0xF000
353 #define GTP_MASK_CHRG_CHAR_N 0x0800
354 #define GTP_MASK_CHRG_CHAR_P 0x0400
355 #define GTP_MASK_CHRG_CHAR_F 0x0200
356 #define GTP_MASK_CHRG_CHAR_H 0x0100
357 #define GTP_MASK_CHRG_CHAR_R 0x00FF
359 /* Traffic Flow Templates mask */
360 #define GTPv1_TFT_CODE_MASK 0xE0
361 #define GTPv1_TFT_SPARE_MASK 0x10
362 #define GTPv1_TFT_NUMBER_MASK 0x0F
364 /* Definition of GSN Address masks */
365 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
366 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
368 /* Definition of QoS masks */
369 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
370 #define GTP_EXT_QOS_DELAY_MASK 0x38
371 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
372 #define GTP_EXT_QOS_PEAK_MASK 0xF0
373 #define GTP_EXT_QOS_SPARE2_MASK 0x08
374 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
375 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
376 #define GTP_EXT_QOS_MEAN_MASK 0x1F
377 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
378 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
379 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
380 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
381 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
382 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
383 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
384 #define GTP_EXT_QOS_SRC_STAT_DESC_MASK 0x0F
385 #define GTP_EXT_QOS_SIG_IND_MASK 0x10
387 /* Definition of Radio Priority's masks */
388 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
389 #define GTPv1_EXT_RP_SPARE_MASK 0x08
390 #define GTPv1_EXT_RP_MASK 0x07
392 static const value_string message_type[] = {
393 {GTP_MSG_UNKNOWN, "For future use"},
394 {GTP_MSG_ECHO_REQ, "Echo request"},
395 {GTP_MSG_ECHO_RESP, "Echo response"},
396 {GTP_MSG_VER_NOT_SUPP, "Version not supported"},
397 {GTP_MSG_NODE_ALIVE_REQ, "Node alive request"},
398 {GTP_MSG_NODE_ALIVE_RESP, "Node alive response"},
399 {GTP_MSG_REDIR_REQ, "Redirection request"},
400 {GTP_MSG_REDIR_RESP, "Redirection response"},
402 * 8-15 For future use. Shall not be sent. If received,
403 * shall be treated as an Unknown message.
406 { 8, "Unknown message(For future use)"},
407 { 9, "Unknown message(For future use)"},
408 { 10, "Unknown message(For future use)"},
409 { 11, "Unknown message(For future use)"},
410 { 12, "Unknown message(For future use)"},
411 { 13, "Unknown message(For future use)"},
412 { 14, "Unknown message(For future use)"},
413 { 15, "Unknown message(For future use)"},
415 {GTP_MSG_CREATE_PDP_REQ, "Create PDP context request"},
416 {GTP_MSG_CREATE_PDP_RESP, "Create PDP context response"},
417 {GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request"},
418 {GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response"},
419 {GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request"},
420 {GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response"},
421 {GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request"},
422 {GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response"},
423 {GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request"},
424 {GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response"},
425 {GTP_MSG_ERR_IND, "Error indication"},
426 {GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request"},
427 {GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response"},
428 {GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request"},
429 {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
430 {GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification"},
431 {GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request"},
432 {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
433 {GTP_MSG_FAIL_REP_REQ, "Failure report request"},
434 {GTP_MSG_FAIL_REP_RESP, "Failure report response"},
435 {GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request"},
436 {GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response"},
437 /* 38-47 For future use. Shall not be sent. If received,
438 * shall be treated as an Unknown message.
441 { 38, "Unknown message(For future use)"},
442 { 39, "Unknown message(For future use)"},
443 { 40, "Unknown message(For future use)"},
444 { 41, "Unknown message(For future use)"},
445 { 42, "Unknown message(For future use)"},
446 { 43, "Unknown message(For future use)"},
447 { 44, "Unknown message(For future use)"},
448 { 45, "Unknown message(For future use)"},
449 { 46, "Unknown message(For future use)"},
450 { 47, "Unknown message(For future use)"},
452 {GTP_MSG_IDENT_REQ, "Identification request"},
453 {GTP_MSG_IDENT_RESP, "Identification response"},
454 {GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request"},
455 {GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response"},
456 {GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement"},
457 {GTP_MSG_FORW_RELOC_REQ, "Forward relocation request"},
458 {GTP_MSG_FORW_RELOC_RESP, "Forward relocation response"},
459 {GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete"},
460 {GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request"},
461 {GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response"},
462 {GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context"},
463 {GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge"},
464 {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
465 /* 61-69 For future use. Shall not be sent. If received,
466 * shall be treated as an Unknown message.
469 { 61, "Unknown message(For future use)"},
470 { 62, "Unknown message(For future use)"},
471 { 63, "Unknown message(For future use)"},
472 { 64, "Unknown message(For future use)"},
473 { 65, "Unknown message(For future use)"},
474 { 66, "Unknown message(For future use)"},
475 { 67, "Unknown message(For future use)"},
476 { 68, "Unknown message(For future use)"},
477 { 69, "Unknown message(For future use)"},
479 {GTP_MSG_RAN_INFO_RELAY, "RAN Information Relay"},
480 /* 71-95 For future use. Shall not be sent. If received,
481 * shall be treated as an Unknown message.
484 { 71, "Unknown message(For future use)"},
485 { 72, "Unknown message(For future use)"},
486 { 73, "Unknown message(For future use)"},
487 { 74, "Unknown message(For future use)"},
488 { 75, "Unknown message(For future use)"},
489 { 76, "Unknown message(For future use)"},
490 { 77, "Unknown message(For future use)"},
491 { 78, "Unknown message(For future use)"},
492 { 79, "Unknown message(For future use)"},
493 { 80, "Unknown message(For future use)"},
494 { 81, "Unknown message(For future use)"},
495 { 82, "Unknown message(For future use)"},
496 { 83, "Unknown message(For future use)"},
497 { 84, "Unknown message(For future use)"},
498 { 85, "Unknown message(For future use)"},
499 { 86, "Unknown message(For future use)"},
500 { 87, "Unknown message(For future use)"},
501 { 88, "Unknown message(For future use)"},
502 { 89, "Unknown message(For future use)"},
503 { 90, "Unknown message(For future use)"},
504 { 91, "Unknown message(For future use)"},
505 { 92, "Unknown message(For future use)"},
506 { 93, "Unknown message(For future use)"},
507 { 94, "Unknown message(For future use)"},
508 { 95, "Unknown message(For future use)"},
510 {GTP_MBMS_NOTIFY_REQ, "MBMS Notification Request"},
511 {GTP_MBMS_NOTIFY_RES, "MBMS Notification Response"},
512 {GTP_MBMS_NOTIFY_REJ_REQ, "MBMS Notification Reject Request"},
513 {GTP_MBMS_NOTIFY_REJ_RES, "MBMS Notification Reject Response"},
514 {GTP_CREATE_MBMS_CNTXT_REQ, "Create MBMS Context Request"},
515 {GTP_CREATE_MBMS_CNTXT_RES, "Create MBMS Context Response"},
516 {GTP_UPD_MBMS_CNTXT_REQ, "Update MBMS Context Request"},
517 {GTP_UPD_MBMS_CNTXT_RES, "Update MBMS Context Response"},
518 {GTP_DEL_MBMS_CNTXT_REQ, "Delete MBMS Context Request"},
519 {GTP_DEL_MBMS_CNTXT_RES, "Delete MBMS Context Response"},
520 /* 106 - 111 For future use. Shall not be sent. If received,
521 * shall be treated as an Unknown message.
523 {GTP_MBMS_REG_REQ, "MBMS Registration Request"},
524 {GTP_MBMS_REG_RES, "MBMS Registration Response"},
525 {GTP_MBMS_DE_REG_REQ, "MBMS De-Registration Request"},
526 {GTP_MBMS_DE_REG_RES, "MBMS De-Registration Response"},
527 {GTP_MBMS_SES_START_REQ, "MBMS Session Start Request"},
528 {GTP_MBMS_SES_START_RES, "MBMS Session Start Response"},
529 {GTP_MBMS_SES_STOP_REQ, "MBMS Session Stop Request"},
530 {GTP_MBMS_SES_STOP_RES, "MBMS Session Stop Response"},
531 {GTP_MBMS_SES_UPD_REQ, "MBMS Session Update Request"},
532 {GTP_MBMS_SES_UPD_RES, "MBMS Session Update Response"},
533 /* 122-127 For future use. Shall not be sent.
534 * If received, shall be treated as an Unknown message.
536 {GTP_MS_INFO_CNG_NOT_REQ, "MS Info Change Notification Request"},
537 {GTP_MS_INFO_CNG_NOT_RES, "MS Info Change Notification Response"},
538 /* 130-239 For future use. Shall not be sent. If received,
539 * shall be treated as an Unknown message.
541 {GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request"},
542 {GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response"},
543 /* 242-253 For future use. Shall not be sent. If received,
544 * shall be treated as an Unknown message.
546 {GTP_MSG_END_MARKER, "End Marker"},
547 {GTP_MSG_TPDU, "T-PDU"},
550 static value_string_ext message_type_ext = VALUE_STRING_EXT_INIT(message_type);
552 /* definitions of fields in extension header */
553 #define GTP_EXT_CAUSE 0x01
554 #define GTP_EXT_IMSI 0x02
555 #define GTP_EXT_RAI 0x03
556 #define GTP_EXT_TLLI 0x04
557 #define GTP_EXT_PTMSI 0x05
558 #define GTP_EXT_QOS_GPRS 0x06
559 #define GTP_EXT_REORDER 0x08
560 #define GTP_EXT_AUTH_TRI 0x09
561 #define GTP_EXT_MAP_CAUSE 0x0B
562 #define GTP_EXT_PTMSI_SIG 0x0C
563 #define GTP_EXT_MS_VALID 0x0D
564 #define GTP_EXT_RECOVER 0x0E
565 #define GTP_EXT_SEL_MODE 0x0F
567 #define GTP_EXT_16 0x10
568 #define GTP_EXT_FLOW_LABEL 0x10
569 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
571 #define GTP_EXT_17 0x11
572 #define GTP_EXT_FLOW_SIG 0x11
573 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
575 #define GTP_EXT_18 0x12
576 #define GTP_EXT_FLOW_II 0x12
577 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G */
579 #define GTP_EXT_19 0x13
580 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
581 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G */
583 #define GTP_EXT_NSAPI 0x14 /* 3G */
584 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
585 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
586 #define GTP_EXT_RP_SMS 0x17 /* 3G */
587 #define GTP_EXT_RP 0x18 /* 3G */
588 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
589 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
590 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
591 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
592 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
593 #define GTP_EXT_TR_COMM 0x7E /* charging */
594 #define GTP_EXT_CHRG_ID 0x7F
595 #define GTP_EXT_USER_ADDR 0x80
596 #define GTP_EXT_MM_CNTXT 0x81
597 #define GTP_EXT_PDP_CNTXT 0x82
598 #define GTP_EXT_APN 0x83
599 #define GTP_EXT_PROTO_CONF 0x84
600 #define GTP_EXT_GSN_ADDR 0x85
601 #define GTP_EXT_MSISDN 0x86
602 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
603 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
604 #define GTP_EXT_TFT 0x89 /* 3G */
605 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
606 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
607 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
608 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
609 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G 142 7.7.41 */
610 #define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */
611 #define GTP_EXT_RAN_TR_CONT 0x90 /* 3G 144 TLV RAN Transparent Container 7.7.43 */
612 #define GTP_EXT_PDP_CONT_PRIO 0x91 /* 3G 145 TLV PDP Context Prioritization 7.7.45 */
613 #define GTP_EXT_ADD_RAB_SETUP_INF 0x92 /* 3G 146 TLV Additional RAB Setup Information 7.7.45A */
614 #define GTP_EXT_SSGN_NO 0x93 /* 3G 147 TLV SGSN Number 7.7.47 */
615 #define GTP_EXT_COMMON_FLGS 0x94 /* 3G 148 TLV Common Flags 7.7.48 */
616 #define GTP_EXT_APN_RES 0x95 /* 3G 149 */
617 #define GTP_EXT_RA_PRIO_LCS 0x96 /* 3G 150 TLV Radio Priority LCS 7.7.25B */
618 #define GTP_EXT_RAT_TYPE 0x97 /* 3G 151 TLV RAT Type 7.7.50 */
619 #define GTP_EXT_USR_LOC_INF 0x98 /* 3G 152 TLV User Location Information 7.7.51 */
620 #define GTP_EXT_MS_TIME_ZONE 0x99 /* 3G 153 TLV MS Time Zone 7.7.52 */
622 #define GTP_EXT_IMEISV 0x9A /* 3G */
623 #define GTP_EXT_CAMEL_CHG_INF_CON 0x9B /* 3G 155 TLV CAMEL Charging Information Container 7.7.54 */
624 #define GTP_EXT_MBMS_UE_CTX 0x9C /* 3G 156 TLV MBMS UE Context 7.7.55 */
625 #define GTP_EXT_TMGI 0x9D /* 3G 157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
626 #define GTP_EXT_RIM_RA 0x9E /* 3G 158 TLV RIM Routing Address 7.7.57 */
627 #define GTP_EXT_MBMS_PROT_CONF_OPT 0x9F /* 3G 159 TLV MBMS Protocol Configuration Options 7.7.58 */
628 #define GTP_EXT_MBMS_SA 0xA0 /* 3G 160 TLV MBMS Service Area 7.7.60 */
629 #define GTP_EXT_SRC_RNC_PDP_CTX_INF 0xA1 /* 3G 161 TLV Source RNC PDCP context info 7.7.61 */
630 #define GTP_EXT_ADD_TRS_INF 0xA2 /* 3G 162 TLV Additional Trace Info 7.7.62 */
631 #define GTP_EXT_HOP_COUNT 0xA3 /* 3G 163 TLV Hop Counter 7.7.63 */
632 #define GTP_EXT_SEL_PLMN_ID 0xA4 /* 3G 164 TLV Selected PLMN ID 7.7.64 */
633 #define GTP_EXT_MBMS_SES_ID 0xA5 /* 3G 165 TLV MBMS Session Identifier 7.7.65 */
634 #define GTP_EXT_MBMS_2G_3G_IND 0xA6 /* 3G 166 TLV MBMS 2G/3G Indicator 7.7.66 */
635 #define GTP_EXT_ENH_NSAPI 0xA7 /* 3G 167 TLV Enhanced NSAPI 7.7.67 */
636 #define GTP_EXT_MBMS_SES_DUR 0xA8 /* 3G 168 TLV MBMS Session Duration 7.7.59 */
637 #define GTP_EXT_ADD_MBMS_TRS_INF 0xA9 /* 3G 169 TLV Additional MBMS Trace Info 7.7.68 */
638 #define GTP_EXT_MBMS_SES_ID_REP_NO 0xAA /* 3G 170 TLV MBMS Session Identity Repetition Number 7.7.69 */
639 #define GTP_EXT_MBMS_TIME_TO_DATA_TR 0xAB /* 3G 171 TLV MBMS Time To Data Transfer 7.7.70 */
640 #define GTP_EXT_PS_HO_REQ_CTX 0xAC /* 3G 172 TLV PS Handover Request Context 7.7.71 */
641 #define GTP_EXT_BSS_CONT 0xAD /* 3G 173 TLV BSS Container 7.7.72 */
642 #define GTP_EXT_CELL_ID 0xAE /* 3G 174 TLV Cell Identification 7.7.73 */
643 #define GTP_EXT_PDU_NO 0xAF /* 3G 175 TLV PDU Numbers 7.7.74 */
644 #define GTP_EXT_BSSGP_CAUSE 0xB0 /* 3G 176 TLV BSSGP Cause 7.7.75 */
645 #define GTP_EXT_REQ_MBMS_BEARER_CAP 0xB1 /* 3G 177 TLV Required MBMS bearer capabilities 7.7.76 */
646 #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2 /* 3G 178 TLV RIM Routing Address Discriminator 7.7.77 */
647 #define GTP_EXT_LIST_OF_SETUP_PFCS 0xB3 /* 3G 179 TLV List of set-up PFCs 7.7.78 */
648 #define GTP_EXT_PS_HANDOVER_XIP_PAR 0xB4 /* 3G 180 TLV PS Handover XID Parameters 7.7.79 */
649 #define GTP_EXT_MS_INF_CHG_REP_ACT 0xB5 /* 3G 181 TLV MS Info Change Reporting Action 7.7.80 */
650 #define GTP_EXT_DIRECT_TUNNEL_FLGS 0xB6 /* 3G 182 TLV Direct Tunnel Flags 7.7.81 */
651 #define GTP_EXT_CORRELATION_ID 0xB7 /* 3G 183 TLV Correlation-ID 7.7.82 */
652 #define GTP_EXT_BEARER_CONTROL_MODE 0xB8 /* 3G 184 TLV Bearer Control Mode 7.7.83 */
653 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
655 #define GTP_EXT_C1 0xC1
656 #define GTP_EXT_C2 0xC2
657 #define GTP_EXT_REL_PACK 0xF9 /* charging */
658 #define GTP_EXT_CAN_PACK 0xFA /* charging */
659 #define GTP_EXT_CHRG_ADDR 0xFB /* 3G 251 TLV Charging Gateway Address 7.7.44 */
660 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
661 #define GTP_EXT_DATA_REQ 0xFC /* charging */
662 #define GTP_EXT_DATA_RESP 0xFD /* charging */
663 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
664 #define GTP_EXT_PRIV_EXT 0xFF
666 static const value_string gtp_val[] = {
667 {GTP_EXT_CAUSE, "Cause of operation"},
668 {GTP_EXT_IMSI, "IMSI"},
669 {GTP_EXT_RAI, "Routing Area Identity"},
670 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
671 {GTP_EXT_PTMSI, "Packet TMSI"},
672 {GTP_EXT_QOS_GPRS, "Quality of Service"},
673 {GTP_EXT_REORDER, "Reorder required"},
674 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
675 {GTP_EXT_MAP_CAUSE, "MAP cause"},
676 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
677 {GTP_EXT_MS_VALID, "MS validated"},
678 {GTP_EXT_RECOVER, "Recovery"},
679 {GTP_EXT_SEL_MODE, "Selection mode"},
681 {GTP_EXT_16, "Flow label data I"},
682 {GTP_EXT_FLOW_LABEL, "Flow label data I"},
683 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
685 {GTP_EXT_17, "Flow label signalling"},
686 {GTP_EXT_FLOW_SIG, "Flow label signalling"},
687 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
689 {GTP_EXT_18, "Flow label data II"},
690 {GTP_EXT_FLOW_II, "Flow label data II"},
691 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
693 {GTP_EXT_19, "MS not reachable reason"},
694 {GTP_EXT_MS_REASON, "MS not reachable reason"},
695 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
697 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
698 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
699 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
700 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
701 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
702 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
703 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
704 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
705 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
706 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
707 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
708 {GTP_EXT_CHRG_ID, "Charging ID"},
709 {GTP_EXT_USER_ADDR, "End user address"},
710 {GTP_EXT_MM_CNTXT, "MM context"},
711 {GTP_EXT_PDP_CNTXT, "PDP context"},
712 {GTP_EXT_APN, "Access Point Name"},
713 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
714 {GTP_EXT_GSN_ADDR, "GSN address"},
715 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
716 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
717 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
718 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
719 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
720 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
721 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
722 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
723 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
724 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
726 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
727 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
728 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
729 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
730 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
731 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
732 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
733 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
734 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
735 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
737 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
738 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
739 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
740 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
741 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
742 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
743 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
744 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
745 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
746 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
747 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
748 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
749 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
750 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
751 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
752 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
753 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
754 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
755 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
756 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
757 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
758 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
759 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
760 {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
761 {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
762 {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
763 {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"}, /* 7.7.79 */
764 {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
765 {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
766 {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
767 {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
768 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
769 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
770 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
771 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
772 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
773 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
774 {GTP_EXT_PRIV_EXT, "Private Extension"},
777 static value_string_ext gtp_val_ext = VALUE_STRING_EXT_INIT(gtp_val);
779 /* It seems like some IE's are renamed in gtpv1 at least reading
780 * 3GPP TS 29.060 version 6.11.0 Release 6
782 static const value_string gtpv1_val[] = {
783 {GTP_EXT_CAUSE, "Cause of operation"},
784 {GTP_EXT_IMSI, "IMSI"},
785 {GTP_EXT_RAI, "Routing Area Identity"},
786 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
787 {GTP_EXT_PTMSI, "Packet TMSI"},
788 {GTP_EXT_QOS_GPRS, "Quality of Service"},
789 {GTP_EXT_REORDER, "Reorder required"},
790 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
791 {GTP_EXT_MAP_CAUSE, "MAP cause"},
792 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
793 {GTP_EXT_MS_VALID, "MS validated"},
794 {GTP_EXT_RECOVER, "Recovery"},
795 {GTP_EXT_SEL_MODE, "Selection mode"},
797 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
799 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
801 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
803 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
805 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
806 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
807 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
808 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
809 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
810 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
811 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
812 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
813 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
814 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
815 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
816 {GTP_EXT_CHRG_ID, "Charging ID"},
817 {GTP_EXT_USER_ADDR, "End user address"},
818 {GTP_EXT_MM_CNTXT, "MM context"},
819 {GTP_EXT_PDP_CNTXT, "PDP context"},
820 {GTP_EXT_APN, "Access Point Name"},
821 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
822 {GTP_EXT_GSN_ADDR, "GSN address"},
823 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
824 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
825 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
826 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
827 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
828 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
829 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
830 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
831 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
832 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
834 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
835 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
836 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
837 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
838 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
839 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
840 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
841 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
842 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
843 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
845 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
846 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
847 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
848 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
849 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
850 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
851 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
852 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
853 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
854 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
855 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
856 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
857 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
858 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
859 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
860 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
861 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
862 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
863 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
864 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
865 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
866 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
867 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
868 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
869 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
870 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
871 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
872 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
873 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
874 {GTP_EXT_PRIV_EXT, "Private Extension"},
877 static value_string_ext gtpv1_val_ext = VALUE_STRING_EXT_INIT(gtpv1_val);
879 /* GPRS: 9.60 v7.6.0, page 37
880 * UMTS: 29.060 v4.0, page 45
881 * ETSI TS 129 060 V9.4.0 (2010-10)
883 static const value_string cause_type[] = {
884 { 0, "Request IMSI"},
885 { 1, "Request IMEI"},
886 { 2, "Request IMSI and IMEI"},
887 { 3, "No identity needed"},
889 { 5, "MS is not GPRS responding"},
890 /* For future use 6-48 */
891 /* Cause values reserved for GPRS charging
892 * protocol use (see GTP' in 3GPP TS 32.295 [33])
895 { 59, "System failure"}, /* charging */
896 { 60, "The transmit buffers are becoming full"}, /* charging */
897 { 61, "The receive buffers are becoming full"}, /* charging */
898 { 62, "Another node is about to go down"}, /* charging */
899 { 63, "This node is about to go down"}, /* charging */
900 /* For future use 64-127 */
901 {128, "Request accepted"},
902 {129, "New PDP type due to network preference"},
903 {130, "New PDP type due to single address bearer only"},
904 /* For future use 131-176 */
905 /* Cause values reserved for GPRS charging
906 * protocol use (see GTP' in 3GPP TS 32.295 [33])
909 {192, "Non-existent"},
910 {193, "Invalid message format"},
911 {194, "IMSI not known"},
912 {195, "MS is GPRS detached"},
913 {196, "MS is not GPRS responding"},
915 {198, "Version not supported"},
916 {199, "No resource available"},
917 {200, "Service not supported"},
918 {201, "Mandatory IE incorrect"},
919 {202, "Mandatory IE missing"},
920 {203, "Optional IE incorrect"},
921 {204, "System failure"},
922 {205, "Roaming restriction"},
923 {206, "P-TMSI signature mismatch"},
924 {207, "GPRS connection suspended"},
925 {208, "Authentication failure"},
926 {209, "User authentication failed"},
927 {210, "Context not found"},
928 {211, "All PDP dynamic addresses are occupied"},
929 {212, "No memory is available"},
930 {213, "Relocation failure"},
931 {214, "Unknown mandatory extension header"},
932 {215, "Semantic error in the TFT operation"},
933 {216, "Syntactic error in the TFT operation"},
934 {217, "Semantic errors in packet filter(s)"},
935 {218, "Syntactic errors in packet filter(s)"},
936 {219, "Missing or unknown APN"},
937 {220, "Unknown PDP address or PDP type"},
938 {221, "PDP context without TFT already activated"},
939 {222, "APN access denied - no subscription"},
940 {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
941 {224, "MS MBMS Capabilities Insufficient"},
942 {225, "Invalid Correlation-ID"},
943 {226, "MBMS Bearer Context Superseded"},
944 {227, "Bearer Control Mode violation"},
945 {228, "Collision with network initiated request"},
946 /* For future use 229-240 */
947 /* Cause values reserved for GPRS charging
948 * protocol use (see GTP' in 3GPP TS 32.295 [33])
951 {252, "Request related to possibly duplicated packets already fulfilled"}, /* charging */
952 {253, "Request already fulfilled"}, /* charging */
953 {254, "Sequence numbers of released/cancelled packets IE incorrect"}, /* charging */
954 {255, "Request not fulfilled"}, /* charging */
957 static value_string_ext cause_type_ext = VALUE_STRING_EXT_INIT(cause_type);
960 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
961 * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
964 static const value_string gsn_addr_type[] = {
970 static const value_string pdp_type[] = {
979 static const value_string pdp_org_type[] = {
985 static const value_string qos_delay_type[] = {
986 {0x00, "Subscribed delay class (in MS to network direction)"},
987 {0x01, "Delay class 1"},
988 {0x02, "Delay class 2"},
989 {0x03, "Delay class 3"},
990 {0x04, "Delay class 4 (best effort)"},
995 static const value_string qos_reliability_type[] = {
996 {0x00, "Subscribed reliability class (in MS to network direction)"},
997 {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
998 {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
999 {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
1000 {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
1001 {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
1006 static const value_string qos_peak_type[] = {
1007 {0x00, "Subscribed peak throughput (in MS to network direction)"},
1008 {0x01, "Up to 1 000 oct/s"},
1009 {0x02, "Up to 2 000 oct/s"},
1010 {0x03, "Up to 4 000 oct/s"},
1011 {0x04, "Up to 8 000 oct/s"},
1012 {0x05, "Up to 16 000 oct/s"},
1013 {0x06, "Up to 32 000 oct/s"},
1014 {0x07, "Up to 64 000 oct/s"},
1015 {0x08, "Up to 128 000 oct/s"},
1016 {0x09, "Up to 256 000 oct/s"},
1017 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
1027 static const value_string qos_precedence_type[] = {
1028 {0x00, "Subscribed precedence (in MS to network direction)"},
1029 {0x01, "High priority"},
1030 {0x02, "Normal priority"},
1031 {0x03, "Low priority"},
1036 static const value_string qos_mean_type[] = {
1037 {0x00, "Subscribed mean throughput (in MS to network direction)"},
1038 {0x01, "100 oct/h"}, /* Class 2 */
1039 {0x02, "200 oct/h"}, /* Class 3 */
1040 {0x03, "500 oct/h"}, /* Class 4 */
1041 {0x04, "1 000 oct/h"}, /* Class 5 */
1042 {0x05, "2 000 oct/h"}, /* Class 6 */
1043 {0x06, "5 000 oct/h"}, /* Class 7 */
1044 {0x07, "10 000 oct/h"}, /* Class 8 */
1045 {0x08, "20 000 oct/h"}, /* Class 9 */
1046 {0x09, "50 000 oct/h"}, /* Class 10 */
1047 {0x0A, "100 000 oct/h"}, /* Class 11 */
1048 {0x0B, "200 000 oct/h"}, /* Class 12 */
1049 {0x0C, "500 000 oct/h"}, /* Class 13 */
1050 {0x0D, "1 000 000 oct/h"}, /* Class 14 */
1051 {0x0E, "2 000 000 oct/h"}, /* Class 15 */
1052 {0x0F, "5 000 000 oct/h"}, /* Class 16 */
1053 {0x10, "10 000 000 oct/h"}, /* Class 17 */
1054 {0x11, "20 000 000 oct/h"}, /* Class 18 */
1055 {0x12, "50 000 000 oct/h"}, /* Class 19 */
1056 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
1069 {0x1F, "Best effort"}, /* Class 1 */
1072 static value_string_ext qos_mean_type_ext = VALUE_STRING_EXT_INIT(qos_mean_type);
1074 static const value_string qos_del_err_sdu[] = {
1075 {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
1076 {0x01, "No detect ('-')"},
1077 {0x02, "Erroneous SDUs are delivered ('yes')"},
1078 {0x03, "Erroneous SDUs are not delivered ('no')"},
1079 {0x07, "Reserved"}, /* All other values are reserved */
1083 static const value_string qos_del_order[] = {
1084 {0x00, "Subscribed delivery order (in MS to network direction)"},
1085 {0x01, "With delivery order ('yes')"},
1086 {0x02, "Without delivery order ('no')"},
1087 {0x03, "Reserved"}, /* All other values are reserved */
1091 static const value_string qos_traf_class[] = {
1092 {0x00, "Subscribed traffic class (in MS to network direction)"},
1093 {0x01, "Conversational class"},
1094 {0x02, "Streaming class"},
1095 {0x03, "Interactive class"},
1096 {0x04, "Background class"},
1097 {0x07, "Reserved"}, /* All other values are reserved */
1101 static const value_string qos_max_sdu_size[] = {
1102 {0x00, "Subscribed maximum SDU size (in MS to network direction"},
1103 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
1104 {0x97, "1502 octets"},
1105 {0x98, "1510 octets"},
1106 {0x99, "1520 octets"},
1107 {0, NULL} /* All other values are reserved */
1110 static const value_string qos_max_ul[] = {
1111 {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
1112 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1113 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1114 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1119 static const value_string qos_max_dl[] = {
1120 {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
1121 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1122 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1123 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1128 static const value_string qos_res_ber[] = {
1129 {0x00, "Subscribed residual BER (in MS to network direction)"},
1130 {0x01, "1/20 = 5x10^-2"},
1131 {0x02, "1/100 = 1x10^-2"},
1132 {0x03, "1/200 = 5x10^-3"},
1133 {0x04, "1/250 = 4x10^-3"},
1134 {0x05, "1/1 000 = 1x10^-3"},
1135 {0x06, "1/10 000 = 1x10^-4"},
1136 {0x07, "1/100 000 = 1x10^-5"},
1137 {0x08, "1/1 000 000 = 1x10^-6"},
1138 {0x09, "3/50 000 000 = 6x10^-8"},
1139 {0x0F, "Reserved"}, /* All other values are reserved */
1143 static const value_string qos_sdu_err_ratio[] = {
1144 {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
1145 {0x01, "1/100 = 1x10^-2"},
1146 {0x02, "7/1000 = 7x10^-3"},
1147 {0x03, "1/1 000 = 1x10^-3"},
1148 {0x04, "1/10 000 = 1x10^-4"},
1149 {0x05, "1/100 000 = 1x10^-5"},
1150 {0x06, "1/1 000 000 = 1x10^-6"},
1151 {0x07, "1/10 = 1x10^-1"},
1152 {0x0F, "Reserved"}, /* All other values are reserved */
1156 static const value_string qos_traf_handl_prio[] = {
1157 {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
1158 {0x01, "Priority level 1"},
1159 {0x02, "Priority level 2"},
1160 {0x03, "Priority level 3"},
1164 static const value_string qos_trans_delay[] = {
1165 {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
1166 {0x01, "10 ms"}, /* Using a granularity of 10 ms */
1181 {0x10, "200 ms"}, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
1197 {0x20, "1000 ms"}, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
1231 static value_string_ext qos_trans_delay_ext = VALUE_STRING_EXT_INIT(qos_trans_delay);
1233 static const value_string qos_guar_ul[] = {
1234 {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
1235 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1236 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1237 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1242 static const value_string src_stat_desc_vals[] = {
1249 static const true_false_string gtp_sig_ind = {
1250 "Optimised for signalling traffic",
1251 "Not optimised for signalling traffic"
1254 static const value_string qos_guar_dl[] = {
1255 {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
1256 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1257 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1258 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1263 static const value_string sel_mode_type[] = {
1264 {0, "MS or network provided APN, subscribed verified"},
1265 {1, "MS provided APN, subscription not verified"},
1266 {2, "Network provided APN, subscription not verified"},
1267 {3, "For future use (Network provided APN, subscription not verified"}, /* Shall not be sent. If received, shall be sent as value 2 */
1271 static const value_string tr_comm_type[] = {
1272 {1, "Send data record packet"},
1273 {2, "Send possibly duplicated data record packet"},
1274 {3, "Cancel data record packet"},
1275 {4, "Release data record packet"},
1279 /* TODO: CHeck if all ms_reasons are included */
1280 static const value_string ms_not_reachable_type[] = {
1281 {0, "No paging response via the MSC"},
1282 {1, "IMSI detached"},
1283 {2, "Roaming restriction"},
1284 {3, "Deregistered in the HLR for non GPRS"},
1285 {4, "MS purge for non GPRS"},
1286 {5, "No paging response via the SGSN"},
1287 {6, "GPRS detached"},
1288 {7, "Deregistered in the HLR for non GPRS"},
1289 {8, "MS purged for GPRS"},
1290 {9, "Unidentified subscriber via the MSC"},
1291 {10, "Unidentified subscriber via the SGSN"},
1295 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1297 static const value_string ranap_cause_type[] = {
1298 /* Radio Network Layer Cause (1-->64) */
1299 {1, "RAB preempted"},
1300 {2, "Trelocoverall Expiry"},
1301 {3, "Trelocprep Expiry"},
1302 {4, "Treloccomplete Expiry"},
1303 {5, "Tqueuing Expiry"},
1304 {6, "Relocation Triggered"},
1305 {7, "TRELOCalloc Expiry"},
1306 {8, "Unable to Establish During Relocation"},
1307 {9, "Unknown Target RNC"},
1308 {10, "Relocation Cancelled"},
1309 {11, "Successful Relocation"},
1310 {12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
1311 {13, "Change of Ciphering and/or Integrity Protection is not supported"},
1312 {14, "Failure in the Radio Interface Procedure"},
1313 {15, "Release due to UTRAN Generated Reason"},
1314 {16, "User Inactivity"},
1315 {17, "Time Critical Relocation"},
1316 {18, "Requested Traffic Class not Available"},
1317 {19, "Invalid RAB Parameters Value"},
1318 {20, "Requested Maximum Bit Rate not Available"},
1319 {21, "Requested Guaranteed Bit Rate not Available"},
1320 {22, "Requested Transfer Delay not Achievable"},
1321 {23, "Invalid RAB Parameters Combination"},
1322 {24, "Condition Violation for SDU Parameters"},
1323 {25, "Condition Violation for Traffic Handling Priority"},
1324 {26, "Condition Violation for Guaranteed Bit Rate"},
1325 {27, "User Plane Versions not Supported"},
1326 {28, "Iu UP Failure"},
1327 {29, "Relocation Failure in Target CN/RNC or Target System"},
1328 {30, "Invalid RAB ID"},
1329 {31, "No Remaining RAB"},
1330 {32, "Interaction with other procedure"},
1331 {33, "Requested Maximum Bit Rate for DL not Available"},
1332 {34, "Requested Maximum Bit Rate for UL not Available"},
1333 {35, "Requested Guaranteed Bit Rate for DL not Available"},
1334 {36, "Requested Guaranteed Bit Rate for UL not Available"},
1335 {37, "Repeated Integrity Checking Failure"},
1336 {38, "Requested Report Type not supported"},
1337 {39, "Request superseded"},
1338 {40, "Release due to UE generated signalling connection release"},
1339 {41, "Resource Optimisation Relocation"},
1340 {42, "Requested Information Not Available"},
1341 {43, "Relocation desirable for radio reasons"},
1342 {44, "Relocation not supported in Target RNC or Target System"},
1343 {45, "Directed Retry"},
1344 {46, "Radio Connection With UE Lost"},
1345 {47, "rNC-unable-to-establish-all-RFCs"},
1346 {48, "deciphering-keys-not-available"},
1347 {49, "dedicated-assistance-data-not-available"},
1348 {50, "relocation-target-not-allowed"},
1349 {51, "location-reporting-congestion"},
1350 {52, "reduce-load-in-serving-cell"},
1351 {53, "no-radio-resources-available-in-target-cell"},
1352 {54, "gERAN-Iumode-failure"},
1353 {55, "access-restricted-due-to-shared-networks"},
1354 {56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
1355 {57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
1356 {58, "mBMS-no-multicast-service-for-this-UE"},
1357 {59, "mBMS-unknown-UE-ID"},
1358 {60, "successful-MBMS-session-start-no-data-bearer-necessary"},
1359 {61, "mBMS-superseded-due-to-NNSF"},
1360 {62, "mBMS-UE-linking-already-done"},
1361 {63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
1362 {64, "tMGI-unknown"},
1363 /* Transport Layer Cause (65-->80) */
1364 {65, "Signalling Transport Resource Failure"},
1365 {66, "Iu Transport Connection Failed to Establish"},
1366 /* NAS Cause (81-->96) */
1367 {81, "User Restriction Start Indication"},
1368 {82, "User Restriction End Indication"},
1369 {83, "Normal Release"},
1370 /* Protocol Cause (97-->112) */
1371 {97, "Transfer Syntax Error"},
1372 {98, "Semantic Error"},
1373 {99, "Message not compatible with receiver state"},
1374 {100, "Abstract Syntax Error (Reject)"},
1375 {101, "Abstract Syntax Error (Ignore and Notify)"},
1376 {102, "Abstract Syntax Error (Falsely Constructed Message"},
1377 /* Miscellaneous Cause (113-->128) */
1378 {113, "O & M Intervention"},
1379 {114, "No Resource Available"},
1380 {115, "Unspecified Failure"},
1381 {116, "Network Optimisation"},
1382 /* Non-standard Cause (129-->255) */
1384 /* ranap_CauseRadioNetworkExtension ??
1385 { 257, "iP-multicast-address-and-APN-not-valid" },
1386 { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
1387 { 259, "mBMS-request-superseded" },
1388 { 260, "mBMS-de-registration-during-session-not-allowed" },
1389 { 261, "mBMS-no-data-bearer-necessary" },
1394 static value_string_ext ranap_cause_type_ext = VALUE_STRING_EXT_INIT(ranap_cause_type);
1396 static const value_string mm_sec_modep[] = {
1397 {0, "Used cipher value, UMTS keys and Quintuplets"},
1398 {1, "GSM key and triplets"},
1399 {2, "UMTS key and quintuplets"},
1400 {3, "GSM key and quintuplets"},
1404 static const value_string gtp_cipher_algorithm[] = {
1405 {0, "No ciphering"},
1415 static const value_string gtp_ext_rat_type_vals[] = {
1421 {5, "HSPA Evolution"},
1425 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
1426 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
1427 #define MM_PROTO_PDSS1 0x02
1428 #define MM_PROTO_CALL_CONTROL 0x03
1429 #define MM_PROTO_PDSS2 0x04
1430 #define MM_PROTO_MM_NON_GPRS 0x05
1431 #define MM_PROTO_RR_MGMT 0x06
1432 #define MM_PROTO_MM_GPRS 0x08
1433 #define MM_PROTO_SMS 0x09
1434 #define MM_PROTO_SESSION_MGMT 0x0A
1435 #define MM_PROTO_NON_CALL_RELATED 0x0B
1437 static const value_string tft_code_type[] = {
1439 {1, "Create new TFT"},
1440 {2, "Delete existing TFT"},
1441 {3, "Add packet filters to existing TFT"},
1442 {4, "Replace packet filters in existing TFT"},
1443 {5, "Delete packet filters from existing TFT"},
1450 static dissector_handle_t ip_handle;
1451 static dissector_handle_t ipv6_handle;
1452 static dissector_handle_t ppp_handle;
1453 static dissector_handle_t data_handle;
1454 static dissector_handle_t gtpcdr_handle;
1455 static dissector_handle_t sndcpxid_handle;
1456 static dissector_handle_t gtpv2_handle;
1457 static dissector_table_t bssap_pdu_type_table;
1459 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype);
1461 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1462 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1463 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1464 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1465 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1466 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1467 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1468 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1469 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1470 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1471 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1472 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1473 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1474 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1475 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1476 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1477 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1478 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1479 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1480 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1481 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1482 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1483 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1484 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1485 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1486 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1487 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1488 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1489 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1490 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1491 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1492 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1493 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1494 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1495 static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1496 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1497 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1498 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1499 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1500 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1501 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1502 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1503 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1504 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1505 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1507 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1508 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1509 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1510 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1511 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1512 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1513 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1514 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1515 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1516 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1517 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1518 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1519 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1520 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1521 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1522 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1523 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1524 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1525 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1526 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1527 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1528 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1529 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1530 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1531 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1532 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1533 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1534 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1535 static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1536 static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1537 static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1538 static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1539 static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1540 static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1541 static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1542 static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1543 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1544 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1545 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1546 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1547 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1548 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1549 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1550 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1551 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1552 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1553 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1554 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1555 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1557 typedef struct _gtp_opt {
1559 int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *);
1562 static const gtp_opt_t gtpopt[] = {
1563 {GTP_EXT_CAUSE, decode_gtp_cause},
1564 {GTP_EXT_IMSI, decode_gtp_imsi},
1565 {GTP_EXT_RAI, decode_gtp_rai},
1566 {GTP_EXT_TLLI, decode_gtp_tlli},
1567 {GTP_EXT_PTMSI, decode_gtp_ptmsi},
1568 {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
1569 {GTP_EXT_REORDER, decode_gtp_reorder},
1570 {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
1571 {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
1572 {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
1573 {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
1574 {GTP_EXT_RECOVER, decode_gtp_recovery},
1575 {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
1576 {GTP_EXT_16, decode_gtp_16},
1577 {GTP_EXT_17, decode_gtp_17},
1578 {GTP_EXT_18, decode_gtp_18},
1579 {GTP_EXT_19, decode_gtp_19},
1580 {GTP_EXT_NSAPI, decode_gtp_nsapi},
1581 {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
1582 {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
1583 {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
1584 {GTP_EXT_RP, decode_gtp_rp},
1585 {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
1586 {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
1587 {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
1588 {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
1589 {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
1590 {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
1591 {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
1592 {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
1593 {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
1594 {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
1595 {GTP_EXT_APN, decode_gtp_apn},
1596 {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
1597 {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
1598 {GTP_EXT_MSISDN, decode_gtp_msisdn},
1599 {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts}, /* 3G */
1600 {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui}, /* 3G */
1601 {GTP_EXT_TFT, decode_gtp_tft}, /* 3G */
1602 {GTP_EXT_TARGET_ID, decode_gtp_target_id}, /* 3G */
1603 {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont}, /* 3G */
1604 {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup}, /* 3G */
1605 {GTP_EXT_HDR_LIST, decode_gtp_hdr_list}, /* 3G */
1606 {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id}, /* 3G */
1607 {GTP_EXT_OMC_ID, decode_gtp_omc_id}, /* 3G */
1608 /* TS 29 060 V6.11.0 */
1609 {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont}, /* 7.7.43 */
1610 {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio}, /* 7.7.45 */
1611 {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf}, /* 7.7.45A */
1612 {GTP_EXT_SSGN_NO, decode_gtp_ssgn_no}, /* 7.7.47 */
1613 {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs}, /* 7.7.48 */
1614 {GTP_EXT_APN_RES, decode_gtp_apn_res}, /* 3G */
1615 {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs}, /* 7.7.25B */
1616 {GTP_EXT_RAT_TYPE, decode_gtp_rat_type}, /* 3G */
1617 {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf}, /* 7.7.51 */
1618 {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone}, /* 7.7.52 */
1619 {GTP_EXT_IMEISV, decode_gtp_imeisv}, /* 3G 7.7.53 */
1620 {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con}, /* 7.7.54 */
1621 {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx}, /* 7.7.55 */
1622 {GTP_EXT_TMGI, decode_gtp_tmgi}, /* 7.7.56 */
1623 {GTP_EXT_RIM_RA, decode_gtp_rim_ra}, /* 7.7.57 */
1624 {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt}, /* 7.7.58 */
1625 {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa}, /* 7.7.60 */
1626 {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf}, /* 7.7.61 */
1627 {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf}, /* 7.7.62 */
1628 {GTP_EXT_HOP_COUNT, decode_gtp_hop_count}, /* 7.7.63 */
1629 {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id}, /* 7.7.64 */
1630 {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id}, /* 7.7.65 */
1631 {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind}, /* 7.7.66 */
1632 {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi}, /* 7.7.67 */
1633 {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur}, /* 7.7.59 */
1634 {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf}, /* 7.7.68 */
1635 {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no}, /* 7.7.69 */
1636 {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr}, /* 7.7.70 */
1637 {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx}, /* 7.7.71 */
1638 {GTP_EXT_BSS_CONT, decode_gtp_bss_cont}, /* 7.7.72 */
1639 {GTP_EXT_CELL_ID, decode_gtp_cell_id}, /* 7.7.73 */
1640 {GTP_EXT_PDU_NO, decode_gtp_pdu_no}, /* 7.7.74 */
1641 {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause}, /* 7.7.75 */
1642 {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap}, /* 7.7.76 */
1643 {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc}, /* 7.7.77 */
1644 {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc}, /* 7.7.78 */
1645 {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid}, /* 7.7.79 */
1646 {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act}, /* 7.7.80 */
1647 {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg}, /* 7.7.81 */
1648 {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id}, /* 7.7.82 */
1649 {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod}, /* 7.7.83 */
1651 {GTP_EXT_REL_PACK, decode_gtp_rel_pack}, /* charging */
1652 {GTP_EXT_CAN_PACK, decode_gtp_can_pack}, /* charging */
1653 {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
1654 {GTP_EXT_DATA_REQ, decode_gtp_data_req}, /* charging */
1655 {GTP_EXT_DATA_RESP, decode_gtp_data_resp}, /* charging */
1656 {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
1657 {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
1658 {0, decode_gtp_unknown}
1667 static guint8 gtp_version = 0;
1668 static const char *yesno[] = { "no", "yes" };
1670 static gchar *id_to_str(const guint8 * ad)
1673 static gchar str[17] = " ";
1674 guint8 bits8to5, bits4to1;
1676 static const gchar hex_digits[10] = "0123456789";
1678 for (i = 0; i < 8; i++) {
1679 bits8to5 = (ad[i] >> 4) & 0x0F;
1680 bits4to1 = ad[i] & 0x0F;
1682 str[j++] = hex_digits[bits4to1];
1684 str[j++] = hex_digits[bits8to5];
1690 static gchar *imsi_to_str(const guint8 * ad)
1693 static gchar str[17] = " ";
1696 for (i = 0; i < 8; i++) {
1697 if ((ad[i] & 0x0F) <= 9)
1698 str[j++] = (ad[i] & 0x0F) + 0x30;
1699 if (((ad[i] >> 4) & 0x0F) <= 9)
1700 str[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
1707 static gchar *msisdn_to_str(const guint8 * ad, int len)
1710 static gchar str[18] = "+ ";
1711 guint8 bits8to5, bits4to1;
1713 static const gchar hex_digits[10] = "0123456789";
1715 for (i = 1; i < len && i < 9; i++) {
1716 bits8to5 = (ad[i] >> 4) & 0x0F;
1717 bits4to1 = ad[i] & 0x0F;
1719 str[j++] = hex_digits[bits4to1];
1721 str[j++] = hex_digits[bits8to5];
1728 /* Next definitions and function check_field_presence checks if given field
1729 * in GTP packet is compliant with ETSI
1731 typedef struct _header {
1736 typedef struct _message {
1738 ext_header fields[32];
1741 /* ---------------------
1743 * ---------------------*/
1744 static _gtp_mess_items gprs_mess_items[] = {
1748 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1753 GTP_MSG_ECHO_RESP, {
1754 {GTP_EXT_RECOVER, GTP_MANDATORY},
1755 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1760 GTP_MSG_VER_NOT_SUPP, {
1765 GTP_MSG_NODE_ALIVE_REQ, {
1766 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
1767 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1772 GTP_MSG_NODE_ALIVE_RESP, {
1773 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1778 GTP_MSG_REDIR_REQ, {
1779 {GTP_EXT_CAUSE, GTP_MANDATORY},
1780 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
1781 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1786 GTP_MSG_REDIR_RESP, {
1787 {GTP_EXT_CAUSE, GTP_MANDATORY},
1788 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1793 GTP_MSG_CREATE_PDP_REQ, {
1794 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1795 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1796 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1797 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1798 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1799 {GTP_EXT_MSISDN, GTP_MANDATORY},
1800 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1801 {GTP_EXT_APN, GTP_MANDATORY},
1802 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1803 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1804 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1805 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1810 GTP_MSG_CREATE_PDP_RESP, {
1811 {GTP_EXT_CAUSE, GTP_MANDATORY},
1812 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1813 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1814 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1815 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1816 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1817 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1818 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1819 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1820 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1821 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1822 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1823 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1828 GTP_MSG_UPDATE_PDP_REQ, {
1829 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1830 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1831 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1832 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1833 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1834 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1835 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1840 GTP_MSG_UPDATE_PDP_RESP, {
1841 {GTP_EXT_CAUSE, GTP_MANDATORY},
1842 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1843 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1844 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1845 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1846 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1847 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1848 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1849 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1850 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1855 GTP_MSG_DELETE_PDP_REQ, {
1856 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1861 GTP_MSG_DELETE_PDP_RESP, {
1862 {GTP_EXT_CAUSE, GTP_MANDATORY},
1863 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1868 GTP_MSG_CREATE_AA_PDP_REQ, {
1869 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1870 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1871 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1872 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1873 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1874 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1875 {GTP_EXT_APN, GTP_MANDATORY},
1876 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1877 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1878 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1879 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1884 GTP_MSG_CREATE_AA_PDP_RESP, {
1885 {GTP_EXT_CAUSE, GTP_MANDATORY},
1886 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1887 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1888 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1889 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1890 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1891 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1892 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1893 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1894 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1895 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1896 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1897 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1902 GTP_MSG_DELETE_AA_PDP_REQ, {
1903 {GTP_EXT_CAUSE, GTP_MANDATORY},
1904 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1909 GTP_MSG_DELETE_AA_PDP_RESP, {
1910 {GTP_EXT_CAUSE, GTP_MANDATORY},
1911 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1917 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1922 GTP_MSG_PDU_NOTIFY_REQ, {
1923 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1924 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1929 GTP_MSG_PDU_NOTIFY_RESP, {
1930 {GTP_EXT_CAUSE, GTP_MANDATORY},
1931 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1936 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1937 {GTP_EXT_CAUSE, GTP_MANDATORY},
1938 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1939 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1944 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1945 {GTP_EXT_CAUSE, GTP_MANDATORY},
1946 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1951 GTP_MSG_SEND_ROUT_INFO_REQ, {
1952 {GTP_EXT_IMSI, GTP_MANDATORY},
1953 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1958 GTP_MSG_SEND_ROUT_INFO_RESP, {
1959 {GTP_EXT_CAUSE, GTP_MANDATORY},
1960 {GTP_EXT_IMSI, GTP_MANDATORY},
1961 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
1962 {GTP_EXT_MS_REASON, GTP_OPTIONAL},
1963 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
1964 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1969 GTP_MSG_FAIL_REP_REQ, {
1970 {GTP_EXT_IMSI, GTP_MANDATORY},
1971 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1976 GTP_MSG_FAIL_REP_RESP, {
1977 {GTP_EXT_CAUSE, GTP_MANDATORY},
1978 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
1979 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1984 GTP_MSG_MS_PRESENT_REQ, {
1985 {GTP_EXT_IMSI, GTP_MANDATORY},
1986 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1987 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1992 GTP_MSG_MS_PRESENT_RESP, {
1993 {GTP_EXT_CAUSE, GTP_MANDATORY},
1994 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1999 GTP_MSG_IDENT_REQ, {
2000 {GTP_EXT_RAI, GTP_MANDATORY},
2001 {GTP_EXT_PTMSI, GTP_MANDATORY},
2002 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2003 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2008 GTP_MSG_IDENT_RESP, {
2009 {GTP_EXT_CAUSE, GTP_MANDATORY},
2010 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2011 {GTP_EXT_AUTH_TRI, GTP_OPTIONAL},
2012 {GTP_EXT_AUTH_QUI, GTP_OPTIONAL},
2013 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2018 GTP_MSG_SGSN_CNTXT_REQ, {
2019 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2020 {GTP_EXT_RAI, GTP_MANDATORY},
2021 {GTP_EXT_TLLI, GTP_MANDATORY},
2022 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2023 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2024 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
2029 GTP_MSG_SGSN_CNTXT_RESP, {
2030 {GTP_EXT_CAUSE, GTP_MANDATORY},
2031 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2032 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
2033 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2034 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2035 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2040 GTP_MSG_SGSN_CNTXT_ACK, {
2041 {GTP_EXT_CAUSE, GTP_MANDATORY},
2042 {GTP_EXT_FLOW_II, GTP_CONDITIONAL},
2043 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2044 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2049 GTP_MSG_DATA_TRANSF_REQ, {
2050 {GTP_EXT_TR_COMM, GTP_MANDATORY},
2051 {GTP_EXT_DATA_REQ, GTP_CONDITIONAL},
2052 {GTP_EXT_REL_PACK, GTP_CONDITIONAL},
2053 {GTP_EXT_CAN_PACK, GTP_CONDITIONAL},
2054 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2059 GTP_MSG_DATA_TRANSF_RESP, {
2060 {GTP_EXT_CAUSE, GTP_MANDATORY},
2061 {GTP_EXT_DATA_RESP, GTP_MANDATORY},
2062 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2073 /* -----------------------------
2075 * -----------------------------*/
2076 static _gtp_mess_items umts_mess_items[] = {
2077 /* 7.2 Path Management Messages */
2080 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2085 GTP_MSG_ECHO_RESP, {
2086 {GTP_EXT_RECOVER, GTP_MANDATORY},
2087 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2092 GTP_MSG_VER_NOT_SUPP, {
2097 GTP_MSG_SUPP_EXT_HDR, {
2098 {GTP_EXT_HDR_LIST, GTP_MANDATORY},
2104 GTP_MSG_NODE_ALIVE_REQ, {
2105 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
2106 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2111 GTP_MSG_NODE_ALIVE_RESP, {
2112 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2117 GTP_MSG_REDIR_REQ, {
2118 {GTP_EXT_CAUSE, GTP_MANDATORY},
2119 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
2120 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2125 GTP_MSG_REDIR_REQ, {
2129 /* 7.3 Tunnel Management Messages */
2131 GTP_MSG_CREATE_PDP_REQ, {
2132 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2133 /* RAI is in TS 29.060 V6.11.0 */
2134 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2135 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2136 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL},
2137 {GTP_EXT_TEID, GTP_MANDATORY},
2138 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2139 {GTP_EXT_NSAPI, GTP_MANDATORY},
2140 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2141 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},
2142 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2143 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2144 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2145 {GTP_EXT_APN, GTP_CONDITIONAL},
2146 {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL},
2147 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2148 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2149 {GTP_EXT_MSISDN, GTP_CONDITIONAL},
2150 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2151 {GTP_EXT_TFT, GTP_CONDITIONAL},
2152 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2153 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2154 /* TS 29.060 V6.11.0 */
2155 {GTP_EXT_APN_RES, GTP_OPTIONAL},
2156 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},
2157 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},
2158 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},
2159 {GTP_EXT_IMEISV, GTP_OPTIONAL},
2160 {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL},
2161 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},
2162 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2167 GTP_MSG_CREATE_PDP_RESP, {
2168 {GTP_EXT_CAUSE, GTP_MANDATORY},
2169 {GTP_EXT_REORDER, GTP_CONDITIONAL},
2170 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2171 {GTP_EXT_TEID, GTP_CONDITIONAL},
2172 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2173 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2174 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2175 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2176 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2177 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2178 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2179 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2180 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2181 /* TS 29.060 V6.11.0 */
2182 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2183 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2184 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2185 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2189 { /* checked, SGSN -> GGSN */
2190 GTP_MSG_UPDATE_PDP_REQ, {
2191 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2192 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2193 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2194 {GTP_EXT_TEID, GTP_MANDATORY},
2195 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2196 {GTP_EXT_NSAPI, GTP_MANDATORY},
2197 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2198 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2199 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2200 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2201 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
2202 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2203 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2204 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2205 {GTP_EXT_TFT, GTP_OPTIONAL},
2206 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2207 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2208 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2209 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2210 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2211 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2212 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2213 {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL}, /* Direct Tunnel Flags 7.7.81 */
2214 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2218 { /* checked, GGSN -> SGSN */
2219 GTP_MSG_UPDATE_PDP_RESP, {
2220 {GTP_EXT_CAUSE, GTP_MANDATORY},
2221 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2222 {GTP_EXT_TEID, GTP_CONDITIONAL},
2223 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2224 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2225 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2226 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2227 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2228 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2229 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2230 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2231 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2232 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2233 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2234 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2235 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2240 GTP_MSG_DELETE_PDP_REQ, {
2241 {GTP_EXT_TEAR_IND, GTP_CONDITIONAL},
2242 {GTP_EXT_NSAPI, GTP_MANDATORY},
2243 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2244 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2249 GTP_MSG_DELETE_PDP_RESP, {
2250 {GTP_EXT_CAUSE, GTP_MANDATORY},
2251 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2252 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2258 {GTP_EXT_TEID, GTP_MANDATORY},
2259 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GSN Address Mandatory 7.7.32 */
2260 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2265 GTP_MSG_PDU_NOTIFY_REQ, {
2266 {GTP_EXT_IMSI, GTP_MANDATORY},
2267 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2268 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2269 {GTP_EXT_APN, GTP_MANDATORY},
2270 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2271 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2272 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2277 GTP_MSG_PDU_NOTIFY_RESP, {
2278 {GTP_EXT_CAUSE, GTP_MANDATORY},
2279 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2284 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2285 {GTP_EXT_CAUSE, GTP_MANDATORY},
2286 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2287 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2288 {GTP_EXT_APN, GTP_MANDATORY},
2289 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2290 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2295 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2296 {GTP_EXT_CAUSE, GTP_MANDATORY},
2297 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2301 /* 7.4 Location Management Messages */
2303 GTP_MSG_SEND_ROUT_INFO_REQ, {
2304 {GTP_EXT_IMSI, GTP_MANDATORY},
2305 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2310 GTP_MSG_SEND_ROUT_INFO_RESP, {
2311 {GTP_EXT_CAUSE, GTP_MANDATORY},
2312 {GTP_EXT_IMSI, GTP_MANDATORY},
2313 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2314 {GTPv1_EXT_MS_REASON, GTP_OPTIONAL},
2315 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
2316 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2321 GTP_MSG_FAIL_REP_REQ, {
2322 {GTP_EXT_IMSI, GTP_MANDATORY},
2323 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2328 GTP_MSG_FAIL_REP_RESP, {
2329 {GTP_EXT_CAUSE, GTP_MANDATORY},
2330 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2331 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2336 GTP_MSG_MS_PRESENT_REQ, {
2337 {GTP_EXT_IMSI, GTP_MANDATORY},
2338 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2339 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2344 GTP_MSG_MS_PRESENT_RESP, {
2345 {GTP_EXT_CAUSE, GTP_MANDATORY},
2346 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2350 /* 7.5 Mobility Management Messages */
2352 GTP_MSG_IDENT_REQ, {
2353 {GTP_EXT_RAI, GTP_MANDATORY},
2354 {GTP_EXT_PTMSI, GTP_MANDATORY},
2355 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2356 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* SGSN Address for Control Plane Optional 7.7.32 */
2357 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2358 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2363 GTP_MSG_IDENT_RESP, {
2364 {GTP_EXT_CAUSE, GTP_MANDATORY},
2365 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2366 {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL},
2367 {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL},
2368 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2373 GTP_MSG_SGSN_CNTXT_REQ, {
2374 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2375 {GTP_EXT_RAI, GTP_MANDATORY},
2376 {GTP_EXT_TLLI, GTP_CONDITIONAL},
2377 {GTP_EXT_PTMSI, GTP_CONDITIONAL},
2378 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2379 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2380 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2381 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2382 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
2383 {GTP_EXT_SSGN_NO, GTP_OPTIONAL}, /* SGSN Number Optional 7.7.47 */
2384 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2385 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2390 GTP_MSG_SGSN_CNTXT_RESP, {
2391 {GTP_EXT_CAUSE, GTP_MANDATORY},
2392 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2393 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2394 {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL}, /* RAB Context Conditional 7.7.19 */
2395 {GTP_EXT_RP_SMS, GTP_OPTIONAL},
2396 {GTP_EXT_RP, GTP_OPTIONAL},
2397 {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL},
2398 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2399 {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL}, /* Radio Priority LCS Optional 7.7.25B */
2400 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2401 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2402 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2403 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2404 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2405 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2410 GTP_MSG_SGSN_CNTXT_ACK, {
2411 {GTP_EXT_CAUSE, GTP_MANDATORY},
2412 {GTP_EXT_TEID_II, GTP_CONDITIONAL},
2413 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2414 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2419 GTP_MSG_FORW_RELOC_REQ, {
2420 {GTP_EXT_IMSI, GTP_MANDATORY},
2421 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2422 {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY},
2423 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2424 {GTP_EXT_MM_CNTXT, GTP_MANDATORY},
2425 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2426 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2427 {GTP_EXT_TARGET_ID, GTP_MANDATORY},
2428 {GTP_EXT_UTRAN_CONT, GTP_MANDATORY},
2429 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2430 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2431 {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL}, /* Selected PLMN ID Optional 7.7.64 */
2432 {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL}, /* PS Handover Request Context Optional 7.7.71 */
2433 {GTP_EXT_BSS_CONT, GTP_OPTIONAL}, /* BSS Container Optional 7.7.72 */
2434 {GTP_EXT_CELL_ID, GTP_OPTIONAL}, /* Cell Identification Optional 7.7.73 */
2435 {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL}, /* BSSGP Cause Optional 7.7.75 */
2436 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2437 {GTP_EXT_SSGN_NO, GTP_OPTIONAL},
2442 GTP_MSG_FORW_RELOC_RESP, {
2443 {GTP_EXT_CAUSE, GTP_MANDATORY},
2444 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2445 {GTP_EXT_TEID_II, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
2446 {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL},
2447 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2448 {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL},
2449 {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL},
2450 {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL}, /* Additional RAB Setup Information Conditional 7.7.45A */
2451 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2456 GTP_MSG_FORW_RELOC_COMP, {
2457 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2462 GTP_MSG_RELOC_CANCEL_REQ, {
2463 {GTP_EXT_IMSI, GTP_MANDATORY},
2464 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2469 GTP_MSG_RELOC_CANCEL_RESP, {
2470 {GTP_EXT_CAUSE, GTP_MANDATORY},
2471 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2476 GTP_MSG_FORW_RELOC_ACK, {
2477 {GTP_EXT_CAUSE, GTP_MANDATORY},
2478 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2483 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2484 {GTP_EXT_CAUSE, GTP_MANDATORY},
2485 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2490 GTP_MSG_FORW_SRNS_CNTXT, {
2491 {GTP_EXT_RAB_CNTXT, GTP_MANDATORY},
2492 {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL}, /* Source RNC PDCP context info Optional 7.7.61 */
2493 {GTP_EXT_PDU_NO, GTP_OPTIONAL}, /* PDU Numbers Optional 7.7.74 */
2494 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2499 /* 7.5.14 RAN Information Management Messages */
2501 GTP_MSG_RAN_INFO_RELAY, {
2502 {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY}, /* RAN Transparent Container Mandatory 7.7.43 */
2503 {GTP_EXT_RIM_RA, GTP_OPTIONAL}, /* RIM Routing Address Optional 7.7.57 */
2504 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2508 /* 7.5A MBMS Messages
2509 * 7.5A.1 UE Specific MBMS Messages
2512 GTP_MBMS_NOTIFY_REQ, {
2513 {GTP_EXT_IMSI, GTP_MANDATORY}, /* IMSI Mandatory 7.7.2 */
2514 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2515 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2516 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2517 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2518 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GGSN Address for Control Plane Mandatory 7.7.32 */
2519 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2520 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2525 GTP_MBMS_NOTIFY_RES, {
2526 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2527 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2532 GTP_MBMS_NOTIFY_REJ_REQ, {
2533 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2534 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2535 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2536 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2537 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2538 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2543 GTP_MBMS_NOTIFY_REJ_RES, {
2544 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2545 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2550 GTP_CREATE_MBMS_CNTXT_REQ, {
2551 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2552 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2553 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2554 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL}, /* Selection mode Conditional 7.7.12 */
2555 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2556 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2557 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2558 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2559 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2560 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
2561 {GTP_EXT_MSISDN, GTP_CONDITIONAL}, /* MSISDN Conditional 7.7.33 */
2562 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2563 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2564 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2565 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2566 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2567 {GTP_EXT_IMEISV, GTP_OPTIONAL}, /* IMEI(SV) Optional 7.7.53 */
2568 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2569 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2570 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2571 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2572 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2577 GTP_CREATE_MBMS_CNTXT_RES, {
2578 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2579 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2580 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2581 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2582 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2583 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2584 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2585 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2586 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2587 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2592 GTP_UPD_MBMS_CNTXT_REQ, {
2593 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2594 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2595 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2596 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2597 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2598 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2599 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2600 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2601 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2602 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2603 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2604 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2605 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2606 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additional Trace Info Optional 7.7.62 */
2607 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2608 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2609 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2614 GTP_UPD_MBMS_CNTXT_RES, {
2615 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2616 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2617 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2618 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2619 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2620 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2621 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2622 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2623 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2628 GTP_DEL_MBMS_CNTXT_REQ, {
2629 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2630 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2631 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL}, /* End User Address Conditional 7.7.27 */
2632 {GTP_EXT_APN, GTP_CONDITIONAL}, /* Access Point Name Conditional 7.7.30 */
2633 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2634 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Conditional 7.7.67 */
2635 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2640 GTP_DEL_MBMS_CNTXT_RES, {
2641 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2642 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2643 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2649 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2650 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2651 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2657 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2658 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
2659 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2664 GTP_MBMS_DE_REG_REQ, {
2665 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2666 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2667 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2672 GTP_MBMS_DE_REG_RES, {
2673 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2674 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2679 GTP_MBMS_SES_START_REQ, {
2680 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2681 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2682 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2683 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2684 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2685 {GTP_EXT_QOS_UMTS, GTP_MANDATORY}, /* Quality of Service Profile Mandatory 7.7.34 */
2686 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Mandatory 7.7.48 */
2687 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
2688 {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY}, /* MBMS Session Duration Mandatory 7.7.59 */
2689 {GTP_EXT_MBMS_SA, GTP_MANDATORY}, /* MBMS Service Area Mandatory 7.7.60 */
2690 {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL}, /* MBMS Session Identifier Optional 7.7.65 */
2691 {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY}, /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
2692 {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
2693 {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY}, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
2694 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2699 GTP_MBMS_SES_START_RES, {
2700 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2701 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2702 {GTP_EXT_TEID, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
2703 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2704 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2705 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
2706 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2711 GTP_MBMS_SES_STOP_REQ, {
2712 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2713 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2714 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2719 GTP_MBMS_SES_STOP_RES, {
2720 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2721 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2732 /* Data structure attached to a conversation,
2733 to keep track of request/response-pairs
2735 typedef struct gtp_conv_info_t {
2736 struct gtp_conv_info_t *next;
2737 GHashTable *unmatched;
2738 GHashTable *matched;
2741 static gtp_conv_info_t *gtp_info_items;
2743 static guint gtp_sn_hash(gconstpointer k)
2745 const gtp_msg_hash_t *key = k;
2750 static gint gtp_sn_equal_matched(gconstpointer k1, gconstpointer k2)
2752 const gtp_msg_hash_t *key1 = k1;
2753 const gtp_msg_hash_t *key2 = k2;
2755 if ( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ) {
2759 if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ) {
2763 return key1->seq_nr == key2->seq_nr;
2766 static gint gtp_sn_equal_unmatched(gconstpointer k1, gconstpointer k2)
2768 const gtp_msg_hash_t *key1 = k1;
2769 const gtp_msg_hash_t *key2 = k2;
2771 return key1->seq_nr == key2->seq_nr;
2774 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype)
2776 gtp_msg_hash_t gcr, *gcrp = NULL;
2777 gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data;
2782 case GTP_MSG_ECHO_REQ:
2783 case GTP_MSG_CREATE_PDP_REQ:
2784 case GTP_MSG_UPDATE_PDP_REQ:
2785 case GTP_MSG_DELETE_PDP_REQ:
2786 gcr.is_request=TRUE;
2787 gcr.req_frame=pinfo->fd->num;
2790 case GTP_MSG_ECHO_RESP:
2791 case GTP_MSG_CREATE_PDP_RESP:
2792 case GTP_MSG_UPDATE_PDP_RESP:
2793 case GTP_MSG_DELETE_PDP_RESP:
2794 gcr.is_request=FALSE;
2796 gcr.rep_frame=pinfo->fd->num;
2802 gcrp = g_hash_table_lookup(gtp_info->matched, &gcr);
2806 gcrp->is_request=gcr.is_request;
2810 /*no match, let's try to make one*/
2812 case GTP_MSG_ECHO_REQ:
2813 case GTP_MSG_CREATE_PDP_REQ:
2814 case GTP_MSG_UPDATE_PDP_REQ:
2815 case GTP_MSG_DELETE_PDP_REQ:
2818 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2820 g_hash_table_remove(gtp_info->unmatched, gcrp);
2822 /* if we cant reuse the old one, grab a new chunk */
2824 gcrp = se_alloc(sizeof(gtp_msg_hash_t));
2826 gcrp->seq_nr=seq_nr;
2827 gcrp->req_frame = pinfo->fd->num;
2828 gcrp->req_time = pinfo->fd->abs_ts;
2829 gcrp->rep_frame = 0;
2830 gcrp->msgtype = msgtype;
2831 gcrp->is_request = TRUE;
2832 g_hash_table_insert(gtp_info->unmatched, gcrp, gcrp);
2835 case GTP_MSG_ECHO_RESP:
2836 case GTP_MSG_CREATE_PDP_RESP:
2837 case GTP_MSG_UPDATE_PDP_RESP:
2838 case GTP_MSG_DELETE_PDP_RESP:
2840 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2843 if (!gcrp->rep_frame) {
2844 g_hash_table_remove(gtp_info->unmatched, gcrp);
2845 gcrp->rep_frame=pinfo->fd->num;
2846 gcrp->is_request=FALSE;
2847 g_hash_table_insert(gtp_info->matched, gcrp, gcrp);
2856 /* we have found a match */
2861 if (gcrp->is_request) {
2862 it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
2863 PROTO_ITEM_SET_GENERATED(it);
2867 it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
2868 PROTO_ITEM_SET_GENERATED(it);
2869 nstime_delta(&ns, &pinfo->fd->abs_ts, &gcrp->req_time);
2870 it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
2871 PROTO_ITEM_SET_GENERATED(it);
2878 static int check_field_presence(guint8 message, guint8 field, int *position)
2882 _gtp_mess_items *mess_items;
2884 switch (gtp_version) {
2886 mess_items = gprs_mess_items;
2889 mess_items = umts_mess_items;
2895 while (mess_items[i].code) {
2896 if (mess_items[i].code == message) {
2898 while (mess_items[i].fields[*position].code) {
2899 if (mess_items[i].fields[*position].code == field) {
2903 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
2904 return mess_items[i].fields[(*position)++].code;
2918 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2920 /* GPRS: 9.60 v7.6.0, chapter
2921 * UMTS: 29.060 v4.0, chapter
2924 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2929 cause = tvb_get_guint8(tvb, offset + 1);
2931 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
2936 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2937 * UMTS: 29.060 v4.0, chapter 7.7.2
2939 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2945 tvb_memcpy(tvb, imsi_val, offset + 1, 8);
2946 imsi_str = imsi_to_str(imsi_val);
2948 proto_tree_add_string(tree, hf_gtp_imsi, tvb, offset, 9, imsi_str);
2953 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2954 * UMTS: 29.060 v4.0, chapter 7.7.3
2956 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2959 proto_tree *ext_tree_rai;
2964 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_RAI, >p_val_ext, "Unknown message"));
2965 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2967 byte[0] = tvb_get_guint8(tvb, offset + 1);
2968 byte[1] = tvb_get_guint8(tvb, offset + 2);
2969 byte[2] = tvb_get_guint8(tvb, offset + 3);
2970 mcc = (byte[0] & 0x0F) * 100 + ((byte[0] & 0xF0) >> 4) * 10 + (byte[1] & 0x0F);
2971 if ((byte[1] & 0xF0) == 0xF0)
2972 mnc = (byte[2] & 0x0F) * 10 + ((byte[2] & 0xF0) >> 4);
2974 mnc = (byte[2] & 0x0F) * 100 + ((byte[2] & 0xF0) >> 4) * 10 + ((byte[1] & 0xF0) >> 4);
2976 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mcc, tvb, offset + 1, 2, mcc);
2977 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mnc, tvb, offset + 2, 2, mnc);
2978 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_lac, tvb, offset + 4, 2, tvb_get_ntohs(tvb, offset + 4));
2979 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, tvb_get_guint8(tvb, offset + 6));
2984 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2985 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2987 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2992 tlli = tvb_get_ntohl(tvb, offset + 1);
2993 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
2998 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
2999 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
3001 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3006 ptmsi = tvb_get_ntohl(tvb, offset + 1);
3007 proto_tree_add_uint(tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
3012 /* adjust - how many bytes before offset should be highlighted
3014 static int decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 adjust)
3017 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
3018 proto_tree *ext_tree_qos;
3021 spare1 = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_SPARE1_MASK;
3022 delay = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_DELAY_MASK;
3023 reliability = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_RELIABILITY_MASK;
3024 peak = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
3025 spare2 = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
3026 precedence = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
3027 spare3 = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
3028 mean = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
3030 te = proto_tree_add_text(tree, tvb, offset - adjust, 3 + adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
3031 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
3032 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3035 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
3036 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
3037 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
3038 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
3039 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
3040 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
3041 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
3042 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
3048 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
3052 * TODO: check if length is included: ETSI 4.08 vs 9.60
3054 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3057 return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
3061 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
3062 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
3064 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3069 reorder = tvb_get_guint8(tvb, offset + 1) & 0x01;
3070 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
3075 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
3076 * 4.08 v7.1.2, chapter 10.5.3.1+
3077 * UMTS: 29.060 v4.0, chapter 7.7.7
3078 * TODO: Add blurb support by registering items in the protocol registration
3080 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3083 proto_tree *ext_tree_auth_tri;
3086 te = proto_tree_add_text(tree, tvb, offset, 29, "%s", val_to_str_ext_const(GTP_EXT_AUTH_TRI, >p_val_ext, "Unknown message"));
3087 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
3089 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + 1, 16));
3090 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + 17, 4));
3091 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + 21, 8));
3093 return 1 + 16 + 4 + 8;
3096 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
3097 * 9.02 v7.7.0, page 1090
3098 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
3099 * 29.002 v4.2.1, chapter 17.5, page 268
3101 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3106 map_cause = tvb_get_guint8(tvb, offset + 1);
3107 proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
3112 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
3113 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
3115 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3120 ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
3121 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
3126 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
3127 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
3129 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3134 ms_valid = tvb_get_guint8(tvb, offset + 1) & 0x01;
3135 proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
3140 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
3141 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
3143 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3148 recovery = tvb_get_guint8(tvb, offset + 1);
3149 proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
3154 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
3155 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
3159 static const gchar *dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb)
3163 /* Value in ASCII(UTF-8) */
3164 sel_mode = tvb_get_guint8(tvb, 0) - 0x30;
3165 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
3167 return val_to_str_const(sel_mode, sel_mode_type, "Unknown");
3170 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3173 proto_tree_add_item(tree, hf_gtp_sel_mode, tvb, offset, 2, FALSE);
3177 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
3178 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
3180 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3183 guint16 ext_flow_label;
3186 switch (gtp_version) {
3188 ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
3189 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
3193 teid_data = tvb_get_ntohl(tvb, offset + 1);
3194 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
3198 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
3204 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
3205 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
3207 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3213 switch (gtp_version) {
3215 flow_sig = tvb_get_ntohs(tvb, offset + 1);
3216 proto_tree_add_uint(tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
3219 teid_cp = tvb_get_ntohl(tvb, offset + 1);
3220 proto_tree_add_uint(tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
3223 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
3228 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
3229 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
3231 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3236 proto_tree *ext_tree_flow_ii;
3239 switch (gtp_version) {
3241 te = proto_tree_add_text(tree, tvb, offset, 4, "%s", val_to_str_ext_const(GTP_EXT_FLOW_II, >p_val_ext, "Unknown message"));
3242 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3244 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3246 flow_ii = tvb_get_ntohs(tvb, offset + 2);
3247 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
3251 te = proto_tree_add_text(tree, tvb, offset, 6, "%s", val_to_str_ext_const(GTP_EXT_TEID_II, >pv1_val_ext, "Unknown message"));
3252 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3254 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3257 teid_ii = tvb_get_ntohl(tvb, offset + 2);
3258 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
3262 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
3268 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
3269 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
3270 * Check if all ms_reason types are included
3272 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3277 field19 = tvb_get_guint8(tvb, offset + 1);
3279 switch (gtp_version) {
3281 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
3284 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
3287 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
3294 /* GPRS: not present
3295 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
3297 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3302 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3303 proto_tree_add_uint(tree, hf_gtp_nsapi, tvb, offset, 2, nsapi);
3308 /* GPRS: not present
3309 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
3311 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3316 ranap = tvb_get_guint8(tvb, offset + 1);
3318 if (ranap > 0 && ranap <= 64)
3319 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3320 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
3321 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3322 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3324 if (ranap > 64 && ranap <= 80)
3325 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3326 ranap, "%s (Transport Layer Cause) : %s (%u)",
3327 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3328 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3330 if (ranap > 80 && ranap <= 96)
3331 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3332 ranap, "%s (NAS Cause) : %s (%u)",
3333 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3334 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3336 if (ranap > 96 && ranap <= 112)
3337 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3338 "%s (Protocol Cause) : %s (%u)",
3339 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3340 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3342 if (ranap > 112 && ranap <= 128)
3343 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3344 "%s (Miscellaneous Cause) : %s (%u)",
3345 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3346 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3348 if (ranap > 128 /* && ranap <=255 */ )
3349 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3350 "%s (Non-standard Cause) : %s (%u)",
3351 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3352 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3357 /* GPRS: not present
3358 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
3360 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3364 proto_tree *ext_tree_rab_cntxt;
3367 te = proto_tree_add_text(tree, tvb, offset, 10, "%s", val_to_str_ext_const(GTP_EXT_RAB_CNTXT, >p_val_ext, "Unknown message"));
3368 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
3370 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3372 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3373 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, FALSE);
3374 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, FALSE);
3375 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, FALSE);
3376 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, FALSE);
3382 /* GPRS: not present
3383 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
3385 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3390 rp_sms = tvb_get_guint8(tvb, offset + 1) & 0x07;
3391 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
3396 /* GPRS: not present
3397 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
3399 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3402 proto_tree *ext_tree_rp;
3404 guint8 nsapi, rp, spare;
3406 nsapi = tvb_get_guint8(tvb, offset + 1) & 0xF0;
3407 spare = tvb_get_guint8(tvb, offset + 1) & 0x08;
3408 rp = tvb_get_guint8(tvb, offset + 1) & 0x07;
3410 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
3411 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
3413 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, nsapi);
3414 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, spare);
3415 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, rp);
3420 /* GPRS: not present
3421 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
3423 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3426 proto_tree *ext_tree_pkt_flow_id;
3428 guint8 nsapi, pkt_flow_id;
3430 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3431 pkt_flow_id = tvb_get_guint8(tvb, offset + 2);
3433 te = proto_tree_add_uint_format(tree, hf_gtp_pkt_flow_id, tvb, offset, 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi, pkt_flow_id);
3434 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
3436 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3437 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
3438 offset + 2, 1, pkt_flow_id, "%s : %u", val_to_str_ext_const(GTP_EXT_PKT_FLOW_ID, >p_val_ext, "Unknown message"), pkt_flow_id);
3443 /* GPRS: not present
3444 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
3445 * TODO: Differenciate these uints?
3447 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3452 proto_tree *ext_tree_chrg_char;
3454 chrg_char = tvb_get_ntohs(tvb, offset + 1);
3456 te = proto_tree_add_uint(tree, hf_gtp_chrg_char, tvb, offset, 3, chrg_char);
3457 /*"%s: %x", val_to_str_ext_const (GTP_EXT_CHRG_CHAR, >p_val_ext, "Unknown message"), chrg_char); */
3458 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
3460 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_s, tvb, offset + 1, 2, chrg_char);
3461 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_n, tvb, offset + 1, 2, chrg_char);
3462 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_p, tvb, offset + 1, 2, chrg_char);
3463 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_f, tvb, offset + 1, 2, chrg_char);
3464 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_h, tvb, offset + 1, 2, chrg_char);
3465 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_r, tvb, offset + 1, 2, chrg_char);
3470 /* GPRS: not present
3471 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3473 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3478 trace_ref = tvb_get_ntohs(tvb, offset + 1);
3480 proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
3485 /* GPRS: not present
3486 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3488 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3493 trace_type = tvb_get_ntohs(tvb, offset + 1);
3495 proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
3500 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3501 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3503 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3508 reason = tvb_get_guint8(tvb, offset + 1);
3510 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
3516 * UMTS: 29.060 v6.11.0, chapter 7.7.25B
3517 * Radio Priority LCS
3519 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3523 proto_tree *ext_tree;
3526 length = tvb_get_ntohs(tvb, offset + 1);
3527 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_RA_PRIO_LCS, >p_val_ext, "Unknown"));
3528 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ra_prio_lcs);
3531 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
3532 offset = offset + 2;
3533 /* TODO add decoding of data */
3534 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
3540 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
3543 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3548 tr_command = tvb_get_guint8(tvb, offset + 1);
3550 proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
3555 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3556 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3558 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3563 chrg_id = tvb_get_ntohl(tvb, offset + 1);
3564 proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
3569 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3570 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3572 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3576 guint8 pdp_typ, pdp_org;
3578 struct e_in6_addr addr_ipv6;
3579 proto_tree *ext_tree_user;
3583 length = tvb_get_ntohs(tvb, offset + 1);
3584 pdp_org = tvb_get_guint8(tvb, offset + 3) & 0x0F;
3585 pdp_typ = tvb_get_guint8(tvb, offset + 4);
3587 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s (%s/%s)",
3588 val_to_str_ext_const(GTP_EXT_USER_ADDR, >p_val_ext, "Unknown message"),
3589 val_to_str_const(pdp_org, pdp_org_type, "Unknown PDP Organization"),
3590 val_to_str_const(pdp_typ, pdp_type, "Unknown PDP Type"));
3591 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3593 proto_tree_add_text(ext_tree_user, tvb, offset + 1, 2, "Length : %u", length);
3594 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset + 3, 1, pdp_org);
3595 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
3598 if (pdp_org == 0 && pdp_typ == 1)
3599 proto_item_append_text(te, " (Point to Point Protocol)");
3600 else if (pdp_typ == 2)
3601 proto_item_append_text(te, " (Octet Stream Protocol)");
3602 } else if (length > 2) {
3605 addr_ipv4 = tvb_get_ipv4(tvb, offset + 5);
3606 proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, addr_ipv4);
3607 proto_item_append_text(te, " : %s", ip_to_str((guint8 *) & addr_ipv4));
3610 tvb_get_ipv6(tvb, offset + 5, &addr_ipv6);
3611 proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, (guint8 *) & addr_ipv6);
3612 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
3616 proto_item_append_text(te, " : empty PDP Address");
3621 static int decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3624 proto_tree *ext_tree_trip;
3625 proto_item *te_trip;
3628 for (i = 0; i < count; i++) {
3629 te_trip = proto_tree_add_text(tree, tvb, offset + i * 28, 28, "Triplet no%x", i);
3630 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3632 proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + i * 28, 16));
3633 proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28 + 16, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + i * 28 + 16, 4));
3634 proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28 + 20, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + i * 28 + 20, 8));
3640 /* adjust - how many bytes before quintuplet should be highlighted
3642 static int decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3645 proto_tree *ext_tree_quint;
3646 proto_item *te_quint;
3647 guint16 q_offset, i;
3648 guint8 xres_len, auth_len;
3652 for (i = 0; i < count; i++) {
3654 te_quint = proto_tree_add_text(tree, tvb, offset, -1, "Quintuplet #%x", i + 1);
3655 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3658 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
3659 q_offset = q_offset + 16;
3660 xres_len = tvb_get_guint8(tvb, offset + q_offset);
3661 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "XRES length: %u", xres_len);
3663 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset + q_offset, xres_len));
3664 q_offset = q_offset + xres_len;
3665 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset + q_offset, 16));
3666 q_offset = q_offset + 16;
3667 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset + q_offset, 16));
3668 q_offset = q_offset + 16;
3669 auth_len = tvb_get_guint8(tvb, offset + q_offset);
3670 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "Authentication length: %u", auth_len);
3672 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset + q_offset, auth_len));
3674 q_offset = q_offset + auth_len;
3675 proto_item_set_end(te_quint, tvb, offset + q_offset);
3682 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3683 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3684 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3685 * - finish displaying last 3 parameters
3687 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3690 guint16 length, quint_len, con_len;
3691 guint8 cksn, count, sec_mode, len;
3692 proto_tree *ext_tree_mm;
3694 proto_item *tf = NULL;
3695 proto_tree *tf_tree = NULL;
3699 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_MM_CNTXT, >p_val_ext, "Unknown message"));
3700 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3703 length = tvb_get_ntohs(tvb, offset + 1);
3708 cksn = tvb_get_guint8(tvb, offset + 3) & 0x07;
3710 sec_mode = (tvb_get_guint8(tvb, offset + 4) >> 6) & 0x03;
3711 count = (tvb_get_guint8(tvb, offset + 4) >> 3) & 0x07;
3713 proto_tree_add_text(ext_tree_mm, tvb, offset + 1, 2, "Length: %x", length);
3714 if (gtp_version == 0)
3719 case 0: /* Used cipher value, UMTS keys and Quintuplets */
3720 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset + 3, 1, FALSE);
3721 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3722 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3723 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3724 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3725 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3726 quint_len = tvb_get_ntohs(tvb, offset + 37);
3727 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3729 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3733 case 1: /* GSM key and triplets */
3734 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3735 if (gtp_version != 0)
3736 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3738 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3739 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3740 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3742 offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
3745 case 2: /* UMTS key and quintuplets */
3746 proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, FALSE);
3747 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3748 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3749 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3750 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3751 quint_len = tvb_get_ntohs(tvb, offset + 37);
3752 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3754 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3757 case 3: /* GSM key and quintuplets */
3758 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3759 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3760 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3761 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3762 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3763 quint_len = tvb_get_ntohs(tvb, offset + 13);
3764 proto_tree_add_text(ext_tree_mm, tvb, offset + 13, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3766 offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
3774 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
3776 de_gmm_drx_param(tvb, ext_tree_mm, offset, 2, NULL, 0);
3777 offset = offset + 2;
3779 len = tvb_get_guint8(tvb, offset);
3780 tf = proto_tree_add_text(ext_tree_mm, tvb, offset, len + 1, "MS Network Capability");
3782 tf_tree = proto_item_add_subtree(tf, ett_gtp_net_cap);
3784 proto_tree_add_text(tf_tree, tvb, offset, 1, "Length of MS network capability contents: %u", len);
3788 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
3790 de_gmm_ms_net_cap(tvb, tf_tree, offset, len, NULL, 0);
3791 offset = offset + len;
3793 /* Container contains one or several optional information elements as described in the clause 'Overview',
3794 * from the clause 'General message format and information elements coding' in 3GPP TS 24.008.
3795 * The IMEISV shall, if available, be included in the Container.
3798 con_len = tvb_get_ntohs(tvb, offset);
3799 proto_tree_add_text(ext_tree_mm, tvb, offset, 2, "Container length: %u", con_len);
3800 offset = offset + 2;
3804 l3_tvb = tvb_new_subset(tvb, offset, con_len, con_len);
3805 if (!dissector_try_port(bssap_pdu_type_table, BSSAP_PDU_TYPE_DTAP, l3_tvb, pinfo, ext_tree_mm))
3806 call_dissector(data_handle, l3_tvb, pinfo, ext_tree_mm);
3812 /* Function to extract the value of an hexadecimal octet. Only the lower
3813 * nybble will be non-zero in the output.
3815 static guint8 hex2dec(guint8 x)
3817 if ((x >= 'a') && (x <= 'f'))
3819 else if ((x >= 'A') && (x <= 'F'))
3821 else if ((x >= '0') && (x <= '9'))
3828 /* Wrapper function to add UTF-8 decoding for QoS attributes in
3831 static guint8 wrapped_tvb_get_guint8(tvbuff_t * tvb, int offset, int type)
3834 return (hex2dec(tvb_get_guint8(tvb, offset)) << 4 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
3836 return tvb_get_guint8(tvb, offset);
3839 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3840 * so type means length of length :-)
3842 * WARNING :) type does not mean length of length any more... see below for
3845 static int decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 type)
3849 guint8 al_ret_priority;
3850 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3851 guint8 traf_class, del_order, del_err_sdu;
3852 guint8 max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext;
3853 guint8 res_ber, sdu_err_ratio;
3854 guint8 trans_delay, traf_handl_prio;
3855 guint8 guar_ul, guar_dl, guar_ul_ext, guar_dl_ext;
3856 guint8 src_stat_desc, sig_ind;
3857 proto_tree *ext_tree_qos;
3859 int mss, mu, md, gu, gd;
3861 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
3862 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
3863 * to one byte to be dissected).
3864 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
3865 * corresponds to one byte to be dissected)
3867 guint8 utf8_type = 1;
3869 /* In RADIUS messages the QoS has a version field of two octets prepended.
3870 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
3871 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
3872 * inconsistent and unuseful, I will check hyphen presence here and
3873 * will signal its presence.
3877 /* Will keep the value that will be returned
3883 length = tvb_get_guint8(tvb, offset);
3884 te = proto_tree_add_text(tree, tvb, offset, length + 1, "%s", qos_str);
3885 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3886 proto_tree_add_text(ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3888 retval = length + 1;
3891 length = tvb_get_ntohs(tvb, offset + 1);
3892 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3893 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3894 proto_tree_add_text(ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3895 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
3896 retval = length + 3;
3899 /* For QoS inside RADIUS Client messages from GGSN */
3902 /* The field in the RADIUS message is the length of the tvb we were given */
3903 length = tvb_length(tvb);
3904 te = proto_tree_add_text(tree, tvb, offset, length, "%s", qos_str);
3906 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3908 proto_tree_add_item(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, FALSE);
3910 /* Hyphen handling */
3911 hyphen = tvb_get_guint8(tvb, offset + 2);
3912 if (hyphen == ((guint8) '-')) {
3913 /* Hyphen is present, put in protocol tree */
3914 proto_tree_add_text(ext_tree_qos, tvb, offset + 2, 1, "Hyphen separator: -");
3915 offset++; /* "Get rid" of hyphen */
3918 /* Now, we modify offset here and in order to use type later
3925 retval = length + 2; /* Actually, will be ignored. */
3928 /* XXX - what should we do with the length here? */
3931 ext_tree_qos = NULL;
3935 /* In RADIUS messages there is no allocation-retention priority
3936 * so I don't need to wrap the following call to tvb_get_guint8
3938 al_ret_priority = tvb_get_guint8(tvb, offset);
3940 /* All calls are wrapped to take into account the possibility that the
3941 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
3942 * of the offset will be the same as in the previous version of this
3943 * dissector, and the wrapped function will serve as a dumb wrapper;
3944 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
3945 * two bytes for needed shift, and the wrapped function will unencode
3946 * two values from the input.
3948 spare1 = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE1_MASK;
3949 delay = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DELAY_MASK;
3950 reliability = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RELIABILITY_MASK;
3951 peak = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PEAK_MASK;
3952 spare2 = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE2_MASK;
3953 precedence = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PRECEDENCE_MASK;
3954 spare3 = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE3_MASK;
3955 mean = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_MEAN_MASK;
3957 /* In RADIUS messages there is no allocation-retention priority */
3959 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3961 /* All additions must take care of the fact that QoS fields in RADIUS
3962 * messages are UTF-8 encoded, so we have to use the same trick as above.
3964 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
3965 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
3966 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
3967 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
3968 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
3969 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
3970 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
3971 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
3973 /* TS 24.008 V 7.8.0
3974 * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
3975 * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
3976 * attributes specified in octets 6-14.
3977 * In the MS to network direction and in the network to MS direction the following applies:
3978 * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
3980 * - If octet 17 is included, then octet 18 shall also be included.
3981 * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
3982 * be accepted by the receiving entity.
3987 /* See above for the need of wrapping
3991 traf_class = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_CLASS_MASK;
3992 del_order = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ORDER_MASK;
3993 del_err_sdu = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ERR_SDU_MASK;
3994 max_sdu_size = wrapped_tvb_get_guint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
3995 max_ul = wrapped_tvb_get_guint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
3996 max_dl = wrapped_tvb_get_guint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
3997 res_ber = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RES_BER_MASK;
3998 sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SDU_ERR_RATIO_MASK;
3999 trans_delay = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRANS_DELAY_MASK;
4000 traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK;
4001 guar_ul = wrapped_tvb_get_guint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
4003 guar_dl = wrapped_tvb_get_guint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
4013 src_stat_desc = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& GTP_EXT_QOS_SRC_STAT_DESC_MASK;
4014 sig_ind = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& GTP_EXT_QOS_SIG_IND_MASK;
4017 max_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
4018 guar_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
4021 max_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
4022 guar_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
4025 /* See above comments for the changes
4027 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
4028 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
4029 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_err_sdu, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_err_sdu);
4030 if (max_sdu_size == 0 || max_sdu_size > 150)
4031 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, max_sdu_size);
4032 if (max_sdu_size > 0 && max_sdu_size <= 150) {
4033 mss = max_sdu_size * 10;
4034 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss,
4035 "Maximum SDU size: %u octets", mss);
4038 if (max_ul == 0 || max_ul == 255)
4039 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
4040 if (max_ul > 0 && max_ul <= 63)
4041 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul,
4042 "Maximum bit rate for uplink: %u kbps", max_ul);
4043 if (max_ul > 63 && max_ul <= 127) {
4044 mu = 64 + (max_ul - 64) * 8;
4045 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
4046 "Maximum bit rate for uplink: %u kbps", mu);
4049 if (max_ul > 127 && max_ul <= 254) {
4050 mu = 576 + (max_ul - 128) * 64;
4051 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
4052 "Maximum bit rate for uplink: %u kbps", mu);
4055 if (max_dl == 0 || max_dl == 255)
4056 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
4057 if (max_dl > 0 && max_dl <= 63)
4058 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl,
4059 "Maximum bit rate for downlink: %u kbps", max_dl);
4060 if (max_dl > 63 && max_dl <= 127) {
4061 md = 64 + (max_dl - 64) * 8;
4062 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
4063 "Maximum bit rate for downlink: %u kbps", md);
4065 if (max_dl > 127 && max_dl <= 254) {
4066 md = 576 + (max_dl - 128) * 64;
4067 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
4068 "Maximum bit rate for downlink: %u kbps", md);
4071 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
4072 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_sdu_err_ratio, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, sdu_err_ratio);
4073 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
4074 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_handl_prio, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, traf_handl_prio);
4076 if (guar_ul == 0 || guar_ul == 255)
4077 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
4078 if (guar_ul > 0 && guar_ul <= 63)
4079 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul,
4080 "Guaranteed bit rate for uplink: %u kbps", guar_ul);
4081 if (guar_ul > 63 && guar_ul <= 127) {
4082 gu = 64 + (guar_ul - 64) * 8;
4083 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
4084 "Guaranteed bit rate for uplink: %u kbps", gu);
4086 if (guar_ul > 127 && guar_ul <= 254) {
4087 gu = 576 + (guar_ul - 128) * 64;
4088 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
4089 "Guaranteed bit rate for uplink: %u kbps", gu);
4093 if (guar_dl == 0 || guar_dl == 255)
4094 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
4095 if (guar_dl > 0 && guar_dl <= 63)
4096 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl,
4097 "Guaranteed bit rate for downlink: %u kbps", guar_dl);
4098 if (guar_dl > 63 && guar_dl <= 127) {
4099 gd = 64 + (guar_dl - 64) * 8;
4100 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
4101 "Guaranteed bit rate for downlink: %u kbps", gd);
4103 if (guar_dl > 127 && guar_dl <= 254) {
4104 gd = 576 + (guar_dl - 128) * 64;
4105 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
4106 "Guaranteed bit rate for downlink: %u kbps", gd);
4110 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_src_stat_desc, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, src_stat_desc);
4111 proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
4115 if (max_dl_ext > 0 && max_dl_ext <= 0x4a) {
4116 md = 8600 + max_dl_ext * 100;
4117 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4118 "Ext Maximum bit rate for downlink: %u kbps", md);
4120 if (max_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4121 md = 16 + (max_dl_ext-0x4a);
4122 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4123 "Ext Maximum bit rate for downlink: %u Mbps", md);
4125 if (max_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4126 md = 128 + (max_dl_ext-0xba)*2;
4127 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4128 "Ext Maximum bit rate for downlink: %u Mbps", md);
4131 if(guar_dl_ext == 0)
4132 proto_tree_add_text(ext_tree_qos, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, "Use the value indicated by the Guaranteed bit rate for downlink in octet 13");
4133 if (guar_dl_ext > 0 && guar_dl_ext <= 0x4a) {
4134 gd = 8600 + guar_dl_ext * 100;
4135 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4136 "Ext Guaranteed bit rate for downlink: %u kbps", gd);
4138 if (guar_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4139 gd = 16 + (guar_dl_ext-0x4a);
4140 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4141 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
4143 if (guar_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4144 gd = 128 + (guar_dl_ext-0xba)*2;
4145 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4146 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
4152 * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
4153 * rate for downlink (extended).
4155 if (max_ul_ext > 0 && max_ul_ext <= 0x4a) {
4156 md = 8600 + max_ul_ext * 100;
4157 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4158 "Ext Maximum bit rate for uplink: %u kbps", md);
4160 if (max_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4161 md = 16 + (max_ul_ext-0x4a);
4162 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4163 "Ext Maximum bit rate for uplink: %u Mbps", md);
4165 if (max_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4166 md = 128 + (max_ul_ext-0xba)*2;
4167 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4168 "Ext Maximum bit rate for uplink: %u Mbps", md);
4171 if (guar_ul_ext == 0)
4172 proto_tree_add_text(ext_tree_qos, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, "Use the value indicated by the Guaranteed bit rate for uplink in octet 12");
4173 if (guar_ul_ext > 0 && guar_ul_ext <= 0x4a) {
4174 gd = 8600 + guar_ul_ext * 100;
4175 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4176 "Ext Guaranteed bit rate for uplink: %u kbps", gd);
4178 if (guar_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4179 gd = 16 + (guar_ul_ext-0x4a);
4180 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4181 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
4183 if (guar_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4184 gd = 128 + (guar_ul_ext-0xba)*2;
4185 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4186 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
4195 /* Diameter 3GPP AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
4197 dissect_diameter_3gpp_qosprofile(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
4199 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
4200 return tvb_length(tvb);
4203 static const gchar *dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb)
4205 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
4206 return tvb_get_ephemeral_string(tvb, 0, tvb_length(tvb));
4209 static void decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree)
4216 name_len = tvb_get_guint8(tvb, offset);
4218 if (name_len < 0x20) {
4219 apn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
4221 if (name_len >= length - 1)
4224 name_len = name_len + apn[tmp] + 1;
4228 apn = tvb_get_ephemeral_string(tvb, offset, length);
4230 proto_tree_add_string(tree, hf_gtp_apn, tvb, offset, length, apn);
4234 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
4235 * UMTS: 29.060 v4.0, chapter 7.7.29
4236 * TODO: unify addr functions
4238 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4241 guint8 ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id, pdp_type_org, pdp_type_num, pdp_addr_len;
4242 guint16 length, sn_down, sn_up, up_flow;
4244 struct e_in6_addr addr_ipv6;
4245 proto_tree *ext_tree_pdp;
4248 length = tvb_get_ntohs(tvb, offset + 1);
4250 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_PDP_CNTXT, >p_val_ext, "Unknown message"));
4251 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
4253 vaa = (tvb_get_guint8(tvb, offset + 3) >> 6) & 0x01;
4254 order = (tvb_get_guint8(tvb, offset + 3) >> 4) & 0x01;
4255 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4256 sapi = tvb_get_guint8(tvb, offset + 4) & 0x0F;
4258 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "VPLMN address allowed: %s", yesno[vaa]);
4259 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Reordering required: %s", yesno[order]);
4260 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "NSAPI: %u", nsapi);
4261 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "SAPI: %u", sapi);
4263 switch (gtp_version) {
4265 decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
4266 decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
4267 decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
4268 offset = offset + 14;
4271 offset = offset + 5;
4272 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
4273 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
4274 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
4280 sn_down = tvb_get_ntohs(tvb, offset);
4281 sn_up = tvb_get_ntohs(tvb, offset + 2);
4282 pdu_send_no = tvb_get_guint8(tvb, offset + 4);
4283 pdu_rec_no = tvb_get_guint8(tvb, offset + 5);
4285 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
4286 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 2, "Sequence number up: %u", sn_up);
4287 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "Send N-PDU number: %u", pdu_send_no);
4288 proto_tree_add_text(ext_tree_pdp, tvb, offset + 5, 1, "Receive N-PDU number: %u", pdu_rec_no);
4290 switch (gtp_version) {
4292 up_flow = tvb_get_ntohs(tvb, offset + 6);
4293 proto_tree_add_text(ext_tree_pdp, tvb, offset + 6, 2, "Uplink flow label signalling: %u", up_flow);
4294 offset = offset + 8;
4297 pdp_cntxt_id = tvb_get_guint8(tvb, offset + 14);
4298 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_cp, tvb, offset + 6, 4, FALSE);
4299 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_data, tvb, offset + 10, 4, FALSE);
4300 proto_tree_add_text(ext_tree_pdp, tvb, offset + 14, 1, "PDP context identifier: %u", pdp_cntxt_id);
4301 offset = offset + 15;
4307 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
4308 pdp_type_num = tvb_get_guint8(tvb, offset + 1);
4309 pdp_addr_len = tvb_get_guint8(tvb, offset + 2);
4311 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str_const(pdp_type_org, pdp_type, "Unknown PDP org"));
4312 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 1, "PDP type: %s", val_to_str_const(pdp_type_num, pdp_type, "Unknown PDP type"));
4313 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 1, "PDP address length: %u", pdp_addr_len);
4315 if (pdp_addr_len > 0) {
4316 switch (pdp_type_num) {
4318 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4319 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 4, "PDP address: %s", ip_to_str((guint8 *) & addr_ipv4));
4322 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4323 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4330 offset = offset + 3 + pdp_addr_len;
4332 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4333 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
4335 switch (ggsn_addr_len) {
4337 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4338 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN Address for control plane: %s", ip_to_str((guint8 *) & addr_ipv4));
4341 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4342 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 16, "GGSN Address for User Traffic: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4348 offset = offset + 1 + ggsn_addr_len;
4350 if (gtp_version == 1) {
4352 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4353 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
4355 switch (ggsn_addr_len) {
4357 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4358 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *) & addr_ipv4));
4361 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4362 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4367 offset = offset + 1 + ggsn_addr_len;
4371 apn_len = tvb_get_guint8(tvb, offset);
4372 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
4373 decode_apn(tvb, offset + 1, apn_len, ext_tree_pdp);
4375 offset = offset + 1 + apn_len;
4377 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
4378 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
4379 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
4380 * MS is stored in the PDP context IE.
4381 * NOTE: Bit 5-8 of the first octet in the encoding defined in 3GPP TS 24.007 [3] is mapped into bit 1-4 of the first
4382 * octet in this field.
4384 trans_id = tvb_get_guint8(tvb, offset);
4385 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Transaction identifier: %u", trans_id);
4390 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
4391 * UMTS: 29.060, v4.0, chapter 7.7.30
4393 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4397 proto_tree *ext_tree_apn;
4400 length = tvb_get_ntohs(tvb, offset + 1);
4402 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_APN, >p_val_ext, "Unknown field"));
4403 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
4405 proto_tree_add_text(ext_tree_apn, tvb, offset + 1, 2, "APN length : %u", length);
4406 decode_apn(tvb, offset + 3, length, ext_tree_apn);
4411 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
4412 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
4413 * UMTS: 29.060 v4.0, chapter 7.7.31
4414 * 24.008, v4.2, chapter 10.5.6.3
4416 int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
4419 guint16 length, proto_offset;
4421 guint8 conf, proto_len, cnt = 1;
4423 proto_tree *ext_tree_proto;
4425 gboolean save_writable;
4427 length = tvb_get_ntohs(tvb, offset + 1);
4429 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_PROTO_CONF, >p_val_ext, "Unknown message"));
4430 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
4432 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
4437 conf = tvb_get_guint8(tvb, offset + 3) & 0x07;
4438 proto_tree_add_text(ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
4440 proto_offset = 1; /* ... 1st byte is conf */
4444 if (proto_offset >= length)
4446 proto_id = tvb_get_ntohs(tvb, offset);
4447 proto_len = tvb_get_guint8(tvb, offset + 2);
4448 proto_offset += proto_len + 3; /* 3 = proto id + length byte */
4450 if (proto_len > 0) {
4452 proto_tree_add_text(ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)",
4453 cnt, val_to_str_ext_const(proto_id, &ppp_vals_ext, "Unknown"), proto_id);
4454 proto_tree_add_text(ext_tree_proto, tvb, offset + 2, 1, "Protocol %u length: %u", cnt, proto_len);
4457 * Don't allow the dissector for the configuration
4458 * protocol in question to update the columns - this
4461 save_writable = col_get_writable(pinfo->cinfo);
4462 col_set_writable(pinfo->cinfo, FALSE);
4465 * XXX - should we have our own dissector table,
4466 * solely for configuration protocols, so that bogus
4467 * values don't cause us to dissect the protocol
4468 * data as, for example, IP?
4470 next_tvb = tvb_new_subset(tvb, offset + 3, proto_len, proto_len);
4471 if (!dissector_try_port(ppp_subdissector_table, proto_id, next_tvb, pinfo, ext_tree_proto)) {
4472 call_dissector(data_handle, next_tvb, pinfo, ext_tree_proto);
4475 col_set_writable(pinfo->cinfo, save_writable);
4478 offset += proto_len + 3;
4485 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
4486 * UMTS: 29.060 v4.0, chapter 7.7.32
4488 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4491 guint8 addr_type, addr_len;
4494 struct e_in6_addr addr_ipv6;
4495 proto_tree *ext_tree_gsn_addr;
4498 length = tvb_get_ntohs(tvb, offset + 1);
4500 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "GSN address : ");
4501 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
4505 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4506 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4507 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4508 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, addr_ipv4);
4511 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4512 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4513 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4514 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4515 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4516 addr_ipv4 = tvb_get_ipv4(tvb, offset + 4);
4517 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4518 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, addr_ipv4);
4521 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4522 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4523 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4524 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
4527 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4528 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4529 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4530 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4531 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4532 tvb_get_ipv6(tvb, offset + 4, &addr_ipv6);
4533 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4534 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, (guint8 *) & addr_ipv6);
4537 proto_item_append_text(te, "unknown type or wrong length");
4544 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
4545 * UMTS: 29.060 v4.0, chapter 7.7.33
4547 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4550 const guint8 *msisdn_val;
4554 length = tvb_get_ntohs(tvb, offset + 1);
4559 msisdn_val = tvb_get_ptr(tvb, offset + 3, length);
4560 msisdn_str = msisdn_to_str(msisdn_val, length);
4562 proto_tree_add_string(tree, hf_gtp_msisdn, tvb, offset, 3 + length, msisdn_str);
4567 /* GPRS: not present
4568 * UMTS: 29.060 v4.0, chapter 7.7.34
4569 * 24.008 v4.2, chapter 10.5.6.5
4571 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4574 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
4577 /* GPRS: not present
4578 * UMTS: 29.060 v4.0, chapter 7.7.35
4580 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4583 proto_tree *ext_tree;
4584 proto_item *te_quint;
4586 guint8 xres_len, auth_len;
4589 length = tvb_get_ntohs(tvb, offset + 1);
4591 te_quint = proto_tree_add_text(tree, tvb, offset, length + 1, "Quintuplet");
4592 ext_tree = proto_item_add_subtree(te_quint, ett_gtp_quint);
4595 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4596 offset = offset + 2;
4598 proto_tree_add_text(ext_tree, tvb, offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
4599 offset = offset + 16;
4600 xres_len = tvb_get_guint8(tvb, offset);
4601 proto_tree_add_text(ext_tree, tvb, offset, 1, "XRES length: %u", xres_len);
4603 proto_tree_add_text(ext_tree, tvb, offset, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset, xres_len));
4604 offset = offset + xres_len;
4605 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4606 offset = offset + 16;
4607 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4608 offset = offset + 16;
4609 auth_len = tvb_get_guint8(tvb, offset);
4610 proto_tree_add_text(ext_tree, tvb, offset, 1, "Authentication length: %u", auth_len);
4612 proto_tree_add_text(ext_tree, tvb, offset, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset, auth_len));
4614 offset = offset + auth_len;
4616 return (3 + length);
4620 /* GPRS: not present
4621 * UMTS: 29.060 v4.0, chapter 7.7.36
4622 * 24.008 v4.2, chapter 10.5.6.12
4624 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4627 guint16 length, port1, port2, tos;
4628 guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto, spare;
4630 guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
4631 struct e_in6_addr addr_ipv6, mask_ipv6;
4632 proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
4633 proto_item *te, *tee, *tef;
4635 length = tvb_get_ntohs(tvb, offset + 1);
4637 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Traffic flow template");
4638 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
4640 tft_flags = tvb_get_guint8(tvb, offset + 3);
4641 tft_code = (tft_flags >> 5) & 0x07;
4642 spare = (tft_flags >> 4) & 0x01;
4643 no_packet_filters = tft_flags & 0x0F;
4645 proto_tree_add_text(ext_tree_tft, tvb, offset + 1, 2, "TFT length: %u", length);
4647 tef = proto_tree_add_text(ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
4648 ext_tree_tft_flags = proto_item_add_subtree(tef, ett_gtp_tft_flags);
4649 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_code, tvb, offset + 3, 1, tft_flags);
4650 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_spare, tvb, offset + 3, 1, tft_flags);
4651 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_number, tvb, offset + 3, 1, tft_flags);
4653 offset = offset + 4;
4655 for (i = 0; i < no_packet_filters; i++) {
4657 pf_id = tvb_get_guint8(tvb, offset);
4659 tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
4660 ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
4663 if (tft_code != 2) {
4665 pf_eval = tvb_get_guint8(tvb, offset);
4666 pf_len = tvb_get_guint8(tvb, offset + 1);
4668 proto_tree_add_uint(ext_tree_tft_pf, hf_gtp_tft_eval, tvb, offset, 1, pf_eval);
4669 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + 1, 1, "Content length: %u", pf_len);
4671 offset = offset + 2;
4674 while (pf_offset < pf_len) {
4676 pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
4678 switch (pf_content_id) {
4679 /* address IPv4 and mask = 8 bytes */
4681 addr_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 1);
4682 mask_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 5);
4683 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 9, "ID 0x10: IPv4/mask: %s/%s", ip_to_str((guint8 *) & addr_ipv4),
4684 ip_to_str((guint8 *) & mask_ipv4));
4685 pf_offset = pf_offset + 9;
4687 /* address IPv6 and mask = 32 bytes */
4689 tvb_get_ipv6(tvb, offset + pf_offset + 1, &addr_ipv6);
4690 tvb_get_ipv6(tvb, offset + pf_offset + 17, &mask_ipv6);
4691 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s",
4692 ip6_to_str((struct e_in6_addr *) &addr_ipv6), ip6_to_str((struct e_in6_addr *) &mask_ipv6));
4693 pf_offset = pf_offset + 33;
4695 /* protocol identifier/next header type = 1 byte */
4697 proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
4698 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)",
4700 pf_offset = pf_offset + 2;
4702 /* single destination port type = 2 bytes */
4704 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4705 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
4706 pf_offset = pf_offset + 3;
4708 /* destination port range type = 4 bytes */
4710 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4711 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4712 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
4713 pf_offset = pf_offset + 5;
4715 /* single source port type = 2 bytes */
4717 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4718 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
4719 pf_offset = pf_offset + 3;
4721 /* source port range type = 4 bytes */
4723 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4724 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4725 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
4726 pf_offset = pf_offset + 5;
4728 /* security parameter index type = 4 bytes */
4730 ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
4731 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
4732 pf_offset = pf_offset + 5;
4734 /* type of service/traffic class type = 2 bytes */
4736 tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4737 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
4738 pf_offset = pf_offset + 3;
4740 /* flow label type = 3 bytes */
4742 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;
4743 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
4744 pf_offset = pf_offset + 4;
4748 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
4749 pf_offset++; /* to avoid infinite loop */
4754 offset = offset + pf_offset;
4761 /* GPRS: not present
4762 * UMTS: 29.060 v4.0, chapter 7.7.37
4763 * Type = 138 (Decimal)
4764 * 25.413(RANAP) TargetID
4766 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4770 proto_item *target_id_item;
4771 proto_tree *ext_tree;
4773 asn1_ctx_t asn1_ctx;
4774 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
4776 length = tvb_get_ntohs(tvb, offset + 1);
4778 target_id_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "Target Identification");
4779 ext_tree = proto_item_add_subtree(target_id_item, ett_gtp_target_id);
4780 offset = offset + 1;
4781 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4782 offset = offset + 2;
4783 next_tvb = tvb_new_subset(tvb, offset, length, length);
4784 dissect_ranap_TargetRNC_ID(next_tvb, 0, &asn1_ctx, ext_tree, hf_gtp_targetRNC_ID);
4790 /* GPRS: not present
4791 * UMTS: 29.060 v4.0, chapter 7.7.38
4793 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4797 proto_item *utran_cont_item;
4798 proto_tree *ext_tree;
4801 length = tvb_get_ntohs(tvb, offset + 1);
4803 utran_cont_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
4804 ext_tree = proto_item_add_subtree(utran_cont_item, ett_gtp_utran_cont);
4805 offset = offset + 1;
4806 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4807 offset = offset + 2;
4808 next_tvb = tvb_new_subset(tvb, offset, length, length);
4810 call_dissector(data_handle, next_tvb, pinfo, ext_tree);
4817 /* GPRS: not present
4818 * UMTS: 29.060 v4.0, chapter 7.7.39
4820 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4823 guint32 teid, addr_ipv4;
4826 struct e_in6_addr addr_ipv6;
4827 proto_tree *ext_tree_rab_setup;
4830 length = tvb_get_ntohs(tvb, offset + 1);
4831 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4833 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Radio Access Bearer Setup Information");
4834 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
4836 proto_tree_add_text(ext_tree_rab_setup, tvb, offset + 1, 2, "RAB setup length : %u", length);
4837 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, nsapi);
4841 teid = tvb_get_ntohl(tvb, offset + 4);
4843 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
4847 addr_ipv4 = tvb_get_ipv4(tvb, offset + 8);
4848 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, addr_ipv4);
4851 tvb_get_ipv6(tvb, offset + 8, &addr_ipv6);
4852 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, (guint8 *) & addr_ipv6);
4863 /* GPRS: not present
4864 * UMTS: 29.060 v4.0, chapter 7.7.40
4866 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4871 proto_tree *ext_tree_hdr_list;
4874 length = tvb_get_guint8(tvb, offset + 1);
4876 te = proto_tree_add_text(tree, tvb, offset, 2 + length, "%s", val_to_str_ext_const(GTP_EXT_HDR_LIST, >p_val_ext, "Unknown"));
4877 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4879 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4881 for (i = 0; i < length; i++) {
4882 hdr = tvb_get_guint8(tvb, offset + 2 + i);
4884 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 2 + i, 1, "No. %u --> Extension Header Type value : %s (%u)", i + 1,
4885 val_to_str_ext_const(hdr, >p_val_ext, "Unknown Extension Header Type"), hdr);
4891 /* GPRS: not present
4892 * UMTS: 29.060 v4.0, chapter 7.7.41
4893 * TODO: find TriggerID description
4895 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4900 length = tvb_get_ntohs(tvb, offset + 1);
4902 proto_tree_add_text(tree, tvb, offset, 3 + length, "%s length : %u", val_to_str_ext_const(GTP_EXT_TRIGGER_ID, >p_val_ext, "Unknown"), length);
4908 /* GPRS: not present
4909 * UMTS: 29.060 v4.0, chapter 7.7.42
4910 * TODO: find OMC-ID description
4912 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4917 length = tvb_get_ntohs(tvb, offset + 1);
4919 proto_tree_add_text(tree, tvb, offset, 3 + length, "%s length : %u", val_to_str_ext_const(GTP_EXT_OMC_ID, >p_val_ext, "Unknown"), length);
4925 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
4926 * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
4928 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4933 struct e_in6_addr addr_ipv6;
4934 proto_tree *ext_tree_chrg_addr;
4937 length = tvb_get_ntohs(tvb, offset + 1);
4939 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, >p_val_ext, "Unknown"));
4940 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
4942 proto_tree_add_text(ext_tree_chrg_addr, tvb, offset + 1, 2, "%s length : %u", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, >p_val_ext, "Unknown"), length);
4946 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4947 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4948 proto_tree_add_ipv4(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, addr_ipv4);
4951 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4952 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4953 proto_tree_add_ipv6(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
4956 proto_item_append_text(te, "unknown type or wrong length");
4964 * UMTS: 29.060 v6.11.0, chapter 7.7.44 RAN Transparent Container
4966 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4970 proto_tree *ext_tree;
4973 length = tvb_get_ntohs(tvb, offset + 1);
4974 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_RAN_TR_CONT, >p_val_ext, "Unknown"));
4975 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ran_tr_cont);
4978 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4979 offset = offset + 2;
4980 /* TODO add decoding of data */
4981 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4988 * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
4990 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4994 proto_tree *ext_tree;
4997 length = tvb_get_ntohs(tvb, offset + 1);
4998 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_PDP_CONT_PRIO, >p_val_ext, "Unknown"));
4999 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdp_cont_prio);
5002 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5003 offset = offset + 2;
5004 /* TODO add decoding of data */
5005 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5012 * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
5014 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5018 proto_tree *ext_tree;
5021 length = tvb_get_ntohs(tvb, offset + 1);
5022 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_ADD_RAB_SETUP_INF, >p_val_ext, "Unknown"));
5023 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rab_setup_inf);
5026 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5027 offset = offset + 2;
5028 /* TODO add decoding of data */
5029 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5037 * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
5039 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5043 proto_tree *ext_tree;
5046 length = tvb_get_ntohs(tvb, offset + 1);
5047 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_SSGN_NO, >p_val_ext, "Unknown"));
5048 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ssgn_no);
5051 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5052 offset = offset + 2;
5053 /* TODO add decoding of data */
5054 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5061 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
5063 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5067 proto_tree *ext_tree;
5070 length = tvb_get_ntohs(tvb, offset + 1);
5071 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_COMMON_FLGS, >p_val_ext, "Unknown"));
5072 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_common_flgs);
5075 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5076 offset = offset + 2;
5077 /* Upgrade QoS Supported */
5078 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, FALSE);
5079 /* NRSN bit field */
5080 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, FALSE);
5081 /* No QoS negotiation */
5082 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, FALSE);
5083 /* MBMS Counting Information bi */
5084 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, FALSE);
5085 /* RAN Procedures Ready */
5086 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, FALSE);
5087 /* MBMS Service Type */
5088 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, FALSE);
5089 /* Prohibit Payload Compression */
5090 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, FALSE);
5097 * UMTS: 29.060 v6.11.0, chapter 7.7.49
5099 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5103 proto_tree *ext_tree_apn_res;
5106 length = tvb_get_ntohs(tvb, offset + 1);
5107 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_APN_RES, >p_val_ext, "Unknown"));
5108 ext_tree_apn_res = proto_item_add_subtree(te, ett_gtp_ext_tree_apn_res);
5111 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5112 offset = offset + 2;
5114 /* Restriction Type value */
5116 proto_item *expert_item;
5117 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
5118 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
5119 PROTO_ITEM_SET_GENERATED(expert_item);
5123 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, FALSE);
5128 * UMTS: 29.060 v6.11.0, chapter 7.7.50
5130 * Type = 151 (Decimal)
5133 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5137 proto_tree *ext_tree_rat_type;
5140 length = tvb_get_ntohs(tvb, offset + 1);
5141 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RAT_TYPE, >p_val_ext, "Unknown"));
5142 ext_tree_rat_type = proto_item_add_subtree(te, ett_gtp_ext_rat_type);
5145 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5146 offset = offset + 2;
5148 /* RAT Type value */
5150 proto_item *expert_item;
5151 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
5152 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
5153 PROTO_ITEM_SET_GENERATED(expert_item);
5157 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, FALSE);
5163 * UMTS: 29.060 v6.11.0, chapter 7.7.51
5164 * User Location Information
5165 * Type = 152 (Decimal)
5168 static const gchar *dissect_radius_user_loc(proto_tree * tree, tvbuff_t * tvb)
5172 guint8 geo_loc_type;
5173 guint16 length = tvb_length(tvb);
5175 /* Geographic Location Type */
5176 proto_tree_add_item(tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5177 geo_loc_type = tvb_get_guint8(tvb, offset);
5180 if (geo_loc_type == 0)
5181 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5182 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 0);
5183 if (geo_loc_type == 1) {
5184 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5185 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 4);
5186 offset = offset + 5;
5187 proto_tree_add_item(tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5191 return tvb_bytes_to_str(tvb, 0, length);
5194 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5198 proto_tree *ext_tree;
5200 guint8 geo_loc_type;
5202 length = tvb_get_ntohs(tvb, offset + 1);
5203 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_USR_LOC_INF, >p_val_ext, "Unknown"));
5204 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_usr_loc_inf);
5207 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5208 offset = offset + 2;
5209 /* TODO add decoding of data */
5210 /* Geographic Location Type */
5211 proto_tree_add_item(ext_tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5212 geo_loc_type = tvb_get_guint8(tvb, offset);
5215 if (geo_loc_type == 0)
5216 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5217 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 0);
5218 if (geo_loc_type == 1) {
5219 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5220 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 4);
5221 offset = offset + 5;
5222 proto_tree_add_item(ext_tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5229 static const value_string daylight_saving_time_vals[] = {
5230 {0, "No adjustment"},
5231 {1, "+1 hour adjustment for Daylight Saving Time"},
5232 {2, "+2 hours adjustment for Daylight Saving Time"},
5238 * UMTS: 29.060 v6.11.0, chapter 7.7.52
5240 * Type = 153 (Decimal)
5241 * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
5242 * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
5243 * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
5244 * its value shall be set as defined in 3GPP TS 22.042
5246 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5250 proto_tree *ext_tree;
5255 length = tvb_get_ntohs(tvb, offset + 1);
5256 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s: ", val_to_str_ext_const(GTP_EXT_MS_TIME_ZONE, >p_val_ext, "Unknown"));
5257 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ms_time_zone);
5260 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5261 offset = offset + 2;
5263 /* 3GPP TS 23.040 version 6.6.0 Release 6
5264 * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
5266 * The Time Zone indicates the difference, expressed in quarters of an hour,
5267 * between the local time and GMT. In the first of the two semi-octets,
5268 * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
5269 * represents the algebraic sign of this difference (0: positive, 1: negative).
5272 data = tvb_get_guint8(tvb, offset);
5273 sign = (data & 0x08) ? '-' : '+';
5274 data = (data >> 4) + (data & 0x07) * 10;
5276 proto_tree_add_text(ext_tree, tvb, offset, 1, "Timezone: GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5277 proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5280 data = tvb_get_guint8(tvb, offset) & 0x3;
5281 proto_tree_add_text(ext_tree, tvb, offset, 1, "%s", val_to_str_const(data, daylight_saving_time_vals, "Unknown"));
5288 * UMTS: 29.060 v6.11.0, chapter 7.7.53
5289 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
5290 * Type = 154 (Decimal)
5292 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5296 proto_tree *ext_imeisv;
5299 const char *digit_str;
5301 length = tvb_get_ntohs(tvb, offset + 1);
5302 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_IMEISV, >p_val_ext, "Unknown"));
5303 ext_imeisv = proto_item_add_subtree(te, ett_gtp_ext_imeisv);
5306 proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5307 offset = offset + 2;
5310 * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
5311 * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
5312 * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
5313 * set to '1111'. Both IMEI and IMEISV are BCD encoded.
5315 next_tvb = tvb_new_subset(tvb, offset, length, length);
5316 digit_str = unpack_digits(next_tvb, 0);
5317 proto_tree_add_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, digit_str);
5318 proto_item_append_text(te, ": %s", digit_str);
5324 * UMTS: 29.060 v6.11.0, chapter 7.7.54
5325 * CAMEL Charging Information Container
5326 * Type = 155 (Decimal)
5328 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5332 proto_tree *ext_tree;
5335 length = tvb_get_ntohs(tvb, offset + 1);
5336 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CAMEL_CHG_INF_CON, >p_val_ext, "Unknown"));
5337 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_camel_chg_inf_con);
5340 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5341 offset = offset + 2;
5342 /* TODO add decoding of data */
5343 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5350 * UMTS: 29.060 v6.11.0, chapter 7.7.55
5353 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5357 proto_tree *ext_tree;
5360 length = tvb_get_ntohs(tvb, offset + 1);
5361 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_UE_CTX, >p_val_ext, "Unknown"));
5362 ext_tree = proto_item_add_subtree(te, ett_GTP_EXT_MBMS_UE_CTX);
5365 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5366 offset = offset + 2;
5367 /* TODO add decoding of data */
5368 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5375 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
5376 * Temporary Mobile Group Identity (TMGI)
5377 * The Temporary Mobile Group Identity (TMGI) information element contains
5378 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
5379 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
5382 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5386 proto_tree *ext_tree, *tmgi_tree;
5387 proto_item *te, *ti;
5390 length = tvb_get_ntohs(tvb, offset + 1);
5391 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_TMGI, >p_val_ext, "Unknown"));
5392 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_tmgi);
5395 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5396 offset = offset + 2;
5398 ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, FALSE);
5400 tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
5401 next_tvb = tvb_new_subset(tvb, offset, length, length);
5402 de_mid(next_tvb, tmgi_tree, 0, length, NULL, 0);
5408 * UMTS: 29.060 v6.11.0, chapter 7.7.57
5409 * RIM Routing Address
5411 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5415 proto_tree *ext_tree;
5418 length = tvb_get_ntohs(tvb, offset + 1);
5419 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RIM_RA, >p_val_ext, "Unknown"));
5420 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rim_ra);
5423 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5424 offset = offset + 2;
5425 /* TODO add decoding of data */
5426 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5428 * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
5436 * UMTS: 29.060 v6.11.0, chapter 7.7.58
5437 * MBMS Protocol Configuration Options
5439 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5443 proto_tree *ext_tree;
5446 length = tvb_get_ntohs(tvb, offset + 1);
5447 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_PROT_CONF_OPT, >p_val_ext, "Unknown"));
5448 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_prot_conf_opt);
5451 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5452 offset = offset + 2;
5453 /* TODO add decoding of data */
5454 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5461 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
5462 * MBMS Session Duration
5464 /* Used for Diameter */
5465 static int dissect_gtp_mbms_ses_dur(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5470 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5471 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5477 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5481 proto_tree *ext_tree;
5484 length = tvb_get_ntohs(tvb, offset + 1);
5485 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SES_DUR, >p_val_ext, "Unknown"));
5486 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bms_ses_dur);
5489 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5490 offset = offset + 2;
5491 /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
5492 * The MBMS Session Duration information element indicates the estimated
5493 * session duration of the MBMS service data transmission if available.
5494 * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
5495 * in 3GPP TS 29.061 [27], excluding the AVP Header fields
5496 * (as defined in IETF RFC 3588 [36], section 4.1).
5498 /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
5499 * with a length of three octets and indicates the estimated session duration
5500 * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
5501 * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
5502 * for which the maximum allowed value is 18 days. For the whole session duration the seconds
5503 * and days are added together and the maximum session duration is 19 days.
5505 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5506 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5513 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
5516 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5520 proto_tree *ext_tree;
5521 proto_item *te, *item;
5522 guint8 no_of_mbms_sa_codes;
5525 length = tvb_get_ntohs(tvb, offset + 1);
5526 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SA, >p_val_ext, "Unknown"));
5527 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_sa);
5530 item = proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5531 offset = offset + 2;
5532 /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
5533 * The MBMS Service Area information element indicates the area over
5534 * which the Multimedia Broadcast/Multicast Service is to be distributed.
5535 * The payload shall be encoded as per the MBMS-Service-Area AVP defined
5536 * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
5537 * IETF RFC 3588 [36], section 4.1).
5539 /* Number N of MBMS service area codes coded as:
5540 * 1 binary value is '00000000'
5542 * 256 binary value is '11111111'
5544 no_of_mbms_sa_codes = tvb_get_guint8(tvb, offset) + 1;
5545 if (length != ((no_of_mbms_sa_codes << 1) + 1)) {
5546 expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_WARN,
5547 "Wrong length: %u. The length of an MBMS service area code is 2 octets", length);
5549 proto_tree_add_uint(ext_tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
5551 /* A consecutive list of N MBMS service area codes
5552 * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
5553 * The length of an MBMS service area code is 2 octets.
5555 for (i = 0; i < no_of_mbms_sa_codes; i++) {
5556 proto_tree_add_item(ext_tree, hf_gtp_mbms_sa_code, tvb, offset, 2, FALSE);
5557 offset = offset + 2;
5565 * UMTS: 29.060 v6.11.0, chapter 7.7.61
5566 * Source RNC PDCP context info
5568 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5572 proto_tree *ext_tree;
5575 length = tvb_get_ntohs(tvb, offset + 1);
5576 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SRC_RNC_PDP_CTX_INF, >p_val_ext, "Unknown"));
5577 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_src_rnc_pdp_ctx_inf);
5580 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5581 offset = offset + 2;
5582 /* TODO add decoding of data */
5583 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5590 * UMTS: 29.060 v6.11.0, chapter 7.7.62
5591 * Additional Trace Info
5593 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5597 proto_tree *ext_tree;
5600 length = tvb_get_ntohs(tvb, offset + 1);
5601 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_TRS_INF, >p_val_ext, "Unknown"));
5602 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_add_trs_inf);
5605 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5606 offset = offset + 2;
5607 /* TODO add decoding of data */
5608 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5615 * UMTS: 29.060 v6.11.0, chapter 7.7.63
5618 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5622 proto_tree *ext_tree;
5625 length = tvb_get_ntohs(tvb, offset + 1);
5626 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_HOP_COUNT, >p_val_ext, "Unknown"));
5627 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_hop_count);
5630 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5631 offset = offset + 2;
5632 /* TODO add decoding of data */
5633 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5640 * UMTS: 29.060 v6.11.0, chapter 7.7.64
5643 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5647 proto_tree *ext_tree;
5650 length = tvb_get_ntohs(tvb, offset + 1);
5651 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SEL_PLMN_ID, >p_val_ext, "Unknown"));
5652 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_sel_plmn_id);
5655 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5656 offset = offset + 2;
5657 /* TODO add decoding of data */
5658 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5665 * UMTS: 29.060 v6.11.0, chapter 7.7.65
5666 * MBMS Session Identifier
5668 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5672 proto_tree *ext_tree;
5675 length = tvb_get_ntohs(tvb, offset + 1);
5676 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SES_ID, >p_val_ext, "Unknown"));
5677 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id);
5680 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5681 offset = offset + 2;
5682 /* TODO add decoding of data */
5683 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5690 * UMTS: 29.060 v6.11.0, chapter 7.7.66
5691 * MBMS 2G/3G Indicator
5693 static const value_string gtp_mbs_2g_3g_ind_vals[] = {
5696 {2, "Both 2G and 3G"},
5700 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5704 proto_tree *ext_tree;
5707 length = tvb_get_ntohs(tvb, offset + 1);
5708 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_2G_3G_IND, >p_val_ext, "Unknown"));
5709 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_2g_3g_ind);
5712 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5713 offset = offset + 2;
5714 /* MBMS 2G/3G Indicator */
5715 proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, FALSE);
5722 * UMTS: 29.060 v6.11.0, chapter 7.7.67
5725 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5729 proto_tree *ext_tree;
5732 length = tvb_get_ntohs(tvb, offset + 1);
5733 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ENH_NSAPI, >p_val_ext, "Unknown"));
5734 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_enh_nsapi);
5737 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5738 offset = offset + 2;
5739 /* TODO add decoding of data */
5740 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5747 * UMTS: 29.060 v6.11.0, chapter 7.7.68
5748 * Additional MBMS Trace Info
5750 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5754 proto_tree *ext_tree;
5757 length = tvb_get_ntohs(tvb, offset + 1);
5758 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_MBMS_TRS_INF, >p_val_ext, "Unknown"));
5759 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ad_mbms_trs_inf);
5762 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5763 offset = offset + 2;
5764 /* TODO add decoding of data */
5765 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5772 * UMTS: 29.060 v6.11.0, chapter 7.7.69
5773 * MBMS Session Identity Repetition Number
5775 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5779 proto_tree *ext_tree;
5782 length = tvb_get_ntohs(tvb, offset + 1);
5783 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SES_ID_REP_NO, >p_val_ext, "Unknown"));
5784 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id_rep_no);
5787 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5788 offset = offset + 2;
5789 /* TODO add decoding of data */
5790 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5797 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
5798 * MBMS Time To Data Transfer
5800 /* Used for Diameter */
5801 static int dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5805 guint8 time_2_dta_tr;
5807 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5808 proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5814 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5818 proto_tree *ext_tree;
5820 guint8 time_2_dta_tr;
5822 length = tvb_get_ntohs(tvb, offset + 1);
5823 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_TIME_TO_DATA_TR, >p_val_ext, "Unknown"));
5824 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_time_to_data_tr);
5827 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5828 offset = offset + 2;
5829 /* TODO add decoding of data
5830 * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
5831 * The MBMS Time To Data Transfer information element contains a
5832 * MBMS Time To Data Transfer allocated by the BM-SC.
5833 * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
5834 * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
5835 * (as defined in IETF RFC 3588 [36], section 4.1).
5837 /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
5838 * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
5841 * 0 0 0 0 0 0 0 0 1s
5842 * 0 0 0 0 0 0 0 1 2s
5843 * 0 0 0 0 0 0 1 0 3s
5845 * 1 1 1 1 1 1 1 1 256s
5847 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5848 proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5855 * UMTS: 29.060 v6.11.0, chapter 7.7.71
5856 * PS Handover Request Context
5859 decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5863 proto_tree *ext_tree;
5866 length = tvb_get_ntohs(tvb, offset + 1);
5867 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PS_HO_REQ_CTX, >p_val_ext, "Unknown"));
5868 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_ho_req_ctx);
5871 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5872 offset = offset + 2;
5873 /* TODO add decoding of data */
5874 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5881 * UMTS: 29.060 v6.11.0, chapter 7.7.72
5885 decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5889 proto_tree *ext_tree;
5892 length = tvb_get_ntohs(tvb, offset + 1);
5893 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSS_CONT, >p_val_ext, "Unknown"));
5894 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bss_cont);
5897 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5898 offset = offset + 2;
5899 /* TODO add decoding of data */
5900 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5902 * The content of this container is defined in 3GPP TS 48.018
5910 * UMTS: 29.060 v6.11.0, chapter 7.7.73
5911 * Cell Identification
5914 decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5918 proto_tree *ext_tree;
5921 length = tvb_get_ntohs(tvb, offset + 1);
5922 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CELL_ID, >p_val_ext, "Unknown"));
5923 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_cell_id);
5926 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5927 offset = offset + 2;
5928 /* TODO add decoding of data */
5929 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5931 * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
5932 * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
5934 * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
5935 * source RNC (RNC-ID) as defined in 3GPP TS 48.018
5943 * UMTS: 29.060 v6.11.0, chapter 7.7.74
5947 decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5951 proto_tree *ext_tree;
5954 length = tvb_get_ntohs(tvb, offset + 1);
5955 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PDU_NO, >p_val_ext, "Unknown"));
5956 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
5959 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5960 offset = offset + 2;
5961 /* TODO add decoding of data */
5962 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5969 * UMTS: 29.060 v6.11.0, chapter 7.7.75
5973 decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5977 proto_tree *ext_tree;
5980 length = tvb_get_ntohs(tvb, offset + 1);
5981 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, >p_val_ext, "Unknown"));
5982 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
5985 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5986 offset = offset + 2;
5989 * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
5991 proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 2, FALSE);
5998 * Required MBMS bearer capabilities 7.7.76
6001 decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6004 proto_tree *ext_tree;
6007 length = tvb_get_ntohs(tvb, offset + 1);
6008 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, >p_val_ext, "Unknown"));
6009 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
6012 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6013 offset = offset + 2;
6014 /* The payload shall be encoded as per the
6015 * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
6016 * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
6018 /* TODO Add decoding (call Diameter dissector???) */
6023 * RIM Routing Address Discriminator 7.7.77
6026 decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6030 proto_tree *ext_tree;
6033 length = tvb_get_ntohs(tvb, offset + 1);
6034 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RIM_ROUTING_ADDR_DISC, >p_val_ext, "Unknown"));
6035 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6038 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6039 offset = offset + 2;
6040 /* TODO add decoding of data */
6041 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6047 * List of set-up PFCs 7.7.78
6050 decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6054 proto_tree *ext_tree;
6057 length = tvb_get_ntohs(tvb, offset + 1);
6058 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_LIST_OF_SETUP_PFCS, >p_val_ext, "Unknown"));
6059 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6062 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6063 offset = offset + 2;
6064 /* TODO add decoding of data */
6065 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6071 * PS Handover XID Parameters 7.7.79
6073 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6077 proto_tree *ext_tree;
6083 length = tvb_get_ntohs(tvb, offset + 1);
6084 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PS_HANDOVER_XIP_PAR, >p_val_ext, "Unknown"));
6085 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_handover_xid);
6088 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6089 offset = offset + 2;
6091 sapi = tvb_get_guint8(tvb, offset) & 0x0F;
6092 proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
6095 xid_par_len = tvb_get_guint8(tvb, offset);
6096 proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
6099 if (sndcpxid_handle) {
6100 next_tvb = tvb_new_subset_remaining(tvb, offset);
6101 call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
6103 proto_tree_add_text(tree, tvb, offset, 0, "Data");
6110 * MS Info Change Reporting Action 7.7.80
6112 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6116 proto_tree *ext_tree;
6119 length = tvb_get_ntohs(tvb, offset + 1);
6120 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MS_INF_CHG_REP_ACT, >p_val_ext, "Unknown"));
6121 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6124 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6125 offset = offset + 2;
6126 /* TODO add decoding of data */
6127 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6133 * Direct Tunnel Flags 7.7.81
6135 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6139 proto_tree *ext_tree;
6142 length = tvb_get_ntohs(tvb, offset + 1);
6143 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_DIRECT_TUNNEL_FLGS, >p_val_ext, "Unknown"));
6144 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6147 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6148 offset = offset + 2;
6149 /* TODO add decoding of data */
6150 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6151 proto_tree_add_item(ext_tree, hf_gtp_ext_ei, tvb, offset, 1, FALSE);
6152 proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, FALSE);
6153 proto_tree_add_item(ext_tree, hf_gtp_ext_dti, tvb, offset, 1, FALSE);
6160 * Correlation-ID 7.7.82
6162 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6166 proto_tree *ext_tree;
6169 length = tvb_get_ntohs(tvb, offset + 1);
6170 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CORRELATION_ID, >p_val_ext, "Unknown"));
6171 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6174 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6175 offset = offset + 2;
6176 /* TODO add decoding of data */
6177 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6183 * Bearer Control Mode 7.7.83
6185 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6189 proto_tree *ext_tree;
6192 length = tvb_get_ntohs(tvb, offset + 1);
6193 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BEARER_CONTROL_MODE, >p_val_ext, "Unknown"));
6194 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6197 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6198 offset = offset + 2;
6199 /* TODO add decoding of data */
6200 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6208 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6211 guint16 length, n, number;
6212 proto_tree *ext_tree_rel_pack;
6215 length = tvb_get_ntohs(tvb, offset + 1);
6217 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
6218 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
6222 while (n < length) {
6224 number = tvb_get_ntohs(tvb, offset + 3 + n);
6225 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
6236 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6239 guint16 length, n, number;
6240 proto_tree *ext_tree_can_pack;
6243 length = tvb_get_ntohs(tvb, offset + 1);
6245 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
6246 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
6250 while (n < length) {
6252 number = tvb_get_ntohs(tvb, offset + 3 + n);
6253 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
6260 /* CDRs dissector */
6261 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6264 guint16 length, format_ver;
6266 proto_tree *ext_tree;
6270 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_DATA_REQ, >p_val_ext, "Unknown message"));
6271 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
6273 length = tvb_get_ntohs(tvb, offset + 1);
6274 no = tvb_get_guint8(tvb, offset + 3);
6275 format = tvb_get_guint8(tvb, offset + 4);
6276 format_ver = tvb_get_ntohs(tvb, offset + 5);
6278 proto_tree_add_text(ext_tree, tvb, offset + 1, 2, "Length: %u", length);
6279 proto_tree_add_text(ext_tree, tvb, offset + 3, 1, "Number of data records: %u", no);
6280 proto_tree_add_text(ext_tree, tvb, offset + 4, 1, "Data record format: %u", format);
6281 proto_tree_add_text(ext_tree, tvb, offset + 5, 2, "Data record format version: %u", format_ver);
6283 if (gtpcdr_handle) {
6284 next_tvb = tvb_new_subset_remaining(tvb, offset);
6285 call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
6287 proto_tree_add_text(tree, tvb, offset, 0, "Data");
6295 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6298 guint16 length, n, number;
6299 proto_tree *ext_tree_data_resp;
6302 length = tvb_get_ntohs(tvb, offset + 1);
6304 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
6305 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
6309 while (n < length) {
6311 number = tvb_get_ntohs(tvb, offset + 3 + n);
6312 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
6324 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6329 struct e_in6_addr addr_ipv6;
6330 proto_tree *ext_tree_node_addr;
6333 length = tvb_get_ntohs(tvb, offset + 1);
6335 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Node address: ");
6336 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
6338 proto_tree_add_text(ext_tree_node_addr, tvb, offset + 1, 2, "Node address length: %u", length);
6342 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
6343 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
6344 proto_tree_add_ipv4(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, addr_ipv4);
6347 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
6348 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
6349 proto_tree_add_ipv6(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
6352 proto_item_append_text(te, "unknown type or wrong length");
6360 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
6361 * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
6365 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6368 guint16 length, ext_id;
6369 proto_tree *ext_tree_priv_ext;
6372 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_PRIV_EXT, >p_val_ext, "Unknown message"));
6373 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
6376 length = tvb_get_ntohs(tvb, offset);
6377 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6378 offset = offset + 2;
6380 ext_id = tvb_get_ntohs(tvb, offset);
6381 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
6382 offset = offset + 2;
6385 * XXX - is this always a text string? Or should it be
6386 * displayed as hex data?
6389 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, FALSE);
6395 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6398 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
6400 return tvb_length_remaining(tvb, offset);
6403 static void dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6405 struct _gtp_hdr gtp_hdr;
6406 proto_tree *gtp_tree, *flags_tree;
6407 proto_item *ti, *tf;
6408 int i, offset, length, gtp_prime, checked_field, mandatory;
6409 int seq_no=0, flow_label=0;
6410 guint8 pdu_no, next_hdr = 0, ext_hdr_val;
6411 const guint8 *tid_val;
6415 guint8 sub_proto, acfield_len = 0, control_field;
6416 gtp_msg_hash_t *gcrp=NULL;
6417 conversation_t *conversation=NULL;
6418 gtp_conv_info_t *gtp_info=(gtp_conv_info_t *)pinfo->private_data;
6422 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
6423 col_clear(pinfo->cinfo, COL_INFO);
6426 * Do we have a conversation for this connection?
6428 conversation = find_or_create_conversation(pinfo);
6431 * Do we already know this conversation?
6433 gtp_info = conversation_get_proto_data(conversation, proto_gtp);
6434 if (gtp_info == NULL) {
6435 /* No. Attach that information to the conversation, and add
6436 * it to the list of information structures.
6438 gtp_info = g_malloc(sizeof(gtp_conv_info_t));
6439 /*Request/response matching tables*/
6440 gtp_info->matched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_matched);
6441 gtp_info->unmatched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_unmatched);
6443 conversation_add_proto_data(conversation, proto_gtp, gtp_info);
6445 gtp_info->next = gtp_info_items;
6446 gtp_info_items = gtp_info;
6448 pd_save = pinfo->private_data;
6449 pinfo->private_data = gtp_info;
6451 tvb_memcpy(tvb, (guint8 *) & gtp_hdr, 0, 4);
6453 if (!(gtp_hdr.flags & 0x10))
6458 switch ((gtp_hdr.flags >> 5) & 0x07) {
6470 col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(gtp_hdr.message, &message_type_ext, "Unknown"));
6473 ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, FALSE);
6474 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
6476 tf = proto_tree_add_uint(gtp_tree, hf_gtp_flags, tvb, 0, 1, gtp_hdr.flags);
6477 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
6480 proto_tree_add_uint(flags_tree, hf_gtp_flags_ver, tvb, 0, 1, gtp_hdr.flags);
6482 proto_tree_add_uint(flags_tree, hf_gtp_prime_flags_ver, tvb, 0, 1, gtp_hdr.flags);
6485 proto_tree_add_uint(flags_tree, hf_gtp_flags_pt, tvb, 0, 1, gtp_hdr.flags);
6487 if((gtp_prime==1)||(gtp_version==0)){
6488 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare1, tvb, 0, 1, gtp_hdr.flags);
6489 proto_tree_add_boolean(flags_tree, hf_gtp_flags_snn, tvb, 0, 1, gtp_hdr.flags);
6491 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare2, tvb, 0, 1, gtp_hdr.flags);
6492 proto_tree_add_boolean(flags_tree, hf_gtp_flags_e, tvb, 0, 1, gtp_hdr.flags);
6493 proto_tree_add_boolean(flags_tree, hf_gtp_flags_s, tvb, 0, 1, gtp_hdr.flags);
6494 proto_tree_add_boolean(flags_tree, hf_gtp_flags_pn, tvb, 0, 1, gtp_hdr.flags);
6497 proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, 1, 1, gtp_hdr.message);
6499 gtp_hdr.length = g_ntohs(gtp_hdr.length);
6500 proto_tree_add_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, gtp_hdr.length);
6505 seq_no = tvb_get_ntohs(tvb, offset);
6506 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6509 switch (gtp_version) {
6511 seq_no = tvb_get_ntohs(tvb, offset);
6512 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6515 flow_label = tvb_get_ntohs(tvb, offset);
6516 proto_tree_add_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
6519 pdu_no = tvb_get_guint8(tvb, offset);
6520 proto_tree_add_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
6523 tid_val = tvb_get_ptr(tvb, offset, 8);
6524 tid_str = id_to_str(tid_val);
6525 proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
6529 teid = tvb_get_ntohl(tvb, offset);
6530 proto_tree_add_uint(gtp_tree, hf_gtp_teid, tvb, offset, 4, teid);
6533 if (gtp_hdr.flags & 0x07) {
6534 seq_no = tvb_get_ntohs(tvb, offset);
6535 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6538 pdu_no = tvb_get_guint8(tvb, offset);
6539 proto_tree_add_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, pdu_no);
6542 next_hdr = tvb_get_guint8(tvb, offset);
6543 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6552 if (gtp_hdr.message != GTP_MSG_TPDU) {
6553 /* TODO: This code should be cleaned up to handle more than one
6554 * header and possibly display the header content */
6559 /* MBMS support indication */
6560 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MBMS support indication header ---]");
6564 /* MS Info Change Reporting support indication */
6565 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MS Info Change Reporting support indication header ---]");
6569 /* PDCP PDU number */
6570 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- PDCP PDU number header ---]");
6574 /* Suspend Request */
6575 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Request header ---]");
6579 /* Suspend Response */
6580 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Response header ---]");
6584 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Unknown extension header ---]");
6588 next_hdr = tvb_get_guint8(tvb, offset);
6589 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6592 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[--- end of GTP header, beginning of extension headers ---]");
6593 length = tvb_length(tvb);
6594 mandatory = 0; /* check order of GTP fields against ETSI */
6596 if (offset >= length)
6599 ext_hdr_val = next_hdr;
6602 ext_hdr_val = tvb_get_guint8(tvb, offset);
6603 if (g_gtp_etsi_order) {
6604 checked_field = check_field_presence(gtp_hdr.message, ext_hdr_val, (int *) &mandatory);
6605 switch (checked_field) {
6607 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] message not found");
6610 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] field not present");
6615 proto_tree_add_text(gtp_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s",
6616 val_to_str_ext_const(checked_field, >p_val_ext, "Unknown extension field"));
6622 while (gtpopt[++i].optcode)
6623 if (gtpopt[i].optcode == ext_hdr_val)
6625 offset = offset + (*gtpopt[i].decode) (tvb, offset, pinfo, gtp_tree);
6628 /*Use sequence number to track Req/Resp pairs*/
6630 gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr.message);
6631 /*pass packet to tap for response time reporting*/
6633 tap_queue_packet(gtp_tap,pinfo,gcrp);
6637 proto_item_set_len (ti, offset);
6640 if ((gtp_hdr.message == GTP_MSG_TPDU) && g_gtp_tpdu) {
6644 else if (gtp_version == 1) {
6645 if (gtp_hdr.flags & 0x07) {
6647 if (tvb_get_guint8(tvb, offset) == 0)
6654 sub_proto = tvb_get_guint8(tvb, offset);
6656 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
6657 /* this is most likely an IPv4 packet
6658 * we can exclude 0x40 - 0x44 because the minimum header size is 20 octets
6659 * 0x4f is excluded because PPP protocol type "IPv6 header compression"
6660 * with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
6662 next_tvb = tvb_new_subset_remaining(tvb, offset);
6663 call_dissector(ip_handle, next_tvb, pinfo, tree);
6665 } else if ((sub_proto & 0xf0) == 0x60) {
6666 /* this is most likely an IPv6 packet */
6667 next_tvb = tvb_new_subset_remaining(tvb, offset);
6668 call_dissector(ipv6_handle, next_tvb, pinfo, tree);
6670 /* this seems to be a PPP packet */
6672 if (sub_proto == 0xff) {
6673 /* this might be an address field, even it shouldn't be here */
6674 control_field = tvb_get_guint8(tvb, offset + 1);
6675 if (control_field == 0x03)
6676 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
6680 next_tvb = tvb_new_subset_remaining(tvb, offset + acfield_len);
6681 call_dissector(ppp_handle, next_tvb, pinfo, tree);
6684 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <");
6685 col_append_str(pinfo->cinfo, COL_PROTOCOL, ">");
6687 pinfo->private_data = pd_save;
6690 static void dissect_gtpprim(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6693 dissect_gtp_common(tvb, pinfo, tree);
6696 static void dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6700 * If this is GTPv2-C call the gtpv2 dissector if present
6701 * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
6703 version = tvb_get_guint8(tvb,0)>>5;
6705 /* GTPv2-C 3GPP TS 29.274 */
6707 call_dissector(gtpv2_handle, tvb, pinfo, tree);
6712 proto_tree_add_text(tree, tvb, 0, -1, "No WS dissector for GTP version %u %s", version,
6713 val_to_str_const(version, ver_types, "Unknown"));
6717 dissect_gtp_common(tvb, pinfo, tree);
6722 static const true_false_string yes_no_tfs = {
6727 static void gtp_reinit(void)
6729 gtp_conv_info_t *gtp_info;
6731 /* Free up state attached to the gtp_info structures */
6732 for (gtp_info = gtp_info_items; gtp_info != NULL; ) {
6733 gtp_conv_info_t *next;
6735 g_hash_table_destroy(gtp_info->matched);
6736 gtp_info->matched=NULL;
6737 g_hash_table_destroy(gtp_info->unmatched);
6738 gtp_info->unmatched=NULL;
6740 next = gtp_info->next;
6745 gtp_info_items = NULL;
6748 void proto_register_gtp(void)
6750 static hf_register_info hf_gtp[] = {
6752 {&hf_gtp_response_in,
6753 {"Response In", "gtp.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this GTP request is in this frame", HFILL}},
6754 {&hf_gtp_response_to,
6755 {"Response To", "gtp.response_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the GTP request in this frame", HFILL}},
6756 {&hf_gtp_time, {"Time", "gtp.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL}},
6757 {&hf_gtp_apn, {"APN", "gtp.apn", FT_STRING, BASE_NONE, NULL, 0, "Access Point Name", HFILL}},
6758 {&hf_gtp_cause, {"Cause", "gtp.cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0, "Cause of operation", HFILL}},
6759 {&hf_gtp_chrg_char, {"Charging characteristics", "gtp.chrg_char", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}},
6760 {&hf_gtp_chrg_char_s, {"Spare", "gtp.chrg_char_s", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, NULL, HFILL}},
6761 {&hf_gtp_chrg_char_n, {"Normal charging", "gtp.chrg_char_n", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, NULL, HFILL}},
6762 {&hf_gtp_chrg_char_p, {"Prepaid charging", "gtp.chrg_char_p", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, NULL, HFILL}},
6763 {&hf_gtp_chrg_char_f,
6764 {"Flat rate charging", "gtp.chrg_char_f", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, NULL, HFILL}},
6765 {&hf_gtp_chrg_char_h,
6766 {"Hot billing charging", "gtp.chrg_char_h", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, NULL, HFILL}},
6767 {&hf_gtp_chrg_char_r, {"Reserved", "gtp.chrg_char_r", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, NULL, HFILL}},
6768 {&hf_gtp_chrg_id, {"Charging ID", "gtp.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
6769 {&hf_gtp_chrg_ipv4, {"CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Charging Gateway address IPv4", HFILL}},
6770 {&hf_gtp_chrg_ipv6, {"CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Charging Gateway address IPv6", HFILL}},
6771 {&hf_gtp_ext_flow_label, {"Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL}},
6772 {&hf_gtp_ext_id, {"Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, NULL, HFILL}},
6773 {&hf_gtp_ext_val, {"Extension value", "gtp.ext_val", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}},
6774 {&hf_gtp_flags, {"Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL}},
6776 {"Version", "gtp.flags.version",
6777 FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
6778 "GTP Version", HFILL}
6780 {&hf_gtp_prime_flags_ver,
6781 {"Version", "gtp.prim.flags.version",
6782 FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK,
6783 "GTP' Version", HFILL}
6786 {"Protocol type", "gtp.flags.payload",
6787 FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
6790 {&hf_gtp_flags_spare1,
6791 {"Reserved", "gtp.flags.reserved",
6792 FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
6793 "Reserved (shall be sent as '111' )", HFILL}
6796 {"Is SNDCP N-PDU included?", "gtp.flags.snn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_SNN_MASK,
6797 "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}},
6798 {&hf_gtp_flags_spare2,
6799 {"Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, "Reserved (shall be sent as '1' )", HFILL}},
6801 {"Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_E_MASK,
6802 "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}},
6804 {"Is Sequence Number present?", "gtp.flags.s", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_S_MASK, "Is Sequence Number present? (1 = yes, 0 = no)",
6807 {"Is N-PDU number present?", "gtp.flags.pn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_PN_MASK, "Is N-PDU number present? (1 = yes, 0 = no)",
6809 {&hf_gtp_flow_ii, {"Flow Label Data II", "gtp.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL}},
6810 {&hf_gtp_flow_label, {"Flow label", "gtp.flow_label", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6811 {&hf_gtp_flow_sig, {"Flow label Signalling", "gtp.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6812 {&hf_gtp_gsn_addr_len,
6813 {"GSN Address Length", "gtp.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, NULL, HFILL}},
6814 {&hf_gtp_gsn_addr_type,
6815 {"GSN Address Type", "gtp.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, NULL, HFILL}},
6816 {&hf_gtp_gsn_ipv4, {"GSN address IPv4", "gtp.gsn_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
6817 {&hf_gtp_gsn_ipv6, {"GSN address IPv6", "gtp.gsn_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
6818 {&hf_gtp_imsi, {"IMSI", "gtp.imsi", FT_STRING, BASE_NONE, NULL, 0, "International Mobile Subscriber Identity number", HFILL}},
6819 {&hf_gtp_length, {"Length", "gtp.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL}},
6820 {&hf_gtp_map_cause, {"MAP cause", "gtp.map_cause", FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0, NULL, HFILL}},
6821 {&hf_gtp_message_type, {"Message Type", "gtp.message", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &message_type_ext, 0x0, "GTP Message Type", HFILL}},
6823 {"MS not reachable reason", "gtp.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, NULL, HFILL}},
6824 {&hf_gtp_ms_valid, {"MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6825 {&hf_gtp_msisdn, {"MSISDN", "gtp.msisdn", FT_STRING, BASE_NONE, NULL, 0, "MS international PSTN/ISDN number", HFILL}},
6827 {"Next extension header type", "gtp.next", FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, NULL,
6829 {&hf_gtp_node_ipv4, {"Node address IPv4", "gtp.node_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Recommended node address IPv4", HFILL}},
6830 {&hf_gtp_node_ipv6, {"Node address IPv6", "gtp.node_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Recommended node address IPv6", HFILL}},
6831 {&hf_gtp_npdu_number, {"N-PDU Number", "gtp.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
6832 {&hf_gtp_nsapi, {"NSAPI", "gtp.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL}},
6833 {&hf_gtp_qos_version, {"Version", "gtp.qos_version", FT_STRING, BASE_NONE, NULL, 0, "Version of the QoS Profile", HFILL}},
6834 {&hf_gtp_qos_spare1, {"Spare", "gtp.qos_spare1", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK, "Spare (shall be sent as '00' )", HFILL}},
6836 {"QoS delay", "gtp.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL}},
6837 {&hf_gtp_qos_reliability,
6838 {"QoS reliability", "gtp.qos_reliability", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
6839 "Quality of Service Reliability Class", HFILL}},
6841 {"QoS peak", "gtp.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL}},
6842 {&hf_gtp_qos_spare2, {"Spare", "gtp.qos_spare2", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK, "Spare (shall be sent as 0)", HFILL}},
6843 {&hf_gtp_qos_precedence,
6844 {"QoS precedence", "gtp.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
6845 "Quality of Service Precedence Class", HFILL}},
6846 {&hf_gtp_qos_spare3,
6847 {"Spare", "gtp.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL}},
6849 {"QoS mean", "gtp.qos_mean", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_mean_type_ext, GTP_EXT_QOS_MEAN_MASK, "Quality of Service Mean Throughput", HFILL}},
6850 {&hf_gtp_qos_al_ret_priority,
6851 {"Allocation/Retention priority", "gtp.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6852 {&hf_gtp_qos_traf_class,
6853 {"Traffic class", "gtp.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, NULL, HFILL}},
6854 {&hf_gtp_qos_del_order,
6855 {"Delivery order", "gtp.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, NULL, HFILL}},
6856 {&hf_gtp_qos_del_err_sdu,
6857 {"Delivery of erroneous SDU", "gtp.qos_del_err_sdu", FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK,
6859 {&hf_gtp_qos_max_sdu_size,
6860 {"Maximum SDU size", "gtp.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, NULL, HFILL}},
6861 {&hf_gtp_qos_max_ul,
6862 {"Maximum bit rate for uplink", "gtp.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, NULL, HFILL}},
6863 {&hf_gtp_qos_max_dl,
6864 {"Maximum bit rate for downlink", "gtp.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, NULL, HFILL}},
6865 {&hf_gtp_qos_res_ber,
6866 {"Residual BER", "gtp.qos_res_ber", FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK, "Residual Bit Error Rate", HFILL}},
6867 {&hf_gtp_qos_sdu_err_ratio,
6868 {"SDU Error ratio", "gtp.qos_sdu_err_ratio", FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK, NULL,
6870 {&hf_gtp_qos_trans_delay,
6871 {"Transfer delay", "gtp.qos_trans_delay", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_trans_delay_ext, GTP_EXT_QOS_TRANS_DELAY_MASK, NULL, HFILL}},
6872 {&hf_gtp_qos_traf_handl_prio,
6873 {"Traffic handling priority", "gtp.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
6875 {&hf_gtp_qos_guar_ul,
6876 {"Guaranteed bit rate for uplink", "gtp.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, NULL, HFILL}},
6877 {&hf_gtp_qos_guar_dl,
6878 {"Guaranteed bit rate for downlink", "gtp.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, NULL,
6880 {&hf_gtp_qos_src_stat_desc,
6881 {"Source Statistics Descriptor", "gtp.src_stat_desc", FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), GTP_EXT_QOS_SRC_STAT_DESC_MASK, NULL, HFILL}},
6882 {&hf_gtp_qos_sig_ind,
6883 {"Signalling Indication", "gtp.sig_ind", FT_BOOLEAN, 8, TFS(>p_sig_ind), GTP_EXT_QOS_SIG_IND_MASK, NULL, HFILL}},
6884 {&hf_gtp_pkt_flow_id, {"Packet Flow ID", "gtp.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6885 {&hf_gtp_ptmsi, {"P-TMSI", "gtp.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL}},
6886 {&hf_gtp_ptmsi_sig, {"P-TMSI Signature", "gtp.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL}},
6887 {&hf_gtp_rab_gtpu_dn, {"Downlink GTP-U seq number", "gtp.rab_gtp_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink GTP-U sequence number", HFILL}},
6888 {&hf_gtp_rab_gtpu_up, {"Uplink GTP-U seq number", "gtp.rab_gtp_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink GTP-U sequence number", HFILL}},
6889 {&hf_gtp_rab_pdu_dn,
6890 {"Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL}},
6891 {&hf_gtp_rab_pdu_up,
6892 {"Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL}},
6893 {&hf_gtp_rai_mcc, {"MCC", "gtp.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL}},
6894 {&hf_gtp_rai_mnc, {"MNC", "gtp.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL}},
6895 {&hf_gtp_rai_rac, {"RAC", "gtp.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL}},
6896 {&hf_gtp_rai_lac, {"LAC", "gtp.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL}},
6897 {&hf_gtp_ranap_cause, {"RANAP cause", "gtp.ranap_cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0, NULL, HFILL}},
6898 {&hf_gtp_recovery, {"Recovery", "gtp.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL}},
6899 {&hf_gtp_reorder, {"Reordering required", "gtp.reorder", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6900 {&hf_gtp_rnc_ipv4, {"RNC address IPv4", "gtp.rnc_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Radio Network Controller address IPv4", HFILL}},
6901 {&hf_gtp_rnc_ipv6, {"RNC address IPv6", "gtp.rnc_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Radio Network Controller address IPv6", HFILL}},
6902 {&hf_gtp_rp, {"Radio Priority", "gtp.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL}},
6904 {"NSAPI in Radio Priority", "gtp.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
6905 "Network layer Service Access Point Identifier in Radio Priority", HFILL}},
6906 {&hf_gtp_rp_sms, {"Radio Priority SMS", "gtp.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL}},
6907 {&hf_gtp_rp_spare, {"Reserved", "gtp.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL}},
6909 {"Selection mode", "gtp.sel_mode",
6910 FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03,
6913 {&hf_gtp_seq_number, {"Sequence number", "gtp.seq_number", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6914 {&hf_gtp_sndcp_number, {"SNDCP N-PDU LLC Number", "gtp.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
6915 {&hf_gtp_tear_ind, {"Teardown Indicator", "gtp.tear_ind", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6916 {&hf_gtp_teid, {"TEID", "gtp.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL}},
6917 {&hf_gtp_teid_cp, {"TEID Control Plane", "gtp.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL}},
6918 {&hf_gtp_ulink_teid_cp,
6919 {"Uplink TEID Control Plane", "gtp.ulink_teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}},
6920 {&hf_gtp_teid_data, {"TEID Data I", "gtp.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL}},
6921 {&hf_gtp_ulink_teid_data,
6922 {"Uplink TEID Data I", "gtp.ulink_teid_data", FT_UINT32, BASE_HEX, NULL, 0, "UplinkTunnel Endpoint Identifier Data I", HFILL}},
6923 {&hf_gtp_teid_ii, {"TEID Data II", "gtp.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL}},
6925 {"TFT operation code", "gtp.tft_code", FT_UINT8, BASE_DEC, VALS(tft_code_type), GTPv1_TFT_CODE_MASK, NULL, HFILL}},
6926 {&hf_gtp_tft_spare, {"TFT spare bit", "gtp.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, NULL, HFILL}},
6927 {&hf_gtp_tft_number,
6928 {"Number of packet filters", "gtp.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, NULL, HFILL}},
6929 {&hf_gtp_tft_eval, {"Evaluation precedence", "gtp.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6930 {&hf_gtp_tid, {"TID", "gtp.tid", FT_STRING, BASE_NONE, NULL, 0, "Tunnel Identifier", HFILL}},
6931 {&hf_gtp_tlli, {"TLLI", "gtp.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL}},
6932 {&hf_gtp_tr_comm, {"Packet transfer command", "gtp.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL}},
6933 {&hf_gtp_trace_ref, {"Trace reference", "gtp.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6934 {&hf_gtp_trace_type, {"Trace type", "gtp.trace_type", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6935 {&hf_gtp_unknown, {"Unknown data (length)", "gtp.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL}},
6936 {&hf_gtp_user_addr_pdp_org,
6937 {"PDP type organization", "gtp.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, NULL, HFILL}},
6938 {&hf_gtp_user_addr_pdp_type, {"PDP type number", "gtp.user_addr_pdp_type", FT_UINT8, BASE_HEX, VALS(pdp_type), 0, "PDP type", HFILL}},
6939 {&hf_gtp_user_ipv4, {"End user address IPv4", "gtp.user_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
6940 {&hf_gtp_user_ipv6, {"End user address IPv6", "gtp.user_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
6941 {&hf_gtp_security_mode,
6942 {"Security Mode", "gtp.security_mode",
6943 FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
6946 {&hf_gtp_no_of_vectors,
6947 {"No of Vectors", "gtp.no_of_vectors",
6948 FT_UINT8, BASE_DEC, NULL, 0x38,
6951 {&hf_gtp_cipher_algorithm,
6952 {"Cipher Algorithm", "gtp.no_of_vectors",
6953 FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
6957 {"Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
6958 FT_UINT8, BASE_DEC, NULL, 0x07,
6962 {"Ciphering Key Sequence Number (CKSN)", "gtp.cksn_ksi",
6963 FT_UINT8, BASE_DEC, NULL, 0x07,
6967 {"Key Set Identifier (KSI)", "gtp.cksn_ksi",
6968 FT_UINT8, BASE_DEC, NULL, 0x07,
6971 {&hf_gtp_ext_length,
6972 {"Length", "gtp.ext_length",
6973 FT_UINT16, BASE_DEC, NULL, 0x0,
6976 {&hf_gtp_ext_apn_res,
6977 {"Restriction Type", "gtp.ext_apn_res",
6978 FT_UINT8, BASE_DEC, NULL, 0x0,
6981 {&hf_gtp_ext_rat_type,
6982 {"RAT Type", "gtp.ext_rat_type",
6983 FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
6986 {&hf_gtp_ext_geo_loc_type,
6987 {"Geographic Location Type", "gtp.ext_geo_loc_type",
6988 FT_UINT8, BASE_DEC, NULL, 0x0,
6992 {"SAC", "gtp.ext_sac",
6993 FT_UINT16, BASE_HEX, NULL, 0x0,
6996 {&hf_gtp_ext_imeisv,
6997 {"IMEI(SV)", "gtp.ext_imeisv",
6998 FT_STRING, BASE_NONE, NULL, 0x0,
7001 { &hf_gtp_targetRNC_ID,
7002 { "targetRNC-ID", "gtp.targetRNC_ID",
7003 FT_NONE, BASE_NONE, NULL, 0,
7005 {&hf_gtp_bssgp_cause,
7006 {"BSSGP Cause", "gtp.bssgp_cause",
7007 FT_UINT8, BASE_DEC, VALS(tab_cause), 0,
7010 {"PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
7011 FT_UINT8, BASE_DEC, NULL, 0x0F,
7013 {&hf_gtp_xid_par_len,
7014 {"PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
7015 FT_UINT8, BASE_DEC, NULL, 0xFF,
7016 "XID parameter length", HFILL}},
7017 {&hf_gtp_cmn_flg_ppc,
7018 {"Prohibit Payload Compression", "gtp.cmn_flg.ppc",
7019 FT_BOOLEAN, 8, NULL, 0x01,
7021 {&hf_gtp_cmn_flg_mbs_srv_type,
7022 {"MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
7023 FT_BOOLEAN, 8, NULL, 0x02,
7025 {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
7026 {"RAN Procedures Ready", "gtp.cmn_flg.ran_pcd_rd",
7027 FT_BOOLEAN, 8, NULL, 0x04,
7029 {&hf_gtp_cmn_flg_mbs_cnt_inf,
7030 {"MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
7031 FT_BOOLEAN, 8, NULL, 0x08,
7033 {&hf_gtp_cmn_flg_no_qos_neg,
7034 {"No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
7035 FT_BOOLEAN, 8, NULL, 0x10,
7037 {&hf_gtp_cmn_flg_nrsn,
7038 {"NRSN bit field", "gtp.cmn_flg.nrsn",
7039 FT_BOOLEAN, 8, NULL, 0x20,
7041 {&hf_gtp_cmn_flg_upgrd_qos_sup,
7042 {"Upgrade QoS Supported", "gtp.cmn_flg.ran_pcd_rd",
7043 FT_BOOLEAN, 8, NULL, 0x40,
7046 {"Temporary Mobile Group Identity (TMGI)", "gtp.cmn_flg.ran_pcd_rd",
7047 FT_BYTES, BASE_NONE, NULL, 0x0,
7049 {&hf_gtp_no_of_mbms_sa_codes,
7050 {"Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
7051 FT_UINT8, BASE_DEC, NULL, 0x0,
7052 "Number N of MBMS service area codes", HFILL}
7054 {&hf_gtp_mbms_ses_dur_days,
7055 {"Estimated session duration days", "gtp.mbms_ses_dur_days",
7056 FT_UINT8, BASE_DEC, NULL, 0xfe,
7059 {&hf_gtp_mbms_ses_dur_s,
7060 {"Estimated session duration seconds", "gtp.mbms_ses_dur_s",
7061 FT_UINT24, BASE_DEC, NULL, 0x01ffff,
7064 {&hf_gtp_mbms_sa_code,
7065 {"MBMS service area code", "gtp.mbms_sa_code",
7066 FT_UINT16, BASE_DEC, NULL, 0x0,
7069 {&hf_gtp_mbs_2g_3g_ind,
7070 {"MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
7071 FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
7074 {&hf_gtp_time_2_dta_tr,
7075 {"Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
7076 FT_UINT8, BASE_DEC, NULL, 0x0,
7080 {"Error Indication (EI)", "gtp.ei",
7081 FT_UINT8, BASE_DEC, NULL, 0x04,
7085 {"GPRS-CSI (GCSI)", "gtp.gcsi",
7086 FT_UINT8, BASE_DEC, NULL, 0x02,
7090 {"Direct Tunnel Indicator (DTI)", "gtp.dti",
7091 FT_UINT8, BASE_DEC, NULL, 0x01,
7096 static gint *ett_gtp_array[] = {
7106 &ett_gtp_pkt_flow_id,
7128 &ett_gtp_ext_tree_apn_res,
7129 &ett_gtp_ext_rat_type,
7130 &ett_gtp_ext_imeisv,
7131 &ett_gtp_ext_ran_tr_cont,
7132 &ett_gtp_ext_pdp_cont_prio,
7133 &ett_gtp_ext_ssgn_no,
7134 &ett_gtp_ext_rab_setup_inf,
7135 &ett_gtp_ext_common_flgs,
7136 &ett_gtp_ext_usr_loc_inf,
7137 &ett_gtp_ext_ms_time_zone,
7138 &ett_gtp_ext_camel_chg_inf_con,
7139 &ett_GTP_EXT_MBMS_UE_CTX,
7142 &ett_gtp_ext_rim_ra,
7143 &ett_gtp_ext_mbms_prot_conf_opt,
7144 &ett_gtp_ext_mbms_sa,
7145 &ett_gtp_ext_bms_ses_dur,
7146 &ett_gtp_ext_src_rnc_pdp_ctx_inf,
7147 &ett_gtp_ext_add_trs_inf,
7148 &ett_gtp_ext_hop_count,
7149 &ett_gtp_ext_sel_plmn_id,
7150 &ett_gtp_ext_mbms_ses_id,
7151 &ett_gtp_ext_mbms_2g_3g_ind,
7152 &ett_gtp_ext_enh_nsapi,
7153 &ett_gtp_ext_ad_mbms_trs_inf,
7154 &ett_gtp_ext_mbms_ses_id_rep_no,
7155 &ett_gtp_ext_mbms_time_to_data_tr,
7156 &ett_gtp_ext_ps_ho_req_ctx,
7157 &ett_gtp_ext_bss_cont,
7158 &ett_gtp_ext_cell_id,
7159 &ett_gtp_ext_pdu_no,
7160 &ett_gtp_ext_bssgp_cause,
7161 &ett_gtp_ext_ra_prio_lcs,
7162 &ett_gtp_ext_ps_handover_xid,
7164 &ett_gtp_utran_cont,
7167 module_t *gtp_module;
7169 proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
7170 proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
7171 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
7173 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
7175 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 and GTP' port", "GTPv0 and GTP' port (default 3386)", 10, &g_gtpv0_port);
7176 prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 or GTPv2 control plane (GTP-C, GTPv2-C) port", "GTPv1 and GTPv2 control plane port (default 2123)", 10,
7178 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
7180 prefs_register_bool_preference(gtp_module, "dissect_tpdu", "Dissect T-PDU", "Dissect T-PDU", &g_gtp_tpdu);
7182 prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
7183 prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
7184 prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
7185 prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
7186 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
7188 /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
7189 * The preference is set to TRUE by default forbackward compatibility
7191 prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
7193 register_dissector("gtp", dissect_gtp, proto_gtp);
7194 register_dissector("gtpprim", dissect_gtpprim, proto_gtp);
7196 register_init_routine(gtp_reinit);
7197 gtp_tap=register_tap("gtp");
7199 /* TS 132 295 V9.0.0 (2010-02)
7201 * - The UDP Destination Port may be the server port number 3386 which has been reserved for GTP'.
7202 * Alternatively another port can be used, which has been configured by O&M, except Port Number 2123
7203 * which is used by GTPv2-C.
7205 * The TCP Destination Port may be the server port number 3386, which has been reserved for G-PDUs. Alternatively,
7206 * another port may be used as configured by O&M. Extra implementation-specific destination ports are possible but
7207 * all CGFs shall support the server port number.
7210 void proto_reg_handoff_gtp(void)
7212 static gboolean Initialized = FALSE;
7213 static dissector_handle_t gtp_handle, gtp_prim_handle;
7214 static gboolean gtp_over_tcp;
7215 static guint gtpv0_port;
7216 static guint gtpv1c_port;
7217 static guint gtpv1u_port;
7220 gtp_handle = find_dissector("gtp");
7221 gtp_prim_handle = find_dissector("gtpprim");
7222 ppp_subdissector_table = find_dissector_table("ppp.protocol");
7224 radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
7225 radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
7226 radius_register_avp_dissector(VENDOR_THE3GPP, 22, dissect_radius_user_loc);
7230 ip_handle = find_dissector("ip");
7231 ipv6_handle = find_dissector("ipv6");
7232 ppp_handle = find_dissector("ppp");
7233 data_handle = find_dissector("data");
7234 gtpcdr_handle = find_dissector("gtpcdr");
7235 sndcpxid_handle = find_dissector("sndcpxid");
7236 gtpv2_handle = find_dissector("gtpv2");
7237 bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
7238 /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
7239 dissector_add("diameter.3gpp", 5, new_create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
7240 /* AVP Code: 904 MBMS-Session-Duration */
7241 dissector_add("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
7242 /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
7243 dissector_add("diameter.3gpp", 911, new_create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
7247 dissector_delete("udp.port", gtpv0_port, gtp_prim_handle);
7248 dissector_delete("udp.port", gtpv1c_port, gtp_handle);
7249 dissector_delete("udp.port", gtpv1u_port, gtp_handle);
7252 dissector_delete("tcp.port", gtpv0_port, gtp_prim_handle);
7253 dissector_delete("tcp.port", gtpv1c_port, gtp_handle);
7254 dissector_delete("tcp.port", gtpv1u_port, gtp_handle);
7258 gtp_over_tcp = g_gtp_over_tcp;
7259 gtpv0_port = g_gtpv0_port;
7260 gtpv1c_port = g_gtpv1c_port;
7261 gtpv1u_port = g_gtpv1u_port;
7263 dissector_add("udp.port", g_gtpv0_port, gtp_prim_handle);
7264 dissector_add("udp.port", g_gtpv1c_port, gtp_handle);
7265 dissector_add("udp.port", g_gtpv1u_port, gtp_handle);
7267 if (g_gtp_over_tcp) {
7268 dissector_add("tcp.port", g_gtpv0_port, gtp_prim_handle);
7269 dissector_add("tcp.port", g_gtpv1c_port, gtp_handle);
7270 dissector_add("tcp.port", g_gtpv1u_port, gtp_handle);
7275 * Editor modelines - http://www.wireshark.org/tools/modelines.html
7280 * indent-tabs-mode: nil
7283 * vi: set shiftwidth=4 tabstop=8 expandtab
7284 * :indentSize=4:tabSize=8:noTabs=true: