5 * Routines for GTP dissection
6 * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
7 * Nicolas Balkota <balkota@mac.com>
9 * Updates and corrections:
10 * Copyright 2006 - 2009, Anders Broman <anders.broman@ericsson.com>
12 * Added Bearer control mode dissection:
13 * Copyright 2011, Grzegorz Szczytowski <grzegorz.szczytowski@gmail.com>
15 * Updates and corrections:
16 * Copyright 2011, Anders Broman <anders.broman@ericsson.com>
18 * Control Plane Request-Response tracking code Largely based on similar routines in
19 * packet-ldap.c by Ronnie Sahlberg
20 * Added by Kari Tiirikainen <kari.tiirikainen@nsn.com>
22 * Wireshark - Network traffic analyzer
23 * By Gerald Combs <gerald@wireshark.org>
24 * Copyright 1998 Gerald Combs
26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License
28 * as published by the Free Software Foundation; either version 2
29 * of the License, or (at your option) any later version.
31 * This program is distributed in the hope that it will be useful,
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 * GNU General Public License for more details.
36 * You should have received a copy of the GNU General Public License
37 * along with this program; if not, write to the Free Software
38 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 * http://www.3gpp.org/ftp/Specs/html-info/29060.htm
51 #include <epan/conversation.h>
52 #include <epan/packet.h>
53 #include <epan/prefs.h>
54 #include <epan/expert.h>
55 #include <epan/sminmpec.h>
56 #include <epan/asn1.h>
58 #include "packet-ipv6.h"
59 #include "packet-ppp.h"
60 #include "packet-radius.h"
61 #include "packet-bssap.h"
62 #include "packet-gsm_a_common.h"
63 #include "packet-gsm_map.h"
64 #include "packet-gprscdr.h"
65 #include "packet-per.h"
66 #include "packet-ranap.h"
67 #include "packet-bssgp.h"
68 #include "packet-gtp.h"
70 static dissector_table_t ppp_subdissector_table;
72 #define GTPv0_PORT 3386
73 #define GTPv1C_PORT 2123 /* 3G Control PDU */
74 #define GTPv1U_PORT 2152 /* 3G T-PDU */
76 #define GTPv0_HDR_LENGTH 20
77 #define GTPv1_HDR_LENGTH 12
78 #define GTP_PRIME_HDR_LENGTH 6
80 /* to check compliance with ETSI */
81 #define GTP_MANDATORY 1
82 #define GTP_OPTIONAL 2
83 #define GTP_CONDITIONAL 4
85 static gboolean g_gtp_over_tcp = TRUE;
86 static guint g_gtpv0_port = GTPv0_PORT;
87 static guint g_gtpv1c_port = GTPv1C_PORT;
88 static guint g_gtpv1u_port = GTPv1U_PORT;
90 void proto_reg_handoff_gtp(void);
92 static int proto_gtp = -1;
95 static int hf_gtp_response_in = -1;
96 static int hf_gtp_response_to = -1;
97 static int hf_gtp_time = -1;
98 static int hf_gtp_apn = -1;
99 static int hf_gtp_cause = -1;
100 static int hf_gtp_chrg_char = -1;
101 static int hf_gtp_chrg_char_s = -1;
102 static int hf_gtp_chrg_char_n = -1;
103 static int hf_gtp_chrg_char_p = -1;
104 static int hf_gtp_chrg_char_f = -1;
105 static int hf_gtp_chrg_char_h = -1;
106 static int hf_gtp_chrg_char_r = -1;
107 static int hf_gtp_chrg_id = -1;
108 static int hf_gtp_chrg_ipv4 = -1;
109 static int hf_gtp_chrg_ipv6 = -1;
110 static int hf_gtp_ext_flow_label = -1;
111 static int hf_gtp_ext_id = -1;
112 static int hf_gtp_ext_val = -1;
113 static int hf_gtp_flags = -1;
114 static int hf_gtp_flags_ver = -1;
115 static int hf_gtp_prime_flags_ver = -1;
116 static int hf_gtp_flags_pt = -1;
117 static int hf_gtp_flags_spare1 = -1;
118 static int hf_gtp_flags_snn = -1;
119 static int hf_gtp_flags_spare2 = -1;
120 static int hf_gtp_flags_e = -1;
121 static int hf_gtp_flags_s = -1;
122 static int hf_gtp_flags_pn = -1;
123 static int hf_gtp_flow_ii = -1;
124 static int hf_gtp_flow_label = -1;
125 static int hf_gtp_flow_sig = -1;
126 static int hf_gtp_gsn_addr_len = -1;
127 static int hf_gtp_gsn_addr_type = -1;
128 static int hf_gtp_gsn_ipv4 = -1;
129 static int hf_gtp_gsn_ipv6 = -1;
130 static int hf_gtp_imsi = -1;
131 static int hf_gtp_length = -1;
132 static int hf_gtp_map_cause = -1;
133 static int hf_gtp_message_type = -1;
134 static int hf_gtp_ms_reason = -1;
135 static int hf_gtp_ms_valid = -1;
136 static int hf_gtp_msisdn = -1;
137 static int hf_gtp_next = -1;
138 static int hf_gtp_npdu_number = -1;
139 static int hf_gtp_node_ipv4 = -1;
140 static int hf_gtp_node_ipv6 = -1;
141 static int hf_gtp_nsapi = -1;
142 static int hf_gtp_ptmsi = -1;
143 static int hf_gtp_ptmsi_sig = -1;
144 static int hf_gtp_qos_version = -1;
145 static int hf_gtp_qos_spare1 = -1;
146 static int hf_gtp_qos_delay = -1;
147 static int hf_gtp_qos_mean = -1;
148 static int hf_gtp_qos_peak = -1;
149 static int hf_gtp_qos_spare2 = -1;
150 static int hf_gtp_qos_precedence = -1;
151 static int hf_gtp_qos_spare3 = -1;
152 static int hf_gtp_qos_reliability = -1;
153 static int hf_gtp_qos_al_ret_priority = -1;
154 static int hf_gtp_qos_traf_class = -1;
155 static int hf_gtp_qos_del_order = -1;
156 static int hf_gtp_qos_del_err_sdu = -1;
157 static int hf_gtp_qos_max_sdu_size = -1;
158 static int hf_gtp_qos_max_ul = -1;
159 static int hf_gtp_qos_max_dl = -1;
160 static int hf_gtp_qos_res_ber = -1;
161 static int hf_gtp_qos_sdu_err_ratio = -1;
162 static int hf_gtp_qos_trans_delay = -1;
163 static int hf_gtp_qos_traf_handl_prio = -1;
164 static int hf_gtp_qos_guar_ul = -1;
165 static int hf_gtp_qos_guar_dl = -1;
166 static int hf_gtp_qos_src_stat_desc = -1;
167 static int hf_gtp_qos_sig_ind = -1;
168 static int hf_gtp_pkt_flow_id = -1;
169 static int hf_gtp_rab_gtpu_dn = -1;
170 static int hf_gtp_rab_gtpu_up = -1;
171 static int hf_gtp_rab_pdu_dn = -1;
172 static int hf_gtp_rab_pdu_up = -1;
173 static int hf_gtp_rai_mcc = -1;
174 static int hf_gtp_rai_mnc = -1;
175 static int hf_gtp_rai_rac = -1;
176 static int hf_gtp_rai_lac = -1;
177 static int hf_gtp_ranap_cause = -1;
178 static int hf_gtp_recovery = -1;
179 static int hf_gtp_reorder = -1;
180 static int hf_gtp_rnc_ipv4 = -1;
181 static int hf_gtp_rnc_ipv6 = -1;
182 static int hf_gtp_rp = -1;
183 static int hf_gtp_rp_nsapi = -1;
184 static int hf_gtp_rp_sms = -1;
185 static int hf_gtp_rp_spare = -1;
186 static int hf_gtp_sel_mode = -1;
187 static int hf_gtp_seq_number = -1;
188 static int hf_gtp_sndcp_number = -1;
189 static int hf_gtp_tear_ind = -1;
190 static int hf_gtp_teid = -1;
191 static int hf_gtp_teid_cp = -1;
192 static int hf_gtp_ulink_teid_cp = -1;
193 static int hf_gtp_teid_data = -1;
194 static int hf_gtp_ulink_teid_data = -1;
195 static int hf_gtp_teid_ii = -1;
196 static int hf_gtp_tft_code = -1;
197 static int hf_gtp_tft_spare = -1;
198 static int hf_gtp_tft_number = -1;
199 static int hf_gtp_tft_eval = -1;
200 static int hf_gtp_tid = -1;
201 static int hf_gtp_tlli = -1;
202 static int hf_gtp_tr_comm = -1;
203 static int hf_gtp_trace_ref = -1;
204 static int hf_gtp_trace_type = -1;
205 static int hf_gtp_unknown = -1;
206 static int hf_gtp_user_addr_pdp_org = -1;
207 static int hf_gtp_user_addr_pdp_type = -1;
208 static int hf_gtp_user_ipv4 = -1;
209 static int hf_gtp_user_ipv6 = -1;
210 static int hf_gtp_security_mode = -1;
211 static int hf_gtp_no_of_vectors = -1;
212 static int hf_gtp_cipher_algorithm = -1;
213 static int hf_gtp_cksn_ksi = -1;
214 static int hf_gtp_cksn = -1;
215 static int hf_gtp_ksi = -1;
216 static int hf_gtp_ext_length = -1;
217 static int hf_gtp_ext_apn_res = -1;
218 static int hf_gtp_ext_rat_type = -1;
219 static int hf_gtp_ext_geo_loc_type = -1;
220 static int hf_gtp_ext_sac = -1;
221 static int hf_gtp_ext_imeisv = -1;
222 static int hf_gtp_targetRNC_ID = -1;
223 static int hf_gtp_bssgp_cause = -1;
224 static int hf_gtp_sapi = -1;
225 static int hf_gtp_xid_par_len = -1;
226 static int hf_gtp_earp_pvi = -1;
227 static int hf_gtp_earp_pl = -1;
228 static int hf_gtp_earp_pci = -1;
229 static int hf_gtp_cdr_app = -1;
230 static int hf_gtp_cdr_rel = -1;
231 static int hf_gtp_cdr_ver = -1;
232 static int hf_gtp_spare = -1;
233 static int hf_gtp_cmn_flg_ppc = -1;
234 static int hf_gtp_cmn_flg_mbs_srv_type = -1;
235 static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy = -1;
236 static int hf_gtp_cmn_flg_mbs_cnt_inf = -1;
237 static int hf_gtp_cmn_flg_nrsn = -1;
238 static int hf_gtp_cmn_flg_no_qos_neg = -1;
239 static int hf_gtp_cmn_flg_upgrd_qos_sup = -1;
240 static int hf_gtp_tmgi = -1;
241 static int hf_gtp_mbms_ses_dur_days = -1;
242 static int hf_gtp_mbms_ses_dur_s = -1;
243 static int hf_gtp_no_of_mbms_sa_codes = -1;
244 static int hf_gtp_mbms_sa_code = -1;
245 static int hf_gtp_mbs_2g_3g_ind = -1;
246 static int hf_gtp_time_2_dta_tr = -1;
247 static int hf_gtp_ext_ei = -1;
248 static int hf_gtp_ext_gcsi = -1;
249 static int hf_gtp_ext_dti = -1;
250 static int hf_gtp_ra_prio_lcs = -1;
251 static int hf_gtp_bcm = -1;
253 /* Initialize the subtree pointers */
254 static gint ett_gtp = -1;
255 static gint ett_gtp_flags = -1;
256 static gint ett_gtp_ext = -1;
257 static gint ett_gtp_rai = -1;
258 static gint ett_gtp_qos = -1;
259 static gint ett_gtp_auth_tri = -1;
260 static gint ett_gtp_flow_ii = -1;
261 static gint ett_gtp_rab_cntxt = -1;
262 static gint ett_gtp_rp = -1;
263 static gint ett_gtp_pkt_flow_id = -1;
264 static gint ett_gtp_chrg_char = -1;
265 static gint ett_gtp_user = -1;
266 static gint ett_gtp_mm = -1;
267 static gint ett_gtp_trip = -1;
268 static gint ett_gtp_quint = -1;
269 static gint ett_gtp_pdp = -1;
270 static gint ett_gtp_apn = -1;
271 static gint ett_gtp_proto = -1;
272 static gint ett_gtp_gsn_addr = -1;
273 static gint ett_gtp_tft = -1;
274 static gint ett_gtp_tft_pf = -1;
275 static gint ett_gtp_tft_flags = -1;
276 static gint ett_gtp_rab_setup = -1;
277 static gint ett_gtp_hdr_list = -1;
278 static gint ett_gtp_chrg_addr = -1;
279 static gint ett_gtp_node_addr = -1;
280 static gint ett_gtp_rel_pack = -1;
281 static gint ett_gtp_can_pack = -1;
282 static gint ett_gtp_data_resp = -1;
283 static gint ett_gtp_priv_ext = -1;
284 static gint ett_gtp_net_cap = -1;
285 static gint ett_gtp_ext_tree_apn_res = -1;
286 static gint ett_gtp_ext_rat_type = -1;
287 static gint ett_gtp_ext_imeisv = -1;
288 static gint ett_gtp_ext_ran_tr_cont = -1;
289 static gint ett_gtp_ext_pdp_cont_prio = -1;
290 static gint ett_gtp_ext_ssgn_no = -1;
291 static gint ett_gtp_ext_rab_setup_inf = -1;
292 static gint ett_gtp_ext_common_flgs = -1;
293 static gint ett_gtp_ext_usr_loc_inf = -1;
294 static gint ett_gtp_ext_ms_time_zone = -1;
295 static gint ett_gtp_ext_camel_chg_inf_con = -1;
296 static gint ett_GTP_EXT_MBMS_UE_CTX = -1;
297 static gint ett_gtp_ext_tmgi = -1;
298 static gint ett_gtp_tmgi = -1;
299 static gint ett_gtp_ext_rim_ra = -1;
300 static gint ett_gtp_ext_mbms_prot_conf_opt = -1;
301 static gint ett_gtp_ext_mbms_sa = -1;
302 static gint ett_gtp_ext_bms_ses_dur = -1;
303 static gint ett_gtp_ext_src_rnc_pdp_ctx_inf = -1;
304 static gint ett_gtp_ext_add_trs_inf = -1;
305 static gint ett_gtp_ext_hop_count = -1;
306 static gint ett_gtp_ext_sel_plmn_id = -1;
307 static gint ett_gtp_ext_mbms_ses_id = -1;
308 static gint ett_gtp_ext_mbms_2g_3g_ind = -1;
309 static gint ett_gtp_ext_enh_nsapi = -1;
310 static gint ett_gtp_ext_ad_mbms_trs_inf = -1;
311 static gint ett_gtp_ext_mbms_ses_id_rep_no = -1;
312 static gint ett_gtp_ext_mbms_time_to_data_tr = -1;
313 static gint ett_gtp_ext_ps_ho_req_ctx = -1;
314 static gint ett_gtp_ext_bss_cont = -1;
315 static gint ett_gtp_ext_cell_id = -1;
316 static gint ett_gtp_ext_pdu_no = -1;
317 static gint ett_gtp_ext_bssgp_cause = -1;
318 static gint ett_gtp_ext_ra_prio_lcs = -1;
319 static gint ett_gtp_ext_ps_handover_xid = -1;
320 static gint ett_gtp_target_id = -1;
321 static gint ett_gtp_utran_cont = -1;
322 static gint ett_gtp_bcm = -1;
323 static gint ett_gtp_cdr_ver = -1;
324 static gint ett_gtp_cdr_dr = -1;
326 static gboolean g_gtp_tpdu = TRUE;
327 static gboolean g_gtp_etsi_order = FALSE;
329 static int gtp_tap = -1;
331 /* Definition of flags masks */
332 #define GTP_VER_MASK 0xE0
334 static const value_string ver_types[] = {
335 {0, "GTP release 97/98 version"},
336 {1, "GTP release 99 version"},
346 static const value_string pt_types[] = {
352 #define GTP_PT_MASK 0x10
353 #define GTP_SPARE1_MASK 0x0E
354 #define GTP_SPARE2_MASK 0x08
355 #define GTP_E_MASK 0x04
356 #define GTP_S_MASK 0x02
357 #define GTP_SNN_MASK 0x01
358 #define GTP_PN_MASK 0x01
360 static const value_string next_extension_header_fieldvals[] = {
361 { 0, "No more extension headers"},
362 { 1, "MBMS support indication"},
363 { 2, "MS Info Change Reporting support indication"},
364 {0xc0, "PDCP PDU number"},
365 {0xc1, "Suspend Request"},
366 {0xc2, "Suspend Response"},
370 /* Definition of 3G charging characteristics masks */
371 #define GTP_MASK_CHRG_CHAR_S 0xF000
372 #define GTP_MASK_CHRG_CHAR_N 0x0800
373 #define GTP_MASK_CHRG_CHAR_P 0x0400
374 #define GTP_MASK_CHRG_CHAR_F 0x0200
375 #define GTP_MASK_CHRG_CHAR_H 0x0100
376 #define GTP_MASK_CHRG_CHAR_R 0x00FF
378 /* Traffic Flow Templates mask */
379 #define GTPv1_TFT_CODE_MASK 0xE0
380 #define GTPv1_TFT_SPARE_MASK 0x10
381 #define GTPv1_TFT_NUMBER_MASK 0x0F
383 /* Definition of GSN Address masks */
384 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
385 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
387 /* Definition of QoS masks */
388 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
389 #define GTP_EXT_QOS_DELAY_MASK 0x38
390 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
391 #define GTP_EXT_QOS_PEAK_MASK 0xF0
392 #define GTP_EXT_QOS_SPARE2_MASK 0x08
393 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
394 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
395 #define GTP_EXT_QOS_MEAN_MASK 0x1F
396 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
397 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
398 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
399 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
400 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
401 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
402 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
403 #define GTP_EXT_QOS_SRC_STAT_DESC_MASK 0x0F
404 #define GTP_EXT_QOS_SIG_IND_MASK 0x10
406 /* Definition of Radio Priority's masks */
407 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
408 #define GTPv1_EXT_RP_SPARE_MASK 0x08
409 #define GTPv1_EXT_RP_MASK 0x07
411 static const value_string message_type[] = {
412 {GTP_MSG_UNKNOWN, "For future use"},
413 {GTP_MSG_ECHO_REQ, "Echo request"},
414 {GTP_MSG_ECHO_RESP, "Echo response"},
415 {GTP_MSG_VER_NOT_SUPP, "Version not supported"},
416 {GTP_MSG_NODE_ALIVE_REQ, "Node alive request"},
417 {GTP_MSG_NODE_ALIVE_RESP, "Node alive response"},
418 {GTP_MSG_REDIR_REQ, "Redirection request"},
419 {GTP_MSG_REDIR_RESP, "Redirection response"},
421 * 8-15 For future use. Shall not be sent. If received,
422 * shall be treated as an Unknown message.
425 { 8, "Unknown message(For future use)"},
426 { 9, "Unknown message(For future use)"},
427 { 10, "Unknown message(For future use)"},
428 { 11, "Unknown message(For future use)"},
429 { 12, "Unknown message(For future use)"},
430 { 13, "Unknown message(For future use)"},
431 { 14, "Unknown message(For future use)"},
432 { 15, "Unknown message(For future use)"},
434 {GTP_MSG_CREATE_PDP_REQ, "Create PDP context request"},
435 {GTP_MSG_CREATE_PDP_RESP, "Create PDP context response"},
436 {GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request"},
437 {GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response"},
438 {GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request"},
439 {GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response"},
440 {GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request"},
441 {GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response"},
442 {GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request"},
443 {GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response"},
444 {GTP_MSG_ERR_IND, "Error indication"},
445 {GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request"},
446 {GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response"},
447 {GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request"},
448 {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
449 {GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification"},
450 {GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request"},
451 {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
452 {GTP_MSG_FAIL_REP_REQ, "Failure report request"},
453 {GTP_MSG_FAIL_REP_RESP, "Failure report response"},
454 {GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request"},
455 {GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response"},
456 /* 38-47 For future use. Shall not be sent. If received,
457 * shall be treated as an Unknown message.
460 { 38, "Unknown message(For future use)"},
461 { 39, "Unknown message(For future use)"},
462 { 40, "Unknown message(For future use)"},
463 { 41, "Unknown message(For future use)"},
464 { 42, "Unknown message(For future use)"},
465 { 43, "Unknown message(For future use)"},
466 { 44, "Unknown message(For future use)"},
467 { 45, "Unknown message(For future use)"},
468 { 46, "Unknown message(For future use)"},
469 { 47, "Unknown message(For future use)"},
471 {GTP_MSG_IDENT_REQ, "Identification request"},
472 {GTP_MSG_IDENT_RESP, "Identification response"},
473 {GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request"},
474 {GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response"},
475 {GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement"},
476 {GTP_MSG_FORW_RELOC_REQ, "Forward relocation request"},
477 {GTP_MSG_FORW_RELOC_RESP, "Forward relocation response"},
478 {GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete"},
479 {GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request"},
480 {GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response"},
481 {GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context"},
482 {GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge"},
483 {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
484 /* 61-69 For future use. Shall not be sent. If received,
485 * shall be treated as an Unknown message.
488 { 61, "Unknown message(For future use)"},
489 { 62, "Unknown message(For future use)"},
490 { 63, "Unknown message(For future use)"},
491 { 64, "Unknown message(For future use)"},
492 { 65, "Unknown message(For future use)"},
493 { 66, "Unknown message(For future use)"},
494 { 67, "Unknown message(For future use)"},
495 { 68, "Unknown message(For future use)"},
496 { 69, "Unknown message(For future use)"},
498 {GTP_MSG_RAN_INFO_RELAY, "RAN Information Relay"},
499 /* 71-95 For future use. Shall not be sent. If received,
500 * shall be treated as an Unknown message.
503 { 71, "Unknown message(For future use)"},
504 { 72, "Unknown message(For future use)"},
505 { 73, "Unknown message(For future use)"},
506 { 74, "Unknown message(For future use)"},
507 { 75, "Unknown message(For future use)"},
508 { 76, "Unknown message(For future use)"},
509 { 77, "Unknown message(For future use)"},
510 { 78, "Unknown message(For future use)"},
511 { 79, "Unknown message(For future use)"},
512 { 80, "Unknown message(For future use)"},
513 { 81, "Unknown message(For future use)"},
514 { 82, "Unknown message(For future use)"},
515 { 83, "Unknown message(For future use)"},
516 { 84, "Unknown message(For future use)"},
517 { 85, "Unknown message(For future use)"},
518 { 86, "Unknown message(For future use)"},
519 { 87, "Unknown message(For future use)"},
520 { 88, "Unknown message(For future use)"},
521 { 89, "Unknown message(For future use)"},
522 { 90, "Unknown message(For future use)"},
523 { 91, "Unknown message(For future use)"},
524 { 92, "Unknown message(For future use)"},
525 { 93, "Unknown message(For future use)"},
526 { 94, "Unknown message(For future use)"},
527 { 95, "Unknown message(For future use)"},
529 {GTP_MBMS_NOTIFY_REQ, "MBMS Notification Request"},
530 {GTP_MBMS_NOTIFY_RES, "MBMS Notification Response"},
531 {GTP_MBMS_NOTIFY_REJ_REQ, "MBMS Notification Reject Request"},
532 {GTP_MBMS_NOTIFY_REJ_RES, "MBMS Notification Reject Response"},
533 {GTP_CREATE_MBMS_CNTXT_REQ, "Create MBMS Context Request"},
534 {GTP_CREATE_MBMS_CNTXT_RES, "Create MBMS Context Response"},
535 {GTP_UPD_MBMS_CNTXT_REQ, "Update MBMS Context Request"},
536 {GTP_UPD_MBMS_CNTXT_RES, "Update MBMS Context Response"},
537 {GTP_DEL_MBMS_CNTXT_REQ, "Delete MBMS Context Request"},
538 {GTP_DEL_MBMS_CNTXT_RES, "Delete MBMS Context Response"},
539 /* 106 - 111 For future use. Shall not be sent. If received,
540 * shall be treated as an Unknown message.
542 {GTP_MBMS_REG_REQ, "MBMS Registration Request"},
543 {GTP_MBMS_REG_RES, "MBMS Registration Response"},
544 {GTP_MBMS_DE_REG_REQ, "MBMS De-Registration Request"},
545 {GTP_MBMS_DE_REG_RES, "MBMS De-Registration Response"},
546 {GTP_MBMS_SES_START_REQ, "MBMS Session Start Request"},
547 {GTP_MBMS_SES_START_RES, "MBMS Session Start Response"},
548 {GTP_MBMS_SES_STOP_REQ, "MBMS Session Stop Request"},
549 {GTP_MBMS_SES_STOP_RES, "MBMS Session Stop Response"},
550 {GTP_MBMS_SES_UPD_REQ, "MBMS Session Update Request"},
551 {GTP_MBMS_SES_UPD_RES, "MBMS Session Update Response"},
552 /* 122-127 For future use. Shall not be sent.
553 * If received, shall be treated as an Unknown message.
555 {GTP_MS_INFO_CNG_NOT_REQ, "MS Info Change Notification Request"},
556 {GTP_MS_INFO_CNG_NOT_RES, "MS Info Change Notification Response"},
557 /* 130-239 For future use. Shall not be sent. If received,
558 * shall be treated as an Unknown message.
560 {GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request"},
561 {GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response"},
562 /* 242-253 For future use. Shall not be sent. If received,
563 * shall be treated as an Unknown message.
565 {GTP_MSG_END_MARKER, "End Marker"},
566 {GTP_MSG_TPDU, "T-PDU"},
569 static value_string_ext message_type_ext = VALUE_STRING_EXT_INIT(message_type);
571 /* definitions of fields in extension header */
572 #define GTP_EXT_CAUSE 0x01
573 #define GTP_EXT_IMSI 0x02
574 #define GTP_EXT_RAI 0x03
575 #define GTP_EXT_TLLI 0x04
576 #define GTP_EXT_PTMSI 0x05
577 #define GTP_EXT_QOS_GPRS 0x06
578 #define GTP_EXT_REORDER 0x08
579 #define GTP_EXT_AUTH_TRI 0x09
580 #define GTP_EXT_MAP_CAUSE 0x0B
581 #define GTP_EXT_PTMSI_SIG 0x0C
582 #define GTP_EXT_MS_VALID 0x0D
583 #define GTP_EXT_RECOVER 0x0E
584 #define GTP_EXT_SEL_MODE 0x0F
586 #define GTP_EXT_16 0x10
587 #define GTP_EXT_FLOW_LABEL 0x10
588 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
590 #define GTP_EXT_17 0x11
591 #define GTP_EXT_FLOW_SIG 0x11
592 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
594 #define GTP_EXT_18 0x12
595 #define GTP_EXT_FLOW_II 0x12
596 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G */
598 #define GTP_EXT_19 0x13 /* 19 TV Teardown Ind 7.7.16 */
599 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
600 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G */
602 #define GTP_EXT_NSAPI 0x14 /* 3G */
603 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
604 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
605 #define GTP_EXT_RP_SMS 0x17 /* 3G */
606 #define GTP_EXT_RP 0x18 /* 3G */
607 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
608 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
609 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
610 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
611 #define GTPv1_EXT_MS_REASON 0x1D /* 3G 29 TV MS Not Reachable Reason 7.7.25A */
612 /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
613 #define GTP_EXT_TR_COMM 0x7E /* charging */
614 #define GTP_EXT_CHRG_ID 0x7F /* 127 TV Charging ID 7.7.26 */
615 #define GTP_EXT_USER_ADDR 0x80
616 #define GTP_EXT_MM_CNTXT 0x81
617 #define GTP_EXT_PDP_CNTXT 0x82
618 #define GTP_EXT_APN 0x83
619 #define GTP_EXT_PROTO_CONF 0x84
620 #define GTP_EXT_GSN_ADDR 0x85
621 #define GTP_EXT_MSISDN 0x86
622 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
623 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
624 #define GTP_EXT_TFT 0x89 /* 3G */
625 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
626 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
627 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
628 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
629 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G 142 7.7.41 */
630 #define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */
631 #define GTP_EXT_RAN_TR_CONT 0x90 /* 3G 144 TLV RAN Transparent Container 7.7.43 */
632 #define GTP_EXT_PDP_CONT_PRIO 0x91 /* 3G 145 TLV PDP Context Prioritization 7.7.45 */
633 #define GTP_EXT_ADD_RAB_SETUP_INF 0x92 /* 3G 146 TLV Additional RAB Setup Information 7.7.45A */
634 #define GTP_EXT_SSGN_NO 0x93 /* 3G 147 TLV SGSN Number 7.7.47 */
635 #define GTP_EXT_COMMON_FLGS 0x94 /* 3G 148 TLV Common Flags 7.7.48 */
636 #define GTP_EXT_APN_RES 0x95 /* 3G 149 */
637 #define GTP_EXT_RA_PRIO_LCS 0x96 /* 3G 150 TLV Radio Priority LCS 7.7.25B */
638 #define GTP_EXT_RAT_TYPE 0x97 /* 3G 151 TLV RAT Type 7.7.50 */
639 #define GTP_EXT_USR_LOC_INF 0x98 /* 3G 152 TLV User Location Information 7.7.51 */
640 #define GTP_EXT_MS_TIME_ZONE 0x99 /* 3G 153 TLV MS Time Zone 7.7.52 */
641 #define GTP_EXT_IMEISV 0x9A /* 3G 154 TLV IMEI(SV) 7.7.53 */
642 #define GTP_EXT_CAMEL_CHG_INF_CON 0x9B /* 3G 155 TLV CAMEL Charging Information Container 7.7.54 */
643 #define GTP_EXT_MBMS_UE_CTX 0x9C /* 3G 156 TLV MBMS UE Context 7.7.55 */
644 #define GTP_EXT_TMGI 0x9D /* 3G 157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
645 #define GTP_EXT_RIM_RA 0x9E /* 3G 158 TLV RIM Routing Address 7.7.57 */
646 #define GTP_EXT_MBMS_PROT_CONF_OPT 0x9F /* 3G 159 TLV MBMS Protocol Configuration Options 7.7.58 */
647 #define GTP_EXT_MBMS_SA 0xA0 /* 3G 160 TLV MBMS Service Area 7.7.60 */
648 #define GTP_EXT_SRC_RNC_PDP_CTX_INF 0xA1 /* 3G 161 TLV Source RNC PDCP context info 7.7.61 */
649 #define GTP_EXT_ADD_TRS_INF 0xA2 /* 3G 162 TLV Additional Trace Info 7.7.62 */
650 #define GTP_EXT_HOP_COUNT 0xA3 /* 3G 163 TLV Hop Counter 7.7.63 */
651 #define GTP_EXT_SEL_PLMN_ID 0xA4 /* 3G 164 TLV Selected PLMN ID 7.7.64 */
652 #define GTP_EXT_MBMS_SES_ID 0xA5 /* 3G 165 TLV MBMS Session Identifier 7.7.65 */
653 #define GTP_EXT_MBMS_2G_3G_IND 0xA6 /* 3G 166 TLV MBMS 2G/3G Indicator 7.7.66 */
654 #define GTP_EXT_ENH_NSAPI 0xA7 /* 3G 167 TLV Enhanced NSAPI 7.7.67 */
655 #define GTP_EXT_MBMS_SES_DUR 0xA8 /* 3G 168 TLV MBMS Session Duration 7.7.59 */
656 #define GTP_EXT_ADD_MBMS_TRS_INF 0xA9 /* 3G 169 TLV Additional MBMS Trace Info 7.7.68 */
657 #define GTP_EXT_MBMS_SES_ID_REP_NO 0xAA /* 3G 170 TLV MBMS Session Identity Repetition Number 7.7.69 */
658 #define GTP_EXT_MBMS_TIME_TO_DATA_TR 0xAB /* 3G 171 TLV MBMS Time To Data Transfer 7.7.70 */
659 #define GTP_EXT_PS_HO_REQ_CTX 0xAC /* 3G 172 TLV PS Handover Request Context 7.7.71 */
660 #define GTP_EXT_BSS_CONT 0xAD /* 3G 173 TLV BSS Container 7.7.72 */
661 #define GTP_EXT_CELL_ID 0xAE /* 3G 174 TLV Cell Identification 7.7.73 */
662 #define GTP_EXT_PDU_NO 0xAF /* 3G 175 TLV PDU Numbers 7.7.74 */
663 #define GTP_EXT_BSSGP_CAUSE 0xB0 /* 3G 176 TLV BSSGP Cause 7.7.75 */
664 #define GTP_EXT_REQ_MBMS_BEARER_CAP 0xB1 /* 3G 177 TLV Required MBMS bearer capabilities 7.7.76 */
665 #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2 /* 3G 178 TLV RIM Routing Address Discriminator 7.7.77 */
666 #define GTP_EXT_LIST_OF_SETUP_PFCS 0xB3 /* 3G 179 TLV List of set-up PFCs 7.7.78 */
667 #define GTP_EXT_PS_HANDOVER_XIP_PAR 0xB4 /* 3G 180 TLV PS Handover XID Parameters 7.7.79 */
668 #define GTP_EXT_MS_INF_CHG_REP_ACT 0xB5 /* 3G 181 TLV MS Info Change Reporting Action 7.7.80 */
669 #define GTP_EXT_DIRECT_TUNNEL_FLGS 0xB6 /* 3G 182 TLV Direct Tunnel Flags 7.7.81 */
670 #define GTP_EXT_CORRELATION_ID 0xB7 /* 3G 183 TLV Correlation-ID 7.7.82 */
671 #define GTP_EXT_BEARER_CONTROL_MODE 0xB8 /* 3G 184 TLV Bearer Control Mode 7.7.83 */
672 /* 3G 185 TLV MBMS Flow Identifier 7.7.84 */
673 /* 3G 186 TLV MBMS IP Multicast Distribution 7.7.85 */
674 /* 3G 187 TLV MBMS Distribution Acknowledgement 7.7.86 */
675 /* 3G 188 TLV Reliable INTER RAT HANDOVER INFO 7.7.87 */
676 /* 3G 189 TLV RFSP Index 7.7.88 */
677 /* 3G 190 TLV Fully Qualified Domain Name (FQDN) 7.7.90 */
678 #define GTP_EXT_EVO_ALLO_RETE_P1 0xBF /* 3G 191 TLV Evolved Allocation/Retention Priority I 7.7.91 */
679 /* 3G 192 TLV Evolved Allocation/Retention Priority II 7.7.92 */
680 /* 3G 193 TLV Extended Common Flags 7.7.93 */
681 /* 3G 194 TLV User CSG Information (UCI) 7.7.94 */
682 /* 3G 195 TLV CSG Information Reporting Action 7.7.95 */
683 /* 3G 196 TLV CSG ID 7.7.96 */
684 /* 3G 197 TLV CSG Membership Indication (CMI) 7.7.97 */
685 /* 3G 198 TLV Aggregate Maximum Bit Rate (AMBR) 7.7.98 */
686 /* 3G 199 TLV UE Network Capability 7.7.99 */
687 /* 3G 200 TLV UE-AMBR 7.7.100 */
688 /* 3G 201 TLV APN-AMBR with NSAPI 7.7.101 */
689 /* 202-238 TLV Spare. For future use. */
691 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
693 #define GTP_EXT_C1 0xC1
694 #define GTP_EXT_C2 0xC2
695 #define GTP_EXT_REL_PACK 0xF9 /* charging */
696 #define GTP_EXT_CAN_PACK 0xFA /* charging */
697 #define GTP_EXT_CHRG_ADDR 0xFB /* 3G 251 TLV Charging Gateway Address 7.7.44 */
698 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
699 #define GTP_EXT_DATA_REQ 0xFC /* charging */
700 #define GTP_EXT_DATA_RESP 0xFD /* charging */
701 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
702 #define GTP_EXT_PRIV_EXT 0xFF
704 static const value_string gtp_val[] = {
705 {GTP_EXT_CAUSE, "Cause of operation"},
706 {GTP_EXT_IMSI, "IMSI"},
707 {GTP_EXT_RAI, "Routing Area Identity"},
708 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
709 {GTP_EXT_PTMSI, "Packet TMSI"},
710 {GTP_EXT_QOS_GPRS, "Quality of Service"},
711 {GTP_EXT_REORDER, "Reorder required"},
712 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
713 {GTP_EXT_MAP_CAUSE, "MAP cause"},
714 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
715 {GTP_EXT_MS_VALID, "MS validated"},
716 {GTP_EXT_RECOVER, "Recovery"},
717 {GTP_EXT_SEL_MODE, "Selection mode"},
719 {GTP_EXT_16, "Flow label data I"},
720 {GTP_EXT_FLOW_LABEL, "Flow label data I"},
721 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
723 {GTP_EXT_17, "Flow label signalling"},
724 {GTP_EXT_FLOW_SIG, "Flow label signalling"},
725 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
727 {GTP_EXT_18, "Flow label data II"},
728 {GTP_EXT_FLOW_II, "Flow label data II"},
729 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
731 {GTP_EXT_19, "MS not reachable reason"},
732 {GTP_EXT_MS_REASON, "MS not reachable reason"},
733 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
735 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
736 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
737 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
738 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
739 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
740 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
741 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
742 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
743 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
744 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
745 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
746 {GTP_EXT_CHRG_ID, "Charging ID"},
747 {GTP_EXT_USER_ADDR, "End user address"},
748 {GTP_EXT_MM_CNTXT, "MM context"},
749 {GTP_EXT_PDP_CNTXT, "PDP context"},
750 {GTP_EXT_APN, "Access Point Name"},
751 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
752 {GTP_EXT_GSN_ADDR, "GSN address"},
753 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
754 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
755 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
756 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
757 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
758 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
759 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
760 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
761 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
762 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
764 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
765 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
766 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
767 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
768 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
769 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
770 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
771 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
772 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
773 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
775 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
776 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
777 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
778 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
779 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
780 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
781 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
782 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
783 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
784 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
785 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
786 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
787 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
788 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
789 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
790 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
791 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
792 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
793 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
794 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
795 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
796 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
797 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
798 {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
799 {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
800 {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
801 {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"}, /* 7.7.79 */
802 {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
803 {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
804 {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
805 {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
806 {185, "MBMS Flow Identifier"}, /* 7.7.84 */
807 {186, "MBMS IP Multicast Distribution"}, /* 7.7.85 */
808 {187, "MBMS Distribution Acknowledgement"}, /* 7.7.86 */
809 {188, "Reliable INTER RAT HANDOVER INFO"}, /* 7.7.87 */
810 {189, "RFSP Index"}, /* 7.7.88 */
811 {190, "Fully Qualified Domain Name (FQDN)"}, /* 7.7.90 */
812 {GTP_EXT_EVO_ALLO_RETE_P1, "Evolved Allocation/Retention Priority I"}, /* 7.7.91 */
813 {192, "Evolved Allocation/Retention Priority II"}, /* 7.7.92 */
814 {193, "Extended Common Flags"}, /* 7.7.93 */
815 {194, "User CSG Information (UCI)"}, /* 7.7.94 */
816 {195, "CSG Information Reporting Action"}, /* 7.7.95 */
817 {196, "CSG ID"}, /* 7.7.96 */
818 {197, "CSG Membership Indication (CMI)"}, /* 7.7.97 */
819 {198, "Aggregate Maximum Bit Rate (AMBR)"}, /* 7.7.98 */
820 {199, "UE Network Capability"}, /* 7.7.99 */
821 {200, "UE-AMBR"}, /* 7.7.100 */
822 {201, "APN-AMBR with NSAPI"}, /* 7.7.101 */
824 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
825 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
826 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
827 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
828 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
829 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
830 {GTP_EXT_PRIV_EXT, "Private Extension"},
833 static value_string_ext gtp_val_ext = VALUE_STRING_EXT_INIT(gtp_val);
835 /* It seems like some IE's are renamed in gtpv1 at least reading
836 * 3GPP TS 29.060 version 6.11.0 Release 6
838 static const value_string gtpv1_val[] = {
839 {GTP_EXT_CAUSE, "Cause of operation"},
840 {GTP_EXT_IMSI, "IMSI"},
841 {GTP_EXT_RAI, "Routing Area Identity"},
842 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
843 {GTP_EXT_PTMSI, "Packet TMSI"},
844 {GTP_EXT_QOS_GPRS, "Quality of Service"},
845 {GTP_EXT_REORDER, "Reorder required"},
846 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
847 {GTP_EXT_MAP_CAUSE, "MAP cause"},
848 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
849 {GTP_EXT_MS_VALID, "MS validated"},
850 {GTP_EXT_RECOVER, "Recovery"},
851 {GTP_EXT_SEL_MODE, "Selection mode"},
853 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
855 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
857 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
859 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
861 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
862 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
863 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
864 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
865 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
866 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
867 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
868 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
869 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
870 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
871 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
872 {GTP_EXT_CHRG_ID, "Charging ID"},
873 {GTP_EXT_USER_ADDR, "End user address"},
874 {GTP_EXT_MM_CNTXT, "MM context"},
875 {GTP_EXT_PDP_CNTXT, "PDP context"},
876 {GTP_EXT_APN, "Access Point Name"},
877 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
878 {GTP_EXT_GSN_ADDR, "GSN address"},
879 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
880 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
881 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
882 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
883 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
884 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
885 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
886 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
887 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
888 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
890 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
891 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
892 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
893 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
894 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
895 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
896 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
897 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
898 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
899 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
901 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
902 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
903 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
904 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
905 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
906 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
907 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
908 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
909 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
910 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
911 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
912 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
913 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
914 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
915 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
916 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
917 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
918 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
919 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
920 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
921 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
922 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
923 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
924 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
925 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
926 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
927 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
928 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
929 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
930 {GTP_EXT_PRIV_EXT, "Private Extension"},
933 static value_string_ext gtpv1_val_ext = VALUE_STRING_EXT_INIT(gtpv1_val);
935 /* GPRS: 9.60 v7.6.0, page 37
936 * UMTS: 29.060 v4.0, page 45
937 * ETSI TS 129 060 V9.4.0 (2010-10) Ch 7.7.1
939 static const value_string cause_type[] = {
940 { 0, "Request IMSI"},
941 { 1, "Request IMEI"},
942 { 2, "Request IMSI and IMEI"},
943 { 3, "No identity needed"},
945 { 5, "MS is not GPRS responding"},
946 /* For future use 6-48 */
947 /* Cause values reserved for GPRS charging
948 * protocol use (see GTP' in 3GPP TS 32.295 [33])
951 { 59, "System failure"}, /* charging */
952 { 60, "The transmit buffers are becoming full"}, /* charging */
953 { 61, "The receive buffers are becoming full"}, /* charging */
954 { 62, "Another node is about to go down"}, /* charging */
955 { 63, "This node is about to go down"}, /* charging */
956 /* For future use 64-127 */
957 {128, "Request accepted"},
958 {129, "New PDP type due to network preference"},
959 {130, "New PDP type due to single address bearer only"},
960 /* For future use 131-176 */
961 /* Cause values reserved for GPRS charging
962 * protocol use (see GTP' in 3GPP TS 32.295 [33])
965 {177, "CDR decoding error"},
967 {192, "Non-existent"},
968 {193, "Invalid message format"},
969 {194, "IMSI not known"},
970 {195, "MS is GPRS detached"},
971 {196, "MS is not GPRS responding"},
973 {198, "Version not supported"},
974 {199, "No resource available"},
975 {200, "Service not supported"},
976 {201, "Mandatory IE incorrect"},
977 {202, "Mandatory IE missing"},
978 {203, "Optional IE incorrect"},
979 {204, "System failure"},
980 {205, "Roaming restriction"},
981 {206, "P-TMSI signature mismatch"},
982 {207, "GPRS connection suspended"},
983 {208, "Authentication failure"},
984 {209, "User authentication failed"},
985 {210, "Context not found"},
986 {211, "All PDP dynamic addresses are occupied"},
987 {212, "No memory is available"},
988 {213, "Relocation failure"},
989 {214, "Unknown mandatory extension header"},
990 {215, "Semantic error in the TFT operation"},
991 {216, "Syntactic error in the TFT operation"},
992 {217, "Semantic errors in packet filter(s)"},
993 {218, "Syntactic errors in packet filter(s)"},
994 {219, "Missing or unknown APN"},
995 {220, "Unknown PDP address or PDP type"},
996 {221, "PDP context without TFT already activated"},
997 {222, "APN access denied - no subscription"},
998 {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
999 {224, "MS MBMS Capabilities Insufficient"},
1000 {225, "Invalid Correlation-ID"},
1001 {226, "MBMS Bearer Context Superseded"},
1002 {227, "Bearer Control Mode violation"},
1003 {228, "Collision with network initiated request"},
1004 /* For future use 229-240 */
1005 /* Cause values reserved for GPRS charging
1006 * protocol use (see GTP' in 3GPP TS 32.295 [33])
1009 {252, "Request related to possibly duplicated packets already fulfilled"}, /* charging */
1010 {253, "Request already fulfilled"}, /* charging */
1011 {254, "Sequence numbers of released/cancelled packets IE incorrect"}, /* charging */
1012 {255, "Request not fulfilled"}, /* charging */
1015 static value_string_ext cause_type_ext = VALUE_STRING_EXT_INIT(cause_type);
1017 /* GPRS: 9.02 v7.7.0
1018 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
1019 * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
1022 static const value_string gsn_addr_type[] = {
1028 static const value_string pdp_type[] = {
1031 {0x02, "OSP:IHOSS"},
1037 static const value_string pdp_org_type[] = {
1043 static const value_string qos_delay_type[] = {
1044 {0x00, "Subscribed delay class (in MS to network direction)"},
1045 {0x01, "Delay class 1"},
1046 {0x02, "Delay class 2"},
1047 {0x03, "Delay class 3"},
1048 {0x04, "Delay class 4 (best effort)"},
1053 static const value_string qos_reliability_type[] = {
1054 {0x00, "Subscribed reliability class (in MS to network direction)"},
1055 {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
1056 {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
1057 {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
1058 {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
1059 {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
1064 static const value_string qos_peak_type[] = {
1065 {0x00, "Subscribed peak throughput (in MS to network direction)"},
1066 {0x01, "Up to 1 000 oct/s"},
1067 {0x02, "Up to 2 000 oct/s"},
1068 {0x03, "Up to 4 000 oct/s"},
1069 {0x04, "Up to 8 000 oct/s"},
1070 {0x05, "Up to 16 000 oct/s"},
1071 {0x06, "Up to 32 000 oct/s"},
1072 {0x07, "Up to 64 000 oct/s"},
1073 {0x08, "Up to 128 000 oct/s"},
1074 {0x09, "Up to 256 000 oct/s"},
1075 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
1085 static const value_string qos_precedence_type[] = {
1086 {0x00, "Subscribed precedence (in MS to network direction)"},
1087 {0x01, "High priority"},
1088 {0x02, "Normal priority"},
1089 {0x03, "Low priority"},
1094 static const value_string qos_mean_type[] = {
1095 {0x00, "Subscribed mean throughput (in MS to network direction)"},
1096 {0x01, "100 oct/h"}, /* Class 2 */
1097 {0x02, "200 oct/h"}, /* Class 3 */
1098 {0x03, "500 oct/h"}, /* Class 4 */
1099 {0x04, "1 000 oct/h"}, /* Class 5 */
1100 {0x05, "2 000 oct/h"}, /* Class 6 */
1101 {0x06, "5 000 oct/h"}, /* Class 7 */
1102 {0x07, "10 000 oct/h"}, /* Class 8 */
1103 {0x08, "20 000 oct/h"}, /* Class 9 */
1104 {0x09, "50 000 oct/h"}, /* Class 10 */
1105 {0x0A, "100 000 oct/h"}, /* Class 11 */
1106 {0x0B, "200 000 oct/h"}, /* Class 12 */
1107 {0x0C, "500 000 oct/h"}, /* Class 13 */
1108 {0x0D, "1 000 000 oct/h"}, /* Class 14 */
1109 {0x0E, "2 000 000 oct/h"}, /* Class 15 */
1110 {0x0F, "5 000 000 oct/h"}, /* Class 16 */
1111 {0x10, "10 000 000 oct/h"}, /* Class 17 */
1112 {0x11, "20 000 000 oct/h"}, /* Class 18 */
1113 {0x12, "50 000 000 oct/h"}, /* Class 19 */
1114 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
1127 {0x1F, "Best effort"}, /* Class 1 */
1130 static value_string_ext qos_mean_type_ext = VALUE_STRING_EXT_INIT(qos_mean_type);
1132 static const value_string qos_del_err_sdu[] = {
1133 {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
1134 {0x01, "No detect ('-')"},
1135 {0x02, "Erroneous SDUs are delivered ('yes')"},
1136 {0x03, "Erroneous SDUs are not delivered ('no')"},
1137 {0x07, "Reserved"}, /* All other values are reserved */
1141 static const value_string qos_del_order[] = {
1142 {0x00, "Subscribed delivery order (in MS to network direction)"},
1143 {0x01, "With delivery order ('yes')"},
1144 {0x02, "Without delivery order ('no')"},
1145 {0x03, "Reserved"}, /* All other values are reserved */
1149 static const value_string qos_traf_class[] = {
1150 {0x00, "Subscribed traffic class (in MS to network direction)"},
1151 {0x01, "Conversational class"},
1152 {0x02, "Streaming class"},
1153 {0x03, "Interactive class"},
1154 {0x04, "Background class"},
1155 {0x07, "Reserved"}, /* All other values are reserved */
1159 static const value_string qos_max_sdu_size[] = {
1160 {0x00, "Subscribed maximum SDU size (in MS to network direction"},
1161 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
1162 {0x97, "1502 octets"},
1163 {0x98, "1510 octets"},
1164 {0x99, "1520 octets"},
1165 {0, NULL} /* All other values are reserved */
1168 static const value_string qos_max_ul[] = {
1169 {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
1170 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1171 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1172 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1177 static const value_string qos_max_dl[] = {
1178 {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
1179 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1180 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1181 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1186 static const value_string qos_res_ber[] = {
1187 {0x00, "Subscribed residual BER (in MS to network direction)"},
1188 {0x01, "1/20 = 5x10^-2"},
1189 {0x02, "1/100 = 1x10^-2"},
1190 {0x03, "1/200 = 5x10^-3"},
1191 {0x04, "1/250 = 4x10^-3"},
1192 {0x05, "1/1 000 = 1x10^-3"},
1193 {0x06, "1/10 000 = 1x10^-4"},
1194 {0x07, "1/100 000 = 1x10^-5"},
1195 {0x08, "1/1 000 000 = 1x10^-6"},
1196 {0x09, "3/50 000 000 = 6x10^-8"},
1197 {0x0F, "Reserved"}, /* All other values are reserved */
1201 static const value_string qos_sdu_err_ratio[] = {
1202 {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
1203 {0x01, "1/100 = 1x10^-2"},
1204 {0x02, "7/1000 = 7x10^-3"},
1205 {0x03, "1/1 000 = 1x10^-3"},
1206 {0x04, "1/10 000 = 1x10^-4"},
1207 {0x05, "1/100 000 = 1x10^-5"},
1208 {0x06, "1/1 000 000 = 1x10^-6"},
1209 {0x07, "1/10 = 1x10^-1"},
1210 {0x0F, "Reserved"}, /* All other values are reserved */
1214 static const value_string qos_traf_handl_prio[] = {
1215 {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
1216 {0x01, "Priority level 1"},
1217 {0x02, "Priority level 2"},
1218 {0x03, "Priority level 3"},
1222 static const value_string qos_trans_delay[] = {
1223 {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
1224 {0x01, "10 ms"}, /* Using a granularity of 10 ms */
1239 {0x10, "200 ms"}, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
1255 {0x20, "1000 ms"}, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
1289 static value_string_ext qos_trans_delay_ext = VALUE_STRING_EXT_INIT(qos_trans_delay);
1291 static const value_string qos_guar_ul[] = {
1292 {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
1293 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1294 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1295 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1300 static const value_string src_stat_desc_vals[] = {
1307 static const true_false_string gtp_sig_ind = {
1308 "Optimised for signalling traffic",
1309 "Not optimised for signalling traffic"
1312 static const value_string qos_guar_dl[] = {
1313 {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
1314 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1315 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1316 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1321 static const value_string sel_mode_type[] = {
1322 {0, "MS or network provided APN, subscribed verified"},
1323 {1, "MS provided APN, subscription not verified"},
1324 {2, "Network provided APN, subscription not verified"},
1325 {3, "For future use (Network provided APN, subscription not verified"}, /* Shall not be sent. If received, shall be sent as value 2 */
1329 static const value_string tr_comm_type[] = {
1330 {1, "Send data record packet"},
1331 {2, "Send possibly duplicated data record packet"},
1332 {3, "Cancel data record packet"},
1333 {4, "Release data record packet"},
1337 /* TODO: CHeck if all ms_reasons are included */
1338 static const value_string ms_not_reachable_type[] = {
1339 {0, "No paging response via the MSC"},
1340 {1, "IMSI detached"},
1341 {2, "Roaming restriction"},
1342 {3, "Deregistered in the HLR for non GPRS"},
1343 {4, "MS purge for non GPRS"},
1344 {5, "No paging response via the SGSN"},
1345 {6, "GPRS detached"},
1346 {7, "Deregistered in the HLR for non GPRS"},
1347 {8, "MS purged for GPRS"},
1348 {9, "Unidentified subscriber via the MSC"},
1349 {10, "Unidentified subscriber via the SGSN"},
1350 {11, "Deregistered in the HSS/HLR for IMS"},
1351 {12, "No response via the IP-SM-GW"},
1355 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1357 static const value_string ranap_cause_type[] = {
1358 /* Radio Network Layer Cause (1-->64) */
1359 {1, "RAB preempted"},
1360 {2, "Trelocoverall Expiry"},
1361 {3, "Trelocprep Expiry"},
1362 {4, "Treloccomplete Expiry"},
1363 {5, "Tqueuing Expiry"},
1364 {6, "Relocation Triggered"},
1365 {7, "TRELOCalloc Expiry"},
1366 {8, "Unable to Establish During Relocation"},
1367 {9, "Unknown Target RNC"},
1368 {10, "Relocation Cancelled"},
1369 {11, "Successful Relocation"},
1370 {12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
1371 {13, "Change of Ciphering and/or Integrity Protection is not supported"},
1372 {14, "Failure in the Radio Interface Procedure"},
1373 {15, "Release due to UTRAN Generated Reason"},
1374 {16, "User Inactivity"},
1375 {17, "Time Critical Relocation"},
1376 {18, "Requested Traffic Class not Available"},
1377 {19, "Invalid RAB Parameters Value"},
1378 {20, "Requested Maximum Bit Rate not Available"},
1379 {21, "Requested Guaranteed Bit Rate not Available"},
1380 {22, "Requested Transfer Delay not Achievable"},
1381 {23, "Invalid RAB Parameters Combination"},
1382 {24, "Condition Violation for SDU Parameters"},
1383 {25, "Condition Violation for Traffic Handling Priority"},
1384 {26, "Condition Violation for Guaranteed Bit Rate"},
1385 {27, "User Plane Versions not Supported"},
1386 {28, "Iu UP Failure"},
1387 {29, "Relocation Failure in Target CN/RNC or Target System"},
1388 {30, "Invalid RAB ID"},
1389 {31, "No Remaining RAB"},
1390 {32, "Interaction with other procedure"},
1391 {33, "Requested Maximum Bit Rate for DL not Available"},
1392 {34, "Requested Maximum Bit Rate for UL not Available"},
1393 {35, "Requested Guaranteed Bit Rate for DL not Available"},
1394 {36, "Requested Guaranteed Bit Rate for UL not Available"},
1395 {37, "Repeated Integrity Checking Failure"},
1396 {38, "Requested Report Type not supported"},
1397 {39, "Request superseded"},
1398 {40, "Release due to UE generated signalling connection release"},
1399 {41, "Resource Optimisation Relocation"},
1400 {42, "Requested Information Not Available"},
1401 {43, "Relocation desirable for radio reasons"},
1402 {44, "Relocation not supported in Target RNC or Target System"},
1403 {45, "Directed Retry"},
1404 {46, "Radio Connection With UE Lost"},
1405 {47, "rNC-unable-to-establish-all-RFCs"},
1406 {48, "deciphering-keys-not-available"},
1407 {49, "dedicated-assistance-data-not-available"},
1408 {50, "relocation-target-not-allowed"},
1409 {51, "location-reporting-congestion"},
1410 {52, "reduce-load-in-serving-cell"},
1411 {53, "no-radio-resources-available-in-target-cell"},
1412 {54, "gERAN-Iumode-failure"},
1413 {55, "access-restricted-due-to-shared-networks"},
1414 {56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
1415 {57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
1416 {58, "mBMS-no-multicast-service-for-this-UE"},
1417 {59, "mBMS-unknown-UE-ID"},
1418 {60, "successful-MBMS-session-start-no-data-bearer-necessary"},
1419 {61, "mBMS-superseded-due-to-NNSF"},
1420 {62, "mBMS-UE-linking-already-done"},
1421 {63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
1422 {64, "tMGI-unknown"},
1423 /* Transport Layer Cause (65-->80) */
1424 {65, "Signalling Transport Resource Failure"},
1425 {66, "Iu Transport Connection Failed to Establish"},
1426 /* NAS Cause (81-->96) */
1427 {81, "User Restriction Start Indication"},
1428 {82, "User Restriction End Indication"},
1429 {83, "Normal Release"},
1430 /* Protocol Cause (97-->112) */
1431 {97, "Transfer Syntax Error"},
1432 {98, "Semantic Error"},
1433 {99, "Message not compatible with receiver state"},
1434 {100, "Abstract Syntax Error (Reject)"},
1435 {101, "Abstract Syntax Error (Ignore and Notify)"},
1436 {102, "Abstract Syntax Error (Falsely Constructed Message"},
1437 /* Miscellaneous Cause (113-->128) */
1438 {113, "O & M Intervention"},
1439 {114, "No Resource Available"},
1440 {115, "Unspecified Failure"},
1441 {116, "Network Optimisation"},
1442 /* Non-standard Cause (129-->255) */
1444 /* ranap_CauseRadioNetworkExtension ??
1445 { 257, "iP-multicast-address-and-APN-not-valid" },
1446 { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
1447 { 259, "mBMS-request-superseded" },
1448 { 260, "mBMS-de-registration-during-session-not-allowed" },
1449 { 261, "mBMS-no-data-bearer-necessary" },
1454 static value_string_ext ranap_cause_type_ext = VALUE_STRING_EXT_INIT(ranap_cause_type);
1456 static const value_string mm_sec_modep[] = {
1457 {0, "Used cipher value, UMTS keys and Quintuplets"},
1458 {1, "GSM key and triplets"},
1459 {2, "UMTS key and quintuplets"},
1460 {3, "GSM key and quintuplets"},
1464 static const value_string gtp_cipher_algorithm[] = {
1465 {0, "No ciphering"},
1475 static const value_string gtp_ext_rat_type_vals[] = {
1481 {5, "HSPA Evolution"},
1485 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
1486 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
1487 #define MM_PROTO_PDSS1 0x02
1488 #define MM_PROTO_CALL_CONTROL 0x03
1489 #define MM_PROTO_PDSS2 0x04
1490 #define MM_PROTO_MM_NON_GPRS 0x05
1491 #define MM_PROTO_RR_MGMT 0x06
1492 #define MM_PROTO_MM_GPRS 0x08
1493 #define MM_PROTO_SMS 0x09
1494 #define MM_PROTO_SESSION_MGMT 0x0A
1495 #define MM_PROTO_NON_CALL_RELATED 0x0B
1497 static const value_string tft_code_type[] = {
1499 {1, "Create new TFT"},
1500 {2, "Delete existing TFT"},
1501 {3, "Add packet filters to existing TFT"},
1502 {4, "Replace packet filters in existing TFT"},
1503 {5, "Delete packet filters from existing TFT"},
1510 static dissector_handle_t ip_handle;
1511 static dissector_handle_t ipv6_handle;
1512 static dissector_handle_t ppp_handle;
1513 static dissector_handle_t data_handle;
1514 static dissector_handle_t gtpcdr_handle;
1515 static dissector_handle_t sndcpxid_handle;
1516 static dissector_handle_t gtpv2_handle;
1517 static dissector_table_t bssap_pdu_type_table;
1519 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype);
1521 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1522 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1523 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1524 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1525 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1526 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1527 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1528 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1529 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1530 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1531 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1532 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1533 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1534 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1535 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1536 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1537 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1538 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1539 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1540 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1541 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1542 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1543 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1544 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1545 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1546 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1547 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1548 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1549 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1550 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1551 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1552 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1553 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1554 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1555 static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1556 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1557 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1558 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1559 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1560 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1561 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1562 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1563 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1564 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1565 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1567 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1568 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1569 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1570 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1571 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1572 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1573 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1574 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1575 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1576 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1577 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1578 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1579 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1580 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1581 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1582 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1583 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1584 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1585 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1586 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1587 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1588 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1589 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1590 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1591 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1592 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1593 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1594 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1595 static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1596 static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1597 static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1598 static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1599 static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1600 static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1601 static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1602 static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1603 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1604 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1605 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1606 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1607 static int decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1608 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1609 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1610 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1611 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1612 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1613 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1614 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1615 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1616 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1618 typedef struct _gtp_opt {
1620 int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *);
1623 static const gtp_opt_t gtpopt[] = {
1624 {GTP_EXT_CAUSE, decode_gtp_cause},
1625 {GTP_EXT_IMSI, decode_gtp_imsi},
1626 {GTP_EXT_RAI, decode_gtp_rai},
1627 {GTP_EXT_TLLI, decode_gtp_tlli},
1628 {GTP_EXT_PTMSI, decode_gtp_ptmsi},
1629 {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
1630 {GTP_EXT_REORDER, decode_gtp_reorder},
1631 {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
1632 {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
1633 {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
1634 {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
1635 {GTP_EXT_RECOVER, decode_gtp_recovery},
1636 {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
1637 {GTP_EXT_16, decode_gtp_16},
1638 {GTP_EXT_17, decode_gtp_17},
1639 {GTP_EXT_18, decode_gtp_18},
1640 {GTP_EXT_19, decode_gtp_19},
1641 {GTP_EXT_NSAPI, decode_gtp_nsapi},
1642 {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
1643 {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
1644 {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
1645 {GTP_EXT_RP, decode_gtp_rp},
1646 {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
1647 {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
1648 {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
1649 {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
1650 {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
1651 {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
1652 {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
1653 {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
1654 {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
1655 {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
1656 {GTP_EXT_APN, decode_gtp_apn},
1657 {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
1658 {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
1659 {GTP_EXT_MSISDN, decode_gtp_msisdn},
1660 {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts}, /* 3G */
1661 {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui}, /* 3G */
1662 {GTP_EXT_TFT, decode_gtp_tft}, /* 3G */
1663 {GTP_EXT_TARGET_ID, decode_gtp_target_id}, /* 3G */
1664 {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont}, /* 3G */
1665 {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup}, /* 3G */
1666 {GTP_EXT_HDR_LIST, decode_gtp_hdr_list}, /* 3G */
1667 {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id}, /* 3G */
1668 {GTP_EXT_OMC_ID, decode_gtp_omc_id}, /* 3G */
1669 /* TS 29 060 V6.11.0 */
1670 {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont}, /* 7.7.43 */
1671 {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio}, /* 7.7.45 */
1672 {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf}, /* 7.7.45A */
1673 {GTP_EXT_SSGN_NO, decode_gtp_ssgn_no}, /* 7.7.47 */
1674 {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs}, /* 7.7.48 */
1675 {GTP_EXT_APN_RES, decode_gtp_apn_res}, /* 3G */
1676 {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs}, /* 7.7.25B */
1677 {GTP_EXT_RAT_TYPE, decode_gtp_rat_type}, /* 3G */
1678 {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf}, /* 7.7.51 */
1679 {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone}, /* 7.7.52 */
1680 {GTP_EXT_IMEISV, decode_gtp_imeisv}, /* 3G 7.7.53 */
1681 {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con}, /* 7.7.54 */
1682 {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx}, /* 7.7.55 */
1683 {GTP_EXT_TMGI, decode_gtp_tmgi}, /* 7.7.56 */
1684 {GTP_EXT_RIM_RA, decode_gtp_rim_ra}, /* 7.7.57 */
1685 {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt}, /* 7.7.58 */
1686 {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa}, /* 7.7.60 */
1687 {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf}, /* 7.7.61 */
1688 {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf}, /* 7.7.62 */
1689 {GTP_EXT_HOP_COUNT, decode_gtp_hop_count}, /* 7.7.63 */
1690 {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id}, /* 7.7.64 */
1691 {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id}, /* 7.7.65 */
1692 {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind}, /* 7.7.66 */
1693 {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi}, /* 7.7.67 */
1694 {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur}, /* 7.7.59 */
1695 {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf}, /* 7.7.68 */
1696 {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no}, /* 7.7.69 */
1697 {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr}, /* 7.7.70 */
1698 {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx}, /* 7.7.71 */
1699 {GTP_EXT_BSS_CONT, decode_gtp_bss_cont}, /* 7.7.72 */
1700 {GTP_EXT_CELL_ID, decode_gtp_cell_id}, /* 7.7.73 */
1701 {GTP_EXT_PDU_NO, decode_gtp_pdu_no}, /* 7.7.74 */
1702 {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause}, /* 7.7.75 */
1703 {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap}, /* 7.7.76 */
1704 {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc}, /* 7.7.77 */
1705 {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc}, /* 7.7.78 */
1706 {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid}, /* 7.7.79 */
1707 {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act}, /* 7.7.80 */
1708 {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg}, /* 7.7.81 */
1709 {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id}, /* 7.7.82 */
1710 {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod}, /* 7.7.83 */
1711 {GTP_EXT_EVO_ALLO_RETE_P1, decode_gtp_evolved_allc_rtn_p1}, /* 7.7.91 */
1712 {GTP_EXT_REL_PACK, decode_gtp_rel_pack}, /* charging */
1713 {GTP_EXT_CAN_PACK, decode_gtp_can_pack}, /* charging */
1714 {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
1715 {GTP_EXT_DATA_REQ, decode_gtp_data_req}, /* charging */
1716 {GTP_EXT_DATA_RESP, decode_gtp_data_resp}, /* charging */
1717 {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
1718 {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
1719 {0, decode_gtp_unknown}
1728 static guint8 gtp_version = 0;
1729 static const char *yesno[] = { "no", "yes" };
1731 static const gchar hex_digits[10] = {'0','1','2','3','4','5','6','7','8','9'};
1733 static gchar *id_to_str(const guint8 * ad)
1736 static gchar str[17] = " ";
1737 guint8 bits8to5, bits4to1;
1740 for (i = 0; i < 8; i++) {
1741 bits8to5 = (ad[i] >> 4) & 0x0F;
1742 bits4to1 = ad[i] & 0x0F;
1744 str[j++] = hex_digits[bits4to1];
1746 str[j++] = hex_digits[bits8to5];
1752 static gchar *imsi_to_str(const guint8 * ad)
1755 static gchar str[17] = " ";
1758 for (i = 0; i < 8; i++) {
1759 if ((ad[i] & 0x0F) <= 9)
1760 str[j++] = (ad[i] & 0x0F) + 0x30;
1761 if (((ad[i] >> 4) & 0x0F) <= 9)
1762 str[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
1769 static gchar *msisdn_to_str(const guint8 * ad, int len)
1772 static gchar str[18] = "+ ";
1773 guint8 bits8to5, bits4to1;
1776 for (i = 1; i < len && i < 9; i++) {
1777 bits8to5 = (ad[i] >> 4) & 0x0F;
1778 bits4to1 = ad[i] & 0x0F;
1780 str[j++] = hex_digits[bits4to1];
1782 str[j++] = hex_digits[bits8to5];
1789 /* Next definitions and function check_field_presence checks if given field
1790 * in GTP packet is compliant with ETSI
1792 typedef struct _header {
1797 typedef struct _message {
1799 ext_header fields[32];
1802 /* ---------------------
1804 * ---------------------*/
1805 static _gtp_mess_items gprs_mess_items[] = {
1809 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1814 GTP_MSG_ECHO_RESP, {
1815 {GTP_EXT_RECOVER, GTP_MANDATORY},
1816 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1821 GTP_MSG_VER_NOT_SUPP, {
1826 GTP_MSG_NODE_ALIVE_REQ, {
1827 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
1828 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1833 GTP_MSG_NODE_ALIVE_RESP, {
1834 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1839 GTP_MSG_REDIR_REQ, {
1840 {GTP_EXT_CAUSE, GTP_MANDATORY},
1841 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
1842 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1847 GTP_MSG_REDIR_RESP, {
1848 {GTP_EXT_CAUSE, GTP_MANDATORY},
1849 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1854 GTP_MSG_CREATE_PDP_REQ, {
1855 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1856 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1857 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1858 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1859 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1860 {GTP_EXT_MSISDN, GTP_MANDATORY},
1861 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1862 {GTP_EXT_APN, GTP_MANDATORY},
1863 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1864 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1865 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1866 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1871 GTP_MSG_CREATE_PDP_RESP, {
1872 {GTP_EXT_CAUSE, GTP_MANDATORY},
1873 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1874 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1875 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1876 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1877 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1878 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1879 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1880 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1881 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1882 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1883 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1884 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1889 GTP_MSG_UPDATE_PDP_REQ, {
1890 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1891 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1892 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1893 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1894 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1895 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1896 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1901 GTP_MSG_UPDATE_PDP_RESP, {
1902 {GTP_EXT_CAUSE, GTP_MANDATORY},
1903 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1904 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1905 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1906 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1907 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1908 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1909 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1910 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1911 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1916 GTP_MSG_DELETE_PDP_REQ, {
1917 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1922 GTP_MSG_DELETE_PDP_RESP, {
1923 {GTP_EXT_CAUSE, GTP_MANDATORY},
1924 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1929 GTP_MSG_CREATE_AA_PDP_REQ, {
1930 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1931 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1932 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1933 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1934 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1935 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1936 {GTP_EXT_APN, GTP_MANDATORY},
1937 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1938 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1939 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1940 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1945 GTP_MSG_CREATE_AA_PDP_RESP, {
1946 {GTP_EXT_CAUSE, GTP_MANDATORY},
1947 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1948 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1949 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1950 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1951 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1952 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1953 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1954 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1955 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1956 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1957 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1958 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1963 GTP_MSG_DELETE_AA_PDP_REQ, {
1964 {GTP_EXT_CAUSE, GTP_MANDATORY},
1965 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1970 GTP_MSG_DELETE_AA_PDP_RESP, {
1971 {GTP_EXT_CAUSE, GTP_MANDATORY},
1972 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1978 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1983 GTP_MSG_PDU_NOTIFY_REQ, {
1984 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1985 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1990 GTP_MSG_PDU_NOTIFY_RESP, {
1991 {GTP_EXT_CAUSE, GTP_MANDATORY},
1992 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1997 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1998 {GTP_EXT_CAUSE, GTP_MANDATORY},
1999 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2000 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2005 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2006 {GTP_EXT_CAUSE, GTP_MANDATORY},
2007 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2012 GTP_MSG_SEND_ROUT_INFO_REQ, {
2013 {GTP_EXT_IMSI, GTP_MANDATORY},
2014 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2019 GTP_MSG_SEND_ROUT_INFO_RESP, {
2020 {GTP_EXT_CAUSE, GTP_MANDATORY},
2021 {GTP_EXT_IMSI, GTP_MANDATORY},
2022 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2023 {GTP_EXT_MS_REASON, GTP_OPTIONAL},
2024 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
2025 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2030 GTP_MSG_FAIL_REP_REQ, {
2031 {GTP_EXT_IMSI, GTP_MANDATORY},
2032 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2037 GTP_MSG_FAIL_REP_RESP, {
2038 {GTP_EXT_CAUSE, GTP_MANDATORY},
2039 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2040 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2045 GTP_MSG_MS_PRESENT_REQ, {
2046 {GTP_EXT_IMSI, GTP_MANDATORY},
2047 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2048 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2053 GTP_MSG_MS_PRESENT_RESP, {
2054 {GTP_EXT_CAUSE, GTP_MANDATORY},
2055 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2060 GTP_MSG_IDENT_REQ, {
2061 {GTP_EXT_RAI, GTP_MANDATORY},
2062 {GTP_EXT_PTMSI, GTP_MANDATORY},
2063 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2064 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2069 GTP_MSG_IDENT_RESP, {
2070 {GTP_EXT_CAUSE, GTP_MANDATORY},
2071 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2072 {GTP_EXT_AUTH_TRI, GTP_OPTIONAL},
2073 {GTP_EXT_AUTH_QUI, GTP_OPTIONAL},
2074 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2079 GTP_MSG_SGSN_CNTXT_REQ, {
2080 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2081 {GTP_EXT_RAI, GTP_MANDATORY},
2082 {GTP_EXT_TLLI, GTP_MANDATORY},
2083 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2084 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2085 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
2090 GTP_MSG_SGSN_CNTXT_RESP, {
2091 {GTP_EXT_CAUSE, GTP_MANDATORY},
2092 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2093 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
2094 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2095 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2096 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2101 GTP_MSG_SGSN_CNTXT_ACK, {
2102 {GTP_EXT_CAUSE, GTP_MANDATORY},
2103 {GTP_EXT_FLOW_II, GTP_CONDITIONAL},
2104 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2105 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2110 GTP_MSG_DATA_TRANSF_REQ, {
2111 {GTP_EXT_TR_COMM, GTP_MANDATORY},
2112 {GTP_EXT_DATA_REQ, GTP_CONDITIONAL},
2113 {GTP_EXT_REL_PACK, GTP_CONDITIONAL},
2114 {GTP_EXT_CAN_PACK, GTP_CONDITIONAL},
2115 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2120 GTP_MSG_DATA_TRANSF_RESP, {
2121 {GTP_EXT_CAUSE, GTP_MANDATORY},
2122 {GTP_EXT_DATA_RESP, GTP_MANDATORY},
2123 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2134 /* -----------------------------
2136 * -----------------------------*/
2137 static _gtp_mess_items umts_mess_items[] = {
2138 /* 7.2 Path Management Messages */
2141 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2146 GTP_MSG_ECHO_RESP, {
2147 {GTP_EXT_RECOVER, GTP_MANDATORY},
2148 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2153 GTP_MSG_VER_NOT_SUPP, {
2158 GTP_MSG_SUPP_EXT_HDR, {
2159 {GTP_EXT_HDR_LIST, GTP_MANDATORY},
2165 GTP_MSG_NODE_ALIVE_REQ, {
2166 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
2167 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2172 GTP_MSG_NODE_ALIVE_RESP, {
2173 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2178 GTP_MSG_REDIR_REQ, {
2179 {GTP_EXT_CAUSE, GTP_MANDATORY},
2180 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
2181 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2186 GTP_MSG_REDIR_REQ, {
2190 /* 7.3 Tunnel Management Messages */
2192 GTP_MSG_CREATE_PDP_REQ, {
2193 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2194 /* RAI is in TS 29.060 V6.11.0 */
2195 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2196 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2197 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL},
2198 {GTP_EXT_TEID, GTP_MANDATORY},
2199 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2200 {GTP_EXT_NSAPI, GTP_MANDATORY},
2201 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2202 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},
2203 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2204 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2205 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2206 {GTP_EXT_APN, GTP_CONDITIONAL},
2207 {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL},
2208 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2209 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2210 {GTP_EXT_MSISDN, GTP_CONDITIONAL},
2211 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2212 {GTP_EXT_TFT, GTP_CONDITIONAL},
2213 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2214 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2215 /* TS 29.060 V6.11.0 */
2216 {GTP_EXT_APN_RES, GTP_OPTIONAL},
2217 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},
2218 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},
2219 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},
2220 {GTP_EXT_IMEISV, GTP_OPTIONAL},
2221 {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL},
2222 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},
2223 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2228 GTP_MSG_CREATE_PDP_RESP, {
2229 {GTP_EXT_CAUSE, GTP_MANDATORY},
2230 {GTP_EXT_REORDER, GTP_CONDITIONAL},
2231 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2232 {GTP_EXT_TEID, GTP_CONDITIONAL},
2233 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2234 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2235 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2236 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2237 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2238 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2239 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2240 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2241 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2242 /* TS 29.060 V6.11.0 */
2243 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2244 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2245 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2246 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2250 { /* checked, SGSN -> GGSN */
2251 GTP_MSG_UPDATE_PDP_REQ, {
2252 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2253 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2254 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2255 {GTP_EXT_TEID, GTP_MANDATORY},
2256 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2257 {GTP_EXT_NSAPI, GTP_MANDATORY},
2258 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2259 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2260 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2261 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2262 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
2263 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2264 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2265 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2266 {GTP_EXT_TFT, GTP_OPTIONAL},
2267 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2268 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2269 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2270 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2271 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2272 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2273 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2274 {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL}, /* Direct Tunnel Flags 7.7.81 */
2275 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2279 { /* checked, GGSN -> SGSN */
2280 GTP_MSG_UPDATE_PDP_RESP, {
2281 {GTP_EXT_CAUSE, GTP_MANDATORY},
2282 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2283 {GTP_EXT_TEID, GTP_CONDITIONAL},
2284 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2285 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2286 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2287 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2288 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2289 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2290 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2291 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2292 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2293 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2294 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2295 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2296 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2301 GTP_MSG_DELETE_PDP_REQ, {
2302 {GTP_EXT_TEAR_IND, GTP_CONDITIONAL},
2303 {GTP_EXT_NSAPI, GTP_MANDATORY},
2304 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2305 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2310 GTP_MSG_DELETE_PDP_RESP, {
2311 {GTP_EXT_CAUSE, GTP_MANDATORY},
2312 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2313 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2319 {GTP_EXT_TEID, GTP_MANDATORY},
2320 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GSN Address Mandatory 7.7.32 */
2321 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2326 GTP_MSG_PDU_NOTIFY_REQ, {
2327 {GTP_EXT_IMSI, GTP_MANDATORY},
2328 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2329 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2330 {GTP_EXT_APN, GTP_MANDATORY},
2331 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2332 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2333 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2338 GTP_MSG_PDU_NOTIFY_RESP, {
2339 {GTP_EXT_CAUSE, GTP_MANDATORY},
2340 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2345 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2346 {GTP_EXT_CAUSE, GTP_MANDATORY},
2347 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2348 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2349 {GTP_EXT_APN, GTP_MANDATORY},
2350 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2351 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2356 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2357 {GTP_EXT_CAUSE, GTP_MANDATORY},
2358 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2362 /* 7.4 Location Management Messages */
2364 GTP_MSG_SEND_ROUT_INFO_REQ, {
2365 {GTP_EXT_IMSI, GTP_MANDATORY},
2366 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2371 GTP_MSG_SEND_ROUT_INFO_RESP, {
2372 {GTP_EXT_CAUSE, GTP_MANDATORY},
2373 {GTP_EXT_IMSI, GTP_MANDATORY},
2374 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2375 {GTPv1_EXT_MS_REASON, GTP_OPTIONAL},
2376 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
2377 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2382 GTP_MSG_FAIL_REP_REQ, {
2383 {GTP_EXT_IMSI, GTP_MANDATORY},
2384 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2389 GTP_MSG_FAIL_REP_RESP, {
2390 {GTP_EXT_CAUSE, GTP_MANDATORY},
2391 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2392 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2397 GTP_MSG_MS_PRESENT_REQ, {
2398 {GTP_EXT_IMSI, GTP_MANDATORY},
2399 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2400 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2405 GTP_MSG_MS_PRESENT_RESP, {
2406 {GTP_EXT_CAUSE, GTP_MANDATORY},
2407 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2411 /* 7.5 Mobility Management Messages */
2413 GTP_MSG_IDENT_REQ, {
2414 {GTP_EXT_RAI, GTP_MANDATORY},
2415 {GTP_EXT_PTMSI, GTP_MANDATORY},
2416 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2417 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* SGSN Address for Control Plane Optional 7.7.32 */
2418 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2419 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2424 GTP_MSG_IDENT_RESP, {
2425 {GTP_EXT_CAUSE, GTP_MANDATORY},
2426 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2427 {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL},
2428 {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL},
2429 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2434 GTP_MSG_SGSN_CNTXT_REQ, {
2435 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2436 {GTP_EXT_RAI, GTP_MANDATORY},
2437 {GTP_EXT_TLLI, GTP_CONDITIONAL},
2438 {GTP_EXT_PTMSI, GTP_CONDITIONAL},
2439 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2440 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2441 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2442 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2443 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
2444 {GTP_EXT_SSGN_NO, GTP_OPTIONAL}, /* SGSN Number Optional 7.7.47 */
2445 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2446 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2451 GTP_MSG_SGSN_CNTXT_RESP, {
2452 {GTP_EXT_CAUSE, GTP_MANDATORY},
2453 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2454 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2455 {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL}, /* RAB Context Conditional 7.7.19 */
2456 {GTP_EXT_RP_SMS, GTP_OPTIONAL},
2457 {GTP_EXT_RP, GTP_OPTIONAL},
2458 {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL},
2459 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2460 {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL}, /* Radio Priority LCS Optional 7.7.25B */
2461 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2462 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2463 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2464 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2465 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2466 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2471 GTP_MSG_SGSN_CNTXT_ACK, {
2472 {GTP_EXT_CAUSE, GTP_MANDATORY},
2473 {GTP_EXT_TEID_II, GTP_CONDITIONAL},
2474 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2475 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2480 GTP_MSG_FORW_RELOC_REQ, {
2481 {GTP_EXT_IMSI, GTP_MANDATORY},
2482 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2483 {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY},
2484 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2485 {GTP_EXT_MM_CNTXT, GTP_MANDATORY},
2486 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2487 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2488 {GTP_EXT_TARGET_ID, GTP_MANDATORY},
2489 {GTP_EXT_UTRAN_CONT, GTP_MANDATORY},
2490 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2491 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2492 {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL}, /* Selected PLMN ID Optional 7.7.64 */
2493 {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL}, /* PS Handover Request Context Optional 7.7.71 */
2494 {GTP_EXT_BSS_CONT, GTP_OPTIONAL}, /* BSS Container Optional 7.7.72 */
2495 {GTP_EXT_CELL_ID, GTP_OPTIONAL}, /* Cell Identification Optional 7.7.73 */
2496 {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL}, /* BSSGP Cause Optional 7.7.75 */
2497 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2498 {GTP_EXT_SSGN_NO, GTP_OPTIONAL},
2503 GTP_MSG_FORW_RELOC_RESP, {
2504 {GTP_EXT_CAUSE, GTP_MANDATORY},
2505 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2506 {GTP_EXT_TEID_II, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
2507 {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL},
2508 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2509 {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL},
2510 {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL},
2511 {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL}, /* Additional RAB Setup Information Conditional 7.7.45A */
2512 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2517 GTP_MSG_FORW_RELOC_COMP, {
2518 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2523 GTP_MSG_RELOC_CANCEL_REQ, {
2524 {GTP_EXT_IMSI, GTP_MANDATORY},
2525 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2530 GTP_MSG_RELOC_CANCEL_RESP, {
2531 {GTP_EXT_CAUSE, GTP_MANDATORY},
2532 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2537 GTP_MSG_FORW_RELOC_ACK, {
2538 {GTP_EXT_CAUSE, GTP_MANDATORY},
2539 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2544 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2545 {GTP_EXT_CAUSE, GTP_MANDATORY},
2546 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2551 GTP_MSG_FORW_SRNS_CNTXT, {
2552 {GTP_EXT_RAB_CNTXT, GTP_MANDATORY},
2553 {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL}, /* Source RNC PDCP context info Optional 7.7.61 */
2554 {GTP_EXT_PDU_NO, GTP_OPTIONAL}, /* PDU Numbers Optional 7.7.74 */
2555 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2560 /* 7.5.14 RAN Information Management Messages */
2562 GTP_MSG_RAN_INFO_RELAY, {
2563 {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY}, /* RAN Transparent Container Mandatory 7.7.43 */
2564 {GTP_EXT_RIM_RA, GTP_OPTIONAL}, /* RIM Routing Address Optional 7.7.57 */
2565 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2569 /* 7.5A MBMS Messages
2570 * 7.5A.1 UE Specific MBMS Messages
2573 GTP_MBMS_NOTIFY_REQ, {
2574 {GTP_EXT_IMSI, GTP_MANDATORY}, /* IMSI Mandatory 7.7.2 */
2575 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2576 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2577 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2578 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2579 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GGSN Address for Control Plane Mandatory 7.7.32 */
2580 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2581 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2586 GTP_MBMS_NOTIFY_RES, {
2587 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2588 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2593 GTP_MBMS_NOTIFY_REJ_REQ, {
2594 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2595 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2596 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2597 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2598 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2599 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2604 GTP_MBMS_NOTIFY_REJ_RES, {
2605 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2606 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2611 GTP_CREATE_MBMS_CNTXT_REQ, {
2612 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2613 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2614 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2615 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL}, /* Selection mode Conditional 7.7.12 */
2616 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2617 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2618 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2619 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2620 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2621 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
2622 {GTP_EXT_MSISDN, GTP_CONDITIONAL}, /* MSISDN Conditional 7.7.33 */
2623 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2624 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2625 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2626 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2627 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2628 {GTP_EXT_IMEISV, GTP_OPTIONAL}, /* IMEI(SV) Optional 7.7.53 */
2629 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2630 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2631 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2632 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2633 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2638 GTP_CREATE_MBMS_CNTXT_RES, {
2639 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2640 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2641 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2642 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2643 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2644 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2645 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2646 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2647 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2648 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2653 GTP_UPD_MBMS_CNTXT_REQ, {
2654 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2655 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2656 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2657 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2658 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2659 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2660 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2661 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2662 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2663 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2664 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2665 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2666 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2667 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additional Trace Info Optional 7.7.62 */
2668 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2669 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2670 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2675 GTP_UPD_MBMS_CNTXT_RES, {
2676 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2677 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2678 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2679 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2680 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2681 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2682 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2683 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2684 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2689 GTP_DEL_MBMS_CNTXT_REQ, {
2690 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2691 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2692 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL}, /* End User Address Conditional 7.7.27 */
2693 {GTP_EXT_APN, GTP_CONDITIONAL}, /* Access Point Name Conditional 7.7.30 */
2694 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2695 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Conditional 7.7.67 */
2696 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2701 GTP_DEL_MBMS_CNTXT_RES, {
2702 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2703 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2704 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2710 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2711 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2712 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2718 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2719 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
2720 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2725 GTP_MBMS_DE_REG_REQ, {
2726 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2727 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2728 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2733 GTP_MBMS_DE_REG_RES, {
2734 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2735 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2740 GTP_MBMS_SES_START_REQ, {
2741 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2742 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2743 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2744 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2745 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2746 {GTP_EXT_QOS_UMTS, GTP_MANDATORY}, /* Quality of Service Profile Mandatory 7.7.34 */
2747 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Mandatory 7.7.48 */
2748 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
2749 {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY}, /* MBMS Session Duration Mandatory 7.7.59 */
2750 {GTP_EXT_MBMS_SA, GTP_MANDATORY}, /* MBMS Service Area Mandatory 7.7.60 */
2751 {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL}, /* MBMS Session Identifier Optional 7.7.65 */
2752 {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY}, /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
2753 {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
2754 {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY}, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
2755 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2760 GTP_MBMS_SES_START_RES, {
2761 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2762 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2763 {GTP_EXT_TEID, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
2764 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2765 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2766 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
2767 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2772 GTP_MBMS_SES_STOP_REQ, {
2773 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2774 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2775 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2780 GTP_MBMS_SES_STOP_RES, {
2781 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2782 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2793 /* Data structure attached to a conversation,
2794 to keep track of request/response-pairs
2796 typedef struct gtp_conv_info_t {
2797 struct gtp_conv_info_t *next;
2798 GHashTable *unmatched;
2799 GHashTable *matched;
2802 static gtp_conv_info_t *gtp_info_items = NULL;
2804 static guint gtp_sn_hash(gconstpointer k)
2806 const gtp_msg_hash_t *key = k;
2811 static gint gtp_sn_equal_matched(gconstpointer k1, gconstpointer k2)
2813 const gtp_msg_hash_t *key1 = k1;
2814 const gtp_msg_hash_t *key2 = k2;
2816 if ( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ) {
2820 if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ) {
2824 return key1->seq_nr == key2->seq_nr;
2827 static gint gtp_sn_equal_unmatched(gconstpointer k1, gconstpointer k2)
2829 const gtp_msg_hash_t *key1 = k1;
2830 const gtp_msg_hash_t *key2 = k2;
2832 return key1->seq_nr == key2->seq_nr;
2835 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype)
2837 gtp_msg_hash_t gcr, *gcrp = NULL;
2838 gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data;
2843 case GTP_MSG_ECHO_REQ:
2844 case GTP_MSG_CREATE_PDP_REQ:
2845 case GTP_MSG_UPDATE_PDP_REQ:
2846 case GTP_MSG_DELETE_PDP_REQ:
2847 gcr.is_request=TRUE;
2848 gcr.req_frame=pinfo->fd->num;
2851 case GTP_MSG_ECHO_RESP:
2852 case GTP_MSG_CREATE_PDP_RESP:
2853 case GTP_MSG_UPDATE_PDP_RESP:
2854 case GTP_MSG_DELETE_PDP_RESP:
2855 gcr.is_request=FALSE;
2857 gcr.rep_frame=pinfo->fd->num;
2863 gcrp = g_hash_table_lookup(gtp_info->matched, &gcr);
2867 gcrp->is_request=gcr.is_request;
2871 /*no match, let's try to make one*/
2873 case GTP_MSG_ECHO_REQ:
2874 case GTP_MSG_CREATE_PDP_REQ:
2875 case GTP_MSG_UPDATE_PDP_REQ:
2876 case GTP_MSG_DELETE_PDP_REQ:
2879 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2881 g_hash_table_remove(gtp_info->unmatched, gcrp);
2883 /* if we cant reuse the old one, grab a new chunk */
2885 gcrp = se_alloc(sizeof(gtp_msg_hash_t));
2887 gcrp->seq_nr=seq_nr;
2888 gcrp->req_frame = pinfo->fd->num;
2889 gcrp->req_time = pinfo->fd->abs_ts;
2890 gcrp->rep_frame = 0;
2891 gcrp->msgtype = msgtype;
2892 gcrp->is_request = TRUE;
2893 g_hash_table_insert(gtp_info->unmatched, gcrp, gcrp);
2896 case GTP_MSG_ECHO_RESP:
2897 case GTP_MSG_CREATE_PDP_RESP:
2898 case GTP_MSG_UPDATE_PDP_RESP:
2899 case GTP_MSG_DELETE_PDP_RESP:
2901 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2904 if (!gcrp->rep_frame) {
2905 g_hash_table_remove(gtp_info->unmatched, gcrp);
2906 gcrp->rep_frame=pinfo->fd->num;
2907 gcrp->is_request=FALSE;
2908 g_hash_table_insert(gtp_info->matched, gcrp, gcrp);
2917 /* we have found a match */
2922 if (gcrp->is_request) {
2923 it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
2924 PROTO_ITEM_SET_GENERATED(it);
2928 it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
2929 PROTO_ITEM_SET_GENERATED(it);
2930 nstime_delta(&ns, &pinfo->fd->abs_ts, &gcrp->req_time);
2931 it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
2932 PROTO_ITEM_SET_GENERATED(it);
2939 static int check_field_presence(guint8 message, guint8 field, int *position)
2943 _gtp_mess_items *mess_items;
2945 switch (gtp_version) {
2947 mess_items = gprs_mess_items;
2950 mess_items = umts_mess_items;
2956 while (mess_items[i].code) {
2957 if (mess_items[i].code == message) {
2959 while (mess_items[i].fields[*position].code) {
2960 if (mess_items[i].fields[*position].code == field) {
2964 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
2965 return mess_items[i].fields[(*position)++].code;
2979 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2981 /* GPRS: 9.60 v7.6.0, chapter
2982 * UMTS: 29.060 v4.0, chapter
2985 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2990 cause = tvb_get_guint8(tvb, offset + 1);
2992 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
2997 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2998 * UMTS: 29.060 v4.0, chapter 7.7.2
3000 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3006 tvb_memcpy(tvb, imsi_val, offset + 1, 8);
3007 imsi_str = imsi_to_str(imsi_val);
3009 proto_tree_add_string(tree, hf_gtp_imsi, tvb, offset, 9, imsi_str);
3014 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
3015 * UMTS: 29.060 v4.0, chapter 7.7.3
3017 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3020 proto_tree *ext_tree_rai;
3025 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_RAI, >p_val_ext, "Unknown message"));
3026 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
3028 byte[0] = tvb_get_guint8(tvb, offset + 1);
3029 byte[1] = tvb_get_guint8(tvb, offset + 2);
3030 byte[2] = tvb_get_guint8(tvb, offset + 3);
3031 mcc = (byte[0] & 0x0F) * 100 + ((byte[0] & 0xF0) >> 4) * 10 + (byte[1] & 0x0F);
3032 if ((byte[1] & 0xF0) == 0xF0)
3033 mnc = (byte[2] & 0x0F) * 10 + ((byte[2] & 0xF0) >> 4);
3035 mnc = (byte[2] & 0x0F) * 100 + ((byte[2] & 0xF0) >> 4) * 10 + ((byte[1] & 0xF0) >> 4);
3037 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mcc, tvb, offset + 1, 2, mcc);
3038 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mnc, tvb, offset + 2, 2, mnc);
3039 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_lac, tvb, offset + 4, 2, tvb_get_ntohs(tvb, offset + 4));
3040 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, tvb_get_guint8(tvb, offset + 6));
3045 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
3046 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
3048 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3053 tlli = tvb_get_ntohl(tvb, offset + 1);
3054 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
3059 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
3060 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
3062 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3067 ptmsi = tvb_get_ntohl(tvb, offset + 1);
3068 proto_tree_add_uint(tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
3073 /* adjust - how many bytes before offset should be highlighted
3075 static int decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 adjust)
3078 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
3079 proto_tree *ext_tree_qos;
3082 spare1 = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_SPARE1_MASK;
3083 delay = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_DELAY_MASK;
3084 reliability = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_RELIABILITY_MASK;
3085 peak = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
3086 spare2 = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
3087 precedence = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
3088 spare3 = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
3089 mean = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
3091 te = proto_tree_add_text(tree, tvb, offset - adjust, 3 + adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
3092 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
3093 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3096 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
3097 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
3098 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
3099 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
3100 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
3101 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
3102 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
3103 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
3109 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
3113 * TODO: check if length is included: ETSI 4.08 vs 9.60
3115 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3118 return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
3122 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
3123 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
3125 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3130 reorder = tvb_get_guint8(tvb, offset + 1) & 0x01;
3131 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
3136 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
3137 * 4.08 v7.1.2, chapter 10.5.3.1+
3138 * UMTS: 29.060 v4.0, chapter 7.7.7
3139 * TODO: Add blurb support by registering items in the protocol registration
3141 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3144 proto_tree *ext_tree_auth_tri;
3147 te = proto_tree_add_text(tree, tvb, offset, 29, "%s", val_to_str_ext_const(GTP_EXT_AUTH_TRI, >p_val_ext, "Unknown message"));
3148 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
3150 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + 1, 16));
3151 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + 17, 4));
3152 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + 21, 8));
3154 return 1 + 16 + 4 + 8;
3157 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
3158 * 9.02 v7.7.0, page 1090
3159 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
3160 * 29.002 v4.2.1, chapter 17.5, page 268
3162 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3167 map_cause = tvb_get_guint8(tvb, offset + 1);
3168 proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
3173 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
3174 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
3176 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3181 ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
3182 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
3187 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
3188 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
3190 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3195 ms_valid = tvb_get_guint8(tvb, offset + 1) & 0x01;
3196 proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
3201 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
3202 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
3204 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3209 recovery = tvb_get_guint8(tvb, offset + 1);
3210 proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
3215 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
3216 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
3220 static const gchar *dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb)
3224 /* Value in ASCII(UTF-8) */
3225 sel_mode = tvb_get_guint8(tvb, 0) - 0x30;
3226 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
3228 return val_to_str_const(sel_mode, sel_mode_type, "Unknown");
3231 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3234 proto_tree_add_item(tree, hf_gtp_sel_mode, tvb, offset, 2, FALSE);
3238 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
3239 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
3241 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3244 guint16 ext_flow_label;
3247 switch (gtp_version) {
3249 ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
3250 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
3254 teid_data = tvb_get_ntohl(tvb, offset + 1);
3255 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
3259 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
3265 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
3266 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
3268 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3274 switch (gtp_version) {
3276 flow_sig = tvb_get_ntohs(tvb, offset + 1);
3277 proto_tree_add_uint(tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
3280 teid_cp = tvb_get_ntohl(tvb, offset + 1);
3281 proto_tree_add_uint(tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
3284 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
3289 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
3290 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
3292 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3297 proto_tree *ext_tree_flow_ii;
3300 switch (gtp_version) {
3302 te = proto_tree_add_text(tree, tvb, offset, 4, "%s", val_to_str_ext_const(GTP_EXT_FLOW_II, >p_val_ext, "Unknown message"));
3303 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3305 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3307 flow_ii = tvb_get_ntohs(tvb, offset + 2);
3308 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
3312 te = proto_tree_add_text(tree, tvb, offset, 6, "%s", val_to_str_ext_const(GTP_EXT_TEID_II, >pv1_val_ext, "Unknown message"));
3313 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3315 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3318 teid_ii = tvb_get_ntohl(tvb, offset + 2);
3319 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
3323 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
3329 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
3330 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
3331 * Check if all ms_reason types are included
3333 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3338 field19 = tvb_get_guint8(tvb, offset + 1);
3340 switch (gtp_version) {
3342 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
3345 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
3348 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
3355 /* GPRS: not present
3356 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
3358 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3363 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3364 proto_tree_add_uint(tree, hf_gtp_nsapi, tvb, offset, 2, nsapi);
3369 /* GPRS: not present
3370 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
3372 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3377 ranap = tvb_get_guint8(tvb, offset + 1);
3379 if (ranap > 0 && ranap <= 64)
3380 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3381 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
3382 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3383 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3385 if (ranap > 64 && ranap <= 80)
3386 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3387 ranap, "%s (Transport Layer Cause) : %s (%u)",
3388 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3389 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3391 if (ranap > 80 && ranap <= 96)
3392 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3393 ranap, "%s (NAS Cause) : %s (%u)",
3394 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3395 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3397 if (ranap > 96 && ranap <= 112)
3398 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3399 "%s (Protocol Cause) : %s (%u)",
3400 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3401 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3403 if (ranap > 112 && ranap <= 128)
3404 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3405 "%s (Miscellaneous Cause) : %s (%u)",
3406 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3407 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3409 if (ranap > 128 /* && ranap <=255 */ )
3410 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3411 "%s (Non-standard Cause) : %s (%u)",
3412 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, >p_val_ext, "Unknown"),
3413 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3418 /* GPRS: not present
3419 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
3421 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3425 proto_tree *ext_tree_rab_cntxt;
3428 te = proto_tree_add_text(tree, tvb, offset, 10, "%s", val_to_str_ext_const(GTP_EXT_RAB_CNTXT, >p_val_ext, "Unknown message"));
3429 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
3431 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3433 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3434 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, FALSE);
3435 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, FALSE);
3436 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, FALSE);
3437 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, FALSE);
3443 /* GPRS: not present
3444 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
3446 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3451 rp_sms = tvb_get_guint8(tvb, offset + 1) & 0x07;
3452 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
3457 /* GPRS: not present
3458 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
3460 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3463 proto_tree *ext_tree_rp;
3465 guint8 nsapi, rp, spare;
3467 nsapi = tvb_get_guint8(tvb, offset + 1) & 0xF0;
3468 spare = tvb_get_guint8(tvb, offset + 1) & 0x08;
3469 rp = tvb_get_guint8(tvb, offset + 1) & 0x07;
3471 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
3472 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
3474 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, nsapi);
3475 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, spare);
3476 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, rp);
3481 /* GPRS: not present
3482 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
3484 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3487 proto_tree *ext_tree_pkt_flow_id;
3489 guint8 nsapi, pkt_flow_id;
3491 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3492 pkt_flow_id = tvb_get_guint8(tvb, offset + 2);
3494 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);
3495 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
3497 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3498 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
3499 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);
3504 /* GPRS: not present
3505 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
3506 * TODO: Differenciate these uints?
3508 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3513 proto_tree *ext_tree_chrg_char;
3515 chrg_char = tvb_get_ntohs(tvb, offset + 1);
3517 te = proto_tree_add_uint(tree, hf_gtp_chrg_char, tvb, offset, 3, chrg_char);
3518 /*"%s: %x", val_to_str_ext_const (GTP_EXT_CHRG_CHAR, >p_val_ext, "Unknown message"), chrg_char); */
3519 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
3521 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_s, tvb, offset + 1, 2, chrg_char);
3522 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_n, tvb, offset + 1, 2, chrg_char);
3523 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_p, tvb, offset + 1, 2, chrg_char);
3524 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_f, tvb, offset + 1, 2, chrg_char);
3525 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_h, tvb, offset + 1, 2, chrg_char);
3526 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_r, tvb, offset + 1, 2, chrg_char);
3531 /* GPRS: not present
3532 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3534 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3539 trace_ref = tvb_get_ntohs(tvb, offset + 1);
3541 proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
3546 /* GPRS: not present
3547 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3549 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3554 trace_type = tvb_get_ntohs(tvb, offset + 1);
3556 proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
3561 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3562 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3564 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3569 reason = tvb_get_guint8(tvb, offset + 1);
3571 /* Reason for Absence is defined in 3GPP TS 23.040 */
3572 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
3578 * UMTS: 29.060 v6.11.0, chapter 7.7.25B
3579 * Radio Priority LCS
3581 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3585 proto_tree *ext_tree;
3588 length = tvb_get_ntohs(tvb, offset + 1);
3589 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"));
3590 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ra_prio_lcs);
3593 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
3594 offset = offset + 2;
3596 proto_tree_add_item(ext_tree, hf_gtp_ra_prio_lcs, tvb, offset, 1, FALSE);
3602 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
3605 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3610 tr_command = tvb_get_guint8(tvb, offset + 1);
3612 proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
3617 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3618 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3620 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3625 chrg_id = tvb_get_ntohl(tvb, offset + 1);
3626 proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
3631 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3632 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3634 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3638 guint8 pdp_typ, pdp_org;
3640 struct e_in6_addr addr_ipv6;
3641 proto_tree *ext_tree_user;
3645 length = tvb_get_ntohs(tvb, offset + 1);
3646 pdp_org = tvb_get_guint8(tvb, offset + 3) & 0x0F;
3647 pdp_typ = tvb_get_guint8(tvb, offset + 4);
3649 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s (%s/%s)",
3650 val_to_str_ext_const(GTP_EXT_USER_ADDR, >p_val_ext, "Unknown message"),
3651 val_to_str_const(pdp_org, pdp_org_type, "Unknown PDP Organization"),
3652 val_to_str_const(pdp_typ, pdp_type, "Unknown PDP Type"));
3653 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3655 proto_tree_add_text(ext_tree_user, tvb, offset + 1, 2, "Length : %u", length);
3656 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset + 3, 1, pdp_org);
3657 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
3660 if (pdp_org == 0 && pdp_typ == 1)
3661 proto_item_append_text(te, " (Point to Point Protocol)");
3662 else if (pdp_typ == 2)
3663 proto_item_append_text(te, " (Octet Stream Protocol)");
3664 } else if (length > 2) {
3667 addr_ipv4 = tvb_get_ipv4(tvb, offset + 5);
3668 proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, addr_ipv4);
3669 proto_item_append_text(te, " : %s", ip_to_str((guint8 *) & addr_ipv4));
3672 tvb_get_ipv6(tvb, offset + 5, &addr_ipv6);
3673 proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, (guint8 *) & addr_ipv6);
3674 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
3678 proto_item_append_text(te, " : empty PDP Address");
3683 static int decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3686 proto_tree *ext_tree_trip;
3687 proto_item *te_trip;
3690 for (i = 0; i < count; i++) {
3691 te_trip = proto_tree_add_text(tree, tvb, offset + i * 28, 28, "Triplet no%x", i);
3692 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3694 proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + i * 28, 16));
3695 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));
3696 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));
3702 /* adjust - how many bytes before quintuplet should be highlighted
3704 static int decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3707 proto_tree *ext_tree_quint;
3708 proto_item *te_quint;
3709 guint16 q_offset, i;
3710 guint8 xres_len, auth_len;
3714 for (i = 0; i < count; i++) {
3716 te_quint = proto_tree_add_text(tree, tvb, offset, -1, "Quintuplet #%x", i + 1);
3717 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3720 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
3721 q_offset = q_offset + 16;
3722 xres_len = tvb_get_guint8(tvb, offset + q_offset);
3723 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "XRES length: %u", xres_len);
3725 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));
3726 q_offset = q_offset + xres_len;
3727 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));
3728 q_offset = q_offset + 16;
3729 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));
3730 q_offset = q_offset + 16;
3731 auth_len = tvb_get_guint8(tvb, offset + q_offset);
3732 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "Authentication length: %u", auth_len);
3734 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));
3736 q_offset = q_offset + auth_len;
3737 proto_item_set_end(te_quint, tvb, offset + q_offset);
3744 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3745 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3746 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3747 * - finish displaying last 3 parameters
3749 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3752 guint16 length, quint_len, con_len;
3753 guint8 cksn, count, sec_mode, len, iei;
3754 proto_tree *ext_tree_mm;
3756 proto_item *tf = NULL;
3757 proto_tree *tf_tree = NULL;
3759 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_MM_CNTXT, >p_val_ext, "Unknown message"));
3760 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3763 length = tvb_get_ntohs(tvb, offset + 1);
3768 cksn = tvb_get_guint8(tvb, offset + 3) & 0x07;
3770 sec_mode = (tvb_get_guint8(tvb, offset + 4) >> 6) & 0x03;
3771 count = (tvb_get_guint8(tvb, offset + 4) >> 3) & 0x07;
3773 proto_tree_add_text(ext_tree_mm, tvb, offset + 1, 2, "Length: %x", length);
3774 if (gtp_version == 0)
3779 case 0: /* Used cipher value, UMTS keys and Quintuplets */
3780 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset + 3, 1, FALSE);
3781 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3782 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3783 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3784 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3785 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3786 quint_len = tvb_get_ntohs(tvb, offset + 37);
3787 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3789 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3793 case 1: /* GSM key and triplets */
3794 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3795 if (gtp_version != 0)
3796 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3798 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3799 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3800 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3802 offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
3805 case 2: /* UMTS key and quintuplets */
3806 proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, FALSE);
3807 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3808 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3809 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3810 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3811 quint_len = tvb_get_ntohs(tvb, offset + 37);
3812 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3814 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3817 case 3: /* GSM key and quintuplets */
3818 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3819 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3820 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3821 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3822 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3823 quint_len = tvb_get_ntohs(tvb, offset + 13);
3824 proto_tree_add_text(ext_tree_mm, tvb, offset + 13, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3826 offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
3834 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
3836 de_gmm_drx_param(tvb, ext_tree_mm, offset, 2, NULL, 0);
3837 offset = offset + 2;
3839 len = tvb_get_guint8(tvb, offset);
3840 tf = proto_tree_add_text(ext_tree_mm, tvb, offset, len + 1, "MS Network Capability");
3842 tf_tree = proto_item_add_subtree(tf, ett_gtp_net_cap);
3844 proto_tree_add_text(tf_tree, tvb, offset, 1, "Length of MS network capability contents: %u", len);
3848 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
3850 de_gmm_ms_net_cap(tvb, tf_tree, offset, len, NULL, 0);
3851 offset = offset + len;
3853 /* 3GPP TS 29.060 version 9.4.0 Release 9
3854 * The two octets Container Length holds the length of the Container, excluding the Container Length octets.
3855 * Container contains one or several optional information elements as described in the clause "Overview", from the clause
3856 * "General message format and information elements coding" in 3GPP TS 24.008 [5]. For the definition of the IEI see
3857 * table 47a, "IEIs for information elements used in the container". The IMEISV shall, if available, be included in the
3858 * Container. The IMEISV is included in the Mobile identity IE. If Container is not included, its Length field value shall
3859 * be set to 0. If the MS is emergency attached and the MS is UICCless or the IMSI is unauthenticated, the International
3860 * Mobile Equipment Identity (IMEI) shall be used as the MS identity.
3862 * Table 47A: IEIs for information elements used in the container
3863 * IEI Information element
3864 * 0x23 Mobile identity
3866 * NOTE: In 3GPP TS 24.008 [5] the IEI definition is
3867 * message dependent. The table is added to
3868 * have a unique definition in the present
3869 * document for the used IEI in the MMcontext.
3872 con_len = tvb_get_ntohs(tvb, offset);
3873 proto_tree_add_text(ext_tree_mm, tvb, offset, 2, "Container length: %u", con_len);
3874 offset = offset + 2;
3877 proto_tree_add_text(ext_tree_mm, tvb, offset, con_len, "Container");
3879 iei = tvb_get_guint8(tvb,offset);
3881 proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "Mobile identity IEI %u",iei);
3883 len = tvb_get_guint8(tvb,offset);
3884 proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "Length %u",len);
3886 de_mid(tvb, ext_tree_mm, offset, len, NULL, 0);
3888 proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "Unknown IEI %u - Later spec than TS 29.060 9.4.0 used?",iei);
3895 /* Function to extract the value of an hexadecimal octet. Only the lower
3896 * nybble will be non-zero in the output.
3898 static guint8 hex2dec(guint8 x)
3900 if ((x >= 'a') && (x <= 'f'))
3902 else if ((x >= 'A') && (x <= 'F'))
3904 else if ((x >= '0') && (x <= '9'))
3911 /* Wrapper function to add UTF-8 decoding for QoS attributes in
3914 static guint8 wrapped_tvb_get_guint8(tvbuff_t * tvb, int offset, int type)
3917 return (hex2dec(tvb_get_guint8(tvb, offset)) << 4 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
3919 return tvb_get_guint8(tvb, offset);
3922 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3923 * so type means length of length :-)
3925 * WARNING :) type does not mean length of length any more... see below for
3928 static int decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 type)
3932 guint8 al_ret_priority;
3933 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3934 guint8 traf_class, del_order, del_err_sdu;
3935 guint8 max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext;
3936 guint8 res_ber, sdu_err_ratio;
3937 guint8 trans_delay, traf_handl_prio;
3938 guint8 guar_ul, guar_dl, guar_ul_ext, guar_dl_ext;
3939 guint8 src_stat_desc, sig_ind;
3940 proto_tree *ext_tree_qos;
3942 int mss, mu, md, gu, gd;
3944 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
3945 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
3946 * to one byte to be dissected).
3947 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
3948 * corresponds to one byte to be dissected)
3950 guint8 utf8_type = 1;
3952 /* In RADIUS messages the QoS has a version field of two octets prepended.
3953 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
3954 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
3955 * inconsistent and unuseful, I will check hyphen presence here and
3956 * will signal its presence.
3960 /* Will keep the value that will be returned
3966 length = tvb_get_guint8(tvb, offset);
3967 te = proto_tree_add_text(tree, tvb, offset, length + 1, "%s", qos_str);
3968 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3969 proto_tree_add_text(ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3971 retval = length + 1;
3974 length = tvb_get_ntohs(tvb, offset + 1);
3975 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3976 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3977 proto_tree_add_text(ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3978 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
3979 retval = length + 3;
3982 /* For QoS inside RADIUS Client messages from GGSN */
3985 /* The field in the RADIUS message is the length of the tvb we were given */
3986 length = tvb_length(tvb);
3987 te = proto_tree_add_text(tree, tvb, offset, length, "%s", qos_str);
3989 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3991 proto_tree_add_item(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, FALSE);
3993 /* Hyphen handling */
3994 hyphen = tvb_get_guint8(tvb, offset + 2);
3995 if (hyphen == ((guint8) '-')) {
3996 /* Hyphen is present, put in protocol tree */
3997 proto_tree_add_text(ext_tree_qos, tvb, offset + 2, 1, "Hyphen separator: -");
3998 offset++; /* "Get rid" of hyphen */
4001 /* Now, we modify offset here and in order to use type later
4008 retval = length + 2; /* Actually, will be ignored. */
4011 /* XXX - what should we do with the length here? */
4014 ext_tree_qos = NULL;
4018 /* In RADIUS messages there is no allocation-retention priority
4019 * so I don't need to wrap the following call to tvb_get_guint8
4021 al_ret_priority = tvb_get_guint8(tvb, offset);
4023 /* All calls are wrapped to take into account the possibility that the
4024 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
4025 * of the offset will be the same as in the previous version of this
4026 * dissector, and the wrapped function will serve as a dumb wrapper;
4027 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
4028 * two bytes for needed shift, and the wrapped function will unencode
4029 * two values from the input.
4031 spare1 = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE1_MASK;
4032 delay = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DELAY_MASK;
4033 reliability = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RELIABILITY_MASK;
4034 peak = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PEAK_MASK;
4035 spare2 = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE2_MASK;
4036 precedence = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PRECEDENCE_MASK;
4037 spare3 = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE3_MASK;
4038 mean = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_MEAN_MASK;
4040 /* In RADIUS messages there is no allocation-retention priority */
4042 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
4044 /* All additions must take care of the fact that QoS fields in RADIUS
4045 * messages are UTF-8 encoded, so we have to use the same trick as above.
4047 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
4048 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
4049 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
4050 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
4051 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
4052 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
4053 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
4054 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
4056 /* TS 24.008 V 7.8.0
4057 * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
4058 * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
4059 * attributes specified in octets 6-14.
4060 * In the MS to network direction and in the network to MS direction the following applies:
4061 * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
4063 * - If octet 17 is included, then octet 18 shall also be included.
4064 * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
4065 * be accepted by the receiving entity.
4070 /* See above for the need of wrapping
4074 traf_class = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_CLASS_MASK;
4075 del_order = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ORDER_MASK;
4076 del_err_sdu = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ERR_SDU_MASK;
4077 max_sdu_size = wrapped_tvb_get_guint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
4078 max_ul = wrapped_tvb_get_guint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
4079 max_dl = wrapped_tvb_get_guint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
4080 res_ber = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RES_BER_MASK;
4081 sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SDU_ERR_RATIO_MASK;
4082 trans_delay = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRANS_DELAY_MASK;
4083 traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK;
4084 guar_ul = wrapped_tvb_get_guint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
4086 guar_dl = wrapped_tvb_get_guint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
4096 src_stat_desc = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& GTP_EXT_QOS_SRC_STAT_DESC_MASK;
4097 sig_ind = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& GTP_EXT_QOS_SIG_IND_MASK;
4100 max_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
4101 guar_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
4104 max_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
4105 guar_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
4108 /* See above comments for the changes
4110 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
4111 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
4112 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);
4113 if (max_sdu_size == 0 || max_sdu_size > 150)
4114 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);
4115 if (max_sdu_size > 0 && max_sdu_size <= 150) {
4116 mss = max_sdu_size * 10;
4117 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss,
4118 "Maximum SDU size: %u octets", mss);
4121 if (max_ul == 0 || max_ul == 255)
4122 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
4123 if (max_ul > 0 && max_ul <= 63)
4124 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul,
4125 "Maximum bit rate for uplink: %u kbps", max_ul);
4126 if (max_ul > 63 && max_ul <= 127) {
4127 mu = 64 + (max_ul - 64) * 8;
4128 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
4129 "Maximum bit rate for uplink: %u kbps", mu);
4132 if (max_ul > 127 && max_ul <= 254) {
4133 mu = 576 + (max_ul - 128) * 64;
4134 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
4135 "Maximum bit rate for uplink: %u kbps", mu);
4138 if (max_dl == 0 || max_dl == 255)
4139 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
4140 if (max_dl > 0 && max_dl <= 63)
4141 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl,
4142 "Maximum bit rate for downlink: %u kbps", max_dl);
4143 if (max_dl > 63 && max_dl <= 127) {
4144 md = 64 + (max_dl - 64) * 8;
4145 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
4146 "Maximum bit rate for downlink: %u kbps", md);
4148 if (max_dl > 127 && max_dl <= 254) {
4149 md = 576 + (max_dl - 128) * 64;
4150 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
4151 "Maximum bit rate for downlink: %u kbps", md);
4154 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
4155 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);
4156 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
4157 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);
4159 if (guar_ul == 0 || guar_ul == 255)
4160 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
4161 if (guar_ul > 0 && guar_ul <= 63)
4162 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul,
4163 "Guaranteed bit rate for uplink: %u kbps", guar_ul);
4164 if (guar_ul > 63 && guar_ul <= 127) {
4165 gu = 64 + (guar_ul - 64) * 8;
4166 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
4167 "Guaranteed bit rate for uplink: %u kbps", gu);
4169 if (guar_ul > 127 && guar_ul <= 254) {
4170 gu = 576 + (guar_ul - 128) * 64;
4171 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
4172 "Guaranteed bit rate for uplink: %u kbps", gu);
4176 if (guar_dl == 0 || guar_dl == 255)
4177 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
4178 if (guar_dl > 0 && guar_dl <= 63)
4179 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl,
4180 "Guaranteed bit rate for downlink: %u kbps", guar_dl);
4181 if (guar_dl > 63 && guar_dl <= 127) {
4182 gd = 64 + (guar_dl - 64) * 8;
4183 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
4184 "Guaranteed bit rate for downlink: %u kbps", gd);
4186 if (guar_dl > 127 && guar_dl <= 254) {
4187 gd = 576 + (guar_dl - 128) * 64;
4188 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
4189 "Guaranteed bit rate for downlink: %u kbps", gd);
4193 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);
4194 proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
4198 if (max_dl_ext > 0 && max_dl_ext <= 0x4a) {
4199 md = 8600 + max_dl_ext * 100;
4200 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4201 "Ext Maximum bit rate for downlink: %u kbps", md);
4203 if (max_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4204 md = 16 + (max_dl_ext-0x4a);
4205 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4206 "Ext Maximum bit rate for downlink: %u Mbps", md);
4208 if (max_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4209 md = 128 + (max_dl_ext-0xba)*2;
4210 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4211 "Ext Maximum bit rate for downlink: %u Mbps", md);
4214 if(guar_dl_ext == 0)
4215 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");
4216 if (guar_dl_ext > 0 && guar_dl_ext <= 0x4a) {
4217 gd = 8600 + guar_dl_ext * 100;
4218 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4219 "Ext Guaranteed bit rate for downlink: %u kbps", gd);
4221 if (guar_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4222 gd = 16 + (guar_dl_ext-0x4a);
4223 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4224 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
4226 if (guar_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4227 gd = 128 + (guar_dl_ext-0xba)*2;
4228 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4229 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
4235 * 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
4236 * rate for downlink (extended).
4238 if (max_ul_ext > 0 && max_ul_ext <= 0x4a) {
4239 md = 8600 + max_ul_ext * 100;
4240 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4241 "Ext Maximum bit rate for uplink: %u kbps", md);
4243 if (max_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4244 md = 16 + (max_ul_ext-0x4a);
4245 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4246 "Ext Maximum bit rate for uplink: %u Mbps", md);
4248 if (max_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4249 md = 128 + (max_ul_ext-0xba)*2;
4250 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4251 "Ext Maximum bit rate for uplink: %u Mbps", md);
4254 if (guar_ul_ext == 0)
4255 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");
4256 if (guar_ul_ext > 0 && guar_ul_ext <= 0x4a) {
4257 gd = 8600 + guar_ul_ext * 100;
4258 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4259 "Ext Guaranteed bit rate for uplink: %u kbps", gd);
4261 if (guar_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4262 gd = 16 + (guar_ul_ext-0x4a);
4263 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4264 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
4266 if (guar_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4267 gd = 128 + (guar_ul_ext-0xba)*2;
4268 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4269 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
4278 /* Diameter 3GPP AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
4280 dissect_diameter_3gpp_qosprofile(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
4282 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
4283 return tvb_length(tvb);
4286 static const gchar *dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb)
4288 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
4289 return tvb_get_ephemeral_string(tvb, 0, tvb_length(tvb));
4292 static void decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree)
4299 name_len = tvb_get_guint8(tvb, offset);
4301 if (name_len < 0x20) {
4302 apn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
4304 if (name_len >= length - 1)
4307 name_len = name_len + apn[tmp] + 1;
4311 apn = tvb_get_ephemeral_string(tvb, offset, length);
4313 proto_tree_add_string(tree, hf_gtp_apn, tvb, offset, length, apn);
4317 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
4318 * UMTS: 29.060 v4.0, chapter 7.7.29
4319 * TODO: unify addr functions
4321 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4324 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;
4325 guint16 length, sn_down, sn_up, up_flow;
4327 struct e_in6_addr addr_ipv6;
4328 proto_tree *ext_tree_pdp;
4331 length = tvb_get_ntohs(tvb, offset + 1);
4333 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"));
4334 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
4336 vaa = (tvb_get_guint8(tvb, offset + 3) >> 6) & 0x01;
4337 asi = (tvb_get_guint8(tvb, offset + 3) >> 5) & 0x01;
4338 order = (tvb_get_guint8(tvb, offset + 3) >> 4) & 0x01;
4339 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4340 sapi = tvb_get_guint8(tvb, offset + 4) & 0x0F;
4342 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "VPLMN address allowed: %s", yesno[vaa]);
4343 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Activity Status Indicator: %s", yesno[asi]);
4344 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Reordering required: %s", yesno[order]);
4345 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "NSAPI: %u", nsapi);
4346 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "SAPI: %u", sapi);
4348 switch (gtp_version) {
4350 decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
4351 decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
4352 decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
4353 offset = offset + 14;
4356 offset = offset + 5;
4357 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
4358 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
4359 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
4365 sn_down = tvb_get_ntohs(tvb, offset);
4366 sn_up = tvb_get_ntohs(tvb, offset + 2);
4367 pdu_send_no = tvb_get_guint8(tvb, offset + 4);
4368 pdu_rec_no = tvb_get_guint8(tvb, offset + 5);
4370 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
4371 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 2, "Sequence number up: %u", sn_up);
4372 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "Send N-PDU number: %u", pdu_send_no);
4373 proto_tree_add_text(ext_tree_pdp, tvb, offset + 5, 1, "Receive N-PDU number: %u", pdu_rec_no);
4375 switch (gtp_version) {
4377 up_flow = tvb_get_ntohs(tvb, offset + 6);
4378 proto_tree_add_text(ext_tree_pdp, tvb, offset + 6, 2, "Uplink flow label signalling: %u", up_flow);
4379 offset = offset + 8;
4382 pdp_cntxt_id = tvb_get_guint8(tvb, offset + 14);
4383 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_cp, tvb, offset + 6, 4, FALSE);
4384 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_data, tvb, offset + 10, 4, FALSE);
4385 proto_tree_add_text(ext_tree_pdp, tvb, offset + 14, 1, "PDP context identifier: %u", pdp_cntxt_id);
4386 offset = offset + 15;
4392 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
4393 pdp_type_num = tvb_get_guint8(tvb, offset + 1);
4394 pdp_addr_len = tvb_get_guint8(tvb, offset + 2);
4396 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"));
4397 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"));
4398 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 1, "PDP address length: %u", pdp_addr_len);
4400 if (pdp_addr_len > 0) {
4401 switch (pdp_type_num) {
4403 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4404 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 4, "PDP address: %s", ip_to_str((guint8 *) & addr_ipv4));
4407 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4408 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4415 offset = offset + 3 + pdp_addr_len;
4417 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4418 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
4420 switch (ggsn_addr_len) {
4422 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4423 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN Address for control plane: %s", ip_to_str((guint8 *) & addr_ipv4));
4426 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4427 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));
4433 offset = offset + 1 + ggsn_addr_len;
4435 if (gtp_version == 1) {
4437 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4438 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
4440 switch (ggsn_addr_len) {
4442 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4443 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *) & addr_ipv4));
4446 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4447 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4452 offset = offset + 1 + ggsn_addr_len;
4456 apn_len = tvb_get_guint8(tvb, offset);
4457 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
4458 decode_apn(tvb, offset + 1, apn_len, ext_tree_pdp);
4460 offset = offset + 1 + apn_len;
4462 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
4463 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
4464 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
4465 * MS is stored in the PDP context IE.
4466 * 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
4467 * octet in this field.
4469 trans_id = tvb_get_guint8(tvb, offset);
4470 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Transaction identifier: %u", trans_id);
4475 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
4476 * UMTS: 29.060, v4.0, chapter 7.7.30
4478 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4482 proto_tree *ext_tree_apn;
4485 length = tvb_get_ntohs(tvb, offset + 1);
4487 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_APN, >p_val_ext, "Unknown field"));
4488 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
4490 proto_tree_add_text(ext_tree_apn, tvb, offset + 1, 2, "APN length : %u", length);
4491 decode_apn(tvb, offset + 3, length, ext_tree_apn);
4496 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
4497 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
4498 * UMTS: 29.060 v4.0, chapter 7.7.31
4499 * 24.008, v4.2, chapter 10.5.6.3
4501 int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
4504 guint16 length, proto_offset;
4506 guint8 conf, proto_len, cnt = 1;
4508 proto_tree *ext_tree_proto;
4510 gboolean save_writable;
4512 length = tvb_get_ntohs(tvb, offset + 1);
4514 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"));
4515 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
4517 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
4522 conf = tvb_get_guint8(tvb, offset + 3) & 0x07;
4523 proto_tree_add_text(ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
4525 proto_offset = 1; /* ... 1st byte is conf */
4529 if (proto_offset >= length)
4531 proto_id = tvb_get_ntohs(tvb, offset);
4532 proto_len = tvb_get_guint8(tvb, offset + 2);
4533 proto_offset += proto_len + 3; /* 3 = proto id + length byte */
4535 if (proto_len > 0) {
4537 proto_tree_add_text(ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)",
4538 cnt, val_to_str_ext_const(proto_id, &ppp_vals_ext, "Unknown"), proto_id);
4539 proto_tree_add_text(ext_tree_proto, tvb, offset + 2, 1, "Protocol %u length: %u", cnt, proto_len);
4542 * Don't allow the dissector for the configuration
4543 * protocol in question to update the columns - this
4546 save_writable = col_get_writable(pinfo->cinfo);
4547 col_set_writable(pinfo->cinfo, FALSE);
4550 * XXX - should we have our own dissector table,
4551 * solely for configuration protocols, so that bogus
4552 * values don't cause us to dissect the protocol
4553 * data as, for example, IP?
4555 next_tvb = tvb_new_subset(tvb, offset + 3, proto_len, proto_len);
4556 if (!dissector_try_uint(ppp_subdissector_table, proto_id, next_tvb, pinfo, ext_tree_proto)) {
4557 call_dissector(data_handle, next_tvb, pinfo, ext_tree_proto);
4560 col_set_writable(pinfo->cinfo, save_writable);
4563 offset += proto_len + 3;
4570 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
4571 * UMTS: 29.060 v4.0, chapter 7.7.32
4573 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4576 guint8 addr_type, addr_len;
4579 struct e_in6_addr addr_ipv6;
4580 proto_tree *ext_tree_gsn_addr;
4583 length = tvb_get_ntohs(tvb, offset + 1);
4585 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "GSN address : ");
4586 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
4590 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4591 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4592 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4593 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, addr_ipv4);
4596 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4597 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4598 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4599 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4600 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4601 addr_ipv4 = tvb_get_ipv4(tvb, offset + 4);
4602 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4603 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, addr_ipv4);
4606 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4607 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4608 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4609 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
4612 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4613 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4614 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4615 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4616 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4617 tvb_get_ipv6(tvb, offset + 4, &addr_ipv6);
4618 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4619 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, (guint8 *) & addr_ipv6);
4622 proto_item_append_text(te, "unknown type or wrong length");
4629 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
4630 * UMTS: 29.060 v4.0, chapter 7.7.33
4632 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4635 const guint8 *msisdn_val;
4639 length = tvb_get_ntohs(tvb, offset + 1);
4644 msisdn_val = tvb_get_ptr(tvb, offset + 3, length);
4645 msisdn_str = msisdn_to_str(msisdn_val, length);
4647 proto_tree_add_string(tree, hf_gtp_msisdn, tvb, offset, 3 + length, msisdn_str);
4652 /* GPRS: not present
4653 * UMTS: 29.060 v4.0, chapter 7.7.34
4654 * 24.008 v4.2, chapter 10.5.6.5
4656 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4659 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
4662 /* GPRS: not present
4663 * UMTS: 29.060 v4.0, chapter 7.7.35
4665 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4668 proto_tree *ext_tree;
4669 proto_item *te_quint;
4671 guint8 xres_len, auth_len;
4674 length = tvb_get_ntohs(tvb, offset + 1);
4676 te_quint = proto_tree_add_text(tree, tvb, offset, length + 1, "Quintuplet");
4677 ext_tree = proto_item_add_subtree(te_quint, ett_gtp_quint);
4680 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4681 offset = offset + 2;
4683 proto_tree_add_text(ext_tree, tvb, offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
4684 offset = offset + 16;
4685 xres_len = tvb_get_guint8(tvb, offset);
4686 proto_tree_add_text(ext_tree, tvb, offset, 1, "XRES length: %u", xres_len);
4688 proto_tree_add_text(ext_tree, tvb, offset, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset, xres_len));
4689 offset = offset + xres_len;
4690 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4691 offset = offset + 16;
4692 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4693 offset = offset + 16;
4694 auth_len = tvb_get_guint8(tvb, offset);
4695 proto_tree_add_text(ext_tree, tvb, offset, 1, "Authentication length: %u", auth_len);
4697 proto_tree_add_text(ext_tree, tvb, offset, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset, auth_len));
4699 offset = offset + auth_len;
4701 return (3 + length);
4705 /* GPRS: not present
4706 * UMTS: 29.060 v4.0, chapter 7.7.36
4707 * 24.008 v4.2, chapter 10.5.6.12
4709 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4712 guint16 length, port1, port2, tos;
4713 guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto, spare;
4715 guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
4716 struct e_in6_addr addr_ipv6, mask_ipv6;
4717 proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
4718 proto_item *te, *tee, *tef;
4720 length = tvb_get_ntohs(tvb, offset + 1);
4722 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Traffic flow template");
4723 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
4725 tft_flags = tvb_get_guint8(tvb, offset + 3);
4726 tft_code = (tft_flags >> 5) & 0x07;
4727 spare = (tft_flags >> 4) & 0x01;
4728 no_packet_filters = tft_flags & 0x0F;
4730 proto_tree_add_text(ext_tree_tft, tvb, offset + 1, 2, "TFT length: %u", length);
4732 tef = proto_tree_add_text(ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
4733 ext_tree_tft_flags = proto_item_add_subtree(tef, ett_gtp_tft_flags);
4734 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_code, tvb, offset + 3, 1, tft_flags);
4735 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_spare, tvb, offset + 3, 1, tft_flags);
4736 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_number, tvb, offset + 3, 1, tft_flags);
4738 offset = offset + 4;
4740 for (i = 0; i < no_packet_filters; i++) {
4742 pf_id = tvb_get_guint8(tvb, offset);
4744 tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
4745 ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
4748 if (tft_code != 2) {
4750 pf_eval = tvb_get_guint8(tvb, offset);
4751 pf_len = tvb_get_guint8(tvb, offset + 1);
4753 proto_tree_add_uint(ext_tree_tft_pf, hf_gtp_tft_eval, tvb, offset, 1, pf_eval);
4754 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + 1, 1, "Content length: %u", pf_len);
4756 offset = offset + 2;
4759 while (pf_offset < pf_len) {
4761 pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
4763 switch (pf_content_id) {
4764 /* address IPv4 and mask = 8 bytes */
4766 addr_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 1);
4767 mask_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 5);
4768 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),
4769 ip_to_str((guint8 *) & mask_ipv4));
4770 pf_offset = pf_offset + 9;
4772 /* address IPv6 and mask = 32 bytes */
4774 tvb_get_ipv6(tvb, offset + pf_offset + 1, &addr_ipv6);
4775 tvb_get_ipv6(tvb, offset + pf_offset + 17, &mask_ipv6);
4776 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s",
4777 ip6_to_str((struct e_in6_addr *) &addr_ipv6), ip6_to_str((struct e_in6_addr *) &mask_ipv6));
4778 pf_offset = pf_offset + 33;
4780 /* protocol identifier/next header type = 1 byte */
4782 proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
4783 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)",
4785 pf_offset = pf_offset + 2;
4787 /* single destination port type = 2 bytes */
4789 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4790 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
4791 pf_offset = pf_offset + 3;
4793 /* destination port range type = 4 bytes */
4795 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4796 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4797 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
4798 pf_offset = pf_offset + 5;
4800 /* single source port type = 2 bytes */
4802 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4803 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
4804 pf_offset = pf_offset + 3;
4806 /* source port range type = 4 bytes */
4808 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4809 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4810 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
4811 pf_offset = pf_offset + 5;
4813 /* security parameter index type = 4 bytes */
4815 ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
4816 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
4817 pf_offset = pf_offset + 5;
4819 /* type of service/traffic class type = 2 bytes */
4821 tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4822 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
4823 pf_offset = pf_offset + 3;
4825 /* flow label type = 3 bytes */
4827 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;
4828 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
4829 pf_offset = pf_offset + 4;
4833 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
4834 pf_offset++; /* to avoid infinite loop */
4839 offset = offset + pf_offset;
4846 /* GPRS: not present
4847 * UMTS: 29.060 v4.0, chapter 7.7.37
4848 * Type = 138 (Decimal)
4849 * 25.413(RANAP) TargetID
4851 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4855 proto_item *target_id_item;
4856 proto_tree *ext_tree;
4858 asn1_ctx_t asn1_ctx;
4859 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
4861 length = tvb_get_ntohs(tvb, offset + 1);
4863 target_id_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "Target Identification");
4864 ext_tree = proto_item_add_subtree(target_id_item, ett_gtp_target_id);
4865 offset = offset + 1;
4866 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4867 offset = offset + 2;
4868 /* The Target Identification information element contains the identification of a target RNC. Octets 4-n shall be encoded
4869 * as the "Target RNC-ID" part of the "Target ID" parameter in 3GPP TS 25.413 [7]. Therefore, the "Choice Target ID"
4870 * that indicates "Target RNC-ID" (numerical value of 0x20) shall not be included in the "Target RNC-ID" value in octets
4873 next_tvb = tvb_new_subset(tvb, offset, length, length);
4874 dissect_ranap_TargetRNC_ID(next_tvb, 0, &asn1_ctx, ext_tree, hf_gtp_targetRNC_ID);
4880 /* GPRS: not present
4881 * UMTS: 29.060 v4.0, chapter 7.7.38
4883 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4887 proto_item *utran_cont_item;
4888 proto_tree *ext_tree;
4891 length = tvb_get_ntohs(tvb, offset + 1);
4893 utran_cont_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
4894 ext_tree = proto_item_add_subtree(utran_cont_item, ett_gtp_utran_cont);
4895 offset = offset + 1;
4896 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4897 offset = offset + 2;
4898 next_tvb = tvb_new_subset(tvb, offset, length, length);
4900 call_dissector(data_handle, next_tvb, pinfo, ext_tree);
4907 /* GPRS: not present
4908 * UMTS: 29.060 v4.0, chapter 7.7.39
4910 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4913 guint32 teid, addr_ipv4;
4916 struct e_in6_addr addr_ipv6;
4917 proto_tree *ext_tree_rab_setup;
4920 length = tvb_get_ntohs(tvb, offset + 1);
4921 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4923 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Radio Access Bearer Setup Information");
4924 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
4926 proto_tree_add_text(ext_tree_rab_setup, tvb, offset + 1, 2, "RAB setup length : %u", length);
4927 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, nsapi);
4931 teid = tvb_get_ntohl(tvb, offset + 4);
4933 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
4937 addr_ipv4 = tvb_get_ipv4(tvb, offset + 8);
4938 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, addr_ipv4);
4941 tvb_get_ipv6(tvb, offset + 8, &addr_ipv6);
4942 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, (guint8 *) & addr_ipv6);
4953 /* GPRS: not present
4954 * UMTS: 29.060 v4.0, chapter 7.7.40
4956 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4961 proto_tree *ext_tree_hdr_list;
4964 length = tvb_get_guint8(tvb, offset + 1);
4966 te = proto_tree_add_text(tree, tvb, offset, 2 + length, "%s", val_to_str_ext_const(GTP_EXT_HDR_LIST, >p_val_ext, "Unknown"));
4967 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4969 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4971 for (i = 0; i < length; i++) {
4972 hdr = tvb_get_guint8(tvb, offset + 2 + i);
4974 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 2 + i, 1, "No. %u --> Extension Header Type value : %s (%u)", i + 1,
4975 val_to_str_ext_const(hdr, >p_val_ext, "Unknown Extension Header Type"), hdr);
4981 /* GPRS: not present
4982 * UMTS: 29.060 v4.0, chapter 7.7.41
4983 * TODO: find TriggerID description
4985 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4990 length = tvb_get_ntohs(tvb, offset + 1);
4992 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);
4998 /* GPRS: not present
4999 * UMTS: 29.060 v4.0, chapter 7.7.42
5000 * TODO: find OMC-ID description
5002 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5007 length = tvb_get_ntohs(tvb, offset + 1);
5009 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);
5015 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
5016 * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
5018 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5023 struct e_in6_addr addr_ipv6;
5024 proto_tree *ext_tree_chrg_addr;
5027 length = tvb_get_ntohs(tvb, offset + 1);
5029 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, >p_val_ext, "Unknown"));
5030 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
5032 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);
5036 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
5037 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
5038 proto_tree_add_ipv4(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, addr_ipv4);
5041 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
5042 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
5043 proto_tree_add_ipv6(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
5046 proto_item_append_text(te, "unknown type or wrong length");
5054 * UMTS: 29.060 v6.11.0, chapter 7.7.44 RAN Transparent Container
5056 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5060 proto_tree *ext_tree;
5063 length = tvb_get_ntohs(tvb, offset + 1);
5064 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"));
5065 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ran_tr_cont);
5068 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5069 offset = offset + 2;
5070 /* TODO add decoding of data */
5071 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5078 * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
5080 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5084 proto_tree *ext_tree;
5087 length = tvb_get_ntohs(tvb, offset + 1);
5088 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"));
5089 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdp_cont_prio);
5092 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5093 offset = offset + 2;
5094 /* TODO add decoding of data */
5095 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5102 * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
5104 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5108 proto_tree *ext_tree;
5111 length = tvb_get_ntohs(tvb, offset + 1);
5112 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"));
5113 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rab_setup_inf);
5116 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5117 offset = offset + 2;
5118 /* TODO add decoding of data */
5119 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5127 * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
5129 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5133 proto_tree *ext_tree;
5136 length = tvb_get_ntohs(tvb, offset + 1);
5137 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_SSGN_NO, >p_val_ext, "Unknown"));
5138 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ssgn_no);
5141 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5142 offset = offset + 2;
5143 /* TODO add decoding of data */
5144 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5151 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
5153 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5157 proto_tree *ext_tree;
5160 length = tvb_get_ntohs(tvb, offset + 1);
5161 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_COMMON_FLGS, >p_val_ext, "Unknown"));
5162 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_common_flgs);
5165 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5166 offset = offset + 2;
5167 /* Upgrade QoS Supported */
5168 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, FALSE);
5169 /* NRSN bit field */
5170 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, FALSE);
5171 /* No QoS negotiation */
5172 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, FALSE);
5173 /* MBMS Counting Information bi */
5174 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, FALSE);
5175 /* RAN Procedures Ready */
5176 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, FALSE);
5177 /* MBMS Service Type */
5178 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, FALSE);
5179 /* Prohibit Payload Compression */
5180 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, FALSE);
5187 * UMTS: 29.060 v6.11.0, chapter 7.7.49
5189 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5193 proto_tree *ext_tree_apn_res;
5196 length = tvb_get_ntohs(tvb, offset + 1);
5197 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_APN_RES, >p_val_ext, "Unknown"));
5198 ext_tree_apn_res = proto_item_add_subtree(te, ett_gtp_ext_tree_apn_res);
5201 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5202 offset = offset + 2;
5204 /* Restriction Type value */
5206 proto_item *expert_item;
5207 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
5208 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
5209 PROTO_ITEM_SET_GENERATED(expert_item);
5213 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, FALSE);
5218 * UMTS: 29.060 v6.11.0, chapter 7.7.50
5220 * Type = 151 (Decimal)
5223 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5227 proto_tree *ext_tree_rat_type;
5230 length = tvb_get_ntohs(tvb, offset + 1);
5231 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RAT_TYPE, >p_val_ext, "Unknown"));
5232 ext_tree_rat_type = proto_item_add_subtree(te, ett_gtp_ext_rat_type);
5235 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5236 offset = offset + 2;
5238 /* RAT Type value */
5240 proto_item *expert_item;
5241 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
5242 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
5243 PROTO_ITEM_SET_GENERATED(expert_item);
5247 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, FALSE);
5253 * UMTS: 29.060 v6.11.0, chapter 7.7.51
5254 * User Location Information
5255 * Type = 152 (Decimal)
5258 static const gchar *dissect_radius_user_loc(proto_tree * tree, tvbuff_t * tvb)
5262 guint8 geo_loc_type;
5263 guint16 length = tvb_length(tvb);
5265 /* Geographic Location Type */
5266 proto_tree_add_item(tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5267 geo_loc_type = tvb_get_guint8(tvb, offset);
5270 if (geo_loc_type == 0)
5271 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5272 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 0);
5273 if (geo_loc_type == 1) {
5274 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5275 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 4);
5276 offset = offset + 5;
5277 proto_tree_add_item(tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5281 return tvb_bytes_to_str(tvb, 0, length);
5284 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5288 proto_tree *ext_tree;
5290 guint8 geo_loc_type;
5292 length = tvb_get_ntohs(tvb, offset + 1);
5293 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"));
5294 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_usr_loc_inf);
5297 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5298 offset = offset + 2;
5299 /* TODO add decoding of data */
5300 /* Geographic Location Type */
5301 proto_tree_add_item(ext_tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5302 geo_loc_type = tvb_get_guint8(tvb, offset);
5305 if (geo_loc_type == 0)
5306 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5307 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 0);
5308 if (geo_loc_type == 1) {
5309 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5310 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 4);
5311 offset = offset + 5;
5312 proto_tree_add_item(ext_tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5319 static const value_string daylight_saving_time_vals[] = {
5320 {0, "No adjustment"},
5321 {1, "+1 hour adjustment for Daylight Saving Time"},
5322 {2, "+2 hours adjustment for Daylight Saving Time"},
5328 * UMTS: 29.060 v6.11.0, chapter 7.7.52
5330 * Type = 153 (Decimal)
5331 * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
5332 * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
5333 * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
5334 * its value shall be set as defined in 3GPP TS 22.042
5336 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5340 proto_tree *ext_tree;
5345 length = tvb_get_ntohs(tvb, offset + 1);
5346 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"));
5347 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ms_time_zone);
5350 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5351 offset = offset + 2;
5353 /* 3GPP TS 23.040 version 6.6.0 Release 6
5354 * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
5356 * The Time Zone indicates the difference, expressed in quarters of an hour,
5357 * between the local time and GMT. In the first of the two semi-octets,
5358 * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
5359 * represents the algebraic sign of this difference (0: positive, 1: negative).
5362 data = tvb_get_guint8(tvb, offset);
5363 sign = (data & 0x08) ? '-' : '+';
5364 data = (data >> 4) + (data & 0x07) * 10;
5366 proto_tree_add_text(ext_tree, tvb, offset, 1, "Timezone: GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5367 proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5370 data = tvb_get_guint8(tvb, offset) & 0x3;
5371 proto_tree_add_text(ext_tree, tvb, offset, 1, "%s", val_to_str_const(data, daylight_saving_time_vals, "Unknown"));
5378 * UMTS: 29.060 v6.11.0, chapter 7.7.53
5379 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
5380 * Type = 154 (Decimal)
5382 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5386 proto_tree *ext_imeisv;
5389 const char *digit_str;
5391 length = tvb_get_ntohs(tvb, offset + 1);
5392 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_IMEISV, >p_val_ext, "Unknown"));
5393 ext_imeisv = proto_item_add_subtree(te, ett_gtp_ext_imeisv);
5396 proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5397 offset = offset + 2;
5400 * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
5401 * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
5402 * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
5403 * set to '1111'. Both IMEI and IMEISV are BCD encoded.
5405 next_tvb = tvb_new_subset(tvb, offset, length, length);
5406 digit_str = unpack_digits(next_tvb, 0);
5407 proto_tree_add_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, digit_str);
5408 proto_item_append_text(te, ": %s", digit_str);
5414 * UMTS: 29.060 v6.11.0, chapter 7.7.54
5415 * CAMEL Charging Information Container
5416 * Type = 155 (Decimal)
5418 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5422 proto_tree *ext_tree;
5425 length = tvb_get_ntohs(tvb, offset + 1);
5426 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"));
5427 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_camel_chg_inf_con);
5430 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5431 offset = offset + 2;
5432 /* TODO add decoding of data */
5433 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5440 * UMTS: 29.060 v6.11.0, chapter 7.7.55
5443 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5447 proto_tree *ext_tree;
5450 length = tvb_get_ntohs(tvb, offset + 1);
5451 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"));
5452 ext_tree = proto_item_add_subtree(te, ett_GTP_EXT_MBMS_UE_CTX);
5455 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5456 offset = offset + 2;
5457 /* TODO add decoding of data */
5458 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5465 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
5466 * Temporary Mobile Group Identity (TMGI)
5467 * The Temporary Mobile Group Identity (TMGI) information element contains
5468 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
5469 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
5472 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5476 proto_tree *ext_tree, *tmgi_tree;
5477 proto_item *te, *ti;
5480 length = tvb_get_ntohs(tvb, offset + 1);
5481 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_TMGI, >p_val_ext, "Unknown"));
5482 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_tmgi);
5485 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5486 offset = offset + 2;
5488 ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, FALSE);
5490 tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
5491 next_tvb = tvb_new_subset(tvb, offset, length, length);
5492 de_mid(next_tvb, tmgi_tree, 0, length, NULL, 0);
5498 * UMTS: 29.060 v6.11.0, chapter 7.7.57
5499 * RIM Routing Address
5501 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5505 proto_tree *ext_tree;
5508 length = tvb_get_ntohs(tvb, offset + 1);
5509 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RIM_RA, >p_val_ext, "Unknown"));
5510 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rim_ra);
5513 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5514 offset = offset + 2;
5515 /* TODO add decoding of data */
5516 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5518 * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
5526 * UMTS: 29.060 v6.11.0, chapter 7.7.58
5527 * MBMS Protocol Configuration Options
5529 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5533 proto_tree *ext_tree;
5536 length = tvb_get_ntohs(tvb, offset + 1);
5537 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"));
5538 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_prot_conf_opt);
5541 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5542 offset = offset + 2;
5543 /* TODO add decoding of data */
5544 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5551 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
5552 * MBMS Session Duration
5554 /* Used for Diameter */
5555 static int dissect_gtp_mbms_ses_dur(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5560 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5561 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5567 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5571 proto_tree *ext_tree;
5574 length = tvb_get_ntohs(tvb, offset + 1);
5575 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"));
5576 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bms_ses_dur);
5579 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5580 offset = offset + 2;
5581 /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
5582 * The MBMS Session Duration information element indicates the estimated
5583 * session duration of the MBMS service data transmission if available.
5584 * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
5585 * in 3GPP TS 29.061 [27], excluding the AVP Header fields
5586 * (as defined in IETF RFC 3588 [36], section 4.1).
5588 /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
5589 * with a length of three octets and indicates the estimated session duration
5590 * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
5591 * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
5592 * for which the maximum allowed value is 18 days. For the whole session duration the seconds
5593 * and days are added together and the maximum session duration is 19 days.
5595 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5596 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5603 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
5606 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5610 proto_tree *ext_tree;
5611 proto_item *te, *item;
5612 guint8 no_of_mbms_sa_codes;
5615 length = tvb_get_ntohs(tvb, offset + 1);
5616 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SA, >p_val_ext, "Unknown"));
5617 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_sa);
5620 item = proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5621 offset = offset + 2;
5622 /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
5623 * The MBMS Service Area information element indicates the area over
5624 * which the Multimedia Broadcast/Multicast Service is to be distributed.
5625 * The payload shall be encoded as per the MBMS-Service-Area AVP defined
5626 * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
5627 * IETF RFC 3588 [36], section 4.1).
5629 /* Number N of MBMS service area codes coded as:
5630 * 1 binary value is '00000000'
5632 * 256 binary value is '11111111'
5634 no_of_mbms_sa_codes = tvb_get_guint8(tvb, offset) + 1;
5635 if (length != ((no_of_mbms_sa_codes << 1) + 1)) {
5636 expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_WARN,
5637 "Wrong length: %u. The length of an MBMS service area code is 2 octets", length);
5639 proto_tree_add_uint(ext_tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
5641 /* A consecutive list of N MBMS service area codes
5642 * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
5643 * The length of an MBMS service area code is 2 octets.
5645 for (i = 0; i < no_of_mbms_sa_codes; i++) {
5646 proto_tree_add_item(ext_tree, hf_gtp_mbms_sa_code, tvb, offset, 2, FALSE);
5647 offset = offset + 2;
5655 * UMTS: 29.060 v6.11.0, chapter 7.7.61
5656 * Source RNC PDCP context info
5658 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5662 proto_tree *ext_tree;
5665 length = tvb_get_ntohs(tvb, offset + 1);
5666 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"));
5667 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_src_rnc_pdp_ctx_inf);
5670 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5671 offset = offset + 2;
5672 /* TODO add decoding of data */
5673 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5680 * UMTS: 29.060 v6.11.0, chapter 7.7.62
5681 * Additional Trace Info
5683 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5687 proto_tree *ext_tree;
5690 length = tvb_get_ntohs(tvb, offset + 1);
5691 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"));
5692 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_add_trs_inf);
5695 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5696 offset = offset + 2;
5697 /* TODO add decoding of data */
5698 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5705 * UMTS: 29.060 v6.11.0, chapter 7.7.63
5708 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5712 proto_tree *ext_tree;
5715 length = tvb_get_ntohs(tvb, offset + 1);
5716 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_HOP_COUNT, >p_val_ext, "Unknown"));
5717 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_hop_count);
5720 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5721 offset = offset + 2;
5722 /* TODO add decoding of data */
5723 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5730 * UMTS: 29.060 v6.11.0, chapter 7.7.64
5733 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5737 proto_tree *ext_tree;
5740 length = tvb_get_ntohs(tvb, offset + 1);
5741 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"));
5742 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_sel_plmn_id);
5745 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5746 offset = offset + 2;
5747 /* TODO add decoding of data */
5748 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5755 * UMTS: 29.060 v6.11.0, chapter 7.7.65
5756 * MBMS Session Identifier
5758 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5762 proto_tree *ext_tree;
5765 length = tvb_get_ntohs(tvb, offset + 1);
5766 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"));
5767 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id);
5770 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5771 offset = offset + 2;
5772 /* TODO add decoding of data */
5773 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5780 * UMTS: 29.060 v6.11.0, chapter 7.7.66
5781 * MBMS 2G/3G Indicator
5783 static const value_string gtp_mbs_2g_3g_ind_vals[] = {
5786 {2, "Both 2G and 3G"},
5790 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5794 proto_tree *ext_tree;
5797 length = tvb_get_ntohs(tvb, offset + 1);
5798 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"));
5799 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_2g_3g_ind);
5802 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5803 offset = offset + 2;
5804 /* MBMS 2G/3G Indicator */
5805 proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, FALSE);
5812 * UMTS: 29.060 v6.11.0, chapter 7.7.67
5815 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5819 proto_tree *ext_tree;
5822 length = tvb_get_ntohs(tvb, offset + 1);
5823 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ENH_NSAPI, >p_val_ext, "Unknown"));
5824 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_enh_nsapi);
5827 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5828 offset = offset + 2;
5829 /* TODO add decoding of data */
5830 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5837 * UMTS: 29.060 v6.11.0, chapter 7.7.68
5838 * Additional MBMS Trace Info
5840 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5844 proto_tree *ext_tree;
5847 length = tvb_get_ntohs(tvb, offset + 1);
5848 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"));
5849 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ad_mbms_trs_inf);
5852 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5853 offset = offset + 2;
5854 /* TODO add decoding of data */
5855 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5862 * UMTS: 29.060 v6.11.0, chapter 7.7.69
5863 * MBMS Session Identity Repetition Number
5865 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5869 proto_tree *ext_tree;
5872 length = tvb_get_ntohs(tvb, offset + 1);
5873 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"));
5874 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id_rep_no);
5877 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5878 offset = offset + 2;
5879 /* TODO add decoding of data */
5880 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5887 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
5888 * MBMS Time To Data Transfer
5890 /* Used for Diameter */
5891 static int dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5895 guint8 time_2_dta_tr;
5897 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5898 proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5904 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5908 proto_tree *ext_tree;
5910 guint8 time_2_dta_tr;
5912 length = tvb_get_ntohs(tvb, offset + 1);
5913 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"));
5914 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_time_to_data_tr);
5917 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5918 offset = offset + 2;
5919 /* TODO add decoding of data
5920 * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
5921 * The MBMS Time To Data Transfer information element contains a
5922 * MBMS Time To Data Transfer allocated by the BM-SC.
5923 * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
5924 * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
5925 * (as defined in IETF RFC 3588 [36], section 4.1).
5927 /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
5928 * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
5931 * 0 0 0 0 0 0 0 0 1s
5932 * 0 0 0 0 0 0 0 1 2s
5933 * 0 0 0 0 0 0 1 0 3s
5935 * 1 1 1 1 1 1 1 1 256s
5937 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5938 proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5945 * UMTS: 29.060 v6.11.0, chapter 7.7.71
5946 * PS Handover Request Context
5949 decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5953 proto_tree *ext_tree;
5956 length = tvb_get_ntohs(tvb, offset + 1);
5957 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"));
5958 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_ho_req_ctx);
5961 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5962 offset = offset + 2;
5963 /* TODO add decoding of data */
5964 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5971 * UMTS: 29.060 v6.11.0, chapter 7.7.72
5975 decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5979 proto_tree *ext_tree;
5982 length = tvb_get_ntohs(tvb, offset + 1);
5983 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSS_CONT, >p_val_ext, "Unknown"));
5984 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bss_cont);
5987 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5988 offset = offset + 2;
5989 /* TODO add decoding of data */
5990 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5992 * The content of this container is defined in 3GPP TS 48.018
6000 * UMTS: 29.060 v6.11.0, chapter 7.7.73
6001 * Cell Identification
6004 decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6008 proto_tree *ext_tree;
6011 length = tvb_get_ntohs(tvb, offset + 1);
6012 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CELL_ID, >p_val_ext, "Unknown"));
6013 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_cell_id);
6016 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6017 offset = offset + 2;
6018 /* TODO add decoding of data */
6019 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6021 * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
6022 * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
6024 * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
6025 * source RNC (RNC-ID) as defined in 3GPP TS 48.018
6033 * UMTS: 29.060 v6.11.0, chapter 7.7.74
6037 decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6041 proto_tree *ext_tree;
6044 length = tvb_get_ntohs(tvb, offset + 1);
6045 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PDU_NO, >p_val_ext, "Unknown"));
6046 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6049 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6050 offset = offset + 2;
6051 /* TODO add decoding of data */
6052 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6059 * UMTS: 29.060 v6.11.0, chapter 7.7.75
6063 decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6067 proto_tree *ext_tree;
6070 length = tvb_get_ntohs(tvb, offset + 1);
6071 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, >p_val_ext, "Unknown"));
6072 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
6075 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6076 offset = offset + 2;
6079 * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
6081 proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 2, FALSE);
6088 * Required MBMS bearer capabilities 7.7.76
6091 decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6094 proto_tree *ext_tree;
6097 length = tvb_get_ntohs(tvb, offset + 1);
6098 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, >p_val_ext, "Unknown"));
6099 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
6102 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6103 offset = offset + 2;
6104 /* The payload shall be encoded as per the
6105 * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
6106 * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
6108 /* TODO Add decoding (call Diameter dissector???) */
6113 * RIM Routing Address Discriminator 7.7.77
6116 decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6120 proto_tree *ext_tree;
6123 length = tvb_get_ntohs(tvb, offset + 1);
6124 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"));
6125 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6128 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6129 offset = offset + 2;
6130 /* TODO add decoding of data */
6131 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6137 * List of set-up PFCs 7.7.78
6140 decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6144 proto_tree *ext_tree;
6147 length = tvb_get_ntohs(tvb, offset + 1);
6148 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"));
6149 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6152 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6153 offset = offset + 2;
6154 /* TODO add decoding of data */
6155 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6161 * PS Handover XID Parameters 7.7.79
6163 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6167 proto_tree *ext_tree;
6173 length = tvb_get_ntohs(tvb, offset + 1);
6174 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"));
6175 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_handover_xid);
6178 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6179 offset = offset + 2;
6181 sapi = tvb_get_guint8(tvb, offset) & 0x0F;
6182 proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
6185 xid_par_len = tvb_get_guint8(tvb, offset);
6186 proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
6189 if (sndcpxid_handle) {
6190 next_tvb = tvb_new_subset_remaining(tvb, offset);
6191 call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
6193 proto_tree_add_text(tree, tvb, offset, 0, "Data");
6200 * MS Info Change Reporting Action 7.7.80
6202 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6206 proto_tree *ext_tree;
6209 length = tvb_get_ntohs(tvb, offset + 1);
6210 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"));
6211 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6214 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6215 offset = offset + 2;
6216 /* TODO add decoding of data */
6217 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6223 * Direct Tunnel Flags 7.7.81
6225 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6229 proto_tree *ext_tree;
6232 length = tvb_get_ntohs(tvb, offset + 1);
6233 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"));
6234 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6237 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6238 offset = offset + 2;
6239 /* TODO add decoding of data */
6240 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6241 proto_tree_add_item(ext_tree, hf_gtp_ext_ei, tvb, offset, 1, FALSE);
6242 proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, FALSE);
6243 proto_tree_add_item(ext_tree, hf_gtp_ext_dti, tvb, offset, 1, FALSE);
6250 * Correlation-ID 7.7.82
6252 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6256 proto_tree *ext_tree;
6259 length = tvb_get_ntohs(tvb, offset + 1);
6260 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CORRELATION_ID, >p_val_ext, "Unknown"));
6261 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6264 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6265 offset = offset + 2;
6266 /* TODO add decoding of data */
6267 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6273 * Bearer Control Mode 7.7.83
6276 static const value_string gtp_pdp_bcm_type_vals[] = {
6282 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6286 proto_tree *ext_tree;
6289 length = tvb_get_ntohs(tvb, offset + 1);
6290 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"));
6291 ext_tree = proto_item_add_subtree(te, ett_gtp_bcm);
6294 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6295 offset = offset + 2;
6297 proto_tree_add_item(ext_tree, hf_gtp_bcm, tvb, offset, 1, FALSE);
6304 * 7.7.91 Evolved Allocation/Retention Priority I
6306 static int decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6310 proto_tree *ext_tree;
6313 length = tvb_get_ntohs(tvb, offset + 1);
6314 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P1, >p_val_ext, "Unknown"));
6315 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6318 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6319 offset = offset + 2;
6321 proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, FALSE);
6322 proto_tree_add_item(ext_tree, hf_gtp_earp_pl, tvb, offset, 1, FALSE);
6323 proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, FALSE);
6332 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6335 guint16 length, n, number;
6336 proto_tree *ext_tree_rel_pack;
6339 length = tvb_get_ntohs(tvb, offset + 1);
6341 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
6342 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
6346 while (n < length) {
6348 number = tvb_get_ntohs(tvb, offset + 3 + n);
6349 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
6360 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6363 guint16 length, n, number;
6364 proto_tree *ext_tree_can_pack;
6367 length = tvb_get_ntohs(tvb, offset + 1);
6369 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
6370 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
6374 while (n < length) {
6376 number = tvb_get_ntohs(tvb, offset + 3 + n);
6377 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
6385 * 3GPP TS 32.295 version 9.0.0 Release 9
6389 static const value_string gtp_cdr_fmt_vals[] = {
6390 {1, "Basic Encoding Rules (BER)"},
6391 {2, "Unaligned basic Packed Encoding Rules (PER)"},
6392 {3, "Aligned basic Packed Encoding Rules (PER)"},
6395 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6398 guint16 length, cdr_length;
6399 guint8 no, format, app_id, rel_id, ver_id, i;
6400 proto_tree *ext_tree, *ver_tree, *cdr_dr_tree;
6401 proto_item *te, *fmt_item, *ver_item;
6404 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_DATA_REQ, >p_val_ext, "Unknown message"));
6405 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
6408 length = tvb_get_ntohs(tvb, offset);
6409 proto_tree_add_text(ext_tree, tvb, offset, 2, "Length: %u", length);
6412 /* Octet 4 Number of Data Records */
6413 no = tvb_get_guint8(tvb, offset);
6414 proto_tree_add_text(ext_tree, tvb, offset, 1, "Number of data records: %u", no);
6417 /* Octet 5 Data Record Format */
6418 format = tvb_get_guint8(tvb, offset);
6419 fmt_item = proto_tree_add_text(ext_tree, tvb, offset, 1, "Data record format: %u", format);
6421 /* The value range is 1-255 in decimal. The value '0' should not be used.
6422 * Only the values 1-10 and 51-255 can be used for standards purposes.
6423 * Values in the range of 11-50 are to be configured only by operators, and are not subject to standardization.
6426 proto_item_append_text(fmt_item, " %s", val_to_str_const(format, gtp_cdr_fmt_vals, "Unknown"));
6427 /* Octet 6 -7 Data Record Format Version
6429 * 6 Application Identifier Release Identifier
6430 * 7 Version Identifier
6432 app_id = tvb_get_guint8(tvb,offset);
6433 rel_id = app_id & 0x0f;
6434 app_id = app_id >>4;
6435 ver_id =tvb_get_guint8(tvb,offset+1);
6436 /* The second octet (#7 in Data Record Packet IE) identifies the version of the TS used to encode the CDR,
6437 * i.e. its value corresponds to the second digit of the version number of the document [51]
6438 * (as shown on the cover sheet), plus '1'.
6439 * E.g. for version 3.4.0, the Version Identifier would be "5".
6440 * In circumstances where the second digit is an alphabetical character, (e.g. 3.b.0), the corresponding ASCII value shall
6441 * be taken, e.g. the Version Identifier would be "66" (ASCII(b)).
6445 /* XXX We don't handle ASCCI version */
6447 ver_item = proto_tree_add_text(ext_tree, tvb, offset, 2, "Data record format version: AppId %u Rel %u.%u.0", app_id,rel_id,ver_id);
6448 ver_tree = proto_item_add_subtree(ver_item, ett_gtp_cdr_ver);
6449 proto_tree_add_item(ver_tree, hf_gtp_cdr_app, tvb, offset, 1, FALSE);
6450 proto_tree_add_item(ver_tree, hf_gtp_cdr_rel, tvb, offset, 1, FALSE);
6452 proto_tree_add_item(ver_tree, hf_gtp_cdr_ver, tvb, offset, 1, FALSE);
6454 for(i = 0; i < no; ++i) {
6455 cdr_length = tvb_get_ntohs(tvb, offset);
6456 te = proto_tree_add_text(ext_tree, tvb, offset, cdr_length+2, "Data record %d", i + 1);
6457 cdr_dr_tree = proto_item_add_subtree(te, ett_gtp_cdr_dr);
6458 proto_tree_add_text(cdr_dr_tree, tvb, offset, 2, "Length: %u", cdr_length);
6460 proto_tree_add_text(cdr_dr_tree, tvb, offset, cdr_length, "Content");
6461 next_tvb = tvb_new_subset_remaining(tvb, offset);
6463 /* XXX this is for release 6, may not work for higer releases */
6465 dissect_gprscdr_GPRSCallEventRecord_PDU(next_tvb, pinfo, cdr_dr_tree);
6468 offset = offset + cdr_length;
6472 /* Proprietary CDR format */
6473 proto_item_append_text(fmt_item, " Proprietary or un documented format");
6476 if (gtpcdr_handle) {
6477 next_tvb = tvb_new_subset_remaining(tvb, offset);
6478 call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
6487 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6490 guint16 length, n, number;
6491 proto_tree *ext_tree_data_resp;
6494 length = tvb_get_ntohs(tvb, offset + 1);
6496 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
6497 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
6501 while (n < length) {
6503 number = tvb_get_ntohs(tvb, offset + 3 + n);
6504 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
6516 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6521 struct e_in6_addr addr_ipv6;
6522 proto_tree *ext_tree_node_addr;
6525 length = tvb_get_ntohs(tvb, offset + 1);
6527 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Node address: ");
6528 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
6530 proto_tree_add_text(ext_tree_node_addr, tvb, offset + 1, 2, "Node address length: %u", length);
6534 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
6535 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
6536 proto_tree_add_ipv4(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, addr_ipv4);
6539 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
6540 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
6541 proto_tree_add_ipv6(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
6544 proto_item_append_text(te, "unknown type or wrong length");
6552 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
6553 * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
6557 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6560 guint16 length, ext_id;
6561 proto_tree *ext_tree_priv_ext;
6564 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_PRIV_EXT, >p_val_ext, "Unknown message"));
6565 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
6568 length = tvb_get_ntohs(tvb, offset);
6569 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6570 offset = offset + 2;
6572 ext_id = tvb_get_ntohs(tvb, offset);
6573 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
6574 offset = offset + 2;
6577 * XXX - is this always a text string? Or should it be
6578 * displayed as hex data?
6581 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, FALSE);
6587 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6590 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
6592 return tvb_length_remaining(tvb, offset);
6595 static void dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6597 struct _gtp_hdr gtp_hdr;
6598 proto_tree *gtp_tree, *flags_tree;
6599 proto_item *ti, *tf;
6600 int i, offset, length, gtp_prime, checked_field, mandatory;
6601 int seq_no=0, flow_label=0;
6602 guint8 pdu_no, next_hdr = 0, ext_hdr_val;
6603 const guint8 *tid_val;
6607 guint8 sub_proto, acfield_len = 0, control_field;
6608 gtp_msg_hash_t *gcrp=NULL;
6609 conversation_t *conversation=NULL;
6610 gtp_conv_info_t *gtp_info;
6614 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
6615 col_clear(pinfo->cinfo, COL_INFO);
6618 * Do we have a conversation for this connection?
6620 conversation = find_or_create_conversation(pinfo);
6623 * Do we already know this conversation?
6625 gtp_info = conversation_get_proto_data(conversation, proto_gtp);
6626 if (gtp_info == NULL) {
6627 /* No. Attach that information to the conversation, and add
6628 * it to the list of information structures.
6630 gtp_info = g_malloc(sizeof(gtp_conv_info_t));
6631 /*Request/response matching tables*/
6632 gtp_info->matched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_matched);
6633 gtp_info->unmatched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_unmatched);
6635 conversation_add_proto_data(conversation, proto_gtp, gtp_info);
6637 gtp_info->next = gtp_info_items;
6638 gtp_info_items = gtp_info;
6640 pd_save = pinfo->private_data;
6641 pinfo->private_data = gtp_info;
6643 tvb_memcpy(tvb, (guint8 *) & gtp_hdr, 0, 4);
6645 if (!(gtp_hdr.flags & 0x10))
6650 switch ((gtp_hdr.flags >> 5) & 0x07) {
6662 col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(gtp_hdr.message, &message_type_ext, "Unknown"));
6665 ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, FALSE);
6666 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
6668 tf = proto_tree_add_uint(gtp_tree, hf_gtp_flags, tvb, 0, 1, gtp_hdr.flags);
6669 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
6672 proto_tree_add_uint(flags_tree, hf_gtp_flags_ver, tvb, 0, 1, gtp_hdr.flags);
6674 proto_tree_add_uint(flags_tree, hf_gtp_prime_flags_ver, tvb, 0, 1, gtp_hdr.flags);
6677 proto_tree_add_uint(flags_tree, hf_gtp_flags_pt, tvb, 0, 1, gtp_hdr.flags);
6679 if((gtp_prime==1)||(gtp_version==0)){
6680 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare1, tvb, 0, 1, gtp_hdr.flags);
6681 proto_tree_add_boolean(flags_tree, hf_gtp_flags_snn, tvb, 0, 1, gtp_hdr.flags);
6683 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare2, tvb, 0, 1, gtp_hdr.flags);
6684 proto_tree_add_boolean(flags_tree, hf_gtp_flags_e, tvb, 0, 1, gtp_hdr.flags);
6685 proto_tree_add_boolean(flags_tree, hf_gtp_flags_s, tvb, 0, 1, gtp_hdr.flags);
6686 proto_tree_add_boolean(flags_tree, hf_gtp_flags_pn, tvb, 0, 1, gtp_hdr.flags);
6689 proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, 1, 1, gtp_hdr.message);
6691 gtp_hdr.length = g_ntohs(gtp_hdr.length);
6692 proto_tree_add_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, gtp_hdr.length);
6697 seq_no = tvb_get_ntohs(tvb, offset);
6698 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6701 switch (gtp_version) {
6703 seq_no = tvb_get_ntohs(tvb, offset);
6704 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6707 flow_label = tvb_get_ntohs(tvb, offset);
6708 proto_tree_add_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
6711 pdu_no = tvb_get_guint8(tvb, offset);
6712 proto_tree_add_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
6715 tid_val = tvb_get_ptr(tvb, offset, 8);
6716 tid_str = id_to_str(tid_val);
6717 proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
6721 teid = tvb_get_ntohl(tvb, offset);
6722 proto_tree_add_uint(gtp_tree, hf_gtp_teid, tvb, offset, 4, teid);
6725 if (gtp_hdr.flags & 0x07) {
6726 seq_no = tvb_get_ntohs(tvb, offset);
6727 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6730 pdu_no = tvb_get_guint8(tvb, offset);
6731 proto_tree_add_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, pdu_no);
6734 next_hdr = tvb_get_guint8(tvb, offset);
6735 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6744 if (gtp_hdr.message != GTP_MSG_TPDU) {
6745 /* TODO: This code should be cleaned up to handle more than one
6746 * header and possibly display the header content */
6751 /* MBMS support indication */
6752 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MBMS support indication header ---]");
6756 /* MS Info Change Reporting support indication */
6757 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MS Info Change Reporting support indication header ---]");
6761 /* PDCP PDU number */
6762 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- PDCP PDU number header ---]");
6766 /* Suspend Request */
6767 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Request header ---]");
6771 /* Suspend Response */
6772 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Response header ---]");
6776 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Unknown extension header ---]");
6780 next_hdr = tvb_get_guint8(tvb, offset);
6781 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6784 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[--- end of GTP header, beginning of extension headers ---]");
6785 length = tvb_length(tvb);
6786 mandatory = 0; /* check order of GTP fields against ETSI */
6788 if (offset >= length)
6791 ext_hdr_val = next_hdr;
6794 ext_hdr_val = tvb_get_guint8(tvb, offset);
6795 if (g_gtp_etsi_order) {
6796 checked_field = check_field_presence(gtp_hdr.message, ext_hdr_val, (int *) &mandatory);
6797 switch (checked_field) {
6799 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] message not found");
6802 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] field not present");
6807 proto_tree_add_text(gtp_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s",
6808 val_to_str_ext_const(checked_field, >p_val_ext, "Unknown extension field"));
6814 while (gtpopt[++i].optcode)
6815 if (gtpopt[i].optcode == ext_hdr_val)
6817 offset = offset + (*gtpopt[i].decode) (tvb, offset, pinfo, gtp_tree);
6820 /*Use sequence number to track Req/Resp pairs*/
6822 gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr.message);
6823 /*pass packet to tap for response time reporting*/
6825 tap_queue_packet(gtp_tap,pinfo,gcrp);
6829 proto_item_set_len (ti, offset);
6832 if ((gtp_hdr.message == GTP_MSG_TPDU) && g_gtp_tpdu) {
6836 else if (gtp_version == 1) {
6837 if (gtp_hdr.flags & 0x07) {
6839 if (tvb_get_guint8(tvb, offset) == 0)
6846 sub_proto = tvb_get_guint8(tvb, offset);
6848 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
6849 /* this is most likely an IPv4 packet
6850 * we can exclude 0x40 - 0x44 because the minimum header size is 20 octets
6851 * 0x4f is excluded because PPP protocol type "IPv6 header compression"
6852 * with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
6854 next_tvb = tvb_new_subset_remaining(tvb, offset);
6855 call_dissector(ip_handle, next_tvb, pinfo, tree);
6857 } else if ((sub_proto & 0xf0) == 0x60) {
6858 /* this is most likely an IPv6 packet */
6859 next_tvb = tvb_new_subset_remaining(tvb, offset);
6860 call_dissector(ipv6_handle, next_tvb, pinfo, tree);
6862 /* this seems to be a PPP packet */
6864 if (sub_proto == 0xff) {
6865 /* this might be an address field, even it shouldn't be here */
6866 control_field = tvb_get_guint8(tvb, offset + 1);
6867 if (control_field == 0x03)
6868 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
6872 next_tvb = tvb_new_subset_remaining(tvb, offset + acfield_len);
6873 call_dissector(ppp_handle, next_tvb, pinfo, tree);
6876 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <");
6877 col_append_str(pinfo->cinfo, COL_PROTOCOL, ">");
6879 pinfo->private_data = pd_save;
6882 static void dissect_gtpprim(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6885 dissect_gtp_common(tvb, pinfo, tree);
6888 static void dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6892 * If this is GTPv2-C call the gtpv2 dissector if present
6893 * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
6895 version = tvb_get_guint8(tvb,0)>>5;
6897 /* GTPv2-C 3GPP TS 29.274 */
6899 call_dissector(gtpv2_handle, tvb, pinfo, tree);
6904 proto_tree_add_text(tree, tvb, 0, -1, "No WS dissector for GTP version %u %s", version,
6905 val_to_str_const(version, ver_types, "Unknown"));
6909 dissect_gtp_common(tvb, pinfo, tree);
6914 static const true_false_string yes_no_tfs = {
6919 static void gtp_reinit(void)
6921 gtp_conv_info_t *gtp_info;
6923 /* Free up state attached to the gtp_info structures */
6924 for (gtp_info = gtp_info_items; gtp_info != NULL; ) {
6925 gtp_conv_info_t *next;
6927 g_hash_table_destroy(gtp_info->matched);
6928 gtp_info->matched=NULL;
6929 g_hash_table_destroy(gtp_info->unmatched);
6930 gtp_info->unmatched=NULL;
6932 next = gtp_info->next;
6937 gtp_info_items = NULL;
6940 void proto_register_gtp(void)
6942 static hf_register_info hf_gtp[] = {
6944 {&hf_gtp_response_in,
6945 {"Response In", "gtp.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this GTP request is in this frame", HFILL}},
6946 {&hf_gtp_response_to,
6947 {"Response To", "gtp.response_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the GTP request in this frame", HFILL}},
6948 {&hf_gtp_time, {"Time", "gtp.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL}},
6949 {&hf_gtp_apn, {"APN", "gtp.apn", FT_STRING, BASE_NONE, NULL, 0, "Access Point Name", HFILL}},
6950 {&hf_gtp_cause, {"Cause", "gtp.cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0, "Cause of operation", HFILL}},
6951 {&hf_gtp_chrg_char, {"Charging characteristics", "gtp.chrg_char", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}},
6952 {&hf_gtp_chrg_char_s, {"Spare", "gtp.chrg_char_s", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, NULL, HFILL}},
6953 {&hf_gtp_chrg_char_n, {"Normal charging", "gtp.chrg_char_n", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, NULL, HFILL}},
6954 {&hf_gtp_chrg_char_p, {"Prepaid charging", "gtp.chrg_char_p", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, NULL, HFILL}},
6955 {&hf_gtp_chrg_char_f,
6956 {"Flat rate charging", "gtp.chrg_char_f", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, NULL, HFILL}},
6957 {&hf_gtp_chrg_char_h,
6958 {"Hot billing charging", "gtp.chrg_char_h", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, NULL, HFILL}},
6959 {&hf_gtp_chrg_char_r, {"Reserved", "gtp.chrg_char_r", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, NULL, HFILL}},
6960 {&hf_gtp_chrg_id, {"Charging ID", "gtp.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
6961 {&hf_gtp_chrg_ipv4, {"CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Charging Gateway address IPv4", HFILL}},
6962 {&hf_gtp_chrg_ipv6, {"CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Charging Gateway address IPv6", HFILL}},
6963 {&hf_gtp_ext_flow_label, {"Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL}},
6964 {&hf_gtp_ext_id, {"Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0, NULL, HFILL}},
6965 {&hf_gtp_ext_val, {"Extension value", "gtp.ext_val", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL}},
6966 {&hf_gtp_flags, {"Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL}},
6968 {"Version", "gtp.flags.version",
6969 FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
6970 "GTP Version", HFILL}
6972 {&hf_gtp_prime_flags_ver,
6973 {"Version", "gtp.prim.flags.version",
6974 FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK,
6975 "GTP' Version", HFILL}
6978 {"Protocol type", "gtp.flags.payload",
6979 FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
6982 {&hf_gtp_flags_spare1,
6983 {"Reserved", "gtp.flags.reserved",
6984 FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
6985 "Reserved (shall be sent as '111' )", HFILL}
6988 {"Is SNDCP N-PDU included?", "gtp.flags.snn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_SNN_MASK,
6989 "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}},
6990 {&hf_gtp_flags_spare2,
6991 {"Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, "Reserved (shall be sent as '1' )", HFILL}},
6993 {"Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_E_MASK,
6994 "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}},
6996 {"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)",
6999 {"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)",
7001 {&hf_gtp_flow_ii, {"Flow Label Data II", "gtp.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL}},
7002 {&hf_gtp_flow_label, {"Flow label", "gtp.flow_label", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
7003 {&hf_gtp_flow_sig, {"Flow label Signalling", "gtp.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
7004 {&hf_gtp_gsn_addr_len,
7005 {"GSN Address Length", "gtp.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, NULL, HFILL}},
7006 {&hf_gtp_gsn_addr_type,
7007 {"GSN Address Type", "gtp.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, NULL, HFILL}},
7008 {&hf_gtp_gsn_ipv4, {"GSN address IPv4", "gtp.gsn_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
7009 {&hf_gtp_gsn_ipv6, {"GSN address IPv6", "gtp.gsn_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
7010 {&hf_gtp_imsi, {"IMSI", "gtp.imsi", FT_STRING, BASE_NONE, NULL, 0, "International Mobile Subscriber Identity number", HFILL}},
7011 {&hf_gtp_length, {"Length", "gtp.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL}},
7012 {&hf_gtp_map_cause, {"MAP cause", "gtp.map_cause", FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0, NULL, HFILL}},
7013 {&hf_gtp_message_type, {"Message Type", "gtp.message", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &message_type_ext, 0x0, "GTP Message Type", HFILL}},
7015 {"MS not reachable reason", "gtp.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, NULL, HFILL}},
7016 {&hf_gtp_ms_valid, {"MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
7017 {&hf_gtp_msisdn, {"MSISDN", "gtp.msisdn", FT_STRING, BASE_NONE, NULL, 0, "MS international PSTN/ISDN number", HFILL}},
7019 {"Next extension header type", "gtp.next", FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, NULL,
7021 {&hf_gtp_node_ipv4, {"Node address IPv4", "gtp.node_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Recommended node address IPv4", HFILL}},
7022 {&hf_gtp_node_ipv6, {"Node address IPv6", "gtp.node_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Recommended node address IPv6", HFILL}},
7023 {&hf_gtp_npdu_number, {"N-PDU Number", "gtp.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
7024 {&hf_gtp_nsapi, {"NSAPI", "gtp.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL}},
7025 {&hf_gtp_qos_version, {"Version", "gtp.qos_version", FT_STRING, BASE_NONE, NULL, 0, "Version of the QoS Profile", HFILL}},
7026 {&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}},
7028 {"QoS delay", "gtp.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL}},
7029 {&hf_gtp_qos_reliability,
7030 {"QoS reliability", "gtp.qos_reliability", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
7031 "Quality of Service Reliability Class", HFILL}},
7033 {"QoS peak", "gtp.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL}},
7034 {&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}},
7035 {&hf_gtp_qos_precedence,
7036 {"QoS precedence", "gtp.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
7037 "Quality of Service Precedence Class", HFILL}},
7038 {&hf_gtp_qos_spare3,
7039 {"Spare", "gtp.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL}},
7041 {"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}},
7042 {&hf_gtp_qos_al_ret_priority,
7043 {"Allocation/Retention priority", "gtp.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
7044 {&hf_gtp_qos_traf_class,
7045 {"Traffic class", "gtp.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, NULL, HFILL}},
7046 {&hf_gtp_qos_del_order,
7047 {"Delivery order", "gtp.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, NULL, HFILL}},
7048 {&hf_gtp_qos_del_err_sdu,
7049 {"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,
7051 {&hf_gtp_qos_max_sdu_size,
7052 {"Maximum SDU size", "gtp.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, NULL, HFILL}},
7053 {&hf_gtp_qos_max_ul,
7054 {"Maximum bit rate for uplink", "gtp.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, NULL, HFILL}},
7055 {&hf_gtp_qos_max_dl,
7056 {"Maximum bit rate for downlink", "gtp.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, NULL, HFILL}},
7057 {&hf_gtp_qos_res_ber,
7058 {"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}},
7059 {&hf_gtp_qos_sdu_err_ratio,
7060 {"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,
7062 {&hf_gtp_qos_trans_delay,
7063 {"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}},
7064 {&hf_gtp_qos_traf_handl_prio,
7065 {"Traffic handling priority", "gtp.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
7067 {&hf_gtp_qos_guar_ul,
7068 {"Guaranteed bit rate for uplink", "gtp.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, NULL, HFILL}},
7069 {&hf_gtp_qos_guar_dl,
7070 {"Guaranteed bit rate for downlink", "gtp.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, NULL,
7072 {&hf_gtp_qos_src_stat_desc,
7073 {"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}},
7074 {&hf_gtp_qos_sig_ind,
7075 {"Signalling Indication", "gtp.sig_ind", FT_BOOLEAN, 8, TFS(>p_sig_ind), GTP_EXT_QOS_SIG_IND_MASK, NULL, HFILL}},
7076 {&hf_gtp_pkt_flow_id, {"Packet Flow ID", "gtp.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
7077 {&hf_gtp_ptmsi, {"P-TMSI", "gtp.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL}},
7078 {&hf_gtp_ptmsi_sig, {"P-TMSI Signature", "gtp.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL}},
7079 {&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}},
7080 {&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}},
7081 {&hf_gtp_rab_pdu_dn,
7082 {"Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL}},
7083 {&hf_gtp_rab_pdu_up,
7084 {"Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL}},
7085 {&hf_gtp_rai_mcc, {"MCC", "gtp.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL}},
7086 {&hf_gtp_rai_mnc, {"MNC", "gtp.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL}},
7087 {&hf_gtp_rai_rac, {"RAC", "gtp.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL}},
7088 {&hf_gtp_rai_lac, {"LAC", "gtp.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL}},
7089 {&hf_gtp_ranap_cause, {"RANAP cause", "gtp.ranap_cause", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0, NULL, HFILL}},
7090 {&hf_gtp_recovery, {"Recovery", "gtp.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL}},
7091 {&hf_gtp_reorder, {"Reordering required", "gtp.reorder", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
7092 {&hf_gtp_rnc_ipv4, {"RNC address IPv4", "gtp.rnc_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Radio Network Controller address IPv4", HFILL}},
7093 {&hf_gtp_rnc_ipv6, {"RNC address IPv6", "gtp.rnc_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Radio Network Controller address IPv6", HFILL}},
7094 {&hf_gtp_rp, {"Radio Priority", "gtp.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL}},
7096 {"NSAPI in Radio Priority", "gtp.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
7097 "Network layer Service Access Point Identifier in Radio Priority", HFILL}},
7098 {&hf_gtp_rp_sms, {"Radio Priority SMS", "gtp.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL}},
7099 {&hf_gtp_rp_spare, {"Reserved", "gtp.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL}},
7101 {"Selection mode", "gtp.sel_mode",
7102 FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03,
7105 {&hf_gtp_seq_number, {"Sequence number", "gtp.seq_number", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
7106 {&hf_gtp_sndcp_number, {"SNDCP N-PDU LLC Number", "gtp.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
7107 {&hf_gtp_tear_ind, {"Teardown Indicator", "gtp.tear_ind", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
7108 {&hf_gtp_teid, {"TEID", "gtp.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL}},
7109 {&hf_gtp_teid_cp, {"TEID Control Plane", "gtp.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL}},
7110 {&hf_gtp_ulink_teid_cp,
7111 {"Uplink TEID Control Plane", "gtp.ulink_teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}},
7112 {&hf_gtp_teid_data, {"TEID Data I", "gtp.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL}},
7113 {&hf_gtp_ulink_teid_data,
7114 {"Uplink TEID Data I", "gtp.ulink_teid_data", FT_UINT32, BASE_HEX, NULL, 0, "UplinkTunnel Endpoint Identifier Data I", HFILL}},
7115 {&hf_gtp_teid_ii, {"TEID Data II", "gtp.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL}},
7117 {"TFT operation code", "gtp.tft_code", FT_UINT8, BASE_DEC, VALS(tft_code_type), GTPv1_TFT_CODE_MASK, NULL, HFILL}},
7118 {&hf_gtp_tft_spare, {"TFT spare bit", "gtp.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, NULL, HFILL}},
7119 {&hf_gtp_tft_number,
7120 {"Number of packet filters", "gtp.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, NULL, HFILL}},
7121 {&hf_gtp_tft_eval, {"Evaluation precedence", "gtp.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
7122 {&hf_gtp_tid, {"TID", "gtp.tid", FT_STRING, BASE_NONE, NULL, 0, "Tunnel Identifier", HFILL}},
7123 {&hf_gtp_tlli, {"TLLI", "gtp.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL}},
7124 {&hf_gtp_tr_comm, {"Packet transfer command", "gtp.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL}},
7125 {&hf_gtp_trace_ref, {"Trace reference", "gtp.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
7126 {&hf_gtp_trace_type, {"Trace type", "gtp.trace_type", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
7127 {&hf_gtp_unknown, {"Unknown data (length)", "gtp.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL}},
7128 {&hf_gtp_user_addr_pdp_org,
7129 {"PDP type organization", "gtp.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, NULL, HFILL}},
7130 {&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}},
7131 {&hf_gtp_user_ipv4, {"End user address IPv4", "gtp.user_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
7132 {&hf_gtp_user_ipv6, {"End user address IPv6", "gtp.user_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
7133 {&hf_gtp_security_mode,
7134 {"Security Mode", "gtp.security_mode",
7135 FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
7138 {&hf_gtp_no_of_vectors,
7139 {"No of Vectors", "gtp.no_of_vectors",
7140 FT_UINT8, BASE_DEC, NULL, 0x38,
7143 {&hf_gtp_cipher_algorithm,
7144 {"Cipher Algorithm", "gtp.no_of_vectors",
7145 FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
7149 {"Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
7150 FT_UINT8, BASE_DEC, NULL, 0x07,
7154 {"Ciphering Key Sequence Number (CKSN)", "gtp.cksn_ksi",
7155 FT_UINT8, BASE_DEC, NULL, 0x07,
7159 {"Key Set Identifier (KSI)", "gtp.cksn_ksi",
7160 FT_UINT8, BASE_DEC, NULL, 0x07,
7163 {&hf_gtp_ext_length,
7164 {"Length", "gtp.ext_length",
7165 FT_UINT16, BASE_DEC, NULL, 0x0,
7168 {&hf_gtp_ext_apn_res,
7169 {"Restriction Type", "gtp.ext_apn_res",
7170 FT_UINT8, BASE_DEC, NULL, 0x0,
7173 {&hf_gtp_ext_rat_type,
7174 {"RAT Type", "gtp.ext_rat_type",
7175 FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
7178 {&hf_gtp_ext_geo_loc_type,
7179 {"Geographic Location Type", "gtp.ext_geo_loc_type",
7180 FT_UINT8, BASE_DEC, NULL, 0x0,
7184 {"SAC", "gtp.ext_sac",
7185 FT_UINT16, BASE_HEX, NULL, 0x0,
7188 {&hf_gtp_ext_imeisv,
7189 {"IMEI(SV)", "gtp.ext_imeisv",
7190 FT_STRING, BASE_NONE, NULL, 0x0,
7193 { &hf_gtp_targetRNC_ID,
7194 { "targetRNC-ID", "gtp.targetRNC_ID",
7195 FT_NONE, BASE_NONE, NULL, 0,
7197 {&hf_gtp_bssgp_cause,
7198 {"BSSGP Cause", "gtp.bssgp_cause",
7199 FT_UINT8, BASE_DEC, VALS(tab_cause), 0,
7202 {"PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
7203 FT_UINT8, BASE_DEC, NULL, 0x0F,
7205 {&hf_gtp_xid_par_len,
7206 {"PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
7207 FT_UINT8, BASE_DEC, NULL, 0xFF,
7208 "XID parameter length", HFILL}},
7210 {"PVI Pre-emption Vulnerability", "gtp.EARP_pre_emption_par_vulnerability",
7211 FT_UINT8, BASE_DEC, NULL, 0x01,
7214 {"PL Priority Level", "gtp.EARP_priority_level",
7215 FT_UINT8, BASE_DEC, NULL, 0x3C,
7218 {"PCI Pre-emption Capability", "gtp.EARP_pre_emption_Capability",
7219 FT_UINT8, BASE_DEC, NULL, 0x40,
7222 {"Application Identifier", "gtp.cdr_app",
7223 FT_UINT8, BASE_DEC, NULL, 0xf0,
7226 {"Release Identifier", "gtp.cdr_rel",
7227 FT_UINT8, BASE_DEC, NULL, 0x0f,
7230 {"Version Identifier", "gtp.cdr_ver",
7231 FT_UINT8, BASE_DEC, NULL, 0x0,
7234 {"Spare", "gtp.spare",
7235 FT_UINT8, BASE_DEC, NULL, 0x02,
7237 {&hf_gtp_cmn_flg_ppc,
7238 {"Prohibit Payload Compression", "gtp.cmn_flg.ppc",
7239 FT_BOOLEAN, 8, NULL, 0x01,
7241 {&hf_gtp_cmn_flg_mbs_srv_type,
7242 {"MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
7243 FT_BOOLEAN, 8, NULL, 0x02,
7245 {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
7246 {"RAN Procedures Ready", "gtp.cmn_flg.ran_pcd_rd",
7247 FT_BOOLEAN, 8, NULL, 0x04,
7249 {&hf_gtp_cmn_flg_mbs_cnt_inf,
7250 {"MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
7251 FT_BOOLEAN, 8, NULL, 0x08,
7253 {&hf_gtp_cmn_flg_no_qos_neg,
7254 {"No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
7255 FT_BOOLEAN, 8, NULL, 0x10,
7257 {&hf_gtp_cmn_flg_nrsn,
7258 {"NRSN bit field", "gtp.cmn_flg.nrsn",
7259 FT_BOOLEAN, 8, NULL, 0x20,
7261 {&hf_gtp_cmn_flg_upgrd_qos_sup,
7262 {"Upgrade QoS Supported", "gtp.cmn_flg.ran_pcd_rd",
7263 FT_BOOLEAN, 8, NULL, 0x40,
7266 {"Temporary Mobile Group Identity (TMGI)", "gtp.cmn_flg.ran_pcd_rd",
7267 FT_BYTES, BASE_NONE, NULL, 0x0,
7269 {&hf_gtp_no_of_mbms_sa_codes,
7270 {"Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
7271 FT_UINT8, BASE_DEC, NULL, 0x0,
7272 "Number N of MBMS service area codes", HFILL}
7274 {&hf_gtp_mbms_ses_dur_days,
7275 {"Estimated session duration days", "gtp.mbms_ses_dur_days",
7276 FT_UINT8, BASE_DEC, NULL, 0xfe,
7279 {&hf_gtp_mbms_ses_dur_s,
7280 {"Estimated session duration seconds", "gtp.mbms_ses_dur_s",
7281 FT_UINT24, BASE_DEC, NULL, 0x01ffff,
7284 {&hf_gtp_mbms_sa_code,
7285 {"MBMS service area code", "gtp.mbms_sa_code",
7286 FT_UINT16, BASE_DEC, NULL, 0x0,
7289 {&hf_gtp_mbs_2g_3g_ind,
7290 {"MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
7291 FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
7294 {&hf_gtp_time_2_dta_tr,
7295 {"Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
7296 FT_UINT8, BASE_DEC, NULL, 0x0,
7300 {"Error Indication (EI)", "gtp.ei",
7301 FT_UINT8, BASE_DEC, NULL, 0x04,
7305 {"GPRS-CSI (GCSI)", "gtp.gcsi",
7306 FT_UINT8, BASE_DEC, NULL, 0x02,
7310 {"Direct Tunnel Indicator (DTI)", "gtp.dti",
7311 FT_UINT8, BASE_DEC, NULL, 0x01,
7314 { &hf_gtp_ra_prio_lcs,
7315 {"Radio Priority LCS", "gtp.raplcs",
7316 FT_UINT8, BASE_DEC, NULL, 0x07,
7320 {"Bearer Control Mode", "gtp.bcm",
7321 FT_UINT8, BASE_DEC, VALS(gtp_pdp_bcm_type_vals), 0,
7326 static gint *ett_gtp_array[] = {
7336 &ett_gtp_pkt_flow_id,
7358 &ett_gtp_ext_tree_apn_res,
7359 &ett_gtp_ext_rat_type,
7360 &ett_gtp_ext_imeisv,
7361 &ett_gtp_ext_ran_tr_cont,
7362 &ett_gtp_ext_pdp_cont_prio,
7363 &ett_gtp_ext_ssgn_no,
7364 &ett_gtp_ext_rab_setup_inf,
7365 &ett_gtp_ext_common_flgs,
7366 &ett_gtp_ext_usr_loc_inf,
7367 &ett_gtp_ext_ms_time_zone,
7368 &ett_gtp_ext_camel_chg_inf_con,
7369 &ett_GTP_EXT_MBMS_UE_CTX,
7372 &ett_gtp_ext_rim_ra,
7373 &ett_gtp_ext_mbms_prot_conf_opt,
7374 &ett_gtp_ext_mbms_sa,
7375 &ett_gtp_ext_bms_ses_dur,
7376 &ett_gtp_ext_src_rnc_pdp_ctx_inf,
7377 &ett_gtp_ext_add_trs_inf,
7378 &ett_gtp_ext_hop_count,
7379 &ett_gtp_ext_sel_plmn_id,
7380 &ett_gtp_ext_mbms_ses_id,
7381 &ett_gtp_ext_mbms_2g_3g_ind,
7382 &ett_gtp_ext_enh_nsapi,
7383 &ett_gtp_ext_ad_mbms_trs_inf,
7384 &ett_gtp_ext_mbms_ses_id_rep_no,
7385 &ett_gtp_ext_mbms_time_to_data_tr,
7386 &ett_gtp_ext_ps_ho_req_ctx,
7387 &ett_gtp_ext_bss_cont,
7388 &ett_gtp_ext_cell_id,
7389 &ett_gtp_ext_pdu_no,
7390 &ett_gtp_ext_bssgp_cause,
7391 &ett_gtp_ext_ra_prio_lcs,
7392 &ett_gtp_ext_ps_handover_xid,
7394 &ett_gtp_utran_cont,
7400 module_t *gtp_module;
7402 proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
7403 proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
7404 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
7406 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
7408 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 and GTP' port", "GTPv0 and GTP' port (default 3386)", 10, &g_gtpv0_port);
7409 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,
7411 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
7413 prefs_register_bool_preference(gtp_module, "dissect_tpdu", "Dissect T-PDU", "Dissect T-PDU", &g_gtp_tpdu);
7415 prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
7416 prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
7417 prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
7418 prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
7419 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
7421 /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
7422 * The preference is set to TRUE by default forbackward compatibility
7424 prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
7426 register_dissector("gtp", dissect_gtp, proto_gtp);
7427 register_dissector("gtpprim", dissect_gtpprim, proto_gtp);
7429 register_init_routine(gtp_reinit);
7430 gtp_tap=register_tap("gtp");
7432 /* TS 132 295 V9.0.0 (2010-02)
7434 * - The UDP Destination Port may be the server port number 3386 which has been reserved for GTP'.
7435 * Alternatively another port can be used, which has been configured by O&M, except Port Number 2123
7436 * which is used by GTPv2-C.
7438 * The TCP Destination Port may be the server port number 3386, which has been reserved for G-PDUs. Alternatively,
7439 * another port may be used as configured by O&M. Extra implementation-specific destination ports are possible but
7440 * all CGFs shall support the server port number.
7443 void proto_reg_handoff_gtp(void)
7445 static gboolean Initialized = FALSE;
7446 static dissector_handle_t gtp_handle, gtp_prim_handle;
7447 static gboolean gtp_over_tcp;
7448 static guint gtpv0_port;
7449 static guint gtpv1c_port;
7450 static guint gtpv1u_port;
7453 gtp_handle = find_dissector("gtp");
7454 gtp_prim_handle = find_dissector("gtpprim");
7455 ppp_subdissector_table = find_dissector_table("ppp.protocol");
7457 radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
7458 radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
7459 radius_register_avp_dissector(VENDOR_THE3GPP, 22, dissect_radius_user_loc);
7463 ip_handle = find_dissector("ip");
7464 ipv6_handle = find_dissector("ipv6");
7465 ppp_handle = find_dissector("ppp");
7466 data_handle = find_dissector("data");
7467 gtpcdr_handle = find_dissector("gtpcdr");
7468 sndcpxid_handle = find_dissector("sndcpxid");
7469 gtpv2_handle = find_dissector("gtpv2");
7470 bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
7471 /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
7472 dissector_add_uint("diameter.3gpp", 5, new_create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
7473 /* AVP Code: 904 MBMS-Session-Duration */
7474 dissector_add_uint("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
7475 /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
7476 dissector_add_uint("diameter.3gpp", 911, new_create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
7480 dissector_delete_uint("udp.port", gtpv0_port, gtp_prim_handle);
7481 dissector_delete_uint("udp.port", gtpv1c_port, gtp_handle);
7482 dissector_delete_uint("udp.port", gtpv1u_port, gtp_handle);
7485 dissector_delete_uint("tcp.port", gtpv0_port, gtp_prim_handle);
7486 dissector_delete_uint("tcp.port", gtpv1c_port, gtp_handle);
7487 dissector_delete_uint("tcp.port", gtpv1u_port, gtp_handle);
7491 gtp_over_tcp = g_gtp_over_tcp;
7492 gtpv0_port = g_gtpv0_port;
7493 gtpv1c_port = g_gtpv1c_port;
7494 gtpv1u_port = g_gtpv1u_port;
7496 dissector_add_uint("udp.port", g_gtpv0_port, gtp_prim_handle);
7497 dissector_add_uint("udp.port", g_gtpv1c_port, gtp_handle);
7498 dissector_add_uint("udp.port", g_gtpv1u_port, gtp_handle);
7500 if (g_gtp_over_tcp) {
7501 dissector_add_uint("tcp.port", g_gtpv0_port, gtp_prim_handle);
7502 dissector_add_uint("tcp.port", g_gtpv1c_port, gtp_handle);
7503 dissector_add_uint("tcp.port", g_gtpv1u_port, gtp_handle);
7508 * Editor modelines - http://www.wireshark.org/tools/modelines.html
7513 * indent-tabs-mode: nil
7516 * vi: set shiftwidth=4 tabstop=8 expandtab
7517 * :indentSize=4:tabSize=8:noTabs=true: