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;
236 static int hf_gtp_ra_prio_lcs = -1;
238 /* Initialize the subtree pointers */
239 static gint ett_gtp = -1;
240 static gint ett_gtp_flags = -1;
241 static gint ett_gtp_ext = -1;
242 static gint ett_gtp_rai = -1;
243 static gint ett_gtp_qos = -1;
244 static gint ett_gtp_auth_tri = -1;
245 static gint ett_gtp_flow_ii = -1;
246 static gint ett_gtp_rab_cntxt = -1;
247 static gint ett_gtp_rp = -1;
248 static gint ett_gtp_pkt_flow_id = -1;
249 static gint ett_gtp_chrg_char = -1;
250 static gint ett_gtp_user = -1;
251 static gint ett_gtp_mm = -1;
252 static gint ett_gtp_trip = -1;
253 static gint ett_gtp_quint = -1;
254 static gint ett_gtp_pdp = -1;
255 static gint ett_gtp_apn = -1;
256 static gint ett_gtp_proto = -1;
257 static gint ett_gtp_gsn_addr = -1;
258 static gint ett_gtp_tft = -1;
259 static gint ett_gtp_tft_pf = -1;
260 static gint ett_gtp_tft_flags = -1;
261 static gint ett_gtp_rab_setup = -1;
262 static gint ett_gtp_hdr_list = -1;
263 static gint ett_gtp_chrg_addr = -1;
264 static gint ett_gtp_node_addr = -1;
265 static gint ett_gtp_rel_pack = -1;
266 static gint ett_gtp_can_pack = -1;
267 static gint ett_gtp_data_resp = -1;
268 static gint ett_gtp_priv_ext = -1;
269 static gint ett_gtp_net_cap = -1;
270 static gint ett_gtp_ext_tree_apn_res = -1;
271 static gint ett_gtp_ext_rat_type = -1;
272 static gint ett_gtp_ext_imeisv = -1;
273 static gint ett_gtp_ext_ran_tr_cont = -1;
274 static gint ett_gtp_ext_pdp_cont_prio = -1;
275 static gint ett_gtp_ext_ssgn_no = -1;
276 static gint ett_gtp_ext_rab_setup_inf = -1;
277 static gint ett_gtp_ext_common_flgs = -1;
278 static gint ett_gtp_ext_usr_loc_inf = -1;
279 static gint ett_gtp_ext_ms_time_zone = -1;
280 static gint ett_gtp_ext_camel_chg_inf_con = -1;
281 static gint ett_GTP_EXT_MBMS_UE_CTX = -1;
282 static gint ett_gtp_ext_tmgi = -1;
283 static gint ett_gtp_tmgi = -1;
284 static gint ett_gtp_ext_rim_ra = -1;
285 static gint ett_gtp_ext_mbms_prot_conf_opt = -1;
286 static gint ett_gtp_ext_mbms_sa = -1;
287 static gint ett_gtp_ext_bms_ses_dur = -1;
288 static gint ett_gtp_ext_src_rnc_pdp_ctx_inf = -1;
289 static gint ett_gtp_ext_add_trs_inf = -1;
290 static gint ett_gtp_ext_hop_count = -1;
291 static gint ett_gtp_ext_sel_plmn_id = -1;
292 static gint ett_gtp_ext_mbms_ses_id = -1;
293 static gint ett_gtp_ext_mbms_2g_3g_ind = -1;
294 static gint ett_gtp_ext_enh_nsapi = -1;
295 static gint ett_gtp_ext_ad_mbms_trs_inf = -1;
296 static gint ett_gtp_ext_mbms_ses_id_rep_no = -1;
297 static gint ett_gtp_ext_mbms_time_to_data_tr = -1;
298 static gint ett_gtp_ext_ps_ho_req_ctx = -1;
299 static gint ett_gtp_ext_bss_cont = -1;
300 static gint ett_gtp_ext_cell_id = -1;
301 static gint ett_gtp_ext_pdu_no = -1;
302 static gint ett_gtp_ext_bssgp_cause = -1;
303 static gint ett_gtp_ext_ra_prio_lcs = -1;
304 static gint ett_gtp_ext_ps_handover_xid = -1;
305 static gint ett_gtp_target_id = -1;
306 static gint ett_gtp_utran_cont = -1;
308 static gboolean g_gtp_tpdu = TRUE;
309 static gboolean g_gtp_etsi_order = FALSE;
311 static int gtp_tap = -1;
313 /* Definition of flags masks */
314 #define GTP_VER_MASK 0xE0
316 static const value_string ver_types[] = {
317 {0, "GTP release 97/98 version"},
318 {1, "GTP release 99 version"},
328 static const value_string pt_types[] = {
334 #define GTP_PT_MASK 0x10
335 #define GTP_SPARE1_MASK 0x0E
336 #define GTP_SPARE2_MASK 0x08
337 #define GTP_E_MASK 0x04
338 #define GTP_S_MASK 0x02
339 #define GTP_SNN_MASK 0x01
340 #define GTP_PN_MASK 0x01
342 static const value_string next_extension_header_fieldvals[] = {
343 { 0, "No more extension headers"},
344 { 1, "MBMS support indication"},
345 { 2, "MS Info Change Reporting support indication"},
346 {0xc0, "PDCP PDU number"},
347 {0xc1, "Suspend Request"},
348 {0xc2, "Suspend Response"},
352 /* Definition of 3G charging characteristics masks */
353 #define GTP_MASK_CHRG_CHAR_S 0xF000
354 #define GTP_MASK_CHRG_CHAR_N 0x0800
355 #define GTP_MASK_CHRG_CHAR_P 0x0400
356 #define GTP_MASK_CHRG_CHAR_F 0x0200
357 #define GTP_MASK_CHRG_CHAR_H 0x0100
358 #define GTP_MASK_CHRG_CHAR_R 0x00FF
360 /* Traffic Flow Templates mask */
361 #define GTPv1_TFT_CODE_MASK 0xE0
362 #define GTPv1_TFT_SPARE_MASK 0x10
363 #define GTPv1_TFT_NUMBER_MASK 0x0F
365 /* Definition of GSN Address masks */
366 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
367 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
369 /* Definition of QoS masks */
370 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
371 #define GTP_EXT_QOS_DELAY_MASK 0x38
372 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
373 #define GTP_EXT_QOS_PEAK_MASK 0xF0
374 #define GTP_EXT_QOS_SPARE2_MASK 0x08
375 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
376 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
377 #define GTP_EXT_QOS_MEAN_MASK 0x1F
378 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
379 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
380 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
381 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
382 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
383 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
384 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
385 #define GTP_EXT_QOS_SRC_STAT_DESC_MASK 0x0F
386 #define GTP_EXT_QOS_SIG_IND_MASK 0x10
388 /* Definition of Radio Priority's masks */
389 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
390 #define GTPv1_EXT_RP_SPARE_MASK 0x08
391 #define GTPv1_EXT_RP_MASK 0x07
393 static const value_string message_type[] = {
394 {GTP_MSG_UNKNOWN, "For future use"},
395 {GTP_MSG_ECHO_REQ, "Echo request"},
396 {GTP_MSG_ECHO_RESP, "Echo response"},
397 {GTP_MSG_VER_NOT_SUPP, "Version not supported"},
398 {GTP_MSG_NODE_ALIVE_REQ, "Node alive request"},
399 {GTP_MSG_NODE_ALIVE_RESP, "Node alive response"},
400 {GTP_MSG_REDIR_REQ, "Redirection request"},
401 {GTP_MSG_REDIR_RESP, "Redirection response"},
403 * 8-15 For future use. Shall not be sent. If received,
404 * shall be treated as an Unknown message.
407 { 8, "Unknown message(For future use)"},
408 { 9, "Unknown message(For future use)"},
409 { 10, "Unknown message(For future use)"},
410 { 11, "Unknown message(For future use)"},
411 { 12, "Unknown message(For future use)"},
412 { 13, "Unknown message(For future use)"},
413 { 14, "Unknown message(For future use)"},
414 { 15, "Unknown message(For future use)"},
416 {GTP_MSG_CREATE_PDP_REQ, "Create PDP context request"},
417 {GTP_MSG_CREATE_PDP_RESP, "Create PDP context response"},
418 {GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request"},
419 {GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response"},
420 {GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request"},
421 {GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response"},
422 {GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request"},
423 {GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response"},
424 {GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request"},
425 {GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response"},
426 {GTP_MSG_ERR_IND, "Error indication"},
427 {GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request"},
428 {GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response"},
429 {GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request"},
430 {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
431 {GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification"},
432 {GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request"},
433 {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
434 {GTP_MSG_FAIL_REP_REQ, "Failure report request"},
435 {GTP_MSG_FAIL_REP_RESP, "Failure report response"},
436 {GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request"},
437 {GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response"},
438 /* 38-47 For future use. Shall not be sent. If received,
439 * shall be treated as an Unknown message.
442 { 38, "Unknown message(For future use)"},
443 { 39, "Unknown message(For future use)"},
444 { 40, "Unknown message(For future use)"},
445 { 41, "Unknown message(For future use)"},
446 { 42, "Unknown message(For future use)"},
447 { 43, "Unknown message(For future use)"},
448 { 44, "Unknown message(For future use)"},
449 { 45, "Unknown message(For future use)"},
450 { 46, "Unknown message(For future use)"},
451 { 47, "Unknown message(For future use)"},
453 {GTP_MSG_IDENT_REQ, "Identification request"},
454 {GTP_MSG_IDENT_RESP, "Identification response"},
455 {GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request"},
456 {GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response"},
457 {GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement"},
458 {GTP_MSG_FORW_RELOC_REQ, "Forward relocation request"},
459 {GTP_MSG_FORW_RELOC_RESP, "Forward relocation response"},
460 {GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete"},
461 {GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request"},
462 {GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response"},
463 {GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context"},
464 {GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge"},
465 {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
466 /* 61-69 For future use. Shall not be sent. If received,
467 * shall be treated as an Unknown message.
470 { 61, "Unknown message(For future use)"},
471 { 62, "Unknown message(For future use)"},
472 { 63, "Unknown message(For future use)"},
473 { 64, "Unknown message(For future use)"},
474 { 65, "Unknown message(For future use)"},
475 { 66, "Unknown message(For future use)"},
476 { 67, "Unknown message(For future use)"},
477 { 68, "Unknown message(For future use)"},
478 { 69, "Unknown message(For future use)"},
480 {GTP_MSG_RAN_INFO_RELAY, "RAN Information Relay"},
481 /* 71-95 For future use. Shall not be sent. If received,
482 * shall be treated as an Unknown message.
485 { 71, "Unknown message(For future use)"},
486 { 72, "Unknown message(For future use)"},
487 { 73, "Unknown message(For future use)"},
488 { 74, "Unknown message(For future use)"},
489 { 75, "Unknown message(For future use)"},
490 { 76, "Unknown message(For future use)"},
491 { 77, "Unknown message(For future use)"},
492 { 78, "Unknown message(For future use)"},
493 { 79, "Unknown message(For future use)"},
494 { 80, "Unknown message(For future use)"},
495 { 81, "Unknown message(For future use)"},
496 { 82, "Unknown message(For future use)"},
497 { 83, "Unknown message(For future use)"},
498 { 84, "Unknown message(For future use)"},
499 { 85, "Unknown message(For future use)"},
500 { 86, "Unknown message(For future use)"},
501 { 87, "Unknown message(For future use)"},
502 { 88, "Unknown message(For future use)"},
503 { 89, "Unknown message(For future use)"},
504 { 90, "Unknown message(For future use)"},
505 { 91, "Unknown message(For future use)"},
506 { 92, "Unknown message(For future use)"},
507 { 93, "Unknown message(For future use)"},
508 { 94, "Unknown message(For future use)"},
509 { 95, "Unknown message(For future use)"},
511 {GTP_MBMS_NOTIFY_REQ, "MBMS Notification Request"},
512 {GTP_MBMS_NOTIFY_RES, "MBMS Notification Response"},
513 {GTP_MBMS_NOTIFY_REJ_REQ, "MBMS Notification Reject Request"},
514 {GTP_MBMS_NOTIFY_REJ_RES, "MBMS Notification Reject Response"},
515 {GTP_CREATE_MBMS_CNTXT_REQ, "Create MBMS Context Request"},
516 {GTP_CREATE_MBMS_CNTXT_RES, "Create MBMS Context Response"},
517 {GTP_UPD_MBMS_CNTXT_REQ, "Update MBMS Context Request"},
518 {GTP_UPD_MBMS_CNTXT_RES, "Update MBMS Context Response"},
519 {GTP_DEL_MBMS_CNTXT_REQ, "Delete MBMS Context Request"},
520 {GTP_DEL_MBMS_CNTXT_RES, "Delete MBMS Context Response"},
521 /* 106 - 111 For future use. Shall not be sent. If received,
522 * shall be treated as an Unknown message.
524 {GTP_MBMS_REG_REQ, "MBMS Registration Request"},
525 {GTP_MBMS_REG_RES, "MBMS Registration Response"},
526 {GTP_MBMS_DE_REG_REQ, "MBMS De-Registration Request"},
527 {GTP_MBMS_DE_REG_RES, "MBMS De-Registration Response"},
528 {GTP_MBMS_SES_START_REQ, "MBMS Session Start Request"},
529 {GTP_MBMS_SES_START_RES, "MBMS Session Start Response"},
530 {GTP_MBMS_SES_STOP_REQ, "MBMS Session Stop Request"},
531 {GTP_MBMS_SES_STOP_RES, "MBMS Session Stop Response"},
532 {GTP_MBMS_SES_UPD_REQ, "MBMS Session Update Request"},
533 {GTP_MBMS_SES_UPD_RES, "MBMS Session Update Response"},
534 /* 122-127 For future use. Shall not be sent.
535 * If received, shall be treated as an Unknown message.
537 {GTP_MS_INFO_CNG_NOT_REQ, "MS Info Change Notification Request"},
538 {GTP_MS_INFO_CNG_NOT_RES, "MS Info Change Notification Response"},
539 /* 130-239 For future use. Shall not be sent. If received,
540 * shall be treated as an Unknown message.
542 {GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request"},
543 {GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response"},
544 /* 242-253 For future use. Shall not be sent. If received,
545 * shall be treated as an Unknown message.
547 {GTP_MSG_END_MARKER, "End Marker"},
548 {GTP_MSG_TPDU, "T-PDU"},
551 static value_string_ext message_type_ext = VALUE_STRING_EXT_INIT(message_type);
553 /* definitions of fields in extension header */
554 #define GTP_EXT_CAUSE 0x01
555 #define GTP_EXT_IMSI 0x02
556 #define GTP_EXT_RAI 0x03
557 #define GTP_EXT_TLLI 0x04
558 #define GTP_EXT_PTMSI 0x05
559 #define GTP_EXT_QOS_GPRS 0x06
560 #define GTP_EXT_REORDER 0x08
561 #define GTP_EXT_AUTH_TRI 0x09
562 #define GTP_EXT_MAP_CAUSE 0x0B
563 #define GTP_EXT_PTMSI_SIG 0x0C
564 #define GTP_EXT_MS_VALID 0x0D
565 #define GTP_EXT_RECOVER 0x0E
566 #define GTP_EXT_SEL_MODE 0x0F
568 #define GTP_EXT_16 0x10
569 #define GTP_EXT_FLOW_LABEL 0x10
570 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
572 #define GTP_EXT_17 0x11
573 #define GTP_EXT_FLOW_SIG 0x11
574 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
576 #define GTP_EXT_18 0x12
577 #define GTP_EXT_FLOW_II 0x12
578 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G */
580 #define GTP_EXT_19 0x13
581 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
582 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G */
584 #define GTP_EXT_NSAPI 0x14 /* 3G */
585 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
586 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
587 #define GTP_EXT_RP_SMS 0x17 /* 3G */
588 #define GTP_EXT_RP 0x18 /* 3G */
589 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
590 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
591 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
592 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
593 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
594 #define GTP_EXT_TR_COMM 0x7E /* charging */
595 #define GTP_EXT_CHRG_ID 0x7F
596 #define GTP_EXT_USER_ADDR 0x80
597 #define GTP_EXT_MM_CNTXT 0x81
598 #define GTP_EXT_PDP_CNTXT 0x82
599 #define GTP_EXT_APN 0x83
600 #define GTP_EXT_PROTO_CONF 0x84
601 #define GTP_EXT_GSN_ADDR 0x85
602 #define GTP_EXT_MSISDN 0x86
603 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
604 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
605 #define GTP_EXT_TFT 0x89 /* 3G */
606 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
607 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
608 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
609 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
610 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G 142 7.7.41 */
611 #define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */
612 #define GTP_EXT_RAN_TR_CONT 0x90 /* 3G 144 TLV RAN Transparent Container 7.7.43 */
613 #define GTP_EXT_PDP_CONT_PRIO 0x91 /* 3G 145 TLV PDP Context Prioritization 7.7.45 */
614 #define GTP_EXT_ADD_RAB_SETUP_INF 0x92 /* 3G 146 TLV Additional RAB Setup Information 7.7.45A */
615 #define GTP_EXT_SSGN_NO 0x93 /* 3G 147 TLV SGSN Number 7.7.47 */
616 #define GTP_EXT_COMMON_FLGS 0x94 /* 3G 148 TLV Common Flags 7.7.48 */
617 #define GTP_EXT_APN_RES 0x95 /* 3G 149 */
618 #define GTP_EXT_RA_PRIO_LCS 0x96 /* 3G 150 TLV Radio Priority LCS 7.7.25B */
619 #define GTP_EXT_RAT_TYPE 0x97 /* 3G 151 TLV RAT Type 7.7.50 */
620 #define GTP_EXT_USR_LOC_INF 0x98 /* 3G 152 TLV User Location Information 7.7.51 */
621 #define GTP_EXT_MS_TIME_ZONE 0x99 /* 3G 153 TLV MS Time Zone 7.7.52 */
623 #define GTP_EXT_IMEISV 0x9A /* 3G */
624 #define GTP_EXT_CAMEL_CHG_INF_CON 0x9B /* 3G 155 TLV CAMEL Charging Information Container 7.7.54 */
625 #define GTP_EXT_MBMS_UE_CTX 0x9C /* 3G 156 TLV MBMS UE Context 7.7.55 */
626 #define GTP_EXT_TMGI 0x9D /* 3G 157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
627 #define GTP_EXT_RIM_RA 0x9E /* 3G 158 TLV RIM Routing Address 7.7.57 */
628 #define GTP_EXT_MBMS_PROT_CONF_OPT 0x9F /* 3G 159 TLV MBMS Protocol Configuration Options 7.7.58 */
629 #define GTP_EXT_MBMS_SA 0xA0 /* 3G 160 TLV MBMS Service Area 7.7.60 */
630 #define GTP_EXT_SRC_RNC_PDP_CTX_INF 0xA1 /* 3G 161 TLV Source RNC PDCP context info 7.7.61 */
631 #define GTP_EXT_ADD_TRS_INF 0xA2 /* 3G 162 TLV Additional Trace Info 7.7.62 */
632 #define GTP_EXT_HOP_COUNT 0xA3 /* 3G 163 TLV Hop Counter 7.7.63 */
633 #define GTP_EXT_SEL_PLMN_ID 0xA4 /* 3G 164 TLV Selected PLMN ID 7.7.64 */
634 #define GTP_EXT_MBMS_SES_ID 0xA5 /* 3G 165 TLV MBMS Session Identifier 7.7.65 */
635 #define GTP_EXT_MBMS_2G_3G_IND 0xA6 /* 3G 166 TLV MBMS 2G/3G Indicator 7.7.66 */
636 #define GTP_EXT_ENH_NSAPI 0xA7 /* 3G 167 TLV Enhanced NSAPI 7.7.67 */
637 #define GTP_EXT_MBMS_SES_DUR 0xA8 /* 3G 168 TLV MBMS Session Duration 7.7.59 */
638 #define GTP_EXT_ADD_MBMS_TRS_INF 0xA9 /* 3G 169 TLV Additional MBMS Trace Info 7.7.68 */
639 #define GTP_EXT_MBMS_SES_ID_REP_NO 0xAA /* 3G 170 TLV MBMS Session Identity Repetition Number 7.7.69 */
640 #define GTP_EXT_MBMS_TIME_TO_DATA_TR 0xAB /* 3G 171 TLV MBMS Time To Data Transfer 7.7.70 */
641 #define GTP_EXT_PS_HO_REQ_CTX 0xAC /* 3G 172 TLV PS Handover Request Context 7.7.71 */
642 #define GTP_EXT_BSS_CONT 0xAD /* 3G 173 TLV BSS Container 7.7.72 */
643 #define GTP_EXT_CELL_ID 0xAE /* 3G 174 TLV Cell Identification 7.7.73 */
644 #define GTP_EXT_PDU_NO 0xAF /* 3G 175 TLV PDU Numbers 7.7.74 */
645 #define GTP_EXT_BSSGP_CAUSE 0xB0 /* 3G 176 TLV BSSGP Cause 7.7.75 */
646 #define GTP_EXT_REQ_MBMS_BEARER_CAP 0xB1 /* 3G 177 TLV Required MBMS bearer capabilities 7.7.76 */
647 #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2 /* 3G 178 TLV RIM Routing Address Discriminator 7.7.77 */
648 #define GTP_EXT_LIST_OF_SETUP_PFCS 0xB3 /* 3G 179 TLV List of set-up PFCs 7.7.78 */
649 #define GTP_EXT_PS_HANDOVER_XIP_PAR 0xB4 /* 3G 180 TLV PS Handover XID Parameters 7.7.79 */
650 #define GTP_EXT_MS_INF_CHG_REP_ACT 0xB5 /* 3G 181 TLV MS Info Change Reporting Action 7.7.80 */
651 #define GTP_EXT_DIRECT_TUNNEL_FLGS 0xB6 /* 3G 182 TLV Direct Tunnel Flags 7.7.81 */
652 #define GTP_EXT_CORRELATION_ID 0xB7 /* 3G 183 TLV Correlation-ID 7.7.82 */
653 #define GTP_EXT_BEARER_CONTROL_MODE 0xB8 /* 3G 184 TLV Bearer Control Mode 7.7.83 */
654 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
656 #define GTP_EXT_C1 0xC1
657 #define GTP_EXT_C2 0xC2
658 #define GTP_EXT_REL_PACK 0xF9 /* charging */
659 #define GTP_EXT_CAN_PACK 0xFA /* charging */
660 #define GTP_EXT_CHRG_ADDR 0xFB /* 3G 251 TLV Charging Gateway Address 7.7.44 */
661 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
662 #define GTP_EXT_DATA_REQ 0xFC /* charging */
663 #define GTP_EXT_DATA_RESP 0xFD /* charging */
664 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
665 #define GTP_EXT_PRIV_EXT 0xFF
667 static const value_string gtp_val[] = {
668 {GTP_EXT_CAUSE, "Cause of operation"},
669 {GTP_EXT_IMSI, "IMSI"},
670 {GTP_EXT_RAI, "Routing Area Identity"},
671 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
672 {GTP_EXT_PTMSI, "Packet TMSI"},
673 {GTP_EXT_QOS_GPRS, "Quality of Service"},
674 {GTP_EXT_REORDER, "Reorder required"},
675 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
676 {GTP_EXT_MAP_CAUSE, "MAP cause"},
677 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
678 {GTP_EXT_MS_VALID, "MS validated"},
679 {GTP_EXT_RECOVER, "Recovery"},
680 {GTP_EXT_SEL_MODE, "Selection mode"},
682 {GTP_EXT_16, "Flow label data I"},
683 {GTP_EXT_FLOW_LABEL, "Flow label data I"},
684 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
686 {GTP_EXT_17, "Flow label signalling"},
687 {GTP_EXT_FLOW_SIG, "Flow label signalling"},
688 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
690 {GTP_EXT_18, "Flow label data II"},
691 {GTP_EXT_FLOW_II, "Flow label data II"},
692 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
694 {GTP_EXT_19, "MS not reachable reason"},
695 {GTP_EXT_MS_REASON, "MS not reachable reason"},
696 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
698 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
699 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
700 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
701 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
702 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
703 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
704 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
705 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
706 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
707 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
708 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
709 {GTP_EXT_CHRG_ID, "Charging ID"},
710 {GTP_EXT_USER_ADDR, "End user address"},
711 {GTP_EXT_MM_CNTXT, "MM context"},
712 {GTP_EXT_PDP_CNTXT, "PDP context"},
713 {GTP_EXT_APN, "Access Point Name"},
714 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
715 {GTP_EXT_GSN_ADDR, "GSN address"},
716 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
717 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
718 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
719 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
720 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
721 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
722 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
723 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
724 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
725 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
727 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
728 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
729 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
730 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
731 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
732 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
733 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
734 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
735 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
736 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
738 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
739 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
740 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
741 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
742 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
743 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
744 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
745 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
746 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
747 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
748 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
749 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
750 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
751 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
752 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
753 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
754 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
755 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
756 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
757 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
758 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
759 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
760 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
761 {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
762 {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
763 {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
764 {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"}, /* 7.7.79 */
765 {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
766 {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
767 {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
768 {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
769 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
770 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
771 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
772 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
773 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
774 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
775 {GTP_EXT_PRIV_EXT, "Private Extension"},
778 static value_string_ext gtp_val_ext = VALUE_STRING_EXT_INIT(gtp_val);
780 /* It seems like some IE's are renamed in gtpv1 at least reading
781 * 3GPP TS 29.060 version 6.11.0 Release 6
783 static const value_string gtpv1_val[] = {
784 {GTP_EXT_CAUSE, "Cause of operation"},
785 {GTP_EXT_IMSI, "IMSI"},
786 {GTP_EXT_RAI, "Routing Area Identity"},
787 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
788 {GTP_EXT_PTMSI, "Packet TMSI"},
789 {GTP_EXT_QOS_GPRS, "Quality of Service"},
790 {GTP_EXT_REORDER, "Reorder required"},
791 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
792 {GTP_EXT_MAP_CAUSE, "MAP cause"},
793 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
794 {GTP_EXT_MS_VALID, "MS validated"},
795 {GTP_EXT_RECOVER, "Recovery"},
796 {GTP_EXT_SEL_MODE, "Selection mode"},
798 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
800 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
802 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
804 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
806 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
807 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
808 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
809 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
810 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
811 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
812 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
813 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
814 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
815 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
816 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
817 {GTP_EXT_CHRG_ID, "Charging ID"},
818 {GTP_EXT_USER_ADDR, "End user address"},
819 {GTP_EXT_MM_CNTXT, "MM context"},
820 {GTP_EXT_PDP_CNTXT, "PDP context"},
821 {GTP_EXT_APN, "Access Point Name"},
822 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
823 {GTP_EXT_GSN_ADDR, "GSN address"},
824 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
825 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
826 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
827 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
828 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
829 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
830 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
831 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
832 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
833 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
835 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
836 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
837 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
838 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
839 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
840 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
841 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
842 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
843 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
844 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
846 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
847 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
848 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
849 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
850 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
851 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
852 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
853 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
854 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
855 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
856 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
857 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
858 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
859 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
860 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
861 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
862 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
863 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
864 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
865 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
866 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
867 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
868 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
869 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
870 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
871 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
872 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
873 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
874 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
875 {GTP_EXT_PRIV_EXT, "Private Extension"},
878 static value_string_ext gtpv1_val_ext = VALUE_STRING_EXT_INIT(gtpv1_val);
880 /* GPRS: 9.60 v7.6.0, page 37
881 * UMTS: 29.060 v4.0, page 45
882 * ETSI TS 129 060 V9.4.0 (2010-10)
884 static const value_string cause_type[] = {
885 { 0, "Request IMSI"},
886 { 1, "Request IMEI"},
887 { 2, "Request IMSI and IMEI"},
888 { 3, "No identity needed"},
890 { 5, "MS is not GPRS responding"},
891 /* For future use 6-48 */
892 /* Cause values reserved for GPRS charging
893 * protocol use (see GTP' in 3GPP TS 32.295 [33])
896 { 59, "System failure"}, /* charging */
897 { 60, "The transmit buffers are becoming full"}, /* charging */
898 { 61, "The receive buffers are becoming full"}, /* charging */
899 { 62, "Another node is about to go down"}, /* charging */
900 { 63, "This node is about to go down"}, /* charging */
901 /* For future use 64-127 */
902 {128, "Request accepted"},
903 {129, "New PDP type due to network preference"},
904 {130, "New PDP type due to single address bearer only"},
905 /* For future use 131-176 */
906 /* Cause values reserved for GPRS charging
907 * protocol use (see GTP' in 3GPP TS 32.295 [33])
910 {192, "Non-existent"},
911 {193, "Invalid message format"},
912 {194, "IMSI not known"},
913 {195, "MS is GPRS detached"},
914 {196, "MS is not GPRS responding"},
916 {198, "Version not supported"},
917 {199, "No resource available"},
918 {200, "Service not supported"},
919 {201, "Mandatory IE incorrect"},
920 {202, "Mandatory IE missing"},
921 {203, "Optional IE incorrect"},
922 {204, "System failure"},
923 {205, "Roaming restriction"},
924 {206, "P-TMSI signature mismatch"},
925 {207, "GPRS connection suspended"},
926 {208, "Authentication failure"},
927 {209, "User authentication failed"},
928 {210, "Context not found"},
929 {211, "All PDP dynamic addresses are occupied"},
930 {212, "No memory is available"},
931 {213, "Relocation failure"},
932 {214, "Unknown mandatory extension header"},
933 {215, "Semantic error in the TFT operation"},
934 {216, "Syntactic error in the TFT operation"},
935 {217, "Semantic errors in packet filter(s)"},
936 {218, "Syntactic errors in packet filter(s)"},
937 {219, "Missing or unknown APN"},
938 {220, "Unknown PDP address or PDP type"},
939 {221, "PDP context without TFT already activated"},
940 {222, "APN access denied - no subscription"},
941 {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
942 {224, "MS MBMS Capabilities Insufficient"},
943 {225, "Invalid Correlation-ID"},
944 {226, "MBMS Bearer Context Superseded"},
945 {227, "Bearer Control Mode violation"},
946 {228, "Collision with network initiated request"},
947 /* For future use 229-240 */
948 /* Cause values reserved for GPRS charging
949 * protocol use (see GTP' in 3GPP TS 32.295 [33])
952 {252, "Request related to possibly duplicated packets already fulfilled"}, /* charging */
953 {253, "Request already fulfilled"}, /* charging */
954 {254, "Sequence numbers of released/cancelled packets IE incorrect"}, /* charging */
955 {255, "Request not fulfilled"}, /* charging */
958 static value_string_ext cause_type_ext = VALUE_STRING_EXT_INIT(cause_type);
961 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
962 * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
965 static const value_string gsn_addr_type[] = {
971 static const value_string pdp_type[] = {
980 static const value_string pdp_org_type[] = {
986 static const value_string qos_delay_type[] = {
987 {0x00, "Subscribed delay class (in MS to network direction)"},
988 {0x01, "Delay class 1"},
989 {0x02, "Delay class 2"},
990 {0x03, "Delay class 3"},
991 {0x04, "Delay class 4 (best effort)"},
996 static const value_string qos_reliability_type[] = {
997 {0x00, "Subscribed reliability class (in MS to network direction)"},
998 {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
999 {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
1000 {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
1001 {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
1002 {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
1007 static const value_string qos_peak_type[] = {
1008 {0x00, "Subscribed peak throughput (in MS to network direction)"},
1009 {0x01, "Up to 1 000 oct/s"},
1010 {0x02, "Up to 2 000 oct/s"},
1011 {0x03, "Up to 4 000 oct/s"},
1012 {0x04, "Up to 8 000 oct/s"},
1013 {0x05, "Up to 16 000 oct/s"},
1014 {0x06, "Up to 32 000 oct/s"},
1015 {0x07, "Up to 64 000 oct/s"},
1016 {0x08, "Up to 128 000 oct/s"},
1017 {0x09, "Up to 256 000 oct/s"},
1018 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
1028 static const value_string qos_precedence_type[] = {
1029 {0x00, "Subscribed precedence (in MS to network direction)"},
1030 {0x01, "High priority"},
1031 {0x02, "Normal priority"},
1032 {0x03, "Low priority"},
1037 static const value_string qos_mean_type[] = {
1038 {0x00, "Subscribed mean throughput (in MS to network direction)"},
1039 {0x01, "100 oct/h"}, /* Class 2 */
1040 {0x02, "200 oct/h"}, /* Class 3 */
1041 {0x03, "500 oct/h"}, /* Class 4 */
1042 {0x04, "1 000 oct/h"}, /* Class 5 */
1043 {0x05, "2 000 oct/h"}, /* Class 6 */
1044 {0x06, "5 000 oct/h"}, /* Class 7 */
1045 {0x07, "10 000 oct/h"}, /* Class 8 */
1046 {0x08, "20 000 oct/h"}, /* Class 9 */
1047 {0x09, "50 000 oct/h"}, /* Class 10 */
1048 {0x0A, "100 000 oct/h"}, /* Class 11 */
1049 {0x0B, "200 000 oct/h"}, /* Class 12 */
1050 {0x0C, "500 000 oct/h"}, /* Class 13 */
1051 {0x0D, "1 000 000 oct/h"}, /* Class 14 */
1052 {0x0E, "2 000 000 oct/h"}, /* Class 15 */
1053 {0x0F, "5 000 000 oct/h"}, /* Class 16 */
1054 {0x10, "10 000 000 oct/h"}, /* Class 17 */
1055 {0x11, "20 000 000 oct/h"}, /* Class 18 */
1056 {0x12, "50 000 000 oct/h"}, /* Class 19 */
1057 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
1070 {0x1F, "Best effort"}, /* Class 1 */
1073 static value_string_ext qos_mean_type_ext = VALUE_STRING_EXT_INIT(qos_mean_type);
1075 static const value_string qos_del_err_sdu[] = {
1076 {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
1077 {0x01, "No detect ('-')"},
1078 {0x02, "Erroneous SDUs are delivered ('yes')"},
1079 {0x03, "Erroneous SDUs are not delivered ('no')"},
1080 {0x07, "Reserved"}, /* All other values are reserved */
1084 static const value_string qos_del_order[] = {
1085 {0x00, "Subscribed delivery order (in MS to network direction)"},
1086 {0x01, "With delivery order ('yes')"},
1087 {0x02, "Without delivery order ('no')"},
1088 {0x03, "Reserved"}, /* All other values are reserved */
1092 static const value_string qos_traf_class[] = {
1093 {0x00, "Subscribed traffic class (in MS to network direction)"},
1094 {0x01, "Conversational class"},
1095 {0x02, "Streaming class"},
1096 {0x03, "Interactive class"},
1097 {0x04, "Background class"},
1098 {0x07, "Reserved"}, /* All other values are reserved */
1102 static const value_string qos_max_sdu_size[] = {
1103 {0x00, "Subscribed maximum SDU size (in MS to network direction"},
1104 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
1105 {0x97, "1502 octets"},
1106 {0x98, "1510 octets"},
1107 {0x99, "1520 octets"},
1108 {0, NULL} /* All other values are reserved */
1111 static const value_string qos_max_ul[] = {
1112 {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
1113 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1114 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1115 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1120 static const value_string qos_max_dl[] = {
1121 {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
1122 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1123 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1124 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1129 static const value_string qos_res_ber[] = {
1130 {0x00, "Subscribed residual BER (in MS to network direction)"},
1131 {0x01, "1/20 = 5x10^-2"},
1132 {0x02, "1/100 = 1x10^-2"},
1133 {0x03, "1/200 = 5x10^-3"},
1134 {0x04, "1/250 = 4x10^-3"},
1135 {0x05, "1/1 000 = 1x10^-3"},
1136 {0x06, "1/10 000 = 1x10^-4"},
1137 {0x07, "1/100 000 = 1x10^-5"},
1138 {0x08, "1/1 000 000 = 1x10^-6"},
1139 {0x09, "3/50 000 000 = 6x10^-8"},
1140 {0x0F, "Reserved"}, /* All other values are reserved */
1144 static const value_string qos_sdu_err_ratio[] = {
1145 {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
1146 {0x01, "1/100 = 1x10^-2"},
1147 {0x02, "7/1000 = 7x10^-3"},
1148 {0x03, "1/1 000 = 1x10^-3"},
1149 {0x04, "1/10 000 = 1x10^-4"},
1150 {0x05, "1/100 000 = 1x10^-5"},
1151 {0x06, "1/1 000 000 = 1x10^-6"},
1152 {0x07, "1/10 = 1x10^-1"},
1153 {0x0F, "Reserved"}, /* All other values are reserved */
1157 static const value_string qos_traf_handl_prio[] = {
1158 {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
1159 {0x01, "Priority level 1"},
1160 {0x02, "Priority level 2"},
1161 {0x03, "Priority level 3"},
1165 static const value_string qos_trans_delay[] = {
1166 {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
1167 {0x01, "10 ms"}, /* Using a granularity of 10 ms */
1182 {0x10, "200 ms"}, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
1198 {0x20, "1000 ms"}, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
1232 static value_string_ext qos_trans_delay_ext = VALUE_STRING_EXT_INIT(qos_trans_delay);
1234 static const value_string qos_guar_ul[] = {
1235 {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
1236 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1237 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1238 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1243 static const value_string src_stat_desc_vals[] = {
1250 static const true_false_string gtp_sig_ind = {
1251 "Optimised for signalling traffic",
1252 "Not optimised for signalling traffic"
1255 static const value_string qos_guar_dl[] = {
1256 {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
1257 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1258 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1259 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1264 static const value_string sel_mode_type[] = {
1265 {0, "MS or network provided APN, subscribed verified"},
1266 {1, "MS provided APN, subscription not verified"},
1267 {2, "Network provided APN, subscription not verified"},
1268 {3, "For future use (Network provided APN, subscription not verified"}, /* Shall not be sent. If received, shall be sent as value 2 */
1272 static const value_string tr_comm_type[] = {
1273 {1, "Send data record packet"},
1274 {2, "Send possibly duplicated data record packet"},
1275 {3, "Cancel data record packet"},
1276 {4, "Release data record packet"},
1280 /* TODO: CHeck if all ms_reasons are included */
1281 static const value_string ms_not_reachable_type[] = {
1282 {0, "No paging response via the MSC"},
1283 {1, "IMSI detached"},
1284 {2, "Roaming restriction"},
1285 {3, "Deregistered in the HLR for non GPRS"},
1286 {4, "MS purge for non GPRS"},
1287 {5, "No paging response via the SGSN"},
1288 {6, "GPRS detached"},
1289 {7, "Deregistered in the HLR for non GPRS"},
1290 {8, "MS purged for GPRS"},
1291 {9, "Unidentified subscriber via the MSC"},
1292 {10, "Unidentified subscriber via the SGSN"},
1296 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1298 static const value_string ranap_cause_type[] = {
1299 /* Radio Network Layer Cause (1-->64) */
1300 {1, "RAB preempted"},
1301 {2, "Trelocoverall Expiry"},
1302 {3, "Trelocprep Expiry"},
1303 {4, "Treloccomplete Expiry"},
1304 {5, "Tqueuing Expiry"},
1305 {6, "Relocation Triggered"},
1306 {7, "TRELOCalloc Expiry"},
1307 {8, "Unable to Establish During Relocation"},
1308 {9, "Unknown Target RNC"},
1309 {10, "Relocation Cancelled"},
1310 {11, "Successful Relocation"},
1311 {12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
1312 {13, "Change of Ciphering and/or Integrity Protection is not supported"},
1313 {14, "Failure in the Radio Interface Procedure"},
1314 {15, "Release due to UTRAN Generated Reason"},
1315 {16, "User Inactivity"},
1316 {17, "Time Critical Relocation"},
1317 {18, "Requested Traffic Class not Available"},
1318 {19, "Invalid RAB Parameters Value"},
1319 {20, "Requested Maximum Bit Rate not Available"},
1320 {21, "Requested Guaranteed Bit Rate not Available"},
1321 {22, "Requested Transfer Delay not Achievable"},
1322 {23, "Invalid RAB Parameters Combination"},
1323 {24, "Condition Violation for SDU Parameters"},
1324 {25, "Condition Violation for Traffic Handling Priority"},
1325 {26, "Condition Violation for Guaranteed Bit Rate"},
1326 {27, "User Plane Versions not Supported"},
1327 {28, "Iu UP Failure"},
1328 {29, "Relocation Failure in Target CN/RNC or Target System"},
1329 {30, "Invalid RAB ID"},
1330 {31, "No Remaining RAB"},
1331 {32, "Interaction with other procedure"},
1332 {33, "Requested Maximum Bit Rate for DL not Available"},
1333 {34, "Requested Maximum Bit Rate for UL not Available"},
1334 {35, "Requested Guaranteed Bit Rate for DL not Available"},
1335 {36, "Requested Guaranteed Bit Rate for UL not Available"},
1336 {37, "Repeated Integrity Checking Failure"},
1337 {38, "Requested Report Type not supported"},
1338 {39, "Request superseded"},
1339 {40, "Release due to UE generated signalling connection release"},
1340 {41, "Resource Optimisation Relocation"},
1341 {42, "Requested Information Not Available"},
1342 {43, "Relocation desirable for radio reasons"},
1343 {44, "Relocation not supported in Target RNC or Target System"},
1344 {45, "Directed Retry"},
1345 {46, "Radio Connection With UE Lost"},
1346 {47, "rNC-unable-to-establish-all-RFCs"},
1347 {48, "deciphering-keys-not-available"},
1348 {49, "dedicated-assistance-data-not-available"},
1349 {50, "relocation-target-not-allowed"},
1350 {51, "location-reporting-congestion"},
1351 {52, "reduce-load-in-serving-cell"},
1352 {53, "no-radio-resources-available-in-target-cell"},
1353 {54, "gERAN-Iumode-failure"},
1354 {55, "access-restricted-due-to-shared-networks"},
1355 {56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
1356 {57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
1357 {58, "mBMS-no-multicast-service-for-this-UE"},
1358 {59, "mBMS-unknown-UE-ID"},
1359 {60, "successful-MBMS-session-start-no-data-bearer-necessary"},
1360 {61, "mBMS-superseded-due-to-NNSF"},
1361 {62, "mBMS-UE-linking-already-done"},
1362 {63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
1363 {64, "tMGI-unknown"},
1364 /* Transport Layer Cause (65-->80) */
1365 {65, "Signalling Transport Resource Failure"},
1366 {66, "Iu Transport Connection Failed to Establish"},
1367 /* NAS Cause (81-->96) */
1368 {81, "User Restriction Start Indication"},
1369 {82, "User Restriction End Indication"},
1370 {83, "Normal Release"},
1371 /* Protocol Cause (97-->112) */
1372 {97, "Transfer Syntax Error"},
1373 {98, "Semantic Error"},
1374 {99, "Message not compatible with receiver state"},
1375 {100, "Abstract Syntax Error (Reject)"},
1376 {101, "Abstract Syntax Error (Ignore and Notify)"},
1377 {102, "Abstract Syntax Error (Falsely Constructed Message"},
1378 /* Miscellaneous Cause (113-->128) */
1379 {113, "O & M Intervention"},
1380 {114, "No Resource Available"},
1381 {115, "Unspecified Failure"},
1382 {116, "Network Optimisation"},
1383 /* Non-standard Cause (129-->255) */
1385 /* ranap_CauseRadioNetworkExtension ??
1386 { 257, "iP-multicast-address-and-APN-not-valid" },
1387 { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
1388 { 259, "mBMS-request-superseded" },
1389 { 260, "mBMS-de-registration-during-session-not-allowed" },
1390 { 261, "mBMS-no-data-bearer-necessary" },
1395 static value_string_ext ranap_cause_type_ext = VALUE_STRING_EXT_INIT(ranap_cause_type);
1397 static const value_string mm_sec_modep[] = {
1398 {0, "Used cipher value, UMTS keys and Quintuplets"},
1399 {1, "GSM key and triplets"},
1400 {2, "UMTS key and quintuplets"},
1401 {3, "GSM key and quintuplets"},
1405 static const value_string gtp_cipher_algorithm[] = {
1406 {0, "No ciphering"},
1416 static const value_string gtp_ext_rat_type_vals[] = {
1422 {5, "HSPA Evolution"},
1426 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
1427 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
1428 #define MM_PROTO_PDSS1 0x02
1429 #define MM_PROTO_CALL_CONTROL 0x03
1430 #define MM_PROTO_PDSS2 0x04
1431 #define MM_PROTO_MM_NON_GPRS 0x05
1432 #define MM_PROTO_RR_MGMT 0x06
1433 #define MM_PROTO_MM_GPRS 0x08
1434 #define MM_PROTO_SMS 0x09
1435 #define MM_PROTO_SESSION_MGMT 0x0A
1436 #define MM_PROTO_NON_CALL_RELATED 0x0B
1438 static const value_string tft_code_type[] = {
1440 {1, "Create new TFT"},
1441 {2, "Delete existing TFT"},
1442 {3, "Add packet filters to existing TFT"},
1443 {4, "Replace packet filters in existing TFT"},
1444 {5, "Delete packet filters from existing TFT"},
1451 static dissector_handle_t ip_handle;
1452 static dissector_handle_t ipv6_handle;
1453 static dissector_handle_t ppp_handle;
1454 static dissector_handle_t data_handle;
1455 static dissector_handle_t gtpcdr_handle;
1456 static dissector_handle_t sndcpxid_handle;
1457 static dissector_handle_t gtpv2_handle;
1458 static dissector_table_t bssap_pdu_type_table;
1460 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype);
1462 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1463 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1464 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1465 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1466 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1467 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1468 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1469 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1470 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1471 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1472 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1473 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1474 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1475 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1476 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1477 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1478 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1479 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1480 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1481 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1482 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1483 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1484 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1485 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1486 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1487 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1488 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1489 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1490 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1491 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1492 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1493 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1494 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1495 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1496 static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1497 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1498 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1499 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1500 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1501 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1502 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1503 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1504 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1505 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1506 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1508 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1509 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1510 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1511 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1512 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1513 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1514 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1515 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1516 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1517 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1518 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1519 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1520 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1521 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1522 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1523 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1524 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1525 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1526 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1527 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1528 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1529 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1530 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1531 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1532 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1533 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1534 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1535 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1536 static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1537 static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1538 static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1539 static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1540 static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1541 static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1542 static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1543 static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1544 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1545 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1546 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1547 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1548 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1549 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1550 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1551 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1552 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1553 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1554 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1555 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1556 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1558 typedef struct _gtp_opt {
1560 int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *);
1563 static const gtp_opt_t gtpopt[] = {
1564 {GTP_EXT_CAUSE, decode_gtp_cause},
1565 {GTP_EXT_IMSI, decode_gtp_imsi},
1566 {GTP_EXT_RAI, decode_gtp_rai},
1567 {GTP_EXT_TLLI, decode_gtp_tlli},
1568 {GTP_EXT_PTMSI, decode_gtp_ptmsi},
1569 {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
1570 {GTP_EXT_REORDER, decode_gtp_reorder},
1571 {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
1572 {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
1573 {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
1574 {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
1575 {GTP_EXT_RECOVER, decode_gtp_recovery},
1576 {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
1577 {GTP_EXT_16, decode_gtp_16},
1578 {GTP_EXT_17, decode_gtp_17},
1579 {GTP_EXT_18, decode_gtp_18},
1580 {GTP_EXT_19, decode_gtp_19},
1581 {GTP_EXT_NSAPI, decode_gtp_nsapi},
1582 {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
1583 {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
1584 {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
1585 {GTP_EXT_RP, decode_gtp_rp},
1586 {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
1587 {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
1588 {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
1589 {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
1590 {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
1591 {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
1592 {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
1593 {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
1594 {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
1595 {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
1596 {GTP_EXT_APN, decode_gtp_apn},
1597 {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
1598 {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
1599 {GTP_EXT_MSISDN, decode_gtp_msisdn},
1600 {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts}, /* 3G */
1601 {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui}, /* 3G */
1602 {GTP_EXT_TFT, decode_gtp_tft}, /* 3G */
1603 {GTP_EXT_TARGET_ID, decode_gtp_target_id}, /* 3G */
1604 {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont}, /* 3G */
1605 {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup}, /* 3G */
1606 {GTP_EXT_HDR_LIST, decode_gtp_hdr_list}, /* 3G */
1607 {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id}, /* 3G */
1608 {GTP_EXT_OMC_ID, decode_gtp_omc_id}, /* 3G */
1609 /* TS 29 060 V6.11.0 */
1610 {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont}, /* 7.7.43 */
1611 {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio}, /* 7.7.45 */
1612 {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf}, /* 7.7.45A */
1613 {GTP_EXT_SSGN_NO, decode_gtp_ssgn_no}, /* 7.7.47 */
1614 {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs}, /* 7.7.48 */
1615 {GTP_EXT_APN_RES, decode_gtp_apn_res}, /* 3G */
1616 {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs}, /* 7.7.25B */
1617 {GTP_EXT_RAT_TYPE, decode_gtp_rat_type}, /* 3G */
1618 {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf}, /* 7.7.51 */
1619 {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone}, /* 7.7.52 */
1620 {GTP_EXT_IMEISV, decode_gtp_imeisv}, /* 3G 7.7.53 */
1621 {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con}, /* 7.7.54 */
1622 {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx}, /* 7.7.55 */
1623 {GTP_EXT_TMGI, decode_gtp_tmgi}, /* 7.7.56 */
1624 {GTP_EXT_RIM_RA, decode_gtp_rim_ra}, /* 7.7.57 */
1625 {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt}, /* 7.7.58 */
1626 {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa}, /* 7.7.60 */
1627 {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf}, /* 7.7.61 */
1628 {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf}, /* 7.7.62 */
1629 {GTP_EXT_HOP_COUNT, decode_gtp_hop_count}, /* 7.7.63 */
1630 {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id}, /* 7.7.64 */
1631 {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id}, /* 7.7.65 */
1632 {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind}, /* 7.7.66 */
1633 {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi}, /* 7.7.67 */
1634 {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur}, /* 7.7.59 */
1635 {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf}, /* 7.7.68 */
1636 {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no}, /* 7.7.69 */
1637 {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr}, /* 7.7.70 */
1638 {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx}, /* 7.7.71 */
1639 {GTP_EXT_BSS_CONT, decode_gtp_bss_cont}, /* 7.7.72 */
1640 {GTP_EXT_CELL_ID, decode_gtp_cell_id}, /* 7.7.73 */
1641 {GTP_EXT_PDU_NO, decode_gtp_pdu_no}, /* 7.7.74 */
1642 {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause}, /* 7.7.75 */
1643 {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap}, /* 7.7.76 */
1644 {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc}, /* 7.7.77 */
1645 {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc}, /* 7.7.78 */
1646 {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid}, /* 7.7.79 */
1647 {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act}, /* 7.7.80 */
1648 {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg}, /* 7.7.81 */
1649 {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id}, /* 7.7.82 */
1650 {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod}, /* 7.7.83 */
1652 {GTP_EXT_REL_PACK, decode_gtp_rel_pack}, /* charging */
1653 {GTP_EXT_CAN_PACK, decode_gtp_can_pack}, /* charging */
1654 {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
1655 {GTP_EXT_DATA_REQ, decode_gtp_data_req}, /* charging */
1656 {GTP_EXT_DATA_RESP, decode_gtp_data_resp}, /* charging */
1657 {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
1658 {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
1659 {0, decode_gtp_unknown}
1668 static guint8 gtp_version = 0;
1669 static const char *yesno[] = { "no", "yes" };
1671 static gchar *id_to_str(const guint8 * ad)
1674 static gchar str[17] = " ";
1675 guint8 bits8to5, bits4to1;
1677 static const gchar hex_digits[10] = "0123456789";
1679 for (i = 0; i < 8; i++) {
1680 bits8to5 = (ad[i] >> 4) & 0x0F;
1681 bits4to1 = ad[i] & 0x0F;
1683 str[j++] = hex_digits[bits4to1];
1685 str[j++] = hex_digits[bits8to5];
1691 static gchar *imsi_to_str(const guint8 * ad)
1694 static gchar str[17] = " ";
1697 for (i = 0; i < 8; i++) {
1698 if ((ad[i] & 0x0F) <= 9)
1699 str[j++] = (ad[i] & 0x0F) + 0x30;
1700 if (((ad[i] >> 4) & 0x0F) <= 9)
1701 str[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
1708 static gchar *msisdn_to_str(const guint8 * ad, int len)
1711 static gchar str[18] = "+ ";
1712 guint8 bits8to5, bits4to1;
1714 static const gchar hex_digits[10] = "0123456789";
1716 for (i = 1; i < len && i < 9; i++) {
1717 bits8to5 = (ad[i] >> 4) & 0x0F;
1718 bits4to1 = ad[i] & 0x0F;
1720 str[j++] = hex_digits[bits4to1];
1722 str[j++] = hex_digits[bits8to5];
1729 /* Next definitions and function check_field_presence checks if given field
1730 * in GTP packet is compliant with ETSI
1732 typedef struct _header {
1737 typedef struct _message {
1739 ext_header fields[32];
1742 /* ---------------------
1744 * ---------------------*/
1745 static _gtp_mess_items gprs_mess_items[] = {
1749 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1754 GTP_MSG_ECHO_RESP, {
1755 {GTP_EXT_RECOVER, GTP_MANDATORY},
1756 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1761 GTP_MSG_VER_NOT_SUPP, {
1766 GTP_MSG_NODE_ALIVE_REQ, {
1767 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
1768 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1773 GTP_MSG_NODE_ALIVE_RESP, {
1774 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1779 GTP_MSG_REDIR_REQ, {
1780 {GTP_EXT_CAUSE, GTP_MANDATORY},
1781 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
1782 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1787 GTP_MSG_REDIR_RESP, {
1788 {GTP_EXT_CAUSE, GTP_MANDATORY},
1789 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1794 GTP_MSG_CREATE_PDP_REQ, {
1795 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1796 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1797 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1798 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1799 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1800 {GTP_EXT_MSISDN, GTP_MANDATORY},
1801 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1802 {GTP_EXT_APN, GTP_MANDATORY},
1803 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1804 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1805 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1806 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1811 GTP_MSG_CREATE_PDP_RESP, {
1812 {GTP_EXT_CAUSE, GTP_MANDATORY},
1813 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1814 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1815 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1816 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1817 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1818 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1819 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1820 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1821 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1822 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1823 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1824 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1829 GTP_MSG_UPDATE_PDP_REQ, {
1830 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1831 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1832 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1833 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1834 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1835 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1836 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1841 GTP_MSG_UPDATE_PDP_RESP, {
1842 {GTP_EXT_CAUSE, GTP_MANDATORY},
1843 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1844 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1845 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1846 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1847 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1848 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1849 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1850 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1851 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1856 GTP_MSG_DELETE_PDP_REQ, {
1857 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1862 GTP_MSG_DELETE_PDP_RESP, {
1863 {GTP_EXT_CAUSE, GTP_MANDATORY},
1864 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1869 GTP_MSG_CREATE_AA_PDP_REQ, {
1870 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1871 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1872 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1873 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1874 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1875 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1876 {GTP_EXT_APN, GTP_MANDATORY},
1877 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1878 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1879 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1880 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1885 GTP_MSG_CREATE_AA_PDP_RESP, {
1886 {GTP_EXT_CAUSE, GTP_MANDATORY},
1887 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1888 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1889 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1890 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1891 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1892 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1893 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1894 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1895 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1896 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1897 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1898 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1903 GTP_MSG_DELETE_AA_PDP_REQ, {
1904 {GTP_EXT_CAUSE, GTP_MANDATORY},
1905 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1910 GTP_MSG_DELETE_AA_PDP_RESP, {
1911 {GTP_EXT_CAUSE, GTP_MANDATORY},
1912 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1918 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1923 GTP_MSG_PDU_NOTIFY_REQ, {
1924 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1925 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1930 GTP_MSG_PDU_NOTIFY_RESP, {
1931 {GTP_EXT_CAUSE, GTP_MANDATORY},
1932 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1937 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1938 {GTP_EXT_CAUSE, GTP_MANDATORY},
1939 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1940 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1945 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1946 {GTP_EXT_CAUSE, GTP_MANDATORY},
1947 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1952 GTP_MSG_SEND_ROUT_INFO_REQ, {
1953 {GTP_EXT_IMSI, GTP_MANDATORY},
1954 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1959 GTP_MSG_SEND_ROUT_INFO_RESP, {
1960 {GTP_EXT_CAUSE, GTP_MANDATORY},
1961 {GTP_EXT_IMSI, GTP_MANDATORY},
1962 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
1963 {GTP_EXT_MS_REASON, GTP_OPTIONAL},
1964 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
1965 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1970 GTP_MSG_FAIL_REP_REQ, {
1971 {GTP_EXT_IMSI, GTP_MANDATORY},
1972 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1977 GTP_MSG_FAIL_REP_RESP, {
1978 {GTP_EXT_CAUSE, GTP_MANDATORY},
1979 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
1980 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1985 GTP_MSG_MS_PRESENT_REQ, {
1986 {GTP_EXT_IMSI, GTP_MANDATORY},
1987 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1988 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1993 GTP_MSG_MS_PRESENT_RESP, {
1994 {GTP_EXT_CAUSE, GTP_MANDATORY},
1995 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2000 GTP_MSG_IDENT_REQ, {
2001 {GTP_EXT_RAI, GTP_MANDATORY},
2002 {GTP_EXT_PTMSI, GTP_MANDATORY},
2003 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2004 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2009 GTP_MSG_IDENT_RESP, {
2010 {GTP_EXT_CAUSE, GTP_MANDATORY},
2011 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2012 {GTP_EXT_AUTH_TRI, GTP_OPTIONAL},
2013 {GTP_EXT_AUTH_QUI, GTP_OPTIONAL},
2014 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2019 GTP_MSG_SGSN_CNTXT_REQ, {
2020 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2021 {GTP_EXT_RAI, GTP_MANDATORY},
2022 {GTP_EXT_TLLI, GTP_MANDATORY},
2023 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2024 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2025 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
2030 GTP_MSG_SGSN_CNTXT_RESP, {
2031 {GTP_EXT_CAUSE, GTP_MANDATORY},
2032 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2033 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
2034 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2035 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2036 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2041 GTP_MSG_SGSN_CNTXT_ACK, {
2042 {GTP_EXT_CAUSE, GTP_MANDATORY},
2043 {GTP_EXT_FLOW_II, GTP_CONDITIONAL},
2044 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2045 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2050 GTP_MSG_DATA_TRANSF_REQ, {
2051 {GTP_EXT_TR_COMM, GTP_MANDATORY},
2052 {GTP_EXT_DATA_REQ, GTP_CONDITIONAL},
2053 {GTP_EXT_REL_PACK, GTP_CONDITIONAL},
2054 {GTP_EXT_CAN_PACK, GTP_CONDITIONAL},
2055 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2060 GTP_MSG_DATA_TRANSF_RESP, {
2061 {GTP_EXT_CAUSE, GTP_MANDATORY},
2062 {GTP_EXT_DATA_RESP, GTP_MANDATORY},
2063 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2074 /* -----------------------------
2076 * -----------------------------*/
2077 static _gtp_mess_items umts_mess_items[] = {
2078 /* 7.2 Path Management Messages */
2081 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2086 GTP_MSG_ECHO_RESP, {
2087 {GTP_EXT_RECOVER, GTP_MANDATORY},
2088 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2093 GTP_MSG_VER_NOT_SUPP, {
2098 GTP_MSG_SUPP_EXT_HDR, {
2099 {GTP_EXT_HDR_LIST, GTP_MANDATORY},
2105 GTP_MSG_NODE_ALIVE_REQ, {
2106 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
2107 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2112 GTP_MSG_NODE_ALIVE_RESP, {
2113 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2118 GTP_MSG_REDIR_REQ, {
2119 {GTP_EXT_CAUSE, GTP_MANDATORY},
2120 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
2121 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2126 GTP_MSG_REDIR_REQ, {
2130 /* 7.3 Tunnel Management Messages */
2132 GTP_MSG_CREATE_PDP_REQ, {
2133 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2134 /* RAI is in TS 29.060 V6.11.0 */
2135 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2136 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2137 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL},
2138 {GTP_EXT_TEID, GTP_MANDATORY},
2139 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2140 {GTP_EXT_NSAPI, GTP_MANDATORY},
2141 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2142 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},
2143 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2144 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2145 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2146 {GTP_EXT_APN, GTP_CONDITIONAL},
2147 {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL},
2148 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2149 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2150 {GTP_EXT_MSISDN, GTP_CONDITIONAL},
2151 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2152 {GTP_EXT_TFT, GTP_CONDITIONAL},
2153 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2154 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2155 /* TS 29.060 V6.11.0 */
2156 {GTP_EXT_APN_RES, GTP_OPTIONAL},
2157 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},
2158 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},
2159 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},
2160 {GTP_EXT_IMEISV, GTP_OPTIONAL},
2161 {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL},
2162 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},
2163 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2168 GTP_MSG_CREATE_PDP_RESP, {
2169 {GTP_EXT_CAUSE, GTP_MANDATORY},
2170 {GTP_EXT_REORDER, GTP_CONDITIONAL},
2171 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2172 {GTP_EXT_TEID, GTP_CONDITIONAL},
2173 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2174 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2175 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2176 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2177 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2178 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2179 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2180 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2181 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2182 /* TS 29.060 V6.11.0 */
2183 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2184 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2185 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2186 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2190 { /* checked, SGSN -> GGSN */
2191 GTP_MSG_UPDATE_PDP_REQ, {
2192 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2193 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2194 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2195 {GTP_EXT_TEID, GTP_MANDATORY},
2196 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2197 {GTP_EXT_NSAPI, GTP_MANDATORY},
2198 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2199 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2200 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2201 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2202 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
2203 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2204 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2205 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2206 {GTP_EXT_TFT, GTP_OPTIONAL},
2207 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2208 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2209 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2210 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2211 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2212 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2213 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2214 {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL}, /* Direct Tunnel Flags 7.7.81 */
2215 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2219 { /* checked, GGSN -> SGSN */
2220 GTP_MSG_UPDATE_PDP_RESP, {
2221 {GTP_EXT_CAUSE, GTP_MANDATORY},
2222 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2223 {GTP_EXT_TEID, GTP_CONDITIONAL},
2224 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2225 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2226 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2227 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2228 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2229 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2230 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2231 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2232 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2233 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2234 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2235 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2236 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2241 GTP_MSG_DELETE_PDP_REQ, {
2242 {GTP_EXT_TEAR_IND, GTP_CONDITIONAL},
2243 {GTP_EXT_NSAPI, GTP_MANDATORY},
2244 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2245 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2250 GTP_MSG_DELETE_PDP_RESP, {
2251 {GTP_EXT_CAUSE, GTP_MANDATORY},
2252 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2253 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2259 {GTP_EXT_TEID, GTP_MANDATORY},
2260 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GSN Address Mandatory 7.7.32 */
2261 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2266 GTP_MSG_PDU_NOTIFY_REQ, {
2267 {GTP_EXT_IMSI, GTP_MANDATORY},
2268 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2269 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2270 {GTP_EXT_APN, GTP_MANDATORY},
2271 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2272 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2273 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2278 GTP_MSG_PDU_NOTIFY_RESP, {
2279 {GTP_EXT_CAUSE, GTP_MANDATORY},
2280 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2285 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2286 {GTP_EXT_CAUSE, GTP_MANDATORY},
2287 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2288 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2289 {GTP_EXT_APN, GTP_MANDATORY},
2290 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2291 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2296 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2297 {GTP_EXT_CAUSE, GTP_MANDATORY},
2298 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2302 /* 7.4 Location Management Messages */
2304 GTP_MSG_SEND_ROUT_INFO_REQ, {
2305 {GTP_EXT_IMSI, GTP_MANDATORY},
2306 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2311 GTP_MSG_SEND_ROUT_INFO_RESP, {
2312 {GTP_EXT_CAUSE, GTP_MANDATORY},
2313 {GTP_EXT_IMSI, GTP_MANDATORY},
2314 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2315 {GTPv1_EXT_MS_REASON, GTP_OPTIONAL},
2316 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
2317 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2322 GTP_MSG_FAIL_REP_REQ, {
2323 {GTP_EXT_IMSI, GTP_MANDATORY},
2324 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2329 GTP_MSG_FAIL_REP_RESP, {
2330 {GTP_EXT_CAUSE, GTP_MANDATORY},
2331 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2332 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2337 GTP_MSG_MS_PRESENT_REQ, {
2338 {GTP_EXT_IMSI, GTP_MANDATORY},
2339 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2340 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2345 GTP_MSG_MS_PRESENT_RESP, {
2346 {GTP_EXT_CAUSE, GTP_MANDATORY},
2347 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2351 /* 7.5 Mobility Management Messages */
2353 GTP_MSG_IDENT_REQ, {
2354 {GTP_EXT_RAI, GTP_MANDATORY},
2355 {GTP_EXT_PTMSI, GTP_MANDATORY},
2356 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2357 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* SGSN Address for Control Plane Optional 7.7.32 */
2358 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2359 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2364 GTP_MSG_IDENT_RESP, {
2365 {GTP_EXT_CAUSE, GTP_MANDATORY},
2366 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2367 {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL},
2368 {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL},
2369 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2374 GTP_MSG_SGSN_CNTXT_REQ, {
2375 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2376 {GTP_EXT_RAI, GTP_MANDATORY},
2377 {GTP_EXT_TLLI, GTP_CONDITIONAL},
2378 {GTP_EXT_PTMSI, GTP_CONDITIONAL},
2379 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2380 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2381 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2382 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2383 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
2384 {GTP_EXT_SSGN_NO, GTP_OPTIONAL}, /* SGSN Number Optional 7.7.47 */
2385 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2386 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2391 GTP_MSG_SGSN_CNTXT_RESP, {
2392 {GTP_EXT_CAUSE, GTP_MANDATORY},
2393 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2394 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2395 {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL}, /* RAB Context Conditional 7.7.19 */
2396 {GTP_EXT_RP_SMS, GTP_OPTIONAL},
2397 {GTP_EXT_RP, GTP_OPTIONAL},
2398 {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL},
2399 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2400 {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL}, /* Radio Priority LCS Optional 7.7.25B */
2401 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2402 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2403 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2404 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2405 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2406 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2411 GTP_MSG_SGSN_CNTXT_ACK, {
2412 {GTP_EXT_CAUSE, GTP_MANDATORY},
2413 {GTP_EXT_TEID_II, GTP_CONDITIONAL},
2414 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2415 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2420 GTP_MSG_FORW_RELOC_REQ, {
2421 {GTP_EXT_IMSI, GTP_MANDATORY},
2422 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2423 {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY},
2424 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2425 {GTP_EXT_MM_CNTXT, GTP_MANDATORY},
2426 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2427 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2428 {GTP_EXT_TARGET_ID, GTP_MANDATORY},
2429 {GTP_EXT_UTRAN_CONT, GTP_MANDATORY},
2430 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2431 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2432 {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL}, /* Selected PLMN ID Optional 7.7.64 */
2433 {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL}, /* PS Handover Request Context Optional 7.7.71 */
2434 {GTP_EXT_BSS_CONT, GTP_OPTIONAL}, /* BSS Container Optional 7.7.72 */
2435 {GTP_EXT_CELL_ID, GTP_OPTIONAL}, /* Cell Identification Optional 7.7.73 */
2436 {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL}, /* BSSGP Cause Optional 7.7.75 */
2437 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2438 {GTP_EXT_SSGN_NO, GTP_OPTIONAL},
2443 GTP_MSG_FORW_RELOC_RESP, {
2444 {GTP_EXT_CAUSE, GTP_MANDATORY},
2445 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2446 {GTP_EXT_TEID_II, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
2447 {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL},
2448 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2449 {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL},
2450 {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL},
2451 {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL}, /* Additional RAB Setup Information Conditional 7.7.45A */
2452 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2457 GTP_MSG_FORW_RELOC_COMP, {
2458 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2463 GTP_MSG_RELOC_CANCEL_REQ, {
2464 {GTP_EXT_IMSI, GTP_MANDATORY},
2465 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2470 GTP_MSG_RELOC_CANCEL_RESP, {
2471 {GTP_EXT_CAUSE, GTP_MANDATORY},
2472 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2477 GTP_MSG_FORW_RELOC_ACK, {
2478 {GTP_EXT_CAUSE, GTP_MANDATORY},
2479 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2484 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2485 {GTP_EXT_CAUSE, GTP_MANDATORY},
2486 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2491 GTP_MSG_FORW_SRNS_CNTXT, {
2492 {GTP_EXT_RAB_CNTXT, GTP_MANDATORY},
2493 {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL}, /* Source RNC PDCP context info Optional 7.7.61 */
2494 {GTP_EXT_PDU_NO, GTP_OPTIONAL}, /* PDU Numbers Optional 7.7.74 */
2495 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2500 /* 7.5.14 RAN Information Management Messages */
2502 GTP_MSG_RAN_INFO_RELAY, {
2503 {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY}, /* RAN Transparent Container Mandatory 7.7.43 */
2504 {GTP_EXT_RIM_RA, GTP_OPTIONAL}, /* RIM Routing Address Optional 7.7.57 */
2505 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2509 /* 7.5A MBMS Messages
2510 * 7.5A.1 UE Specific MBMS Messages
2513 GTP_MBMS_NOTIFY_REQ, {
2514 {GTP_EXT_IMSI, GTP_MANDATORY}, /* IMSI Mandatory 7.7.2 */
2515 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2516 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2517 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2518 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2519 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GGSN Address for Control Plane Mandatory 7.7.32 */
2520 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2521 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2526 GTP_MBMS_NOTIFY_RES, {
2527 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2528 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2533 GTP_MBMS_NOTIFY_REJ_REQ, {
2534 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2535 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2536 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2537 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2538 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2539 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2544 GTP_MBMS_NOTIFY_REJ_RES, {
2545 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2546 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2551 GTP_CREATE_MBMS_CNTXT_REQ, {
2552 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2553 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2554 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2555 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL}, /* Selection mode Conditional 7.7.12 */
2556 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2557 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2558 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2559 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2560 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2561 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
2562 {GTP_EXT_MSISDN, GTP_CONDITIONAL}, /* MSISDN Conditional 7.7.33 */
2563 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2564 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2565 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2566 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2567 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2568 {GTP_EXT_IMEISV, GTP_OPTIONAL}, /* IMEI(SV) Optional 7.7.53 */
2569 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2570 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2571 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2572 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2573 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2578 GTP_CREATE_MBMS_CNTXT_RES, {
2579 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2580 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2581 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2582 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2583 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2584 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2585 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2586 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2587 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2588 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2593 GTP_UPD_MBMS_CNTXT_REQ, {
2594 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2595 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2596 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2597 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2598 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2599 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2600 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2601 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2602 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2603 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2604 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2605 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2606 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2607 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additional Trace Info Optional 7.7.62 */
2608 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2609 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2610 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2615 GTP_UPD_MBMS_CNTXT_RES, {
2616 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2617 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2618 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2619 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2620 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2621 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2622 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2623 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2624 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2629 GTP_DEL_MBMS_CNTXT_REQ, {
2630 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2631 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2632 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL}, /* End User Address Conditional 7.7.27 */
2633 {GTP_EXT_APN, GTP_CONDITIONAL}, /* Access Point Name Conditional 7.7.30 */
2634 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2635 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Conditional 7.7.67 */
2636 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2641 GTP_DEL_MBMS_CNTXT_RES, {
2642 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2643 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2644 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2650 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2651 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2652 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2658 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2659 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
2660 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2665 GTP_MBMS_DE_REG_REQ, {
2666 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2667 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2668 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2673 GTP_MBMS_DE_REG_RES, {
2674 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2675 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2680 GTP_MBMS_SES_START_REQ, {
2681 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2682 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2683 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2684 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2685 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2686 {GTP_EXT_QOS_UMTS, GTP_MANDATORY}, /* Quality of Service Profile Mandatory 7.7.34 */
2687 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Mandatory 7.7.48 */
2688 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
2689 {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY}, /* MBMS Session Duration Mandatory 7.7.59 */
2690 {GTP_EXT_MBMS_SA, GTP_MANDATORY}, /* MBMS Service Area Mandatory 7.7.60 */
2691 {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL}, /* MBMS Session Identifier Optional 7.7.65 */
2692 {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY}, /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
2693 {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
2694 {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY}, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
2695 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2700 GTP_MBMS_SES_START_RES, {
2701 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2702 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2703 {GTP_EXT_TEID, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
2704 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2705 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2706 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
2707 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2712 GTP_MBMS_SES_STOP_REQ, {
2713 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2714 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2715 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2720 GTP_MBMS_SES_STOP_RES, {
2721 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2722 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2733 /* Data structure attached to a conversation,
2734 to keep track of request/response-pairs
2736 typedef struct gtp_conv_info_t {
2737 struct gtp_conv_info_t *next;
2738 GHashTable *unmatched;
2739 GHashTable *matched;
2742 static gtp_conv_info_t *gtp_info_items = NULL;
2744 static guint gtp_sn_hash(gconstpointer k)
2746 const gtp_msg_hash_t *key = k;
2751 static gint gtp_sn_equal_matched(gconstpointer k1, gconstpointer k2)
2753 const gtp_msg_hash_t *key1 = k1;
2754 const gtp_msg_hash_t *key2 = k2;
2756 if ( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ) {
2760 if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ) {
2764 return key1->seq_nr == key2->seq_nr;
2767 static gint gtp_sn_equal_unmatched(gconstpointer k1, gconstpointer k2)
2769 const gtp_msg_hash_t *key1 = k1;
2770 const gtp_msg_hash_t *key2 = k2;
2772 return key1->seq_nr == key2->seq_nr;
2775 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype)
2777 gtp_msg_hash_t gcr, *gcrp = NULL;
2778 gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data;
2783 case GTP_MSG_ECHO_REQ:
2784 case GTP_MSG_CREATE_PDP_REQ:
2785 case GTP_MSG_UPDATE_PDP_REQ:
2786 case GTP_MSG_DELETE_PDP_REQ:
2787 gcr.is_request=TRUE;
2788 gcr.req_frame=pinfo->fd->num;
2791 case GTP_MSG_ECHO_RESP:
2792 case GTP_MSG_CREATE_PDP_RESP:
2793 case GTP_MSG_UPDATE_PDP_RESP:
2794 case GTP_MSG_DELETE_PDP_RESP:
2795 gcr.is_request=FALSE;
2797 gcr.rep_frame=pinfo->fd->num;
2803 gcrp = g_hash_table_lookup(gtp_info->matched, &gcr);
2807 gcrp->is_request=gcr.is_request;
2811 /*no match, let's try to make one*/
2813 case GTP_MSG_ECHO_REQ:
2814 case GTP_MSG_CREATE_PDP_REQ:
2815 case GTP_MSG_UPDATE_PDP_REQ:
2816 case GTP_MSG_DELETE_PDP_REQ:
2819 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2821 g_hash_table_remove(gtp_info->unmatched, gcrp);
2823 /* if we cant reuse the old one, grab a new chunk */
2825 gcrp = se_alloc(sizeof(gtp_msg_hash_t));
2827 gcrp->seq_nr=seq_nr;
2828 gcrp->req_frame = pinfo->fd->num;
2829 gcrp->req_time = pinfo->fd->abs_ts;
2830 gcrp->rep_frame = 0;
2831 gcrp->msgtype = msgtype;
2832 gcrp->is_request = TRUE;
2833 g_hash_table_insert(gtp_info->unmatched, gcrp, gcrp);
2836 case GTP_MSG_ECHO_RESP:
2837 case GTP_MSG_CREATE_PDP_RESP:
2838 case GTP_MSG_UPDATE_PDP_RESP:
2839 case GTP_MSG_DELETE_PDP_RESP:
2841 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2844 if (!gcrp->rep_frame) {
2845 g_hash_table_remove(gtp_info->unmatched, gcrp);
2846 gcrp->rep_frame=pinfo->fd->num;
2847 gcrp->is_request=FALSE;
2848 g_hash_table_insert(gtp_info->matched, gcrp, gcrp);
2857 /* we have found a match */
2862 if (gcrp->is_request) {
2863 it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
2864 PROTO_ITEM_SET_GENERATED(it);
2868 it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
2869 PROTO_ITEM_SET_GENERATED(it);
2870 nstime_delta(&ns, &pinfo->fd->abs_ts, &gcrp->req_time);
2871 it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
2872 PROTO_ITEM_SET_GENERATED(it);
2879 static int check_field_presence(guint8 message, guint8 field, int *position)
2883 _gtp_mess_items *mess_items;
2885 switch (gtp_version) {
2887 mess_items = gprs_mess_items;
2890 mess_items = umts_mess_items;
2896 while (mess_items[i].code) {
2897 if (mess_items[i].code == message) {
2899 while (mess_items[i].fields[*position].code) {
2900 if (mess_items[i].fields[*position].code == field) {
2904 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
2905 return mess_items[i].fields[(*position)++].code;
2919 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2921 /* GPRS: 9.60 v7.6.0, chapter
2922 * UMTS: 29.060 v4.0, chapter
2925 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2930 cause = tvb_get_guint8(tvb, offset + 1);
2932 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
2937 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2938 * UMTS: 29.060 v4.0, chapter 7.7.2
2940 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2946 tvb_memcpy(tvb, imsi_val, offset + 1, 8);
2947 imsi_str = imsi_to_str(imsi_val);
2949 proto_tree_add_string(tree, hf_gtp_imsi, tvb, offset, 9, imsi_str);
2954 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2955 * UMTS: 29.060 v4.0, chapter 7.7.3
2957 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2960 proto_tree *ext_tree_rai;
2965 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_RAI, >p_val_ext, "Unknown message"));
2966 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2968 byte[0] = tvb_get_guint8(tvb, offset + 1);
2969 byte[1] = tvb_get_guint8(tvb, offset + 2);
2970 byte[2] = tvb_get_guint8(tvb, offset + 3);
2971 mcc = (byte[0] & 0x0F) * 100 + ((byte[0] & 0xF0) >> 4) * 10 + (byte[1] & 0x0F);
2972 if ((byte[1] & 0xF0) == 0xF0)
2973 mnc = (byte[2] & 0x0F) * 10 + ((byte[2] & 0xF0) >> 4);
2975 mnc = (byte[2] & 0x0F) * 100 + ((byte[2] & 0xF0) >> 4) * 10 + ((byte[1] & 0xF0) >> 4);
2977 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mcc, tvb, offset + 1, 2, mcc);
2978 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mnc, tvb, offset + 2, 2, mnc);
2979 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_lac, tvb, offset + 4, 2, tvb_get_ntohs(tvb, offset + 4));
2980 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, tvb_get_guint8(tvb, offset + 6));
2985 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2986 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2988 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2993 tlli = tvb_get_ntohl(tvb, offset + 1);
2994 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
2999 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
3000 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
3002 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3007 ptmsi = tvb_get_ntohl(tvb, offset + 1);
3008 proto_tree_add_uint(tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
3013 /* adjust - how many bytes before offset should be highlighted
3015 static int decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 adjust)
3018 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
3019 proto_tree *ext_tree_qos;
3022 spare1 = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_SPARE1_MASK;
3023 delay = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_DELAY_MASK;
3024 reliability = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_RELIABILITY_MASK;
3025 peak = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
3026 spare2 = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
3027 precedence = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
3028 spare3 = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
3029 mean = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
3031 te = proto_tree_add_text(tree, tvb, offset - adjust, 3 + adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
3032 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
3033 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3036 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
3037 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
3038 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
3039 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
3040 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
3041 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
3042 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
3043 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
3049 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
3053 * TODO: check if length is included: ETSI 4.08 vs 9.60
3055 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3058 return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
3062 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
3063 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
3065 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3070 reorder = tvb_get_guint8(tvb, offset + 1) & 0x01;
3071 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
3076 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
3077 * 4.08 v7.1.2, chapter 10.5.3.1+
3078 * UMTS: 29.060 v4.0, chapter 7.7.7
3079 * TODO: Add blurb support by registering items in the protocol registration
3081 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3084 proto_tree *ext_tree_auth_tri;
3087 te = proto_tree_add_text(tree, tvb, offset, 29, "%s", val_to_str_ext_const(GTP_EXT_AUTH_TRI, >p_val_ext, "Unknown message"));
3088 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
3090 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + 1, 16));
3091 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + 17, 4));
3092 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + 21, 8));
3094 return 1 + 16 + 4 + 8;
3097 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
3098 * 9.02 v7.7.0, page 1090
3099 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
3100 * 29.002 v4.2.1, chapter 17.5, page 268
3102 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3107 map_cause = tvb_get_guint8(tvb, offset + 1);
3108 proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
3113 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
3114 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
3116 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3121 ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
3122 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
3127 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
3128 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
3130 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3135 ms_valid = tvb_get_guint8(tvb, offset + 1) & 0x01;
3136 proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
3141 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
3142 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
3144 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3149 recovery = tvb_get_guint8(tvb, offset + 1);
3150 proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
3155 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
3156 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
3160 static const gchar *dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb)
3164 /* Value in ASCII(UTF-8) */
3165 sel_mode = tvb_get_guint8(tvb, 0) - 0x30;
3166 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
3168 return val_to_str_const(sel_mode, sel_mode_type, "Unknown");
3171 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3174 proto_tree_add_item(tree, hf_gtp_sel_mode, tvb, offset, 2, FALSE);
3178 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
3179 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
3181 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3184 guint16 ext_flow_label;
3187 switch (gtp_version) {
3189 ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
3190 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
3194 teid_data = tvb_get_ntohl(tvb, offset + 1);
3195 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
3199 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
3205 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
3206 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
3208 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3214 switch (gtp_version) {
3216 flow_sig = tvb_get_ntohs(tvb, offset + 1);
3217 proto_tree_add_uint(tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
3220 teid_cp = tvb_get_ntohl(tvb, offset + 1);
3221 proto_tree_add_uint(tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
3224 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
3229 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
3230 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
3232 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3237 proto_tree *ext_tree_flow_ii;
3240 switch (gtp_version) {
3242 te = proto_tree_add_text(tree, tvb, offset, 4, "%s", val_to_str_ext_const(GTP_EXT_FLOW_II, >p_val_ext, "Unknown message"));
3243 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3245 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3247 flow_ii = tvb_get_ntohs(tvb, offset + 2);
3248 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
3252 te = proto_tree_add_text(tree, tvb, offset, 6, "%s", val_to_str_ext_const(GTP_EXT_TEID_II, >pv1_val_ext, "Unknown message"));
3253 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3255 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3258 teid_ii = tvb_get_ntohl(tvb, offset + 2);
3259 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
3263 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
3269 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
3270 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
3271 * Check if all ms_reason types are included
3273 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3278 field19 = tvb_get_guint8(tvb, offset + 1);
3280 switch (gtp_version) {
3282 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
3285 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
3288 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
3295 /* GPRS: not present
3296 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
3298 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3303 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3304 proto_tree_add_uint(tree, hf_gtp_nsapi, tvb, offset, 2, nsapi);
3309 /* GPRS: not present
3310 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
3312 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3317 ranap = tvb_get_guint8(tvb, offset + 1);
3319 if (ranap > 0 && ranap <= 64)
3320 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3321 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
3322 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3323 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3325 if (ranap > 64 && ranap <= 80)
3326 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3327 ranap, "%s (Transport Layer Cause) : %s (%u)",
3328 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3329 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3331 if (ranap > 80 && ranap <= 96)
3332 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3333 ranap, "%s (NAS Cause) : %s (%u)",
3334 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3335 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3337 if (ranap > 96 && ranap <= 112)
3338 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3339 "%s (Protocol Cause) : %s (%u)",
3340 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3341 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3343 if (ranap > 112 && ranap <= 128)
3344 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3345 "%s (Miscellaneous Cause) : %s (%u)",
3346 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3347 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3349 if (ranap > 128 /* && ranap <=255 */ )
3350 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3351 "%s (Non-standard Cause) : %s (%u)",
3352 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3353 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3358 /* GPRS: not present
3359 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
3361 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3365 proto_tree *ext_tree_rab_cntxt;
3368 te = proto_tree_add_text(tree, tvb, offset, 10, "%s", val_to_str_ext_const(GTP_EXT_RAB_CNTXT, >p_val_ext, "Unknown message"));
3369 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
3371 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3373 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3374 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, FALSE);
3375 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, FALSE);
3376 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, FALSE);
3377 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, FALSE);
3383 /* GPRS: not present
3384 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
3386 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3391 rp_sms = tvb_get_guint8(tvb, offset + 1) & 0x07;
3392 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
3397 /* GPRS: not present
3398 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
3400 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3403 proto_tree *ext_tree_rp;
3405 guint8 nsapi, rp, spare;
3407 nsapi = tvb_get_guint8(tvb, offset + 1) & 0xF0;
3408 spare = tvb_get_guint8(tvb, offset + 1) & 0x08;
3409 rp = tvb_get_guint8(tvb, offset + 1) & 0x07;
3411 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
3412 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
3414 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, nsapi);
3415 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, spare);
3416 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, rp);
3421 /* GPRS: not present
3422 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
3424 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3427 proto_tree *ext_tree_pkt_flow_id;
3429 guint8 nsapi, pkt_flow_id;
3431 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3432 pkt_flow_id = tvb_get_guint8(tvb, offset + 2);
3434 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);
3435 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
3437 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3438 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
3439 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);
3444 /* GPRS: not present
3445 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
3446 * TODO: Differenciate these uints?
3448 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3453 proto_tree *ext_tree_chrg_char;
3455 chrg_char = tvb_get_ntohs(tvb, offset + 1);
3457 te = proto_tree_add_uint(tree, hf_gtp_chrg_char, tvb, offset, 3, chrg_char);
3458 /*"%s: %x", val_to_str_ext_const (GTP_EXT_CHRG_CHAR, >p_val_ext, "Unknown message"), chrg_char); */
3459 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
3461 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_s, tvb, offset + 1, 2, chrg_char);
3462 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_n, tvb, offset + 1, 2, chrg_char);
3463 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_p, tvb, offset + 1, 2, chrg_char);
3464 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_f, tvb, offset + 1, 2, chrg_char);
3465 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_h, tvb, offset + 1, 2, chrg_char);
3466 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_r, tvb, offset + 1, 2, chrg_char);
3471 /* GPRS: not present
3472 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3474 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3479 trace_ref = tvb_get_ntohs(tvb, offset + 1);
3481 proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
3486 /* GPRS: not present
3487 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3489 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3494 trace_type = tvb_get_ntohs(tvb, offset + 1);
3496 proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
3501 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3502 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3504 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3509 reason = tvb_get_guint8(tvb, offset + 1);
3511 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
3517 * UMTS: 29.060 v6.11.0, chapter 7.7.25B
3518 * Radio Priority LCS
3520 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3524 proto_tree *ext_tree;
3527 length = tvb_get_ntohs(tvb, offset + 1);
3528 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"));
3529 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ra_prio_lcs);
3532 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
3533 offset = offset + 2;
3535 proto_tree_add_item(ext_tree, hf_gtp_ra_prio_lcs, tvb, offset, 1, FALSE);
3541 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
3544 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3549 tr_command = tvb_get_guint8(tvb, offset + 1);
3551 proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
3556 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3557 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3559 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3564 chrg_id = tvb_get_ntohl(tvb, offset + 1);
3565 proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
3570 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3571 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3573 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3577 guint8 pdp_typ, pdp_org;
3579 struct e_in6_addr addr_ipv6;
3580 proto_tree *ext_tree_user;
3584 length = tvb_get_ntohs(tvb, offset + 1);
3585 pdp_org = tvb_get_guint8(tvb, offset + 3) & 0x0F;
3586 pdp_typ = tvb_get_guint8(tvb, offset + 4);
3588 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s (%s/%s)",
3589 val_to_str_ext_const(GTP_EXT_USER_ADDR, >p_val_ext, "Unknown message"),
3590 val_to_str_const(pdp_org, pdp_org_type, "Unknown PDP Organization"),
3591 val_to_str_const(pdp_typ, pdp_type, "Unknown PDP Type"));
3592 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3594 proto_tree_add_text(ext_tree_user, tvb, offset + 1, 2, "Length : %u", length);
3595 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset + 3, 1, pdp_org);
3596 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
3599 if (pdp_org == 0 && pdp_typ == 1)
3600 proto_item_append_text(te, " (Point to Point Protocol)");
3601 else if (pdp_typ == 2)
3602 proto_item_append_text(te, " (Octet Stream Protocol)");
3603 } else if (length > 2) {
3606 addr_ipv4 = tvb_get_ipv4(tvb, offset + 5);
3607 proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, addr_ipv4);
3608 proto_item_append_text(te, " : %s", ip_to_str((guint8 *) & addr_ipv4));
3611 tvb_get_ipv6(tvb, offset + 5, &addr_ipv6);
3612 proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, (guint8 *) & addr_ipv6);
3613 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
3617 proto_item_append_text(te, " : empty PDP Address");
3622 static int decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3625 proto_tree *ext_tree_trip;
3626 proto_item *te_trip;
3629 for (i = 0; i < count; i++) {
3630 te_trip = proto_tree_add_text(tree, tvb, offset + i * 28, 28, "Triplet no%x", i);
3631 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3633 proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + i * 28, 16));
3634 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));
3635 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));
3641 /* adjust - how many bytes before quintuplet should be highlighted
3643 static int decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3646 proto_tree *ext_tree_quint;
3647 proto_item *te_quint;
3648 guint16 q_offset, i;
3649 guint8 xres_len, auth_len;
3653 for (i = 0; i < count; i++) {
3655 te_quint = proto_tree_add_text(tree, tvb, offset, -1, "Quintuplet #%x", i + 1);
3656 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3659 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
3660 q_offset = q_offset + 16;
3661 xres_len = tvb_get_guint8(tvb, offset + q_offset);
3662 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "XRES length: %u", xres_len);
3664 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));
3665 q_offset = q_offset + xres_len;
3666 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));
3667 q_offset = q_offset + 16;
3668 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));
3669 q_offset = q_offset + 16;
3670 auth_len = tvb_get_guint8(tvb, offset + q_offset);
3671 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "Authentication length: %u", auth_len);
3673 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));
3675 q_offset = q_offset + auth_len;
3676 proto_item_set_end(te_quint, tvb, offset + q_offset);
3683 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3684 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3685 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3686 * - finish displaying last 3 parameters
3688 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3691 guint16 length, quint_len, con_len;
3692 guint8 cksn, count, sec_mode, len;
3693 proto_tree *ext_tree_mm;
3695 proto_item *tf = NULL;
3696 proto_tree *tf_tree = NULL;
3700 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_MM_CNTXT, >p_val_ext, "Unknown message"));
3701 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3704 length = tvb_get_ntohs(tvb, offset + 1);
3709 cksn = tvb_get_guint8(tvb, offset + 3) & 0x07;
3711 sec_mode = (tvb_get_guint8(tvb, offset + 4) >> 6) & 0x03;
3712 count = (tvb_get_guint8(tvb, offset + 4) >> 3) & 0x07;
3714 proto_tree_add_text(ext_tree_mm, tvb, offset + 1, 2, "Length: %x", length);
3715 if (gtp_version == 0)
3720 case 0: /* Used cipher value, UMTS keys and Quintuplets */
3721 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset + 3, 1, FALSE);
3722 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3723 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3724 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3725 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3726 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3727 quint_len = tvb_get_ntohs(tvb, offset + 37);
3728 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3730 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3734 case 1: /* GSM key and triplets */
3735 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3736 if (gtp_version != 0)
3737 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3739 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3740 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3741 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3743 offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
3746 case 2: /* UMTS key and quintuplets */
3747 proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, FALSE);
3748 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3749 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3750 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3751 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3752 quint_len = tvb_get_ntohs(tvb, offset + 37);
3753 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3755 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3758 case 3: /* GSM key and quintuplets */
3759 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3760 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3761 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3762 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3763 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3764 quint_len = tvb_get_ntohs(tvb, offset + 13);
3765 proto_tree_add_text(ext_tree_mm, tvb, offset + 13, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3767 offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
3775 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
3777 de_gmm_drx_param(tvb, ext_tree_mm, offset, 2, NULL, 0);
3778 offset = offset + 2;
3780 len = tvb_get_guint8(tvb, offset);
3781 tf = proto_tree_add_text(ext_tree_mm, tvb, offset, len + 1, "MS Network Capability");
3783 tf_tree = proto_item_add_subtree(tf, ett_gtp_net_cap);
3785 proto_tree_add_text(tf_tree, tvb, offset, 1, "Length of MS network capability contents: %u", len);
3789 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
3791 de_gmm_ms_net_cap(tvb, tf_tree, offset, len, NULL, 0);
3792 offset = offset + len;
3794 /* Container contains one or several optional information elements as described in the clause 'Overview',
3795 * from the clause 'General message format and information elements coding' in 3GPP TS 24.008.
3796 * The IMEISV shall, if available, be included in the Container.
3799 con_len = tvb_get_ntohs(tvb, offset);
3800 proto_tree_add_text(ext_tree_mm, tvb, offset, 2, "Container length: %u", con_len);
3801 offset = offset + 2;
3805 l3_tvb = tvb_new_subset(tvb, offset, con_len, con_len);
3806 if (!dissector_try_uint(bssap_pdu_type_table, BSSAP_PDU_TYPE_DTAP, l3_tvb, pinfo, ext_tree_mm))
3807 call_dissector(data_handle, l3_tvb, pinfo, ext_tree_mm);
3813 /* Function to extract the value of an hexadecimal octet. Only the lower
3814 * nybble will be non-zero in the output.
3816 static guint8 hex2dec(guint8 x)
3818 if ((x >= 'a') && (x <= 'f'))
3820 else if ((x >= 'A') && (x <= 'F'))
3822 else if ((x >= '0') && (x <= '9'))
3829 /* Wrapper function to add UTF-8 decoding for QoS attributes in
3832 static guint8 wrapped_tvb_get_guint8(tvbuff_t * tvb, int offset, int type)
3835 return (hex2dec(tvb_get_guint8(tvb, offset)) << 4 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
3837 return tvb_get_guint8(tvb, offset);
3840 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3841 * so type means length of length :-)
3843 * WARNING :) type does not mean length of length any more... see below for
3846 static int decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 type)
3850 guint8 al_ret_priority;
3851 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3852 guint8 traf_class, del_order, del_err_sdu;
3853 guint8 max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext;
3854 guint8 res_ber, sdu_err_ratio;
3855 guint8 trans_delay, traf_handl_prio;
3856 guint8 guar_ul, guar_dl, guar_ul_ext, guar_dl_ext;
3857 guint8 src_stat_desc, sig_ind;
3858 proto_tree *ext_tree_qos;
3860 int mss, mu, md, gu, gd;
3862 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
3863 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
3864 * to one byte to be dissected).
3865 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
3866 * corresponds to one byte to be dissected)
3868 guint8 utf8_type = 1;
3870 /* In RADIUS messages the QoS has a version field of two octets prepended.
3871 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
3872 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
3873 * inconsistent and unuseful, I will check hyphen presence here and
3874 * will signal its presence.
3878 /* Will keep the value that will be returned
3884 length = tvb_get_guint8(tvb, offset);
3885 te = proto_tree_add_text(tree, tvb, offset, length + 1, "%s", qos_str);
3886 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3887 proto_tree_add_text(ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3889 retval = length + 1;
3892 length = tvb_get_ntohs(tvb, offset + 1);
3893 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3894 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3895 proto_tree_add_text(ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3896 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
3897 retval = length + 3;
3900 /* For QoS inside RADIUS Client messages from GGSN */
3903 /* The field in the RADIUS message is the length of the tvb we were given */
3904 length = tvb_length(tvb);
3905 te = proto_tree_add_text(tree, tvb, offset, length, "%s", qos_str);
3907 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3909 proto_tree_add_item(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, FALSE);
3911 /* Hyphen handling */
3912 hyphen = tvb_get_guint8(tvb, offset + 2);
3913 if (hyphen == ((guint8) '-')) {
3914 /* Hyphen is present, put in protocol tree */
3915 proto_tree_add_text(ext_tree_qos, tvb, offset + 2, 1, "Hyphen separator: -");
3916 offset++; /* "Get rid" of hyphen */
3919 /* Now, we modify offset here and in order to use type later
3926 retval = length + 2; /* Actually, will be ignored. */
3929 /* XXX - what should we do with the length here? */
3932 ext_tree_qos = NULL;
3936 /* In RADIUS messages there is no allocation-retention priority
3937 * so I don't need to wrap the following call to tvb_get_guint8
3939 al_ret_priority = tvb_get_guint8(tvb, offset);
3941 /* All calls are wrapped to take into account the possibility that the
3942 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
3943 * of the offset will be the same as in the previous version of this
3944 * dissector, and the wrapped function will serve as a dumb wrapper;
3945 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
3946 * two bytes for needed shift, and the wrapped function will unencode
3947 * two values from the input.
3949 spare1 = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE1_MASK;
3950 delay = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DELAY_MASK;
3951 reliability = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RELIABILITY_MASK;
3952 peak = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PEAK_MASK;
3953 spare2 = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE2_MASK;
3954 precedence = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PRECEDENCE_MASK;
3955 spare3 = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE3_MASK;
3956 mean = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_MEAN_MASK;
3958 /* In RADIUS messages there is no allocation-retention priority */
3960 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3962 /* All additions must take care of the fact that QoS fields in RADIUS
3963 * messages are UTF-8 encoded, so we have to use the same trick as above.
3965 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
3966 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
3967 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
3968 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
3969 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
3970 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
3971 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
3972 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
3974 /* TS 24.008 V 7.8.0
3975 * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
3976 * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
3977 * attributes specified in octets 6-14.
3978 * In the MS to network direction and in the network to MS direction the following applies:
3979 * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
3981 * - If octet 17 is included, then octet 18 shall also be included.
3982 * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
3983 * be accepted by the receiving entity.
3988 /* See above for the need of wrapping
3992 traf_class = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_CLASS_MASK;
3993 del_order = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ORDER_MASK;
3994 del_err_sdu = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ERR_SDU_MASK;
3995 max_sdu_size = wrapped_tvb_get_guint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
3996 max_ul = wrapped_tvb_get_guint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
3997 max_dl = wrapped_tvb_get_guint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
3998 res_ber = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RES_BER_MASK;
3999 sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SDU_ERR_RATIO_MASK;
4000 trans_delay = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRANS_DELAY_MASK;
4001 traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK;
4002 guar_ul = wrapped_tvb_get_guint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
4004 guar_dl = wrapped_tvb_get_guint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
4014 src_stat_desc = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& GTP_EXT_QOS_SRC_STAT_DESC_MASK;
4015 sig_ind = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& GTP_EXT_QOS_SIG_IND_MASK;
4018 max_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
4019 guar_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
4022 max_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
4023 guar_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
4026 /* See above comments for the changes
4028 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
4029 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
4030 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);
4031 if (max_sdu_size == 0 || max_sdu_size > 150)
4032 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);
4033 if (max_sdu_size > 0 && max_sdu_size <= 150) {
4034 mss = max_sdu_size * 10;
4035 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss,
4036 "Maximum SDU size: %u octets", mss);
4039 if (max_ul == 0 || max_ul == 255)
4040 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
4041 if (max_ul > 0 && max_ul <= 63)
4042 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul,
4043 "Maximum bit rate for uplink: %u kbps", max_ul);
4044 if (max_ul > 63 && max_ul <= 127) {
4045 mu = 64 + (max_ul - 64) * 8;
4046 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
4047 "Maximum bit rate for uplink: %u kbps", mu);
4050 if (max_ul > 127 && max_ul <= 254) {
4051 mu = 576 + (max_ul - 128) * 64;
4052 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
4053 "Maximum bit rate for uplink: %u kbps", mu);
4056 if (max_dl == 0 || max_dl == 255)
4057 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
4058 if (max_dl > 0 && max_dl <= 63)
4059 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl,
4060 "Maximum bit rate for downlink: %u kbps", max_dl);
4061 if (max_dl > 63 && max_dl <= 127) {
4062 md = 64 + (max_dl - 64) * 8;
4063 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
4064 "Maximum bit rate for downlink: %u kbps", md);
4066 if (max_dl > 127 && max_dl <= 254) {
4067 md = 576 + (max_dl - 128) * 64;
4068 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
4069 "Maximum bit rate for downlink: %u kbps", md);
4072 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
4073 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);
4074 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
4075 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);
4077 if (guar_ul == 0 || guar_ul == 255)
4078 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
4079 if (guar_ul > 0 && guar_ul <= 63)
4080 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul,
4081 "Guaranteed bit rate for uplink: %u kbps", guar_ul);
4082 if (guar_ul > 63 && guar_ul <= 127) {
4083 gu = 64 + (guar_ul - 64) * 8;
4084 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
4085 "Guaranteed bit rate for uplink: %u kbps", gu);
4087 if (guar_ul > 127 && guar_ul <= 254) {
4088 gu = 576 + (guar_ul - 128) * 64;
4089 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
4090 "Guaranteed bit rate for uplink: %u kbps", gu);
4094 if (guar_dl == 0 || guar_dl == 255)
4095 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
4096 if (guar_dl > 0 && guar_dl <= 63)
4097 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl,
4098 "Guaranteed bit rate for downlink: %u kbps", guar_dl);
4099 if (guar_dl > 63 && guar_dl <= 127) {
4100 gd = 64 + (guar_dl - 64) * 8;
4101 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
4102 "Guaranteed bit rate for downlink: %u kbps", gd);
4104 if (guar_dl > 127 && guar_dl <= 254) {
4105 gd = 576 + (guar_dl - 128) * 64;
4106 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
4107 "Guaranteed bit rate for downlink: %u kbps", gd);
4111 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);
4112 proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
4116 if (max_dl_ext > 0 && max_dl_ext <= 0x4a) {
4117 md = 8600 + max_dl_ext * 100;
4118 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4119 "Ext Maximum bit rate for downlink: %u kbps", md);
4121 if (max_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4122 md = 16 + (max_dl_ext-0x4a);
4123 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4124 "Ext Maximum bit rate for downlink: %u Mbps", md);
4126 if (max_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4127 md = 128 + (max_dl_ext-0xba)*2;
4128 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4129 "Ext Maximum bit rate for downlink: %u Mbps", md);
4132 if(guar_dl_ext == 0)
4133 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");
4134 if (guar_dl_ext > 0 && guar_dl_ext <= 0x4a) {
4135 gd = 8600 + guar_dl_ext * 100;
4136 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4137 "Ext Guaranteed bit rate for downlink: %u kbps", gd);
4139 if (guar_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4140 gd = 16 + (guar_dl_ext-0x4a);
4141 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4142 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
4144 if (guar_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4145 gd = 128 + (guar_dl_ext-0xba)*2;
4146 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4147 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
4153 * 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
4154 * rate for downlink (extended).
4156 if (max_ul_ext > 0 && max_ul_ext <= 0x4a) {
4157 md = 8600 + max_ul_ext * 100;
4158 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4159 "Ext Maximum bit rate for uplink: %u kbps", md);
4161 if (max_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4162 md = 16 + (max_ul_ext-0x4a);
4163 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4164 "Ext Maximum bit rate for uplink: %u Mbps", md);
4166 if (max_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4167 md = 128 + (max_ul_ext-0xba)*2;
4168 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4169 "Ext Maximum bit rate for uplink: %u Mbps", md);
4172 if (guar_ul_ext == 0)
4173 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");
4174 if (guar_ul_ext > 0 && guar_ul_ext <= 0x4a) {
4175 gd = 8600 + guar_ul_ext * 100;
4176 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4177 "Ext Guaranteed bit rate for uplink: %u kbps", gd);
4179 if (guar_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4180 gd = 16 + (guar_ul_ext-0x4a);
4181 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4182 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
4184 if (guar_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4185 gd = 128 + (guar_ul_ext-0xba)*2;
4186 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4187 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
4196 /* Diameter 3GPP AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
4198 dissect_diameter_3gpp_qosprofile(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
4200 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
4201 return tvb_length(tvb);
4204 static const gchar *dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb)
4206 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
4207 return tvb_get_ephemeral_string(tvb, 0, tvb_length(tvb));
4210 static void decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree)
4217 name_len = tvb_get_guint8(tvb, offset);
4219 if (name_len < 0x20) {
4220 apn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
4222 if (name_len >= length - 1)
4225 name_len = name_len + apn[tmp] + 1;
4229 apn = tvb_get_ephemeral_string(tvb, offset, length);
4231 proto_tree_add_string(tree, hf_gtp_apn, tvb, offset, length, apn);
4235 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
4236 * UMTS: 29.060 v4.0, chapter 7.7.29
4237 * TODO: unify addr functions
4239 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4242 guint8 ggsn_addr_len, apn_len, trans_id, vaa, asi, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id, pdp_type_org, pdp_type_num, pdp_addr_len;
4243 guint16 length, sn_down, sn_up, up_flow;
4245 struct e_in6_addr addr_ipv6;
4246 proto_tree *ext_tree_pdp;
4249 length = tvb_get_ntohs(tvb, offset + 1);
4251 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"));
4252 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
4254 vaa = (tvb_get_guint8(tvb, offset + 3) >> 6) & 0x01;
4255 asi = (tvb_get_guint8(tvb, offset + 3) >> 5) & 0x01;
4256 order = (tvb_get_guint8(tvb, offset + 3) >> 4) & 0x01;
4257 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4258 sapi = tvb_get_guint8(tvb, offset + 4) & 0x0F;
4260 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "VPLMN address allowed: %s", yesno[vaa]);
4261 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Activity Status Indicator: %s", yesno[asi]);
4262 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Reordering required: %s", yesno[order]);
4263 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "NSAPI: %u", nsapi);
4264 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "SAPI: %u", sapi);
4266 switch (gtp_version) {
4268 decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
4269 decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
4270 decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
4271 offset = offset + 14;
4274 offset = offset + 5;
4275 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
4276 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
4277 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
4283 sn_down = tvb_get_ntohs(tvb, offset);
4284 sn_up = tvb_get_ntohs(tvb, offset + 2);
4285 pdu_send_no = tvb_get_guint8(tvb, offset + 4);
4286 pdu_rec_no = tvb_get_guint8(tvb, offset + 5);
4288 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
4289 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 2, "Sequence number up: %u", sn_up);
4290 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "Send N-PDU number: %u", pdu_send_no);
4291 proto_tree_add_text(ext_tree_pdp, tvb, offset + 5, 1, "Receive N-PDU number: %u", pdu_rec_no);
4293 switch (gtp_version) {
4295 up_flow = tvb_get_ntohs(tvb, offset + 6);
4296 proto_tree_add_text(ext_tree_pdp, tvb, offset + 6, 2, "Uplink flow label signalling: %u", up_flow);
4297 offset = offset + 8;
4300 pdp_cntxt_id = tvb_get_guint8(tvb, offset + 14);
4301 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_cp, tvb, offset + 6, 4, FALSE);
4302 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_data, tvb, offset + 10, 4, FALSE);
4303 proto_tree_add_text(ext_tree_pdp, tvb, offset + 14, 1, "PDP context identifier: %u", pdp_cntxt_id);
4304 offset = offset + 15;
4310 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
4311 pdp_type_num = tvb_get_guint8(tvb, offset + 1);
4312 pdp_addr_len = tvb_get_guint8(tvb, offset + 2);
4314 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"));
4315 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"));
4316 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 1, "PDP address length: %u", pdp_addr_len);
4318 if (pdp_addr_len > 0) {
4319 switch (pdp_type_num) {
4321 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4322 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 4, "PDP address: %s", ip_to_str((guint8 *) & addr_ipv4));
4325 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4326 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4333 offset = offset + 3 + pdp_addr_len;
4335 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4336 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
4338 switch (ggsn_addr_len) {
4340 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4341 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN Address for control plane: %s", ip_to_str((guint8 *) & addr_ipv4));
4344 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4345 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));
4351 offset = offset + 1 + ggsn_addr_len;
4353 if (gtp_version == 1) {
4355 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4356 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
4358 switch (ggsn_addr_len) {
4360 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4361 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *) & addr_ipv4));
4364 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4365 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4370 offset = offset + 1 + ggsn_addr_len;
4374 apn_len = tvb_get_guint8(tvb, offset);
4375 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
4376 decode_apn(tvb, offset + 1, apn_len, ext_tree_pdp);
4378 offset = offset + 1 + apn_len;
4380 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
4381 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
4382 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
4383 * MS is stored in the PDP context IE.
4384 * 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
4385 * octet in this field.
4387 trans_id = tvb_get_guint8(tvb, offset);
4388 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Transaction identifier: %u", trans_id);
4393 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
4394 * UMTS: 29.060, v4.0, chapter 7.7.30
4396 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4400 proto_tree *ext_tree_apn;
4403 length = tvb_get_ntohs(tvb, offset + 1);
4405 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_APN, >p_val_ext, "Unknown field"));
4406 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
4408 proto_tree_add_text(ext_tree_apn, tvb, offset + 1, 2, "APN length : %u", length);
4409 decode_apn(tvb, offset + 3, length, ext_tree_apn);
4414 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
4415 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
4416 * UMTS: 29.060 v4.0, chapter 7.7.31
4417 * 24.008, v4.2, chapter 10.5.6.3
4419 int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
4422 guint16 length, proto_offset;
4424 guint8 conf, proto_len, cnt = 1;
4426 proto_tree *ext_tree_proto;
4428 gboolean save_writable;
4430 length = tvb_get_ntohs(tvb, offset + 1);
4432 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"));
4433 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
4435 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
4440 conf = tvb_get_guint8(tvb, offset + 3) & 0x07;
4441 proto_tree_add_text(ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
4443 proto_offset = 1; /* ... 1st byte is conf */
4447 if (proto_offset >= length)
4449 proto_id = tvb_get_ntohs(tvb, offset);
4450 proto_len = tvb_get_guint8(tvb, offset + 2);
4451 proto_offset += proto_len + 3; /* 3 = proto id + length byte */
4453 if (proto_len > 0) {
4455 proto_tree_add_text(ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)",
4456 cnt, val_to_str_ext_const(proto_id, &ppp_vals_ext, "Unknown"), proto_id);
4457 proto_tree_add_text(ext_tree_proto, tvb, offset + 2, 1, "Protocol %u length: %u", cnt, proto_len);
4460 * Don't allow the dissector for the configuration
4461 * protocol in question to update the columns - this
4464 save_writable = col_get_writable(pinfo->cinfo);
4465 col_set_writable(pinfo->cinfo, FALSE);
4468 * XXX - should we have our own dissector table,
4469 * solely for configuration protocols, so that bogus
4470 * values don't cause us to dissect the protocol
4471 * data as, for example, IP?
4473 next_tvb = tvb_new_subset(tvb, offset + 3, proto_len, proto_len);
4474 if (!dissector_try_uint(ppp_subdissector_table, proto_id, next_tvb, pinfo, ext_tree_proto)) {
4475 call_dissector(data_handle, next_tvb, pinfo, ext_tree_proto);
4478 col_set_writable(pinfo->cinfo, save_writable);
4481 offset += proto_len + 3;
4488 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
4489 * UMTS: 29.060 v4.0, chapter 7.7.32
4491 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4494 guint8 addr_type, addr_len;
4497 struct e_in6_addr addr_ipv6;
4498 proto_tree *ext_tree_gsn_addr;
4501 length = tvb_get_ntohs(tvb, offset + 1);
4503 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "GSN address : ");
4504 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
4508 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4509 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4510 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4511 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, addr_ipv4);
4514 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4515 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4516 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4517 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4518 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4519 addr_ipv4 = tvb_get_ipv4(tvb, offset + 4);
4520 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4521 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, addr_ipv4);
4524 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4525 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4526 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4527 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
4530 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4531 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4532 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4533 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4534 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4535 tvb_get_ipv6(tvb, offset + 4, &addr_ipv6);
4536 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4537 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, (guint8 *) & addr_ipv6);
4540 proto_item_append_text(te, "unknown type or wrong length");
4547 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
4548 * UMTS: 29.060 v4.0, chapter 7.7.33
4550 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4553 const guint8 *msisdn_val;
4557 length = tvb_get_ntohs(tvb, offset + 1);
4562 msisdn_val = tvb_get_ptr(tvb, offset + 3, length);
4563 msisdn_str = msisdn_to_str(msisdn_val, length);
4565 proto_tree_add_string(tree, hf_gtp_msisdn, tvb, offset, 3 + length, msisdn_str);
4570 /* GPRS: not present
4571 * UMTS: 29.060 v4.0, chapter 7.7.34
4572 * 24.008 v4.2, chapter 10.5.6.5
4574 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4577 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
4580 /* GPRS: not present
4581 * UMTS: 29.060 v4.0, chapter 7.7.35
4583 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4586 proto_tree *ext_tree;
4587 proto_item *te_quint;
4589 guint8 xres_len, auth_len;
4592 length = tvb_get_ntohs(tvb, offset + 1);
4594 te_quint = proto_tree_add_text(tree, tvb, offset, length + 1, "Quintuplet");
4595 ext_tree = proto_item_add_subtree(te_quint, ett_gtp_quint);
4598 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4599 offset = offset + 2;
4601 proto_tree_add_text(ext_tree, tvb, offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
4602 offset = offset + 16;
4603 xres_len = tvb_get_guint8(tvb, offset);
4604 proto_tree_add_text(ext_tree, tvb, offset, 1, "XRES length: %u", xres_len);
4606 proto_tree_add_text(ext_tree, tvb, offset, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset, xres_len));
4607 offset = offset + xres_len;
4608 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4609 offset = offset + 16;
4610 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4611 offset = offset + 16;
4612 auth_len = tvb_get_guint8(tvb, offset);
4613 proto_tree_add_text(ext_tree, tvb, offset, 1, "Authentication length: %u", auth_len);
4615 proto_tree_add_text(ext_tree, tvb, offset, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset, auth_len));
4617 offset = offset + auth_len;
4619 return (3 + length);
4623 /* GPRS: not present
4624 * UMTS: 29.060 v4.0, chapter 7.7.36
4625 * 24.008 v4.2, chapter 10.5.6.12
4627 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4630 guint16 length, port1, port2, tos;
4631 guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto, spare;
4633 guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
4634 struct e_in6_addr addr_ipv6, mask_ipv6;
4635 proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
4636 proto_item *te, *tee, *tef;
4638 length = tvb_get_ntohs(tvb, offset + 1);
4640 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Traffic flow template");
4641 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
4643 tft_flags = tvb_get_guint8(tvb, offset + 3);
4644 tft_code = (tft_flags >> 5) & 0x07;
4645 spare = (tft_flags >> 4) & 0x01;
4646 no_packet_filters = tft_flags & 0x0F;
4648 proto_tree_add_text(ext_tree_tft, tvb, offset + 1, 2, "TFT length: %u", length);
4650 tef = proto_tree_add_text(ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
4651 ext_tree_tft_flags = proto_item_add_subtree(tef, ett_gtp_tft_flags);
4652 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_code, tvb, offset + 3, 1, tft_flags);
4653 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_spare, tvb, offset + 3, 1, tft_flags);
4654 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_number, tvb, offset + 3, 1, tft_flags);
4656 offset = offset + 4;
4658 for (i = 0; i < no_packet_filters; i++) {
4660 pf_id = tvb_get_guint8(tvb, offset);
4662 tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
4663 ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
4666 if (tft_code != 2) {
4668 pf_eval = tvb_get_guint8(tvb, offset);
4669 pf_len = tvb_get_guint8(tvb, offset + 1);
4671 proto_tree_add_uint(ext_tree_tft_pf, hf_gtp_tft_eval, tvb, offset, 1, pf_eval);
4672 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + 1, 1, "Content length: %u", pf_len);
4674 offset = offset + 2;
4677 while (pf_offset < pf_len) {
4679 pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
4681 switch (pf_content_id) {
4682 /* address IPv4 and mask = 8 bytes */
4684 addr_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 1);
4685 mask_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 5);
4686 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),
4687 ip_to_str((guint8 *) & mask_ipv4));
4688 pf_offset = pf_offset + 9;
4690 /* address IPv6 and mask = 32 bytes */
4692 tvb_get_ipv6(tvb, offset + pf_offset + 1, &addr_ipv6);
4693 tvb_get_ipv6(tvb, offset + pf_offset + 17, &mask_ipv6);
4694 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s",
4695 ip6_to_str((struct e_in6_addr *) &addr_ipv6), ip6_to_str((struct e_in6_addr *) &mask_ipv6));
4696 pf_offset = pf_offset + 33;
4698 /* protocol identifier/next header type = 1 byte */
4700 proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
4701 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)",
4703 pf_offset = pf_offset + 2;
4705 /* single destination port type = 2 bytes */
4707 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4708 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
4709 pf_offset = pf_offset + 3;
4711 /* destination port range type = 4 bytes */
4713 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4714 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4715 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
4716 pf_offset = pf_offset + 5;
4718 /* single source port type = 2 bytes */
4720 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4721 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
4722 pf_offset = pf_offset + 3;
4724 /* source port range type = 4 bytes */
4726 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4727 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4728 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
4729 pf_offset = pf_offset + 5;
4731 /* security parameter index type = 4 bytes */
4733 ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
4734 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
4735 pf_offset = pf_offset + 5;
4737 /* type of service/traffic class type = 2 bytes */
4739 tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4740 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
4741 pf_offset = pf_offset + 3;
4743 /* flow label type = 3 bytes */
4745 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;
4746 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
4747 pf_offset = pf_offset + 4;
4751 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
4752 pf_offset++; /* to avoid infinite loop */
4757 offset = offset + pf_offset;
4764 /* GPRS: not present
4765 * UMTS: 29.060 v4.0, chapter 7.7.37
4766 * Type = 138 (Decimal)
4767 * 25.413(RANAP) TargetID
4769 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4773 proto_item *target_id_item;
4774 proto_tree *ext_tree;
4776 asn1_ctx_t asn1_ctx;
4777 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
4779 length = tvb_get_ntohs(tvb, offset + 1);
4781 target_id_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "Target Identification");
4782 ext_tree = proto_item_add_subtree(target_id_item, ett_gtp_target_id);
4783 offset = offset + 1;
4784 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4785 offset = offset + 2;
4786 next_tvb = tvb_new_subset(tvb, offset, length, length);
4787 dissect_ranap_TargetRNC_ID(next_tvb, 0, &asn1_ctx, ext_tree, hf_gtp_targetRNC_ID);
4793 /* GPRS: not present
4794 * UMTS: 29.060 v4.0, chapter 7.7.38
4796 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4800 proto_item *utran_cont_item;
4801 proto_tree *ext_tree;
4804 length = tvb_get_ntohs(tvb, offset + 1);
4806 utran_cont_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
4807 ext_tree = proto_item_add_subtree(utran_cont_item, ett_gtp_utran_cont);
4808 offset = offset + 1;
4809 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4810 offset = offset + 2;
4811 next_tvb = tvb_new_subset(tvb, offset, length, length);
4813 call_dissector(data_handle, next_tvb, pinfo, ext_tree);
4820 /* GPRS: not present
4821 * UMTS: 29.060 v4.0, chapter 7.7.39
4823 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4826 guint32 teid, addr_ipv4;
4829 struct e_in6_addr addr_ipv6;
4830 proto_tree *ext_tree_rab_setup;
4833 length = tvb_get_ntohs(tvb, offset + 1);
4834 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4836 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Radio Access Bearer Setup Information");
4837 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
4839 proto_tree_add_text(ext_tree_rab_setup, tvb, offset + 1, 2, "RAB setup length : %u", length);
4840 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, nsapi);
4844 teid = tvb_get_ntohl(tvb, offset + 4);
4846 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
4850 addr_ipv4 = tvb_get_ipv4(tvb, offset + 8);
4851 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, addr_ipv4);
4854 tvb_get_ipv6(tvb, offset + 8, &addr_ipv6);
4855 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, (guint8 *) & addr_ipv6);
4866 /* GPRS: not present
4867 * UMTS: 29.060 v4.0, chapter 7.7.40
4869 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4874 proto_tree *ext_tree_hdr_list;
4877 length = tvb_get_guint8(tvb, offset + 1);
4879 te = proto_tree_add_text(tree, tvb, offset, 2 + length, "%s", val_to_str_ext_const(GTP_EXT_HDR_LIST, >p_val_ext, "Unknown"));
4880 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4882 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4884 for (i = 0; i < length; i++) {
4885 hdr = tvb_get_guint8(tvb, offset + 2 + i);
4887 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 2 + i, 1, "No. %u --> Extension Header Type value : %s (%u)", i + 1,
4888 val_to_str_ext_const(hdr, >p_val_ext, "Unknown Extension Header Type"), hdr);
4894 /* GPRS: not present
4895 * UMTS: 29.060 v4.0, chapter 7.7.41
4896 * TODO: find TriggerID description
4898 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4903 length = tvb_get_ntohs(tvb, offset + 1);
4905 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);
4911 /* GPRS: not present
4912 * UMTS: 29.060 v4.0, chapter 7.7.42
4913 * TODO: find OMC-ID description
4915 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4920 length = tvb_get_ntohs(tvb, offset + 1);
4922 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);
4928 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
4929 * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
4931 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4936 struct e_in6_addr addr_ipv6;
4937 proto_tree *ext_tree_chrg_addr;
4940 length = tvb_get_ntohs(tvb, offset + 1);
4942 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, >p_val_ext, "Unknown"));
4943 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
4945 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);
4949 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4950 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4951 proto_tree_add_ipv4(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, addr_ipv4);
4954 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4955 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4956 proto_tree_add_ipv6(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
4959 proto_item_append_text(te, "unknown type or wrong length");
4967 * UMTS: 29.060 v6.11.0, chapter 7.7.44 RAN Transparent Container
4969 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4973 proto_tree *ext_tree;
4976 length = tvb_get_ntohs(tvb, offset + 1);
4977 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"));
4978 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ran_tr_cont);
4981 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4982 offset = offset + 2;
4983 /* TODO add decoding of data */
4984 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4991 * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
4993 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4997 proto_tree *ext_tree;
5000 length = tvb_get_ntohs(tvb, offset + 1);
5001 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"));
5002 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdp_cont_prio);
5005 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5006 offset = offset + 2;
5007 /* TODO add decoding of data */
5008 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5015 * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
5017 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5021 proto_tree *ext_tree;
5024 length = tvb_get_ntohs(tvb, offset + 1);
5025 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"));
5026 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rab_setup_inf);
5029 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5030 offset = offset + 2;
5031 /* TODO add decoding of data */
5032 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5040 * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
5042 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5046 proto_tree *ext_tree;
5049 length = tvb_get_ntohs(tvb, offset + 1);
5050 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_SSGN_NO, >p_val_ext, "Unknown"));
5051 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ssgn_no);
5054 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5055 offset = offset + 2;
5056 /* TODO add decoding of data */
5057 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5064 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
5066 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5070 proto_tree *ext_tree;
5073 length = tvb_get_ntohs(tvb, offset + 1);
5074 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_COMMON_FLGS, >p_val_ext, "Unknown"));
5075 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_common_flgs);
5078 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5079 offset = offset + 2;
5080 /* Upgrade QoS Supported */
5081 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, FALSE);
5082 /* NRSN bit field */
5083 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, FALSE);
5084 /* No QoS negotiation */
5085 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, FALSE);
5086 /* MBMS Counting Information bi */
5087 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, FALSE);
5088 /* RAN Procedures Ready */
5089 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, FALSE);
5090 /* MBMS Service Type */
5091 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, FALSE);
5092 /* Prohibit Payload Compression */
5093 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, FALSE);
5100 * UMTS: 29.060 v6.11.0, chapter 7.7.49
5102 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5106 proto_tree *ext_tree_apn_res;
5109 length = tvb_get_ntohs(tvb, offset + 1);
5110 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_APN_RES, >p_val_ext, "Unknown"));
5111 ext_tree_apn_res = proto_item_add_subtree(te, ett_gtp_ext_tree_apn_res);
5114 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5115 offset = offset + 2;
5117 /* Restriction Type value */
5119 proto_item *expert_item;
5120 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
5121 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
5122 PROTO_ITEM_SET_GENERATED(expert_item);
5126 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, FALSE);
5131 * UMTS: 29.060 v6.11.0, chapter 7.7.50
5133 * Type = 151 (Decimal)
5136 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5140 proto_tree *ext_tree_rat_type;
5143 length = tvb_get_ntohs(tvb, offset + 1);
5144 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RAT_TYPE, >p_val_ext, "Unknown"));
5145 ext_tree_rat_type = proto_item_add_subtree(te, ett_gtp_ext_rat_type);
5148 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5149 offset = offset + 2;
5151 /* RAT Type value */
5153 proto_item *expert_item;
5154 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
5155 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
5156 PROTO_ITEM_SET_GENERATED(expert_item);
5160 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, FALSE);
5166 * UMTS: 29.060 v6.11.0, chapter 7.7.51
5167 * User Location Information
5168 * Type = 152 (Decimal)
5171 static const gchar *dissect_radius_user_loc(proto_tree * tree, tvbuff_t * tvb)
5175 guint8 geo_loc_type;
5176 guint16 length = tvb_length(tvb);
5178 /* Geographic Location Type */
5179 proto_tree_add_item(tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5180 geo_loc_type = tvb_get_guint8(tvb, offset);
5183 if (geo_loc_type == 0)
5184 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5185 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 0);
5186 if (geo_loc_type == 1) {
5187 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5188 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 4);
5189 offset = offset + 5;
5190 proto_tree_add_item(tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5194 return tvb_bytes_to_str(tvb, 0, length);
5197 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5201 proto_tree *ext_tree;
5203 guint8 geo_loc_type;
5205 length = tvb_get_ntohs(tvb, offset + 1);
5206 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"));
5207 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_usr_loc_inf);
5210 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5211 offset = offset + 2;
5212 /* TODO add decoding of data */
5213 /* Geographic Location Type */
5214 proto_tree_add_item(ext_tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5215 geo_loc_type = tvb_get_guint8(tvb, offset);
5218 if (geo_loc_type == 0)
5219 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5220 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 0);
5221 if (geo_loc_type == 1) {
5222 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5223 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 4);
5224 offset = offset + 5;
5225 proto_tree_add_item(ext_tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5232 static const value_string daylight_saving_time_vals[] = {
5233 {0, "No adjustment"},
5234 {1, "+1 hour adjustment for Daylight Saving Time"},
5235 {2, "+2 hours adjustment for Daylight Saving Time"},
5241 * UMTS: 29.060 v6.11.0, chapter 7.7.52
5243 * Type = 153 (Decimal)
5244 * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
5245 * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
5246 * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
5247 * its value shall be set as defined in 3GPP TS 22.042
5249 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5253 proto_tree *ext_tree;
5258 length = tvb_get_ntohs(tvb, offset + 1);
5259 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"));
5260 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ms_time_zone);
5263 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5264 offset = offset + 2;
5266 /* 3GPP TS 23.040 version 6.6.0 Release 6
5267 * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
5269 * The Time Zone indicates the difference, expressed in quarters of an hour,
5270 * between the local time and GMT. In the first of the two semi-octets,
5271 * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
5272 * represents the algebraic sign of this difference (0: positive, 1: negative).
5275 data = tvb_get_guint8(tvb, offset);
5276 sign = (data & 0x08) ? '-' : '+';
5277 data = (data >> 4) + (data & 0x07) * 10;
5279 proto_tree_add_text(ext_tree, tvb, offset, 1, "Timezone: GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5280 proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5283 data = tvb_get_guint8(tvb, offset) & 0x3;
5284 proto_tree_add_text(ext_tree, tvb, offset, 1, "%s", val_to_str_const(data, daylight_saving_time_vals, "Unknown"));
5291 * UMTS: 29.060 v6.11.0, chapter 7.7.53
5292 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
5293 * Type = 154 (Decimal)
5295 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5299 proto_tree *ext_imeisv;
5302 const char *digit_str;
5304 length = tvb_get_ntohs(tvb, offset + 1);
5305 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_IMEISV, >p_val_ext, "Unknown"));
5306 ext_imeisv = proto_item_add_subtree(te, ett_gtp_ext_imeisv);
5309 proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5310 offset = offset + 2;
5313 * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
5314 * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
5315 * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
5316 * set to '1111'. Both IMEI and IMEISV are BCD encoded.
5318 next_tvb = tvb_new_subset(tvb, offset, length, length);
5319 digit_str = unpack_digits(next_tvb, 0);
5320 proto_tree_add_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, digit_str);
5321 proto_item_append_text(te, ": %s", digit_str);
5327 * UMTS: 29.060 v6.11.0, chapter 7.7.54
5328 * CAMEL Charging Information Container
5329 * Type = 155 (Decimal)
5331 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5335 proto_tree *ext_tree;
5338 length = tvb_get_ntohs(tvb, offset + 1);
5339 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"));
5340 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_camel_chg_inf_con);
5343 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5344 offset = offset + 2;
5345 /* TODO add decoding of data */
5346 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5353 * UMTS: 29.060 v6.11.0, chapter 7.7.55
5356 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5360 proto_tree *ext_tree;
5363 length = tvb_get_ntohs(tvb, offset + 1);
5364 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"));
5365 ext_tree = proto_item_add_subtree(te, ett_GTP_EXT_MBMS_UE_CTX);
5368 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5369 offset = offset + 2;
5370 /* TODO add decoding of data */
5371 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5378 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
5379 * Temporary Mobile Group Identity (TMGI)
5380 * The Temporary Mobile Group Identity (TMGI) information element contains
5381 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
5382 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
5385 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5389 proto_tree *ext_tree, *tmgi_tree;
5390 proto_item *te, *ti;
5393 length = tvb_get_ntohs(tvb, offset + 1);
5394 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_TMGI, >p_val_ext, "Unknown"));
5395 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_tmgi);
5398 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5399 offset = offset + 2;
5401 ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, FALSE);
5403 tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
5404 next_tvb = tvb_new_subset(tvb, offset, length, length);
5405 de_mid(next_tvb, tmgi_tree, 0, length, NULL, 0);
5411 * UMTS: 29.060 v6.11.0, chapter 7.7.57
5412 * RIM Routing Address
5414 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5418 proto_tree *ext_tree;
5421 length = tvb_get_ntohs(tvb, offset + 1);
5422 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RIM_RA, >p_val_ext, "Unknown"));
5423 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rim_ra);
5426 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5427 offset = offset + 2;
5428 /* TODO add decoding of data */
5429 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5431 * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
5439 * UMTS: 29.060 v6.11.0, chapter 7.7.58
5440 * MBMS Protocol Configuration Options
5442 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5446 proto_tree *ext_tree;
5449 length = tvb_get_ntohs(tvb, offset + 1);
5450 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"));
5451 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_prot_conf_opt);
5454 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5455 offset = offset + 2;
5456 /* TODO add decoding of data */
5457 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5464 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
5465 * MBMS Session Duration
5467 /* Used for Diameter */
5468 static int dissect_gtp_mbms_ses_dur(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5473 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5474 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5480 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5484 proto_tree *ext_tree;
5487 length = tvb_get_ntohs(tvb, offset + 1);
5488 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"));
5489 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bms_ses_dur);
5492 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5493 offset = offset + 2;
5494 /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
5495 * The MBMS Session Duration information element indicates the estimated
5496 * session duration of the MBMS service data transmission if available.
5497 * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
5498 * in 3GPP TS 29.061 [27], excluding the AVP Header fields
5499 * (as defined in IETF RFC 3588 [36], section 4.1).
5501 /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
5502 * with a length of three octets and indicates the estimated session duration
5503 * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
5504 * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
5505 * for which the maximum allowed value is 18 days. For the whole session duration the seconds
5506 * and days are added together and the maximum session duration is 19 days.
5508 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5509 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5516 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
5519 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5523 proto_tree *ext_tree;
5524 proto_item *te, *item;
5525 guint8 no_of_mbms_sa_codes;
5528 length = tvb_get_ntohs(tvb, offset + 1);
5529 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SA, >p_val_ext, "Unknown"));
5530 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_sa);
5533 item = proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5534 offset = offset + 2;
5535 /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
5536 * The MBMS Service Area information element indicates the area over
5537 * which the Multimedia Broadcast/Multicast Service is to be distributed.
5538 * The payload shall be encoded as per the MBMS-Service-Area AVP defined
5539 * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
5540 * IETF RFC 3588 [36], section 4.1).
5542 /* Number N of MBMS service area codes coded as:
5543 * 1 binary value is '00000000'
5545 * 256 binary value is '11111111'
5547 no_of_mbms_sa_codes = tvb_get_guint8(tvb, offset) + 1;
5548 if (length != ((no_of_mbms_sa_codes << 1) + 1)) {
5549 expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_WARN,
5550 "Wrong length: %u. The length of an MBMS service area code is 2 octets", length);
5552 proto_tree_add_uint(ext_tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
5554 /* A consecutive list of N MBMS service area codes
5555 * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
5556 * The length of an MBMS service area code is 2 octets.
5558 for (i = 0; i < no_of_mbms_sa_codes; i++) {
5559 proto_tree_add_item(ext_tree, hf_gtp_mbms_sa_code, tvb, offset, 2, FALSE);
5560 offset = offset + 2;
5568 * UMTS: 29.060 v6.11.0, chapter 7.7.61
5569 * Source RNC PDCP context info
5571 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5575 proto_tree *ext_tree;
5578 length = tvb_get_ntohs(tvb, offset + 1);
5579 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"));
5580 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_src_rnc_pdp_ctx_inf);
5583 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5584 offset = offset + 2;
5585 /* TODO add decoding of data */
5586 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5593 * UMTS: 29.060 v6.11.0, chapter 7.7.62
5594 * Additional Trace Info
5596 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5600 proto_tree *ext_tree;
5603 length = tvb_get_ntohs(tvb, offset + 1);
5604 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"));
5605 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_add_trs_inf);
5608 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5609 offset = offset + 2;
5610 /* TODO add decoding of data */
5611 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5618 * UMTS: 29.060 v6.11.0, chapter 7.7.63
5621 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5625 proto_tree *ext_tree;
5628 length = tvb_get_ntohs(tvb, offset + 1);
5629 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_HOP_COUNT, >p_val_ext, "Unknown"));
5630 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_hop_count);
5633 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5634 offset = offset + 2;
5635 /* TODO add decoding of data */
5636 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5643 * UMTS: 29.060 v6.11.0, chapter 7.7.64
5646 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5650 proto_tree *ext_tree;
5653 length = tvb_get_ntohs(tvb, offset + 1);
5654 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"));
5655 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_sel_plmn_id);
5658 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5659 offset = offset + 2;
5660 /* TODO add decoding of data */
5661 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5668 * UMTS: 29.060 v6.11.0, chapter 7.7.65
5669 * MBMS Session Identifier
5671 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5675 proto_tree *ext_tree;
5678 length = tvb_get_ntohs(tvb, offset + 1);
5679 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"));
5680 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id);
5683 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5684 offset = offset + 2;
5685 /* TODO add decoding of data */
5686 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5693 * UMTS: 29.060 v6.11.0, chapter 7.7.66
5694 * MBMS 2G/3G Indicator
5696 static const value_string gtp_mbs_2g_3g_ind_vals[] = {
5699 {2, "Both 2G and 3G"},
5703 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5707 proto_tree *ext_tree;
5710 length = tvb_get_ntohs(tvb, offset + 1);
5711 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"));
5712 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_2g_3g_ind);
5715 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5716 offset = offset + 2;
5717 /* MBMS 2G/3G Indicator */
5718 proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, FALSE);
5725 * UMTS: 29.060 v6.11.0, chapter 7.7.67
5728 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5732 proto_tree *ext_tree;
5735 length = tvb_get_ntohs(tvb, offset + 1);
5736 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ENH_NSAPI, >p_val_ext, "Unknown"));
5737 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_enh_nsapi);
5740 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5741 offset = offset + 2;
5742 /* TODO add decoding of data */
5743 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5750 * UMTS: 29.060 v6.11.0, chapter 7.7.68
5751 * Additional MBMS Trace Info
5753 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5757 proto_tree *ext_tree;
5760 length = tvb_get_ntohs(tvb, offset + 1);
5761 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"));
5762 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ad_mbms_trs_inf);
5765 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5766 offset = offset + 2;
5767 /* TODO add decoding of data */
5768 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5775 * UMTS: 29.060 v6.11.0, chapter 7.7.69
5776 * MBMS Session Identity Repetition Number
5778 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5782 proto_tree *ext_tree;
5785 length = tvb_get_ntohs(tvb, offset + 1);
5786 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"));
5787 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id_rep_no);
5790 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5791 offset = offset + 2;
5792 /* TODO add decoding of data */
5793 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5800 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
5801 * MBMS Time To Data Transfer
5803 /* Used for Diameter */
5804 static int dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5808 guint8 time_2_dta_tr;
5810 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5811 proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5817 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5821 proto_tree *ext_tree;
5823 guint8 time_2_dta_tr;
5825 length = tvb_get_ntohs(tvb, offset + 1);
5826 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"));
5827 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_time_to_data_tr);
5830 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5831 offset = offset + 2;
5832 /* TODO add decoding of data
5833 * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
5834 * The MBMS Time To Data Transfer information element contains a
5835 * MBMS Time To Data Transfer allocated by the BM-SC.
5836 * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
5837 * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
5838 * (as defined in IETF RFC 3588 [36], section 4.1).
5840 /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
5841 * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
5844 * 0 0 0 0 0 0 0 0 1s
5845 * 0 0 0 0 0 0 0 1 2s
5846 * 0 0 0 0 0 0 1 0 3s
5848 * 1 1 1 1 1 1 1 1 256s
5850 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5851 proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5858 * UMTS: 29.060 v6.11.0, chapter 7.7.71
5859 * PS Handover Request Context
5862 decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5866 proto_tree *ext_tree;
5869 length = tvb_get_ntohs(tvb, offset + 1);
5870 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"));
5871 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_ho_req_ctx);
5874 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5875 offset = offset + 2;
5876 /* TODO add decoding of data */
5877 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5884 * UMTS: 29.060 v6.11.0, chapter 7.7.72
5888 decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5892 proto_tree *ext_tree;
5895 length = tvb_get_ntohs(tvb, offset + 1);
5896 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSS_CONT, >p_val_ext, "Unknown"));
5897 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bss_cont);
5900 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5901 offset = offset + 2;
5902 /* TODO add decoding of data */
5903 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5905 * The content of this container is defined in 3GPP TS 48.018
5913 * UMTS: 29.060 v6.11.0, chapter 7.7.73
5914 * Cell Identification
5917 decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5921 proto_tree *ext_tree;
5924 length = tvb_get_ntohs(tvb, offset + 1);
5925 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CELL_ID, >p_val_ext, "Unknown"));
5926 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_cell_id);
5929 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5930 offset = offset + 2;
5931 /* TODO add decoding of data */
5932 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5934 * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
5935 * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
5937 * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
5938 * source RNC (RNC-ID) as defined in 3GPP TS 48.018
5946 * UMTS: 29.060 v6.11.0, chapter 7.7.74
5950 decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5954 proto_tree *ext_tree;
5957 length = tvb_get_ntohs(tvb, offset + 1);
5958 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PDU_NO, >p_val_ext, "Unknown"));
5959 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
5962 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5963 offset = offset + 2;
5964 /* TODO add decoding of data */
5965 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5972 * UMTS: 29.060 v6.11.0, chapter 7.7.75
5976 decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5980 proto_tree *ext_tree;
5983 length = tvb_get_ntohs(tvb, offset + 1);
5984 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, >p_val_ext, "Unknown"));
5985 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
5988 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5989 offset = offset + 2;
5992 * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
5994 proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 2, FALSE);
6001 * Required MBMS bearer capabilities 7.7.76
6004 decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6007 proto_tree *ext_tree;
6010 length = tvb_get_ntohs(tvb, offset + 1);
6011 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, >p_val_ext, "Unknown"));
6012 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
6015 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6016 offset = offset + 2;
6017 /* The payload shall be encoded as per the
6018 * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
6019 * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
6021 /* TODO Add decoding (call Diameter dissector???) */
6026 * RIM Routing Address Discriminator 7.7.77
6029 decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6033 proto_tree *ext_tree;
6036 length = tvb_get_ntohs(tvb, offset + 1);
6037 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"));
6038 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6041 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6042 offset = offset + 2;
6043 /* TODO add decoding of data */
6044 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6050 * List of set-up PFCs 7.7.78
6053 decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6057 proto_tree *ext_tree;
6060 length = tvb_get_ntohs(tvb, offset + 1);
6061 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"));
6062 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6065 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6066 offset = offset + 2;
6067 /* TODO add decoding of data */
6068 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6074 * PS Handover XID Parameters 7.7.79
6076 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6080 proto_tree *ext_tree;
6086 length = tvb_get_ntohs(tvb, offset + 1);
6087 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"));
6088 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_handover_xid);
6091 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6092 offset = offset + 2;
6094 sapi = tvb_get_guint8(tvb, offset) & 0x0F;
6095 proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
6098 xid_par_len = tvb_get_guint8(tvb, offset);
6099 proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
6102 if (sndcpxid_handle) {
6103 next_tvb = tvb_new_subset_remaining(tvb, offset);
6104 call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
6106 proto_tree_add_text(tree, tvb, offset, 0, "Data");
6113 * MS Info Change Reporting Action 7.7.80
6115 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6119 proto_tree *ext_tree;
6122 length = tvb_get_ntohs(tvb, offset + 1);
6123 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"));
6124 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6127 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6128 offset = offset + 2;
6129 /* TODO add decoding of data */
6130 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6136 * Direct Tunnel Flags 7.7.81
6138 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6142 proto_tree *ext_tree;
6145 length = tvb_get_ntohs(tvb, offset + 1);
6146 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"));
6147 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6150 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6151 offset = offset + 2;
6152 /* TODO add decoding of data */
6153 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6154 proto_tree_add_item(ext_tree, hf_gtp_ext_ei, tvb, offset, 1, FALSE);
6155 proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, FALSE);
6156 proto_tree_add_item(ext_tree, hf_gtp_ext_dti, tvb, offset, 1, FALSE);
6163 * Correlation-ID 7.7.82
6165 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6169 proto_tree *ext_tree;
6172 length = tvb_get_ntohs(tvb, offset + 1);
6173 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CORRELATION_ID, >p_val_ext, "Unknown"));
6174 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6177 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6178 offset = offset + 2;
6179 /* TODO add decoding of data */
6180 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6186 * Bearer Control Mode 7.7.83
6188 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6192 proto_tree *ext_tree;
6195 length = tvb_get_ntohs(tvb, offset + 1);
6196 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"));
6197 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6200 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6201 offset = offset + 2;
6202 /* TODO add decoding of data */
6203 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6211 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6214 guint16 length, n, number;
6215 proto_tree *ext_tree_rel_pack;
6218 length = tvb_get_ntohs(tvb, offset + 1);
6220 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
6221 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
6225 while (n < length) {
6227 number = tvb_get_ntohs(tvb, offset + 3 + n);
6228 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
6239 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6242 guint16 length, n, number;
6243 proto_tree *ext_tree_can_pack;
6246 length = tvb_get_ntohs(tvb, offset + 1);
6248 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
6249 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
6253 while (n < length) {
6255 number = tvb_get_ntohs(tvb, offset + 3 + n);
6256 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
6263 /* CDRs dissector */
6264 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6267 guint16 length, format_ver;
6269 proto_tree *ext_tree;
6273 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_DATA_REQ, >p_val_ext, "Unknown message"));
6274 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
6276 length = tvb_get_ntohs(tvb, offset + 1);
6277 no = tvb_get_guint8(tvb, offset + 3);
6278 format = tvb_get_guint8(tvb, offset + 4);
6279 format_ver = tvb_get_ntohs(tvb, offset + 5);
6281 proto_tree_add_text(ext_tree, tvb, offset + 1, 2, "Length: %u", length);
6282 proto_tree_add_text(ext_tree, tvb, offset + 3, 1, "Number of data records: %u", no);
6283 proto_tree_add_text(ext_tree, tvb, offset + 4, 1, "Data record format: %u", format);
6284 proto_tree_add_text(ext_tree, tvb, offset + 5, 2, "Data record format version: %u", format_ver);
6286 if (gtpcdr_handle) {
6287 next_tvb = tvb_new_subset_remaining(tvb, offset);
6288 call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
6290 proto_tree_add_text(tree, tvb, offset, 0, "Data");
6298 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6301 guint16 length, n, number;
6302 proto_tree *ext_tree_data_resp;
6305 length = tvb_get_ntohs(tvb, offset + 1);
6307 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
6308 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
6312 while (n < length) {
6314 number = tvb_get_ntohs(tvb, offset + 3 + n);
6315 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
6327 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6332 struct e_in6_addr addr_ipv6;
6333 proto_tree *ext_tree_node_addr;
6336 length = tvb_get_ntohs(tvb, offset + 1);
6338 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Node address: ");
6339 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
6341 proto_tree_add_text(ext_tree_node_addr, tvb, offset + 1, 2, "Node address length: %u", length);
6345 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
6346 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
6347 proto_tree_add_ipv4(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, addr_ipv4);
6350 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
6351 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
6352 proto_tree_add_ipv6(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
6355 proto_item_append_text(te, "unknown type or wrong length");
6363 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
6364 * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
6368 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6371 guint16 length, ext_id;
6372 proto_tree *ext_tree_priv_ext;
6375 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_PRIV_EXT, >p_val_ext, "Unknown message"));
6376 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
6379 length = tvb_get_ntohs(tvb, offset);
6380 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6381 offset = offset + 2;
6383 ext_id = tvb_get_ntohs(tvb, offset);
6384 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
6385 offset = offset + 2;
6388 * XXX - is this always a text string? Or should it be
6389 * displayed as hex data?
6392 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, FALSE);
6398 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6401 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
6403 return tvb_length_remaining(tvb, offset);
6406 static void dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6408 struct _gtp_hdr gtp_hdr;
6409 proto_tree *gtp_tree, *flags_tree;
6410 proto_item *ti, *tf;
6411 int i, offset, length, gtp_prime, checked_field, mandatory;
6412 int seq_no=0, flow_label=0;
6413 guint8 pdu_no, next_hdr = 0, ext_hdr_val;
6414 const guint8 *tid_val;
6418 guint8 sub_proto, acfield_len = 0, control_field;
6419 gtp_msg_hash_t *gcrp=NULL;
6420 conversation_t *conversation=NULL;
6421 gtp_conv_info_t *gtp_info=(gtp_conv_info_t *)pinfo->private_data;
6425 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
6426 col_clear(pinfo->cinfo, COL_INFO);
6429 * Do we have a conversation for this connection?
6431 conversation = find_or_create_conversation(pinfo);
6434 * Do we already know this conversation?
6436 gtp_info = conversation_get_proto_data(conversation, proto_gtp);
6437 if (gtp_info == NULL) {
6438 /* No. Attach that information to the conversation, and add
6439 * it to the list of information structures.
6441 gtp_info = g_malloc(sizeof(gtp_conv_info_t));
6442 /*Request/response matching tables*/
6443 gtp_info->matched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_matched);
6444 gtp_info->unmatched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_unmatched);
6446 conversation_add_proto_data(conversation, proto_gtp, gtp_info);
6448 gtp_info->next = gtp_info_items;
6449 gtp_info_items = gtp_info;
6451 pd_save = pinfo->private_data;
6452 pinfo->private_data = gtp_info;
6454 tvb_memcpy(tvb, (guint8 *) & gtp_hdr, 0, 4);
6456 if (!(gtp_hdr.flags & 0x10))
6461 switch ((gtp_hdr.flags >> 5) & 0x07) {
6473 col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(gtp_hdr.message, &message_type_ext, "Unknown"));
6476 ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, FALSE);
6477 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
6479 tf = proto_tree_add_uint(gtp_tree, hf_gtp_flags, tvb, 0, 1, gtp_hdr.flags);
6480 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
6483 proto_tree_add_uint(flags_tree, hf_gtp_flags_ver, tvb, 0, 1, gtp_hdr.flags);
6485 proto_tree_add_uint(flags_tree, hf_gtp_prime_flags_ver, tvb, 0, 1, gtp_hdr.flags);
6488 proto_tree_add_uint(flags_tree, hf_gtp_flags_pt, tvb, 0, 1, gtp_hdr.flags);
6490 if((gtp_prime==1)||(gtp_version==0)){
6491 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare1, tvb, 0, 1, gtp_hdr.flags);
6492 proto_tree_add_boolean(flags_tree, hf_gtp_flags_snn, tvb, 0, 1, gtp_hdr.flags);
6494 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare2, tvb, 0, 1, gtp_hdr.flags);
6495 proto_tree_add_boolean(flags_tree, hf_gtp_flags_e, tvb, 0, 1, gtp_hdr.flags);
6496 proto_tree_add_boolean(flags_tree, hf_gtp_flags_s, tvb, 0, 1, gtp_hdr.flags);
6497 proto_tree_add_boolean(flags_tree, hf_gtp_flags_pn, tvb, 0, 1, gtp_hdr.flags);
6500 proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, 1, 1, gtp_hdr.message);
6502 gtp_hdr.length = g_ntohs(gtp_hdr.length);
6503 proto_tree_add_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, gtp_hdr.length);
6508 seq_no = tvb_get_ntohs(tvb, offset);
6509 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6512 switch (gtp_version) {
6514 seq_no = tvb_get_ntohs(tvb, offset);
6515 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6518 flow_label = tvb_get_ntohs(tvb, offset);
6519 proto_tree_add_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
6522 pdu_no = tvb_get_guint8(tvb, offset);
6523 proto_tree_add_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
6526 tid_val = tvb_get_ptr(tvb, offset, 8);
6527 tid_str = id_to_str(tid_val);
6528 proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
6532 teid = tvb_get_ntohl(tvb, offset);
6533 proto_tree_add_uint(gtp_tree, hf_gtp_teid, tvb, offset, 4, teid);
6536 if (gtp_hdr.flags & 0x07) {
6537 seq_no = tvb_get_ntohs(tvb, offset);
6538 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6541 pdu_no = tvb_get_guint8(tvb, offset);
6542 proto_tree_add_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, pdu_no);
6545 next_hdr = tvb_get_guint8(tvb, offset);
6546 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6555 if (gtp_hdr.message != GTP_MSG_TPDU) {
6556 /* TODO: This code should be cleaned up to handle more than one
6557 * header and possibly display the header content */
6562 /* MBMS support indication */
6563 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MBMS support indication header ---]");
6567 /* MS Info Change Reporting support indication */
6568 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MS Info Change Reporting support indication header ---]");
6572 /* PDCP PDU number */
6573 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- PDCP PDU number header ---]");
6577 /* Suspend Request */
6578 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Request header ---]");
6582 /* Suspend Response */
6583 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Response header ---]");
6587 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Unknown extension header ---]");
6591 next_hdr = tvb_get_guint8(tvb, offset);
6592 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6595 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[--- end of GTP header, beginning of extension headers ---]");
6596 length = tvb_length(tvb);
6597 mandatory = 0; /* check order of GTP fields against ETSI */
6599 if (offset >= length)
6602 ext_hdr_val = next_hdr;
6605 ext_hdr_val = tvb_get_guint8(tvb, offset);
6606 if (g_gtp_etsi_order) {
6607 checked_field = check_field_presence(gtp_hdr.message, ext_hdr_val, (int *) &mandatory);
6608 switch (checked_field) {
6610 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] message not found");
6613 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] field not present");
6618 proto_tree_add_text(gtp_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s",
6619 val_to_str_ext_const(checked_field, >p_val_ext, "Unknown extension field"));
6625 while (gtpopt[++i].optcode)
6626 if (gtpopt[i].optcode == ext_hdr_val)
6628 offset = offset + (*gtpopt[i].decode) (tvb, offset, pinfo, gtp_tree);
6631 /*Use sequence number to track Req/Resp pairs*/
6633 gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr.message);
6634 /*pass packet to tap for response time reporting*/
6636 tap_queue_packet(gtp_tap,pinfo,gcrp);
6640 proto_item_set_len (ti, offset);
6643 if ((gtp_hdr.message == GTP_MSG_TPDU) && g_gtp_tpdu) {
6647 else if (gtp_version == 1) {
6648 if (gtp_hdr.flags & 0x07) {
6650 if (tvb_get_guint8(tvb, offset) == 0)
6657 sub_proto = tvb_get_guint8(tvb, offset);
6659 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
6660 /* this is most likely an IPv4 packet
6661 * we can exclude 0x40 - 0x44 because the minimum header size is 20 octets
6662 * 0x4f is excluded because PPP protocol type "IPv6 header compression"
6663 * with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
6665 next_tvb = tvb_new_subset_remaining(tvb, offset);
6666 call_dissector(ip_handle, next_tvb, pinfo, tree);
6668 } else if ((sub_proto & 0xf0) == 0x60) {
6669 /* this is most likely an IPv6 packet */
6670 next_tvb = tvb_new_subset_remaining(tvb, offset);
6671 call_dissector(ipv6_handle, next_tvb, pinfo, tree);
6673 /* this seems to be a PPP packet */
6675 if (sub_proto == 0xff) {
6676 /* this might be an address field, even it shouldn't be here */
6677 control_field = tvb_get_guint8(tvb, offset + 1);
6678 if (control_field == 0x03)
6679 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
6683 next_tvb = tvb_new_subset_remaining(tvb, offset + acfield_len);
6684 call_dissector(ppp_handle, next_tvb, pinfo, tree);
6687 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <");
6688 col_append_str(pinfo->cinfo, COL_PROTOCOL, ">");
6690 pinfo->private_data = pd_save;
6693 static void dissect_gtpprim(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6696 dissect_gtp_common(tvb, pinfo, tree);
6699 static void dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6703 * If this is GTPv2-C call the gtpv2 dissector if present
6704 * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
6706 version = tvb_get_guint8(tvb,0)>>5;
6708 /* GTPv2-C 3GPP TS 29.274 */
6710 call_dissector(gtpv2_handle, tvb, pinfo, tree);
6715 proto_tree_add_text(tree, tvb, 0, -1, "No WS dissector for GTP version %u %s", version,
6716 val_to_str_const(version, ver_types, "Unknown"));
6720 dissect_gtp_common(tvb, pinfo, tree);
6725 static const true_false_string yes_no_tfs = {
6730 static void gtp_reinit(void)
6732 gtp_conv_info_t *gtp_info;
6734 /* Free up state attached to the gtp_info structures */
6735 for (gtp_info = gtp_info_items; gtp_info != NULL; ) {
6736 gtp_conv_info_t *next;
6738 g_hash_table_destroy(gtp_info->matched);
6739 gtp_info->matched=NULL;
6740 g_hash_table_destroy(gtp_info->unmatched);
6741 gtp_info->unmatched=NULL;
6743 next = gtp_info->next;
6748 gtp_info_items = NULL;
6751 void proto_register_gtp(void)
6753 static hf_register_info hf_gtp[] = {
6755 {&hf_gtp_response_in,
6756 {"Response In", "gtp.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this GTP request is in this frame", HFILL}},
6757 {&hf_gtp_response_to,
6758 {"Response To", "gtp.response_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the GTP request in this frame", HFILL}},
6759 {&hf_gtp_time, {"Time", "gtp.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL}},
6760 {&hf_gtp_apn, {"APN", "gtp.apn", FT_STRING, BASE_NONE, NULL, 0, "Access Point Name", HFILL}},
6761 {&hf_gtp_cause, {"Cause", "gtp.cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0, "Cause of operation", HFILL}},
6762 {&hf_gtp_chrg_char, {"Charging characteristics", "gtp.chrg_char", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}},
6763 {&hf_gtp_chrg_char_s, {"Spare", "gtp.chrg_char_s", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, NULL, HFILL}},
6764 {&hf_gtp_chrg_char_n, {"Normal charging", "gtp.chrg_char_n", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, NULL, HFILL}},
6765 {&hf_gtp_chrg_char_p, {"Prepaid charging", "gtp.chrg_char_p", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, NULL, HFILL}},
6766 {&hf_gtp_chrg_char_f,
6767 {"Flat rate charging", "gtp.chrg_char_f", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, NULL, HFILL}},
6768 {&hf_gtp_chrg_char_h,
6769 {"Hot billing charging", "gtp.chrg_char_h", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, NULL, HFILL}},
6770 {&hf_gtp_chrg_char_r, {"Reserved", "gtp.chrg_char_r", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, NULL, HFILL}},
6771 {&hf_gtp_chrg_id, {"Charging ID", "gtp.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
6772 {&hf_gtp_chrg_ipv4, {"CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Charging Gateway address IPv4", HFILL}},
6773 {&hf_gtp_chrg_ipv6, {"CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Charging Gateway address IPv6", HFILL}},
6774 {&hf_gtp_ext_flow_label, {"Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL}},
6775 {&hf_gtp_ext_id, {"Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, NULL, HFILL}},
6776 {&hf_gtp_ext_val, {"Extension value", "gtp.ext_val", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}},
6777 {&hf_gtp_flags, {"Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL}},
6779 {"Version", "gtp.flags.version",
6780 FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
6781 "GTP Version", HFILL}
6783 {&hf_gtp_prime_flags_ver,
6784 {"Version", "gtp.prim.flags.version",
6785 FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK,
6786 "GTP' Version", HFILL}
6789 {"Protocol type", "gtp.flags.payload",
6790 FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
6793 {&hf_gtp_flags_spare1,
6794 {"Reserved", "gtp.flags.reserved",
6795 FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
6796 "Reserved (shall be sent as '111' )", HFILL}
6799 {"Is SNDCP N-PDU included?", "gtp.flags.snn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_SNN_MASK,
6800 "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}},
6801 {&hf_gtp_flags_spare2,
6802 {"Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, "Reserved (shall be sent as '1' )", HFILL}},
6804 {"Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_E_MASK,
6805 "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}},
6807 {"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)",
6810 {"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)",
6812 {&hf_gtp_flow_ii, {"Flow Label Data II", "gtp.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL}},
6813 {&hf_gtp_flow_label, {"Flow label", "gtp.flow_label", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6814 {&hf_gtp_flow_sig, {"Flow label Signalling", "gtp.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6815 {&hf_gtp_gsn_addr_len,
6816 {"GSN Address Length", "gtp.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, NULL, HFILL}},
6817 {&hf_gtp_gsn_addr_type,
6818 {"GSN Address Type", "gtp.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, NULL, HFILL}},
6819 {&hf_gtp_gsn_ipv4, {"GSN address IPv4", "gtp.gsn_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
6820 {&hf_gtp_gsn_ipv6, {"GSN address IPv6", "gtp.gsn_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
6821 {&hf_gtp_imsi, {"IMSI", "gtp.imsi", FT_STRING, BASE_NONE, NULL, 0, "International Mobile Subscriber Identity number", HFILL}},
6822 {&hf_gtp_length, {"Length", "gtp.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL}},
6823 {&hf_gtp_map_cause, {"MAP cause", "gtp.map_cause", FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0, NULL, HFILL}},
6824 {&hf_gtp_message_type, {"Message Type", "gtp.message", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &message_type_ext, 0x0, "GTP Message Type", HFILL}},
6826 {"MS not reachable reason", "gtp.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, NULL, HFILL}},
6827 {&hf_gtp_ms_valid, {"MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6828 {&hf_gtp_msisdn, {"MSISDN", "gtp.msisdn", FT_STRING, BASE_NONE, NULL, 0, "MS international PSTN/ISDN number", HFILL}},
6830 {"Next extension header type", "gtp.next", FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, NULL,
6832 {&hf_gtp_node_ipv4, {"Node address IPv4", "gtp.node_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Recommended node address IPv4", HFILL}},
6833 {&hf_gtp_node_ipv6, {"Node address IPv6", "gtp.node_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Recommended node address IPv6", HFILL}},
6834 {&hf_gtp_npdu_number, {"N-PDU Number", "gtp.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
6835 {&hf_gtp_nsapi, {"NSAPI", "gtp.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL}},
6836 {&hf_gtp_qos_version, {"Version", "gtp.qos_version", FT_STRING, BASE_NONE, NULL, 0, "Version of the QoS Profile", HFILL}},
6837 {&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}},
6839 {"QoS delay", "gtp.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL}},
6840 {&hf_gtp_qos_reliability,
6841 {"QoS reliability", "gtp.qos_reliability", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
6842 "Quality of Service Reliability Class", HFILL}},
6844 {"QoS peak", "gtp.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL}},
6845 {&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}},
6846 {&hf_gtp_qos_precedence,
6847 {"QoS precedence", "gtp.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
6848 "Quality of Service Precedence Class", HFILL}},
6849 {&hf_gtp_qos_spare3,
6850 {"Spare", "gtp.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL}},
6852 {"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}},
6853 {&hf_gtp_qos_al_ret_priority,
6854 {"Allocation/Retention priority", "gtp.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6855 {&hf_gtp_qos_traf_class,
6856 {"Traffic class", "gtp.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, NULL, HFILL}},
6857 {&hf_gtp_qos_del_order,
6858 {"Delivery order", "gtp.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, NULL, HFILL}},
6859 {&hf_gtp_qos_del_err_sdu,
6860 {"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,
6862 {&hf_gtp_qos_max_sdu_size,
6863 {"Maximum SDU size", "gtp.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, NULL, HFILL}},
6864 {&hf_gtp_qos_max_ul,
6865 {"Maximum bit rate for uplink", "gtp.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, NULL, HFILL}},
6866 {&hf_gtp_qos_max_dl,
6867 {"Maximum bit rate for downlink", "gtp.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, NULL, HFILL}},
6868 {&hf_gtp_qos_res_ber,
6869 {"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}},
6870 {&hf_gtp_qos_sdu_err_ratio,
6871 {"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,
6873 {&hf_gtp_qos_trans_delay,
6874 {"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}},
6875 {&hf_gtp_qos_traf_handl_prio,
6876 {"Traffic handling priority", "gtp.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
6878 {&hf_gtp_qos_guar_ul,
6879 {"Guaranteed bit rate for uplink", "gtp.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, NULL, HFILL}},
6880 {&hf_gtp_qos_guar_dl,
6881 {"Guaranteed bit rate for downlink", "gtp.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, NULL,
6883 {&hf_gtp_qos_src_stat_desc,
6884 {"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}},
6885 {&hf_gtp_qos_sig_ind,
6886 {"Signalling Indication", "gtp.sig_ind", FT_BOOLEAN, 8, TFS(>p_sig_ind), GTP_EXT_QOS_SIG_IND_MASK, NULL, HFILL}},
6887 {&hf_gtp_pkt_flow_id, {"Packet Flow ID", "gtp.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6888 {&hf_gtp_ptmsi, {"P-TMSI", "gtp.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL}},
6889 {&hf_gtp_ptmsi_sig, {"P-TMSI Signature", "gtp.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL}},
6890 {&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}},
6891 {&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}},
6892 {&hf_gtp_rab_pdu_dn,
6893 {"Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL}},
6894 {&hf_gtp_rab_pdu_up,
6895 {"Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL}},
6896 {&hf_gtp_rai_mcc, {"MCC", "gtp.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL}},
6897 {&hf_gtp_rai_mnc, {"MNC", "gtp.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL}},
6898 {&hf_gtp_rai_rac, {"RAC", "gtp.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL}},
6899 {&hf_gtp_rai_lac, {"LAC", "gtp.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL}},
6900 {&hf_gtp_ranap_cause, {"RANAP cause", "gtp.ranap_cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0, NULL, HFILL}},
6901 {&hf_gtp_recovery, {"Recovery", "gtp.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL}},
6902 {&hf_gtp_reorder, {"Reordering required", "gtp.reorder", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6903 {&hf_gtp_rnc_ipv4, {"RNC address IPv4", "gtp.rnc_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Radio Network Controller address IPv4", HFILL}},
6904 {&hf_gtp_rnc_ipv6, {"RNC address IPv6", "gtp.rnc_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Radio Network Controller address IPv6", HFILL}},
6905 {&hf_gtp_rp, {"Radio Priority", "gtp.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL}},
6907 {"NSAPI in Radio Priority", "gtp.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
6908 "Network layer Service Access Point Identifier in Radio Priority", HFILL}},
6909 {&hf_gtp_rp_sms, {"Radio Priority SMS", "gtp.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL}},
6910 {&hf_gtp_rp_spare, {"Reserved", "gtp.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL}},
6912 {"Selection mode", "gtp.sel_mode",
6913 FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03,
6916 {&hf_gtp_seq_number, {"Sequence number", "gtp.seq_number", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6917 {&hf_gtp_sndcp_number, {"SNDCP N-PDU LLC Number", "gtp.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
6918 {&hf_gtp_tear_ind, {"Teardown Indicator", "gtp.tear_ind", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6919 {&hf_gtp_teid, {"TEID", "gtp.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL}},
6920 {&hf_gtp_teid_cp, {"TEID Control Plane", "gtp.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL}},
6921 {&hf_gtp_ulink_teid_cp,
6922 {"Uplink TEID Control Plane", "gtp.ulink_teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}},
6923 {&hf_gtp_teid_data, {"TEID Data I", "gtp.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL}},
6924 {&hf_gtp_ulink_teid_data,
6925 {"Uplink TEID Data I", "gtp.ulink_teid_data", FT_UINT32, BASE_HEX, NULL, 0, "UplinkTunnel Endpoint Identifier Data I", HFILL}},
6926 {&hf_gtp_teid_ii, {"TEID Data II", "gtp.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL}},
6928 {"TFT operation code", "gtp.tft_code", FT_UINT8, BASE_DEC, VALS(tft_code_type), GTPv1_TFT_CODE_MASK, NULL, HFILL}},
6929 {&hf_gtp_tft_spare, {"TFT spare bit", "gtp.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, NULL, HFILL}},
6930 {&hf_gtp_tft_number,
6931 {"Number of packet filters", "gtp.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, NULL, HFILL}},
6932 {&hf_gtp_tft_eval, {"Evaluation precedence", "gtp.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6933 {&hf_gtp_tid, {"TID", "gtp.tid", FT_STRING, BASE_NONE, NULL, 0, "Tunnel Identifier", HFILL}},
6934 {&hf_gtp_tlli, {"TLLI", "gtp.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL}},
6935 {&hf_gtp_tr_comm, {"Packet transfer command", "gtp.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL}},
6936 {&hf_gtp_trace_ref, {"Trace reference", "gtp.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6937 {&hf_gtp_trace_type, {"Trace type", "gtp.trace_type", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6938 {&hf_gtp_unknown, {"Unknown data (length)", "gtp.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL}},
6939 {&hf_gtp_user_addr_pdp_org,
6940 {"PDP type organization", "gtp.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, NULL, HFILL}},
6941 {&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}},
6942 {&hf_gtp_user_ipv4, {"End user address IPv4", "gtp.user_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
6943 {&hf_gtp_user_ipv6, {"End user address IPv6", "gtp.user_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
6944 {&hf_gtp_security_mode,
6945 {"Security Mode", "gtp.security_mode",
6946 FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
6949 {&hf_gtp_no_of_vectors,
6950 {"No of Vectors", "gtp.no_of_vectors",
6951 FT_UINT8, BASE_DEC, NULL, 0x38,
6954 {&hf_gtp_cipher_algorithm,
6955 {"Cipher Algorithm", "gtp.no_of_vectors",
6956 FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
6960 {"Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
6961 FT_UINT8, BASE_DEC, NULL, 0x07,
6965 {"Ciphering Key Sequence Number (CKSN)", "gtp.cksn_ksi",
6966 FT_UINT8, BASE_DEC, NULL, 0x07,
6970 {"Key Set Identifier (KSI)", "gtp.cksn_ksi",
6971 FT_UINT8, BASE_DEC, NULL, 0x07,
6974 {&hf_gtp_ext_length,
6975 {"Length", "gtp.ext_length",
6976 FT_UINT16, BASE_DEC, NULL, 0x0,
6979 {&hf_gtp_ext_apn_res,
6980 {"Restriction Type", "gtp.ext_apn_res",
6981 FT_UINT8, BASE_DEC, NULL, 0x0,
6984 {&hf_gtp_ext_rat_type,
6985 {"RAT Type", "gtp.ext_rat_type",
6986 FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
6989 {&hf_gtp_ext_geo_loc_type,
6990 {"Geographic Location Type", "gtp.ext_geo_loc_type",
6991 FT_UINT8, BASE_DEC, NULL, 0x0,
6995 {"SAC", "gtp.ext_sac",
6996 FT_UINT16, BASE_HEX, NULL, 0x0,
6999 {&hf_gtp_ext_imeisv,
7000 {"IMEI(SV)", "gtp.ext_imeisv",
7001 FT_STRING, BASE_NONE, NULL, 0x0,
7004 { &hf_gtp_targetRNC_ID,
7005 { "targetRNC-ID", "gtp.targetRNC_ID",
7006 FT_NONE, BASE_NONE, NULL, 0,
7008 {&hf_gtp_bssgp_cause,
7009 {"BSSGP Cause", "gtp.bssgp_cause",
7010 FT_UINT8, BASE_DEC, VALS(tab_cause), 0,
7013 {"PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
7014 FT_UINT8, BASE_DEC, NULL, 0x0F,
7016 {&hf_gtp_xid_par_len,
7017 {"PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
7018 FT_UINT8, BASE_DEC, NULL, 0xFF,
7019 "XID parameter length", HFILL}},
7020 {&hf_gtp_cmn_flg_ppc,
7021 {"Prohibit Payload Compression", "gtp.cmn_flg.ppc",
7022 FT_BOOLEAN, 8, NULL, 0x01,
7024 {&hf_gtp_cmn_flg_mbs_srv_type,
7025 {"MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
7026 FT_BOOLEAN, 8, NULL, 0x02,
7028 {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
7029 {"RAN Procedures Ready", "gtp.cmn_flg.ran_pcd_rd",
7030 FT_BOOLEAN, 8, NULL, 0x04,
7032 {&hf_gtp_cmn_flg_mbs_cnt_inf,
7033 {"MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
7034 FT_BOOLEAN, 8, NULL, 0x08,
7036 {&hf_gtp_cmn_flg_no_qos_neg,
7037 {"No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
7038 FT_BOOLEAN, 8, NULL, 0x10,
7040 {&hf_gtp_cmn_flg_nrsn,
7041 {"NRSN bit field", "gtp.cmn_flg.nrsn",
7042 FT_BOOLEAN, 8, NULL, 0x20,
7044 {&hf_gtp_cmn_flg_upgrd_qos_sup,
7045 {"Upgrade QoS Supported", "gtp.cmn_flg.ran_pcd_rd",
7046 FT_BOOLEAN, 8, NULL, 0x40,
7049 {"Temporary Mobile Group Identity (TMGI)", "gtp.cmn_flg.ran_pcd_rd",
7050 FT_BYTES, BASE_NONE, NULL, 0x0,
7052 {&hf_gtp_no_of_mbms_sa_codes,
7053 {"Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
7054 FT_UINT8, BASE_DEC, NULL, 0x0,
7055 "Number N of MBMS service area codes", HFILL}
7057 {&hf_gtp_mbms_ses_dur_days,
7058 {"Estimated session duration days", "gtp.mbms_ses_dur_days",
7059 FT_UINT8, BASE_DEC, NULL, 0xfe,
7062 {&hf_gtp_mbms_ses_dur_s,
7063 {"Estimated session duration seconds", "gtp.mbms_ses_dur_s",
7064 FT_UINT24, BASE_DEC, NULL, 0x01ffff,
7067 {&hf_gtp_mbms_sa_code,
7068 {"MBMS service area code", "gtp.mbms_sa_code",
7069 FT_UINT16, BASE_DEC, NULL, 0x0,
7072 {&hf_gtp_mbs_2g_3g_ind,
7073 {"MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
7074 FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
7077 {&hf_gtp_time_2_dta_tr,
7078 {"Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
7079 FT_UINT8, BASE_DEC, NULL, 0x0,
7083 {"Error Indication (EI)", "gtp.ei",
7084 FT_UINT8, BASE_DEC, NULL, 0x04,
7088 {"GPRS-CSI (GCSI)", "gtp.gcsi",
7089 FT_UINT8, BASE_DEC, NULL, 0x02,
7093 {"Direct Tunnel Indicator (DTI)", "gtp.dti",
7094 FT_UINT8, BASE_DEC, NULL, 0x01,
7097 { &hf_gtp_ra_prio_lcs,
7098 {"Radio Priority LCS", "gtp.raplcs",
7099 FT_UINT8, BASE_DEC, NULL, 0x07,
7105 static gint *ett_gtp_array[] = {
7115 &ett_gtp_pkt_flow_id,
7137 &ett_gtp_ext_tree_apn_res,
7138 &ett_gtp_ext_rat_type,
7139 &ett_gtp_ext_imeisv,
7140 &ett_gtp_ext_ran_tr_cont,
7141 &ett_gtp_ext_pdp_cont_prio,
7142 &ett_gtp_ext_ssgn_no,
7143 &ett_gtp_ext_rab_setup_inf,
7144 &ett_gtp_ext_common_flgs,
7145 &ett_gtp_ext_usr_loc_inf,
7146 &ett_gtp_ext_ms_time_zone,
7147 &ett_gtp_ext_camel_chg_inf_con,
7148 &ett_GTP_EXT_MBMS_UE_CTX,
7151 &ett_gtp_ext_rim_ra,
7152 &ett_gtp_ext_mbms_prot_conf_opt,
7153 &ett_gtp_ext_mbms_sa,
7154 &ett_gtp_ext_bms_ses_dur,
7155 &ett_gtp_ext_src_rnc_pdp_ctx_inf,
7156 &ett_gtp_ext_add_trs_inf,
7157 &ett_gtp_ext_hop_count,
7158 &ett_gtp_ext_sel_plmn_id,
7159 &ett_gtp_ext_mbms_ses_id,
7160 &ett_gtp_ext_mbms_2g_3g_ind,
7161 &ett_gtp_ext_enh_nsapi,
7162 &ett_gtp_ext_ad_mbms_trs_inf,
7163 &ett_gtp_ext_mbms_ses_id_rep_no,
7164 &ett_gtp_ext_mbms_time_to_data_tr,
7165 &ett_gtp_ext_ps_ho_req_ctx,
7166 &ett_gtp_ext_bss_cont,
7167 &ett_gtp_ext_cell_id,
7168 &ett_gtp_ext_pdu_no,
7169 &ett_gtp_ext_bssgp_cause,
7170 &ett_gtp_ext_ra_prio_lcs,
7171 &ett_gtp_ext_ps_handover_xid,
7173 &ett_gtp_utran_cont,
7176 module_t *gtp_module;
7178 proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
7179 proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
7180 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
7182 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
7184 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 and GTP' port", "GTPv0 and GTP' port (default 3386)", 10, &g_gtpv0_port);
7185 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,
7187 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
7189 prefs_register_bool_preference(gtp_module, "dissect_tpdu", "Dissect T-PDU", "Dissect T-PDU", &g_gtp_tpdu);
7191 prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
7192 prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
7193 prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
7194 prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
7195 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
7197 /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
7198 * The preference is set to TRUE by default forbackward compatibility
7200 prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
7202 register_dissector("gtp", dissect_gtp, proto_gtp);
7203 register_dissector("gtpprim", dissect_gtpprim, proto_gtp);
7205 register_init_routine(gtp_reinit);
7206 gtp_tap=register_tap("gtp");
7208 /* TS 132 295 V9.0.0 (2010-02)
7210 * - The UDP Destination Port may be the server port number 3386 which has been reserved for GTP'.
7211 * Alternatively another port can be used, which has been configured by O&M, except Port Number 2123
7212 * which is used by GTPv2-C.
7214 * The TCP Destination Port may be the server port number 3386, which has been reserved for G-PDUs. Alternatively,
7215 * another port may be used as configured by O&M. Extra implementation-specific destination ports are possible but
7216 * all CGFs shall support the server port number.
7219 void proto_reg_handoff_gtp(void)
7221 static gboolean Initialized = FALSE;
7222 static dissector_handle_t gtp_handle, gtp_prim_handle;
7223 static gboolean gtp_over_tcp;
7224 static guint gtpv0_port;
7225 static guint gtpv1c_port;
7226 static guint gtpv1u_port;
7229 gtp_handle = find_dissector("gtp");
7230 gtp_prim_handle = find_dissector("gtpprim");
7231 ppp_subdissector_table = find_dissector_table("ppp.protocol");
7233 radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
7234 radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
7235 radius_register_avp_dissector(VENDOR_THE3GPP, 22, dissect_radius_user_loc);
7239 ip_handle = find_dissector("ip");
7240 ipv6_handle = find_dissector("ipv6");
7241 ppp_handle = find_dissector("ppp");
7242 data_handle = find_dissector("data");
7243 gtpcdr_handle = find_dissector("gtpcdr");
7244 sndcpxid_handle = find_dissector("sndcpxid");
7245 gtpv2_handle = find_dissector("gtpv2");
7246 bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
7247 /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
7248 dissector_add_uint("diameter.3gpp", 5, new_create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
7249 /* AVP Code: 904 MBMS-Session-Duration */
7250 dissector_add_uint("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
7251 /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
7252 dissector_add_uint("diameter.3gpp", 911, new_create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
7256 dissector_delete_uint("udp.port", gtpv0_port, gtp_prim_handle);
7257 dissector_delete_uint("udp.port", gtpv1c_port, gtp_handle);
7258 dissector_delete_uint("udp.port", gtpv1u_port, gtp_handle);
7261 dissector_delete_uint("tcp.port", gtpv0_port, gtp_prim_handle);
7262 dissector_delete_uint("tcp.port", gtpv1c_port, gtp_handle);
7263 dissector_delete_uint("tcp.port", gtpv1u_port, gtp_handle);
7267 gtp_over_tcp = g_gtp_over_tcp;
7268 gtpv0_port = g_gtpv0_port;
7269 gtpv1c_port = g_gtpv1c_port;
7270 gtpv1u_port = g_gtpv1u_port;
7272 dissector_add_uint("udp.port", g_gtpv0_port, gtp_prim_handle);
7273 dissector_add_uint("udp.port", g_gtpv1c_port, gtp_handle);
7274 dissector_add_uint("udp.port", g_gtpv1u_port, gtp_handle);
7276 if (g_gtp_over_tcp) {
7277 dissector_add_uint("tcp.port", g_gtpv0_port, gtp_prim_handle);
7278 dissector_add_uint("tcp.port", g_gtpv1c_port, gtp_handle);
7279 dissector_add_uint("tcp.port", g_gtpv1u_port, gtp_handle);
7284 * Editor modelines - http://www.wireshark.org/tools/modelines.html
7289 * indent-tabs-mode: nil
7292 * vi: set shiftwidth=4 tabstop=8 expandtab
7293 * :indentSize=4:tabSize=8:noTabs=true: