3 * Routines for GTP dissection
4 * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
5 * Nicolas Balkota <balkota@mac.com>
7 * Updates and corrections:
8 * Copyright 2006 - 2009, Anders Broman <anders.broman@ericsson.com>
12 * Control Plane Request-Response tracking code Largely based on similar routines in
13 * packet-ldap.c by Ronnie Sahlberg
14 * Added by Kari Tiirikainen <kari.tiirikainen@nsn.com>
17 * Wireshark - Network traffic analyzer
18 * By Gerald Combs <gerald@wireshark.org>
19 * Copyright 1998 Gerald Combs
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation; either version 2
24 * of the License, or (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 * Ref: 3GPP TS 29.060 version 6.8.0 Release 6
47 #include <epan/conversation.h>
48 #include <epan/packet.h>
49 #include <epan/prefs.h>
50 #include <epan/expert.h>
51 #include <epan/sminmpec.h>
52 #include <epan/asn1.h>
54 #include "packet-ipv6.h"
55 #include "packet-ppp.h"
56 #include "packet-radius.h"
57 #include "packet-bssap.h"
58 #include "packet-gsm_a_common.h"
59 #include "packet-gsm_map.h"
60 #include "packet-per.h"
61 #include "packet-ranap.h"
62 #include "packet-bssgp.h"
63 #include "packet-gtp.h"
65 static dissector_table_t ppp_subdissector_table;
67 #define GTPv0_PORT 3386
68 #define GTPv1C_PORT 2123 /* 3G Control PDU */
69 #define GTPv1U_PORT 2152 /* 3G T-PDU */
71 #define GTPv0_HDR_LENGTH 20
72 #define GTPv1_HDR_LENGTH 12
73 #define GTP_PRIME_HDR_LENGTH 6
75 /* to check compliance with ETSI */
76 #define GTP_MANDATORY 1
77 #define GTP_OPTIONAL 2
78 #define GTP_CONDITIONAL 4
80 static gboolean g_gtp_over_tcp = TRUE;
81 static guint g_gtpv0_port = GTPv0_PORT;
82 static guint g_gtpv1c_port = GTPv1C_PORT;
83 static guint g_gtpv1u_port = GTPv1U_PORT;
85 void proto_reg_handoff_gtp(void);
87 static int proto_gtp = -1;
90 static int hf_gtp_response_in = -1;
91 static int hf_gtp_response_to = -1;
92 static int hf_gtp_time = -1;
93 static int hf_gtp_apn = -1;
94 static int hf_gtp_cause = -1;
95 static int hf_gtp_chrg_char = -1;
96 static int hf_gtp_chrg_char_s = -1;
97 static int hf_gtp_chrg_char_n = -1;
98 static int hf_gtp_chrg_char_p = -1;
99 static int hf_gtp_chrg_char_f = -1;
100 static int hf_gtp_chrg_char_h = -1;
101 static int hf_gtp_chrg_char_r = -1;
102 static int hf_gtp_chrg_id = -1;
103 static int hf_gtp_chrg_ipv4 = -1;
104 static int hf_gtp_chrg_ipv6 = -1;
105 static int hf_gtp_ext_flow_label = -1;
106 static int hf_gtp_ext_id = -1;
107 static int hf_gtp_ext_val = -1;
108 static int hf_gtp_flags = -1;
109 static int hf_gtp_flags_ver = -1;
110 static int hf_gtp_flags_pt = -1;
111 static int hf_gtp_flags_spare1 = -1;
112 static int hf_gtp_flags_snn = -1;
113 static int hf_gtp_flags_spare2 = -1;
114 static int hf_gtp_flags_e = -1;
115 static int hf_gtp_flags_s = -1;
116 static int hf_gtp_flags_pn = -1;
117 static int hf_gtp_flow_ii = -1;
118 static int hf_gtp_flow_label = -1;
119 static int hf_gtp_flow_sig = -1;
120 static int hf_gtp_gsn_addr_len = -1;
121 static int hf_gtp_gsn_addr_type = -1;
122 static int hf_gtp_gsn_ipv4 = -1;
123 static int hf_gtp_gsn_ipv6 = -1;
124 static int hf_gtp_imsi = -1;
125 static int hf_gtp_length = -1;
126 static int hf_gtp_map_cause = -1;
127 static int hf_gtp_message_type = -1;
128 static int hf_gtp_ms_reason = -1;
129 static int hf_gtp_ms_valid = -1;
130 static int hf_gtp_msisdn = -1;
131 static int hf_gtp_next = -1;
132 static int hf_gtp_npdu_number = -1;
133 static int hf_gtp_node_ipv4 = -1;
134 static int hf_gtp_node_ipv6 = -1;
135 static int hf_gtp_nsapi = -1;
136 static int hf_gtp_ptmsi = -1;
137 static int hf_gtp_ptmsi_sig = -1;
138 static int hf_gtp_qos_version = -1;
139 static int hf_gtp_qos_spare1 = -1;
140 static int hf_gtp_qos_delay = -1;
141 static int hf_gtp_qos_mean = -1;
142 static int hf_gtp_qos_peak = -1;
143 static int hf_gtp_qos_spare2 = -1;
144 static int hf_gtp_qos_precedence = -1;
145 static int hf_gtp_qos_spare3 = -1;
146 static int hf_gtp_qos_reliability = -1;
147 static int hf_gtp_qos_al_ret_priority = -1;
148 static int hf_gtp_qos_traf_class = -1;
149 static int hf_gtp_qos_del_order = -1;
150 static int hf_gtp_qos_del_err_sdu = -1;
151 static int hf_gtp_qos_max_sdu_size = -1;
152 static int hf_gtp_qos_max_ul = -1;
153 static int hf_gtp_qos_max_dl = -1;
154 static int hf_gtp_qos_res_ber = -1;
155 static int hf_gtp_qos_sdu_err_ratio = -1;
156 static int hf_gtp_qos_trans_delay = -1;
157 static int hf_gtp_qos_traf_handl_prio = -1;
158 static int hf_gtp_qos_guar_ul = -1;
159 static int hf_gtp_qos_guar_dl = -1;
160 static int hf_gtp_qos_src_stat_desc = -1;
161 static int hf_gtp_qos_sig_ind = -1;
162 static int hf_gtp_pkt_flow_id = -1;
163 static int hf_gtp_rab_gtpu_dn = -1;
164 static int hf_gtp_rab_gtpu_up = -1;
165 static int hf_gtp_rab_pdu_dn = -1;
166 static int hf_gtp_rab_pdu_up = -1;
167 static int hf_gtp_rai_mcc = -1;
168 static int hf_gtp_rai_mnc = -1;
169 static int hf_gtp_rai_rac = -1;
170 static int hf_gtp_rai_lac = -1;
171 static int hf_gtp_ranap_cause = -1;
172 static int hf_gtp_recovery = -1;
173 static int hf_gtp_reorder = -1;
174 static int hf_gtp_rnc_ipv4 = -1;
175 static int hf_gtp_rnc_ipv6 = -1;
176 static int hf_gtp_rp = -1;
177 static int hf_gtp_rp_nsapi = -1;
178 static int hf_gtp_rp_sms = -1;
179 static int hf_gtp_rp_spare = -1;
180 static int hf_gtp_sel_mode = -1;
181 static int hf_gtp_seq_number = -1;
182 static int hf_gtp_sndcp_number = -1;
183 static int hf_gtp_tear_ind = -1;
184 static int hf_gtp_teid = -1;
185 static int hf_gtp_teid_cp = -1;
186 static int hf_gtp_ulink_teid_cp = -1;
187 static int hf_gtp_teid_data = -1;
188 static int hf_gtp_ulink_teid_data = -1;
189 static int hf_gtp_teid_ii = -1;
190 static int hf_gtp_tft_code = -1;
191 static int hf_gtp_tft_spare = -1;
192 static int hf_gtp_tft_number = -1;
193 static int hf_gtp_tft_eval = -1;
194 static int hf_gtp_tid = -1;
195 static int hf_gtp_tlli = -1;
196 static int hf_gtp_tr_comm = -1;
197 static int hf_gtp_trace_ref = -1;
198 static int hf_gtp_trace_type = -1;
199 static int hf_gtp_unknown = -1;
200 static int hf_gtp_user_addr_pdp_org = -1;
201 static int hf_gtp_user_addr_pdp_type = -1;
202 static int hf_gtp_user_ipv4 = -1;
203 static int hf_gtp_user_ipv6 = -1;
204 static int hf_gtp_security_mode = -1;
205 static int hf_gtp_no_of_vectors = -1;
206 static int hf_gtp_cipher_algorithm = -1;
207 static int hf_gtp_cksn_ksi = -1;
208 static int hf_gtp_cksn = -1;
209 static int hf_gtp_ksi = -1;
210 static int hf_gtp_ext_length = -1;
211 static int hf_gtp_ext_apn_res = -1;
212 static int hf_gtp_ext_rat_type = -1;
213 static int hf_gtp_ext_geo_loc_type = -1;
214 static int hf_gtp_ext_sac = -1;
215 static int hf_gtp_ext_imeisv = -1;
216 static int hf_gtp_targetRNC_ID = -1;
217 static int hf_gtp_bssgp_cause = -1;
218 static int hf_gtp_sapi = -1;
219 static int hf_gtp_xid_par_len = -1;
220 static int hf_gtp_cmn_flg_ppc = -1;
221 static int hf_gtp_cmn_flg_mbs_srv_type = -1;
222 static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy = -1;
223 static int hf_gtp_cmn_flg_mbs_cnt_inf = -1;
224 static int hf_gtp_cmn_flg_nrsn = -1;
225 static int hf_gtp_cmn_flg_no_qos_neg = -1;
226 static int hf_gtp_cmn_flg_upgrd_qos_sup = -1;
227 static int hf_gtp_tmgi = -1;
228 static int hf_gtp_mbms_ses_dur_days = -1;
229 static int hf_gtp_mbms_ses_dur_s = -1;
230 static int hf_gtp_no_of_mbms_sa_codes = -1;
231 static int hf_gtp_mbms_sa_code = -1;
232 static int hf_gtp_mbs_2g_3g_ind = -1;
233 static int hf_gtp_time_2_dta_tr = -1;
234 static int hf_gtp_ext_ei = -1;
235 static int hf_gtp_ext_gcsi = -1;
236 static int hf_gtp_ext_dti = -1;
238 /* Initialize the subtree pointers */
239 static gint ett_gtp = -1;
240 static gint ett_gtp_flags = -1;
241 static gint ett_gtp_ext = -1;
242 static gint ett_gtp_rai = -1;
243 static gint ett_gtp_qos = -1;
244 static gint ett_gtp_auth_tri = -1;
245 static gint ett_gtp_flow_ii = -1;
246 static gint ett_gtp_rab_cntxt = -1;
247 static gint ett_gtp_rp = -1;
248 static gint ett_gtp_pkt_flow_id = -1;
249 static gint ett_gtp_chrg_char = -1;
250 static gint ett_gtp_user = -1;
251 static gint ett_gtp_mm = -1;
252 static gint ett_gtp_trip = -1;
253 static gint ett_gtp_quint = -1;
254 static gint ett_gtp_pdp = -1;
255 static gint ett_gtp_apn = -1;
256 static gint ett_gtp_proto = -1;
257 static gint ett_gtp_gsn_addr = -1;
258 static gint ett_gtp_tft = -1;
259 static gint ett_gtp_tft_pf = -1;
260 static gint ett_gtp_tft_flags = -1;
261 static gint ett_gtp_rab_setup = -1;
262 static gint ett_gtp_hdr_list = -1;
263 static gint ett_gtp_chrg_addr = -1;
264 static gint ett_gtp_node_addr = -1;
265 static gint ett_gtp_rel_pack = -1;
266 static gint ett_gtp_can_pack = -1;
267 static gint ett_gtp_data_resp = -1;
268 static gint ett_gtp_priv_ext = -1;
269 static gint ett_gtp_net_cap = -1;
270 static gint ett_gtp_ext_tree_apn_res = -1;
271 static gint ett_gtp_ext_rat_type = -1;
272 static gint ett_gtp_ext_imeisv = -1;
273 static gint ett_gtp_ext_ran_tr_cont = -1;
274 static gint ett_gtp_ext_pdp_cont_prio = -1;
275 static gint ett_gtp_ext_ssgn_no = -1;
276 static gint ett_gtp_ext_rab_setup_inf = -1;
277 static gint ett_gtp_ext_common_flgs = -1;
278 static gint ett_gtp_ext_usr_loc_inf = -1;
279 static gint ett_gtp_ext_ms_time_zone = -1;
280 static gint ett_gtp_ext_camel_chg_inf_con = -1;
281 static gint ett_GTP_EXT_MBMS_UE_CTX = -1;
282 static gint ett_gtp_ext_tmgi = -1;
283 static gint ett_gtp_tmgi = -1;
284 static gint ett_gtp_ext_rim_ra = -1;
285 static gint ett_gtp_ext_mbms_prot_conf_opt = -1;
286 static gint ett_gtp_ext_mbms_sa = -1;
287 static gint ett_gtp_ext_bms_ses_dur = -1;
288 static gint ett_gtp_ext_src_rnc_pdp_ctx_inf = -1;
289 static gint ett_gtp_ext_add_trs_inf = -1;
290 static gint ett_gtp_ext_hop_count = -1;
291 static gint ett_gtp_ext_sel_plmn_id = -1;
292 static gint ett_gtp_ext_mbms_ses_id = -1;
293 static gint ett_gtp_ext_mbms_2g_3g_ind = -1;
294 static gint ett_gtp_ext_enh_nsapi = -1;
295 static gint ett_gtp_ext_ad_mbms_trs_inf = -1;
296 static gint ett_gtp_ext_mbms_ses_id_rep_no = -1;
297 static gint ett_gtp_ext_mbms_time_to_data_tr = -1;
298 static gint ett_gtp_ext_ps_ho_req_ctx = -1;
299 static gint ett_gtp_ext_bss_cont = -1;
300 static gint ett_gtp_ext_cell_id = -1;
301 static gint ett_gtp_ext_pdu_no = -1;
302 static gint ett_gtp_ext_bssgp_cause = -1;
303 static gint ett_gtp_ext_ra_prio_lcs = -1;
304 static gint ett_gtp_ext_ps_handover_xid = -1;
305 static gint ett_gtp_target_id = -1;
306 static gint ett_gtp_utran_cont = -1;
308 static gboolean g_gtp_tpdu = TRUE;
309 static gboolean g_gtp_etsi_order = FALSE;
311 static int gtp_tap = -1;
313 /* Definition of flags masks */
314 #define GTP_VER_MASK 0xE0
316 static const value_string ver_types[] = {
317 {0, "GTP release 97/98 version"},
318 {1, "GTP release 99 version"},
328 static const value_string pt_types[] = {
334 #define GTP_PT_MASK 0x10
335 #define GTP_SPARE1_MASK 0x0E
336 #define GTP_SPARE2_MASK 0x08
337 #define GTP_E_MASK 0x04
338 #define GTP_S_MASK 0x02
339 #define GTP_SNN_MASK 0x01
340 #define GTP_PN_MASK 0x01
342 static const value_string next_extension_header_fieldvals[] = {
343 {0, "No more extension headers"},
344 {1, "MBMS support indication"},
345 {2, "MS Info Change Reporting support indication"},
346 {0xc0, "PDCP PDU number"},
347 {0xc1, "Suspend Request"},
348 {0xc2, "Suspend Response"},
352 /* Definition of 3G charging characteristics masks */
353 #define GTP_MASK_CHRG_CHAR_S 0xF000
354 #define GTP_MASK_CHRG_CHAR_N 0x0800
355 #define GTP_MASK_CHRG_CHAR_P 0x0400
356 #define GTP_MASK_CHRG_CHAR_F 0x0200
357 #define GTP_MASK_CHRG_CHAR_H 0x0100
358 #define GTP_MASK_CHRG_CHAR_R 0x00FF
360 /* Traffic Flow Templates mask */
361 #define GTPv1_TFT_CODE_MASK 0xE0
362 #define GTPv1_TFT_SPARE_MASK 0x10
363 #define GTPv1_TFT_NUMBER_MASK 0x0F
365 /* Definition of GSN Address masks */
366 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
367 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
369 /* Definition of QoS masks */
370 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
371 #define GTP_EXT_QOS_DELAY_MASK 0x38
372 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
373 #define GTP_EXT_QOS_PEAK_MASK 0xF0
374 #define GTP_EXT_QOS_SPARE2_MASK 0x08
375 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
376 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
377 #define GTP_EXT_QOS_MEAN_MASK 0x1F
378 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
379 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
380 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
381 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
382 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
383 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
384 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
386 /* Definition of Radio Priority's masks */
387 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
388 #define GTPv1_EXT_RP_SPARE_MASK 0x08
389 #define GTPv1_EXT_RP_MASK 0x07
391 static const value_string message_type[] = {
392 {GTP_MSG_UNKNOWN, "For future use"},
393 {GTP_MSG_ECHO_REQ, "Echo request"},
394 {GTP_MSG_ECHO_RESP, "Echo response"},
395 {GTP_MSG_VER_NOT_SUPP, "Version not supported"},
396 {GTP_MSG_NODE_ALIVE_REQ, "Node alive request"},
397 {GTP_MSG_NODE_ALIVE_RESP, "Node alive response"},
398 {GTP_MSG_REDIR_REQ, "Redirection request"},
399 {GTP_MSG_REDIR_RESP, "Redirection response"},
400 {GTP_MSG_CREATE_PDP_REQ, "Create PDP context request"},
401 {GTP_MSG_CREATE_PDP_RESP, "Create PDP context response"},
402 {GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request"},
403 {GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response"},
404 {GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request"},
405 {GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response"},
406 {GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request"},
407 {GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response"},
408 {GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request"},
409 {GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response"},
410 {GTP_MSG_ERR_IND, "Error indication"},
411 {GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request"},
412 {GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response"},
413 {GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request"},
414 {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
415 {GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification"},
416 {GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request"},
417 {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
418 {GTP_MSG_FAIL_REP_REQ, "Failure report request"},
419 {GTP_MSG_FAIL_REP_RESP, "Failure report response"},
420 {GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request"},
421 {GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response"},
422 {GTP_MSG_IDENT_REQ, "Identification request"},
423 {GTP_MSG_IDENT_RESP, "Identification response"},
424 {GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request"},
425 {GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response"},
426 {GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement"},
427 {GTP_MSG_FORW_RELOC_REQ, "Forward relocation request"},
428 {GTP_MSG_FORW_RELOC_RESP, "Forward relocation response"},
429 {GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete"},
430 {GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request"},
431 {GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response"},
432 {GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context"},
433 {GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge"},
434 {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
435 {GTP_MSG_RAN_INFO_RELAY, "RAN Information Relay"},
436 {GTP_MBMS_NOTIFY_REQ, "MBMS Notification Request"},
437 {GTP_MBMS_NOTIFY_RES, "MBMS Notification Response"},
438 {GTP_MBMS_NOTIFY_REJ_REQ, "MBMS Notification Reject Request"},
439 {GTP_MBMS_NOTIFY_REJ_RES, "MBMS Notification Reject Response"},
440 {GTP_CREATE_MBMS_CNTXT_REQ, "Create MBMS Context Request"},
441 {GTP_CREATE_MBMS_CNTXT_RES, "Create MBMS Context Response"},
442 {GTP_UPD_MBMS_CNTXT_REQ, "Update MBMS Context Request"},
443 {GTP_UPD_MBMS_CNTXT_RES, "Update MBMS Context Response"},
444 {GTP_DEL_MBMS_CNTXT_REQ, "Delete MBMS Context Request"},
445 {GTP_DEL_MBMS_CNTXT_RES, "Delete MBMS Context Response"},
446 {GTP_MBMS_REG_REQ, "MBMS Registration Request"},
447 {GTP_MBMS_REG_RES, "MBMS Registration Response"},
448 {GTP_MBMS_DE_REG_REQ, "MBMS De-Registration Request"},
449 {GTP_MBMS_DE_REG_RES, "MBMS De-Registration Response"},
450 {GTP_MBMS_SES_START_REQ, "MBMS Session Start Request"},
451 {GTP_MBMS_SES_START_RES, "MBMS Session Start Response"},
452 {GTP_MBMS_SES_STOP_REQ, "MBMS Session Stop Request"},
453 {GTP_MBMS_SES_STOP_RES, "MBMS Session Stop Response"},
454 {GTP_MBMS_SES_UPD_REQ, "MBMS Session Update Request"},
455 {GTP_MBMS_SES_UPD_RES, "MBMS Session Update Response"},
456 /* 122-127 For future use. Shall not be sent.
457 * If received, shall be treated as an Unknown message.
459 {GTP_MS_INFO_CNG_NOT_REQ, "MS Info Change Notification Request"},
460 {GTP_MS_INFO_CNG_NOT_RES, "MS Info Change Notification Response"},
461 {GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request"},
462 {GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response"},
463 {GTP_MSG_TPDU, "T-PDU"},
467 /* definitions of fields in extension header */
468 #define GTP_EXT_CAUSE 0x01
469 #define GTP_EXT_IMSI 0x02
470 #define GTP_EXT_RAI 0x03
471 #define GTP_EXT_TLLI 0x04
472 #define GTP_EXT_PTMSI 0x05
473 #define GTP_EXT_QOS_GPRS 0x06
474 #define GTP_EXT_REORDER 0x08
475 #define GTP_EXT_AUTH_TRI 0x09
476 #define GTP_EXT_MAP_CAUSE 0x0B
477 #define GTP_EXT_PTMSI_SIG 0x0C
478 #define GTP_EXT_MS_VALID 0x0D
479 #define GTP_EXT_RECOVER 0x0E
480 #define GTP_EXT_SEL_MODE 0x0F
482 #define GTP_EXT_16 0x10
483 #define GTP_EXT_FLOW_LABEL 0x10
484 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
486 #define GTP_EXT_17 0x11
487 #define GTP_EXT_FLOW_SIG 0x11
488 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
490 #define GTP_EXT_18 0x12
491 #define GTP_EXT_FLOW_II 0x12
492 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G */
494 #define GTP_EXT_19 0x13
495 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
496 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G */
498 #define GTP_EXT_NSAPI 0x14 /* 3G */
499 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
500 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
501 #define GTP_EXT_RP_SMS 0x17 /* 3G */
502 #define GTP_EXT_RP 0x18 /* 3G */
503 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
504 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
505 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
506 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
507 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
508 #define GTP_EXT_TR_COMM 0x7E /* charging */
509 #define GTP_EXT_CHRG_ID 0x7F
510 #define GTP_EXT_USER_ADDR 0x80
511 #define GTP_EXT_MM_CNTXT 0x81
512 #define GTP_EXT_PDP_CNTXT 0x82
513 #define GTP_EXT_APN 0x83
514 #define GTP_EXT_PROTO_CONF 0x84
515 #define GTP_EXT_GSN_ADDR 0x85
516 #define GTP_EXT_MSISDN 0x86
517 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
518 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
519 #define GTP_EXT_TFT 0x89 /* 3G */
520 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
521 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
522 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
523 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
524 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G 142 7.7.41 */
525 #define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */
526 #define GTP_EXT_RAN_TR_CONT 0x90 /* 3G 144 TLV RAN Transparent Container 7.7.43 */
527 #define GTP_EXT_PDP_CONT_PRIO 0x91 /* 3G 145 TLV PDP Context Prioritization 7.7.45 */
528 #define GTP_EXT_ADD_RAB_SETUP_INF 0x92 /* 3G 146 TLV Additional RAB Setup Information 7.7.45A */
529 #define GTP_EXT_SSGN_NO 0x93 /* 3G 147 TLV SGSN Number 7.7.47 */
530 #define GTP_EXT_COMMON_FLGS 0x94 /* 3G 148 TLV Common Flags 7.7.48 */
531 #define GTP_EXT_APN_RES 0x95 /* 3G 149 */
532 #define GTP_EXT_RA_PRIO_LCS 0x96 /* 3G 150 TLV Radio Priority LCS 7.7.25B */
533 #define GTP_EXT_RAT_TYPE 0x97 /* 3G 151 TLV RAT Type 7.7.50 */
534 #define GTP_EXT_USR_LOC_INF 0x98 /* 3G 152 TLV User Location Information 7.7.51 */
535 #define GTP_EXT_MS_TIME_ZONE 0x99 /* 3G 153 TLV MS Time Zone 7.7.52 */
537 #define GTP_EXT_IMEISV 0x9A /* 3G */
538 #define GTP_EXT_CAMEL_CHG_INF_CON 0x9B /* 3G 155 TLV CAMEL Charging Information Container 7.7.54 */
539 #define GTP_EXT_MBMS_UE_CTX 0x9C /* 3G 156 TLV MBMS UE Context 7.7.55 */
540 #define GTP_EXT_TMGI 0x9D /* 3G 157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
541 #define GTP_EXT_RIM_RA 0x9E /* 3G 158 TLV RIM Routing Address 7.7.57 */
542 #define GTP_EXT_MBMS_PROT_CONF_OPT 0x9F /* 3G 159 TLV MBMS Protocol Configuration Options 7.7.58 */
543 #define GTP_EXT_MBMS_SA 0xA0 /* 3G 160 TLV MBMS Service Area 7.7.60 */
544 #define GTP_EXT_SRC_RNC_PDP_CTX_INF 0xA1 /* 3G 161 TLV Source RNC PDCP context info 7.7.61 */
545 #define GTP_EXT_ADD_TRS_INF 0xA2 /* 3G 162 TLV Additional Trace Info 7.7.62 */
546 #define GTP_EXT_HOP_COUNT 0xA3 /* 3G 163 TLV Hop Counter 7.7.63 */
547 #define GTP_EXT_SEL_PLMN_ID 0xA4 /* 3G 164 TLV Selected PLMN ID 7.7.64 */
548 #define GTP_EXT_MBMS_SES_ID 0xA5 /* 3G 165 TLV MBMS Session Identifier 7.7.65 */
549 #define GTP_EXT_MBMS_2G_3G_IND 0xA6 /* 3G 166 TLV MBMS 2G/3G Indicator 7.7.66 */
550 #define GTP_EXT_ENH_NSAPI 0xA7 /* 3G 167 TLV Enhanced NSAPI 7.7.67 */
551 #define GTP_EXT_MBMS_SES_DUR 0xA8 /* 3G 168 TLV MBMS Session Duration 7.7.59 */
552 #define GTP_EXT_ADD_MBMS_TRS_INF 0xA9 /* 3G 169 TLV Additional MBMS Trace Info 7.7.68 */
553 #define GTP_EXT_MBMS_SES_ID_REP_NO 0xAA /* 3G 170 TLV MBMS Session Identity Repetition Number 7.7.69 */
554 #define GTP_EXT_MBMS_TIME_TO_DATA_TR 0xAB /* 3G 171 TLV MBMS Time To Data Transfer 7.7.70 */
555 #define GTP_EXT_PS_HO_REQ_CTX 0xAC /* 3G 172 TLV PS Handover Request Context 7.7.71 */
556 #define GTP_EXT_BSS_CONT 0xAD /* 3G 173 TLV BSS Container 7.7.72 */
557 #define GTP_EXT_CELL_ID 0xAE /* 3G 174 TLV Cell Identification 7.7.73 */
558 #define GTP_EXT_PDU_NO 0xAF /* 3G 175 TLV PDU Numbers 7.7.74 */
559 #define GTP_EXT_BSSGP_CAUSE 0xB0 /* 3G 176 TLV BSSGP Cause 7.7.75 */
560 #define GTP_EXT_REQ_MBMS_BEARER_CAP 0xB1 /* 3G 177 TLV Required MBMS bearer capabilities 7.7.76 */
561 #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2 /* 3G 178 TLV RIM Routing Address Discriminator 7.7.77 */
562 #define GTP_EXT_LIST_OF_SETUP_PFCS 0xB3 /* 3G 179 TLV List of set-up PFCs 7.7.78 */
563 #define GTP_EXT_PS_HANDOVER_XIP_PAR 0xB4 /* 3G 180 TLV PS Handover XID Parameters 7.7.79 */
564 #define GTP_EXT_MS_INF_CHG_REP_ACT 0xB5 /* 3G 181 TLV MS Info Change Reporting Action 7.7.80 */
565 #define GTP_EXT_DIRECT_TUNNEL_FLGS 0xB6 /* 3G 182 TLV Direct Tunnel Flags 7.7.81 */
566 #define GTP_EXT_CORRELATION_ID 0xB7 /* 3G 183 TLV Correlation-ID 7.7.82 */
567 #define GTP_EXT_BEARER_CONTROL_MODE 0xB8 /* 3G 184 TLV Bearer Control Mode 7.7.83 */
568 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
570 #define GTP_EXT_C1 0xC1
571 #define GTP_EXT_C2 0xC2
572 #define GTP_EXT_REL_PACK 0xF9 /* charging */
573 #define GTP_EXT_CAN_PACK 0xFA /* charging */
574 #define GTP_EXT_CHRG_ADDR 0xFB /* 3G 251 TLV Charging Gateway Address 7.7.44 */
575 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
576 #define GTP_EXT_DATA_REQ 0xFC /* charging */
577 #define GTP_EXT_DATA_RESP 0xFD /* charging */
578 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
579 #define GTP_EXT_PRIV_EXT 0xFF
581 static const value_string gtp_val[] = {
582 {GTP_EXT_CAUSE, "Cause of operation"},
583 {GTP_EXT_IMSI, "IMSI"},
584 {GTP_EXT_RAI, "Routing Area Identity"},
585 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
586 {GTP_EXT_PTMSI, "Packet TMSI"},
587 {GTP_EXT_QOS_GPRS, "Quality of Service"},
588 {GTP_EXT_REORDER, "Reorder required"},
589 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
590 {GTP_EXT_MAP_CAUSE, "MAP cause"},
591 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
592 {GTP_EXT_MS_VALID, "MS validated"},
593 {GTP_EXT_RECOVER, "Recovery"},
594 {GTP_EXT_SEL_MODE, "Selection mode"},
596 {GTP_EXT_16, "Flow label data I"},
597 {GTP_EXT_FLOW_LABEL, "Flow label data I"},
598 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
600 {GTP_EXT_17, "Flow label signalling"},
601 {GTP_EXT_FLOW_SIG, "Flow label signalling"},
602 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
604 {GTP_EXT_18, "Flow label data II"},
605 {GTP_EXT_FLOW_II, "Flow label data II"},
606 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
608 {GTP_EXT_19, "MS not reachable reason"},
609 {GTP_EXT_MS_REASON, "MS not reachable reason"},
610 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
612 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
613 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
614 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
615 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
616 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
617 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
618 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
619 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
620 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
621 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
622 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
623 {GTP_EXT_CHRG_ID, "Charging ID"},
624 {GTP_EXT_USER_ADDR, "End user address"},
625 {GTP_EXT_MM_CNTXT, "MM context"},
626 {GTP_EXT_PDP_CNTXT, "PDP context"},
627 {GTP_EXT_APN, "Access Point Name"},
628 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
629 {GTP_EXT_GSN_ADDR, "GSN address"},
630 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
631 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
632 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
633 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
634 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
635 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
636 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
637 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
638 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
639 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
641 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
642 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
643 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
644 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
645 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
646 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
647 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
648 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
649 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
650 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
652 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
653 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
654 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
655 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
656 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
657 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
658 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
659 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
660 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
661 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
662 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
663 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
664 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
665 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
666 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
667 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
668 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
669 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
670 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
671 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
672 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
673 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
674 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
675 {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
676 {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
677 {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
678 {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"}, /* 7.7.79 */
679 {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
680 {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
681 {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
682 {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
683 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
684 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
685 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
686 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
687 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
688 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
689 {GTP_EXT_PRIV_EXT, "Private Extension"},
693 /* It seems like some IE's are renamed in gtpv1 at least reading
694 * 3GPP TS 29.060 version 6.11.0 Release 6
696 static const value_string gtpv1_val[] = {
697 {GTP_EXT_CAUSE, "Cause of operation"},
698 {GTP_EXT_IMSI, "IMSI"},
699 {GTP_EXT_RAI, "Routing Area Identity"},
700 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
701 {GTP_EXT_PTMSI, "Packet TMSI"},
702 {GTP_EXT_QOS_GPRS, "Quality of Service"},
703 {GTP_EXT_REORDER, "Reorder required"},
704 {GTP_EXT_AUTH_TRI, "Authentication triplets"},
705 {GTP_EXT_MAP_CAUSE, "MAP cause"},
706 {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
707 {GTP_EXT_MS_VALID, "MS validated"},
708 {GTP_EXT_RECOVER, "Recovery"},
709 {GTP_EXT_SEL_MODE, "Selection mode"},
711 {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
713 {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
715 {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
717 {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
719 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
720 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
721 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
722 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
723 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
724 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
725 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
726 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
727 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
728 {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
729 {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
730 {GTP_EXT_CHRG_ID, "Charging ID"},
731 {GTP_EXT_USER_ADDR, "End user address"},
732 {GTP_EXT_MM_CNTXT, "MM context"},
733 {GTP_EXT_PDP_CNTXT, "PDP context"},
734 {GTP_EXT_APN, "Access Point Name"},
735 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
736 {GTP_EXT_GSN_ADDR, "GSN address"},
737 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
738 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
739 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
740 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
741 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
742 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
743 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
744 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
745 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
746 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
748 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
749 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
750 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
751 {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
752 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
753 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
754 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
755 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
756 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
757 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
759 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
760 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
761 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
762 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
763 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
764 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
765 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
766 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
767 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
768 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
769 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
770 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
771 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
772 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
773 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
774 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
775 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
776 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
777 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
778 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
779 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
780 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
781 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
782 {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
783 {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
784 {GTP_EXT_CHRG_ADDR, "Charging Gateway address"},
785 {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
786 {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
787 {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
788 {GTP_EXT_PRIV_EXT, "Private Extension"},
792 /* GPRS: 9.60 v7.6.0, page 37
793 * UMTS: 29.060 v4.0, page 45
795 static const value_string cause_type[] = {
798 {2, "Request IMSI and IMEI"},
799 {3, "No identity needed"},
801 {5, "MS is not GPRS responding"},
802 {59, "System failure"}, /* charging */
803 {60, "The transmit buffers are becoming full"}, /* charging */
804 {61, "The receive buffers are becoming full"}, /* charging */
805 {62, "Another node is about to go down"}, /* charging */
806 {63, "This node is about to go down"}, /* charging */
807 {128, "Request accepted"},
808 {192, "Non-existent"},
809 {193, "Invalid message format"},
810 {194, "IMSI not known"},
811 {195, "MS is GPRS detached"},
812 {196, "MS is not GPRS responding"},
814 {198, "Version not supported"},
815 {199, "No resource available"},
816 {200, "Service not supported"},
817 {201, "Mandatory IE incorrect"},
818 {202, "Mandatory IE missing"},
819 {203, "Optional IE incorrect"},
820 {204, "System failure"},
821 {205, "Roaming restriction"},
822 {206, "P-TMSI signature mismatch"},
823 {207, "GPRS connection suspended"},
824 {208, "Authentication failure"},
825 {209, "User authentication failed"},
826 {210, "Context not found"},
827 {211, "All PDP dynamic addresses are occupied"},
828 {212, "No memory is available"},
829 {213, "Relocation failure"},
830 {214, "Unknown mandatory extension header"},
831 {215, "Semantic error in the TFT operation"},
832 {216, "Syntactic error in the TFT operation"},
833 {217, "Semantic errors in packet filter(s)"},
834 {218, "Syntactic errors in packet filter(s)"},
835 {219, "Missing or unknown APN"},
836 {220, "Unknown PDP address or PDP type"},
837 {221, "PDP context without TFT already activated"},
838 {222, "APN access denied - no subscription"},
839 {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
840 {224, "MS MBMS Capabilities Insufficient"},
841 {225, "Invalid Correlation-ID"},
842 {226, "MBMS Bearer Context Superseded"},
843 {252, "Request related to possibly duplicated packets already fulfilled"}, /* charging */
844 {253, "Request already fulfilled"}, /* charging */
845 {254, "Sequence numbers of released/cancelled packets IE incorrect"}, /* charging */
846 {255, "Request not fulfilled"}, /* charging */
851 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
852 * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
855 static const value_string gsn_addr_type[] = {
861 static const value_string pdp_type[] = {
870 static const value_string pdp_org_type[] = {
876 static const value_string qos_delay_type[] = {
877 {0x00, "Subscribed delay class (in MS to network direction)"},
878 {0x01, "Delay class 1"},
879 {0x02, "Delay class 2"},
880 {0x03, "Delay class 3"},
881 {0x04, "Delay class 4 (best effort)"},
886 static const value_string qos_reliability_type[] = {
887 {0x00, "Subscribed reliability class (in MS to network direction)"},
888 {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
889 {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
890 {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
891 {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
892 {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
897 static const value_string qos_peak_type[] = {
898 {0x00, "Subscribed peak throughput (in MS to network direction)"},
899 {0x01, "Up to 1 000 oct/s"},
900 {0x02, "Up to 2 000 oct/s"},
901 {0x03, "Up to 4 000 oct/s"},
902 {0x04, "Up to 8 000 oct/s"},
903 {0x05, "Up to 16 000 oct/s"},
904 {0x06, "Up to 32 000 oct/s"},
905 {0x07, "Up to 64 000 oct/s"},
906 {0x08, "Up to 128 000 oct/s"},
907 {0x09, "Up to 256 000 oct/s"},
908 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
918 static const value_string qos_precedence_type[] = {
919 {0x00, "Subscribed precedence (in MS to network direction)"},
920 {0x01, "High priority"},
921 {0x02, "Normal priority"},
922 {0x03, "Low priority"},
927 static const value_string qos_mean_type[] = {
928 {0x00, "Subscribed mean throughput (in MS to network direction)"},
929 {0x01, "100 oct/h"}, /* Class 2 */
930 {0x02, "200 oct/h"}, /* Class 3 */
931 {0x03, "500 oct/h"}, /* Class 4 */
932 {0x04, "1 000 oct/h"}, /* Class 5 */
933 {0x05, "2 000 oct/h"}, /* Class 6 */
934 {0x06, "5 000 oct/h"}, /* Class 7 */
935 {0x07, "10 000 oct/h"}, /* Class 8 */
936 {0x08, "20 000 oct/h"}, /* Class 9 */
937 {0x09, "50 000 oct/h"}, /* Class 10 */
938 {0x0A, "100 000 oct/h"}, /* Class 11 */
939 {0x0B, "200 000 oct/h"}, /* Class 12 */
940 {0x0C, "500 000 oct/h"}, /* Class 13 */
941 {0x0D, "1 000 000 oct/h"}, /* Class 14 */
942 {0x0E, "2 000 000 oct/h"}, /* Class 15 */
943 {0x0F, "5 000 000 oct/h"}, /* Class 16 */
944 {0x10, "10 000 000 oct/h"}, /* Class 17 */
945 {0x11, "20 000 000 oct/h"}, /* Class 18 */
946 {0x12, "50 000 000 oct/h"}, /* Class 19 */
947 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
960 {0x1F, "Best effort"}, /* Class 1 */
964 static const value_string qos_del_err_sdu[] = {
965 {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
966 {0x01, "No detect ('-')"},
967 {0x02, "Erroneous SDUs are delivered ('yes')"},
968 {0x03, "Erroneous SDUs are not delivered ('no')"},
969 {0x07, "Reserved"}, /* All other values are reserved */
973 static const value_string qos_del_order[] = {
974 {0x00, "Subscribed delivery order (in MS to network direction)"},
975 {0x01, "With delivery order ('yes')"},
976 {0x02, "Without delivery order ('no')"},
977 {0x03, "Reserved"}, /* All other values are reserved */
981 static const value_string qos_traf_class[] = {
982 {0x00, "Subscribed traffic class (in MS to network direction)"},
983 {0x01, "Conversational class"},
984 {0x02, "Streaming class"},
985 {0x03, "Interactive class"},
986 {0x04, "Background class"},
987 {0x07, "Reserved"}, /* All other values are reserved */
991 static const value_string qos_max_sdu_size[] = {
992 {0x00, "Subscribed maximum SDU size (in MS to network direction"},
993 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
994 {0x97, "1502 octets"},
995 {0x98, "1510 octets"},
996 {0x99, "1520 octets"},
997 {0, NULL} /* All other values are reserved */
1000 static const value_string qos_max_ul[] = {
1001 {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
1002 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1003 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1004 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1009 static const value_string qos_max_dl[] = {
1010 {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
1011 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1012 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1013 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1018 static const value_string qos_res_ber[] = {
1019 {0x00, "Subscribed residual BER (in MS to network direction)"},
1020 {0x01, "1/20 = 5x10^-2"},
1021 {0x02, "1/100 = 1x10^-2"},
1022 {0x03, "1/200 = 5x10^-3"},
1023 {0x04, "1/250 = 4x10^-3"},
1024 {0x05, "1/1 000 = 1x10^-3"},
1025 {0x06, "1/10 000 = 1x10^-4"},
1026 {0x07, "1/100 000 = 1x10^-5"},
1027 {0x08, "1/1 000 000 = 1x10^-6"},
1028 {0x09, "3/50 000 000 = 6x10^-8"},
1029 {0x0F, "Reserved"}, /* All other values are reserved */
1033 static const value_string qos_sdu_err_ratio[] = {
1034 {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
1035 {0x01, "1/100 = 1x10^-2"},
1036 {0x02, "7/1000 = 7x10^-3"},
1037 {0x03, "1/1 000 = 1x10^-3"},
1038 {0x04, "1/10 000 = 1x10^-4"},
1039 {0x05, "1/100 000 = 1x10^-5"},
1040 {0x06, "1/1 000 000 = 1x10^-6"},
1041 {0x07, "1/10 = 1x10^-1"},
1042 {0x0F, "Reserved"}, /* All other values are reserved */
1046 static const value_string qos_traf_handl_prio[] = {
1047 {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
1048 {0x01, "Priority level 1"},
1049 {0x02, "Priority level 2"},
1050 {0x03, "Priority level 3"},
1054 static const value_string qos_trans_delay[] = {
1055 {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
1056 {0x01, "10 ms"}, /* Using a granularity of 10 ms */
1071 {0x10, "200 ms"}, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
1087 {0x20, "1000 ms"}, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
1122 static const value_string qos_guar_ul[] = {
1123 {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
1124 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1125 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1126 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1131 static const value_string src_stat_desc_vals[] = {
1138 static const true_false_string gtp_sig_ind = {
1139 "Optimised for signalling traffic",
1140 "Not optimised for signalling traffic"
1143 static const value_string qos_guar_dl[] = {
1144 {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
1145 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1146 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1147 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1152 static const value_string sel_mode_type[] = {
1153 {0, "MS or network provided APN, subscribed verified"},
1154 {1, "MS provided APN, subscription not verified"},
1155 {2, "Network provided APN, subscription not verified"},
1156 {3, "For future use (Network provided APN, subscription not verified"}, /* Shall not be sent. If received, shall be sent as value 2 */
1160 static const value_string tr_comm_type[] = {
1161 {1, "Send data record packet"},
1162 {2, "Send possibly duplicated data record packet"},
1163 {3, "Cancel data record packet"},
1164 {4, "Release data record packet"},
1168 /* TODO: CHeck if all ms_reasons are included */
1169 static const value_string ms_not_reachable_type[] = {
1170 {0, "No paging response via the MSC"},
1171 {1, "IMSI detached"},
1172 {2, "Roaming restriction"},
1173 {3, "Deregistered in the HLR for non GPRS"},
1174 {4, "MS purge for non GPRS"},
1175 {5, "No paging response via the SGSN"},
1176 {6, "GPRS detached"},
1177 {7, "Deregistered in the HLR for non GPRS"},
1178 {8, "MS purged for GPRS"},
1179 {9, "Unidentified subscriber via the MSC"},
1180 {10, "Unidentified subscriber via the SGSN"},
1184 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1186 static const value_string ranap_cause_type[] = {
1187 /* Radio Network Layer Cause (1-->64) */
1188 {1, "RAB preempted"},
1189 {2, "Trelocoverall Expiry"},
1190 {3, "Trelocprep Expiry"},
1191 {4, "Treloccomplete Expiry"},
1192 {5, "Tqueuing Expiry"},
1193 {6, "Relocation Triggered"},
1194 {7, "TRELOCalloc Expiry"},
1195 {8, "Unable to Establish During Relocation"},
1196 {9, "Unknown Target RNC"},
1197 {10, "Relocation Cancelled"},
1198 {11, "Successful Relocation"},
1199 {12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
1200 {13, "Change of Ciphering and/or Integrity Protection is not supported"},
1201 {14, "Failure in the Radio Interface Procedure"},
1202 {15, "Release due to UTRAN Generated Reason"},
1203 {16, "User Inactivity"},
1204 {17, "Time Critical Relocation"},
1205 {18, "Requested Traffic Class not Available"},
1206 {19, "Invalid RAB Parameters Value"},
1207 {20, "Requested Maximum Bit Rate not Available"},
1208 {21, "Requested Guaranteed Bit Rate not Available"},
1209 {22, "Requested Transfer Delay not Achievable"},
1210 {23, "Invalid RAB Parameters Combination"},
1211 {24, "Condition Violation for SDU Parameters"},
1212 {25, "Condition Violation for Traffic Handling Priority"},
1213 {26, "Condition Violation for Guaranteed Bit Rate"},
1214 {27, "User Plane Versions not Supported"},
1215 {28, "Iu UP Failure"},
1216 {29, "Relocation Failure in Target CN/RNC or Target System"},
1217 {30, "Invalid RAB ID"},
1218 {31, "No Remaining RAB"},
1219 {32, "Interaction with other procedure"},
1220 {33, "Requested Maximum Bit Rate for DL not Available"},
1221 {34, "Requested Maximum Bit Rate for UL not Available"},
1222 {35, "Requested Guaranteed Bit Rate for DL not Available"},
1223 {36, "Requested Guaranteed Bit Rate for UL not Available"},
1224 {37, "Repeated Integrity Checking Failure"},
1225 {38, "Requested Report Type not supported"},
1226 {39, "Request superseded"},
1227 {40, "Release due to UE generated signalling connection release"},
1228 {41, "Resource Optimisation Relocation"},
1229 {42, "Requested Information Not Available"},
1230 {43, "Relocation desirable for radio reasons"},
1231 {44, "Relocation not supported in Target RNC or Target System"},
1232 {45, "Directed Retry"},
1233 {46, "Radio Connection With UE Lost"},
1234 {47, "rNC-unable-to-establish-all-RFCs"},
1235 {48, "deciphering-keys-not-available"},
1236 {49, "dedicated-assistance-data-not-available"},
1237 {50, "relocation-target-not-allowed"},
1238 {51, "location-reporting-congestion"},
1239 {52, "reduce-load-in-serving-cell"},
1240 {53, "no-radio-resources-available-in-target-cell"},
1241 {54, "gERAN-Iumode-failure"},
1242 {55, "access-restricted-due-to-shared-networks"},
1243 {56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
1244 {57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
1245 {58, "mBMS-no-multicast-service-for-this-UE"},
1246 {59, "mBMS-unknown-UE-ID"},
1247 {60, "successful-MBMS-session-start-no-data-bearer-necessary"},
1248 {61, "mBMS-superseded-due-to-NNSF"},
1249 {62, "mBMS-UE-linking-already-done"},
1250 {63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
1251 {64, "tMGI-unknown"},
1252 /* Transport Layer Cause (65-->80) */
1253 {65, "Signalling Transport Resource Failure"},
1254 {66, "Iu Transport Connection Failed to Establish"},
1255 /* NAS Cause (81-->96) */
1256 {81, "User Restriction Start Indication"},
1257 {82, "User Restriction End Indication"},
1258 {83, "Normal Release"},
1259 /* Protocol Cause (97-->112) */
1260 {97, "Transfer Syntax Error"},
1261 {98, "Semantic Error"},
1262 {99, "Message not compatible with receiver state"},
1263 {100, "Abstract Syntax Error (Reject)"},
1264 {101, "Abstract Syntax Error (Ignore and Notify)"},
1265 {102, "Abstract Syntax Error (Falsely Constructed Message"},
1266 /* Miscellaneous Cause (113-->128) */
1267 {113, "O & M Intervention"},
1268 {114, "No Resource Available"},
1269 {115, "Unspecified Failure"},
1270 {116, "Network Optimisation"},
1271 /* Non-standard Cause (129-->255) */
1273 /* ranap_CauseRadioNetworkExtension ??
1274 { 257, "iP-multicast-address-and-APN-not-valid" },
1275 { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
1276 { 259, "mBMS-request-superseded" },
1277 { 260, "mBMS-de-registration-during-session-not-allowed" },
1278 { 261, "mBMS-no-data-bearer-necessary" },
1284 static const value_string mm_sec_modep[] = {
1285 {0, "Used cipher value, UMTS keys and Quintuplets"},
1286 {1, "GSM key and triplets"},
1287 {2, "UMTS key and quintuplets"},
1288 {3, "GSM key and quintuplets"},
1292 static const value_string gtp_cipher_algorithm[] = {
1293 {0, "No ciphering"},
1303 static const value_string gtp_ext_rat_type_vals[] = {
1309 {5, "HSPA Evolution"},
1313 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
1314 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
1315 #define MM_PROTO_PDSS1 0x02
1316 #define MM_PROTO_CALL_CONTROL 0x03
1317 #define MM_PROTO_PDSS2 0x04
1318 #define MM_PROTO_MM_NON_GPRS 0x05
1319 #define MM_PROTO_RR_MGMT 0x06
1320 #define MM_PROTO_MM_GPRS 0x08
1321 #define MM_PROTO_SMS 0x09
1322 #define MM_PROTO_SESSION_MGMT 0x0A
1323 #define MM_PROTO_NON_CALL_RELATED 0x0B
1325 static const value_string tft_code_type[] = {
1327 {1, "Create new TFT"},
1328 {2, "Delete existing TFT"},
1329 {3, "Add packet filters to existing TFT"},
1330 {4, "Replace packet filters in existing TFT"},
1331 {5, "Delete packet filters from existing TFT"},
1338 static dissector_handle_t ip_handle;
1339 static dissector_handle_t ipv6_handle;
1340 static dissector_handle_t ppp_handle;
1341 static dissector_handle_t data_handle;
1342 static dissector_handle_t gtpcdr_handle;
1343 static dissector_handle_t sndcpxid_handle;
1344 static dissector_handle_t gtpv2_handle;
1345 static dissector_table_t bssap_pdu_type_table;
1347 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype);
1349 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1350 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1351 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1352 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1353 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1354 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1355 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1356 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1357 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1358 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1359 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1360 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1361 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1362 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1363 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1364 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1365 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1366 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1367 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1368 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1369 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1370 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1371 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1372 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1373 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1374 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1375 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1376 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1377 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1378 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1379 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1380 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1381 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1382 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1383 static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1384 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1385 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1386 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1387 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1388 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1389 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1390 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1391 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1392 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1393 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1395 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1396 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1397 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1398 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1399 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1400 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1401 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1402 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1403 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1404 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1405 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1406 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1407 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1408 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1409 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1410 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1411 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1412 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1413 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1414 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1415 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1416 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1417 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1418 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1419 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1420 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1421 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1422 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1423 static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1424 static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1425 static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1426 static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1427 static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1428 static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1429 static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1430 static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1431 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1432 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1433 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1434 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1435 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1436 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1437 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1438 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1439 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1440 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1441 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1442 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1443 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1445 typedef struct _gtp_opt {
1447 int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *);
1450 static const gtp_opt_t gtpopt[] = {
1451 {GTP_EXT_CAUSE, decode_gtp_cause},
1452 {GTP_EXT_IMSI, decode_gtp_imsi},
1453 {GTP_EXT_RAI, decode_gtp_rai},
1454 {GTP_EXT_TLLI, decode_gtp_tlli},
1455 {GTP_EXT_PTMSI, decode_gtp_ptmsi},
1456 {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
1457 {GTP_EXT_REORDER, decode_gtp_reorder},
1458 {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
1459 {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
1460 {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
1461 {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
1462 {GTP_EXT_RECOVER, decode_gtp_recovery},
1463 {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
1464 {GTP_EXT_16, decode_gtp_16},
1465 {GTP_EXT_17, decode_gtp_17},
1466 {GTP_EXT_18, decode_gtp_18},
1467 {GTP_EXT_19, decode_gtp_19},
1468 {GTP_EXT_NSAPI, decode_gtp_nsapi},
1469 {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
1470 {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
1471 {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
1472 {GTP_EXT_RP, decode_gtp_rp},
1473 {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
1474 {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
1475 {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
1476 {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
1477 {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
1478 {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
1479 {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
1480 {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
1481 {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
1482 {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
1483 {GTP_EXT_APN, decode_gtp_apn},
1484 {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
1485 {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
1486 {GTP_EXT_MSISDN, decode_gtp_msisdn},
1487 {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts}, /* 3G */
1488 {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui}, /* 3G */
1489 {GTP_EXT_TFT, decode_gtp_tft}, /* 3G */
1490 {GTP_EXT_TARGET_ID, decode_gtp_target_id}, /* 3G */
1491 {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont}, /* 3G */
1492 {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup}, /* 3G */
1493 {GTP_EXT_HDR_LIST, decode_gtp_hdr_list}, /* 3G */
1494 {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id}, /* 3G */
1495 {GTP_EXT_OMC_ID, decode_gtp_omc_id}, /* 3G */
1496 /* TS 29 060 V6.11.0 */
1497 {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont}, /* 7.7.43 */
1498 {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio}, /* 7.7.45 */
1499 {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf}, /* 7.7.45A */
1500 {GTP_EXT_SSGN_NO, decode_gtp_ssgn_no}, /* 7.7.47 */
1501 {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs}, /* 7.7.48 */
1502 {GTP_EXT_APN_RES, decode_gtp_apn_res}, /* 3G */
1503 {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs}, /* 7.7.25B */
1504 {GTP_EXT_RAT_TYPE, decode_gtp_rat_type}, /* 3G */
1505 {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf}, /* 7.7.51 */
1506 {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone}, /* 7.7.52 */
1507 {GTP_EXT_IMEISV, decode_gtp_imeisv}, /* 3G 7.7.53 */
1508 {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con}, /* 7.7.54 */
1509 {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx}, /* 7.7.55 */
1510 {GTP_EXT_TMGI, decode_gtp_tmgi}, /* 7.7.56 */
1511 {GTP_EXT_RIM_RA, decode_gtp_rim_ra}, /* 7.7.57 */
1512 {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt}, /* 7.7.58 */
1513 {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa}, /* 7.7.60 */
1514 {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf}, /* 7.7.61 */
1515 {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf}, /* 7.7.62 */
1516 {GTP_EXT_HOP_COUNT, decode_gtp_hop_count}, /* 7.7.63 */
1517 {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id}, /* 7.7.64 */
1518 {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id}, /* 7.7.65 */
1519 {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind}, /* 7.7.66 */
1520 {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi}, /* 7.7.67 */
1521 {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur}, /* 7.7.59 */
1522 {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf}, /* 7.7.68 */
1523 {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no}, /* 7.7.69 */
1524 {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr}, /* 7.7.70 */
1525 {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx}, /* 7.7.71 */
1526 {GTP_EXT_BSS_CONT, decode_gtp_bss_cont}, /* 7.7.72 */
1527 {GTP_EXT_CELL_ID, decode_gtp_cell_id}, /* 7.7.73 */
1528 {GTP_EXT_PDU_NO, decode_gtp_pdu_no}, /* 7.7.74 */
1529 {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause}, /* 7.7.75 */
1530 {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap}, /* 7.7.76 */
1531 {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc}, /* 7.7.77 */
1532 {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc}, /* 7.7.78 */
1533 {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid}, /* 7.7.79 */
1534 {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act}, /* 7.7.80 */
1535 {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg}, /* 7.7.81 */
1536 {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id}, /* 7.7.82 */
1537 {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod}, /* 7.7.83 */
1539 {GTP_EXT_REL_PACK, decode_gtp_rel_pack}, /* charging */
1540 {GTP_EXT_CAN_PACK, decode_gtp_can_pack}, /* charging */
1541 {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
1542 {GTP_EXT_DATA_REQ, decode_gtp_data_req}, /* charging */
1543 {GTP_EXT_DATA_RESP, decode_gtp_data_resp}, /* charging */
1544 {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
1545 {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
1546 {0, decode_gtp_unknown}
1555 static guint8 gtp_version = 0;
1556 static const char *yesno[] = { "no", "yes" };
1558 static gchar *id_to_str(const guint8 * ad)
1561 static gchar str[17] = " ";
1562 guint8 bits8to5, bits4to1;
1564 static const gchar hex_digits[10] = "0123456789";
1566 for (i = 0; i < 8; i++) {
1567 bits8to5 = (ad[i] >> 4) & 0x0F;
1568 bits4to1 = ad[i] & 0x0F;
1570 str[j++] = hex_digits[bits4to1];
1572 str[j++] = hex_digits[bits8to5];
1578 static gchar *imsi_to_str(const guint8 * ad)
1581 static gchar str[17] = " ";
1584 for (i = 0; i < 8; i++) {
1585 if ((ad[i] & 0x0F) <= 9)
1586 str[j++] = (ad[i] & 0x0F) + 0x30;
1587 if (((ad[i] >> 4) & 0x0F) <= 9)
1588 str[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
1595 static gchar *msisdn_to_str(const guint8 * ad, int len)
1598 static gchar str[18] = "+ ";
1599 guint8 bits8to5, bits4to1;
1601 static const gchar hex_digits[10] = "0123456789";
1603 for (i = 1; i < len && i < 9; i++) {
1604 bits8to5 = (ad[i] >> 4) & 0x0F;
1605 bits4to1 = ad[i] & 0x0F;
1607 str[j++] = hex_digits[bits4to1];
1609 str[j++] = hex_digits[bits8to5];
1616 /* Next definitions and function check_field_presence checks if given field
1617 * in GTP packet is compliant with ETSI
1619 typedef struct _header {
1624 typedef struct _message {
1626 ext_header fields[32];
1629 /* ---------------------
1631 * ---------------------*/
1632 static _gtp_mess_items gprs_mess_items[] = {
1636 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1641 GTP_MSG_ECHO_RESP, {
1642 {GTP_EXT_RECOVER, GTP_MANDATORY},
1643 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1648 GTP_MSG_VER_NOT_SUPP, {
1653 GTP_MSG_NODE_ALIVE_REQ, {
1654 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
1655 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1660 GTP_MSG_NODE_ALIVE_RESP, {
1661 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1666 GTP_MSG_REDIR_REQ, {
1667 {GTP_EXT_CAUSE, GTP_MANDATORY},
1668 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
1669 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1674 GTP_MSG_REDIR_RESP, {
1675 {GTP_EXT_CAUSE, GTP_MANDATORY},
1676 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1681 GTP_MSG_CREATE_PDP_REQ, {
1682 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1683 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1684 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1685 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1686 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1687 {GTP_EXT_MSISDN, GTP_MANDATORY},
1688 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1689 {GTP_EXT_APN, GTP_MANDATORY},
1690 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1691 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1692 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1693 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1698 GTP_MSG_CREATE_PDP_RESP, {
1699 {GTP_EXT_CAUSE, GTP_MANDATORY},
1700 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1701 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1702 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1703 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1704 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1705 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1706 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1707 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1708 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1709 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1710 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1711 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1716 GTP_MSG_UPDATE_PDP_REQ, {
1717 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1718 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1719 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1720 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1721 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1722 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1723 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1728 GTP_MSG_UPDATE_PDP_RESP, {
1729 {GTP_EXT_CAUSE, GTP_MANDATORY},
1730 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1731 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1732 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1733 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1734 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1735 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1736 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1737 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1738 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1743 GTP_MSG_DELETE_PDP_REQ, {
1744 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1749 GTP_MSG_DELETE_PDP_RESP, {
1750 {GTP_EXT_CAUSE, GTP_MANDATORY},
1751 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1756 GTP_MSG_CREATE_AA_PDP_REQ, {
1757 {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1758 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1759 {GTP_EXT_SEL_MODE, GTP_MANDATORY},
1760 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
1761 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1762 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1763 {GTP_EXT_APN, GTP_MANDATORY},
1764 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1765 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1766 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1767 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1772 GTP_MSG_CREATE_AA_PDP_RESP, {
1773 {GTP_EXT_CAUSE, GTP_MANDATORY},
1774 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
1775 {GTP_EXT_REORDER, GTP_CONDITIONAL},
1776 {GTP_EXT_RECOVER, GTP_OPTIONAL},
1777 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
1778 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1779 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
1780 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
1781 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
1782 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1783 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1784 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
1785 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1790 GTP_MSG_DELETE_AA_PDP_REQ, {
1791 {GTP_EXT_CAUSE, GTP_MANDATORY},
1792 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1797 GTP_MSG_DELETE_AA_PDP_RESP, {
1798 {GTP_EXT_CAUSE, GTP_MANDATORY},
1799 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1805 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1810 GTP_MSG_PDU_NOTIFY_REQ, {
1811 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1812 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1817 GTP_MSG_PDU_NOTIFY_RESP, {
1818 {GTP_EXT_CAUSE, GTP_MANDATORY},
1819 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1824 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1825 {GTP_EXT_CAUSE, GTP_MANDATORY},
1826 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
1827 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1832 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1833 {GTP_EXT_CAUSE, GTP_MANDATORY},
1834 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1839 GTP_MSG_SEND_ROUT_INFO_REQ, {
1840 {GTP_EXT_IMSI, GTP_MANDATORY},
1841 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1846 GTP_MSG_SEND_ROUT_INFO_RESP, {
1847 {GTP_EXT_CAUSE, GTP_MANDATORY},
1848 {GTP_EXT_IMSI, GTP_MANDATORY},
1849 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
1850 {GTP_EXT_MS_REASON, GTP_OPTIONAL},
1851 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
1852 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1857 GTP_MSG_FAIL_REP_REQ, {
1858 {GTP_EXT_IMSI, GTP_MANDATORY},
1859 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1864 GTP_MSG_FAIL_REP_RESP, {
1865 {GTP_EXT_CAUSE, GTP_MANDATORY},
1866 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
1867 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1872 GTP_MSG_MS_PRESENT_REQ, {
1873 {GTP_EXT_IMSI, GTP_MANDATORY},
1874 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
1875 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1880 GTP_MSG_MS_PRESENT_RESP, {
1881 {GTP_EXT_CAUSE, GTP_MANDATORY},
1882 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1887 GTP_MSG_IDENT_REQ, {
1888 {GTP_EXT_RAI, GTP_MANDATORY},
1889 {GTP_EXT_PTMSI, GTP_MANDATORY},
1890 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
1891 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1896 GTP_MSG_IDENT_RESP, {
1897 {GTP_EXT_CAUSE, GTP_MANDATORY},
1898 {GTP_EXT_IMSI, GTP_CONDITIONAL},
1899 {GTP_EXT_AUTH_TRI, GTP_OPTIONAL},
1900 {GTP_EXT_AUTH_QUI, GTP_OPTIONAL},
1901 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1906 GTP_MSG_SGSN_CNTXT_REQ, {
1907 {GTP_EXT_IMSI, GTP_CONDITIONAL},
1908 {GTP_EXT_RAI, GTP_MANDATORY},
1909 {GTP_EXT_TLLI, GTP_MANDATORY},
1910 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
1911 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
1912 {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
1917 GTP_MSG_SGSN_CNTXT_RESP, {
1918 {GTP_EXT_CAUSE, GTP_MANDATORY},
1919 {GTP_EXT_IMSI, GTP_CONDITIONAL},
1920 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
1921 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
1922 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
1923 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1928 GTP_MSG_SGSN_CNTXT_ACK, {
1929 {GTP_EXT_CAUSE, GTP_MANDATORY},
1930 {GTP_EXT_FLOW_II, GTP_CONDITIONAL},
1931 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
1932 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1937 GTP_MSG_DATA_TRANSF_REQ, {
1938 {GTP_EXT_TR_COMM, GTP_MANDATORY},
1939 {GTP_EXT_DATA_REQ, GTP_CONDITIONAL},
1940 {GTP_EXT_REL_PACK, GTP_CONDITIONAL},
1941 {GTP_EXT_CAN_PACK, GTP_CONDITIONAL},
1942 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1947 GTP_MSG_DATA_TRANSF_RESP, {
1948 {GTP_EXT_CAUSE, GTP_MANDATORY},
1949 {GTP_EXT_DATA_RESP, GTP_MANDATORY},
1950 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1961 /* -----------------------------
1963 * -----------------------------*/
1964 static _gtp_mess_items umts_mess_items[] = {
1965 /* 7.2 Path Management Messages */
1968 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1973 GTP_MSG_ECHO_RESP, {
1974 {GTP_EXT_RECOVER, GTP_MANDATORY},
1975 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1980 GTP_MSG_VER_NOT_SUPP, {
1985 GTP_MSG_SUPP_EXT_HDR, {
1986 {GTP_EXT_HDR_LIST, GTP_MANDATORY},
1992 GTP_MSG_NODE_ALIVE_REQ, {
1993 {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
1994 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1999 GTP_MSG_NODE_ALIVE_RESP, {
2000 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2005 GTP_MSG_REDIR_REQ, {
2006 {GTP_EXT_CAUSE, GTP_MANDATORY},
2007 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
2008 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2013 GTP_MSG_REDIR_REQ, {
2017 /* 7.3 Tunnel Management Messages */
2019 GTP_MSG_CREATE_PDP_REQ, {
2020 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2021 /* RAI is in TS 29.060 V6.11.0 */
2022 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2023 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2024 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL},
2025 {GTP_EXT_TEID, GTP_MANDATORY},
2026 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2027 {GTP_EXT_NSAPI, GTP_MANDATORY},
2028 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2029 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},
2030 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2031 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2032 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2033 {GTP_EXT_APN, GTP_CONDITIONAL},
2034 {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL},
2035 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2036 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2037 {GTP_EXT_MSISDN, GTP_CONDITIONAL},
2038 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2039 {GTP_EXT_TFT, GTP_CONDITIONAL},
2040 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2041 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2042 /* TS 29.060 V6.11.0 */
2043 {GTP_EXT_APN_RES, GTP_OPTIONAL},
2044 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},
2045 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},
2046 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},
2047 {GTP_EXT_IMEISV, GTP_OPTIONAL},
2048 {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL},
2049 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},
2050 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2055 GTP_MSG_CREATE_PDP_RESP, {
2056 {GTP_EXT_CAUSE, GTP_MANDATORY},
2057 {GTP_EXT_REORDER, GTP_CONDITIONAL},
2058 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2059 {GTP_EXT_TEID, GTP_CONDITIONAL},
2060 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2061 {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2062 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2063 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2064 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2065 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2066 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2067 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2068 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2069 /* TS 29.060 V6.11.0 */
2070 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2071 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2072 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2073 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2077 { /* checked, SGSN -> GGSN */
2078 GTP_MSG_UPDATE_PDP_REQ, {
2079 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2080 {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2081 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2082 {GTP_EXT_TEID, GTP_MANDATORY},
2083 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2084 {GTP_EXT_NSAPI, GTP_MANDATORY},
2085 {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2086 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2087 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2088 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2089 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
2090 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2091 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2092 {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2093 {GTP_EXT_TFT, GTP_OPTIONAL},
2094 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2095 {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2096 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2097 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2098 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2099 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2100 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2101 {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL}, /* Direct Tunnel Flags 7.7.81 */
2102 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2106 { /* checked, GGSN -> SGSN */
2107 GTP_MSG_UPDATE_PDP_RESP, {
2108 {GTP_EXT_CAUSE, GTP_MANDATORY},
2109 {GTP_EXT_RECOVER, GTP_OPTIONAL},
2110 {GTP_EXT_TEID, GTP_CONDITIONAL},
2111 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2112 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2113 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2114 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2115 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2116 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2117 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2118 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2119 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2120 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2121 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2122 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
2123 {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
2128 GTP_MSG_DELETE_PDP_REQ, {
2129 {GTP_EXT_TEAR_IND, GTP_CONDITIONAL},
2130 {GTP_EXT_NSAPI, GTP_MANDATORY},
2131 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2132 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2137 GTP_MSG_DELETE_PDP_RESP, {
2138 {GTP_EXT_CAUSE, GTP_MANDATORY},
2139 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2140 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2146 {GTP_EXT_TEID, GTP_MANDATORY},
2147 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GSN Address Mandatory 7.7.32 */
2148 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2153 GTP_MSG_PDU_NOTIFY_REQ, {
2154 {GTP_EXT_IMSI, GTP_MANDATORY},
2155 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2156 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2157 {GTP_EXT_APN, GTP_MANDATORY},
2158 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2159 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2160 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2165 GTP_MSG_PDU_NOTIFY_RESP, {
2166 {GTP_EXT_CAUSE, GTP_MANDATORY},
2167 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2172 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2173 {GTP_EXT_CAUSE, GTP_MANDATORY},
2174 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2175 {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2176 {GTP_EXT_APN, GTP_MANDATORY},
2177 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2178 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2183 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2184 {GTP_EXT_CAUSE, GTP_MANDATORY},
2185 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2189 /* 7.4 Location Management Messages */
2191 GTP_MSG_SEND_ROUT_INFO_REQ, {
2192 {GTP_EXT_IMSI, GTP_MANDATORY},
2193 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2198 GTP_MSG_SEND_ROUT_INFO_RESP, {
2199 {GTP_EXT_CAUSE, GTP_MANDATORY},
2200 {GTP_EXT_IMSI, GTP_MANDATORY},
2201 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2202 {GTPv1_EXT_MS_REASON, GTP_OPTIONAL},
2203 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
2204 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2209 GTP_MSG_FAIL_REP_REQ, {
2210 {GTP_EXT_IMSI, GTP_MANDATORY},
2211 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2216 GTP_MSG_FAIL_REP_RESP, {
2217 {GTP_EXT_CAUSE, GTP_MANDATORY},
2218 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2219 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2224 GTP_MSG_MS_PRESENT_REQ, {
2225 {GTP_EXT_IMSI, GTP_MANDATORY},
2226 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2227 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2232 GTP_MSG_MS_PRESENT_RESP, {
2233 {GTP_EXT_CAUSE, GTP_MANDATORY},
2234 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2238 /* 7.5 Mobility Management Messages */
2240 GTP_MSG_IDENT_REQ, {
2241 {GTP_EXT_RAI, GTP_MANDATORY},
2242 {GTP_EXT_PTMSI, GTP_MANDATORY},
2243 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2244 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* SGSN Address for Control Plane Optional 7.7.32 */
2245 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2246 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2251 GTP_MSG_IDENT_RESP, {
2252 {GTP_EXT_CAUSE, GTP_MANDATORY},
2253 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2254 {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL},
2255 {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL},
2256 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2261 GTP_MSG_SGSN_CNTXT_REQ, {
2262 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2263 {GTP_EXT_RAI, GTP_MANDATORY},
2264 {GTP_EXT_TLLI, GTP_CONDITIONAL},
2265 {GTP_EXT_PTMSI, GTP_CONDITIONAL},
2266 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2267 {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2268 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2269 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2270 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
2271 {GTP_EXT_SSGN_NO, GTP_OPTIONAL}, /* SGSN Number Optional 7.7.47 */
2272 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
2273 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2278 GTP_MSG_SGSN_CNTXT_RESP, {
2279 {GTP_EXT_CAUSE, GTP_MANDATORY},
2280 {GTP_EXT_IMSI, GTP_CONDITIONAL},
2281 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2282 {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL}, /* RAB Context Conditional 7.7.19 */
2283 {GTP_EXT_RP_SMS, GTP_OPTIONAL},
2284 {GTP_EXT_RP, GTP_OPTIONAL},
2285 {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL},
2286 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2287 {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL}, /* Radio Priority LCS Optional 7.7.25B */
2288 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2289 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2290 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2291 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2292 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2293 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2298 GTP_MSG_SGSN_CNTXT_ACK, {
2299 {GTP_EXT_CAUSE, GTP_MANDATORY},
2300 {GTP_EXT_TEID_II, GTP_CONDITIONAL},
2301 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2302 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2307 GTP_MSG_FORW_RELOC_REQ, {
2308 {GTP_EXT_IMSI, GTP_MANDATORY},
2309 {GTP_EXT_TEID_CP, GTP_MANDATORY},
2310 {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY},
2311 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
2312 {GTP_EXT_MM_CNTXT, GTP_MANDATORY},
2313 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2314 {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2315 {GTP_EXT_TARGET_ID, GTP_MANDATORY},
2316 {GTP_EXT_UTRAN_CONT, GTP_MANDATORY},
2317 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
2318 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
2319 {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL}, /* Selected PLMN ID Optional 7.7.64 */
2320 {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL}, /* PS Handover Request Context Optional 7.7.71 */
2321 {GTP_EXT_BSS_CONT, GTP_OPTIONAL}, /* BSS Container Optional 7.7.72 */
2322 {GTP_EXT_CELL_ID, GTP_OPTIONAL}, /* Cell Identification Optional 7.7.73 */
2323 {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL}, /* BSSGP Cause Optional 7.7.75 */
2324 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2325 {GTP_EXT_SSGN_NO, GTP_OPTIONAL},
2330 GTP_MSG_FORW_RELOC_RESP, {
2331 {GTP_EXT_CAUSE, GTP_MANDATORY},
2332 {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2333 {GTP_EXT_TEID_II, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
2334 {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL},
2335 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2336 {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL},
2337 {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL},
2338 {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL}, /* Additional RAB Setup Information Conditional 7.7.45A */
2339 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2344 GTP_MSG_FORW_RELOC_COMP, {
2345 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2350 GTP_MSG_RELOC_CANCEL_REQ, {
2351 {GTP_EXT_IMSI, GTP_MANDATORY},
2352 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2357 GTP_MSG_RELOC_CANCEL_RESP, {
2358 {GTP_EXT_CAUSE, GTP_MANDATORY},
2359 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2364 GTP_MSG_FORW_RELOC_ACK, {
2365 {GTP_EXT_CAUSE, GTP_MANDATORY},
2366 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2371 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2372 {GTP_EXT_CAUSE, GTP_MANDATORY},
2373 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2378 GTP_MSG_FORW_SRNS_CNTXT, {
2379 {GTP_EXT_RAB_CNTXT, GTP_MANDATORY},
2380 {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL}, /* Source RNC PDCP context info Optional 7.7.61 */
2381 {GTP_EXT_PDU_NO, GTP_OPTIONAL}, /* PDU Numbers Optional 7.7.74 */
2382 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2387 /* 7.5.14 RAN Information Management Messages */
2389 GTP_MSG_RAN_INFO_RELAY, {
2390 {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY}, /* RAN Transparent Container Mandatory 7.7.43 */
2391 {GTP_EXT_RIM_RA, GTP_OPTIONAL}, /* RIM Routing Address Optional 7.7.57 */
2392 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2396 /* 7.5A MBMS Messages
2397 * 7.5A.1 UE Specific MBMS Messages
2400 GTP_MBMS_NOTIFY_REQ, {
2401 {GTP_EXT_IMSI, GTP_MANDATORY}, /* IMSI Mandatory 7.7.2 */
2402 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2403 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2404 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2405 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2406 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GGSN Address for Control Plane Mandatory 7.7.32 */
2407 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2408 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2413 GTP_MBMS_NOTIFY_RES, {
2414 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2415 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2420 GTP_MBMS_NOTIFY_REJ_REQ, {
2421 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2422 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2423 {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
2424 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2425 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2426 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2431 GTP_MBMS_NOTIFY_REJ_RES, {
2432 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2433 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2438 GTP_CREATE_MBMS_CNTXT_REQ, {
2439 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2440 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2441 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2442 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL}, /* Selection mode Conditional 7.7.12 */
2443 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2444 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2445 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2446 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2447 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2448 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
2449 {GTP_EXT_MSISDN, GTP_CONDITIONAL}, /* MSISDN Conditional 7.7.33 */
2450 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2451 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2452 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2453 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2454 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2455 {GTP_EXT_IMEISV, GTP_OPTIONAL}, /* IMEI(SV) Optional 7.7.53 */
2456 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2457 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
2458 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2459 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2460 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2465 GTP_CREATE_MBMS_CNTXT_RES, {
2466 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2467 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2468 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2469 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2470 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2471 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2472 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2473 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2474 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2475 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2480 GTP_UPD_MBMS_CNTXT_REQ, {
2481 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2482 {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2483 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2484 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2485 {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
2486 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2487 {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2488 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2489 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2490 {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
2491 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
2492 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
2493 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
2494 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additional Trace Info Optional 7.7.62 */
2495 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2496 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
2497 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2502 GTP_UPD_MBMS_CNTXT_RES, {
2503 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2504 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2505 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2506 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2507 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2508 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2509 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
2510 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
2511 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2516 GTP_DEL_MBMS_CNTXT_REQ, {
2517 {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
2518 {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2519 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL}, /* End User Address Conditional 7.7.27 */
2520 {GTP_EXT_APN, GTP_CONDITIONAL}, /* Access Point Name Conditional 7.7.30 */
2521 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2522 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Conditional 7.7.67 */
2523 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2528 GTP_DEL_MBMS_CNTXT_RES, {
2529 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2530 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2531 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2537 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2538 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2539 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2545 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2546 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
2547 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2552 GTP_MBMS_DE_REG_REQ, {
2553 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2554 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2555 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2560 GTP_MBMS_DE_REG_RES, {
2561 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2562 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2567 GTP_MBMS_SES_START_REQ, {
2568 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2569 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2570 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2571 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2572 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2573 {GTP_EXT_QOS_UMTS, GTP_MANDATORY}, /* Quality of Service Profile Mandatory 7.7.34 */
2574 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Mandatory 7.7.48 */
2575 {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
2576 {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY}, /* MBMS Session Duration Mandatory 7.7.59 */
2577 {GTP_EXT_MBMS_SA, GTP_MANDATORY}, /* MBMS Service Area Mandatory 7.7.60 */
2578 {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL}, /* MBMS Session Identifier Optional 7.7.65 */
2579 {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY}, /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
2580 {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
2581 {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY}, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
2582 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2587 GTP_MBMS_SES_START_RES, {
2588 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2589 {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
2590 {GTP_EXT_TEID, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
2591 {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2592 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2593 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
2594 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2599 GTP_MBMS_SES_STOP_REQ, {
2600 {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2601 {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
2602 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2607 GTP_MBMS_SES_STOP_RES, {
2608 {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
2609 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
2620 /* Data structure attached to a conversation,
2621 to keep track of request/response-pairs
2623 typedef struct gtp_conv_info_t {
2624 struct gtp_conv_info_t *next;
2625 GHashTable *unmatched;
2626 GHashTable *matched;
2629 static gtp_conv_info_t *gtp_info_items;
2631 static guint gtp_sn_hash(gconstpointer k)
2633 const gtp_msg_hash_t *key = k;
2638 static gint gtp_sn_equal_matched(gconstpointer k1, gconstpointer k2)
2640 const gtp_msg_hash_t *key1 = k1;
2641 const gtp_msg_hash_t *key2 = k2;
2643 if( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ){
2647 if( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ){
2651 return key1->seq_nr == key2->seq_nr;
2654 static gint gtp_sn_equal_unmatched(gconstpointer k1, gconstpointer k2)
2656 const gtp_msg_hash_t *key1 = k1;
2657 const gtp_msg_hash_t *key2 = k2;
2659 return key1->seq_nr == key2->seq_nr;
2662 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype)
2664 gtp_msg_hash_t gcr, *gcrp = NULL;
2665 gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data;
2670 case GTP_MSG_ECHO_REQ:
2671 case GTP_MSG_CREATE_PDP_REQ:
2672 case GTP_MSG_UPDATE_PDP_REQ:
2673 case GTP_MSG_DELETE_PDP_REQ:
2674 gcr.is_request=TRUE;
2675 gcr.req_frame=pinfo->fd->num;
2678 case GTP_MSG_ECHO_RESP:
2679 case GTP_MSG_CREATE_PDP_RESP:
2680 case GTP_MSG_UPDATE_PDP_RESP:
2681 case GTP_MSG_DELETE_PDP_RESP:
2682 gcr.is_request=FALSE;
2684 gcr.rep_frame=pinfo->fd->num;
2690 gcrp = g_hash_table_lookup(gtp_info->matched, &gcr);
2694 gcrp->is_request=gcr.is_request;
2698 /*no match, let's try to make one*/
2700 case GTP_MSG_ECHO_REQ:
2701 case GTP_MSG_CREATE_PDP_REQ:
2702 case GTP_MSG_UPDATE_PDP_REQ:
2703 case GTP_MSG_DELETE_PDP_REQ:
2706 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2708 g_hash_table_remove(gtp_info->unmatched, gcrp);
2710 /* if we cant reuse the old one, grab a new chunk */
2712 gcrp = se_alloc(sizeof(gtp_msg_hash_t));
2714 gcrp->seq_nr=seq_nr;
2715 gcrp->req_frame = pinfo->fd->num;
2716 gcrp->req_time = pinfo->fd->abs_ts;
2717 gcrp->rep_frame = 0;
2718 gcrp->msgtype = msgtype;
2719 gcrp->is_request = TRUE;
2720 g_hash_table_insert(gtp_info->unmatched, gcrp, gcrp);
2723 case GTP_MSG_ECHO_RESP:
2724 case GTP_MSG_CREATE_PDP_RESP:
2725 case GTP_MSG_UPDATE_PDP_RESP:
2726 case GTP_MSG_DELETE_PDP_RESP:
2728 gcrp=g_hash_table_lookup(gtp_info->unmatched, &gcr);
2731 if(!gcrp->rep_frame){
2732 g_hash_table_remove(gtp_info->unmatched, gcrp);
2733 gcrp->rep_frame=pinfo->fd->num;
2734 gcrp->is_request=FALSE;
2735 g_hash_table_insert(gtp_info->matched, gcrp, gcrp);
2744 /* we have found a match */
2749 if (gcrp->is_request) {
2750 it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
2751 PROTO_ITEM_SET_GENERATED(it);
2755 it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
2756 PROTO_ITEM_SET_GENERATED(it);
2757 nstime_delta(&ns, &pinfo->fd->abs_ts, &gcrp->req_time);
2758 it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
2759 PROTO_ITEM_SET_GENERATED(it);
2766 static int check_field_presence(guint8 message, guint8 field, int *position)
2770 _gtp_mess_items *mess_items;
2772 switch (gtp_version) {
2774 mess_items = gprs_mess_items;
2777 mess_items = umts_mess_items;
2783 while (mess_items[i].code) {
2784 if (mess_items[i].code == message) {
2786 while (mess_items[i].fields[*position].code) {
2787 if (mess_items[i].fields[*position].code == field) {
2791 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
2792 return mess_items[i].fields[(*position)++].code;
2806 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2808 /* GPRS: 9.60 v7.6.0, chapter
2809 * UMTS: 29.060 v4.0, chapter
2811 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2816 cause = tvb_get_guint8(tvb, offset + 1);
2818 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
2823 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2824 * UMTS: 29.060 v4.0, chapter 7.7.2
2826 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2832 tvb_memcpy(tvb, imsi_val, offset + 1, 8);
2833 imsi_str = imsi_to_str(imsi_val);
2835 proto_tree_add_string(tree, hf_gtp_imsi, tvb, offset, 9, imsi_str);
2840 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2841 * UMTS: 29.060 v4.0, chapter 7.7.3
2843 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2846 proto_tree *ext_tree_rai;
2851 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));
2852 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2854 byte[0] = tvb_get_guint8(tvb, offset + 1);
2855 byte[1] = tvb_get_guint8(tvb, offset + 2);
2856 byte[2] = tvb_get_guint8(tvb, offset + 3);
2857 mcc = (byte[0] & 0x0F) * 100 + ((byte[0] & 0xF0) >> 4) * 10 + (byte[1] & 0x0F);
2858 if ((byte[1] & 0xF0) == 0xF0)
2859 mnc = (byte[2] & 0x0F) * 10 + ((byte[2] & 0xF0) >> 4);
2861 mnc = (byte[2] & 0x0F) * 100 + ((byte[2] & 0xF0) >> 4) * 10 + ((byte[1] & 0xF0) >> 4);
2863 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mcc, tvb, offset + 1, 2, mcc);
2864 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mnc, tvb, offset + 2, 2, mnc);
2865 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_lac, tvb, offset + 4, 2, tvb_get_ntohs(tvb, offset + 4));
2866 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, tvb_get_guint8(tvb, offset + 6));
2871 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2872 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2874 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2879 tlli = tvb_get_ntohl(tvb, offset + 1);
2880 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
2885 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
2886 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
2888 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2893 ptmsi = tvb_get_ntohl(tvb, offset + 1);
2894 proto_tree_add_uint(tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
2899 /* adjust - how many bytes before offset should be highlighted
2901 static int decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 adjust)
2904 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
2905 proto_tree *ext_tree_qos;
2908 spare1 = tvb_get_guint8(tvb, offset) & 0xC0;
2909 delay = tvb_get_guint8(tvb, offset) & 0x38;
2910 reliability = tvb_get_guint8(tvb, offset) & 0x07;
2911 peak = tvb_get_guint8(tvb, offset + 1) & 0xF0;
2912 spare2 = tvb_get_guint8(tvb, offset + 1) & 0x08;
2913 precedence = tvb_get_guint8(tvb, offset + 1) & 0x07;
2914 spare3 = tvb_get_guint8(tvb, offset + 2) & 0xE0;
2915 mean = tvb_get_guint8(tvb, offset + 2) & 0x1F;
2917 te = proto_tree_add_text(tree, tvb, offset - adjust, 3 + adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
2918 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
2919 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
2922 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
2923 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
2924 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
2925 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
2926 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
2927 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
2928 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
2929 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
2935 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
2939 * TODO: check if length is included: ETSI 4.08 vs 9.60
2941 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2944 return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
2948 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
2949 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
2951 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2956 reorder = tvb_get_guint8(tvb, offset + 1) & 0x01;
2957 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
2962 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
2963 * 4.08 v7.1.2, chapter 10.5.3.1+
2964 * UMTS: 29.060 v4.0, chapter 7.7.7
2965 * TODO: Add blurb support by registering items in the protocol registration
2967 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2970 proto_tree *ext_tree_auth_tri;
2973 te = proto_tree_add_text(tree, tvb, offset, 29, "%s", val_to_str(GTP_EXT_AUTH_TRI, gtp_val, "Unknown message"));
2974 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
2976 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + 1, 16));
2977 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + 17, 4));
2978 proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + 21, 8));
2980 return 1 + 16 + 4 + 8;
2983 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
2984 * 9.02 v7.7.0, page 1090
2985 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
2986 * 29.002 v4.2.1, chapter 17.5, page 268
2988 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
2993 map_cause = tvb_get_guint8(tvb, offset + 1);
2994 proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
2999 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
3000 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
3002 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3007 ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
3008 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
3013 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
3014 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
3016 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3021 ms_valid = tvb_get_guint8(tvb, offset + 1) & 0x01;
3022 proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
3027 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
3028 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
3030 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3035 recovery = tvb_get_guint8(tvb, offset + 1);
3036 proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
3041 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
3042 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
3046 static const gchar *dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb)
3050 /* Value in ASCII(UTF-8) */
3051 sel_mode = tvb_get_guint8(tvb, 0) - 0x30;
3052 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
3054 return val_to_str(sel_mode, sel_mode_type, "Unknown");
3057 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3060 proto_tree_add_item(tree, hf_gtp_sel_mode, tvb, offset, 2, FALSE);
3064 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
3065 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
3067 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3070 guint16 ext_flow_label;
3073 switch (gtp_version) {
3075 ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
3076 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
3080 teid_data = tvb_get_ntohl(tvb, offset + 1);
3081 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
3085 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
3091 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
3092 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
3094 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3100 switch (gtp_version) {
3102 flow_sig = tvb_get_ntohs(tvb, offset + 1);
3103 proto_tree_add_uint(tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
3106 teid_cp = tvb_get_ntohl(tvb, offset + 1);
3107 proto_tree_add_uint(tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
3110 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
3115 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
3116 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
3118 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3123 proto_tree *ext_tree_flow_ii;
3126 switch (gtp_version) {
3128 te = proto_tree_add_text(tree, tvb, offset, 4, "%s", val_to_str(GTP_EXT_FLOW_II, gtp_val, "Unknown message"));
3129 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3131 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3133 flow_ii = tvb_get_ntohs(tvb, offset + 2);
3134 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
3138 te = proto_tree_add_text(tree, tvb, offset, 6, "%s", val_to_str(GTP_EXT_TEID_II, gtpv1_val, "Unknown message"));
3139 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3141 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3144 teid_ii = tvb_get_ntohl(tvb, offset + 2);
3145 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
3149 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
3155 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
3156 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
3157 * Check if all ms_reason types are included
3159 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3164 field19 = tvb_get_guint8(tvb, offset + 1);
3166 switch (gtp_version) {
3168 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
3171 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
3174 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
3181 /* GPRS: not present
3182 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
3184 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3189 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3190 proto_tree_add_uint(tree, hf_gtp_nsapi, tvb, offset, 2, nsapi);
3195 /* GPRS: not present
3196 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
3198 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3203 ranap = tvb_get_guint8(tvb, offset + 1);
3205 if (ranap > 0 && ranap <= 64)
3206 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3207 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
3208 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3209 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3211 if (ranap > 64 && ranap <= 80)
3212 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3213 ranap, "%s (Transport Layer Cause) : %s (%u)",
3214 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3215 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3217 if (ranap > 80 && ranap <= 96)
3218 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3219 ranap, "%s (NAS Cause) : %s (%u)",
3220 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3221 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3223 if (ranap > 96 && ranap <= 112)
3224 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3225 "%s (Protocol Cause) : %s (%u)",
3226 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3227 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3229 if (ranap > 112 && ranap <= 128)
3230 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3231 "%s (Miscellaneous Cause) : %s (%u)",
3232 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3233 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3235 if (ranap > 128 /* && ranap <=255 */ )
3236 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3237 "%s (Non-standard Cause) : %s (%u)",
3238 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3239 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3244 /* GPRS: not present
3245 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
3247 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3251 proto_tree *ext_tree_rab_cntxt;
3254 te = proto_tree_add_text(tree, tvb, offset, 10, "%s", val_to_str(GTP_EXT_RAB_CNTXT, gtp_val, "Unknown message"));
3255 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
3257 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3259 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3260 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, FALSE);
3261 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, FALSE);
3262 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, FALSE);
3263 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, FALSE);
3269 /* GPRS: not present
3270 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
3272 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3277 rp_sms = tvb_get_guint8(tvb, offset + 1) & 0x07;
3278 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
3283 /* GPRS: not present
3284 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
3286 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3289 proto_tree *ext_tree_rp;
3291 guint8 nsapi, rp, spare;
3293 nsapi = tvb_get_guint8(tvb, offset + 1) & 0xF0;
3294 spare = tvb_get_guint8(tvb, offset + 1) & 0x08;
3295 rp = tvb_get_guint8(tvb, offset + 1) & 0x07;
3297 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
3298 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
3300 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, nsapi);
3301 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, spare);
3302 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, rp);
3307 /* GPRS: not present
3308 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
3310 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3313 proto_tree *ext_tree_pkt_flow_id;
3315 guint8 nsapi, pkt_flow_id;
3317 nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3318 pkt_flow_id = tvb_get_guint8(tvb, offset + 2);
3320 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);
3321 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
3323 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3324 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
3325 offset + 2, 1, pkt_flow_id, "%s : %u", val_to_str(GTP_EXT_PKT_FLOW_ID, gtp_val, "Unknown message"), pkt_flow_id);
3330 /* GPRS: not present
3331 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
3332 * TODO: Differenciate these uints?
3334 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3339 proto_tree *ext_tree_chrg_char;
3341 chrg_char = tvb_get_ntohs(tvb, offset + 1);
3343 te = proto_tree_add_uint(tree, hf_gtp_chrg_char, tvb, offset, 3, chrg_char);
3344 /*"%s: %x", val_to_str (GTP_EXT_CHRG_CHAR, gtp_val, "Unknown message"), chrg_char); */
3345 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
3347 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_s, tvb, offset + 1, 2, chrg_char);
3348 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_n, tvb, offset + 1, 2, chrg_char);
3349 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_p, tvb, offset + 1, 2, chrg_char);
3350 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_f, tvb, offset + 1, 2, chrg_char);
3351 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_h, tvb, offset + 1, 2, chrg_char);
3352 proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_r, tvb, offset + 1, 2, chrg_char);
3357 /* GPRS: not present
3358 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3360 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3365 trace_ref = tvb_get_ntohs(tvb, offset + 1);
3367 proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
3372 /* GPRS: not present
3373 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3375 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3380 trace_type = tvb_get_ntohs(tvb, offset + 1);
3382 proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
3387 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3388 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3390 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3395 reason = tvb_get_guint8(tvb, offset + 1);
3397 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
3403 * UMTS: 29.060 v6.11.0, chapter 7.7.25B
3404 * Radio Priority LCS
3406 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3410 proto_tree *ext_tree;
3413 length = tvb_get_ntohs(tvb, offset + 1);
3414 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_RA_PRIO_LCS, gtp_val, "Unknown"));
3415 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ra_prio_lcs);
3418 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
3419 offset = offset + 2;
3420 /* TODO add decoding of data */
3421 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
3427 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
3430 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3435 tr_command = tvb_get_guint8(tvb, offset + 1);
3437 proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
3442 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3443 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3445 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3450 chrg_id = tvb_get_ntohl(tvb, offset + 1);
3451 proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
3456 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3457 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3459 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3463 guint8 pdp_typ, pdp_org;
3465 struct e_in6_addr addr_ipv6;
3466 proto_tree *ext_tree_user;
3470 length = tvb_get_ntohs(tvb, offset + 1);
3471 pdp_org = tvb_get_guint8(tvb, offset + 3) & 0x0F;
3472 pdp_typ = tvb_get_guint8(tvb, offset + 4);
3474 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s (%s/%s)",
3475 val_to_str(GTP_EXT_USER_ADDR, gtp_val, "Unknown message"),
3476 val_to_str(pdp_org, pdp_org_type, "Unknown PDP Organization"), val_to_str(pdp_typ, pdp_type, "Unknown PDP Type"));
3477 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3479 proto_tree_add_text(ext_tree_user, tvb, offset + 1, 2, "Length : %u", length);
3480 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset + 3, 1, pdp_org);
3481 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
3484 if (pdp_org == 0 && pdp_typ == 1)
3485 proto_item_append_text(te, " (Point to Point Protocol)");
3486 else if (pdp_typ == 2)
3487 proto_item_append_text(te, " (Octet Stream Protocol)");
3488 } else if (length > 2) {
3491 addr_ipv4 = tvb_get_ipv4(tvb, offset + 5);
3492 proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, addr_ipv4);
3493 proto_item_append_text(te, " : %s", ip_to_str((guint8 *) & addr_ipv4));
3496 tvb_get_ipv6(tvb, offset + 5, &addr_ipv6);
3497 proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, (guint8 *) & addr_ipv6);
3498 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
3502 proto_item_append_text(te, " : empty PDP Address");
3507 static int decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3510 proto_tree *ext_tree_trip;
3511 proto_item *te_trip;
3514 for (i = 0; i < count; i++) {
3515 te_trip = proto_tree_add_text(tree, tvb, offset + i * 28, 28, "Triplet no%x", i);
3516 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3518 proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + i * 28, 16));
3519 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));
3520 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));
3526 /* adjust - how many bytes before quintuplet should be highlighted
3528 static int decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
3531 proto_tree *ext_tree_quint;
3532 proto_item *te_quint;
3533 guint16 q_offset, i;
3534 guint8 xres_len, auth_len;
3538 for (i = 0; i < count; i++) {
3540 te_quint = proto_tree_add_text(tree, tvb, offset, -1, "Quintuplet #%x", i + 1);
3541 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3544 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
3545 q_offset = q_offset + 16;
3546 xres_len = tvb_get_guint8(tvb, offset + q_offset);
3547 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "XRES length: %u", xres_len);
3549 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));
3550 q_offset = q_offset + xres_len;
3551 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));
3552 q_offset = q_offset + 16;
3553 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));
3554 q_offset = q_offset + 16;
3555 auth_len = tvb_get_guint8(tvb, offset + q_offset);
3556 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "Authentication length: %u", auth_len);
3558 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));
3560 q_offset = q_offset + auth_len;
3561 proto_item_set_end(te_quint, tvb, offset + q_offset);
3568 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3569 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3570 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3571 * - finish displaying last 3 parameters
3573 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3576 guint16 length, quint_len, con_len;
3577 guint8 cksn, count, sec_mode, len;
3578 proto_tree *ext_tree_mm;
3580 proto_item *tf = NULL;
3581 proto_tree *tf_tree = NULL;
3585 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str(GTP_EXT_MM_CNTXT, gtp_val, "Unknown message"));
3586 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3589 length = tvb_get_ntohs(tvb, offset + 1);
3594 cksn = tvb_get_guint8(tvb, offset + 3) & 0x07;
3596 sec_mode = (tvb_get_guint8(tvb, offset + 4) >> 6) & 0x03;
3597 count = (tvb_get_guint8(tvb, offset + 4) >> 3) & 0x07;
3599 proto_tree_add_text(ext_tree_mm, tvb, offset + 1, 2, "Length: %x", length);
3600 if (gtp_version == 0)
3605 case 0: /* Used cipher value, UMTS keys and Quintuplets */
3606 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset + 3, 1, FALSE);
3607 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3608 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3609 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3610 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3611 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3612 quint_len = tvb_get_ntohs(tvb, offset + 37);
3613 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3615 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3619 case 1: /* GSM key and triplets */
3620 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3621 if (gtp_version != 0)
3622 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3624 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3625 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3626 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3628 offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
3631 case 2: /* UMTS key and quintuplets */
3632 proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, FALSE);
3633 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3634 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3635 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
3636 proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
3637 quint_len = tvb_get_ntohs(tvb, offset + 37);
3638 proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3640 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
3643 case 3: /* GSM key and quintuplets */
3644 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, FALSE);
3645 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, FALSE);
3646 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, FALSE);
3647 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, FALSE);
3648 proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
3649 quint_len = tvb_get_ntohs(tvb, offset + 13);
3650 proto_tree_add_text(ext_tree_mm, tvb, offset + 13, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3652 offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
3660 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
3662 de_gmm_drx_param(tvb, ext_tree_mm, offset, 2, NULL, 0);
3663 offset = offset + 2;
3665 len = tvb_get_guint8(tvb, offset);
3666 tf = proto_tree_add_text(ext_tree_mm, tvb, offset, len + 1, "MS Network Capability");
3668 tf_tree = proto_item_add_subtree(tf, ett_gtp_net_cap);
3670 proto_tree_add_text(tf_tree, tvb, offset, 1, "Length of MS network capability contents: %u", len);
3674 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
3676 de_gmm_ms_net_cap(tvb, tf_tree, offset, len, NULL, 0);
3677 offset = offset + len;
3679 /* Container contains one or several optional information elements as described in the clause 'Overview',
3680 * from the clause 'General message format and information elements coding' in 3GPP TS 24.008.
3681 * The IMEISV shall, if available, be included in the Container.
3684 con_len = tvb_get_ntohs(tvb, offset);
3685 proto_tree_add_text(ext_tree_mm, tvb, offset, 2, "Container length: %u", con_len);
3686 offset = offset + 2;
3690 l3_tvb = tvb_new_subset(tvb, offset, con_len, con_len);
3691 if (!dissector_try_port(bssap_pdu_type_table, BSSAP_PDU_TYPE_DTAP, l3_tvb, pinfo, ext_tree_mm))
3692 call_dissector(data_handle, l3_tvb, pinfo, ext_tree_mm);
3698 /* Function to extract the value of an hexadecimal octet. Only the lower
3699 * nybble will be non-zero in the output.
3701 static guint8 hex2dec(guint8 x)
3703 if ((x >= 'a') && (x <= 'f'))
3705 else if ((x >= 'A') && (x <= 'F'))
3707 else if ((x >= '0') && (x <= '9'))
3714 /* Wrapper function to add UTF-8 decoding for QoS attributes in
3717 static guint8 wrapped_tvb_get_guint8(tvbuff_t * tvb, int offset, int type)
3720 return (hex2dec(tvb_get_guint8(tvb, offset)) << 4 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
3722 return tvb_get_guint8(tvb, offset);
3725 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3726 * so type means length of length :-)
3728 * WARNING :) type does not mean length of length any more... see below for
3731 static int decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 type)
3735 guint8 al_ret_priority;
3736 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3737 guint8 traf_class, del_order, del_err_sdu;
3738 guint8 max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext;
3739 guint8 res_ber, sdu_err_ratio;
3740 guint8 trans_delay, traf_handl_prio;
3741 guint8 guar_ul, guar_dl, guar_ul_ext, guar_dl_ext;
3742 guint8 src_stat_desc, sig_ind;
3743 proto_tree *ext_tree_qos;
3745 int mss, mu, md, gu, gd;
3747 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
3748 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
3749 * to one byte to be dissected).
3750 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
3751 * corresponds to one byte to be dissected)
3753 guint8 utf8_type = 1;
3755 /* In RADIUS messages the QoS has a version field of two octets prepended.
3756 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
3757 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
3758 * inconsistent and unuseful, I will check hyphen presence here and
3759 * will signal its presence.
3763 /* Will keep the value that will be returned
3769 length = tvb_get_guint8(tvb, offset);
3770 te = proto_tree_add_text(tree, tvb, offset, length + 1, "%s", qos_str);
3771 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3772 proto_tree_add_text(ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3774 retval = length + 1;
3777 length = tvb_get_ntohs(tvb, offset + 1);
3778 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3779 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3780 proto_tree_add_text(ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3781 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
3782 retval = length + 3;
3785 /* For QoS inside RADIUS Client messages from GGSN */
3788 /* The field in the RADIUS message is the length of the tvb we were given */
3789 length = tvb_length(tvb);
3790 te = proto_tree_add_text(tree, tvb, offset, length, "%s", qos_str);
3792 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3794 proto_tree_add_item(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, FALSE);
3796 /* Hyphen handling */
3797 hyphen = tvb_get_guint8(tvb, offset + 2);
3798 if (hyphen == ((guint8) '-')) {
3799 /* Hyphen is present, put in protocol tree */
3800 proto_tree_add_text(ext_tree_qos, tvb, offset + 2, 1, "Hyphen separator: -");
3801 offset++; /* "Get rid" of hyphen */
3804 /* Now, we modify offset here and in order to use type later
3811 retval = length + 2; /* Actually, will be ignored. */
3814 /* XXX - what should we do with the length here? */
3817 ext_tree_qos = NULL;
3821 /* In RADIUS messages there is no allocation-retention priority
3822 * so I don't need to wrap the following call to tvb_get_guint8
3824 al_ret_priority = tvb_get_guint8(tvb, offset);
3826 /* All calls are wrapped to take into account the possibility that the
3827 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
3828 * of the offset will be the same as in the previous version of this
3829 * dissector, and the wrapped function will serve as a dumb wrapper;
3830 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
3831 * two bytes for needed shift, and the wrapped function will unencode
3832 * two values from the input.
3834 spare1 = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & 0xC0;
3835 delay = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & 0x38;
3836 reliability = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & 0x07;
3837 peak = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3838 spare2 = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & 0x08;
3839 precedence = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & 0x07;
3840 spare3 = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3841 mean = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & 0x1F;
3843 /* In RADIUS messages there is no allocation-retention priority */
3845 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3847 /* All additions must take care of the fact that QoS fields in RADIUS
3848 * messages are UTF-8 encoded, so we have to use the same trick as above.
3850 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
3851 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
3852 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
3853 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
3854 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
3855 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
3856 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
3857 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
3859 /* TS 24.008 V 7.8.0
3860 * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
3861 * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
3862 * attributes specified in octets 6-14.
3863 * In the MS to network direction and in the network to MS direction the following applies:
3864 * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
3866 * - If octet 17 is included, then octet 18 shall also be included.
3867 * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
3868 * be accepted by the receiving entity.
3873 /* See above for the need of wrapping
3877 traf_class = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3878 del_order = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & 0x18;
3879 del_err_sdu = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & 0x07;
3880 max_sdu_size = wrapped_tvb_get_guint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
3881 max_ul = wrapped_tvb_get_guint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
3882 max_dl = wrapped_tvb_get_guint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
3883 res_ber = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3884 sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & 0x0F;
3885 trans_delay = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & 0xFC;
3886 traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & 0x03;
3887 guar_ul = wrapped_tvb_get_guint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
3889 guar_dl = wrapped_tvb_get_guint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
3899 src_stat_desc = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& 0xf;
3900 sig_ind = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type)& 0x01;
3903 max_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
3904 guar_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
3907 max_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
3908 guar_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
3911 /* See above comments for the changes
3913 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
3914 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
3915 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);
3916 if (max_sdu_size == 0 || max_sdu_size > 150)
3917 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);
3918 if (max_sdu_size > 0 && max_sdu_size <= 150) {
3919 mss = max_sdu_size * 10;
3920 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss,
3921 "Maximum SDU size : %u octets", mss);
3924 if (max_ul == 0 || max_ul == 255)
3925 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
3926 if (max_ul > 0 && max_ul <= 63)
3927 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul,
3928 "Maximum bit rate for uplink : %u kbps", max_ul);
3929 if (max_ul > 63 && max_ul <= 127) {
3930 mu = 64 + (max_ul - 64) * 8;
3931 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
3932 "Maximum bit rate for uplink : %u kbps", mu);
3935 if (max_ul > 127 && max_ul <= 254) {
3936 mu = 576 + (max_ul - 128) * 64;
3937 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
3938 "Maximum bit rate for uplink : %u kbps", mu);
3941 if (max_dl == 0 || max_dl == 255)
3942 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
3943 if (max_dl > 0 && max_dl <= 63)
3944 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl,
3945 "Maximum bit rate for downlink : %u kbps", max_dl);
3946 if (max_dl > 63 && max_dl <= 127) {
3947 md = 64 + (max_dl - 64) * 8;
3948 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
3949 "Maximum bit rate for downlink : %u kbps", md);
3951 if (max_dl > 127 && max_dl <= 254) {
3952 md = 576 + (max_dl - 128) * 64;
3953 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
3954 "Maximum bit rate for downlink : %u kbps", md);
3957 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
3958 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);
3959 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
3960 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);
3962 if (guar_ul == 0 || guar_ul == 255)
3963 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
3964 if (guar_ul > 0 && guar_ul <= 63)
3965 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul,
3966 "Guaranteed bit rate for uplink : %u kbps", guar_ul);
3967 if (guar_ul > 63 && guar_ul <= 127) {
3968 gu = 64 + (guar_ul - 64) * 8;
3969 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
3970 "Guaranteed bit rate for uplink : %u kbps", gu);
3972 if (guar_ul > 127 && guar_ul <= 254) {
3973 gu = 576 + (guar_ul - 128) * 64;
3974 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
3975 "Guaranteed bit rate for uplink : %u kbps", gu);
3979 if (guar_dl == 0 || guar_dl == 255)
3980 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
3981 if (guar_dl > 0 && guar_dl <= 63)
3982 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl,
3983 "Guaranteed bit rate for downlink : %u kbps", guar_dl);
3984 if (guar_dl > 63 && guar_dl <= 127) {
3985 gd = 64 + (guar_dl - 64) * 8;
3986 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
3987 "Guaranteed bit rate for downlink : %u kbps", gd);
3989 if (guar_dl > 127 && guar_dl <= 254) {
3990 gd = 576 + (guar_dl - 128) * 64;
3991 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
3992 "Guaranteed bit rate for downlink : %u kbps", gd);
3996 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);
3997 proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
4001 if (max_dl_ext > 0 && max_dl_ext <= 0x4a) {
4002 md = 8600 + max_dl_ext * 100;
4003 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4004 "Ext Maximum bit rate for downlink : %u kbps", md);
4006 if (max_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4007 md = 16 + (max_dl_ext-0x4a);
4008 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4009 "Ext Maximum bit rate for downlink : %u Mbps", md);
4011 if (max_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4012 md = 128 + (max_dl_ext-0xba)*2;
4013 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
4014 "Ext Maximum bit rate for downlink : %u Mbps", md);
4017 if(guar_dl_ext == 0)
4018 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");
4019 if (guar_dl_ext > 0 && guar_dl_ext <= 0x4a) {
4020 gd = 8600 + guar_dl_ext * 100;
4021 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4022 "Ext Guaranteed bit rate for downlink : %u kbps", gd);
4024 if (guar_dl_ext > 0x4a && max_dl_ext <= 0xba) {
4025 gd = 16 + (guar_dl_ext-0x4a);
4026 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4027 "Ext Guaranteed bit rate for downlink : %u Mbps", gd);
4029 if (guar_dl_ext > 0xba && max_dl_ext <= 0xfa) {
4030 gd = 128 + (guar_dl_ext-0xba)*2;
4031 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
4032 "Ext Guaranteed bit rate for downlink : %u Mbps", gd);
4038 * 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
4039 * rate for downlink (extended).
4041 if (max_ul_ext > 0 && max_ul_ext <= 0x4a) {
4042 md = 8600 + max_ul_ext * 100;
4043 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4044 "Ext Maximum bit rate for uplink : %u kbps", md);
4046 if (max_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4047 md = 16 + (max_ul_ext-0x4a);
4048 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4049 "Ext Maximum bit rate for uplink : %u Mbps", md);
4051 if (max_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4052 md = 128 + (max_ul_ext-0xba)*2;
4053 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
4054 "Ext Maximum bit rate for uplink : %u Mbps", md);
4057 if(guar_ul_ext == 0)
4058 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 13");
4059 if (guar_ul_ext > 0 && guar_ul_ext <= 0x4a) {
4060 gd = 8600 + guar_ul_ext * 100;
4061 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4062 "Ext Guaranteed bit rate for uplink : %u kbps", gd);
4064 if (guar_ul_ext > 0x4a && max_ul_ext <= 0xba) {
4065 gd = 16 + (guar_ul_ext-0x4a);
4066 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4067 "Ext Guaranteed bit rate for uplink : %u Mbps", gd);
4069 if (guar_ul_ext > 0xba && max_ul_ext <= 0xfa) {
4070 gd = 128 + (guar_ul_ext-0xba)*2;
4071 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
4072 "Ext Guaranteed bit rate for uplink : %u Mbps", gd);
4081 static const gchar *dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb)
4083 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
4084 return tvb_get_ephemeral_string(tvb, 0, tvb_length(tvb));
4087 static void decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree)
4094 name_len = tvb_get_guint8(tvb, offset);
4096 if (name_len < 0x20) {
4097 apn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
4099 if (name_len >= length - 1)
4102 name_len = name_len + apn[tmp] + 1;
4106 apn = tvb_get_ephemeral_string(tvb, offset, length);
4108 proto_tree_add_string(tree, hf_gtp_apn, tvb, offset, length, apn);
4112 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
4113 * UMTS: 29.060 v4.0, chapter 7.7.29
4114 * TODO: unify addr functions
4116 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4119 guint8 ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id, pdp_type_org, pdp_type_num, pdp_addr_len;
4120 guint16 length, sn_down, sn_up, up_flow;
4122 struct e_in6_addr addr_ipv6;
4123 proto_tree *ext_tree_pdp;
4126 length = tvb_get_ntohs(tvb, offset + 1);
4128 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str(GTP_EXT_PDP_CNTXT, gtp_val, "Unknown message"));
4129 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
4131 vaa = (tvb_get_guint8(tvb, offset + 3) >> 6) & 0x01;
4132 order = (tvb_get_guint8(tvb, offset + 3) >> 4) & 0x01;
4133 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4134 sapi = tvb_get_guint8(tvb, offset + 4) & 0x0F;
4136 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "VPLMN address allowed: %s", yesno[vaa]);
4137 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Reordering required: %s", yesno[order]);
4138 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "NSAPI: %u", nsapi);
4139 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "SAPI: %u", sapi);
4141 switch (gtp_version) {
4143 decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
4144 decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
4145 decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
4146 offset = offset + 14;
4149 offset = offset + 5;
4150 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
4151 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
4152 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
4158 sn_down = tvb_get_ntohs(tvb, offset);
4159 sn_up = tvb_get_ntohs(tvb, offset + 2);
4160 pdu_send_no = tvb_get_guint8(tvb, offset + 4);
4161 pdu_rec_no = tvb_get_guint8(tvb, offset + 5);
4163 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
4164 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 2, "Sequence number up: %u", sn_up);
4165 proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "Send N-PDU number: %u", pdu_send_no);
4166 proto_tree_add_text(ext_tree_pdp, tvb, offset + 5, 1, "Receive N-PDU number: %u", pdu_rec_no);
4168 switch (gtp_version) {
4170 up_flow = tvb_get_ntohs(tvb, offset + 6);
4171 proto_tree_add_text(ext_tree_pdp, tvb, offset + 6, 2, "Uplink flow label signalling: %u", up_flow);
4172 offset = offset + 8;
4175 pdp_cntxt_id = tvb_get_guint8(tvb, offset + 14);
4176 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_cp, tvb, offset + 6, 4, FALSE);
4177 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_data, tvb, offset + 10, 4, FALSE);
4178 proto_tree_add_text(ext_tree_pdp, tvb, offset + 14, 1, "PDP context identifier: %u", pdp_cntxt_id);
4179 offset = offset + 15;
4185 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
4186 pdp_type_num = tvb_get_guint8(tvb, offset + 1);
4187 pdp_addr_len = tvb_get_guint8(tvb, offset + 2);
4189 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP org"));
4190 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 1, "PDP type: %s", val_to_str(pdp_type_num, pdp_type, "Unknown PDP type"));
4191 proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 1, "PDP address length: %u", pdp_addr_len);
4193 if (pdp_addr_len > 0) {
4194 switch (pdp_type_num) {
4196 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4197 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 4, "PDP address: %s", ip_to_str((guint8 *) & addr_ipv4));
4200 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4201 proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4208 offset = offset + 3 + pdp_addr_len;
4210 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4211 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
4213 switch (ggsn_addr_len) {
4215 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4216 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN Address for control plane: %s", ip_to_str((guint8 *) & addr_ipv4));
4219 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4220 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));
4226 offset = offset + 1 + ggsn_addr_len;
4228 if (gtp_version == 1) {
4230 ggsn_addr_len = tvb_get_guint8(tvb, offset);
4231 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
4233 switch (ggsn_addr_len) {
4235 addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
4236 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *) & addr_ipv4));
4239 tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
4240 proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4245 offset = offset + 1 + ggsn_addr_len;
4249 apn_len = tvb_get_guint8(tvb, offset);
4250 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
4251 decode_apn(tvb, offset + 1, apn_len, ext_tree_pdp);
4253 offset = offset + 1 + apn_len;
4255 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
4256 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
4257 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
4258 * MS is stored in the PDP context IE.
4259 * 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
4260 * octet in this field.
4262 trans_id = tvb_get_guint8(tvb, offset);
4263 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Transaction identifier: %u", trans_id);
4268 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
4269 * UMTS: 29.060, v4.0, chapter 7.7.30
4271 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4275 proto_tree *ext_tree_apn;
4278 length = tvb_get_ntohs(tvb, offset + 1);
4280 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str(GTP_EXT_APN, gtp_val, "Unknown field"));
4281 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
4283 proto_tree_add_text(ext_tree_apn, tvb, offset + 1, 2, "APN length : %u", length);
4284 decode_apn(tvb, offset + 3, length, ext_tree_apn);
4289 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
4290 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
4291 * UMTS: 29.060 v4.0, chapter 7.7.31
4292 * 24.008, v4.2, chapter 10.5.6.3
4294 int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
4297 guint16 length, proto_offset;
4299 guint8 conf, proto_len, cnt = 1;
4301 proto_tree *ext_tree_proto;
4303 gboolean save_writable;
4305 length = tvb_get_ntohs(tvb, offset + 1);
4307 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str(GTP_EXT_PROTO_CONF, gtp_val, "Unknown message"));
4308 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
4310 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
4315 conf = tvb_get_guint8(tvb, offset + 3) & 0x07;
4316 proto_tree_add_text(ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
4318 proto_offset = 1; /* ... 1st byte is conf */
4322 if (proto_offset >= length)
4324 proto_id = tvb_get_ntohs(tvb, offset);
4325 proto_len = tvb_get_guint8(tvb, offset + 2);
4326 proto_offset += proto_len + 3; /* 3 = proto id + length byte */
4328 if (proto_len > 0) {
4330 proto_tree_add_text(ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)",
4331 cnt, val_to_str(proto_id, ppp_vals, "Unknown"), proto_id);
4332 proto_tree_add_text(ext_tree_proto, tvb, offset + 2, 1, "Protocol %u length: %u", cnt, proto_len);
4335 * Don't allow the dissector for the configuration
4336 * protocol in question to update the columns - this
4339 save_writable = col_get_writable(pinfo->cinfo);
4340 col_set_writable(pinfo->cinfo, FALSE);
4343 * XXX - should we have our own dissector table,
4344 * solely for configuration protocols, so that bogus
4345 * values don't cause us to dissect the protocol
4346 * data as, for example, IP?
4348 next_tvb = tvb_new_subset(tvb, offset + 3, proto_len, proto_len);
4349 if (!dissector_try_port(ppp_subdissector_table, proto_id, next_tvb, pinfo, ext_tree_proto)) {
4350 call_dissector(data_handle, next_tvb, pinfo, ext_tree_proto);
4353 col_set_writable(pinfo->cinfo, save_writable);
4356 offset += proto_len + 3;
4363 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
4364 * UMTS: 29.060 v4.0, chapter 7.7.32
4366 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4369 guint8 addr_type, addr_len;
4372 struct e_in6_addr addr_ipv6;
4373 proto_tree *ext_tree_gsn_addr;
4376 length = tvb_get_ntohs(tvb, offset + 1);
4378 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "GSN address : ");
4379 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
4383 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4384 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4385 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4386 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, addr_ipv4);
4389 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4390 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4391 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4392 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4393 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4394 addr_ipv4 = tvb_get_ipv4(tvb, offset + 4);
4395 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4396 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, addr_ipv4);
4399 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
4400 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4401 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4402 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
4405 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
4406 addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
4407 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
4408 addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
4409 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
4410 tvb_get_ipv6(tvb, offset + 4, &addr_ipv6);
4411 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4412 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, (guint8 *) & addr_ipv6);
4415 proto_item_append_text(te, "unknown type or wrong length");
4422 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
4423 * UMTS: 29.060 v4.0, chapter 7.7.33
4425 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4428 const guint8 *msisdn_val;
4432 length = tvb_get_ntohs(tvb, offset + 1);
4437 msisdn_val = tvb_get_ptr(tvb, offset + 3, length);
4438 msisdn_str = msisdn_to_str(msisdn_val, length);
4440 proto_tree_add_string(tree, hf_gtp_msisdn, tvb, offset, 3 + length, msisdn_str);
4445 /* GPRS: not present
4446 * UMTS: 29.060 v4.0, chapter 7.7.34
4447 * 24.008 v4.2, chapter 10.5.6.5
4449 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4452 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
4455 /* GPRS: not present
4456 * UMTS: 29.060 v4.0, chapter 7.7.35
4458 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4461 proto_tree *ext_tree;
4462 proto_item *te_quint;
4464 guint8 xres_len, auth_len;
4467 length = tvb_get_ntohs(tvb, offset + 1);
4469 te_quint = proto_tree_add_text(tree, tvb, offset, length + 1, "Quintuplet");
4470 ext_tree = proto_item_add_subtree(te_quint, ett_gtp_quint);
4473 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4474 offset = offset + 2;
4476 proto_tree_add_text(ext_tree, tvb, offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
4477 offset = offset + 16;
4478 xres_len = tvb_get_guint8(tvb, offset);
4479 proto_tree_add_text(ext_tree, tvb, offset, 1, "XRES length: %u", xres_len);
4481 proto_tree_add_text(ext_tree, tvb, offset, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset, xres_len));
4482 offset = offset + xres_len;
4483 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4484 offset = offset + 16;
4485 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4486 offset = offset + 16;
4487 auth_len = tvb_get_guint8(tvb, offset);
4488 proto_tree_add_text(ext_tree, tvb, offset, 1, "Authentication length: %u", auth_len);
4490 proto_tree_add_text(ext_tree, tvb, offset, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset, auth_len));
4492 offset = offset + auth_len;
4494 return (3 + length);
4498 /* GPRS: not present
4499 * UMTS: 29.060 v4.0, chapter 7.7.36
4500 * 24.008 v4.2, chapter 10.5.6.12
4502 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4505 guint16 length, port1, port2, tos;
4506 guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto, spare;
4508 guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
4509 struct e_in6_addr addr_ipv6, mask_ipv6;
4510 proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
4511 proto_item *te, *tee, *tef;
4513 length = tvb_get_ntohs(tvb, offset + 1);
4515 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Traffic flow template");
4516 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
4518 tft_flags = tvb_get_guint8(tvb, offset + 3);
4519 tft_code = (tft_flags >> 5) & 0x07;
4520 spare = (tft_flags >> 4) & 0x01;
4521 no_packet_filters = tft_flags & 0x0F;
4523 proto_tree_add_text(ext_tree_tft, tvb, offset + 1, 2, "TFT length: %u", length);
4525 tef = proto_tree_add_text(ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
4526 ext_tree_tft_flags = proto_item_add_subtree(tef, ett_gtp_tft_flags);
4527 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_code, tvb, offset + 3, 1, tft_flags);
4528 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_spare, tvb, offset + 3, 1, tft_flags);
4529 proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_number, tvb, offset + 3, 1, tft_flags);
4531 offset = offset + 4;
4533 for (i = 0; i < no_packet_filters; i++) {
4535 pf_id = tvb_get_guint8(tvb, offset);
4537 tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
4538 ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
4541 if (tft_code != 2) {
4543 pf_eval = tvb_get_guint8(tvb, offset);
4544 pf_len = tvb_get_guint8(tvb, offset + 1);
4546 proto_tree_add_uint(ext_tree_tft_pf, hf_gtp_tft_eval, tvb, offset, 1, pf_eval);
4547 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + 1, 1, "Content length: %u", pf_len);
4549 offset = offset + 2;
4552 while (pf_offset < pf_len) {
4554 pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
4556 switch (pf_content_id) {
4557 /* address IPv4 and mask = 8 bytes */
4559 addr_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 1);
4560 mask_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 5);
4561 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),
4562 ip_to_str((guint8 *) & mask_ipv4));
4563 pf_offset = pf_offset + 9;
4565 /* address IPv6 and mask = 32 bytes */
4567 tvb_get_ipv6(tvb, offset + pf_offset + 1, &addr_ipv6);
4568 tvb_get_ipv6(tvb, offset + pf_offset + 17, &mask_ipv6);
4569 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s",
4570 ip6_to_str((struct e_in6_addr *) &addr_ipv6), ip6_to_str((struct e_in6_addr *) &mask_ipv6));
4571 pf_offset = pf_offset + 33;
4573 /* protocol identifier/next header type = 1 byte */
4575 proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
4576 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)",
4578 pf_offset = pf_offset + 2;
4580 /* single destination port type = 2 bytes */
4582 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4583 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
4584 pf_offset = pf_offset + 3;
4586 /* destination port range type = 4 bytes */
4588 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4589 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4590 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
4591 pf_offset = pf_offset + 5;
4593 /* single source port type = 2 bytes */
4595 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4596 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
4597 pf_offset = pf_offset + 3;
4599 /* source port range type = 4 bytes */
4601 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4602 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
4603 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
4604 pf_offset = pf_offset + 5;
4606 /* security parameter index type = 4 bytes */
4608 ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
4609 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
4610 pf_offset = pf_offset + 5;
4612 /* type of service/traffic class type = 2 bytes */
4614 tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
4615 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
4616 pf_offset = pf_offset + 3;
4618 /* flow label type = 3 bytes */
4620 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;
4621 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
4622 pf_offset = pf_offset + 4;
4626 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
4627 pf_offset++; /* to avoid infinite loop */
4632 offset = offset + pf_offset;
4639 /* GPRS: not present
4640 * UMTS: 29.060 v4.0, chapter 7.7.37
4641 * Type = 138 (Decimal)
4642 * 25.413(RANAP) TargetID
4644 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4648 proto_item *target_id_item;
4649 proto_tree *ext_tree;
4651 asn1_ctx_t asn1_ctx;
4652 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
4654 length = tvb_get_ntohs(tvb, offset + 1);
4656 target_id_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "Target Identification");
4657 ext_tree = proto_item_add_subtree(target_id_item, ett_gtp_target_id);
4658 offset = offset + 1;
4659 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4660 offset = offset + 2;
4661 next_tvb = tvb_new_subset(tvb, offset, length, length);
4662 dissect_ranap_TargetRNC_ID(next_tvb, 0, &asn1_ctx, ext_tree, hf_gtp_targetRNC_ID);
4668 /* GPRS: not present
4669 * UMTS: 29.060 v4.0, chapter 7.7.38
4671 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4675 proto_item *utran_cont_item;
4676 proto_tree *ext_tree;
4679 length = tvb_get_ntohs(tvb, offset + 1);
4681 utran_cont_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
4682 ext_tree = proto_item_add_subtree(utran_cont_item, ett_gtp_utran_cont);
4683 offset = offset + 1;
4684 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4685 offset = offset + 2;
4686 next_tvb = tvb_new_subset(tvb, offset, length, length);
4688 call_dissector(data_handle, next_tvb, pinfo, ext_tree);
4695 /* GPRS: not present
4696 * UMTS: 29.060 v4.0, chapter 7.7.39
4698 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4701 guint32 teid, addr_ipv4;
4704 struct e_in6_addr addr_ipv6;
4705 proto_tree *ext_tree_rab_setup;
4708 length = tvb_get_ntohs(tvb, offset + 1);
4709 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4711 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Radio Access Bearer Setup Information");
4712 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
4714 proto_tree_add_text(ext_tree_rab_setup, tvb, offset + 1, 2, "RAB setup length : %u", length);
4715 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, nsapi);
4719 teid = tvb_get_ntohl(tvb, offset + 4);
4721 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
4725 addr_ipv4 = tvb_get_ipv4(tvb, offset + 8);
4726 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, addr_ipv4);
4729 tvb_get_ipv6(tvb, offset + 8, &addr_ipv6);
4730 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, (guint8 *) & addr_ipv6);
4741 /* GPRS: not present
4742 * UMTS: 29.060 v4.0, chapter 7.7.40
4744 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4749 proto_tree *ext_tree_hdr_list;
4752 length = tvb_get_guint8(tvb, offset + 1);
4754 te = proto_tree_add_text(tree, tvb, offset, 2 + length, "%s", val_to_str(GTP_EXT_HDR_LIST, gtp_val, "Unknown"));
4755 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4757 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4759 for (i = 0; i < length; i++) {
4760 hdr = tvb_get_guint8(tvb, offset + 2 + i);
4762 proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 2 + i, 1, "No. %u --> Extension Header Type value : %s (%u)", i + 1,
4763 val_to_str(hdr, gtp_val, "Unknown Extension Header Type"), hdr);
4769 /* GPRS: not present
4770 * UMTS: 29.060 v4.0, chapter 7.7.41
4771 * TODO: find TriggerID description
4773 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4778 length = tvb_get_ntohs(tvb, offset + 1);
4780 proto_tree_add_text(tree, tvb, offset, 3 + length, "%s length : %u", val_to_str(GTP_EXT_TRIGGER_ID, gtp_val, "Unknown"), length);
4786 /* GPRS: not present
4787 * UMTS: 29.060 v4.0, chapter 7.7.42
4788 * TODO: find OMC-ID description
4790 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4795 length = tvb_get_ntohs(tvb, offset + 1);
4797 proto_tree_add_text(tree, tvb, offset, 3 + length, "%s length : %u", val_to_str(GTP_EXT_OMC_ID, gtp_val, "Unknown"), length);
4803 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
4804 * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
4806 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4811 struct e_in6_addr addr_ipv6;
4812 proto_tree *ext_tree_chrg_addr;
4815 length = tvb_get_ntohs(tvb, offset + 1);
4817 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"));
4818 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
4820 proto_tree_add_text(ext_tree_chrg_addr, tvb, offset + 1, 2, "%s length : %u", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"), length);
4824 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
4825 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
4826 proto_tree_add_ipv4(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, addr_ipv4);
4829 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
4830 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
4831 proto_tree_add_ipv6(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
4834 proto_item_append_text(te, "unknown type or wrong length");
4842 * UMTS: 29.060 v6.11.0, chapter 7.7.44 RAN Transparent Container
4844 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4848 proto_tree *ext_tree;
4851 length = tvb_get_ntohs(tvb, offset + 1);
4852 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_RAN_TR_CONT, gtp_val, "Unknown"));
4853 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ran_tr_cont);
4856 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4857 offset = offset + 2;
4858 /* TODO add decoding of data */
4859 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4866 * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
4868 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4872 proto_tree *ext_tree;
4875 length = tvb_get_ntohs(tvb, offset + 1);
4876 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_PDP_CONT_PRIO, gtp_val, "Unknown"));
4877 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdp_cont_prio);
4880 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4881 offset = offset + 2;
4882 /* TODO add decoding of data */
4883 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4890 * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
4892 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4896 proto_tree *ext_tree;
4899 length = tvb_get_ntohs(tvb, offset + 1);
4900 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_ADD_RAB_SETUP_INF, gtp_val, "Unknown"));
4901 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rab_setup_inf);
4904 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4905 offset = offset + 2;
4906 /* TODO add decoding of data */
4907 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4915 * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
4917 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4921 proto_tree *ext_tree;
4924 length = tvb_get_ntohs(tvb, offset + 1);
4925 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_SSGN_NO, gtp_val, "Unknown"));
4926 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ssgn_no);
4929 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4930 offset = offset + 2;
4931 /* TODO add decoding of data */
4932 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4939 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
4941 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4945 proto_tree *ext_tree;
4948 length = tvb_get_ntohs(tvb, offset + 1);
4949 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_COMMON_FLGS, gtp_val, "Unknown"));
4950 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_common_flgs);
4953 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4954 offset = offset + 2;
4955 /* Upgrade QoS Supported */
4956 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, FALSE);
4957 /* NRSN bit field */
4958 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, FALSE);
4959 /* No QoS negotiation */
4960 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, FALSE);
4961 /* MBMS Counting Information bi */
4962 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, FALSE);
4963 /* RAN Procedures Ready */
4964 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, FALSE);
4965 /* MBMS Service Type */
4966 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, FALSE);
4967 /* Prohibit Payload Compression */
4968 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, FALSE);
4975 * UMTS: 29.060 v6.11.0, chapter 7.7.49
4977 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
4981 proto_tree *ext_tree_apn_res;
4984 length = tvb_get_ntohs(tvb, offset + 1);
4985 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str(GTP_EXT_APN_RES, gtp_val, "Unknown"));
4986 ext_tree_apn_res = proto_item_add_subtree(te, ett_gtp_ext_tree_apn_res);
4989 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4990 offset = offset + 2;
4992 /* Restriction Type value */
4994 proto_item *expert_item;
4995 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
4996 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
4997 PROTO_ITEM_SET_GENERATED(expert_item);
5001 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, FALSE);
5006 * UMTS: 29.060 v6.11.0, chapter 7.7.50
5008 * Type = 151 (Decimal)
5011 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5015 proto_tree *ext_tree_rat_type;
5018 length = tvb_get_ntohs(tvb, offset + 1);
5019 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_RAT_TYPE, gtp_val, "Unknown"));
5020 ext_tree_rat_type = proto_item_add_subtree(te, ett_gtp_ext_rat_type);
5023 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5024 offset = offset + 2;
5026 /* RAT Type value */
5028 proto_item *expert_item;
5029 expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
5030 expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
5031 PROTO_ITEM_SET_GENERATED(expert_item);
5035 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, FALSE);
5041 * UMTS: 29.060 v6.11.0, chapter 7.7.51
5042 * User Location Information
5043 * Type = 152 (Decimal)
5046 static const gchar *dissect_radius_user_loc(proto_tree * tree, tvbuff_t * tvb)
5050 guint8 geo_loc_type;
5051 guint16 length = tvb_length(tvb);
5053 /* Geographic Location Type */
5054 proto_tree_add_item(tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5055 geo_loc_type = tvb_get_guint8(tvb, offset);
5058 if (geo_loc_type == 0)
5059 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5060 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 0);
5061 if (geo_loc_type == 1) {
5062 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5063 be_cell_id_aux(tvb, tree, offset, length - 1, NULL, 0, 4);
5064 offset = offset + 5;
5065 proto_tree_add_item(tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5069 return tvb_bytes_to_str(tvb, 0, length);
5072 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5076 proto_tree *ext_tree;
5078 guint8 geo_loc_type;
5080 length = tvb_get_ntohs(tvb, offset + 1);
5081 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_USR_LOC_INF, gtp_val, "Unknown"));
5082 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_usr_loc_inf);
5085 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5086 offset = offset + 2;
5087 /* TODO add decoding of data */
5088 /* Geographic Location Type */
5089 proto_tree_add_item(ext_tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
5090 geo_loc_type = tvb_get_guint8(tvb, offset);
5093 if (geo_loc_type == 0)
5094 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
5095 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 0);
5096 if (geo_loc_type == 1) {
5097 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
5098 be_cell_id_aux(tvb, ext_tree, offset, length - 1, NULL, 0, 4);
5099 offset = offset + 5;
5100 proto_tree_add_item(ext_tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
5107 static const value_string daylight_saving_time_vals[] = {
5108 {0, "No adjustment"},
5109 {1, "+1 hour adjustment for Daylight Saving Time"},
5110 {2, "+2 hours adjustment for Daylight Saving Time"},
5116 * UMTS: 29.060 v6.11.0, chapter 7.7.52
5118 * Type = 153 (Decimal)
5119 * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
5120 * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
5121 * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
5122 * its value shall be set as defined in 3GPP TS 22.042
5124 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5128 proto_tree *ext_tree;
5133 length = tvb_get_ntohs(tvb, offset + 1);
5134 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s: ", val_to_str(GTP_EXT_MS_TIME_ZONE, gtp_val, "Unknown"));
5135 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ms_time_zone);
5138 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5139 offset = offset + 2;
5141 /* 3GPP TS 23.040 version 6.6.0 Release 6
5142 * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
5144 * The Time Zone indicates the difference, expressed in quarters of an hour,
5145 * between the local time and GMT. In the first of the two semi-octets,
5146 * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
5147 * represents the algebraic sign of this difference (0: positive, 1: negative).
5150 data = tvb_get_guint8(tvb, offset);
5151 sign = (data & 0x08) ? '-' : '+';
5152 data = (data >> 4) + (data & 0x07) * 10;
5154 proto_tree_add_text(ext_tree, tvb, offset, 1, "Timezone: GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5155 proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
5158 data = tvb_get_guint8(tvb, offset) & 0x3;
5159 proto_tree_add_text(ext_tree, tvb, offset, 1, "%s", val_to_str(data, daylight_saving_time_vals, "Unknown"));
5166 * UMTS: 29.060 v6.11.0, chapter 7.7.53
5167 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
5168 * Type = 154 (Decimal)
5170 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5174 proto_tree *ext_imeisv;
5179 length = tvb_get_ntohs(tvb, offset + 1);
5180 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_IMEISV, gtp_val, "Unknown"));
5181 ext_imeisv = proto_item_add_subtree(te, ett_gtp_ext_imeisv);
5184 proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5185 offset = offset + 2;
5188 * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
5189 * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
5190 * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
5191 * set to '1111'. Both IMEI and IMEISV are BCD encoded.
5193 next_tvb = tvb_new_subset(tvb, offset, length, length);
5194 digit_str = unpack_digits(next_tvb, 0);
5195 proto_tree_add_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, digit_str);
5196 proto_item_append_text(te, ": %s", digit_str);
5202 * UMTS: 29.060 v6.11.0, chapter 7.7.54
5203 * CAMEL Charging Information Container
5204 * Type = 155 (Decimal)
5206 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5210 proto_tree *ext_tree;
5213 length = tvb_get_ntohs(tvb, offset + 1);
5214 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_CAMEL_CHG_INF_CON, gtp_val, "Unknown"));
5215 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_camel_chg_inf_con);
5218 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5219 offset = offset + 2;
5220 /* TODO add decoding of data */
5221 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5228 * UMTS: 29.060 v6.11.0, chapter 7.7.55
5231 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5235 proto_tree *ext_tree;
5238 length = tvb_get_ntohs(tvb, offset + 1);
5239 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_UE_CTX, gtp_val, "Unknown"));
5240 ext_tree = proto_item_add_subtree(te, ett_GTP_EXT_MBMS_UE_CTX);
5243 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5244 offset = offset + 2;
5245 /* TODO add decoding of data */
5246 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5253 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
5254 * Temporary Mobile Group Identity (TMGI)
5255 * The Temporary Mobile Group Identity (TMGI) information element contains
5256 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
5257 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
5260 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5264 proto_tree *ext_tree, *tmgi_tree;
5265 proto_item *te, *ti;
5268 length = tvb_get_ntohs(tvb, offset + 1);
5269 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_TMGI, gtp_val, "Unknown"));
5270 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_tmgi);
5273 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5274 offset = offset + 2;
5276 ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, FALSE);
5278 tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
5279 next_tvb = tvb_new_subset(tvb, offset, length, length);
5280 de_mid(next_tvb, tmgi_tree, 0, length, NULL, 0);
5286 * UMTS: 29.060 v6.11.0, chapter 7.7.57
5287 * RIM Routing Address
5289 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5293 proto_tree *ext_tree;
5296 length = tvb_get_ntohs(tvb, offset + 1);
5297 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_RIM_RA, gtp_val, "Unknown"));
5298 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rim_ra);
5301 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5302 offset = offset + 2;
5303 /* TODO add decoding of data */
5304 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5306 * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
5314 * UMTS: 29.060 v6.11.0, chapter 7.7.58
5315 * MBMS Protocol Configuration Options
5317 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5321 proto_tree *ext_tree;
5324 length = tvb_get_ntohs(tvb, offset + 1);
5325 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_PROT_CONF_OPT, gtp_val, "Unknown"));
5326 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_prot_conf_opt);
5329 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5330 offset = offset + 2;
5331 /* TODO add decoding of data */
5332 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5339 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
5340 * MBMS Session Duration
5342 /* Used for Diameter */
5343 static int dissect_gtp_mbms_ses_dur(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5348 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5349 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5355 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5359 proto_tree *ext_tree;
5362 length = tvb_get_ntohs(tvb, offset + 1);
5363 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_SES_DUR, gtp_val, "Unknown"));
5364 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bms_ses_dur);
5367 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5368 offset = offset + 2;
5369 /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
5370 * The MBMS Session Duration information element indicates the estimated
5371 * session duration of the MBMS service data transmission if available.
5372 * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
5373 * in 3GPP TS 29.061 [27], excluding the AVP Header fields
5374 * (as defined in IETF RFC 3588 [36], section 4.1).
5376 /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
5377 * with a length of three octets and indicates the estimated session duration
5378 * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
5379 * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
5380 * for which the maximum allowed value is 18 days. For the whole session duration the seconds
5381 * and days are added together and the maximum session duration is 19 days.
5383 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5384 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5391 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
5394 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5398 proto_tree *ext_tree;
5399 proto_item *te, *item;
5400 guint8 no_of_mbms_sa_codes;
5403 length = tvb_get_ntohs(tvb, offset + 1);
5404 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_SA, gtp_val, "Unknown"));
5405 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_sa);
5408 item = proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5409 offset = offset + 2;
5410 /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
5411 * The MBMS Service Area information element indicates the area over
5412 * which the Multimedia Broadcast/Multicast Service is to be distributed.
5413 * The payload shall be encoded as per the MBMS-Service-Area AVP defined
5414 * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
5415 * IETF RFC 3588 [36], section 4.1).
5417 /* Number N of MBMS service area codes coded as:
5418 * 1 binary value is '00000000'
5420 * 256 binary value is '11111111'
5422 no_of_mbms_sa_codes = tvb_get_guint8(tvb, offset) + 1;
5423 if (length != ((no_of_mbms_sa_codes << 1) + 1)) {
5424 expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_WARN,
5425 "Wrong length: %u. The length of an MBMS service area code is 2 octets", length);
5427 proto_tree_add_uint(ext_tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
5429 /* A consecutive list of N MBMS service area codes
5430 * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
5431 * The length of an MBMS service area code is 2 octets.
5433 for (i = 0; i < no_of_mbms_sa_codes; i++) {
5434 proto_tree_add_item(ext_tree, hf_gtp_mbms_sa_code, tvb, offset, 2, FALSE);
5435 offset = offset + 2;
5443 * UMTS: 29.060 v6.11.0, chapter 7.7.61
5444 * Source RNC PDCP context info
5446 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5450 proto_tree *ext_tree;
5453 length = tvb_get_ntohs(tvb, offset + 1);
5454 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_SRC_RNC_PDP_CTX_INF, gtp_val, "Unknown"));
5455 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_src_rnc_pdp_ctx_inf);
5458 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5459 offset = offset + 2;
5460 /* TODO add decoding of data */
5461 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5468 * UMTS: 29.060 v6.11.0, chapter 7.7.62
5469 * Additional Trace Info
5471 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5475 proto_tree *ext_tree;
5478 length = tvb_get_ntohs(tvb, offset + 1);
5479 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_ADD_TRS_INF, gtp_val, "Unknown"));
5480 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_add_trs_inf);
5483 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5484 offset = offset + 2;
5485 /* TODO add decoding of data */
5486 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5493 * UMTS: 29.060 v6.11.0, chapter 7.7.63
5496 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5500 proto_tree *ext_tree;
5503 length = tvb_get_ntohs(tvb, offset + 1);
5504 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_HOP_COUNT, gtp_val, "Unknown"));
5505 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_hop_count);
5508 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5509 offset = offset + 2;
5510 /* TODO add decoding of data */
5511 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5518 * UMTS: 29.060 v6.11.0, chapter 7.7.64
5521 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5525 proto_tree *ext_tree;
5528 length = tvb_get_ntohs(tvb, offset + 1);
5529 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_SEL_PLMN_ID, gtp_val, "Unknown"));
5530 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_sel_plmn_id);
5533 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5534 offset = offset + 2;
5535 /* TODO add decoding of data */
5536 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5543 * UMTS: 29.060 v6.11.0, chapter 7.7.65
5544 * MBMS Session Identifier
5546 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5550 proto_tree *ext_tree;
5553 length = tvb_get_ntohs(tvb, offset + 1);
5554 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_SES_ID, gtp_val, "Unknown"));
5555 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id);
5558 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5559 offset = offset + 2;
5560 /* TODO add decoding of data */
5561 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5568 * UMTS: 29.060 v6.11.0, chapter 7.7.66
5569 * MBMS 2G/3G Indicator
5571 static const value_string gtp_mbs_2g_3g_ind_vals[] = {
5574 {2, "Both 2G and 3G"},
5578 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5582 proto_tree *ext_tree;
5585 length = tvb_get_ntohs(tvb, offset + 1);
5586 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_2G_3G_IND, gtp_val, "Unknown"));
5587 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_2g_3g_ind);
5590 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5591 offset = offset + 2;
5592 /* MBMS 2G/3G Indicator */
5593 proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, FALSE);
5600 * UMTS: 29.060 v6.11.0, chapter 7.7.67
5603 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5607 proto_tree *ext_tree;
5610 length = tvb_get_ntohs(tvb, offset + 1);
5611 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_ENH_NSAPI, gtp_val, "Unknown"));
5612 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_enh_nsapi);
5615 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5616 offset = offset + 2;
5617 /* TODO add decoding of data */
5618 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5625 * UMTS: 29.060 v6.11.0, chapter 7.7.68
5626 * Additional MBMS Trace Info
5628 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5632 proto_tree *ext_tree;
5635 length = tvb_get_ntohs(tvb, offset + 1);
5636 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_ADD_MBMS_TRS_INF, gtp_val, "Unknown"));
5637 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ad_mbms_trs_inf);
5640 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5641 offset = offset + 2;
5642 /* TODO add decoding of data */
5643 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5650 * UMTS: 29.060 v6.11.0, chapter 7.7.69
5651 * MBMS Session Identity Repetition Number
5653 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5657 proto_tree *ext_tree;
5660 length = tvb_get_ntohs(tvb, offset + 1);
5661 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_SES_ID_REP_NO, gtp_val, "Unknown"));
5662 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id_rep_no);
5665 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5666 offset = offset + 2;
5667 /* TODO add decoding of data */
5668 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5675 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
5676 * MBMS Time To Data Transfer
5678 /* Used for Diameter */
5679 static int dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb _U_, packet_info * pinfo _U_, proto_tree * tree _U_)
5683 guint8 time_2_dta_tr;
5685 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5686 proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5692 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5696 proto_tree *ext_tree;
5698 guint8 time_2_dta_tr;
5700 length = tvb_get_ntohs(tvb, offset + 1);
5701 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MBMS_TIME_TO_DATA_TR, gtp_val, "Unknown"));
5702 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_time_to_data_tr);
5705 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5706 offset = offset + 2;
5707 /* TODO add decoding of data
5708 * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
5709 * The MBMS Time To Data Transfer information element contains a
5710 * MBMS Time To Data Transfer allocated by the BM-SC.
5711 * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
5712 * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
5713 * (as defined in IETF RFC 3588 [36], section 4.1).
5715 /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
5716 * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
5719 * 0 0 0 0 0 0 0 0 1s
5720 * 0 0 0 0 0 0 0 1 2s
5721 * 0 0 0 0 0 0 1 0 3s
5723 * 1 1 1 1 1 1 1 1 256s
5725 time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
5726 proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5733 * UMTS: 29.060 v6.11.0, chapter 7.7.71
5734 * PS Handover Request Context
5737 decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5741 proto_tree *ext_tree;
5744 length = tvb_get_ntohs(tvb, offset + 1);
5745 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_PS_HO_REQ_CTX, gtp_val, "Unknown"));
5746 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_ho_req_ctx);
5749 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5750 offset = offset + 2;
5751 /* TODO add decoding of data */
5752 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5759 * UMTS: 29.060 v6.11.0, chapter 7.7.72
5763 decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5767 proto_tree *ext_tree;
5770 length = tvb_get_ntohs(tvb, offset + 1);
5771 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_BSS_CONT, gtp_val, "Unknown"));
5772 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bss_cont);
5775 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5776 offset = offset + 2;
5777 /* TODO add decoding of data */
5778 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5780 * The content of this container is defined in 3GPP TS 48.018
5788 * UMTS: 29.060 v6.11.0, chapter 7.7.73
5789 * Cell Identification
5792 decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5796 proto_tree *ext_tree;
5799 length = tvb_get_ntohs(tvb, offset + 1);
5800 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_CELL_ID, gtp_val, "Unknown"));
5801 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_cell_id);
5804 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5805 offset = offset + 2;
5806 /* TODO add decoding of data */
5807 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5809 * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
5810 * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
5812 * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
5813 * source RNC (RNC-ID) as defined in 3GPP TS 48.018
5821 * UMTS: 29.060 v6.11.0, chapter 7.7.74
5825 decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5829 proto_tree *ext_tree;
5832 length = tvb_get_ntohs(tvb, offset + 1);
5833 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_PDU_NO, gtp_val, "Unknown"));
5834 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
5837 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5838 offset = offset + 2;
5839 /* TODO add decoding of data */
5840 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5847 * UMTS: 29.060 v6.11.0, chapter 7.7.75
5851 decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5855 proto_tree *ext_tree;
5858 length = tvb_get_ntohs(tvb, offset + 1);
5859 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_BSSGP_CAUSE, gtp_val, "Unknown"));
5860 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
5863 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5864 offset = offset + 2;
5867 * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
5869 proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 2, FALSE);
5876 * Required MBMS bearer capabilities 7.7.76
5879 decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5882 proto_tree *ext_tree;
5885 length = tvb_get_ntohs(tvb, offset + 1);
5886 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_BSSGP_CAUSE, gtp_val, "Unknown"));
5887 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
5890 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5891 offset = offset + 2;
5892 /* The payload shall be encoded as per the
5893 * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
5894 * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
5896 /* TODO Add decoding (call Diameter dissector???) */
5901 * RIM Routing Address Discriminator 7.7.77
5904 decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5908 proto_tree *ext_tree;
5911 length = tvb_get_ntohs(tvb, offset + 1);
5912 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_RIM_ROUTING_ADDR_DISC, gtp_val, "Unknown"));
5913 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
5916 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5917 offset = offset + 2;
5918 /* TODO add decoding of data */
5919 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5925 * List of set-up PFCs 7.7.78
5928 decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5932 proto_tree *ext_tree;
5935 length = tvb_get_ntohs(tvb, offset + 1);
5936 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_LIST_OF_SETUP_PFCS, gtp_val, "Unknown"));
5937 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
5940 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5941 offset = offset + 2;
5942 /* TODO add decoding of data */
5943 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5949 * PS Handover XID Parameters 7.7.79
5951 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5955 proto_tree *ext_tree;
5961 length = tvb_get_ntohs(tvb, offset + 1);
5962 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_PS_HANDOVER_XIP_PAR, gtp_val, "Unknown"));
5963 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_handover_xid);
5966 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5967 offset = offset + 2;
5969 sapi = tvb_get_guint8(tvb, offset) & 0x0F;
5970 proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
5973 xid_par_len = tvb_get_guint8(tvb, offset);
5974 proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
5977 if (sndcpxid_handle) {
5978 next_tvb = tvb_new_subset_remaining(tvb, offset);
5979 call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
5981 proto_tree_add_text(tree, tvb, offset, 0, "Data");
5988 * MS Info Change Reporting Action 7.7.80
5990 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
5994 proto_tree *ext_tree;
5997 length = tvb_get_ntohs(tvb, offset + 1);
5998 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_MS_INF_CHG_REP_ACT, gtp_val, "Unknown"));
5999 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6002 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6003 offset = offset + 2;
6004 /* TODO add decoding of data */
6005 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6011 * Direct Tunnel Flags 7.7.81
6013 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6017 proto_tree *ext_tree;
6020 length = tvb_get_ntohs(tvb, offset + 1);
6021 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_DIRECT_TUNNEL_FLGS, gtp_val, "Unknown"));
6022 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6025 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6026 offset = offset + 2;
6027 /* TODO add decoding of data */
6028 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6029 proto_tree_add_item(ext_tree, hf_gtp_ext_ei, tvb, offset, 1, FALSE);
6030 proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, FALSE);
6031 proto_tree_add_item(ext_tree, hf_gtp_ext_dti, tvb, offset, 1, FALSE);
6038 * Correlation-ID 7.7.82
6040 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6044 proto_tree *ext_tree;
6047 length = tvb_get_ntohs(tvb, offset + 1);
6048 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str(GTP_EXT_CORRELATION_ID, gtp_val, "Unknown"));
6049 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6052 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6053 offset = offset + 2;
6054 /* TODO add decoding of data */
6055 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6061 * Bearer Control Mode 7.7.83
6063 static int decode_gtp_bearer_cntrl_mod(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(GTP_EXT_BEARER_CONTROL_MODE, gtp_val, "Unknown"));
6072 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
6075 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6076 offset = offset + 2;
6077 /* TODO add decoding of data */
6078 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
6086 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6089 guint16 length, n, number;
6090 proto_tree *ext_tree_rel_pack;
6093 length = tvb_get_ntohs(tvb, offset + 1);
6095 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
6096 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
6100 while (n < length) {
6102 number = tvb_get_ntohs(tvb, offset + 3 + n);
6103 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
6114 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6117 guint16 length, n, number;
6118 proto_tree *ext_tree_can_pack;
6121 length = tvb_get_ntohs(tvb, offset + 1);
6123 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
6124 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
6128 while (n < length) {
6130 number = tvb_get_ntohs(tvb, offset + 3 + n);
6131 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
6138 /* CDRs dissector */
6139 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6142 guint16 length, format_ver;
6144 proto_tree *ext_tree;
6148 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
6149 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
6151 length = tvb_get_ntohs(tvb, offset + 1);
6152 no = tvb_get_guint8(tvb, offset + 3);
6153 format = tvb_get_guint8(tvb, offset + 4);
6154 format_ver = tvb_get_ntohs(tvb, offset + 5);
6156 proto_tree_add_text(ext_tree, tvb, offset + 1, 2, "Length: %u", length);
6157 proto_tree_add_text(ext_tree, tvb, offset + 3, 1, "Number of data records: %u", no);
6158 proto_tree_add_text(ext_tree, tvb, offset + 4, 1, "Data record format: %u", format);
6159 proto_tree_add_text(ext_tree, tvb, offset + 5, 2, "Data record format version: %u", format_ver);
6161 if (gtpcdr_handle) {
6162 next_tvb = tvb_new_subset_remaining(tvb, offset);
6163 call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
6165 proto_tree_add_text(tree, tvb, offset, 0, "Data");
6173 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6176 guint16 length, n, number;
6177 proto_tree *ext_tree_data_resp;
6180 length = tvb_get_ntohs(tvb, offset + 1);
6182 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
6183 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
6187 while (n < length) {
6189 number = tvb_get_ntohs(tvb, offset + 3 + n);
6190 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
6202 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6207 struct e_in6_addr addr_ipv6;
6208 proto_tree *ext_tree_node_addr;
6211 length = tvb_get_ntohs(tvb, offset + 1);
6213 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Node address: ");
6214 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
6216 proto_tree_add_text(ext_tree_node_addr, tvb, offset + 1, 2, "Node address length: %u", length);
6220 addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
6221 proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
6222 proto_tree_add_ipv4(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, addr_ipv4);
6225 tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
6226 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
6227 proto_tree_add_ipv6(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
6230 proto_item_append_text(te, "unknown type or wrong length");
6238 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
6239 * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
6243 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6246 guint16 length, ext_id;
6247 proto_tree *ext_tree_priv_ext;
6250 te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str(GTP_EXT_PRIV_EXT, gtp_val, "Unknown message"));
6251 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
6254 length = tvb_get_ntohs(tvb, offset);
6255 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, FALSE);
6256 offset = offset + 2;
6258 ext_id = tvb_get_ntohs(tvb, offset);
6259 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
6260 offset = offset + 2;
6263 * XXX - is this always a text string? Or should it be
6264 * displayed as hex data?
6267 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, FALSE);
6273 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
6276 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
6278 return tvb_length_remaining(tvb, offset);
6281 static void dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
6283 struct _gtp_hdr gtp_hdr;
6284 proto_tree *gtp_tree, *flags_tree;
6285 proto_item *ti, *tf;
6286 int i, offset, length, gtp_prime, checked_field, mandatory;
6287 int seq_no=0, flow_label=0;
6288 guint8 pdu_no, next_hdr = 0, ext_hdr_val, version;
6289 const guint8 *tid_val;
6293 guint8 sub_proto, acfield_len = 0, control_field;
6294 gtp_msg_hash_t *gcrp=NULL;
6295 conversation_t *conversation=NULL;
6296 gtp_conv_info_t *gtp_info=(gtp_conv_info_t *)pinfo->private_data;
6300 * If this is GTPv2-C call the gtpv2 dissector if present
6301 * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
6303 version = tvb_get_guint8(tvb,0)>>5;
6305 /* GTPv2-C 3GPP TS 29.274 */
6307 call_dissector(gtpv2_handle, tvb, pinfo, tree);
6312 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
6313 col_clear(pinfo->cinfo, COL_INFO);
6316 * Do we have a conversation for this connection?
6318 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
6319 pinfo->ptype, pinfo->srcport,
6320 pinfo->destport, 0);
6321 if (conversation == NULL) {
6322 /* We don't yet have a conversation, so create one. */
6323 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
6324 pinfo->ptype, pinfo->srcport,
6325 pinfo->destport, 0);
6328 * Do we already know this conversation?
6330 gtp_info = conversation_get_proto_data(conversation, proto_gtp);
6331 if (gtp_info == NULL) {
6332 /* No. Attach that information to the conversation, and add
6333 * it to the list of information structures.
6335 gtp_info = g_malloc(sizeof(gtp_conv_info_t));
6336 /*Request/response matching tables*/
6337 gtp_info->matched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_matched);
6338 gtp_info->unmatched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_unmatched);
6340 conversation_add_proto_data(conversation, proto_gtp, gtp_info);
6342 gtp_info->next = gtp_info_items;
6343 gtp_info_items = gtp_info;
6345 pd_save = pinfo->private_data;
6346 pinfo->private_data = gtp_info;
6348 tvb_memcpy(tvb, (guint8 *) & gtp_hdr, 0, 4);
6350 if (!(gtp_hdr.flags & 0x10))
6355 switch ((gtp_hdr.flags >> 5) & 0x07) {
6367 if (check_col(pinfo->cinfo, COL_INFO))
6368 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtp_hdr.message, message_type, "Unknown"));
6371 ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, FALSE);
6372 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
6374 tf = proto_tree_add_uint(gtp_tree, hf_gtp_flags, tvb, 0, 1, gtp_hdr.flags);
6375 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
6377 proto_tree_add_uint(flags_tree, hf_gtp_flags_ver, tvb, 0, 1, gtp_hdr.flags);
6380 proto_tree_add_text(tree, tvb, 0, -1, "No WS dissector for GTP version %u %s", version, val_to_str(version, ver_types, "Unknown"));
6381 pinfo->private_data = pd_save;
6385 proto_tree_add_uint(flags_tree, hf_gtp_flags_pt, tvb, 0, 1, gtp_hdr.flags);
6387 switch (gtp_version) {
6389 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare1, tvb, 0, 1, gtp_hdr.flags);
6390 proto_tree_add_boolean(flags_tree, hf_gtp_flags_snn, tvb, 0, 1, gtp_hdr.flags);
6393 proto_tree_add_uint(flags_tree, hf_gtp_flags_spare2, tvb, 0, 1, gtp_hdr.flags);
6394 proto_tree_add_boolean(flags_tree, hf_gtp_flags_e, tvb, 0, 1, gtp_hdr.flags);
6395 proto_tree_add_boolean(flags_tree, hf_gtp_flags_s, tvb, 0, 1, gtp_hdr.flags);
6396 proto_tree_add_boolean(flags_tree, hf_gtp_flags_pn, tvb, 0, 1, gtp_hdr.flags);
6402 proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, 1, 1, gtp_hdr.message);
6404 gtp_hdr.length = g_ntohs(gtp_hdr.length);
6405 proto_tree_add_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, gtp_hdr.length);
6410 seq_no = tvb_get_ntohs(tvb, offset);
6411 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6414 switch (gtp_version) {
6416 seq_no = tvb_get_ntohs(tvb, offset);
6417 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6420 flow_label = tvb_get_ntohs(tvb, offset);
6421 proto_tree_add_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
6424 pdu_no = tvb_get_guint8(tvb, offset);
6425 proto_tree_add_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
6428 tid_val = tvb_get_ptr(tvb, offset, 8);
6429 tid_str = id_to_str(tid_val);
6430 proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
6434 teid = tvb_get_ntohl(tvb, offset);
6435 proto_tree_add_uint(gtp_tree, hf_gtp_teid, tvb, offset, 4, teid);
6438 if (gtp_hdr.flags & 0x07) {
6439 seq_no = tvb_get_ntohs(tvb, offset);
6440 proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
6443 pdu_no = tvb_get_guint8(tvb, offset);
6444 proto_tree_add_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, pdu_no);
6447 next_hdr = tvb_get_guint8(tvb, offset);
6448 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6457 if (gtp_hdr.message != GTP_MSG_TPDU) {
6458 /* TODO: This code should be cleaned up to handle more than one
6459 * header and possibly display the header content */
6464 /* MBMS support indication */
6465 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MBMS support indication header ---]");
6469 /* MS Info Change Reporting support indication */
6470 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- MS Info Change Reporting support indication header ---]");
6474 /* PDCP PDU number */
6475 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- PDCP PDU number header ---]");
6479 /* Suspend Request */
6480 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Request header ---]");
6484 /* Suspend Response */
6485 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Suspend Response header ---]");
6489 proto_tree_add_text(gtp_tree, tvb, offset, 4, "[--- Unknown extension header ---]");
6493 next_hdr = tvb_get_guint8(tvb, offset);
6494 proto_tree_add_uint(gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
6497 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[--- end of GTP header, beginning of extension headers ---]");
6498 length = tvb_length(tvb);
6499 mandatory = 0; /* check order of GTP fields against ETSI */
6501 if (offset >= length)
6504 ext_hdr_val = next_hdr;
6507 ext_hdr_val = tvb_get_guint8(tvb, offset);
6508 if (g_gtp_etsi_order) {
6509 checked_field = check_field_presence(gtp_hdr.message, ext_hdr_val, (int *) &mandatory);
6510 switch (checked_field) {
6512 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] message not found");
6515 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] field not present");
6520 proto_tree_add_text(gtp_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s",
6521 val_to_str(checked_field, gtp_val, "Unknown extension field"));
6527 while (gtpopt[++i].optcode)
6528 if (gtpopt[i].optcode == ext_hdr_val)
6530 offset = offset + (*gtpopt[i].decode) (tvb, offset, pinfo, gtp_tree);
6533 /*Use sequence number to track Req/Resp pairs*/
6535 gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr.message);
6536 /*pass packet to tap for response time reporting*/
6538 tap_queue_packet(gtp_tap,pinfo,gcrp);
6544 if ((gtp_hdr.message == GTP_MSG_TPDU) && g_gtp_tpdu) {
6548 else if (gtp_version == 1) {
6549 if (gtp_hdr.flags & 0x07) {
6551 if (tvb_get_guint8(tvb, offset) == 0)
6558 sub_proto = tvb_get_guint8(tvb, offset);
6560 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
6561 /* this is most likely an IPv4 packet
6562 * we can exclude 0x40 - 0x44 because the minimum header size is 20 octets
6563 * 0x4f is excluded because PPP protocol type "IPv6 header compression"
6564 * with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
6566 next_tvb = tvb_new_subset_remaining(tvb, offset);
6567 call_dissector(ip_handle, next_tvb, pinfo, tree);
6569 } else if ((sub_proto & 0xf0) == 0x60) {
6570 /* this is most likely an IPv6 packet */
6571 next_tvb = tvb_new_subset_remaining(tvb, offset);
6572 call_dissector(ipv6_handle, next_tvb, pinfo, tree);
6574 /* this seems to be a PPP packet */
6576 if (sub_proto == 0xff) {
6577 /* this might be an address field, even it shouldn't be here */
6578 control_field = tvb_get_guint8(tvb, offset + 1);
6579 if (control_field == 0x03)
6580 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
6584 next_tvb = tvb_new_subset_remaining(tvb, offset + acfield_len);
6585 call_dissector(ppp_handle, next_tvb, pinfo, tree);
6588 if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
6589 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <");
6590 col_append_str(pinfo->cinfo, COL_PROTOCOL, ">");
6593 pinfo->private_data = pd_save;
6596 static const true_false_string yes_no_tfs = {
6601 static void gtp_reinit(void)
6603 gtp_conv_info_t *gtp_info;
6605 /* Free up state attached to the gtp_info structures */
6606 for (gtp_info = gtp_info_items; gtp_info != NULL; ) {
6607 gtp_conv_info_t *next;
6609 g_hash_table_destroy(gtp_info->matched);
6610 gtp_info->matched=NULL;
6611 g_hash_table_destroy(gtp_info->unmatched);
6612 gtp_info->unmatched=NULL;
6614 next = gtp_info->next;
6619 gtp_info_items = NULL;
6622 void proto_register_gtp(void)
6624 static hf_register_info hf_gtp[] = {
6626 {&hf_gtp_response_in,
6627 {"Response In", "gtp.response_in", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "The response to this GTP request is in this frame", HFILL}},
6628 {&hf_gtp_response_to,
6629 {"Response To", "gtp.response_to", FT_FRAMENUM, BASE_NONE, NULL, 0x0, "This is a response to the GTP request in this frame", HFILL}},
6630 {&hf_gtp_time, {"Time", "gtp.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Request and the Response", HFILL}},
6631 {&hf_gtp_apn, {"APN", "gtp.apn", FT_STRING, BASE_NONE, NULL, 0, "Access Point Name", HFILL}},
6632 {&hf_gtp_cause, {"Cause", "gtp.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL}},
6633 {&hf_gtp_chrg_char, {"Charging characteristics", "gtp.chrg_char", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL}},
6634 {&hf_gtp_chrg_char_s, {"Spare", "gtp.chrg_char_s", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, NULL, HFILL}},
6635 {&hf_gtp_chrg_char_n, {"Normal charging", "gtp.chrg_char_n", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, NULL, HFILL}},
6636 {&hf_gtp_chrg_char_p, {"Prepaid charging", "gtp.chrg_char_p", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, NULL, HFILL}},
6637 {&hf_gtp_chrg_char_f,
6638 {"Flat rate charging", "gtp.chrg_char_f", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, NULL, HFILL}},
6639 {&hf_gtp_chrg_char_h,
6640 {"Hot billing charging", "gtp.chrg_char_h", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, NULL, HFILL}},
6641 {&hf_gtp_chrg_char_r, {"Reserved", "gtp.chrg_char_r", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, NULL, HFILL}},
6642 {&hf_gtp_chrg_id, {"Charging ID", "gtp.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
6643 {&hf_gtp_chrg_ipv4, {"CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Charging Gateway address IPv4", HFILL}},
6644 {&hf_gtp_chrg_ipv6, {"CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Charging Gateway address IPv6", HFILL}},
6645 {&hf_gtp_ext_flow_label, {"Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL}},
6646 {&hf_gtp_ext_id, {"Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC, VALS(sminmpec_values), 0, "Extension Identifier", HFILL}},
6647 {&hf_gtp_ext_val, {"Extension value", "gtp.ext_val", FT_BYTES, BASE_NONE, NULL, 0, "Extension Value", HFILL}},
6648 {&hf_gtp_flags, {"Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL}},
6650 {"Version", "gtp.flags.version",
6651 FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
6652 "GTP Version", HFILL}
6655 {"Protocol type", "gtp.flags.payload",
6656 FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
6657 "Protocol Type", HFILL}
6659 {&hf_gtp_flags_spare1,
6660 {"Reserved", "gtp.flags.reserved",
6661 FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
6662 "Reserved (shall be sent as '111' )", HFILL}
6665 {"Is SNDCP N-PDU included?", "gtp.flags.snn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_SNN_MASK,
6666 "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}},
6667 {&hf_gtp_flags_spare2,
6668 {"Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, "Reserved (shall be sent as '1' )", HFILL}},
6670 {"Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_E_MASK,
6671 "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}},
6673 {"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)",
6676 {"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)",
6678 {&hf_gtp_flow_ii, {"Flow Label Data II", "gtp.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL}},
6679 {&hf_gtp_flow_label, {"Flow label", "gtp.flow_label", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6680 {&hf_gtp_flow_sig, {"Flow label Signalling", "gtp.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, "Flow label signalling", HFILL}},
6681 {&hf_gtp_gsn_addr_len,
6682 {"GSN Address Length", "gtp.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, NULL, HFILL}},
6683 {&hf_gtp_gsn_addr_type,
6684 {"GSN Address Type", "gtp.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, NULL, HFILL}},
6685 {&hf_gtp_gsn_ipv4, {"GSN address IPv4", "gtp.gsn_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
6686 {&hf_gtp_gsn_ipv6, {"GSN address IPv6", "gtp.gsn_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
6687 {&hf_gtp_imsi, {"IMSI", "gtp.imsi", FT_STRING, BASE_NONE, NULL, 0, "International Mobile Subscriber Identity number", HFILL}},
6688 {&hf_gtp_length, {"Length", "gtp.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL}},
6689 {&hf_gtp_map_cause, {"MAP cause", "gtp.map_cause", FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0, NULL, HFILL}},
6690 {&hf_gtp_message_type, {"Message Type", "gtp.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL}},
6692 {"MS not reachable reason", "gtp.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, "MS Not Reachable Reason", HFILL}},
6693 {&hf_gtp_ms_valid, {"MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6694 {&hf_gtp_msisdn, {"MSISDN", "gtp.msisdn", FT_STRING, BASE_NONE, NULL, 0, "MS international PSTN/ISDN number", HFILL}},
6696 {"Next extension header type", "gtp.next", FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0, "Next Extension Header Type",
6698 {&hf_gtp_node_ipv4, {"Node address IPv4", "gtp.node_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Recommended node address IPv4", HFILL}},
6699 {&hf_gtp_node_ipv6, {"Node address IPv6", "gtp.node_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Recommended node address IPv6", HFILL}},
6700 {&hf_gtp_npdu_number, {"N-PDU Number", "gtp.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
6701 {&hf_gtp_nsapi, {"NSAPI", "gtp.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL}},
6702 {&hf_gtp_qos_version, {"Version", "gtp.qos_version", FT_STRING, BASE_NONE, NULL, 0, "Version of the QoS Profile", HFILL}},
6703 {&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}},
6705 {"QoS delay", "gtp.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL}},
6706 {&hf_gtp_qos_reliability,
6707 {"QoS reliability", "gtp.qos_reliabilty", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
6708 "Quality of Service Reliability Class", HFILL}},
6710 {"QoS peak", "gtp.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL}},
6711 {&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}},
6712 {&hf_gtp_qos_precedence,
6713 {"QoS precedence", "gtp.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
6714 "Quality of Service Precedence Class", HFILL}},
6715 {&hf_gtp_qos_spare3,
6716 {"Spare", "gtp.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL}},
6718 {"QoS mean", "gtp.qos_mean", FT_UINT8, BASE_DEC, VALS(qos_mean_type), GTP_EXT_QOS_MEAN_MASK, "Quality of Service Mean Throughput", HFILL}},
6719 {&hf_gtp_qos_al_ret_priority,
6720 {"Allocation/Retention priority", "gtp.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, "Allocation/Retention Priority", HFILL}},
6721 {&hf_gtp_qos_traf_class,
6722 {"Traffic class", "gtp.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, "Traffic Class", HFILL}},
6723 {&hf_gtp_qos_del_order,
6724 {"Delivery order", "gtp.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, "Delivery Order", HFILL}},
6725 {&hf_gtp_qos_del_err_sdu,
6726 {"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,
6727 "Delivery of Erroneous SDU", HFILL}},
6728 {&hf_gtp_qos_max_sdu_size,
6729 {"Maximum SDU size", "gtp.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, NULL, HFILL}},
6730 {&hf_gtp_qos_max_ul,
6731 {"Maximum bit rate for uplink", "gtp.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, NULL, HFILL}},
6732 {&hf_gtp_qos_max_dl,
6733 {"Maximum bit rate for downlink", "gtp.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, NULL, HFILL}},
6734 {&hf_gtp_qos_res_ber,
6735 {"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}},
6736 {&hf_gtp_qos_sdu_err_ratio,
6737 {"SDU Error ratio", "gtp.qos_sdu_err_ratio", FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK, "SDU Error Ratio",
6739 {&hf_gtp_qos_trans_delay,
6740 {"Transfer delay", "gtp.qos_trans_delay", FT_UINT8, BASE_DEC, VALS(qos_trans_delay), GTP_EXT_QOS_TRANS_DELAY_MASK, "Transfer Delay", HFILL}},
6741 {&hf_gtp_qos_traf_handl_prio,
6742 {"Traffic handling priority", "gtp.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
6743 "Traffic Handling Priority", HFILL}},
6744 {&hf_gtp_qos_guar_ul,
6745 {"Guaranteed bit rate for uplink", "gtp.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, NULL, HFILL}},
6746 {&hf_gtp_qos_guar_dl,
6747 {"Guaranteed bit rate for downlink", "gtp.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, NULL,
6749 {&hf_gtp_qos_src_stat_desc,
6750 {"Source Statistics Descriptor", "gtp.src_stat_desc", FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), 0xf, NULL, HFILL}},
6751 {&hf_gtp_qos_sig_ind,
6752 {"Signalling Indication", "gtp.sig_ind", FT_BOOLEAN, 8, TFS(>p_sig_ind), 0x10, NULL, HFILL}},
6753 {&hf_gtp_pkt_flow_id, {"Packet Flow ID", "gtp.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6754 {&hf_gtp_ptmsi, {"P-TMSI", "gtp.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL}},
6755 {&hf_gtp_ptmsi_sig, {"P-TMSI Signature", "gtp.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL}},
6756 {&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}},
6757 {&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}},
6758 {&hf_gtp_rab_pdu_dn,
6759 {"Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL}},
6760 {&hf_gtp_rab_pdu_up,
6761 {"Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL}},
6762 {&hf_gtp_rai_mcc, {"MCC", "gtp.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL}},
6763 {&hf_gtp_rai_mnc, {"MNC", "gtp.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL}},
6764 {&hf_gtp_rai_rac, {"RAC", "gtp.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL}},
6765 {&hf_gtp_rai_lac, {"LAC", "gtp.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL}},
6766 {&hf_gtp_ranap_cause, {"RANAP cause", "gtp.ranap_cause", FT_UINT8, BASE_DEC, VALS(ranap_cause_type), 0, NULL, HFILL}},
6767 {&hf_gtp_recovery, {"Recovery", "gtp.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL}},
6768 {&hf_gtp_reorder, {"Reordering required", "gtp.reorder", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6769 {&hf_gtp_rnc_ipv4, {"RNC address IPv4", "gtp.rnc_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "Radio Network Controller address IPv4", HFILL}},
6770 {&hf_gtp_rnc_ipv6, {"RNC address IPv6", "gtp.rnc_ipv6", FT_IPv6, BASE_NONE, NULL, 0, "Radio Network Controller address IPv6", HFILL}},
6771 {&hf_gtp_rp, {"Radio Priority", "gtp.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL}},
6773 {"NSAPI in Radio Priority", "gtp.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
6774 "Network layer Service Access Point Identifier in Radio Priority", HFILL}},
6775 {&hf_gtp_rp_sms, {"Radio Priority SMS", "gtp.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL}},
6776 {&hf_gtp_rp_spare, {"Reserved", "gtp.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL}},
6778 {"Selection mode", "gtp.sel_mode",
6779 FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03,
6780 "Selection Mode", HFILL}
6782 {&hf_gtp_seq_number, {"Sequence number", "gtp.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL}},
6783 {&hf_gtp_sndcp_number, {"SNDCP N-PDU LLC Number", "gtp.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL}},
6784 {&hf_gtp_tear_ind, {"Teardown Indicator", "gtp.tear_ind", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
6785 {&hf_gtp_teid, {"TEID", "gtp.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL}},
6786 {&hf_gtp_teid_cp, {"TEID Control Plane", "gtp.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL}},
6787 {&hf_gtp_ulink_teid_cp,
6788 {"Uplink TEID Control Plane", "gtp.ulink_teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}},
6789 {&hf_gtp_teid_data, {"TEID Data I", "gtp.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL}},
6790 {&hf_gtp_ulink_teid_data,
6791 {"Uplink TEID Data I", "gtp.ulink_teid_data", FT_UINT32, BASE_HEX, NULL, 0, "UplinkTunnel Endpoint Identifier Data I", HFILL}},
6792 {&hf_gtp_teid_ii, {"TEID Data II", "gtp.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL}},
6794 {"TFT operation code", "gtp.tft_code", FT_UINT8, BASE_DEC, VALS(tft_code_type), GTPv1_TFT_CODE_MASK, NULL, HFILL}},
6795 {&hf_gtp_tft_spare, {"TFT spare bit", "gtp.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, NULL, HFILL}},
6796 {&hf_gtp_tft_number,
6797 {"Number of packet filters", "gtp.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, NULL, HFILL}},
6798 {&hf_gtp_tft_eval, {"Evaluation precedence", "gtp.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}},
6799 {&hf_gtp_tid, {"TID", "gtp.tid", FT_STRING, BASE_NONE, NULL, 0, "Tunnel Identifier", HFILL}},
6800 {&hf_gtp_tlli, {"TLLI", "gtp.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL}},
6801 {&hf_gtp_tr_comm, {"Packet transfer command", "gtp.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL}},
6802 {&hf_gtp_trace_ref, {"Trace reference", "gtp.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6803 {&hf_gtp_trace_type, {"Trace type", "gtp.trace_type", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL}},
6804 {&hf_gtp_unknown, {"Unknown data (length)", "gtp.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL}},
6805 {&hf_gtp_user_addr_pdp_org,
6806 {"PDP type organization", "gtp.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, NULL, HFILL}},
6807 {&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}},
6808 {&hf_gtp_user_ipv4, {"End user address IPv4", "gtp.user_ipv4", FT_IPv4, BASE_NONE, NULL, 0, NULL, HFILL}},
6809 {&hf_gtp_user_ipv6, {"End user address IPv6", "gtp.user_ipv6", FT_IPv6, BASE_NONE, NULL, 0, NULL, HFILL}},
6810 {&hf_gtp_security_mode,
6811 {"Security Mode", "gtp.security_mode",
6812 FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
6815 {&hf_gtp_no_of_vectors,
6816 {"No of Vectors", "gtp.no_of_vectors",
6817 FT_UINT8, BASE_DEC, NULL, 0x38,
6820 {&hf_gtp_cipher_algorithm,
6821 {"Cipher Algorithm", "gtp.no_of_vectors",
6822 FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
6826 {"Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
6827 FT_UINT8, BASE_DEC, NULL, 0x07,
6831 {"Ciphering Key Sequence Number (CKSN)", "gtp.cksn_ksi",
6832 FT_UINT8, BASE_DEC, NULL, 0x07,
6836 {"Key Set Identifier (KSI)", "gtp.cksn_ksi",
6837 FT_UINT8, BASE_DEC, NULL, 0x07,
6840 {&hf_gtp_ext_length,
6841 {"Length", "gtp.ext_length",
6842 FT_UINT16, BASE_DEC, NULL, 0x0,
6845 {&hf_gtp_ext_apn_res,
6846 {"Restriction Type", "gtp.ext_apn_res",
6847 FT_UINT8, BASE_DEC, NULL, 0x0,
6850 {&hf_gtp_ext_rat_type,
6851 {"RAT Type", "gtp.ext_rat_type",
6852 FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
6855 {&hf_gtp_ext_geo_loc_type,
6856 {"Geographic Location Type", "gtp.ext_geo_loc_type",
6857 FT_UINT8, BASE_DEC, NULL, 0x0,
6861 {"SAC", "gtp.ext_sac",
6862 FT_UINT16, BASE_HEX, NULL, 0x0,
6865 {&hf_gtp_ext_imeisv,
6866 {"IMEI(SV)", "gtp.ext_imeisv",
6867 FT_STRING, BASE_NONE, NULL, 0x0,
6870 { &hf_gtp_targetRNC_ID,
6871 { "targetRNC-ID", "gtp.targetRNC_ID",
6872 FT_NONE, BASE_NONE, NULL, 0,
6874 {&hf_gtp_bssgp_cause,
6875 {"BSSGP Cause", "gtp.bssgp_cause",
6876 FT_UINT8, BASE_DEC, VALS(tab_cause), 0,
6879 {"PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
6880 FT_UINT8, BASE_DEC, NULL, 0x0F,
6882 {&hf_gtp_xid_par_len,
6883 {"PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
6884 FT_UINT8, BASE_DEC, NULL, 0xFF,
6885 "XID parameter length", HFILL}},
6886 {&hf_gtp_cmn_flg_ppc,
6887 {"Prohibit Payload Compression", "gtp.cmn_flg.ppc",
6888 FT_BOOLEAN, 8, NULL, 0x01,
6890 {&hf_gtp_cmn_flg_mbs_srv_type,
6891 {"MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
6892 FT_BOOLEAN, 8, NULL, 0x02,
6894 {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
6895 {"RAN Procedures Ready", "gtp.cmn_flg.ran_pcd_rd",
6896 FT_BOOLEAN, 8, NULL, 0x04,
6898 {&hf_gtp_cmn_flg_mbs_cnt_inf,
6899 {"MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
6900 FT_BOOLEAN, 8, NULL, 0x08,
6902 {&hf_gtp_cmn_flg_no_qos_neg,
6903 {"No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
6904 FT_BOOLEAN, 8, NULL, 0x10,
6906 {&hf_gtp_cmn_flg_nrsn,
6907 {"NRSN bit field", "gtp.cmn_flg.nrsn",
6908 FT_BOOLEAN, 8, NULL, 0x20,
6910 {&hf_gtp_cmn_flg_upgrd_qos_sup,
6911 {"Upgrade QoS Supported", "gtp.cmn_flg.ran_pcd_rd",
6912 FT_BOOLEAN, 8, NULL, 0x40,
6915 {"Temporary Mobile Group Identity (TMGI)", "gtp.cmn_flg.ran_pcd_rd",
6916 FT_BYTES, BASE_NONE, NULL, 0x0,
6918 {&hf_gtp_no_of_mbms_sa_codes,
6919 {"Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
6920 FT_UINT8, BASE_DEC, NULL, 0x0,
6921 "Number N of MBMS service area codes", HFILL}
6923 {&hf_gtp_mbms_ses_dur_days,
6924 {"Estimated session duration days", "gtp.mbms_ses_dur_days",
6925 FT_UINT8, BASE_DEC, NULL, 0xfe,
6928 {&hf_gtp_mbms_ses_dur_s,
6929 {"Estimated session duration seconds", "gtp.mbms_ses_dur_s",
6930 FT_UINT24, BASE_DEC, NULL, 0x01ffff,
6933 {&hf_gtp_mbms_sa_code,
6934 {"MBMS service area code", "gtp.mbms_sa_code",
6935 FT_UINT16, BASE_DEC, NULL, 0x0,
6938 {&hf_gtp_mbs_2g_3g_ind,
6939 {"MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
6940 FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
6943 {&hf_gtp_time_2_dta_tr,
6944 {"Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
6945 FT_UINT8, BASE_DEC, NULL, 0x0,
6949 {"Error Indication (EI)", "gtp.ei",
6950 FT_UINT8, BASE_DEC, NULL, 0x04,
6954 {"GPRS-CSI (GCSI)", "gtp.gcsi",
6955 FT_UINT8, BASE_DEC, NULL, 0x02,
6959 {"Direct Tunnel Indicator (DTI)", "gtp.dti",
6960 FT_UINT8, BASE_DEC, NULL, 0x01,
6965 static gint *ett_gtp_array[] = {
6975 &ett_gtp_pkt_flow_id,
6997 &ett_gtp_ext_tree_apn_res,
6998 &ett_gtp_ext_rat_type,
6999 &ett_gtp_ext_imeisv,
7000 &ett_gtp_ext_ran_tr_cont,
7001 &ett_gtp_ext_pdp_cont_prio,
7002 &ett_gtp_ext_ssgn_no,
7003 &ett_gtp_ext_rab_setup_inf,
7004 &ett_gtp_ext_common_flgs,
7005 &ett_gtp_ext_usr_loc_inf,
7006 &ett_gtp_ext_ms_time_zone,
7007 &ett_gtp_ext_camel_chg_inf_con,
7008 &ett_GTP_EXT_MBMS_UE_CTX,
7011 &ett_gtp_ext_rim_ra,
7012 &ett_gtp_ext_mbms_prot_conf_opt,
7013 &ett_gtp_ext_mbms_sa,
7014 &ett_gtp_ext_bms_ses_dur,
7015 &ett_gtp_ext_src_rnc_pdp_ctx_inf,
7016 &ett_gtp_ext_add_trs_inf,
7017 &ett_gtp_ext_hop_count,
7018 &ett_gtp_ext_sel_plmn_id,
7019 &ett_gtp_ext_mbms_ses_id,
7020 &ett_gtp_ext_mbms_2g_3g_ind,
7021 &ett_gtp_ext_enh_nsapi,
7022 &ett_gtp_ext_ad_mbms_trs_inf,
7023 &ett_gtp_ext_mbms_ses_id_rep_no,
7024 &ett_gtp_ext_mbms_time_to_data_tr,
7025 &ett_gtp_ext_ps_ho_req_ctx,
7026 &ett_gtp_ext_bss_cont,
7027 &ett_gtp_ext_cell_id,
7028 &ett_gtp_ext_pdu_no,
7029 &ett_gtp_ext_bssgp_cause,
7030 &ett_gtp_ext_ra_prio_lcs,
7031 &ett_gtp_ext_ps_handover_xid,
7033 &ett_gtp_utran_cont,
7036 module_t *gtp_module;
7038 proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
7039 proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
7040 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
7042 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
7044 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 port", "GTPv0 port (default 3386)", 10, &g_gtpv0_port);
7045 prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 control plane (GTP-C) port", "GTPv1 control plane port (default 2123)", 10,
7047 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
7049 prefs_register_bool_preference(gtp_module, "dissect_tpdu", "Dissect T-PDU", "Dissect T-PDU", &g_gtp_tpdu);
7051 prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
7052 prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
7053 prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
7054 prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
7055 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
7057 /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
7058 * The preference is set to TRUE by default forbackward compatibility
7060 prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
7062 register_dissector("gtp", dissect_gtp, proto_gtp);
7064 register_init_routine(gtp_reinit);
7065 gtp_tap=register_tap("gtp");
7068 void proto_reg_handoff_gtp(void)
7070 static gboolean Initialized = FALSE;
7071 static dissector_handle_t gtp_handle;
7072 static gboolean gtp_over_tcp;
7073 static guint gtpv0_port;
7074 static guint gtpv1c_port;
7075 static guint gtpv1u_port;
7078 gtp_handle = find_dissector("gtp");
7079 ppp_subdissector_table = find_dissector_table("ppp.protocol");
7081 radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
7082 radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
7083 radius_register_avp_dissector(VENDOR_THE3GPP, 22, dissect_radius_user_loc);
7085 ip_handle = find_dissector("ip");
7086 ipv6_handle = find_dissector("ipv6");
7087 ppp_handle = find_dissector("ppp");
7088 data_handle = find_dissector("data");
7089 gtpcdr_handle = find_dissector("gtpcdr");
7090 sndcpxid_handle = find_dissector("sndcpxid");
7091 gtpv2_handle = find_dissector("gtpv2");
7092 bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
7093 /* AVP Code: 904 MBMS-Session-Duration */
7094 dissector_add("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
7095 /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
7096 dissector_add("diameter.3gpp", 911, new_create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
7100 dissector_delete("udp.port", gtpv0_port, gtp_handle);
7101 dissector_delete("udp.port", gtpv1c_port, gtp_handle);
7102 dissector_delete("udp.port", gtpv1u_port, gtp_handle);
7105 dissector_delete("tcp.port", gtpv0_port, gtp_handle);
7106 dissector_delete("tcp.port", gtpv1c_port, gtp_handle);
7107 dissector_delete("tcp.port", gtpv1u_port, gtp_handle);
7111 gtp_over_tcp = g_gtp_over_tcp;
7112 gtpv0_port = g_gtpv0_port;
7113 gtpv1c_port = g_gtpv1c_port;
7114 gtpv1u_port = g_gtpv1u_port;
7116 dissector_add("udp.port", g_gtpv0_port, gtp_handle);
7117 dissector_add("udp.port", g_gtpv1c_port, gtp_handle);
7118 dissector_add("udp.port", g_gtpv1u_port, gtp_handle);
7120 if (g_gtp_over_tcp) {
7121 dissector_add("tcp.port", g_gtpv0_port, gtp_handle);
7122 dissector_add("tcp.port", g_gtpv1c_port, gtp_handle);
7123 dissector_add("tcp.port", g_gtpv1u_port, gtp_handle);
7128 * Editor modelines - http://www.wireshark.org/tools/modelines.html
7133 * indent-tabs-mode: t
7136 * vi: set shiftwidth=4 tabstop=8 noexpandtab
7137 * :indentSize=4:tabSize=8:noTabs=false: