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 - 2008, Anders Broman <anders.broman@ericsson.com>
12 * Wireshark - Network traffic analyzer
13 * By Gerald Combs <gerald@wireshark.org>
14 * Copyright 1998 Gerald Combs
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 * Ref: 3GPP TS 29.060 version 6.8.0 Release 6
42 #include <epan/packet.h>
43 #include <epan/prefs.h>
44 #include <epan/expert.h>
45 #include <epan/sminmpec.h>
46 #include <epan/asn1.h>
47 #include "packet-ipv6.h"
48 #include "packet-ppp.h"
49 #include "packet-radius.h"
50 #include "packet-bssap.h"
51 #include "packet-gsm_a.h"
52 #include "packet-gsm_map.h"
53 #include "packet-per.h"
54 #include "packet-ranap.h"
55 #include "packet-bssgp.h"
57 static dissector_table_t ppp_subdissector_table;
59 #define GTPv0_PORT 3386
60 #define GTPv1C_PORT 2123 /* 3G Control PDU */
61 #define GTPv1U_PORT 2152 /* 3G T-PDU */
63 #define GTPv0_HDR_LENGTH 20
64 #define GTPv1_HDR_LENGTH 12
65 #define GTP_PRIME_HDR_LENGTH 6
67 /* to check compliance with ETSI */
68 #define GTP_MANDATORY 1
69 #define GTP_OPTIONAL 2
70 #define GTP_CONDITIONAL 4
72 static guint g_gtpv0_port = GTPv0_PORT;
73 static guint g_gtpv1c_port = GTPv1C_PORT;
74 static guint g_gtpv1u_port = GTPv1U_PORT;
76 void proto_reg_handoff_gtp(void);
78 static int proto_gtp = -1;
80 static int hf_gtp_apn = -1;
81 static int hf_gtp_cause = -1;
82 static int hf_gtp_chrg_char = -1;
83 static int hf_gtp_chrg_char_s = -1;
84 static int hf_gtp_chrg_char_n = -1;
85 static int hf_gtp_chrg_char_p = -1;
86 static int hf_gtp_chrg_char_f = -1;
87 static int hf_gtp_chrg_char_h = -1;
88 static int hf_gtp_chrg_char_r = -1;
89 static int hf_gtp_chrg_id = -1;
90 static int hf_gtp_chrg_ipv4 = -1;
91 static int hf_gtp_chrg_ipv6 = -1;
92 static int hf_gtp_ext_flow_label = -1;
93 static int hf_gtp_ext_id = -1;
94 static int hf_gtp_ext_val = -1;
95 static int hf_gtp_flags = -1;
96 static int hf_gtp_flags_ver = -1;
97 static int hf_gtp_flags_pt = -1;
98 static int hf_gtp_flags_spare1 = -1;
99 static int hf_gtp_flags_snn = -1;
100 static int hf_gtp_flags_spare2 = -1;
101 static int hf_gtp_flags_e = -1;
102 static int hf_gtp_flags_s = -1;
103 static int hf_gtp_flags_pn = -1;
104 static int hf_gtp_flow_ii = -1;
105 static int hf_gtp_flow_label = -1;
106 static int hf_gtp_flow_sig = -1;
107 static int hf_gtp_gsn_addr_len = -1;
108 static int hf_gtp_gsn_addr_type = -1;
109 static int hf_gtp_gsn_ipv4 = -1;
110 static int hf_gtp_gsn_ipv6 = -1;
111 static int hf_gtp_imsi = -1;
112 static int hf_gtp_length = -1;
113 static int hf_gtp_map_cause = -1;
114 static int hf_gtp_message_type = -1;
115 static int hf_gtp_ms_reason = -1;
116 static int hf_gtp_ms_valid = -1;
117 static int hf_gtp_msisdn = -1;
118 static int hf_gtp_next = -1;
119 static int hf_gtp_npdu_number = -1;
120 static int hf_gtp_node_ipv4 = -1;
121 static int hf_gtp_node_ipv6 = -1;
122 static int hf_gtp_nsapi = -1;
123 static int hf_gtp_ptmsi = -1;
124 static int hf_gtp_ptmsi_sig = -1;
125 static int hf_gtp_qos_version = -1;
126 static int hf_gtp_qos_spare1 = -1;
127 static int hf_gtp_qos_delay = -1;
128 static int hf_gtp_qos_mean = -1;
129 static int hf_gtp_qos_peak = -1;
130 static int hf_gtp_qos_spare2 = -1;
131 static int hf_gtp_qos_precedence = -1;
132 static int hf_gtp_qos_spare3 = -1;
133 static int hf_gtp_qos_reliability = -1;
134 static int hf_gtp_qos_al_ret_priority = -1;
135 static int hf_gtp_qos_traf_class = -1;
136 static int hf_gtp_qos_del_order = -1;
137 static int hf_gtp_qos_del_err_sdu = -1;
138 static int hf_gtp_qos_max_sdu_size = -1;
139 static int hf_gtp_qos_max_ul = -1;
140 static int hf_gtp_qos_max_dl = -1;
141 static int hf_gtp_qos_res_ber = -1;
142 static int hf_gtp_qos_sdu_err_ratio = -1;
143 static int hf_gtp_qos_trans_delay = -1;
144 static int hf_gtp_qos_traf_handl_prio = -1;
145 static int hf_gtp_qos_guar_ul = -1;
146 static int hf_gtp_qos_guar_dl = -1;
147 static int hf_gtp_pkt_flow_id = -1;
148 static int hf_gtp_rab_gtpu_dn = -1;
149 static int hf_gtp_rab_gtpu_up = -1;
150 static int hf_gtp_rab_pdu_dn = -1;
151 static int hf_gtp_rab_pdu_up = -1;
152 static int hf_gtp_rai_mcc = -1;
153 static int hf_gtp_rai_mnc = -1;
154 static int hf_gtp_rai_rac = -1;
155 static int hf_gtp_rai_lac = -1;
156 static int hf_gtp_ranap_cause = -1;
157 static int hf_gtp_recovery = -1;
158 static int hf_gtp_reorder = -1;
159 static int hf_gtp_rnc_ipv4 = -1;
160 static int hf_gtp_rnc_ipv6 = -1;
161 static int hf_gtp_rp = -1;
162 static int hf_gtp_rp_nsapi = -1;
163 static int hf_gtp_rp_sms = -1;
164 static int hf_gtp_rp_spare = -1;
165 static int hf_gtp_sel_mode = -1;
166 static int hf_gtp_seq_number = -1;
167 static int hf_gtp_sndcp_number = -1;
168 static int hf_gtp_tear_ind = -1;
169 static int hf_gtp_teid = -1;
170 static int hf_gtp_teid_cp = -1;
171 static int hf_gtp_ulink_teid_cp = -1;
172 static int hf_gtp_teid_data = -1;
173 static int hf_gtp_ulink_teid_data = -1;
174 static int hf_gtp_teid_ii = -1;
175 static int hf_gtp_tft_code = -1;
176 static int hf_gtp_tft_spare = -1;
177 static int hf_gtp_tft_number = -1;
178 static int hf_gtp_tft_eval = -1;
179 static int hf_gtp_tid = -1;
180 static int hf_gtp_tlli = -1;
181 static int hf_gtp_tr_comm = -1;
182 static int hf_gtp_trace_ref = -1;
183 static int hf_gtp_trace_type = -1;
184 static int hf_gtp_unknown = -1;
185 static int hf_gtp_user_addr_pdp_org = -1;
186 static int hf_gtp_user_addr_pdp_type = -1;
187 static int hf_gtp_user_ipv4 = -1;
188 static int hf_gtp_user_ipv6 = -1;
189 static int hf_gtp_security_mode = -1;
190 static int hf_gtp_no_of_vectors = -1;
191 static int hf_gtp_cipher_algorithm = -1;
192 static int hf_gtp_cksn_ksi = -1;
193 static int hf_gtp_cksn = -1;
194 static int hf_gtp_ksi = -1;
195 static int hf_gtp_ext_length = -1;
196 static int hf_gtp_ext_apn_res = -1;
197 static int hf_gtp_ext_rat_type = -1;
198 static int hf_gtp_ext_geo_loc_type = -1;
199 static int hf_gtp_ext_sac = -1;
200 static int hf_gtp_ext_imeisv = -1;
201 static int hf_gtp_targetid = -1;
202 static int hf_gtp_bssgp_cause = -1;
203 static int hf_gtp_cmn_flg_ppc = -1;
204 static int hf_gtp_cmn_flg_mbs_srv_type = -1;
205 static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy = -1;
206 static int hf_gtp_cmn_flg_mbs_cnt_inf = -1;
207 static int hf_gtp_cmn_flg_nrsn = -1;
208 static int hf_gtp_cmn_flg_no_qos_neg = -1;
209 static int hf_gtp_cmn_flg_upgrd_qos_sup = -1;
210 static int hf_gtp_tmgi = -1;
211 static int hf_gtp_mbms_ses_dur_days = -1;
212 static int hf_gtp_mbms_ses_dur_s = -1;
213 static int hf_gtp_no_of_mbms_sa_codes = -1;
214 static int hf_gtp_mbms_sa_code = -1;
215 static int hf_gtp_mbs_2g_3g_ind = -1;
216 static int hf_gtp_time_2_dta_tr = -1;
218 /* Initialize the subtree pointers */
219 static gint ett_gtp = -1;
220 static gint ett_gtp_flags = -1;
221 static gint ett_gtp_ext = -1;
222 static gint ett_gtp_rai = -1;
223 static gint ett_gtp_qos = -1;
224 static gint ett_gtp_auth_tri = -1;
225 static gint ett_gtp_flow_ii = -1;
226 static gint ett_gtp_rab_cntxt = -1;
227 static gint ett_gtp_rp = -1;
228 static gint ett_gtp_pkt_flow_id = -1;
229 static gint ett_gtp_chrg_char = -1;
230 static gint ett_gtp_user = -1;
231 static gint ett_gtp_mm = -1;
232 static gint ett_gtp_trip = -1;
233 static gint ett_gtp_quint = -1;
234 static gint ett_gtp_pdp = -1;
235 static gint ett_gtp_apn = -1;
236 static gint ett_gtp_proto = -1;
237 static gint ett_gtp_gsn_addr = -1;
238 static gint ett_gtp_tft = -1;
239 static gint ett_gtp_tft_pf = -1;
240 static gint ett_gtp_tft_flags = -1;
241 static gint ett_gtp_rab_setup = -1;
242 static gint ett_gtp_hdr_list = -1;
243 static gint ett_gtp_chrg_addr = -1;
244 static gint ett_gtp_node_addr = -1;
245 static gint ett_gtp_rel_pack = -1;
246 static gint ett_gtp_can_pack = -1;
247 static gint ett_gtp_data_resp = -1;
248 static gint ett_gtp_priv_ext = -1;
249 static gint ett_gtp_net_cap = -1;
250 static gint ett_gtp_ext_tree_apn_res = -1;
251 static gint ett_gtp_ext_rat_type = -1;
252 static gint ett_gtp_ext_imeisv = -1;
253 static gint ett_gtp_ext_ran_tr_cont = -1;
254 static gint ett_gtp_ext_pdp_cont_prio = -1;
255 static gint ett_gtp_ext_ssgn_no = -1;
256 static gint ett_gtp_ext_rab_setup_inf = -1;
257 static gint ett_gtp_ext_common_flgs = -1;
258 static gint ett_gtp_ext_usr_loc_inf = -1;
259 static gint ett_gtp_ext_ms_time_zone = -1;
260 static gint ett_gtp_ext_camel_chg_inf_con = -1;
261 static gint ett_GTP_EXT_MBMS_UE_CTX = -1;
262 static gint ett_gtp_ext_tmgi = -1;
263 static gint ett_gtp_tmgi = -1;
264 static gint ett_gtp_ext_rim_ra = -1;
265 static gint ett_gtp_ext_mbms_prot_conf_opt = -1;
266 static gint ett_gtp_ext_mbms_sa = -1;
267 static gint ett_gtp_ext_bms_ses_dur = -1;
268 static gint ett_gtp_ext_src_rnc_pdp_ctx_inf = -1;
269 static gint ett_gtp_ext_add_trs_inf = -1;
270 static gint ett_gtp_ext_hop_count = -1;
271 static gint ett_gtp_ext_sel_plmn_id = -1;
272 static gint ett_gtp_ext_mbms_ses_id = -1;
273 static gint ett_gtp_ext_mbms_2g_3g_ind = -1;
274 static gint ett_gtp_ext_enh_nsapi = -1;
275 static gint ett_gtp_ext_ad_mbms_trs_inf = -1;
276 static gint ett_gtp_ext_mbms_ses_id_rep_no = -1;
277 static gint ett_gtp_ext_mbms_time_to_data_tr = -1;
278 static gint ett_gtp_ext_ps_ho_req_ctx = -1;
279 static gint ett_gtp_ext_bss_cont = -1;
280 static gint ett_gtp_ext_cell_id = -1;
281 static gint ett_gtp_ext_pdu_no = -1;
282 static gint ett_gtp_ext_bssgp_cause = -1;
283 static gint ett_gtp_ext_ra_prio_lcs = -1;
284 static gint ett_gtp_target_id = -1;
285 static gint ett_gtp_utran_cont = -1;
287 static gboolean gtp_tpdu = TRUE;
288 static gboolean gtp_over_tcp = TRUE;
289 static gboolean gtp_etsi_order = FALSE;
290 static guint gtpv0_port = 0;
291 static guint gtpv1c_port = 0;
292 static guint gtpv1u_port = 0;
294 /* Definition of flags masks */
295 #define GTP_VER_MASK 0xE0
297 static const value_string ver_types[] = {
298 { 0, "GTP release 97/98 version" },
299 { 1, "GTP release 99 version" },
308 static const value_string pt_types[] = {
314 #define GTP_PT_MASK 0x10
315 #define GTP_SPARE1_MASK 0x0E
316 #define GTP_SPARE2_MASK 0x08
317 #define GTP_E_MASK 0x04
318 #define GTP_S_MASK 0x02
319 #define GTP_SNN_MASK 0x01
320 #define GTP_PN_MASK 0x01
322 /* Definition of 3G charging characteristics masks */
323 #define GTP_MASK_CHRG_CHAR_S 0xF000
324 #define GTP_MASK_CHRG_CHAR_N 0x0800
325 #define GTP_MASK_CHRG_CHAR_P 0x0400
326 #define GTP_MASK_CHRG_CHAR_F 0x0200
327 #define GTP_MASK_CHRG_CHAR_H 0x0100
328 #define GTP_MASK_CHRG_CHAR_R 0x00FF
330 /* Traffic Flow Templates mask */
331 #define GTPv1_TFT_CODE_MASK 0xE0
332 #define GTPv1_TFT_SPARE_MASK 0x10
333 #define GTPv1_TFT_NUMBER_MASK 0x0F
335 /* Definition of GSN Address masks */
336 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
337 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
339 /* Definition of QoS masks */
340 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
341 #define GTP_EXT_QOS_DELAY_MASK 0x38
342 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
343 #define GTP_EXT_QOS_PEAK_MASK 0xF0
344 #define GTP_EXT_QOS_SPARE2_MASK 0x08
345 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
346 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
347 #define GTP_EXT_QOS_MEAN_MASK 0x1F
348 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
349 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
350 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
351 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
352 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
353 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
354 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
356 /* Definition of Radio Priority's masks */
357 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
358 #define GTPv1_EXT_RP_SPARE_MASK 0x08
359 #define GTPv1_EXT_RP_MASK 0x07
361 /* definitions of GTP messages */
362 #define GTP_MSG_UNKNOWN 0x00
363 #define GTP_MSG_ECHO_REQ 0x01
364 #define GTP_MSG_ECHO_RESP 0x02
365 #define GTP_MSG_VER_NOT_SUPP 0x03
366 #define GTP_MSG_NODE_ALIVE_REQ 0x04
367 #define GTP_MSG_NODE_ALIVE_RESP 0x05
368 #define GTP_MSG_REDIR_REQ 0x06
369 #define GTP_MSG_REDIR_RESP 0x07
370 #define GTP_MSG_CREATE_PDP_REQ 0x10
371 #define GTP_MSG_CREATE_PDP_RESP 0x11
372 #define GTP_MSG_UPDATE_PDP_REQ 0x12
373 #define GTP_MSG_UPDATE_PDP_RESP 0x13
374 #define GTP_MSG_DELETE_PDP_REQ 0x14
375 #define GTP_MSG_DELETE_PDP_RESP 0x15
376 #define GTP_MSG_CREATE_AA_PDP_REQ 0x16 /* 2G */
377 #define GTP_MSG_CREATE_AA_PDP_RESP 0x17 /* 2G */
378 #define GTP_MSG_DELETE_AA_PDP_REQ 0x18 /* 2G */
379 #define GTP_MSG_DELETE_AA_PDP_RESP 0x19 /* 2G */
380 #define GTP_MSG_ERR_IND 0x1A
381 #define GTP_MSG_PDU_NOTIFY_REQ 0x1B
382 #define GTP_MSG_PDU_NOTIFY_RESP 0x1C
383 #define GTP_MSG_PDU_NOTIFY_REJ_REQ 0x1D
384 #define GTP_MSG_PDU_NOTIFY_REJ_RESP 0x1E
385 #define GTP_MSG_SUPP_EXT_HDR 0x1F
386 #define GTP_MSG_SEND_ROUT_INFO_REQ 0x20
387 #define GTP_MSG_SEND_ROUT_INFO_RESP 0x21
388 #define GTP_MSG_FAIL_REP_REQ 0x22
389 #define GTP_MSG_FAIL_REP_RESP 0x23
390 #define GTP_MSG_MS_PRESENT_REQ 0x24
391 #define GTP_MSG_MS_PRESENT_RESP 0x25
392 #define GTP_MSG_IDENT_REQ 0x30
393 #define GTP_MSG_IDENT_RESP 0x31
394 #define GTP_MSG_SGSN_CNTXT_REQ 0x32
395 #define GTP_MSG_SGSN_CNTXT_RESP 0x33
396 #define GTP_MSG_SGSN_CNTXT_ACK 0x34
397 #define GTP_MSG_FORW_RELOC_REQ 0x35
398 #define GTP_MSG_FORW_RELOC_RESP 0x36
399 #define GTP_MSG_FORW_RELOC_COMP 0x37
400 #define GTP_MSG_RELOC_CANCEL_REQ 0x38
401 #define GTP_MSG_RELOC_CANCEL_RESP 0x39
402 #define GTP_MSG_FORW_SRNS_CNTXT 0x3A
403 #define GTP_MSG_FORW_RELOC_ACK 0x3B
404 #define GTP_MSG_FORW_SRNS_CNTXT_ACK 0x3C
406 #define GTP_MSG_RAN_INFO_RELAY 70
407 #define GTP_MBMS_NOTIFY_REQ 96
408 #define GTP_MBMS_NOTIFY_RES 97
409 #define GTP_MBMS_NOTIFY_REJ_REQ 98
410 #define GTP_MBMS_NOTIFY_REJ_RES 99
411 #define GTP_CREATE_MBMS_CNTXT_REQ 100
412 #define GTP_CREATE_MBMS_CNTXT_RES 101
413 #define GTP_UPD_MBMS_CNTXT_REQ 102
414 #define GTP_UPD_MBMS_CNTXT_RES 103
415 #define GTP_DEL_MBMS_CNTXT_REQ 104
416 #define GTP_DEL_MBMS_CNTXT_RES 105
417 #define GTP_MBMS_REG_REQ 112
418 #define GTP_MBMS_REG_RES 113
419 #define GTP_MBMS_DE_REG_REQ 114
420 #define GTP_MBMS_DE_REG_RES 115
421 #define GTP_MBMS_SES_START_REQ 116
422 #define GTP_MBMS_SES_START_RES 117
423 #define GTP_MBMS_SES_STOP_REQ 118
424 #define GTP_MBMS_SES_STOP_RES 119
425 #define GTP_MBMS_SES_UPD_REQ 120
426 #define GTP_MBMS_SES_UPD_RES 121
427 /* 122-127 For future use. Shall not be sent.
428 * If received, shall be treated as an Unknown message.
430 #define GTP_MS_INFO_CNG_NOT_REQ 121
431 #define GTP_MS_INFO_CNG_NOT_RES 122
432 /* 130-239 For future use. Shall not be sent.
433 * If received, shall be treated as an Unknown message.
435 #define GTP_MSG_DATA_TRANSF_REQ 0xF0
436 #define GTP_MSG_DATA_TRANSF_RESP 0xF1
437 /* 242-254 For future use. Shall not be sent.
438 * If received, shall be treated as an Unknown message.
440 #define GTP_MSG_TPDU 0xFF
442 static const value_string message_type[] = {
443 { GTP_MSG_UNKNOWN, "For future use" },
444 { GTP_MSG_ECHO_REQ, "Echo request" },
445 { GTP_MSG_ECHO_RESP, "Echo response" },
446 { GTP_MSG_VER_NOT_SUPP, "Version not supported" },
447 { GTP_MSG_NODE_ALIVE_REQ, "Node alive request" },
448 { GTP_MSG_NODE_ALIVE_RESP, "Node alive response" },
449 { GTP_MSG_REDIR_REQ, "Redirection request" },
450 { GTP_MSG_REDIR_RESP, "Redirection response" },
451 { GTP_MSG_CREATE_PDP_REQ, "Create PDP context request" },
452 { GTP_MSG_CREATE_PDP_RESP, "Create PDP context response" },
453 { GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request" },
454 { GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response" },
455 { GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request" },
456 { GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response" },
457 { GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request" },
458 { GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response" },
459 { GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request" },
460 { GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response" },
461 { GTP_MSG_ERR_IND, "Error indication" },
462 { GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request" },
463 { GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response" },
464 { GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request" },
465 { GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response" },
466 { GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification" },
467 { GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request" },
468 { GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response" },
469 { GTP_MSG_FAIL_REP_REQ, "Failure report request" },
470 { GTP_MSG_FAIL_REP_RESP, "Failure report response" },
471 { GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request" },
472 { GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response" },
473 { GTP_MSG_IDENT_REQ, "Identification request" },
474 { GTP_MSG_IDENT_RESP, "Identification response" },
475 { GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request" },
476 { GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response" },
477 { GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement" },
478 { GTP_MSG_FORW_RELOC_REQ, "Forward relocation request" },
479 { GTP_MSG_FORW_RELOC_RESP, "Forward relocation response" },
480 { GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete" },
481 { GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request" },
482 { GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response" },
483 { GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context" },
484 { GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge" },
485 { GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge" },
486 { GTP_MSG_RAN_INFO_RELAY, "RAN Information Relay" },
487 { GTP_MBMS_NOTIFY_REQ, "MBMS Notification Request" },
488 { GTP_MBMS_NOTIFY_RES, "MBMS Notification Response" },
489 { GTP_MBMS_NOTIFY_REJ_REQ, "MBMS Notification Reject Request" },
490 { GTP_MBMS_NOTIFY_REJ_RES, "MBMS Notification Reject Response" },
491 { GTP_CREATE_MBMS_CNTXT_REQ, "Create MBMS Context Request" },
492 { GTP_CREATE_MBMS_CNTXT_RES, "Create MBMS Context Response" },
493 { GTP_UPD_MBMS_CNTXT_REQ, "Update MBMS Context Request" },
494 { GTP_UPD_MBMS_CNTXT_RES, "Update MBMS Context Response" },
495 { GTP_DEL_MBMS_CNTXT_REQ, "Delete MBMS Context Request" },
496 { GTP_DEL_MBMS_CNTXT_RES, "Delete MBMS Context Response" },
497 { GTP_MBMS_REG_REQ, "MBMS Registration Request" },
498 { GTP_MBMS_REG_RES, "MBMS Registration Response" },
499 { GTP_MBMS_DE_REG_REQ, "MBMS De-Registration Request" },
500 { GTP_MBMS_DE_REG_RES, "MBMS De-Registration Response" },
501 { GTP_MBMS_SES_START_REQ, "MBMS Session Start Request" },
502 { GTP_MBMS_SES_START_RES, "MBMS Session Start Response" },
503 { GTP_MBMS_SES_STOP_REQ, "MBMS Session Stop Request" },
504 { GTP_MBMS_SES_STOP_RES, "MBMS Session Stop Response" },
505 { GTP_MBMS_SES_UPD_REQ, "MBMS Session Update Request" },
506 { GTP_MBMS_SES_UPD_RES, "MBMS Session Update Response" },
507 /* 122-127 For future use. Shall not be sent.
508 * If received, shall be treated as an Unknown message.
510 { GTP_MS_INFO_CNG_NOT_REQ, "MS Info Change Notification Request" },
511 { GTP_MS_INFO_CNG_NOT_RES, "MS Info Change Notification Response" },
512 { GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request" },
513 { GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response" },
514 { GTP_MSG_TPDU, "T-PDU" },
518 /* definitions of fields in extension header */
519 #define GTP_EXT_CAUSE 0x01
520 #define GTP_EXT_IMSI 0x02
521 #define GTP_EXT_RAI 0x03
522 #define GTP_EXT_TLLI 0x04
523 #define GTP_EXT_PTMSI 0x05
524 #define GTP_EXT_QOS_GPRS 0x06
525 #define GTP_EXT_REORDER 0x08
526 #define GTP_EXT_AUTH_TRI 0x09
527 #define GTP_EXT_MAP_CAUSE 0x0B
528 #define GTP_EXT_PTMSI_SIG 0x0C
529 #define GTP_EXT_MS_VALID 0x0D
530 #define GTP_EXT_RECOVER 0x0E
531 #define GTP_EXT_SEL_MODE 0x0F
533 #define GTP_EXT_16 0x10
534 #define GTP_EXT_FLOW_LABEL 0x10
535 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
537 #define GTP_EXT_17 0x11
538 #define GTP_EXT_FLOW_SIG 0x11
539 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
541 #define GTP_EXT_18 0x12
542 #define GTP_EXT_FLOW_II 0x12
543 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G*/
545 #define GTP_EXT_19 0x13
546 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
547 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G*/
549 #define GTP_EXT_NSAPI 0x14 /* 3G */
550 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
551 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
552 #define GTP_EXT_RP_SMS 0x17 /* 3G */
553 #define GTP_EXT_RP 0x18 /* 3G */
554 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
555 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
556 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
557 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
558 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
559 #define GTP_EXT_TR_COMM 0x7E /* charging */
560 #define GTP_EXT_CHRG_ID 0x7F
561 #define GTP_EXT_USER_ADDR 0x80
562 #define GTP_EXT_MM_CNTXT 0x81
563 #define GTP_EXT_PDP_CNTXT 0x82
564 #define GTP_EXT_APN 0x83
565 #define GTP_EXT_PROTO_CONF 0x84
566 #define GTP_EXT_GSN_ADDR 0x85
567 #define GTP_EXT_MSISDN 0x86
568 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
569 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
570 #define GTP_EXT_TFT 0x89 /* 3G */
571 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
572 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
573 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
574 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
575 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G 142 7.7.41 */
576 #define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */
577 #define GTP_EXT_RAN_TR_CONT 0x90 /* 3G 144 TLV RAN Transparent Container 7.7.43 */
578 #define GTP_EXT_PDP_CONT_PRIO 0x91 /* 3G 145 TLV PDP Context Prioritization 7.7.45 */
579 #define GTP_EXT_ADD_RAB_SETUP_INF 0x92 /* 3G 146 TLV Additional RAB Setup Information 7.7.45A */
580 #define GTP_EXT_SSGN_NO 0x93 /* 3G 147 TLV SGSN Number 7.7.47 */
581 #define GTP_EXT_COMMON_FLGS 0x94 /* 3G 148 TLV Common Flags 7.7.48 */
582 #define GTP_EXT_APN_RES 0x95 /* 3G 149 */
583 #define GTP_EXT_RA_PRIO_LCS 0x96 /* 3G 150 TLV Radio Priority LCS 7.7.25B */
584 #define GTP_EXT_RAT_TYPE 0x97 /* 3G 151 TLV RAT Type 7.7.50 */
585 #define GTP_EXT_USR_LOC_INF 0x98 /* 3G 152 TLV User Location Information 7.7.51 */
586 #define GTP_EXT_MS_TIME_ZONE 0x99 /* 3G 153 TLV MS Time Zone 7.7.52 */
588 #define GTP_EXT_IMEISV 0x9A /* 3G */
589 #define GTP_EXT_CAMEL_CHG_INF_CON 0x9B /* 3G 155 TLV CAMEL Charging Information Container 7.7.54 */
590 #define GTP_EXT_MBMS_UE_CTX 0x9C /* 3G 156 TLV MBMS UE Context 7.7.55 */
591 #define GTP_EXT_TMGI 0x9D /* 3G 157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
592 #define GTP_EXT_RIM_RA 0x9E /* 3G 158 TLV RIM Routing Address 7.7.57 */
593 #define GTP_EXT_MBMS_PROT_CONF_OPT 0x9F /* 3G 159 TLV MBMS Protocol Configuration Options 7.7.58 */
594 #define GTP_EXT_MBMS_SA 0xA0 /* 3G 160 TLV MBMS Service Area 7.7.60 */
595 #define GTP_EXT_SRC_RNC_PDP_CTX_INF 0xA1 /* 3G 161 TLV Source RNC PDCP context info 7.7.61 */
596 #define GTP_EXT_ADD_TRS_INF 0xA2 /* 3G 162 TLV Additional Trace Info 7.7.62 */
597 #define GTP_EXT_HOP_COUNT 0xA3 /* 3G 163 TLV Hop Counter 7.7.63 */
598 #define GTP_EXT_SEL_PLMN_ID 0xA4 /* 3G 164 TLV Selected PLMN ID 7.7.64 */
599 #define GTP_EXT_MBMS_SES_ID 0xA5 /* 3G 165 TLV MBMS Session Identifier 7.7.65 */
600 #define GTP_EXT_MBMS_2G_3G_IND 0xA6 /* 3G 166 TLV MBMS 2G/3G Indicator 7.7.66 */
601 #define GTP_EXT_ENH_NSAPI 0xA7 /* 3G 167 TLV Enhanced NSAPI 7.7.67 */
602 #define GTP_EXT_MBMS_SES_DUR 0xA8 /* 3G 168 TLV MBMS Session Duration 7.7.59 */
603 #define GTP_EXT_ADD_MBMS_TRS_INF 0xA9 /* 3G 169 TLV Additional MBMS Trace Info 7.7.68 */
604 #define GTP_EXT_MBMS_SES_ID_REP_NO 0xAA /* 3G 170 TLV MBMS Session Identity Repetition Number 7.7.69 */
605 #define GTP_EXT_MBMS_TIME_TO_DATA_TR 0xAB /* 3G 171 TLV MBMS Time To Data Transfer 7.7.70 */
606 #define GTP_EXT_PS_HO_REQ_CTX 0xAC /* 3G 172 TLV PS Handover Request Context 7.7.71 */
607 #define GTP_EXT_BSS_CONT 0xAD /* 3G 173 TLV BSS Container 7.7.72 */
608 #define GTP_EXT_CELL_ID 0xAE /* 3G 174 TLV Cell Identification 7.7.73 */
609 #define GTP_EXT_PDU_NO 0xAF /* 3G 175 TLV PDU Numbers 7.7.74 */
610 #define GTP_EXT_BSSGP_CAUSE 0xA0 /* 3G 176 TLV BSSGP Cause 7.7.75 */
611 #define GTP_EXT_REQ_MBMS_BEARER_CAP 0xA1 /* 3G 177 TLV Required MBMS bearer capabilities 7.7.76 */
612 #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xA2 /* 3G 178 TLV RIM Routing Address Discriminator 7.7.77 */
613 #define GTP_EXT_LIST_OF_SETUP_PFCS 0xA3 /* 3G 179 TLV List of set-up PFCs 7.7.78 */
614 #define GTP_EXT_PS_HANDOWER_XIP_PAR 0xA4 /* 3G 180 TLV PS Handover XID Parameters 7.7.79 */
615 #define GTP_EXT_MS_INF_CHG_REP_ACT 0xA5 /* 3G 181 TLV MS Info Change Reporting Action 7.7.80 */
616 #define GTP_EXT_DIRECT_TUNNEL_FLGS 0xA6 /* 3G 182 TLV Direct Tunnel Flags 7.7.81 */
617 #define GTP_EXT_CORRELATION_ID 0xA7 /* 3G 183 TLV Correlation-ID 7.7.82 */
618 #define GTP_EXT_BEARER_CONTROL_MODE 0xA8 /* 3G 184 TLV Bearer Control Mode 7.7.83 */
619 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
621 #define GTP_EXT_C1 0xC1
622 #define GTP_EXT_C2 0xC2
623 #define GTP_EXT_REL_PACK 0xF9 /* charging */
624 #define GTP_EXT_CAN_PACK 0xFA /* charging */
625 #define GTP_EXT_CHRG_ADDR 0xFB /* 3G 251 TLV Charging Gateway Address 7.7.44*/
626 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
627 #define GTP_EXT_DATA_REQ 0xFC /* charging */
628 #define GTP_EXT_DATA_RESP 0xFD /* charging */
629 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
630 #define GTP_EXT_PRIV_EXT 0xFF
632 static const value_string gtp_val[] = {
633 { GTP_EXT_CAUSE, "Cause of operation" },
634 { GTP_EXT_IMSI, "IMSI" },
635 { GTP_EXT_RAI, "Routing Area Identity" },
636 { GTP_EXT_TLLI, "Temporary Logical Link Identity" },
637 { GTP_EXT_PTMSI, "Packet TMSI" },
638 { GTP_EXT_QOS_GPRS, "Quality of Service" },
639 { GTP_EXT_REORDER, "Reorder required" },
640 { GTP_EXT_AUTH_TRI, "Authentication triplets" },
641 { GTP_EXT_MAP_CAUSE, "MAP cause" },
642 { GTP_EXT_PTMSI_SIG, "P-TMSI signature" },
643 { GTP_EXT_MS_VALID, "MS validated" },
644 { GTP_EXT_RECOVER, "Recovery" },
645 { GTP_EXT_SEL_MODE, "Selection mode" },
647 { GTP_EXT_16, "Flow label data I" },
648 { GTP_EXT_FLOW_LABEL, "Flow label data I" },
649 { GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I" }, /* 3G */
651 { GTP_EXT_17, "Flow label signalling" },
652 { GTP_EXT_FLOW_SIG, "Flow label signalling" },
653 { GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane" }, /* 3G */
655 { GTP_EXT_18, "Flow label data II" },
656 { GTP_EXT_FLOW_II, "Flow label data II" },
657 { GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II" }, /* 3G */
659 { GTP_EXT_19, "MS not reachable reason" },
660 { GTP_EXT_MS_REASON, "MS not reachable reason" },
661 { GTP_EXT_TEAR_IND, "Teardown ID" }, /* 3G */
663 { GTP_EXT_NSAPI, "NSAPI" }, /* 3G */
664 { GTP_EXT_RANAP_CAUSE, "RANAP cause" }, /* 3G */
665 { GTP_EXT_RAB_CNTXT, "RAB context" }, /* 3G */
666 { GTP_EXT_RP_SMS, "Radio Priority for MO SMS" }, /* 3G */
667 { GTP_EXT_RP, "Radio Priority" }, /* 3G */
668 { GTP_EXT_PKT_FLOW_ID, "Packet Flow ID" }, /* 3G */
669 { GTP_EXT_CHRG_CHAR, "Charging characteristics" }, /* 3G */
670 { GTP_EXT_TRACE_REF, "Trace references" }, /* 3G */
671 { GTP_EXT_TRACE_TYPE, "Trace type" }, /* 3G */
672 { GTPv1_EXT_MS_REASON, "MS not reachable reason" }, /* 3G */
673 { GTP_EXT_TR_COMM, "Packet transfer command" }, /* charging */
674 { GTP_EXT_CHRG_ID, "Charging ID" },
675 { GTP_EXT_USER_ADDR, "End user address" },
676 { GTP_EXT_MM_CNTXT, "MM context" },
677 { GTP_EXT_PDP_CNTXT, "PDP context" },
678 { GTP_EXT_APN, "Access Point Name" },
679 { GTP_EXT_PROTO_CONF, "Protocol configuration options" },
680 { GTP_EXT_GSN_ADDR, "GSN address" },
681 { GTP_EXT_MSISDN, "MS international PSTN/ISDN number" },
682 { GTP_EXT_QOS_UMTS, "Quality of service (UMTS)" }, /* 3G */
683 { GTP_EXT_AUTH_QUI, "Authentication quintuplets" }, /* 3G */
684 { GTP_EXT_TFT, "Traffic Flow Template (TFT)" }, /* 3G */
685 { GTP_EXT_TARGET_ID, "Target (RNC) identification" }, /* 3G */
686 { GTP_EXT_UTRAN_CONT, "UTRAN transparent field" }, /* 3G */
687 { GTP_EXT_RAB_SETUP, "RAB setup information" }, /* 3G */
688 { GTP_EXT_HDR_LIST, "Extension Header Types List" }, /* 3G */
689 { GTP_EXT_TRIGGER_ID, "Trigger Id" }, /* 3G */
690 { GTP_EXT_OMC_ID, "OMC Identity" }, /* 3G */
692 { GTP_EXT_RAN_TR_CONT, "RAN Transparent Container" }, /* 7.7.43 */
693 { GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization" }, /* 7.7.45 */
694 { GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information" }, /* 7.7.45A */
695 { GTP_EXT_SSGN_NO, "SGSN Number" }, /* 7.7.47 */
696 { GTP_EXT_COMMON_FLGS, "Common Flags" }, /* 7.7.48 */
697 { GTP_EXT_APN_RES, "APN Restriction" }, /* 3G */
698 { GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS" }, /* 7.7.25B */
699 { GTP_EXT_RAT_TYPE, "RAT Type" }, /* 3G */
700 { GTP_EXT_USR_LOC_INF, "User Location Information" }, /* 7.7.51 */
701 { GTP_EXT_MS_TIME_ZONE, "MS Time Zone" }, /* 7.7.52 */
703 { GTP_EXT_IMEISV, "IMEI(SV)" }, /* 3G */
704 { GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container" }, /* 7.7.54 */
705 { GTP_EXT_MBMS_UE_CTX, "MBMS UE Context" }, /* 7.7.55 */
706 { GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)" }, /* 7.7.56 */
707 { GTP_EXT_RIM_RA, "RIM Routing Address" }, /* 7.7.57 */
708 { GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options" }, /* 7.7.58 */
709 { GTP_EXT_MBMS_SA, "MBMS Service Area" }, /* 7.7.60 */
710 { GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info" }, /* 7.7.61 */
711 { GTP_EXT_ADD_TRS_INF, "Additional Trace Info" }, /* 7.7.62 */
712 { GTP_EXT_HOP_COUNT, "Hop Counter" }, /* 7.7.63 */
713 { GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID" }, /* 7.7.64 */
714 { GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier" }, /* 7.7.65 */
715 { GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator" }, /* 7.7.66 */
716 { GTP_EXT_ENH_NSAPI, "Enhanced NSAPI" }, /* 7.7.67 */
717 { GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration" }, /* 7.7.59 */
718 { GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info" }, /* 7.7.68 */
719 { GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number" }, /* 7.7.69 */
720 { GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer" }, /* 7.7.70 */
721 { GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context" }, /* 7.7.71 */
722 { GTP_EXT_BSS_CONT, "BSS Container" }, /* 7.7.72 */
723 { GTP_EXT_CELL_ID, "Cell Identification" }, /* 7.7.73 */
724 { GTP_EXT_PDU_NO, "PDU Numbers" }, /* 7.7.74 */
725 { GTP_EXT_BSSGP_CAUSE, "BSSGP Cause" }, /* 7.7.75 */
726 { GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities" }, /* 7.7.76 */
727 { GTP_EXT_RIM_ROUTING_ADDR_DISC,"RIM Routing Address Discriminator" }, /* 7.7.77 */
728 { GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs" }, /* 7.7.78 */
729 { GTP_EXT_PS_HANDOWER_XIP_PAR, "PS Handover XID Parameters" }, /* 7.7.79 */
730 { GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action" }, /* 7.7.80 */
731 { GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags" }, /* 7.7.81 */
732 { GTP_EXT_CORRELATION_ID, "Correlation-ID" }, /* 7.7.82 */
733 { GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode" }, /* 7.7.83 */
734 { GTP_EXT_REL_PACK, "Sequence numbers of released packets IE" }, /* charging */
735 { GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE" }, /* charging */
736 { GTP_EXT_CHRG_ADDR, "Charging Gateway address" },
737 { GTP_EXT_DATA_REQ, "Data record packet" }, /* charging */
738 { GTP_EXT_DATA_RESP, "Requests responded" }, /* charging */
739 { GTP_EXT_NODE_ADDR, "Address of recommended node" }, /* charging */
740 { GTP_EXT_PRIV_EXT, "Private Extension" },
743 /* It seems like some IE's are renamed in gtpv1 at least reading
744 * 3GPP TS 29.060 version 6.11.0 Release 6
746 static const value_string gtpv1_val[] = {
747 { GTP_EXT_CAUSE, "Cause of operation" },
748 { GTP_EXT_IMSI, "IMSI" },
749 { GTP_EXT_RAI, "Routing Area Identity" },
750 { GTP_EXT_TLLI, "Temporary Logical Link Identity" },
751 { GTP_EXT_PTMSI, "Packet TMSI" },
752 { GTP_EXT_QOS_GPRS, "Quality of Service" },
753 { GTP_EXT_REORDER, "Reorder required" },
754 { GTP_EXT_AUTH_TRI, "Authentication triplets" },
755 { GTP_EXT_MAP_CAUSE, "MAP cause" },
756 { GTP_EXT_PTMSI_SIG, "P-TMSI signature" },
757 { GTP_EXT_MS_VALID, "MS validated" },
758 { GTP_EXT_RECOVER, "Recovery" },
759 { GTP_EXT_SEL_MODE, "Selection mode" },
761 { GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I" }, /* 3G */
763 { GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane" }, /* 3G */
765 { GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II" }, /* 3G */
767 { GTP_EXT_TEAR_IND, "Teardown ID" }, /* 3G */
769 { GTP_EXT_NSAPI, "NSAPI" }, /* 3G */
770 { GTP_EXT_RANAP_CAUSE, "RANAP cause" }, /* 3G */
771 { GTP_EXT_RAB_CNTXT, "RAB context" }, /* 3G */
772 { GTP_EXT_RP_SMS, "Radio Priority for MO SMS" }, /* 3G */
773 { GTP_EXT_RP, "Radio Priority" }, /* 3G */
774 { GTP_EXT_PKT_FLOW_ID, "Packet Flow ID" }, /* 3G */
775 { GTP_EXT_CHRG_CHAR, "Charging characteristics" }, /* 3G */
776 { GTP_EXT_TRACE_REF, "Trace references" }, /* 3G */
777 { GTP_EXT_TRACE_TYPE, "Trace type" }, /* 3G */
778 { GTPv1_EXT_MS_REASON, "MS not reachable reason" }, /* 3G */
779 { GTP_EXT_TR_COMM, "Packet transfer command" }, /* charging */
780 { GTP_EXT_CHRG_ID, "Charging ID" },
781 { GTP_EXT_USER_ADDR, "End user address" },
782 { GTP_EXT_MM_CNTXT, "MM context" },
783 { GTP_EXT_PDP_CNTXT, "PDP context" },
784 { GTP_EXT_APN, "Access Point Name" },
785 { GTP_EXT_PROTO_CONF, "Protocol configuration options" },
786 { GTP_EXT_GSN_ADDR, "GSN address" },
787 { GTP_EXT_MSISDN, "MS international PSTN/ISDN number" },
788 { GTP_EXT_QOS_UMTS, "Quality of service (UMTS)" }, /* 3G */
789 { GTP_EXT_AUTH_QUI, "Authentication quintuplets" }, /* 3G */
790 { GTP_EXT_TFT, "Traffic Flow Template (TFT)" }, /* 3G */
791 { GTP_EXT_TARGET_ID, "Target (RNC) identification" }, /* 3G */
792 { GTP_EXT_UTRAN_CONT, "UTRAN transparent field" }, /* 3G */
793 { GTP_EXT_RAB_SETUP, "RAB setup information" }, /* 3G */
794 { GTP_EXT_HDR_LIST, "Extension Header Types List" }, /* 3G */
795 { GTP_EXT_TRIGGER_ID, "Trigger Id" }, /* 3G */
796 { GTP_EXT_OMC_ID, "OMC Identity" }, /* 3G */
798 { GTP_EXT_RAN_TR_CONT, "RAN Transparent Container" }, /* 7.7.43 */
799 { GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization" }, /* 7.7.45 */
800 { GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information" }, /* 7.7.45A */
801 { GTP_EXT_SSGN_NO, "SGSN Number" }, /* 7.7.47 */
802 { GTP_EXT_COMMON_FLGS, "Common Flags" }, /* 7.7.48 */
803 { GTP_EXT_APN_RES, "APN Restriction" }, /* 3G */
804 { GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS" }, /* 7.7.25B */
805 { GTP_EXT_RAT_TYPE, "RAT Type" }, /* 3G */
806 { GTP_EXT_USR_LOC_INF, "User Location Information" }, /* 7.7.51 */
807 { GTP_EXT_MS_TIME_ZONE, "MS Time Zone" }, /* 7.7.52 */
809 { GTP_EXT_IMEISV, "IMEI(SV)" }, /* 3G */
810 { GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container" }, /* 7.7.54 */
811 { GTP_EXT_MBMS_UE_CTX, "MBMS UE Context" }, /* 7.7.55 */
812 { GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)" }, /* 7.7.56 */
813 { GTP_EXT_RIM_RA, "RIM Routing Address" }, /* 7.7.57 */
814 { GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options" }, /* 7.7.58 */
815 { GTP_EXT_MBMS_SA, "MBMS Service Area" }, /* 7.7.60 */
816 { GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info" }, /* 7.7.61 */
817 { GTP_EXT_ADD_TRS_INF, "Additional Trace Info" }, /* 7.7.62 */
818 { GTP_EXT_HOP_COUNT, "Hop Counter" }, /* 7.7.63 */
819 { GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID" }, /* 7.7.64 */
820 { GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier" }, /* 7.7.65 */
821 { GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator" }, /* 7.7.66 */
822 { GTP_EXT_ENH_NSAPI, "Enhanced NSAPI" }, /* 7.7.67 */
823 { GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration" }, /* 7.7.59 */
824 { GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info" }, /* 7.7.68 */
825 { GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number" }, /* 7.7.69 */
826 { GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer" }, /* 7.7.70 */
827 { GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context" }, /* 7.7.71 */
828 { GTP_EXT_BSS_CONT, "BSS Container" }, /* 7.7.72 */
829 { GTP_EXT_CELL_ID, "Cell Identification" }, /* 7.7.73 */
830 { GTP_EXT_PDU_NO, "PDU Numbers" }, /* 7.7.74 */
831 { GTP_EXT_BSSGP_CAUSE, "BSSGP Cause" }, /* 7.7.75 */
832 { GTP_EXT_REL_PACK, "Sequence numbers of released packets IE" }, /* charging */
833 { GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE" }, /* charging */
834 { GTP_EXT_CHRG_ADDR, "Charging Gateway address" },
835 { GTP_EXT_DATA_REQ, "Data record packet" }, /* charging */
836 { GTP_EXT_DATA_RESP, "Requests responded" }, /* charging */
837 { GTP_EXT_NODE_ADDR, "Address of recommended node" }, /* charging */
838 { GTP_EXT_PRIV_EXT, "Private Extension" },
841 /* GPRS: 9.60 v7.6.0, page 37
842 * UMTS: 29.060 v4.0, page 45
844 static const value_string cause_type[] = {
845 { 0, "Request IMSI" },
846 { 1, "Request IMEI" },
847 { 2, "Request IMSI and IMEI" },
848 { 3, "No identity needed" },
850 { 5, "MS is not GPRS responding" },
851 { 59, "System failure" }, /* charging */
852 { 60, "The transmit buffers are becoming full" }, /* charging */
853 { 61, "The receive buffers are becoming full" }, /* charging */
854 { 62, "Another node is about to go down" }, /* charging */
855 { 63, "This node is about to go down" }, /* charging */
856 { 128, "Request accepted" },
857 { 192, "Non-existent" },
858 { 193, "Invalid message format" },
859 { 194, "IMSI not known" },
860 { 195, "MS is GPRS detached" },
861 { 196, "MS is not GPRS responding" },
862 { 197, "MS refuses" },
863 { 198, "Version not supported" },
864 { 199, "No resource available" },
865 { 200, "Service not supported" },
866 { 201, "Mandatory IE incorrect" },
867 { 202, "Mandatory IE missing" },
868 { 203, "Optional IE incorrect" },
869 { 204, "System failure" },
870 { 205, "Roaming restriction" },
871 { 206, "P-TMSI signature mismatch" },
872 { 207, "GPRS connection suspended" },
873 { 208, "Authentication failure" },
874 { 209, "User authentication failed" },
875 { 210, "Context not found" },
876 { 211, "All PDP dynamic addresses are occupied" },
877 { 212, "No memory is available" },
878 { 213, "Relocation failure" },
879 { 214, "Unknown mandatory extension header" },
880 { 215, "Semantic error in the TFT operation" },
881 { 216, "Syntactic error in the TFT operation" },
882 { 217, "Semantic errors in packet filter(s)" },
883 { 218, "Syntactic errors in packet filter(s)" },
884 { 219, "Missing or unknown APN" },
885 { 220, "Unknown PDP address or PDP type" },
886 { 221, "PDP context without TFT already activated" },
887 { 222, "APN access denied - no subscription" },
888 { 223, "APN Restriction type incompatibility with currently active PDP Contexts" },
889 { 224, "MS MBMS Capabilities Insufficient" },
890 { 225, "Invalid Correlation-ID" },
891 { 226, "MBMS Bearer Context Superseded" },
892 { 252, "Request related to possibly duplicated packets already fulfilled" }, /* charging */
893 { 253, "Request already fulfilled" }, /* charging */
894 { 254, "Sequence numbers of released/cancelled packets IE incorrect" }, /* charging */
895 { 255, "Request not fulfilled" }, /* charging */
900 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
901 * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
904 static const value_string gsn_addr_type[] = {
910 static const value_string pdp_type[] = {
913 { 0x02, "OSP:IHOSS" },
919 static const value_string pdp_org_type[] = {
925 static const value_string qos_delay_type[] = {
926 { 0x00, "Subscribed delay class (in MS to network direction)" },
927 { 0x01, "Delay class 1" },
928 { 0x02, "Delay class 2" },
929 { 0x03, "Delay class 3" },
930 { 0x04, "Delay class 4 (best effort)" },
931 { 0x07, "Reserved" },
935 static const value_string qos_reliability_type[] = {
936 { 0x00, "Subscribed reliability class (in MS to network direction)" },
937 { 0x01, "Acknowledged GTP, LLC, and RLC; Protected data" },
938 { 0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data" },
939 { 0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data" },
940 { 0x04, "Unacknowledged GTP/LLC/RLC, Protected data" },
941 { 0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data" },
942 { 0x07, "Reserved" },
946 static const value_string qos_peak_type[] = {
947 { 0x00, "Subscribed peak throughput (in MS to network direction)" },
948 { 0x01, "Up to 1 000 oct/s" },
949 { 0x02, "Up to 2 000 oct/s" },
950 { 0x03, "Up to 4 000 oct/s" },
951 { 0x04, "Up to 8 000 oct/s" },
952 { 0x05, "Up to 16 000 oct/s" },
953 { 0x06, "Up to 32 000 oct/s" },
954 { 0x07, "Up to 64 000 oct/s" },
955 { 0x08, "Up to 128 000 oct/s" },
956 { 0x09, "Up to 256 000 oct/s" },
957 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
958 { 0x0A, "Reserved" },
959 { 0x0B, "Reserved" },
960 { 0x0C, "Reserved" },
961 { 0x0D, "Reserved" },
962 { 0x0E, "Reserved" },
963 { 0x0F, "Reserved" },
967 static const value_string qos_precedence_type[] = {
968 { 0x00, "Subscribed precedence (in MS to network direction)" },
969 { 0x01, "High priority" },
970 { 0x02, "Normal priority" },
971 { 0x03, "Low priority" },
972 { 0x07, "Reserved" },
976 static const value_string qos_mean_type[] = {
977 { 0x00, "Subscribed mean throughput (in MS to network direction)" },
978 { 0x01, "100 oct/h" }, /* Class 2 */
979 { 0x02, "200 oct/h" }, /* Class 3 */
980 { 0x03, "500 oct/h" }, /* Class 4 */
981 { 0x04, "1 000 oct/h" }, /* Class 5 */
982 { 0x05, "2 000 oct/h" }, /* Class 6 */
983 { 0x06, "5 000 oct/h" }, /* Class 7 */
984 { 0x07, "10 000 oct/h" }, /* Class 8 */
985 { 0x08, "20 000 oct/h" }, /* Class 9 */
986 { 0x09, "50 000 oct/h" }, /* Class 10 */
987 { 0x0A, "100 000 oct/h" }, /* Class 11 */
988 { 0x0B, "200 000 oct/h" }, /* Class 12 */
989 { 0x0C, "500 000 oct/h" }, /* Class 13 */
990 { 0x0D, "1 000 000 oct/h" }, /* Class 14 */
991 { 0x0E, "2 000 000 oct/h" }, /* Class 15 */
992 { 0x0F, "5 000 000 oct/h" }, /* Class 16 */
993 { 0x10, "10 000 000 oct/h" }, /* Class 17 */
994 { 0x11, "20 000 000 oct/h" }, /* Class 18 */
995 { 0x12, "50 000 000 oct/h" }, /* Class 19 */
996 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
997 { 0x13, "Reserved" },
998 { 0x14, "Reserved" },
999 { 0x15, "Reserved" },
1000 { 0x16, "Reserved" },
1001 { 0x17, "Reserved" },
1002 { 0x18, "Reserved" },
1003 { 0x19, "Reserved" },
1004 { 0x1A, "Reserved" },
1005 { 0x1B, "Reserved" },
1006 { 0x1C, "Reserved" },
1007 { 0x1D, "Reserved" },
1008 { 0x1E, "Reserved" },
1009 { 0x1F, "Best effort" }, /* Class 1 */
1013 static const value_string qos_del_err_sdu[] = {
1014 { 0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)" },
1015 { 0x01, "No detect ('-')" },
1016 { 0x02, "Erroneous SDUs are delivered ('yes')" },
1017 { 0x03, "Erroneous SDUs are not delivered ('no')" },
1018 { 0x07, "Reserved" }, /* All other values are reserved */
1022 static const value_string qos_del_order[] = {
1023 { 0x00, "Subscribed delivery order (in MS to network direction)" },
1024 { 0x01, "With delivery order ('yes')" },
1025 { 0x02, "Without delivery order ('no')" },
1026 { 0x03, "Reserved" }, /* All other values are reserved */
1030 static const value_string qos_traf_class[] = {
1031 { 0x00, "Subscribed traffic class (in MS to network direction)" },
1032 { 0x01, "Conversational class" },
1033 { 0x02, "Streaming class" },
1034 { 0x03, "Interactive class" },
1035 { 0x04, "Background class" },
1036 { 0x07, "Reserved" }, /* All other values are reserved */
1040 static const value_string qos_max_sdu_size[] = {
1041 { 0x00, "Subscribed maximum SDU size (in MS to network direction" },
1042 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
1043 { 0x97, "1502 octets" },
1044 { 0x98, "1510 octets" },
1045 { 0x99, "1520 octets" },
1046 { 0, NULL } /* All other values are reserved */
1049 static const value_string qos_max_ul[] = {
1050 { 0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)" },
1051 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1052 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1053 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1058 static const value_string qos_max_dl[] = {
1059 { 0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)" },
1060 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1061 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1062 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1067 static const value_string qos_res_ber[] = {
1068 { 0x00, "Subscribed residual BER (in MS to network direction)" },
1069 { 0x01, "1/20 = 5x10^-2" },
1070 { 0x02, "1/100 = 1x10^-2" },
1071 { 0x03, "1/200 = 5x10^-3" },
1072 { 0x04, "1/250 = 4x10^-3" },
1073 { 0x05, "1/1 000 = 1x10^-3" },
1074 { 0x06, "1/10 000 = 1x10^-4" },
1075 { 0x07, "1/100 000 = 1x10^-5" },
1076 { 0x08, "1/1 000 000 = 1x10^-6" },
1077 { 0x09, "3/50 000 000 = 6x10^-8" },
1078 { 0x0F, "Reserved" }, /* All other values are reserved */
1082 static const value_string qos_sdu_err_ratio[] = {
1083 { 0x00, "Subscribed SDU error ratio (in MS to network direction)" },
1084 { 0x01, "1/100 = 1x10^-2" },
1085 { 0x02, "7/1000 = 7x10^-3" },
1086 { 0x03, "1/1 000 = 1x10^-3" },
1087 { 0x04, "1/10 000 = 1x10^-4" },
1088 { 0x05, "1/100 000 = 1x10^-5" },
1089 { 0x06, "1/1 000 000 = 1x10^-6" },
1090 { 0x07, "1/10 = 1x10^-1" },
1091 { 0x0F, "Reserved" }, /* All other values are reserved */
1095 static const value_string qos_traf_handl_prio[] = {
1096 { 0x00, "Subscribed traffic handling priority (in MS to network direction)" },
1097 { 0x01, "Priority level 1" },
1098 { 0x02, "Priority level 2" },
1099 { 0x03, "Priority level 3" },
1103 static const value_string qos_trans_delay[] = {
1104 { 0x00, "Subscribed Transfer Delay (in MS to network direction)" },
1105 { 0x01, "10 ms" }, /* Using a granularity of 10 ms */
1120 { 0x10, "200 ms" }, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
1136 { 0x20, "1000 ms" }, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
1137 { 0x21, "1100 ms" },
1138 { 0x22, "1200 ms" },
1139 { 0x23, "1300 ms" },
1140 { 0x24, "1400 ms" },
1141 { 0x25, "1500 ms" },
1142 { 0x26, "1600 ms" },
1143 { 0x27, "1700 ms" },
1144 { 0x28, "1800 ms" },
1145 { 0x29, "1900 ms" },
1146 { 0x2A, "2000 ms" },
1147 { 0x2B, "2100 ms" },
1148 { 0x2C, "2200 ms" },
1149 { 0x2D, "2300 ms" },
1150 { 0x2E, "2400 ms" },
1151 { 0x2F, "2500 ms" },
1152 { 0x30, "2600 ms" },
1153 { 0x31, "2700 ms" },
1154 { 0x32, "2800 ms" },
1155 { 0x33, "2900 ms" },
1156 { 0x34, "3000 ms" },
1157 { 0x35, "3100 ms" },
1158 { 0x36, "3200 ms" },
1159 { 0x37, "3300 ms" },
1160 { 0x38, "3400 ms" },
1161 { 0x39, "3500 ms" },
1162 { 0x3A, "3600 ms" },
1163 { 0x3B, "3700 ms" },
1164 { 0x3C, "3800 ms" },
1165 { 0x3D, "3900 ms" },
1166 { 0x3E, "4000 ms" },
1167 { 0x3F, "Reserved"},
1171 static const value_string qos_guar_ul[] = {
1172 { 0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)" },
1173 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1174 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1175 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1180 static const value_string qos_guar_dl[] = {
1181 { 0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)" },
1182 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1183 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1184 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1189 static const value_string sel_mode_type[] = {
1190 { 0, "MS or network provided APN, subscribed verified" },
1191 { 1, "MS provided APN, subscription not verified" },
1192 { 2, "Network provided APN, subscription not verified" },
1193 { 3, "For future use (Network provided APN, subscription not verified" },/* Shall not be sent. If received, shall be sent as value 2 */
1197 static const value_string tr_comm_type[] = {
1198 { 1, "Send data record packet" },
1199 { 2, "Send possibly duplicated data record packet" },
1200 { 3, "Cancel data record packet" },
1201 { 4, "Release data record packet"},
1205 /* TODO: CHeck if all ms_reasons are included */
1206 static const value_string ms_not_reachable_type[] = {
1207 { 0, "No paging response via the MSC" },
1208 { 1, "IMSI detached" },
1209 { 2, "Roaming restriction" },
1210 { 3, "Deregistered in the HLR for non GPRS" },
1211 { 4, "MS purge for non GPRS" },
1212 { 5, "No paging response via the SGSN" },
1213 { 6, "GPRS detached" },
1214 { 7, "Deregistered in the HLR for non GPRS" },
1215 { 8, "MS purged for GPRS" },
1216 { 9, "Unidentified subscriber via the MSC" },
1217 { 10, "Unidentified subscriber via the SGSN" },
1221 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1223 static const value_string ranap_cause_type[] = {
1224 /* Radio Network Layer Cause (1-->64) */
1225 { 1, "RAB preempted" },
1226 { 2, "Trelocoverall Expiry" },
1227 { 3, "Trelocprep Expiry" },
1228 { 4, "Treloccomplete Expiry" },
1229 { 5, "Tqueing Expiry" },
1230 { 6, "Relocation Triggered" },
1231 { 7, "TRELOCalloc Expiry" },
1232 { 8, "Unable to Estabish During Relocation" },
1233 { 9, "Unknown Target RNC" },
1234 { 10, "Relocation Cancelled" },
1235 { 11, "Successful Relocation" },
1236 { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported" },
1237 { 13, "Change of Ciphering and/or Integrity Protection is not supported" },
1238 { 14, "Failure in the Radio Interface Procedure" },
1239 { 15, "Release due to UTRAN Generated Reason" },
1240 { 16, "User Inactivity" },
1241 { 17, "Time Critical Relocation" },
1242 { 18, "Requested Traffic Class not Available" },
1243 { 19, "Invalid RAB Parameters Value" },
1244 { 20, "Requested Maximum Bit Rate not Available" },
1245 { 21, "Requested Guaranteed Bit Rate not Available" },
1246 { 22, "Requested Transfer Delay not Achievable" },
1247 { 23, "Invalid RAB Parameters Combination" },
1248 { 24, "Condition Violation for SDU Parameters" },
1249 { 25, "Condition Violation for Traffic Handling Priority" },
1250 { 26, "Condition Violation for Guaranteed Bit Rate" },
1251 { 27, "User Plane Versions not Supported" },
1252 { 28, "Iu UP Failure" },
1253 { 29, "Relocation Failure in Target CN/RNC or Target System" },
1254 { 30, "Invalid RAB ID" },
1255 { 31, "No Remaining RAB" },
1256 { 32, "Interaction with other procedure" },
1257 { 33, "Requested Maximum Bit Rate for DL not Available" },
1258 { 34, "Requested Maximum Bit Rate for UL not Available" },
1259 { 35, "Requested Guaranteed Bit Rate for DL not Available" },
1260 { 36, "Requested Guaranteed Bit Rate for UL not Available" },
1261 { 37, "Repeated Integrity Checking Failure" },
1262 { 38, "Requested Report Type not supported" },
1263 { 39, "Request superseded" },
1264 { 40, "Release due to UE generated signalling connection release" },
1265 { 41, "Resource Optimisation Relocation" },
1266 { 42, "Requested Information Not Available" },
1267 { 43, "Relocation desirable for radio reasons" },
1268 { 44, "Relocation not supported in Target RNC or Target System" },
1269 { 45, "Directed Retry" },
1270 { 46, "Radio Connection With UE Lost" },
1271 { 47, "rNC-unable-to-establish-all-RFCs" },
1272 { 48, "deciphering-keys-not-available" },
1273 { 49, "dedicated-assistance-data-not-available" },
1274 { 50, "relocation-target-not-allowed" },
1275 { 51, "location-reporting-congestion" },
1276 { 52, "reduce-load-in-serving-cell" },
1277 { 53, "no-radio-resources-available-in-target-cell" },
1278 { 54, "gERAN-Iumode-failure" },
1279 { 55, "access-restricted-due-to-shared-networks" },
1280 { 56, "incoming-relocation-not-supported-due-to-PUESBINE-feature" },
1281 { 57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell" },
1282 { 58, "mBMS-no-multicast-service-for-this-UE" },
1283 { 59, "mBMS-unknown-UE-ID" },
1284 { 60, "successful-MBMS-session-start-no-data-bearer-necessary" },
1285 { 61, "mBMS-superseded-due-to-NNSF" },
1286 { 62, "mBMS-UE-linking-already-done" },
1287 { 63, "mBMS-UE-de-linking-failure-no-existing-UE-linking" },
1288 { 64, "tMGI-unknown" },
1289 /* Transport Layer Cause (65-->80) */
1290 { 65, "Signalling Transport Resource Failure" },
1291 { 66, "Iu Transport Connection Failed to Establish" },
1292 /* NAS Cause (81-->96) */
1293 { 81, "User Restriction Start Indication" },
1294 { 82, "User Restriction End Indication" },
1295 { 83, "Normal Release" },
1296 /* Protocol Cause (97-->112) */
1297 { 97, "Transfer Syntax Error" },
1298 { 98, "Semantic Error" },
1299 { 99, "Message not compatible with receiver state" },
1300 { 100, "Abstract Syntax Error (Reject)" },
1301 { 101, "Abstract Syntax Error (Ignore and Notify)" },
1302 { 102, "Abstract Syntax Error (Falsely Constructed Message" },
1303 /* Miscellaneous Cause (113-->128) */
1304 { 113, "O & M Intervention" },
1305 { 114, "No Resource Available" },
1306 { 115, "Unspecified Failure" },
1307 { 116, "Network Opimisation" },
1308 /* Non-standard Cause (129-->255) */
1310 /* ranap_CauseRadioNetworkExtension ??
1311 { 257, "iP-multicast-address-and-APN-not-valid" },
1312 { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
1313 { 259, "mBMS-request-superseded" },
1314 { 260, "mBMS-de-registration-during-session-not-allowed" },
1315 { 261, "mBMS-no-data-bearer-necessary" },
1321 static const value_string mm_sec_modep[] = {
1322 { 0, "Used cipher value, UMTS keys and Quintuplets" },
1323 { 1, "GSM key and triplets" },
1324 { 2, "UMTS key and quintuplets" },
1325 { 3, "GSM key and quintuplets" },
1329 static const value_string gtp_cipher_algorithm[] = {
1330 { 0, "No ciphering" },
1341 static const value_string gtp_ext_rat_type_vals[] = {
1351 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
1352 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
1353 #define MM_PROTO_PDSS1 0x02
1354 #define MM_PROTO_CALL_CONTROL 0x03
1355 #define MM_PROTO_PDSS2 0x04
1356 #define MM_PROTO_MM_NON_GPRS 0x05
1357 #define MM_PROTO_RR_MGMT 0x06
1358 #define MM_PROTO_MM_GPRS 0x08
1359 #define MM_PROTO_SMS 0x09
1360 #define MM_PROTO_SESSION_MGMT 0x0A
1361 #define MM_PROTO_NON_CALL_RELATED 0x0B
1363 static const value_string tft_code_type[] = {
1365 { 1, "Create new TFT" },
1366 { 2, "Delete existing TFT" },
1367 { 3, "Add packet filters to existing TFT" },
1368 { 4, "Replace packet filters in existing TFT" },
1369 { 5, "Delete packet filters from existing TFT" },
1376 static dissector_handle_t ip_handle;
1377 static dissector_handle_t ipv6_handle;
1378 static dissector_handle_t ppp_handle;
1379 static dissector_handle_t data_handle;
1380 static dissector_handle_t gtpcdr_handle;
1381 static dissector_table_t bssap_pdu_type_table=NULL;
1383 static int decode_gtp_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1384 static int decode_gtp_imsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1385 static int decode_gtp_rai (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1386 static int decode_gtp_tlli (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1387 static int decode_gtp_ptmsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1388 static int decode_gtp_qos_gprs (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1389 static int decode_gtp_reorder (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1390 static int decode_gtp_auth_tri (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1391 static int decode_gtp_map_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1392 static int decode_gtp_ptmsi_sig (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1393 static int decode_gtp_ms_valid (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1394 static int decode_gtp_recovery (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1395 static int decode_gtp_sel_mode (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1396 static int decode_gtp_16 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1397 static int decode_gtp_17 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1398 static int decode_gtp_18 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1399 static int decode_gtp_19 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1400 static int decode_gtp_nsapi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1401 static int decode_gtp_ranap_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1402 static int decode_gtp_rab_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1403 static int decode_gtp_rp_sms (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1404 static int decode_gtp_rp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1405 static int decode_gtp_pkt_flow_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1406 static int decode_gtp_chrg_char (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1407 static int decode_gtp_trace_ref (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1408 static int decode_gtp_trace_type (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1409 static int decode_gtp_ms_reason (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1410 static int decode_gtp_tr_comm (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1411 static int decode_gtp_chrg_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1412 static int decode_gtp_user_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1413 static int decode_gtp_mm_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1414 static int decode_gtp_pdp_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1415 static int decode_gtp_apn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1416 static int decode_gtp_gsn_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1417 static int decode_gtp_proto_conf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1418 static int decode_gtp_msisdn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1419 static int decode_gtp_qos_umts (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1420 static int decode_gtp_auth_qui (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1421 static int decode_gtp_tft (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1422 static int decode_gtp_target_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1423 static int decode_gtp_utran_cont (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1424 static int decode_gtp_rab_setup (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1425 static int decode_gtp_hdr_list (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1426 static int decode_gtp_trigger_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1427 static int decode_gtp_omc_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1429 static int decode_gtp_ran_tr_cont (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1430 static int decode_gtp_pdp_cont_prio (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1431 static int decode_gtp_add_rab_setup_inf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1432 static int decode_gtp_ssgn_no (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1433 static int decode_gtp_common_flgs (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1434 static int decode_gtp_apn_res (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1435 static int decode_gtp_ra_prio_lcs (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1436 static int decode_gtp_rat_type (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1437 static int decode_gtp_usr_loc_inf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1438 static int decode_gtp_ms_time_zone (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1439 static int decode_gtp_imeisv (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1440 static int decode_gtp_camel_chg_inf_con (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1441 static int decode_gtp_mbms_ue_ctx (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1442 static int decode_gtp_tmgi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1443 static int decode_gtp_rim_ra (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1444 static int decode_gtp_mbms_prot_conf_opt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1445 static int decode_gtp_mbms_sa (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1446 static int decode_gtp_src_rnc_pdp_ctx_inf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1447 static int decode_gtp_add_trs_inf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1448 static int decode_gtp_hop_count (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1449 static int decode_gtp_sel_plmn_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1450 static int decode_gtp_mbms_ses_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1451 static int decode_gtp_mbms_2g_3g_ind (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1452 static int decode_gtp_enh_nsapi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1453 static int decode_gtp_mbms_ses_dur (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1454 static int decode_gtp_add_mbms_trs_inf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1455 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1456 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1457 static int decode_gtp_ps_ho_req_ctx (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1458 static int decode_gtp_bss_cont (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1459 static int decode_gtp_cell_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1460 static int decode_gtp_pdu_no (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1461 static int decode_gtp_bssgp_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1463 static int decode_gtp_chrg_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1464 static int decode_gtp_rel_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1465 static int decode_gtp_can_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1466 static int decode_gtp_data_req (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1467 static int decode_gtp_data_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1468 static int decode_gtp_node_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1469 static int decode_gtp_priv_ext (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1470 static int decode_gtp_unknown (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1472 typedef struct _gtp_opt {
1474 int (*decode)(tvbuff_t *, int, packet_info *, proto_tree *);
1477 static const gtp_opt_t gtpopt[] = {
1478 { GTP_EXT_CAUSE, decode_gtp_cause },
1479 { GTP_EXT_IMSI, decode_gtp_imsi },
1480 { GTP_EXT_RAI, decode_gtp_rai },
1481 { GTP_EXT_TLLI, decode_gtp_tlli },
1482 { GTP_EXT_PTMSI, decode_gtp_ptmsi },
1483 { GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs },
1484 { GTP_EXT_REORDER, decode_gtp_reorder },
1485 { GTP_EXT_AUTH_TRI, decode_gtp_auth_tri },
1486 { GTP_EXT_MAP_CAUSE, decode_gtp_map_cause },
1487 { GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig },
1488 { GTP_EXT_MS_VALID, decode_gtp_ms_valid },
1489 { GTP_EXT_RECOVER, decode_gtp_recovery },
1490 { GTP_EXT_SEL_MODE, decode_gtp_sel_mode },
1491 { GTP_EXT_16, decode_gtp_16 },
1492 { GTP_EXT_17, decode_gtp_17 },
1493 { GTP_EXT_18, decode_gtp_18 },
1494 { GTP_EXT_19, decode_gtp_19 },
1495 { GTP_EXT_NSAPI, decode_gtp_nsapi },
1496 { GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause },
1497 { GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt },
1498 { GTP_EXT_RP_SMS, decode_gtp_rp_sms },
1499 { GTP_EXT_RP, decode_gtp_rp },
1500 { GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id },
1501 { GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char },
1502 { GTP_EXT_TRACE_REF, decode_gtp_trace_ref },
1503 { GTP_EXT_TRACE_TYPE, decode_gtp_trace_type },
1504 { GTPv1_EXT_MS_REASON, decode_gtp_ms_reason },
1505 { GTP_EXT_TR_COMM, decode_gtp_tr_comm },
1506 { GTP_EXT_CHRG_ID, decode_gtp_chrg_id },
1507 { GTP_EXT_USER_ADDR, decode_gtp_user_addr },
1508 { GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt },
1509 { GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt },
1510 { GTP_EXT_APN, decode_gtp_apn },
1511 { GTP_EXT_PROTO_CONF, decode_gtp_proto_conf },
1512 { GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr },
1513 { GTP_EXT_MSISDN, decode_gtp_msisdn },
1514 { GTP_EXT_QOS_UMTS, decode_gtp_qos_umts }, /* 3G */
1515 { GTP_EXT_AUTH_QUI, decode_gtp_auth_qui }, /* 3G */
1516 { GTP_EXT_TFT, decode_gtp_tft }, /* 3G */
1517 { GTP_EXT_TARGET_ID, decode_gtp_target_id }, /* 3G */
1518 { GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont }, /* 3G */
1519 { GTP_EXT_RAB_SETUP, decode_gtp_rab_setup }, /* 3G */
1520 { GTP_EXT_HDR_LIST, decode_gtp_hdr_list }, /* 3G */
1521 { GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id }, /* 3G */
1522 { GTP_EXT_OMC_ID, decode_gtp_omc_id }, /* 3G */
1523 /* TS 29 060 V6.11.0 */
1524 { GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont }, /* 7.7.43 */
1525 { GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio }, /* 7.7.45 */
1526 { GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf }, /* 7.7.45A */
1527 { GTP_EXT_SSGN_NO, decode_gtp_ssgn_no }, /* 7.7.47 */
1528 { GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs }, /* 7.7.48 */
1529 { GTP_EXT_APN_RES, decode_gtp_apn_res }, /* 3G */
1530 { GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs }, /* 7.7.25B */
1531 { GTP_EXT_RAT_TYPE, decode_gtp_rat_type }, /* 3G */
1532 { GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf}, /* 7.7.51 */
1533 { GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone}, /* 7.7.52 */
1534 { GTP_EXT_IMEISV, decode_gtp_imeisv }, /* 3G 7.7.53*/
1535 { GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con }, /* 7.7.54 */
1536 { GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx }, /* 7.7.55 */
1537 { GTP_EXT_TMGI, decode_gtp_tmgi }, /* 7.7.56 */
1538 { GTP_EXT_RIM_RA, decode_gtp_rim_ra }, /* 7.7.57 */
1539 { GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt }, /* 7.7.58 */
1540 { GTP_EXT_MBMS_SA, decode_gtp_mbms_sa }, /* 7.7.60 */
1541 { GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf }, /* 7.7.61 */
1542 { GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf }, /* 7.7.62 */
1543 { GTP_EXT_HOP_COUNT, decode_gtp_hop_count }, /* 7.7.63 */
1544 { GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id }, /* 7.7.64 */
1545 { GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id }, /* 7.7.65 */
1546 { GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind }, /* 7.7.66 */
1547 { GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi }, /* 7.7.67 */
1548 { GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur }, /* 7.7.59 */
1549 { GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf }, /* 7.7.68 */
1550 { GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no }, /* 7.7.69 */
1551 { GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr }, /* 7.7.70 */
1552 { GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx }, /* 7.7.71 */
1553 { GTP_EXT_BSS_CONT, decode_gtp_bss_cont }, /* 7.7.72 */
1554 { GTP_EXT_CELL_ID, decode_gtp_cell_id }, /* 7.7.73 */
1555 { GTP_EXT_PDU_NO, decode_gtp_pdu_no }, /* 7.7.74 */
1556 { GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause }, /* 7.7.75 */
1558 { GTP_EXT_REL_PACK, decode_gtp_rel_pack }, /* charging */
1559 { GTP_EXT_CAN_PACK, decode_gtp_can_pack }, /* charging */
1560 { GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr },
1561 { GTP_EXT_DATA_REQ, decode_gtp_data_req }, /* charging */
1562 { GTP_EXT_DATA_RESP, decode_gtp_data_resp }, /* charging */
1563 { GTP_EXT_NODE_ADDR, decode_gtp_node_addr },
1564 { GTP_EXT_PRIV_EXT, decode_gtp_priv_ext },
1565 { 0, decode_gtp_unknown }
1574 static guint8 gtp_version = 0;
1575 static const char *yesno[] = { "no", "yes" };
1578 col_append_str_gtp(column_info *cinfo, gint el, const gchar *proto_name) {
1582 gchar _tmp[COL_MAX_LEN];
1584 max_len = COL_MAX_LEN;
1586 for (i = 0; i < cinfo->num_cols; i++) {
1587 if (cinfo->fmt_matx[i][el]) {
1588 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
1590 strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
1591 cinfo->col_buf[i][max_len - 1] = '\0';
1595 strncat(_tmp, proto_name, COL_MAX_LEN);
1596 strncat(_tmp, " <", COL_MAX_LEN - strlen(_tmp));
1597 strncat(_tmp, cinfo->col_buf[i], COL_MAX_LEN - strlen(_tmp));
1598 strncat(_tmp, ">", COL_MAX_LEN - strlen(_tmp));
1599 cinfo->col_buf[i][0] = '\0';
1600 strncat(cinfo->col_buf[i], _tmp, COL_MAX_LEN);
1601 cinfo->col_data[i] = cinfo->col_buf[i];
1607 id_to_str(const guint8 *ad) {
1609 static gchar str[17] = " ";
1610 guint8 bits8to5, bits4to1;
1612 static const gchar hex_digits[10] = "0123456789";
1614 for (i = 0; i < 8; i++) {
1615 bits8to5 = (ad[i] >> 4) & 0x0F;
1616 bits4to1 = ad[i] & 0x0F;
1618 str[j++] = hex_digits[bits4to1];
1620 str[j++] = hex_digits[bits8to5];
1627 imsi_to_str(const guint8 *ad) {
1629 static gchar str[17] = " ";
1632 for (i = 0; i < 8; i++) {
1633 if ((ad[i] & 0x0F) <= 9) str[j++] = (ad[i] & 0x0F) + 0x30;
1634 if (((ad[i] >> 4) & 0x0F) <= 9) str[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
1642 msisdn_to_str(const guint8 *ad, int len) {
1644 static gchar str[18] = "+ ";
1645 guint8 bits8to5, bits4to1;
1647 static const gchar hex_digits[10] = "0123456789";
1649 for (i = 1; i < len && i < 9; i++) {
1650 bits8to5 = (ad[i] >> 4) & 0x0F;
1651 bits4to1 = ad[i] & 0x0F;
1653 str[j++] = hex_digits[bits4to1];
1655 str[j++] = hex_digits[bits8to5];
1662 /* Next definitions and function check_field_presence checks if given field
1663 * in GTP packet is compliant with ETSI
1665 typedef struct _header {
1670 typedef struct _message {
1672 ext_header fields[32];
1675 /* ---------------------
1677 * ---------------------*/
1678 static _gtp_mess_items gprs_mess_items[] = {
1682 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1687 GTP_MSG_ECHO_RESP, {
1688 { GTP_EXT_RECOVER, GTP_MANDATORY },
1689 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1694 GTP_MSG_VER_NOT_SUPP, {
1699 GTP_MSG_NODE_ALIVE_REQ, {
1700 { GTP_EXT_NODE_ADDR, GTP_MANDATORY },
1701 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1706 GTP_MSG_NODE_ALIVE_RESP, {
1707 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1712 GTP_MSG_REDIR_REQ, {
1713 { GTP_EXT_CAUSE, GTP_MANDATORY },
1714 { GTP_EXT_NODE_ADDR, GTP_OPTIONAL },
1715 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1720 GTP_MSG_REDIR_RESP, {
1721 { GTP_EXT_CAUSE, GTP_MANDATORY },
1722 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1727 GTP_MSG_CREATE_PDP_REQ, {
1728 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1729 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1730 { GTP_EXT_SEL_MODE, GTP_MANDATORY },
1731 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1732 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1733 { GTP_EXT_MSISDN, GTP_MANDATORY },
1734 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1735 { GTP_EXT_APN, GTP_MANDATORY },
1736 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1737 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1738 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1739 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1744 GTP_MSG_CREATE_PDP_RESP, {
1745 { GTP_EXT_CAUSE, GTP_MANDATORY },
1746 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1747 { GTP_EXT_REORDER, GTP_CONDITIONAL },
1748 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1749 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1750 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1751 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1752 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1753 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1754 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1755 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1756 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1757 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1762 GTP_MSG_UPDATE_PDP_REQ, {
1763 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1764 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1765 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1766 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1767 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1768 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1769 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1774 GTP_MSG_UPDATE_PDP_RESP, {
1775 { GTP_EXT_CAUSE, GTP_MANDATORY },
1776 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1777 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1778 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1779 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1780 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1781 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1782 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1783 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1784 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1789 GTP_MSG_DELETE_PDP_REQ, {
1790 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1795 GTP_MSG_DELETE_PDP_RESP, {
1796 { GTP_EXT_CAUSE, GTP_MANDATORY },
1797 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1802 GTP_MSG_CREATE_AA_PDP_REQ, {
1803 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1804 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1805 { GTP_EXT_SEL_MODE, GTP_MANDATORY },
1806 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1807 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1808 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1809 { GTP_EXT_APN, GTP_MANDATORY },
1810 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1811 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1812 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1813 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1818 GTP_MSG_CREATE_AA_PDP_RESP, {
1819 { GTP_EXT_CAUSE, GTP_MANDATORY },
1820 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1821 { GTP_EXT_REORDER, GTP_CONDITIONAL },
1822 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1823 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1824 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1825 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1826 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1827 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1828 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1829 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1830 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1831 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1836 GTP_MSG_DELETE_AA_PDP_REQ, {
1837 { GTP_EXT_CAUSE, GTP_MANDATORY },
1838 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1843 GTP_MSG_DELETE_AA_PDP_RESP, {
1844 { GTP_EXT_CAUSE, GTP_MANDATORY },
1845 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1851 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1856 GTP_MSG_PDU_NOTIFY_REQ, {
1857 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1858 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1863 GTP_MSG_PDU_NOTIFY_RESP, {
1864 { GTP_EXT_CAUSE, GTP_MANDATORY },
1865 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1870 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1871 { GTP_EXT_CAUSE, GTP_MANDATORY },
1872 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1873 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1878 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1879 { GTP_EXT_CAUSE, GTP_MANDATORY },
1880 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1885 GTP_MSG_SEND_ROUT_INFO_REQ, {
1886 { GTP_EXT_IMSI, GTP_MANDATORY },
1887 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1892 GTP_MSG_SEND_ROUT_INFO_RESP, {
1893 { GTP_EXT_CAUSE, GTP_MANDATORY },
1894 { GTP_EXT_IMSI, GTP_MANDATORY },
1895 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
1896 { GTP_EXT_MS_REASON, GTP_OPTIONAL },
1897 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL },
1898 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1903 GTP_MSG_FAIL_REP_REQ, {
1904 { GTP_EXT_IMSI, GTP_MANDATORY },
1905 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1910 GTP_MSG_FAIL_REP_RESP, {
1911 { GTP_EXT_CAUSE, GTP_MANDATORY },
1912 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
1913 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1918 GTP_MSG_MS_PRESENT_REQ, {
1919 { GTP_EXT_IMSI, GTP_MANDATORY },
1920 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1921 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1926 GTP_MSG_MS_PRESENT_RESP, {
1927 { GTP_EXT_CAUSE, GTP_MANDATORY },
1928 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1933 GTP_MSG_IDENT_REQ, {
1934 { GTP_EXT_RAI, GTP_MANDATORY },
1935 { GTP_EXT_PTMSI, GTP_MANDATORY },
1936 { GTP_EXT_PTMSI_SIG, GTP_OPTIONAL },
1937 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1942 GTP_MSG_IDENT_RESP, {
1943 { GTP_EXT_CAUSE, GTP_MANDATORY },
1944 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1945 { GTP_EXT_AUTH_TRI, GTP_OPTIONAL },
1946 { GTP_EXT_AUTH_QUI, GTP_OPTIONAL },
1947 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1952 GTP_MSG_SGSN_CNTXT_REQ, {
1953 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1954 { GTP_EXT_RAI, GTP_MANDATORY },
1955 { GTP_EXT_TLLI, GTP_MANDATORY },
1956 { GTP_EXT_PTMSI_SIG, GTP_OPTIONAL },
1957 { GTP_EXT_MS_VALID, GTP_OPTIONAL },
1958 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1963 GTP_MSG_SGSN_CNTXT_RESP, {
1964 { GTP_EXT_CAUSE, GTP_MANDATORY },
1965 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1966 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1967 { GTP_EXT_MM_CNTXT, GTP_CONDITIONAL },
1968 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
1969 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1974 GTP_MSG_SGSN_CNTXT_ACK, {
1975 { GTP_EXT_CAUSE, GTP_MANDATORY },
1976 { GTP_EXT_FLOW_II, GTP_CONDITIONAL },
1977 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1978 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1983 GTP_MSG_DATA_TRANSF_REQ, {
1984 { GTP_EXT_TR_COMM, GTP_MANDATORY },
1985 { GTP_EXT_DATA_REQ, GTP_CONDITIONAL },
1986 { GTP_EXT_REL_PACK, GTP_CONDITIONAL },
1987 { GTP_EXT_CAN_PACK, GTP_CONDITIONAL },
1988 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1993 GTP_MSG_DATA_TRANSF_RESP, {
1994 { GTP_EXT_CAUSE, GTP_MANDATORY },
1995 { GTP_EXT_DATA_RESP, GTP_MANDATORY },
1996 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2007 /* -----------------------------
2009 * -----------------------------*/
2010 static _gtp_mess_items umts_mess_items[] = {
2011 /* 7.2 Path Management Messages */
2014 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2019 GTP_MSG_ECHO_RESP, {
2020 { GTP_EXT_RECOVER, GTP_MANDATORY },
2021 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2026 GTP_MSG_VER_NOT_SUPP, {
2031 GTP_MSG_SUPP_EXT_HDR, {
2032 { GTP_EXT_HDR_LIST, GTP_MANDATORY },
2038 GTP_MSG_NODE_ALIVE_REQ, {
2039 { GTP_EXT_NODE_ADDR, GTP_MANDATORY },
2040 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2045 GTP_MSG_NODE_ALIVE_RESP, {
2046 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2051 GTP_MSG_REDIR_REQ, {
2052 { GTP_EXT_CAUSE, GTP_MANDATORY },
2053 { GTP_EXT_NODE_ADDR, GTP_OPTIONAL },
2054 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2059 GTP_MSG_REDIR_REQ, {
2063 /* 7.3 Tunnel Management Messages */
2065 GTP_MSG_CREATE_PDP_REQ, {
2066 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2067 /* RAI is in TS 29.060 V6.11.0 */
2068 { GTP_EXT_RAI, GTP_OPTIONAL }, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2069 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2070 { GTP_EXT_SEL_MODE, GTP_CONDITIONAL },
2071 { GTP_EXT_TEID, GTP_MANDATORY },
2072 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2073 { GTP_EXT_NSAPI, GTP_MANDATORY },
2074 { GTP_EXT_NSAPI, GTP_CONDITIONAL },
2075 { GTP_EXT_CHRG_CHAR, GTP_OPTIONAL },
2076 { GTP_EXT_TRACE_REF, GTP_OPTIONAL },
2077 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL },
2078 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
2079 { GTP_EXT_APN, GTP_CONDITIONAL },
2080 { GTP_EXT_PROTO_CONF, GTP_CONDITIONAL },
2081 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2082 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2083 { GTP_EXT_MSISDN, GTP_CONDITIONAL },
2084 { GTP_EXT_QOS_UMTS, GTP_MANDATORY },
2085 { GTP_EXT_TFT, GTP_CONDITIONAL },
2086 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL },
2087 { GTP_EXT_OMC_ID, GTP_OPTIONAL },
2088 /* TS 29.060 V6.11.0 */
2089 { GTP_EXT_APN_RES, GTP_OPTIONAL },
2090 { GTP_EXT_RAT_TYPE, GTP_OPTIONAL },
2091 { GTP_EXT_USR_LOC_INF, GTP_OPTIONAL },
2092 { GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL },
2093 { GTP_EXT_IMEISV, GTP_OPTIONAL },
2094 { GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL },
2095 { GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL },
2096 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2101 GTP_MSG_CREATE_PDP_RESP, {
2102 { GTP_EXT_CAUSE, GTP_MANDATORY },
2103 { GTP_EXT_REORDER, GTP_CONDITIONAL },
2104 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2105 { GTP_EXT_TEID, GTP_CONDITIONAL },
2106 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2107 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
2108 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
2109 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
2110 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2111 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2112 { GTP_EXT_QOS_UMTS, GTP_CONDITIONAL },
2113 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
2114 /* TS 29.060 V6.11.0 */
2115 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL }, /* Alternative Charging Gateway Address Optional 7.7.44 */
2116 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2117 { GTP_EXT_COMMON_FLGS, GTP_OPTIONAL }, /* Common Flags Optional 7.7.48 */
2118 { GTP_EXT_APN_RES, GTP_OPTIONAL }, /* APN Restriction Optional 7.7.49 */
2122 { /* checked, SGSN -> GGSN */
2123 GTP_MSG_UPDATE_PDP_REQ, {
2124 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2125 { GTP_EXT_RAI, GTP_OPTIONAL }, /* Routeing Area Identity (RAI) Optional 7.7.3 */
2126 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2127 { GTP_EXT_TEID, GTP_MANDATORY },
2128 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2129 { GTP_EXT_NSAPI, GTP_MANDATORY },
2130 { GTP_EXT_TRACE_REF, GTP_OPTIONAL },
2131 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL },
2132 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL }, /* Protocol Configuration Options Optional 7.7.31 */
2133 { GTP_EXT_GSN_ADDR, GTP_MANDATORY }, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2134 { GTP_EXT_GSN_ADDR, GTP_MANDATORY }, /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
2135 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL }, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2136 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL }, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2137 { GTP_EXT_QOS_UMTS, GTP_MANDATORY },
2138 { GTP_EXT_TFT, GTP_OPTIONAL },
2139 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL },
2140 { GTP_EXT_OMC_ID, GTP_OPTIONAL },
2141 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2142 { GTP_EXT_RAT_TYPE, GTP_OPTIONAL }, /* RAT Type Optional 7.7.50 */
2143 { GTP_EXT_USR_LOC_INF, GTP_OPTIONAL }, /* User Location Information Optional 7.7.51 */
2144 { GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL }, /* MS Time Zone Optional 7.7.52 */
2145 { GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL }, /* Additonal Trace Info Optional 7.7.62 */
2146 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2150 { /* checked, GGSN -> SGSN */
2151 GTP_MSG_UPDATE_PDP_RESP, {
2152 { GTP_EXT_CAUSE, GTP_MANDATORY },
2153 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2154 { GTP_EXT_TEID, GTP_CONDITIONAL },
2155 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2156 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
2157 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL }, /* Protocol Configuration Options Optional 7.7.31 */
2158 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2159 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2160 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL }, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2161 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL }, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2162 { GTP_EXT_QOS_UMTS, GTP_CONDITIONAL },
2163 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
2164 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL }, /* Alternative Charging Gateway Address Optional 7.7.44 */
2165 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2166 { GTP_EXT_COMMON_FLGS, GTP_OPTIONAL }, /* Common Flags Optional 7.7.48 */
2167 { GTP_EXT_APN_RES, GTP_OPTIONAL }, /* APN Restriction Optional 7.7.49 */
2172 GTP_MSG_DELETE_PDP_REQ, {
2173 { GTP_EXT_TEAR_IND, GTP_CONDITIONAL },
2174 { GTP_EXT_NSAPI, GTP_MANDATORY },
2175 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL }, /* Protocol Configuration Options Optional 7.7.31 */
2176 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2181 GTP_MSG_DELETE_PDP_RESP, {
2182 { GTP_EXT_CAUSE, GTP_MANDATORY },
2183 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL }, /* Protocol Configuration Options Optional 7.7.31 */
2184 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2190 { GTP_EXT_TEID, GTP_MANDATORY },
2191 { GTP_EXT_GSN_ADDR, GTP_MANDATORY }, /* GSN Address Mandatory 7.7.32 */
2192 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2197 GTP_MSG_PDU_NOTIFY_REQ, {
2198 { GTP_EXT_IMSI, GTP_MANDATORY },
2199 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2200 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
2201 { GTP_EXT_APN, GTP_MANDATORY },
2202 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL }, /* Protocol Configuration Options Optional 7.7.31 */
2203 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2204 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2209 GTP_MSG_PDU_NOTIFY_RESP, {
2210 { GTP_EXT_CAUSE, GTP_MANDATORY },
2211 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2216 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2217 { GTP_EXT_CAUSE, GTP_MANDATORY },
2218 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2219 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
2220 { GTP_EXT_APN, GTP_MANDATORY },
2221 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL }, /* Protocol Configuration Options Optional 7.7.31 */
2222 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2227 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2228 { GTP_EXT_CAUSE, GTP_MANDATORY },
2229 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2233 /* 7.4 Location Management Messages */
2235 GTP_MSG_SEND_ROUT_INFO_REQ, {
2236 { GTP_EXT_IMSI, GTP_MANDATORY },
2237 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2242 GTP_MSG_SEND_ROUT_INFO_RESP, {
2243 { GTP_EXT_CAUSE, GTP_MANDATORY },
2244 { GTP_EXT_IMSI, GTP_MANDATORY },
2245 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
2246 { GTPv1_EXT_MS_REASON, GTP_OPTIONAL },
2247 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL },
2248 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2253 GTP_MSG_FAIL_REP_REQ, {
2254 { GTP_EXT_IMSI, GTP_MANDATORY },
2255 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2260 GTP_MSG_FAIL_REP_RESP, {
2261 { GTP_EXT_CAUSE, GTP_MANDATORY },
2262 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
2263 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2268 GTP_MSG_MS_PRESENT_REQ, {
2269 { GTP_EXT_IMSI, GTP_MANDATORY },
2270 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2271 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2276 GTP_MSG_MS_PRESENT_RESP, {
2277 { GTP_EXT_CAUSE, GTP_MANDATORY },
2278 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2282 /* 7.5 Mobility Management Messages */
2284 GTP_MSG_IDENT_REQ, {
2285 { GTP_EXT_RAI, GTP_MANDATORY },
2286 { GTP_EXT_PTMSI, GTP_MANDATORY },
2287 { GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL },
2288 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL }, /* SGSN Address for Control Plane Optional 7.7.32 */
2289 { GTP_EXT_HOP_COUNT, GTP_OPTIONAL }, /* Hop Counter Optional 7.7.63 */
2290 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2295 GTP_MSG_IDENT_RESP, {
2296 { GTP_EXT_CAUSE, GTP_MANDATORY },
2297 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2298 { GTP_EXT_AUTH_TRI, GTP_CONDITIONAL },
2299 { GTP_EXT_AUTH_QUI, GTP_CONDITIONAL },
2300 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2305 GTP_MSG_SGSN_CNTXT_REQ, {
2306 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2307 { GTP_EXT_RAI, GTP_MANDATORY },
2308 { GTP_EXT_TLLI, GTP_CONDITIONAL },
2309 { GTP_EXT_PTMSI, GTP_CONDITIONAL },
2310 { GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL },
2311 { GTP_EXT_MS_VALID, GTP_OPTIONAL },
2312 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2313 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2314 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL }, /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
2315 { GTP_EXT_SSGN_NO, GTP_OPTIONAL }, /* SGSN Number Optional 7.7.47 */
2316 { GTP_EXT_HOP_COUNT, GTP_OPTIONAL }, /* Hop Counter Optional 7.7.63 */
2317 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2322 GTP_MSG_SGSN_CNTXT_RESP, {
2323 { GTP_EXT_CAUSE, GTP_MANDATORY },
2324 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2325 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2326 { GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL }, /* RAB Context Conditional 7.7.19 */
2327 { GTP_EXT_RP_SMS, GTP_OPTIONAL },
2328 { GTP_EXT_RP, GTP_OPTIONAL },
2329 { GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL },
2330 { GTP_EXT_CHRG_CHAR, GTP_OPTIONAL }, /* CharingCharacteristics Optional 7.7.23 */
2331 { GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL }, /* Radio Priority LCS Optional 7.7.25B */
2332 { GTP_EXT_MM_CNTXT, GTP_CONDITIONAL },
2333 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
2334 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2335 { GTP_EXT_PDP_CONT_PRIO,GTP_OPTIONAL }, /* PDP Context Prioritization Optional 7.7.45 */
2336 { GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL }, /* MBMS UE Context Optional 7.7.55 */
2337 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2342 GTP_MSG_SGSN_CNTXT_ACK, {
2343 { GTP_EXT_CAUSE, GTP_MANDATORY },
2344 { GTP_EXT_TEID_II, GTP_CONDITIONAL },
2345 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2346 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2351 GTP_MSG_FORW_RELOC_REQ, {
2352 { GTP_EXT_IMSI, GTP_MANDATORY },
2353 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2354 { GTP_EXT_RANAP_CAUSE, GTP_MANDATORY },
2355 { GTP_EXT_CHRG_CHAR, GTP_OPTIONAL }, /* CharingCharacteristics Optional 7.7.23 */
2356 { GTP_EXT_MM_CNTXT, GTP_MANDATORY },
2357 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
2358 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2359 { GTP_EXT_TARGET_ID, GTP_MANDATORY },
2360 { GTP_EXT_UTRAN_CONT, GTP_MANDATORY },
2361 { GTP_EXT_PDP_CONT_PRIO,GTP_OPTIONAL }, /* PDP Context Prioritization Optional 7.7.45 */
2362 { GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL }, /* MBMS UE Context Optional 7.7.55 */
2363 { GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL }, /* Selected PLMN ID Optional 7.7.64 */
2364 { GTP_EXT_PS_HO_REQ_CTX,GTP_OPTIONAL }, /* PS Handover Request Context Optional 7.7.71 */
2365 { GTP_EXT_BSS_CONT, GTP_OPTIONAL }, /* BSS Container Optional 7.7.72 */
2366 { GTP_EXT_CELL_ID, GTP_OPTIONAL }, /* Cell Identification Optional 7.7.73 */
2367 { GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL }, /* BSSGP Cause Optional 7.7.75 */
2368 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2369 { GTP_EXT_SSGN_NO, GTP_OPTIONAL },
2374 GTP_MSG_FORW_RELOC_RESP, {
2375 { GTP_EXT_CAUSE, GTP_MANDATORY },
2376 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2377 { GTP_EXT_TEID_II, GTP_CONDITIONAL }, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
2378 { GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL },
2379 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2380 { GTP_EXT_UTRAN_CONT, GTP_OPTIONAL },
2381 { GTP_EXT_RAB_SETUP, GTP_CONDITIONAL },
2382 { GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL }, /* Additional RAB Setup Information Conditional 7.7.45A */
2383 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2388 GTP_MSG_FORW_RELOC_COMP, {
2389 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2394 GTP_MSG_RELOC_CANCEL_REQ, {
2395 { GTP_EXT_IMSI, GTP_MANDATORY },
2396 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2401 GTP_MSG_RELOC_CANCEL_RESP, {
2402 { GTP_EXT_CAUSE, GTP_MANDATORY },
2403 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2408 GTP_MSG_FORW_RELOC_ACK, {
2409 { GTP_EXT_CAUSE, GTP_MANDATORY },
2410 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2415 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2416 { GTP_EXT_CAUSE, GTP_MANDATORY },
2417 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2422 GTP_MSG_FORW_SRNS_CNTXT, {
2423 { GTP_EXT_RAB_CNTXT, GTP_MANDATORY },
2424 { GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL }, /* Source RNC PDCP context info Optional 7.7.61 */
2425 { GTP_EXT_PDU_NO, GTP_OPTIONAL }, /* PDU Numbers Optional 7.7.74 */
2426 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2431 /* 7.5.14 RAN Information Management Messages */
2433 GTP_MSG_RAN_INFO_RELAY, {
2434 { GTP_EXT_RAN_TR_CONT, GTP_MANDATORY }, /* RAN Transparent Container Mandatory 7.7.43 */
2435 { GTP_EXT_RIM_RA, GTP_OPTIONAL }, /* RIM Routing Address Optional 7.7.57 */
2436 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2440 /* 7.5A MBMS Messages
2441 * 7.5A.1 UE Specific MBMS Messages
2444 GTP_MBMS_NOTIFY_REQ, {
2445 { GTP_EXT_IMSI, GTP_MANDATORY }, /* IMSI Mandatory 7.7.2 */
2446 { GTP_EXT_TEID_CP, GTP_MANDATORY }, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2447 { GTP_EXT_NSAPI, GTP_MANDATORY }, /* NSAPI Mandatory 7.7.17 */
2448 { GTP_EXT_USER_ADDR, GTP_MANDATORY }, /* End User Address Mandatory 7.7.27 */
2449 { GTP_EXT_APN, GTP_MANDATORY }, /* Access Point Name Mandatory 7.7.30 */
2450 { GTP_EXT_GSN_ADDR, GTP_MANDATORY }, /* GGSN Address for Control Plane Mandatory 7.7.32 */
2451 { GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL }, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2452 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2457 GTP_MBMS_NOTIFY_RES, {
2458 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2459 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2464 GTP_MBMS_NOTIFY_REJ_REQ, {
2465 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2466 { GTP_EXT_TEID_CP, GTP_MANDATORY }, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2467 { GTP_EXT_NSAPI, GTP_MANDATORY }, /* NSAPI Mandatory 7.7.17 */
2468 { GTP_EXT_USER_ADDR, GTP_MANDATORY }, /* End User Address Mandatory 7.7.27 */
2469 { GTP_EXT_APN, GTP_MANDATORY }, /* Access Point Name Mandatory 7.7.30 */
2470 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2475 GTP_MBMS_NOTIFY_REJ_RES, {
2476 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2477 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2482 GTP_CREATE_MBMS_CNTXT_REQ, {
2483 { GTP_EXT_IMSI, GTP_CONDITIONAL }, /* IMSI Conditional 7.7.2 */
2484 { GTP_EXT_RAI, GTP_MANDATORY }, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2485 { GTP_EXT_RECOVER, GTP_OPTIONAL }, /* Recovery Optional 7.7.11 */
2486 { GTP_EXT_SEL_MODE, GTP_CONDITIONAL }, /* Selection mode Conditional 7.7.12 */
2487 { GTP_EXT_TEID_CP, GTP_CONDITIONAL }, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2488 { GTP_EXT_TRACE_REF, GTP_OPTIONAL }, /* Trace Reference Optional 7.7.24 */
2489 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL }, /* Trace Type Optional 7.7.25 */
2490 { GTP_EXT_USER_ADDR, GTP_MANDATORY }, /* End User Address Mandatory 7.7.27 */
2491 { GTP_EXT_APN, GTP_MANDATORY }, /* Access Point Name Mandatory 7.7.30 */
2492 { GTP_EXT_GSN_ADDR, GTP_MANDATORY }, /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
2493 { GTP_EXT_MSISDN, GTP_CONDITIONAL }, /* MSISDN Conditional 7.7.33 */
2494 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL }, /* Trigger Id Optional 7.7.41 */
2495 { GTP_EXT_OMC_ID, GTP_OPTIONAL }, /* OMC Identity Optional 7.7.42 */
2496 { GTP_EXT_RAT_TYPE, GTP_OPTIONAL }, /* RAT Type Optional 7.7.50 */
2497 { GTP_EXT_USR_LOC_INF, GTP_OPTIONAL }, /* User Location Information Optional 7.7.51 */
2498 { GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL }, /* MS Time Zone Optional 7.7.52 */
2499 { GTP_EXT_IMEISV, GTP_OPTIONAL }, /* IMEI(SV) Optional 7.7.53 */
2500 { GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL }, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2501 { GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL }, /* Additonal Trace Info Optional 7.7.62 */
2502 { GTP_EXT_ENH_NSAPI, GTP_MANDATORY }, /* Enhanced NSAPI Mandatory 7.7.67 */
2503 { GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL }, /* Additional MBMS Trace Info Optional 7.7.68 */
2504 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2509 GTP_CREATE_MBMS_CNTXT_RES, {
2510 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2511 { GTP_EXT_RECOVER, GTP_OPTIONAL }, /* Recovery Optional 7.7.11 */
2512 { GTP_EXT_TEID_CP, GTP_CONDITIONAL }, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2513 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL }, /* Charging ID Conditional 7.7.26 */
2514 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2515 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2516 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL }, /* Charging Gateway Address Optional 7.7.44 */
2517 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL }, /* Alternative Charging Gateway Address Optional 7.7.44 */
2518 { GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL }, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2519 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2524 GTP_UPD_MBMS_CNTXT_REQ, {
2525 { GTP_EXT_IMSI, GTP_CONDITIONAL }, /* IMSI Conditional 7.7.2 */
2526 { GTP_EXT_RAI, GTP_MANDATORY }, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2527 { GTP_EXT_RECOVER, GTP_OPTIONAL }, /* Recovery Optional 7.7.11 */
2528 { GTP_EXT_TEID_CP, GTP_CONDITIONAL }, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2529 { GTP_EXT_TRACE_REF, GTP_OPTIONAL }, /* Trace Reference Optional 7.7.24 */
2530 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL }, /* Trace Type Optional 7.7.25 */
2531 { GTP_EXT_GSN_ADDR, GTP_MANDATORY }, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2532 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2533 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL }, /* Trigger Id Optional 7.7.41 */
2534 { GTP_EXT_OMC_ID, GTP_OPTIONAL }, /* OMC Identity Optional 7.7.42 */
2535 { GTP_EXT_RAT_TYPE, GTP_OPTIONAL }, /* RAT Type Optional 7.7.50 */
2536 { GTP_EXT_USR_LOC_INF, GTP_OPTIONAL }, /* User Location Information Optional 7.7.51 */
2537 { GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL }, /* MS Time Zone Optional 7.7.52 */
2538 { GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL }, /* Additional Trace Info Optional 7.7.62 */
2539 { GTP_EXT_ENH_NSAPI, GTP_MANDATORY }, /* Enhanced NSAPI Mandatory 7.7.67 */
2540 { GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL }, /* Additional MBMS Trace Info Optional 7.7.68 */
2541 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2546 GTP_UPD_MBMS_CNTXT_RES, {
2547 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2548 { GTP_EXT_RECOVER, GTP_OPTIONAL }, /* Recovery Optional 7.7.11 */
2549 { GTP_EXT_TEID_CP, GTP_MANDATORY }, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2550 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL }, /* Charging ID Conditional 7.7.26 */
2551 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2552 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2553 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL }, /* Charging Gateway Address Optional 7.7.44 */
2554 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL }, /* Alternative Charging Gateway Address Optional 7.7.44 */
2555 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2560 GTP_DEL_MBMS_CNTXT_REQ, {
2561 { GTP_EXT_IMSI, GTP_CONDITIONAL }, /* IMSI Conditional 7.7.2 */
2562 { GTP_EXT_TEID_CP, GTP_MANDATORY }, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2563 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL }, /* End User Address Conditional 7.7.27 */
2564 { GTP_EXT_APN, GTP_CONDITIONAL }, /* Access Point Name Conditional 7.7.30 */
2565 { GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL }, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2566 { GTP_EXT_ENH_NSAPI, GTP_MANDATORY }, /* Enhanced NSAPI Conditional 7.7.67 */
2567 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2572 GTP_DEL_MBMS_CNTXT_RES, {
2573 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2574 { GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL }, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2575 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2581 { GTP_EXT_USER_ADDR, GTP_MANDATORY }, /* End User Address Mandatory 7.7.27 */
2582 { GTP_EXT_APN, GTP_MANDATORY }, /* Access Point Name Mandatory 7.7.30 */
2583 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2589 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2590 { GTP_EXT_TMGI, GTP_MANDATORY }, /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
2591 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2596 GTP_MBMS_DE_REG_REQ, {
2597 { GTP_EXT_USER_ADDR, GTP_MANDATORY }, /* End User Address Mandatory 7.7.27 */
2598 { GTP_EXT_APN, GTP_MANDATORY }, /* Access Point Name Mandatory 7.7.30 */
2599 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2604 GTP_MBMS_DE_REG_RES, {
2605 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2606 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2611 GTP_MBMS_SES_START_REQ, {
2612 { GTP_EXT_RECOVER, GTP_OPTIONAL }, /* Recovery Optional 7.7.11 */
2613 { GTP_EXT_TEID_CP, GTP_CONDITIONAL }, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2614 { GTP_EXT_USER_ADDR, GTP_MANDATORY }, /* End User Address Mandatory 7.7.27 */
2615 { GTP_EXT_APN, GTP_MANDATORY }, /* Access Point Name Mandatory 7.7.30 */
2616 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2617 { GTP_EXT_QOS_UMTS, GTP_MANDATORY }, /* Quality of Service Profile Mandatory 7.7.34 */
2618 { GTP_EXT_COMMON_FLGS, GTP_OPTIONAL }, /* Common Flags Mandatory 7.7.48 */
2619 { GTP_EXT_TMGI, GTP_MANDATORY }, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
2620 { GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY }, /* MBMS Session Duration Mandatory 7.7.59 */
2621 { GTP_EXT_MBMS_SA, GTP_MANDATORY }, /* MBMS Service Area Mandatory 7.7.60 */
2622 { GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL }, /* MBMS Session Identifier Optional 7.7.65 */
2623 { GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY }, /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
2624 { GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL }, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
2625 { GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY }, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
2626 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2631 GTP_MBMS_SES_START_RES, {
2632 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2633 { GTP_EXT_RECOVER, GTP_OPTIONAL }, /* Recovery Optional 7.7.11 */
2634 { GTP_EXT_TEID, GTP_CONDITIONAL }, /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
2635 { GTP_EXT_TEID_CP, GTP_CONDITIONAL }, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2636 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2637 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL }, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
2638 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2643 GTP_MBMS_SES_STOP_REQ, {
2644 { GTP_EXT_USER_ADDR, GTP_MANDATORY }, /* End User Address Mandatory 7.7.27 */
2645 { GTP_EXT_APN, GTP_MANDATORY }, /* Access Point Name Mandatory 7.7.30 */
2646 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2651 GTP_MBMS_SES_STOP_RES, {
2652 { GTP_EXT_CAUSE, GTP_MANDATORY }, /* Cause Mandatory 7.7.1 */
2653 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL }, /* Private Extension Optional 7.7.46 */
2665 check_field_presence(guint8 message, guint8 field, int *position) {
2668 _gtp_mess_items *mess_items;
2670 switch(gtp_version) {
2672 mess_items = gprs_mess_items;
2675 mess_items = umts_mess_items;
2681 while (mess_items[i].code) {
2682 if (mess_items[i].code == message) {
2684 while (mess_items[i].fields[*position].code) {
2685 if (mess_items[i].fields[*position].code == field) {
2689 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
2690 return mess_items[i].fields[(*position)++].code;
2703 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2705 /* GPRS: 9.60 v7.6.0, chapter
2706 * UMTS: 29.060 v4.0, chapter
2709 decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2713 cause = tvb_get_guint8(tvb, offset+1);
2715 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
2720 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2721 * UMTS: 29.060 v4.0, chapter 7.7.2
2724 decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2729 tvb_memcpy(tvb, imsi_val, offset+1, 8);
2730 imsi_str = imsi_to_str (imsi_val);
2732 proto_tree_add_string (tree, hf_gtp_imsi, tvb, offset, 9, imsi_str);
2737 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2738 * UMTS: 29.060 v4.0, chapter 7.7.3
2741 decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2743 proto_tree *ext_tree_rai;
2748 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));
2749 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2751 byte[0] = tvb_get_guint8 (tvb, offset + 1);
2752 byte[1] = tvb_get_guint8 (tvb, offset + 2);
2753 byte[2] = tvb_get_guint8 (tvb, offset + 3);
2754 mcc = (byte[0] & 0x0F) * 100 + ((byte[0] & 0xF0) >> 4) * 10 + (byte[1] & 0x0F );
2755 if ((byte[1] & 0xF0) == 0xF0)
2756 mnc = (byte[2] & 0x0F) * 10 + ((byte[2] & 0xF0) >> 4);
2758 mnc = (byte[2] & 0x0F) * 100 + ((byte[2] & 0xF0) >> 4 ) * 10 + ((byte[1] & 0xF0) >> 4);
2760 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mcc, tvb, offset+1, 2, mcc);
2761 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mnc, tvb, offset+2, 2, mnc);
2762 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_lac, tvb, offset+4, 2, tvb_get_ntohs (tvb, offset+4));
2763 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_rac, tvb, offset+6, 1, tvb_get_guint8 (tvb, offset+6));
2768 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2769 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2772 decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2776 tlli = tvb_get_ntohl(tvb, offset+1);
2777 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
2782 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
2783 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
2786 decode_gtp_ptmsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2790 ptmsi = tvb_get_ntohl (tvb, offset+1);
2791 proto_tree_add_uint (tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
2796 /* adjust - how many bytes before offset should be highlighted
2799 decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, const gchar* qos_str, guint8 adjust) {
2801 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
2802 proto_tree *ext_tree_qos;
2805 spare1 = tvb_get_guint8(tvb, offset) & 0xC0;
2806 delay = tvb_get_guint8(tvb, offset) & 0x38;
2807 reliability = tvb_get_guint8(tvb, offset) & 0x07;
2808 peak = tvb_get_guint8(tvb, offset+1) & 0xF0;
2809 spare2 = tvb_get_guint8(tvb, offset+1) & 0x08;
2810 precedence = tvb_get_guint8(tvb, offset+1) & 0x07;
2811 spare3 = tvb_get_guint8(tvb, offset+2) & 0xE0;
2812 mean = tvb_get_guint8(tvb, offset+2) & 0x1F;
2814 te = proto_tree_add_text(tree, tvb, offset-adjust, 3+adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
2815 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
2816 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
2819 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
2820 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
2821 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
2822 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset+1, 1, peak);
2823 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset+1, 1, spare2);
2824 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset+1, 1, precedence);
2825 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset+2, 1, spare3);
2826 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset+2, 1, mean);
2832 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
2836 * TODO: check if length is included: ETSI 4.08 vs 9.60
2839 decode_gtp_qos_gprs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2841 return (1+decode_qos_gprs(tvb, offset+1, tree, "Quality of Service", 1));
2845 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
2846 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
2849 decode_gtp_reorder(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2853 reorder = tvb_get_guint8(tvb, offset+1) & 0x01;
2854 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
2859 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
2860 * 4.08 v7.1.2, chapter 10.5.3.1+
2861 * UMTS: 29.060 v4.0, chapter 7.7.7
2862 * TODO: Add blurb support by registering items in the protocol registration
2865 decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2867 proto_tree *ext_tree_auth_tri;
2870 te = proto_tree_add_text(tree, tvb, offset, 29, val_to_str(GTP_EXT_AUTH_TRI, gtp_val, "Unknown message"));
2871 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
2873 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+1, 16));
2874 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset+17, 4));
2875 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset+21, 8));
2880 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
2881 * 9.02 v7.7.0, page 1090
2882 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
2883 * 29.002 v4.2.1, chapter 17.5, page 268
2886 decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2890 map_cause = tvb_get_guint8(tvb, offset+1);
2891 proto_tree_add_uint (tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
2896 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
2897 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
2900 decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2904 ptmsi_sig = tvb_get_ntoh24(tvb, offset+1);
2905 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
2910 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
2911 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
2914 decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2918 ms_valid = tvb_get_guint8(tvb, offset+1) & 0x01;
2919 proto_tree_add_boolean (tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
2924 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
2925 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
2928 decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2932 recovery = tvb_get_guint8(tvb, offset+1);
2933 proto_tree_add_uint (tree, hf_gtp_recovery, tvb, offset, 2, recovery);
2938 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
2939 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
2942 decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2946 sel_mode = tvb_get_guint8(tvb, offset+1) & 0x03;
2947 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, offset, 2, sel_mode);
2952 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
2953 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
2956 decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2958 guint16 ext_flow_label;
2961 switch (gtp_version) {
2963 ext_flow_label = tvb_get_ntohs(tvb, offset+1);
2964 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
2968 teid_data = tvb_get_ntohl(tvb, offset+1);
2969 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
2973 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
2979 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
2980 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
2983 decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2988 switch (gtp_version) {
2990 flow_sig = tvb_get_ntohs(tvb, offset+1);
2991 proto_tree_add_uint (tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
2994 teid_cp = tvb_get_ntohl(tvb, offset+1);
2995 proto_tree_add_uint (tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
2998 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
3003 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
3004 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
3007 decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3011 proto_tree *ext_tree_flow_ii;
3014 switch (gtp_version) {
3016 te = proto_tree_add_text(tree, tvb, offset, 4, val_to_str(GTP_EXT_FLOW_II, gtp_val, "Unknown message"));
3017 ext_tree_flow_ii = proto_item_add_subtree (te, ett_gtp_flow_ii);
3019 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
3021 flow_ii = tvb_get_ntohs(tvb, offset+2);
3022 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset+2, 2, flow_ii);
3026 te = proto_tree_add_text (tree, tvb, offset, 6, val_to_str(GTP_EXT_TEID_II, gtpv1_val, "Unknown message"));
3027 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3029 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
3032 teid_ii = tvb_get_ntohl(tvb, offset+2);
3033 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset+2, 4, teid_ii);
3037 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
3043 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
3044 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
3045 * Check if all ms_reason types are included
3048 decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3052 field19 = tvb_get_guint8(tvb, offset+1);
3054 switch (gtp_version) {
3056 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
3059 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
3062 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
3069 /* GPRS: not present
3070 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
3073 decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3077 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
3078 proto_tree_add_uint(tree, hf_gtp_nsapi, tvb, offset, 2, nsapi);
3083 /* GPRS: not present
3084 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
3087 decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3091 ranap = tvb_get_guint8(tvb, offset+1);
3093 if(ranap > 0 && ranap <=64)
3094 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3095 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
3096 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3097 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3099 if(ranap > 64 && ranap <=80)
3100 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3101 ranap, "%s (Transport Layer Cause) : %s (%u)",
3102 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3103 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3105 if(ranap > 80 && ranap <=96)
3106 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3107 ranap, "%s (NAS Cause) : %s (%u)",
3108 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3109 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3111 if(ranap > 96 && ranap <=112)
3112 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3113 "%s (Protocol Cause) : %s (%u)",
3114 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3115 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3117 if(ranap > 112 && ranap <=128)
3118 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3119 "%s (Miscellaneous Cause) : %s (%u)",
3120 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3121 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3123 if(ranap > 128 /* && ranap <=255 */)
3124 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3125 "%s (Non-standard Cause) : %s (%u)",
3126 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
3127 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
3132 /* GPRS: not present
3133 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
3136 decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3139 proto_tree *ext_tree_rab_cntxt;
3142 te = proto_tree_add_text(tree, tvb, offset, 10, val_to_str(GTP_EXT_RAB_CNTXT, gtp_val, "Unknown message"));
3143 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
3145 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
3147 proto_tree_add_uint (ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset+1, 1, nsapi);
3148 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset+2, 2, FALSE);
3149 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset+4, 2, FALSE);
3150 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset+6, 2, FALSE);
3151 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset+8, 2, FALSE);
3157 /* GPRS: not present
3158 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
3161 decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3165 rp_sms = tvb_get_guint8(tvb, offset+1) & 0x07;
3166 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
3171 /* GPRS: not present
3172 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
3175 decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3177 proto_tree *ext_tree_rp;
3179 guint8 nsapi, rp, spare;
3181 nsapi = tvb_get_guint8(tvb, offset+1) & 0xF0;
3182 spare = tvb_get_guint8(tvb, offset+1) & 0x08;
3183 rp = tvb_get_guint8(tvb, offset+1) & 0x07;
3185 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
3186 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
3188 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset+1, 1, nsapi);
3189 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset+1, 1, spare);
3190 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset+1, 1, rp);
3195 /* GPRS: not present
3196 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
3199 decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3201 proto_tree *ext_tree_pkt_flow_id;
3203 guint8 nsapi, pkt_flow_id;
3205 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
3206 pkt_flow_id = tvb_get_guint8(tvb, offset+2);
3208 te = proto_tree_add_uint_format (tree, hf_gtp_pkt_flow_id, tvb, offset,
3209 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi,
3211 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
3213 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset+1, 1, nsapi);
3214 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
3215 offset+2, 1, pkt_flow_id, "%s : %u",
3216 val_to_str(GTP_EXT_PKT_FLOW_ID, gtp_val, "Unknown message"),
3222 /* GPRS: not present
3223 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
3224 * TODO: Differenciate these uints?
3227 decode_gtp_chrg_char(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3231 proto_tree *ext_tree_chrg_char;
3233 chrg_char = tvb_get_ntohs(tvb, offset+1);
3235 te = proto_tree_add_uint (tree, hf_gtp_chrg_char, tvb, offset, 3, chrg_char);
3236 /*"%s: %x", val_to_str (GTP_EXT_CHRG_CHAR, gtp_val, "Unknown message"), chrg_char);*/
3237 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
3239 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_s, tvb, offset+1, 2, chrg_char);
3240 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_n, tvb, offset+1, 2, chrg_char);
3241 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_p, tvb, offset+1, 2, chrg_char);
3242 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_f, tvb, offset+1, 2, chrg_char);
3243 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_h, tvb, offset+1, 2, chrg_char);
3244 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_r, tvb, offset+1, 2, chrg_char);
3249 /* GPRS: not present
3250 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3253 decode_gtp_trace_ref(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3257 trace_ref = tvb_get_ntohs(tvb, offset+1);
3259 proto_tree_add_uint (tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
3264 /* GPRS: not present
3265 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3268 decode_gtp_trace_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3272 trace_type = tvb_get_ntohs(tvb, offset+1);
3274 proto_tree_add_uint (tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
3279 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3280 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3283 decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3287 reason = tvb_get_guint8(tvb, offset+1);
3289 proto_tree_add_uint (tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
3295 * UMTS: 29.060 v6.11.0, chapter 7.7.25B
3296 * Radio Priority LCS
3299 decode_gtp_ra_prio_lcs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3302 proto_tree *ext_tree;
3305 length = tvb_get_ntohs(tvb, offset+1);
3306 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_RA_PRIO_LCS, gtp_val, "Unknown"));
3307 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ra_prio_lcs);
3310 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
3312 /* TODO add decoding of data */
3313 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
3319 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
3323 decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3327 tr_command = tvb_get_guint8(tvb, offset+1);
3329 proto_tree_add_uint (tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
3334 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3335 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3338 decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3342 chrg_id = tvb_get_ntohl(tvb, offset+1);
3343 proto_tree_add_uint (tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
3348 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3349 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3352 decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3355 guint8 pdp_typ, pdp_org;
3357 struct e_in6_addr addr_ipv6;
3358 proto_tree *ext_tree_user;
3362 length = tvb_get_ntohs(tvb, offset+1);
3363 pdp_org = tvb_get_guint8(tvb, offset+3) & 0x0F;
3364 pdp_typ = tvb_get_guint8(tvb, offset+4);
3366 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s (%s/%s)",
3367 val_to_str(GTP_EXT_USER_ADDR, gtp_val, "Unknown message"),
3368 val_to_str(pdp_org, pdp_org_type, "Unknown PDP Organization"),
3369 val_to_str(pdp_typ, pdp_type, "Unknown PDP Type"));
3370 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3372 proto_tree_add_text(ext_tree_user, tvb, offset+1, 2, "Length : %u", length);
3373 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset+3, 1, pdp_org);
3374 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset+4, 1, pdp_typ);
3377 if (pdp_org == 0 && pdp_typ == 1)
3378 proto_item_append_text(te, " (Point to Point Protocol)");
3379 else if (pdp_typ == 2)
3380 proto_item_append_text(te, " (Octet Stream Protocol)");
3381 } else if (length > 2) {
3384 addr_ipv4 = tvb_get_ipv4(tvb, offset+5);
3385 proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset+5, 4, addr_ipv4);
3386 proto_item_append_text(te, " : %s", ip_to_str((guint8 *)&addr_ipv4));
3389 tvb_get_ipv6(tvb, offset+5, &addr_ipv6);
3390 proto_tree_add_ipv6 (ext_tree_user, hf_gtp_user_ipv6, tvb, offset+5, 16, (guint8 *)&addr_ipv6);
3391 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3395 proto_item_append_text(te, " : empty PDP Address");
3401 decode_triplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
3403 proto_tree *ext_tree_trip;
3404 proto_item *te_trip;
3407 for (i=0;i<count;i++) {
3408 te_trip = proto_tree_add_text(tree, tvb, offset+i*28, 28, "Triplet no%x", i);
3409 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3411 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+i*28, 16));
3412 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));
3413 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));
3419 /* adjust - how many bytes before quintuplet should be highlighted
3422 decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
3424 proto_tree *ext_tree_quint;
3425 proto_item *te_quint;
3426 guint16 q_offset, i;
3427 guint8 xres_len, auth_len;
3431 for (i=0;i<count;i++) {
3433 te_quint = proto_tree_add_text(tree, tvb, offset, -1, "Quintuplet #%x", i+1);
3434 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3437 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
3438 q_offset = q_offset + 16;
3439 xres_len = tvb_get_guint8(tvb, offset+q_offset);
3440 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "XRES length: %u", xres_len);
3442 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));
3443 q_offset = q_offset + xres_len;
3444 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));
3445 q_offset = q_offset + 16;
3446 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));
3447 q_offset = q_offset +16;
3448 auth_len = tvb_get_guint8(tvb, offset + q_offset);
3449 proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "Authentication length: %u", auth_len);
3451 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));
3453 q_offset = q_offset+auth_len;
3454 proto_item_set_end(te_quint, tvb, offset+q_offset);
3461 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3462 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3463 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3464 * - finish displaying last 3 parameters
3467 decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3469 guint16 length, quint_len, con_len;
3470 guint8 cksn, count, sec_mode, len;
3471 proto_tree *ext_tree_mm;
3473 proto_item *tf = NULL;
3474 proto_tree *tf_tree = NULL;
3478 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_MM_CNTXT, gtp_val, "Unknown message"));
3479 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3482 length = tvb_get_ntohs(tvb, offset+1);
3483 if (length < 1) return 3;
3486 cksn = tvb_get_guint8(tvb, offset+3) & 0x07;
3488 sec_mode = (tvb_get_guint8(tvb, offset+4) >> 6) & 0x03;
3489 count = (tvb_get_guint8(tvb, offset+4) >> 3) & 0x07;
3491 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 2, "Length: %x", length);
3492 if (gtp_version == 0)
3497 case 0: /* Used cipher value, UMTS keys and Quintuplets */
3498 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset+3, 1, FALSE);
3499 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset+4, 1, FALSE);
3500 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset+4, 1, FALSE);
3501 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset+4, 1, FALSE);
3502 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset+5, 16));
3503 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset+21, 16));
3504 quint_len = tvb_get_ntohs(tvb, offset+37);
3505 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3507 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count) + 39;
3511 case 1: /* GSM key and triplets */
3512 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset+3, 1, FALSE);
3513 if (gtp_version != 0)
3514 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset+4, 1, FALSE);
3516 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset+4, 1, FALSE);
3517 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset+4, 1, FALSE);
3518 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset+5, 8));
3520 offset = offset + decode_triplet(tvb, offset+13, ext_tree_mm, count) + 13;
3523 case 2: /* UMTS key and quintuplets */
3524 proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset+3, 1, FALSE);
3525 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset+4, 1, FALSE);
3526 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset+4, 1, FALSE);
3527 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset+5, 16));
3528 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset+21, 16));
3529 quint_len = tvb_get_ntohs(tvb, offset+37);
3530 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3532 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count) + 39;
3535 case 3: /* GSM key and quintuplets */
3536 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset+3, 1, FALSE);
3537 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset+4, 1, FALSE);
3538 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset+4, 1, FALSE);
3539 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset+4, 1, FALSE);
3540 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset+5, 8));
3541 quint_len = tvb_get_ntohs(tvb, offset+13);
3542 proto_tree_add_text(ext_tree_mm, tvb, offset+13, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
3544 offset = offset + decode_quintuplet(tvb, offset+15, ext_tree_mm, count) + 15;
3552 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
3554 de_gmm_drx_param(tvb, ext_tree_mm, offset, 2, NULL, 0);
3557 len = tvb_get_guint8(tvb, offset);
3558 tf = proto_tree_add_text(ext_tree_mm,
3560 "MS Network Capability");
3562 tf_tree = proto_item_add_subtree(tf, ett_gtp_net_cap);
3564 proto_tree_add_text(tf_tree, tvb, offset, 1, "Length of MS network capability contents: %u", len);
3568 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
3570 de_gmm_ms_net_cap(tvb, tf_tree, offset, len, NULL, 0);
3571 offset = offset +len;
3573 /* Container contains one or several optional information elements as described in the clause 'Overview',
3574 * from the clause 'General message format and information elements coding' in 3GPP TS 24.008.
3575 * The IMEISV shall, if available, be included in the Container.
3578 con_len = tvb_get_ntohs(tvb, offset);
3579 proto_tree_add_text(ext_tree_mm, tvb, offset, 2, "Container length: %u", con_len);
3580 offset = offset + 2;
3584 l3_tvb = tvb_new_subset(tvb, offset,con_len, con_len );
3585 if (!dissector_try_port(bssap_pdu_type_table,BSSAP_PDU_TYPE_DTAP, l3_tvb, pinfo, ext_tree_mm))
3586 call_dissector(data_handle, l3_tvb, pinfo, ext_tree_mm);
3592 /* Function to extract the value of an hexadecimal octet. Only the lower
3593 * nybble will be non-zero in the output.
3595 static guint8 hex2dec (guint8 x)
3597 if ((x >= 'a') && (x <= 'f'))
3599 else if ((x >= 'A') && (x <= 'F'))
3601 else if ((x >= '0') && (x <= '9'))
3608 /* Wrapper function to add UTF-8 decoding for QoS attributes in
3611 static guint8 wrapped_tvb_get_guint8( tvbuff_t *tvb, int offset, int type)
3614 return (hex2dec(tvb_get_guint8(tvb, offset)) << 4
3615 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
3617 return tvb_get_guint8(tvb, offset);
3620 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3621 * so type means length of length :-)
3623 * WARNING :) type does not mean length of length any more... see below for
3627 decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, const gchar* qos_str, guint8 type) {
3630 guint8 al_ret_priority;
3631 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3632 guint8 traf_class, del_order, del_err_sdu;
3633 guint8 max_sdu_size, max_ul, max_dl;
3634 guint8 res_ber, sdu_err_ratio;
3635 guint8 trans_delay, traf_handl_prio;
3636 guint8 guar_ul, guar_dl;
3637 proto_tree *ext_tree_qos;
3639 int mss, mu, md, gu, gd;
3641 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
3642 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
3643 * to one byte to be dissected).
3644 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
3645 * corresponds to one byte to be dissected)
3647 guint8 utf8_type = 1;
3649 /* In RADIUS messages the QoS has a version field of two octets prepended.
3650 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
3651 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
3652 * inconsistent and unuseful, I will check hyphen presence here and
3653 * will signal its presence.
3657 /* Will keep the value that will be returned
3663 length = tvb_get_guint8 (tvb, offset);
3664 te = proto_tree_add_text (tree, tvb, offset, length + 1, "%s", qos_str);
3665 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3666 proto_tree_add_text (ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3668 retval = length + 1;
3671 length = tvb_get_ntohs (tvb, offset + 1);
3672 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3673 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3674 proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3675 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
3676 retval = length + 3;
3679 /* For QoS inside RADIUS Client messages from GGSN */
3682 /* The field in the RADIUS message is the length of the tvb we were given */
3683 length = tvb_length(tvb);
3684 te = proto_tree_add_text (tree, tvb, offset, length, "%s", qos_str);
3686 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3688 proto_tree_add_item (ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, FALSE);
3690 /* Hyphen handling */
3691 hyphen = tvb_get_guint8(tvb, offset + 2);
3692 if (hyphen == ((guint8) '-'))
3694 /* Hyphen is present, put in protocol tree */
3695 proto_tree_add_text (ext_tree_qos, tvb, offset + 2, 1, "Hyphen separator: -");
3696 offset++; /* "Get rid" of hyphen */
3699 /* Now, we modify offset here and in order to use type later
3706 retval = length + 2; /* Actually, will be ignored. */
3709 /* XXX - what should we do with the length here? */
3712 ext_tree_qos = NULL;
3716 /* In RADIUS messages there is no allocation-retention priority
3717 * so I don't need to wrap the following call to tvb_get_guint8
3719 al_ret_priority = tvb_get_guint8 (tvb, offset);
3721 /* All calls are wrapped to take into account the possibility that the
3722 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
3723 * of the offset will be the same as in the previous version of this
3724 * dissector, and the wrapped function will serve as a dumb wrapper;
3725 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
3726 * two bytes for needed shift, and the wrapped function will unencode
3727 * two values from the input.
3729 spare1 = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0xC0;
3730 delay = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x38;
3731 reliability = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x07;
3732 peak = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3733 spare2 = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x08;
3734 precedence = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x07;
3735 spare3 = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3736 mean = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0x1F;
3738 /* In RADIUS messages there is no allocation-retention priority */
3740 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3742 /* All additions must take care of the fact that QoS fields in RADIUS
3743 * messages are UTF-8 encoded, so we have to use the same trick as above.
3745 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, spare1);
3746 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, delay);
3747 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, reliability);
3748 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, peak);
3749 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, spare2);
3750 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, precedence);
3751 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, spare3);
3752 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, mean);
3756 /* See above for the need of wrapping
3758 traf_class = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3759 del_order = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x18;
3760 del_err_sdu = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x07;
3761 max_sdu_size = wrapped_tvb_get_guint8(tvb, offset+(5 - 1) * utf8_type + 1, utf8_type);
3762 max_ul = wrapped_tvb_get_guint8(tvb, offset+(6 - 1) * utf8_type + 1, utf8_type);
3763 max_dl = wrapped_tvb_get_guint8(tvb, offset+(7 - 1) * utf8_type + 1, utf8_type);
3764 res_ber = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3765 sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0x0F;
3766 trans_delay = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0xFC;
3767 traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0x03;
3768 guar_ul = wrapped_tvb_get_guint8(tvb, offset+(10 - 1) * utf8_type + 1, utf8_type);
3769 guar_dl = wrapped_tvb_get_guint8(tvb, offset+(11 - 1) * utf8_type + 1, utf8_type);
3771 /* See above comments for the changes
3773 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, traf_class);
3774 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, del_order);
3775 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);
3776 if (max_sdu_size == 0 || max_sdu_size > 150)
3777 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);
3778 if (max_sdu_size > 0 && max_sdu_size <= 150) {
3779 mss = max_sdu_size*10;
3780 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset+(5 - 1) * utf8_type + 1, utf8_type, mss, "Maximum SDU size : %u octets", mss);
3783 if(max_ul == 0 || max_ul == 255)
3784 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul);
3785 if(max_ul > 0 && max_ul <= 63)
3786 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul, "Maximum bit rate for uplink : %u kbps", max_ul);
3787 if(max_ul > 63 && max_ul <=127) {
3788 mu = 64 + ( max_ul - 64 ) * 8;
3789 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
3792 if(max_ul > 127 && max_ul <=254) {
3793 mu = 576 + ( max_ul - 128 ) * 64;
3794 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
3797 if(max_dl == 0 || max_dl == 255)
3798 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl);
3799 if(max_dl > 0 && max_dl <= 63)
3800 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl, "Maximum bit rate for downlink : %u kbps", max_dl);
3801 if(max_dl > 63 && max_dl <=127) {
3802 md = 64 + ( max_dl - 64 ) * 8;
3803 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
3805 if(max_dl > 127 && max_dl <=254) {
3806 md = 576 + ( max_dl - 128 ) * 64;
3807 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
3810 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset+(8 - 1) * utf8_type + 1, utf8_type, res_ber);
3811 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);
3812 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset+(9 - 1) * utf8_type + 1, utf8_type, trans_delay);
3813 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);
3815 if(guar_ul == 0 || guar_ul == 255)
3816 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul);
3817 if(guar_ul > 0 && guar_ul <= 63)
3818 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul, "Guaranteed bit rate for uplink : %u kbps", guar_ul);
3819 if(guar_ul > 63 && guar_ul <=127) {
3820 gu = 64 + ( guar_ul - 64 ) * 8;
3821 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3823 if(guar_ul > 127 && guar_ul <=254) {
3824 gu = 576 + ( guar_ul - 128 ) * 64;
3825 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3828 if(guar_dl == 0 || guar_dl == 255)
3829 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl);
3830 if(guar_dl > 0 && guar_dl <= 63)
3831 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl, "Guaranteed bit rate for downlink : %u kbps", guar_dl);
3832 if(guar_dl > 63 && guar_dl <=127) {
3833 gd = 64 + ( guar_dl - 64 ) * 8;
3834 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3836 if(guar_dl > 127 && guar_dl <=254) {
3837 gd = 576 + ( guar_dl - 128 ) * 64;
3838 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3846 static const gchar* dissect_radius_qos_umts(proto_tree *tree, tvbuff_t *tvb) {
3847 decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
3848 return tvb_get_ephemeral_string(tvb,0,tvb_length(tvb));
3852 decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) {
3858 name_len = tvb_get_guint8 (tvb, offset);
3860 if (name_len < 0x20) {
3861 apn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
3863 if (name_len >= length - 1) break;
3865 name_len = name_len + apn[tmp] + 1;
3869 apn = tvb_get_ephemeral_string(tvb, offset, length);
3871 proto_tree_add_string (tree, hf_gtp_apn, tvb, offset, length, apn);
3875 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
3876 * UMTS: 29.060 v4.0, chapter 7.7.29
3877 * TODO: unify addr functions
3880 decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3882 guint8 ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id,
3883 pdp_type_org, pdp_type_num, pdp_addr_len;
3884 guint16 length, sn_down, sn_up, up_flow;
3886 struct e_in6_addr addr_ipv6;
3887 proto_tree *ext_tree_pdp;
3890 length = tvb_get_ntohs(tvb, offset+1);
3892 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_PDP_CNTXT, gtp_val, "Unknown message"));
3893 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
3895 vaa = (tvb_get_guint8(tvb, offset+3) >> 6) & 0x01;
3896 order = (tvb_get_guint8(tvb, offset+3) >> 4) & 0x01;
3897 nsapi = tvb_get_guint8(tvb, offset+3) & 0x0F;
3898 sapi = tvb_get_guint8(tvb, offset+4) & 0x0F;
3900 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "VPLMN address allowed: %s", yesno[vaa]);
3901 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "Reordering required: %s", yesno[order]);
3902 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "NSAPI: %u", nsapi);
3903 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "SAPI: %u", sapi);
3905 switch (gtp_version) {
3907 decode_qos_gprs(tvb, offset+5, ext_tree_pdp, "QoS subscribed", 0);
3908 decode_qos_gprs(tvb, offset+8, ext_tree_pdp, "QoS requested", 0);
3909 decode_qos_gprs(tvb, offset+11, ext_tree_pdp, "QoS negotiated", 0);
3910 offset = offset + 14;
3913 offset = offset + 5;
3914 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
3915 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
3916 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
3922 sn_down = tvb_get_ntohs(tvb, offset);
3923 sn_up = tvb_get_ntohs(tvb, offset+2);
3924 pdu_send_no = tvb_get_guint8(tvb, offset+4);
3925 pdu_rec_no = tvb_get_guint8(tvb, offset+5);
3927 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
3928 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 2, "Sequence number up: %u", sn_up);
3929 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "Send N-PDU number: %u", pdu_send_no);
3930 proto_tree_add_text(ext_tree_pdp, tvb, offset+5, 1, "Receive N-PDU number: %u", pdu_rec_no);
3932 switch (gtp_version) {
3934 up_flow = tvb_get_ntohs(tvb, offset+6);
3935 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 2, "Uplink flow label signalling: %u", up_flow);
3936 offset = offset + 8;
3939 pdp_cntxt_id = tvb_get_guint8(tvb, offset+14);
3940 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_cp, tvb, offset+6, 4, FALSE);
3941 proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_data, tvb, offset+10, 4, FALSE);
3942 proto_tree_add_text(ext_tree_pdp, tvb, offset+14, 1, "PDP context identifier: %u", pdp_cntxt_id);
3943 offset = offset + 15;
3949 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
3950 pdp_type_num = tvb_get_guint8(tvb, offset+1);
3951 pdp_addr_len = tvb_get_guint8(tvb, offset+2);
3953 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP org"));
3954 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"));
3955 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 1, "PDP address length: %u", pdp_addr_len);
3957 if (pdp_addr_len > 0) {
3958 switch (pdp_type_num) {
3960 addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
3961 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 4, "PDP address: %s", ip_to_str((guint8 *)&addr_ipv4));
3964 tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
3965 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3972 offset = offset + 3 + pdp_addr_len;
3974 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3975 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
3977 switch (ggsn_addr_len) {
3979 addr_ipv4 = tvb_get_ipv4(tvb, offset+1);
3980 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN Address for control plane: %s", ip_to_str((guint8 *)&addr_ipv4));
3983 tvb_get_ipv6(tvb, offset+1, &addr_ipv6);
3984 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));
3990 offset = offset + 1 + ggsn_addr_len;
3992 if (gtp_version == 1) {
3994 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3995 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
3997 switch (ggsn_addr_len) {
3999 addr_ipv4 = tvb_get_ipv4(tvb, offset+1);
4000 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
4003 tvb_get_ipv6(tvb, offset+1, &addr_ipv6);
4004 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4009 offset = offset + 1 + ggsn_addr_len;
4013 apn_len = tvb_get_guint8(tvb, offset);
4014 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
4015 decode_apn(tvb, offset+1, apn_len, ext_tree_pdp);
4017 offset = offset + 1 + apn_len;
4019 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
4020 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
4021 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
4022 * MS is stored in the PDP context IE.
4023 * 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
4024 * octet in this field.
4026 trans_id = tvb_get_guint8(tvb, offset);
4027 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Transaction identifier: %u", trans_id);
4032 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
4033 * UMTS: 29.060, v4.0, chapter 7.7.30
4036 decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4039 proto_tree *ext_tree_apn;
4042 length = tvb_get_ntohs(tvb, offset+1);
4044 te = proto_tree_add_text (tree, tvb, offset, length+3, val_to_str(GTP_EXT_APN, gtp_val, "Unknown field"));
4045 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
4047 proto_tree_add_text (ext_tree_apn, tvb, offset+1, 2, "APN length : %u", length);
4048 decode_apn (tvb, offset+3, length, ext_tree_apn);
4053 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
4054 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
4055 * UMTS: 29.060 v4.0, chapter 7.7.31
4056 * 24.008, v4.2, chapter 10.5.6.3
4059 decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4061 guint16 length, proto_offset;
4063 guint8 conf, proto_len, cnt = 1;
4065 proto_tree *ext_tree_proto;
4067 gboolean save_writable;
4069 length = tvb_get_ntohs(tvb, offset + 1);
4071 te = proto_tree_add_text(tree, tvb, offset, length + 3, val_to_str(GTP_EXT_PROTO_CONF, gtp_val, "Unknown message"));
4072 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
4074 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
4076 if (length < 1) return 3;
4078 conf = tvb_get_guint8 (tvb, offset + 3) & 0x07;
4079 proto_tree_add_text (ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
4081 proto_offset = 1; /* ... 1st byte is conf */
4085 if (proto_offset >= length) break;
4086 proto_id = tvb_get_ntohs (tvb, offset);
4087 proto_len = tvb_get_guint8 (tvb, offset + 2);
4088 proto_offset += proto_len + 3; /* 3 = proto id + length byte */
4090 if (proto_len > 0) {
4092 proto_tree_add_text (ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)",
4093 cnt, val_to_str(proto_id, ppp_vals, "Unknown"),
4095 proto_tree_add_text (ext_tree_proto, tvb, offset+2, 1, "Protocol %u length: %u", cnt, proto_len);
4098 * Don't allow the dissector for the configuration
4099 * protocol in question to update the columns - this
4102 save_writable = col_get_writable(pinfo->cinfo);
4103 col_set_writable(pinfo->cinfo, FALSE);
4106 * XXX - should we have our own dissector table,
4107 * solely for configuration protocols, so that bogus
4108 * values don't cause us to dissect the protocol
4109 * data as, for example, IP?
4111 next_tvb = tvb_new_subset (tvb, offset + 3, proto_len, proto_len);
4112 if (!dissector_try_port(ppp_subdissector_table,
4113 proto_id, next_tvb, pinfo, ext_tree_proto)) {
4114 call_dissector(data_handle, next_tvb, pinfo,
4118 col_set_writable(pinfo->cinfo, save_writable);
4121 offset += proto_len + 3;
4128 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
4129 * UMTS: 29.060 v4.0, chapter 7.7.32
4132 decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4134 guint8 addr_type, addr_len;
4137 struct e_in6_addr addr_ipv6;
4138 proto_tree *ext_tree_gsn_addr;
4141 length = tvb_get_ntohs(tvb, offset+1);
4143 te = proto_tree_add_text(tree, tvb, offset, 3+length, "GSN address : ");
4144 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
4148 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
4149 addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
4150 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4151 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset+3, 4, addr_ipv4);
4154 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
4155 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
4156 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset+3, 1, addr_type);
4157 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
4158 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset+3, 1, addr_len);
4159 addr_ipv4 = tvb_get_ipv4(tvb, offset+4);
4160 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4161 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset+4, 4, addr_ipv4);
4164 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
4165 tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
4166 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4167 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
4170 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
4171 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
4172 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset+3, 1, addr_type);
4173 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
4174 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset+3, 1, addr_len);
4175 tvb_get_ipv6(tvb, offset+4, &addr_ipv6);
4176 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4177 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset+4, 16, (guint8*)&addr_ipv6);
4180 proto_item_append_text(te, "unknown type or wrong length");
4187 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
4188 * UMTS: 29.060 v4.0, chapter 7.7.33
4191 decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4193 const guint8 *msisdn_val;
4197 length = tvb_get_ntohs(tvb, offset+1);
4199 if (length < 1) return 3;
4201 msisdn_val = tvb_get_ptr(tvb, offset+3, length);
4202 msisdn_str = msisdn_to_str(msisdn_val, length);
4204 proto_tree_add_string(tree, hf_gtp_msisdn, tvb, offset, 3+length, msisdn_str);
4209 /* GPRS: not present
4210 * UMTS: 29.060 v4.0, chapter 7.7.34
4211 * 24.008 v4.2, chapter 10.5.6.5
4214 decode_gtp_qos_umts(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4216 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
4219 /* GPRS: not present
4220 * UMTS: 29.060 v4.0, chapter 7.7.35
4223 decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4225 proto_tree *ext_tree;
4226 proto_item *te_quint;
4228 guint8 xres_len, auth_len;
4231 length = tvb_get_ntohs(tvb, offset + 1);
4233 te_quint = proto_tree_add_text(tree, tvb, offset, length+1, "Quintuplet");
4234 ext_tree = proto_item_add_subtree(te_quint, ett_gtp_quint);
4237 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4240 proto_tree_add_text(ext_tree, tvb, offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
4241 offset = offset + 16;
4242 xres_len = tvb_get_guint8(tvb, offset);
4243 proto_tree_add_text(ext_tree, tvb, offset, 1, "XRES length: %u", xres_len);
4245 proto_tree_add_text(ext_tree, tvb, offset , xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset, xres_len));
4246 offset = offset + xres_len;
4247 proto_tree_add_text(ext_tree, tvb ,offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4248 offset = offset + 16;
4249 proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset, 16));
4250 offset = offset +16;
4251 auth_len = tvb_get_guint8(tvb, offset);
4252 proto_tree_add_text(ext_tree, tvb, offset, 1, "Authentication length: %u", auth_len);
4254 proto_tree_add_text(ext_tree, tvb, offset , auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset, auth_len));
4256 offset = offset+auth_len;
4258 return (3 + length);
4262 /* GPRS: not present
4263 * UMTS: 29.060 v4.0, chapter 7.7.36
4264 * 24.008 v4.2, chapter 10.5.6.12
4267 decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4269 guint16 length, port1, port2, tos;
4270 guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto, spare;
4272 guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
4273 struct e_in6_addr addr_ipv6, mask_ipv6;
4274 proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
4275 proto_item *te, *tee, *tef;
4277 length = tvb_get_ntohs(tvb, offset+1);
4279 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Traffic flow template");
4280 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
4282 tft_flags = tvb_get_guint8(tvb, offset+3);
4283 tft_code = (tft_flags >> 5) & 0x07;
4284 spare = (tft_flags >> 4) & 0x01;
4285 no_packet_filters = tft_flags & 0x0F;
4287 proto_tree_add_text(ext_tree_tft, tvb, offset+1, 2, "TFT length: %u", length);
4289 tef = proto_tree_add_text (ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
4290 ext_tree_tft_flags = proto_item_add_subtree (tef, ett_gtp_tft_flags);
4291 proto_tree_add_uint (ext_tree_tft_flags, hf_gtp_tft_code, tvb, offset + 3, 1, tft_flags);
4292 proto_tree_add_uint (ext_tree_tft_flags, hf_gtp_tft_spare, tvb, offset + 3, 1, tft_flags);
4293 proto_tree_add_uint (ext_tree_tft_flags, hf_gtp_tft_number, tvb, offset + 3, 1, tft_flags);
4295 offset = offset + 4;
4297 for (i=0;i<no_packet_filters;i++) {
4299 pf_id = tvb_get_guint8(tvb, offset);
4301 tee = proto_tree_add_text (ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
4302 ext_tree_tft_pf = proto_item_add_subtree (tee, ett_gtp_tft_pf);
4305 if (tft_code != 2) {
4307 pf_eval = tvb_get_guint8(tvb, offset);
4308 pf_len = tvb_get_guint8(tvb, offset + 1);
4310 proto_tree_add_uint (ext_tree_tft_pf, hf_gtp_tft_eval, tvb, offset, 1, pf_eval);
4311 proto_tree_add_text (ext_tree_tft_pf, tvb, offset+1, 1, "Content length: %u", pf_len);
4313 offset = offset + 2;
4316 while (pf_offset < pf_len) {
4318 pf_content_id = tvb_get_guint8 (tvb, offset + pf_offset);
4320 switch (pf_content_id) {
4321 /* address IPv4 and mask = 8 bytes*/
4323 addr_ipv4 = tvb_get_ipv4 (tvb, offset + pf_offset + 1);
4324 mask_ipv4 = tvb_get_ipv4 (tvb, offset + pf_offset + 5);
4325 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), ip_to_str ((guint8 *)&mask_ipv4));
4326 pf_offset = pf_offset + 9;
4328 /* address IPv6 and mask = 32 bytes*/
4330 tvb_get_ipv6 (tvb, offset+pf_offset+1, &addr_ipv6);
4331 tvb_get_ipv6 (tvb, offset+pf_offset+17, &mask_ipv6);
4332 proto_tree_add_text (ext_tree_tft_pf, tvb, offset+pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s", ip6_to_str ((struct e_in6_addr*)&addr_ipv6), ip6_to_str ((struct e_in6_addr*)&mask_ipv6));
4333 pf_offset = pf_offset + 33;
4335 /* protocol identifier/next header type = 1 byte*/
4337 proto = tvb_get_guint8 (tvb, offset + pf_offset + 1);
4338 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)", proto, proto);
4339 pf_offset = pf_offset + 2;
4341 /* single destination port type = 2 bytes */
4343 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4344 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
4345 pf_offset = pf_offset + 3;
4347 /* destination port range type = 4 bytes */
4349 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4350 port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
4351 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
4352 pf_offset = pf_offset + 5;
4354 /* single source port type = 2 bytes */
4356 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4357 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
4358 pf_offset = pf_offset + 3;
4360 /* source port range type = 4 bytes */
4362 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4363 port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
4364 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
4365 pf_offset = pf_offset + 5;
4367 /* security parameter index type = 4 bytes */
4369 ipsec_id = tvb_get_ntohl (tvb, offset + pf_offset + 1);
4370 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
4371 pf_offset = pf_offset + 5;
4373 /* type of service/traffic class type = 2 bytes */
4375 tos = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4376 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
4377 pf_offset = pf_offset + 3;
4379 /* flow label type = 3 bytes */
4381 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;
4382 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
4383 pf_offset = pf_offset + 4;
4387 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
4388 pf_offset++; /* to avoid infinite loop */
4393 offset = offset + pf_offset;
4400 /* GPRS: not present
4401 * UMTS: 29.060 v4.0, chapter 7.7.37
4402 * Type = 138 (Decimal)
4403 * 25.413(RANAP) TargetID
4406 decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4409 proto_item *target_id_item;
4410 proto_tree *ext_tree;
4412 asn1_ctx_t asn1_ctx;
4413 asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
4415 length = tvb_get_ntohs(tvb, offset + 1);
4417 target_id_item = proto_tree_add_text (tree, tvb, offset, 3 + length, "Target Identification");
4418 ext_tree = proto_item_add_subtree (target_id_item, ett_gtp_target_id);
4420 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4422 next_tvb = tvb_new_subset (tvb, offset, length, length);
4423 dissect_ranap_TargetID(next_tvb, 0, &asn1_ctx, ext_tree, hf_gtp_targetid);
4429 /* GPRS: not present
4430 * UMTS: 29.060 v4.0, chapter 7.7.38
4433 decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4436 proto_item *utran_cont_item;
4437 proto_tree *ext_tree;
4440 length = tvb_get_ntohs(tvb, offset + 1);
4442 utran_cont_item = proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
4443 ext_tree = proto_item_add_subtree (utran_cont_item, ett_gtp_utran_cont);
4445 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4447 next_tvb = tvb_new_subset (tvb, offset, length, length);
4454 /* GPRS: not present
4455 * UMTS: 29.060 v4.0, chapter 7.7.39
4458 decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4460 guint32 teid, addr_ipv4;
4463 struct e_in6_addr addr_ipv6;
4464 proto_tree *ext_tree_rab_setup;
4467 length = tvb_get_ntohs(tvb, offset + 1);
4468 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4470 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Radio Access Bearer Setup Information");
4471 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
4473 proto_tree_add_text(ext_tree_rab_setup, tvb, offset+1, 2, "RAB setup length : %u", length);
4474 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset+3, 1, nsapi);
4478 teid = tvb_get_ntohl(tvb, offset + 4);
4480 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset+4, 4, teid);
4484 addr_ipv4 = tvb_get_ipv4(tvb, offset+8);
4485 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset+8, 4, addr_ipv4);
4488 tvb_get_ipv6(tvb, offset+8, &addr_ipv6);
4489 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset+8, 16, (guint8 *)&addr_ipv6);
4500 /* GPRS: not present
4501 * UMTS: 29.060 v4.0, chapter 7.7.40
4504 decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4508 proto_tree *ext_tree_hdr_list;
4511 length = tvb_get_guint8(tvb, offset + 1);
4513 te = proto_tree_add_text(tree, tvb, offset, 2+length, "%s", val_to_str(GTP_EXT_HDR_LIST, gtp_val, "Unknown"));
4514 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4516 proto_tree_add_text(ext_tree_hdr_list, tvb, offset+1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4518 for(i=0 ; i<length ; i++) {
4519 hdr = tvb_get_guint8(tvb, offset+2+i);
4521 proto_tree_add_text(ext_tree_hdr_list, tvb, offset+2+i, 1, "No. %u --> Extension Header Type value : %s (%u)", i+1, val_to_str(hdr, gtp_val, "Unknown Extension Header Type"), hdr);
4527 /* GPRS: not present
4528 * UMTS: 29.060 v4.0, chapter 7.7.41
4529 * TODO: find TriggerID description
4532 decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4536 length = tvb_get_ntohs(tvb, offset + 1);
4538 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_TRIGGER_ID, gtp_val, "Unknown"), length);
4544 /* GPRS: not present
4545 * UMTS: 29.060 v4.0, chapter 7.7.42
4546 * TODO: find OMC-ID description
4549 decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4553 length = tvb_get_ntohs(tvb, offset + 1);
4555 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_OMC_ID, gtp_val, "Unknown"), length);
4561 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
4562 * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
4565 decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4569 struct e_in6_addr addr_ipv6;
4570 proto_tree *ext_tree_chrg_addr;
4573 length = tvb_get_ntohs(tvb, offset+1);
4575 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"));
4576 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
4578 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);
4582 addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
4583 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4584 proto_tree_add_ipv4 (ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset+3, 4, addr_ipv4);
4587 tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
4588 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4589 proto_tree_add_ipv6 (ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
4592 proto_item_append_text(te, "unknown type or wrong length");
4600 * UMTS: 29.060 v6.11.0, chapter 7.7.44 RAN Transparent Container
4603 decode_gtp_ran_tr_cont(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4606 proto_tree *ext_tree;
4609 length = tvb_get_ntohs(tvb, offset+1);
4610 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_RAN_TR_CONT, gtp_val, "Unknown"));
4611 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ran_tr_cont);
4614 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4616 /* TODO add decoding of data */
4617 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4624 * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
4627 decode_gtp_pdp_cont_prio(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4630 proto_tree *ext_tree;
4633 length = tvb_get_ntohs(tvb, offset+1);
4634 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_PDP_CONT_PRIO, gtp_val, "Unknown"));
4635 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdp_cont_prio);
4638 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4640 /* TODO add decoding of data */
4641 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4647 * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
4650 decode_gtp_add_rab_setup_inf(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4653 proto_tree *ext_tree;
4656 length = tvb_get_ntohs(tvb, offset+1);
4657 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_ADD_RAB_SETUP_INF, gtp_val, "Unknown"));
4658 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rab_setup_inf);
4661 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4663 /* TODO add decoding of data */
4664 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4672 * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
4675 decode_gtp_ssgn_no(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4678 proto_tree *ext_tree;
4681 length = tvb_get_ntohs(tvb, offset+1);
4682 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_SSGN_NO, gtp_val, "Unknown"));
4683 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ssgn_no);
4686 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4688 /* TODO add decoding of data */
4689 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4696 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
4699 decode_gtp_common_flgs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4702 proto_tree *ext_tree;
4705 length = tvb_get_ntohs(tvb, offset+1);
4706 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_COMMON_FLGS, gtp_val, "Unknown"));
4707 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_common_flgs);
4710 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4712 /* Upgrade QoS Supported */
4713 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, FALSE);
4714 /* No QoS negotiation */
4715 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, FALSE);
4716 /* NRSN bit field */
4717 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, FALSE);
4718 /* MBMS Counting Information bi */
4719 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, FALSE);
4720 /* RAN Procedures Ready */
4721 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, FALSE);
4722 /* MBMS Service Type */
4723 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, FALSE);
4724 /* Prohibit Payload Compression */
4725 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, FALSE);
4732 * UMTS: 29.060 v6.11.0, chapter 7.7.49
4735 decode_gtp_apn_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4738 proto_tree *ext_tree_apn_res;
4741 length = tvb_get_ntohs(tvb, offset+1);
4742 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_APN_RES, gtp_val, "Unknown"));
4743 ext_tree_apn_res = proto_item_add_subtree(te, ett_gtp_ext_tree_apn_res);
4746 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4749 /* Restriction Type value */
4750 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, FALSE);
4755 * UMTS: 29.060 v6.11.0, chapter 7.7.50
4757 * Type = 151 (Decimal)
4760 decode_gtp_rat_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4763 proto_tree *ext_tree_rat_type;
4766 length = tvb_get_ntohs(tvb, offset+1);
4767 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_RAT_TYPE, gtp_val, "Unknown"));
4768 ext_tree_rat_type = proto_item_add_subtree(te, ett_gtp_ext_rat_type);
4771 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4774 /* RAT Type value */
4775 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, FALSE);
4780 * UMTS: 29.060 v6.11.0, chapter 7.7.51
4781 * User Location Information
4782 * Type = 152 (Decimal)
4785 decode_gtp_usr_loc_inf(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4788 proto_tree *ext_tree;
4790 guint8 geo_loc_type;
4792 length = tvb_get_ntohs(tvb, offset+1);
4793 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_USR_LOC_INF, gtp_val, "Unknown"));
4794 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_usr_loc_inf);
4797 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4799 /* TODO add decoding of data */
4800 /* Geographic Location Type */
4801 proto_tree_add_item(ext_tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, FALSE);
4802 geo_loc_type = tvb_get_guint8(tvb,offset);
4805 if (geo_loc_type == 0)
4806 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
4807 be_cell_id_aux(tvb, ext_tree, offset, length-1, NULL, 0, 0);
4808 if (geo_loc_type == 1){
4809 /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
4810 be_cell_id_aux(tvb, ext_tree, offset, length-1, NULL, 0, 4);
4811 offset = offset + 5;
4812 proto_tree_add_item(ext_tree, hf_gtp_ext_sac, tvb, offset, 2, FALSE);
4820 * UMTS: 29.060 v6.11.0, chapter 7.7.52
4822 * Type = 153 (Decimal)
4825 decode_gtp_ms_time_zone(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4828 proto_tree *ext_tree;
4833 length = tvb_get_ntohs(tvb, offset+1);
4834 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_MS_TIME_ZONE, gtp_val, "Unknown"));
4835 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ms_time_zone);
4838 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4841 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4842 /* 3GPP TS 23.040 version 6.6.0 Release 6
4843 * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
4845 * The Time Zone indicates the difference, expressed in quarters of an hour,
4846 * between the local time and GMT. In the first of the two semi-octets,
4847 * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
4848 * represents the algebraic sign of this difference (0: positive, 1: negative).
4851 data = tvb_get_guint8(tvb, offset);
4852 sign = (data & 0x08)?'-':'+';
4853 data = (data >> 4) + (data & 0x07) * 10;
4855 proto_tree_add_text(tree, tvb, offset, 1,"Timezone: GMT %c %d hours %d minutes",
4856 sign, data / 4, data % 4 * 15);
4863 * UMTS: 29.060 v6.11.0, chapter 7.7.53
4864 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
4865 * Type = 154 (Decimal)
4868 decode_gtp_imeisv(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4871 proto_tree *ext_imeisv;
4876 length = tvb_get_ntohs(tvb, offset+1);
4877 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_IMEISV, gtp_val, "Unknown"));
4878 ext_imeisv = proto_item_add_subtree(te, ett_gtp_ext_imeisv);
4881 proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4885 * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
4886 * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
4887 * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
4888 * set to '1111'. Both IMEI and IMEISV are BCD encoded.
4890 next_tvb = tvb_new_subset(tvb, offset, length, length);
4891 digit_str = unpack_digits(next_tvb, 0);
4892 proto_tree_add_string(tree, hf_gtp_ext_imeisv, next_tvb, 0, -1, digit_str);
4897 * UMTS: 29.060 v6.11.0, chapter 7.7.54
4898 * CAMEL Charging Information Container
4899 * Type = 155 (Decimal)
4902 decode_gtp_camel_chg_inf_con(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4905 proto_tree *ext_tree;
4908 length = tvb_get_ntohs(tvb, offset+1);
4909 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_CAMEL_CHG_INF_CON, gtp_val, "Unknown"));
4910 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_camel_chg_inf_con);
4913 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4915 /* TODO add decoding of data */
4916 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4922 * UMTS: 29.060 v6.11.0, chapter 7.7.55
4926 decode_gtp_mbms_ue_ctx(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4929 proto_tree *ext_tree;
4932 length = tvb_get_ntohs(tvb, offset+1);
4933 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_MBMS_UE_CTX, gtp_val, "Unknown"));
4934 ext_tree = proto_item_add_subtree(te, ett_GTP_EXT_MBMS_UE_CTX);
4937 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4939 /* TODO add decoding of data */
4940 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
4947 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
4948 * Temporary Mobile Group Identity (TMGI)
4949 * The Temporary Mobile Group Identity (TMGI) information element contains
4950 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
4951 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
4955 decode_gtp_tmgi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4958 proto_tree *ext_tree, *tmgi_tree;
4959 proto_item *te, *ti;
4962 length = tvb_get_ntohs(tvb, offset+1);
4963 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_TMGI, gtp_val, "Unknown"));
4964 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_tmgi);
4967 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4970 ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, FALSE);
4972 tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
4973 next_tvb = tvb_new_subset(tvb, offset, length, length);
4974 de_mid(next_tvb, tmgi_tree, 0, length, NULL, 0);
4980 * UMTS: 29.060 v6.11.0, chapter 7.7.57
4981 * RIM Routing Address
4984 decode_gtp_rim_ra(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4987 proto_tree *ext_tree;
4990 length = tvb_get_ntohs(tvb, offset+1);
4991 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_RIM_RA, gtp_val, "Unknown"));
4992 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_rim_ra);
4995 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
4997 /* TODO add decoding of data */
4998 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5000 * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
5008 * UMTS: 29.060 v6.11.0, chapter 7.7.58
5009 * MBMS Protocol Configuration Options
5012 decode_gtp_mbms_prot_conf_opt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5015 proto_tree *ext_tree;
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_MBMS_PROT_CONF_OPT, gtp_val, "Unknown"));
5020 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_prot_conf_opt);
5023 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5025 /* TODO add decoding of data */
5026 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5032 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
5033 * MBMS Session Duration
5035 /* Used for Diameter */
5036 static int dissect_gtp_mbms_ses_dur(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
5040 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5041 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5048 decode_gtp_mbms_ses_dur(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5051 proto_tree *ext_tree;
5054 length = tvb_get_ntohs(tvb, offset+1);
5055 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_MBMS_SES_DUR, gtp_val, "Unknown"));
5056 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bms_ses_dur);
5059 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5061 /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
5062 * The MBMS Session Duration information element indicates the estimated
5063 * session duration of the MBMS service data transmission if available.
5064 * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
5065 * in 3GPP TS 29.061 [27], excluding the AVP Header fields
5066 * (as defined in IETF RFC 3588 [36], section 4.1).
5068 /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
5069 * with a length of three octets and indicates the estimated session duration
5070 * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
5071 * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
5072 * for which the maximum allowed value is 18 days. For the whole session duration the seconds
5073 * and days are added together and the maximum session duration is 19 days.
5075 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
5076 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
5083 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
5087 decode_gtp_mbms_sa(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5090 proto_tree *ext_tree;
5091 proto_item *te, *item;
5092 guint8 no_of_mbms_sa_codes;
5095 length = tvb_get_ntohs(tvb, offset+1);
5096 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_MBMS_SA, gtp_val, "Unknown"));
5097 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_sa);
5100 item = proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5102 /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
5103 * The MBMS Service Area information element indicates the area over
5104 * which the Multimedia Broadcast/Multicast Service is to be distributed.
5105 * The payload shall be encoded as per the MBMS-Service-Area AVP defined
5106 * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
5107 * IETF RFC 3588 [36], section 4.1).
5109 /* Number N of MBMS service area codes coded as:
5110 * 1 binary value is '00000000'
5112 * 256 binary value is '11111111'
5114 no_of_mbms_sa_codes = tvb_get_guint8(tvb,offset) + 1;
5115 if(length != ((no_of_mbms_sa_codes <<1) +1)){
5116 expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_WARN,
5117 "Wrong length: %u. The length of an MBMS service area code is 2 octets",length);
5119 proto_tree_add_uint(ext_tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
5121 /* A consecutive list of N MBMS service area codes
5122 * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
5123 * The length of an MBMS service area code is 2 octets.
5125 for (i=0;i<no_of_mbms_sa_codes;i++) {
5126 proto_tree_add_item(ext_tree, hf_gtp_mbms_sa_code, tvb, offset, 2, FALSE);
5135 * UMTS: 29.060 v6.11.0, chapter 7.7.61
5136 * Source RNC PDCP context info
5139 decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5142 proto_tree *ext_tree;
5145 length = tvb_get_ntohs(tvb, offset+1);
5146 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_SRC_RNC_PDP_CTX_INF, gtp_val, "Unknown"));
5147 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_src_rnc_pdp_ctx_inf);
5150 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5152 /* TODO add decoding of data */
5153 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5160 * UMTS: 29.060 v6.11.0, chapter 7.7.62
5161 * Additional Trace Info
5164 decode_gtp_add_trs_inf(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5167 proto_tree *ext_tree;
5170 length = tvb_get_ntohs(tvb, offset+1);
5171 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_ADD_TRS_INF, gtp_val, "Unknown"));
5172 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_add_trs_inf);
5175 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5177 /* TODO add decoding of data */
5178 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5185 * UMTS: 29.060 v6.11.0, chapter 7.7.63
5189 decode_gtp_hop_count(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5192 proto_tree *ext_tree;
5195 length = tvb_get_ntohs(tvb, offset+1);
5196 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_HOP_COUNT, gtp_val, "Unknown"));
5197 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_hop_count);
5200 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5202 /* TODO add decoding of data */
5203 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5210 * UMTS: 29.060 v6.11.0, chapter 7.7.64
5214 decode_gtp_sel_plmn_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5217 proto_tree *ext_tree;
5220 length = tvb_get_ntohs(tvb, offset+1);
5221 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_SEL_PLMN_ID, gtp_val, "Unknown"));
5222 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_sel_plmn_id);
5225 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5227 /* TODO add decoding of data */
5228 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5235 * UMTS: 29.060 v6.11.0, chapter 7.7.65
5236 * MBMS Session Identifier
5239 decode_gtp_mbms_ses_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5242 proto_tree *ext_tree;
5245 length = tvb_get_ntohs(tvb, offset+1);
5246 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_MBMS_SES_ID, gtp_val, "Unknown"));
5247 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id);
5250 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5252 /* TODO add decoding of data */
5253 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5260 * UMTS: 29.060 v6.11.0, chapter 7.7.66
5261 * MBMS 2G/3G Indicator
5263 static const value_string gtp_mbs_2g_3g_ind_vals[] = {
5266 { 2, "Both 2G and 3G" },
5271 decode_gtp_mbms_2g_3g_ind(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5274 proto_tree *ext_tree;
5277 length = tvb_get_ntohs(tvb, offset+1);
5278 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_MBMS_2G_3G_IND, gtp_val, "Unknown"));
5279 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_2g_3g_ind);
5282 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5284 /* MBMS 2G/3G Indicator */
5285 proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, FALSE);
5292 * UMTS: 29.060 v6.11.0, chapter 7.7.67
5296 decode_gtp_enh_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5299 proto_tree *ext_tree;
5302 length = tvb_get_ntohs(tvb, offset+1);
5303 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_ENH_NSAPI, gtp_val, "Unknown"));
5304 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_enh_nsapi);
5307 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5309 /* TODO add decoding of data */
5310 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5317 * UMTS: 29.060 v6.11.0, chapter 7.7.68
5318 * Additional MBMS Trace Info
5321 decode_gtp_add_mbms_trs_inf(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5324 proto_tree *ext_tree;
5327 length = tvb_get_ntohs(tvb, offset+1);
5328 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_ADD_MBMS_TRS_INF, gtp_val, "Unknown"));
5329 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ad_mbms_trs_inf);
5332 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5334 /* TODO add decoding of data */
5335 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5342 * UMTS: 29.060 v6.11.0, chapter 7.7.69
5343 * MBMS Session Identity Repetition Number
5346 decode_gtp_mbms_ses_id_rep_no(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5349 proto_tree *ext_tree;
5352 length = tvb_get_ntohs(tvb, offset+1);
5353 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_MBMS_SES_ID_REP_NO, gtp_val, "Unknown"));
5354 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_ses_id_rep_no);
5357 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5359 /* TODO add decoding of data */
5360 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5367 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
5368 * MBMS Time To Data Transfer
5370 /* Used for Diameter */
5371 static int dissect_gtp_mbms_time_to_data_tr(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
5374 guint8 time_2_dta_tr;
5376 time_2_dta_tr = tvb_get_guint8(tvb,offset) + 1;
5377 proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5384 decode_gtp_mbms_time_to_data_tr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5387 proto_tree *ext_tree;
5389 guint8 time_2_dta_tr;
5391 length = tvb_get_ntohs(tvb, offset+1);
5392 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_MBMS_TIME_TO_DATA_TR, gtp_val, "Unknown"));
5393 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_time_to_data_tr);
5396 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5398 /* TODO add decoding of data
5399 * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
5400 * The MBMS Time To Data Transfer information element contains a
5401 * MBMS Time To Data Transfer allocated by the BM-SC.
5402 * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
5403 * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
5404 * (as defined in IETF RFC 3588 [36], section 4.1).
5406 /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
5407 * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
5410 * 0 0 0 0 0 0 0 0 1s
5411 * 0 0 0 0 0 0 0 1 2s
5412 * 0 0 0 0 0 0 1 0 3s
5414 * 1 1 1 1 1 1 1 1 256s
5416 time_2_dta_tr = tvb_get_guint8(tvb,offset) + 1;
5417 proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
5424 * UMTS: 29.060 v6.11.0, chapter 7.7.71
5425 * PS Handover Request Context
5428 decode_gtp_ps_ho_req_ctx(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5431 proto_tree *ext_tree;
5434 length = tvb_get_ntohs(tvb, offset+1);
5435 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_PS_HO_REQ_CTX, gtp_val, "Unknown"));
5436 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_ps_ho_req_ctx);
5439 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5441 /* TODO add decoding of data */
5442 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5449 * UMTS: 29.060 v6.11.0, chapter 7.7.72
5453 decode_gtp_bss_cont(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5456 proto_tree *ext_tree;
5459 length = tvb_get_ntohs(tvb, offset+1);
5460 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_BSS_CONT, gtp_val, "Unknown"));
5461 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bss_cont);
5464 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5466 /* TODO add decoding of data */
5467 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5469 * The content of this container is defined in 3GPP TS 48.018
5477 * UMTS: 29.060 v6.11.0, chapter 7.7.73
5478 * Cell Identification
5481 decode_gtp_cell_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5484 proto_tree *ext_tree;
5487 length = tvb_get_ntohs(tvb, offset+1);
5488 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_CELL_ID, gtp_val, "Unknown"));
5489 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_cell_id);
5492 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5494 /* TODO add decoding of data */
5495 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5497 * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
5498 * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
5500 * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
5501 * source RNC (RNC-ID) as defined in 3GPP TS 48.018
5509 * UMTS: 29.060 v6.11.0, chapter 7.7.74
5513 decode_gtp_pdu_no(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5516 proto_tree *ext_tree;
5519 length = tvb_get_ntohs(tvb, offset+1);
5520 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_PDU_NO, gtp_val, "Unknown"));
5521 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_pdu_no);
5524 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5526 /* TODO add decoding of data */
5527 proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
5534 * UMTS: 29.060 v6.11.0, chapter 7.7.75
5538 decode_gtp_bssgp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5541 proto_tree *ext_tree;
5544 length = tvb_get_ntohs(tvb, offset+1);
5545 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_BSSGP_CAUSE, gtp_val, "Unknown"));
5546 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
5549 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5553 * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
5555 proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 2, FALSE);
5563 * Required MBMS bearer capabilities 7.7.76
5566 decode_gtp_mbms_bearer_cap(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5568 proto_tree *ext_tree;
5571 length = tvb_get_ntohs(tvb, offset+1);
5572 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s", val_to_str(GTP_EXT_BSSGP_CAUSE, gtp_val, "Unknown"));
5573 ext_tree = proto_item_add_subtree(te, ett_gtp_ext_bssgp_cause);
5576 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5578 /* The payload shall be encoded as per the
5579 * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
5580 * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
5582 /* TODO Add decoding (call Diameter dissector???)*/
5587 * RIM Routing Address Discriminator 7.7.77
5590 * List of set-up PFCs 7.7.78
5593 * PS Handover XID Parameters 7.7.79
5596 * MS Info Change Reporting Action 7.7.80
5599 * Direct Tunnel Flags 7.7.81
5602 * Correlation-ID 7.7.82
5605 * Bearer Control Mode 7.7.83
5612 decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5614 guint16 length, n, number;
5615 proto_tree *ext_tree_rel_pack;
5618 length = tvb_get_ntohs(tvb, offset + 1);
5620 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
5621 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
5625 while (n < length) {
5627 number = tvb_get_ntohs(tvb, offset + 3 + n);
5628 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
5640 decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5642 guint16 length, n, number;
5643 proto_tree *ext_tree_can_pack;
5646 length = tvb_get_ntohs(tvb, offset + 1);
5648 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
5649 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
5653 while (n < length) {
5655 number = tvb_get_ntohs(tvb, offset + 3 + n);
5656 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
5663 /* CDRs dissector */
5665 decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5667 guint16 length, format_ver;
5669 proto_tree *ext_tree;
5673 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
5674 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
5676 length = tvb_get_ntohs(tvb, offset + 1);
5677 no = tvb_get_guint8(tvb, offset + 3);
5678 format = tvb_get_guint8(tvb, offset + 4);
5679 format_ver = tvb_get_ntohs(tvb, offset + 5);
5681 proto_tree_add_text(ext_tree, tvb, offset+1, 2, "Length: %u", length);
5682 proto_tree_add_text(ext_tree, tvb, offset+3, 1, "Number of data records: %u", no);
5683 proto_tree_add_text(ext_tree, tvb, offset+4, 1, "Data record format: %u", format);
5684 proto_tree_add_text(ext_tree, tvb, offset+5, 2, "Data record format version: %u", format_ver);
5686 if (gtpcdr_handle) {
5687 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
5688 call_dissector (gtpcdr_handle, next_tvb, pinfo, tree);
5691 proto_tree_add_text (tree, tvb, offset, 0, "Data");
5700 decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5702 guint16 length, n, number;
5703 proto_tree *ext_tree_data_resp;
5706 length = tvb_get_ntohs(tvb, offset + 1);
5708 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
5709 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
5713 while (n < length) {
5715 number = tvb_get_ntohs(tvb, offset + 3 + n);
5716 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
5729 decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5733 struct e_in6_addr addr_ipv6;
5734 proto_tree *ext_tree_node_addr;
5737 length = tvb_get_ntohs(tvb, offset+1);
5739 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Node address: ");
5740 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
5742 proto_tree_add_text (ext_tree_node_addr, tvb, offset+1, 2, "Node address length: %u", length);
5746 addr_ipv4 = tvb_get_ipv4(tvb, offset+3);
5747 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
5748 proto_tree_add_ipv4 (ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset+3, 4, addr_ipv4);
5751 tvb_get_ipv6(tvb, offset+3, &addr_ipv6);
5752 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
5753 proto_tree_add_ipv6 (ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
5756 proto_item_append_text(te, "unknown type or wrong length");
5764 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
5765 * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
5770 decode_gtp_priv_ext(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5772 guint16 length, ext_id;
5773 proto_tree *ext_tree_priv_ext;
5776 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_PRIV_EXT, gtp_val, "Unknown message"));
5777 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
5780 length = tvb_get_ntohs(tvb, offset);
5781 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, FALSE);
5784 ext_id = tvb_get_ntohs(tvb, offset);
5785 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
5789 * XXX - is this always a text string? Or should it be
5790 * displayed as hex data?
5793 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length-2, FALSE);
5800 decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
5802 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
5804 return tvb_length_remaining(tvb, offset);
5808 dissect_gtp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
5810 struct _gtp_hdr gtp_hdr;
5811 proto_tree *gtp_tree, *flags_tree;
5812 proto_item *ti, *tf;
5813 int i, offset, length, gtp_prime, checked_field, mandatory;
5814 int seq_no, flow_label;
5815 guint8 pdu_no, next_hdr = 0, ext_hdr_val;
5816 const guint8 *tid_val;
5820 guint8 sub_proto, acfield_len = 0, control_field;
5822 if (check_col(pinfo->cinfo, COL_PROTOCOL))
5823 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
5824 if (check_col(pinfo->cinfo, COL_INFO))
5825 col_clear(pinfo->cinfo, COL_INFO);
5827 tvb_memcpy(tvb, (guint8 *)>p_hdr, 0, 4);
5829 if (!(gtp_hdr.flags & 0x10))
5834 switch ((gtp_hdr.flags >> 5) & 0x07) {
5846 if (check_col(pinfo->cinfo, COL_INFO))
5847 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtp_hdr.message, message_type, "Unknown"));
5850 ti = proto_tree_add_item (tree, proto_gtp, tvb, 0, -1, FALSE);
5851 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
5853 tf = proto_tree_add_uint (gtp_tree, hf_gtp_flags, tvb, 0, 1, gtp_hdr.flags);
5854 flags_tree = proto_item_add_subtree (tf, ett_gtp_flags);
5856 proto_tree_add_uint (flags_tree, hf_gtp_flags_ver, tvb, 0, 1, gtp_hdr.flags);
5857 proto_tree_add_uint (flags_tree, hf_gtp_flags_pt, tvb, 0, 1, gtp_hdr.flags);
5859 switch (gtp_version) {
5861 proto_tree_add_uint (flags_tree, hf_gtp_flags_spare1, tvb, 0, 1, gtp_hdr.flags);
5862 proto_tree_add_boolean (flags_tree, hf_gtp_flags_snn, tvb, 0, 1, gtp_hdr.flags);
5865 proto_tree_add_uint (flags_tree, hf_gtp_flags_spare2, tvb, 0, 1, gtp_hdr.flags);
5866 proto_tree_add_boolean (flags_tree, hf_gtp_flags_e, tvb, 0, 1, gtp_hdr.flags);
5867 proto_tree_add_boolean (flags_tree, hf_gtp_flags_s, tvb, 0, 1, gtp_hdr.flags);
5868 proto_tree_add_boolean (flags_tree, hf_gtp_flags_pn, tvb, 0, 1, gtp_hdr.flags);
5874 proto_tree_add_uint (gtp_tree, hf_gtp_message_type, tvb, 1, 1, gtp_hdr.message);
5876 gtp_hdr.length = g_ntohs (gtp_hdr.length);
5877 proto_tree_add_uint (gtp_tree, hf_gtp_length, tvb, 2, 2, gtp_hdr.length);
5882 seq_no = tvb_get_ntohs (tvb, offset);
5883 proto_tree_add_uint (gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
5886 switch (gtp_version) {
5888 seq_no = tvb_get_ntohs (tvb, offset);
5889 proto_tree_add_uint (gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
5892 flow_label = tvb_get_ntohs (tvb, offset);
5893 proto_tree_add_uint (gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
5896 pdu_no = tvb_get_guint8 (tvb, offset);
5897 proto_tree_add_uint (gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
5900 tid_val = tvb_get_ptr(tvb, offset, 8);
5901 tid_str = id_to_str (tid_val);
5902 proto_tree_add_string (gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
5906 teid = tvb_get_ntohl (tvb, offset);
5907 proto_tree_add_uint (gtp_tree, hf_gtp_teid, tvb, offset, 4, teid);
5910 if (gtp_hdr.flags & 0x07) {
5911 seq_no = tvb_get_ntohs (tvb, offset);
5912 proto_tree_add_uint (gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
5915 pdu_no = tvb_get_guint8 (tvb, offset);
5916 proto_tree_add_uint (gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, pdu_no);
5919 next_hdr = tvb_get_guint8 (tvb, offset);
5920 proto_tree_add_uint (gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
5930 if (gtp_hdr.message != GTP_MSG_TPDU) {
5931 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[--- end of GTP header, beginning of extension headers ---]");
5932 length = tvb_length (tvb);
5933 mandatory = 0; /* check order of GTP fields against ETSI */
5935 if (offset >= length)
5938 ext_hdr_val = next_hdr;
5942 ext_hdr_val = tvb_get_guint8 (tvb, offset);
5943 if (gtp_etsi_order) {
5944 checked_field = check_field_presence (gtp_hdr.message, ext_hdr_val , (int *)&mandatory);
5945 switch (checked_field) {
5946 case -2: proto_tree_add_text (gtp_tree, tvb, 0, 0, "[WARNING] message not found");
5948 case -1: proto_tree_add_text (gtp_tree, tvb, 0, 0, "[WARNING] field not present");
5951 default: proto_tree_add_text (gtp_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s", val_to_str(checked_field, gtp_val, "Unknown extension field"));
5957 while (gtpopt[++i].optcode)
5958 if (gtpopt[i].optcode == ext_hdr_val)
5960 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtp_tree);
5965 if ((gtp_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
5970 if (gtp_version == 1) {
5971 if (gtp_hdr.flags & 0x07) {
5973 if (tvb_get_guint8 (tvb, offset) == 0)
5982 sub_proto = tvb_get_guint8 (tvb, offset);
5984 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
5985 /* this is most likely an IPv4 packet
5986 * we can exclude 0x40 - 0x44 because the minimum header size is 20 octets
5987 * 0x4f is excluded because PPP protocol type "IPv6 header compression"
5988 * with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
5990 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
5991 call_dissector(ip_handle, next_tvb, pinfo, tree);
5994 if ((sub_proto & 0xf0) == 0x60){
5995 /* this is most likely an IPv6 packet */
5996 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
5997 call_dissector (ipv6_handle, next_tvb, pinfo, tree);
5999 /* this seems to be a PPP packet */
6001 if (sub_proto == 0xff) {
6002 /* this might be an address field, even it shouldn't be here */
6003 control_field = tvb_get_guint8 (tvb, offset + 1);
6004 if (control_field == 0x03)
6005 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
6009 next_tvb = tvb_new_subset (tvb, offset + acfield_len, -1, -1);
6010 call_dissector (ppp_handle, next_tvb, pinfo, tree);
6013 if (check_col(pinfo->cinfo, COL_PROTOCOL))
6014 col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP");
6018 static const true_false_string yes_no_tfs = {
6024 proto_register_gtp(void)
6026 static hf_register_info hf_gtp[] = {
6027 { &hf_gtp_apn, { "APN", "gtp.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
6028 { &hf_gtp_cause, { "Cause ", "gtp.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
6029 { &hf_gtp_chrg_char, { "Charging characteristics", "gtp.chrg_char", FT_UINT16, BASE_DEC, NULL, 0, "Charging characteristics", HFILL }},
6030 { &hf_gtp_chrg_char_s, { "Spare", "gtp.chrg_char_s", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, "Spare", HFILL }},
6031 { &hf_gtp_chrg_char_n, { "Normal charging", "gtp.chrg_char_n", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, "Normal charging", HFILL }},
6032 { &hf_gtp_chrg_char_p, { "Prepaid charging", "gtp.chrg_char_p", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, "Prepaid charging", HFILL }},
6033 { &hf_gtp_chrg_char_f, { "Flat rate charging", "gtp.chrg_char_f", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, "Flat rate charging", HFILL }},
6034 { &hf_gtp_chrg_char_h, { "Hot billing charging", "gtp.chrg_char_h", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, "Hot billing charging", HFILL }},
6035 { &hf_gtp_chrg_char_r, { "Reserved", "gtp.chrg_char_r", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, "Reserved", HFILL }},
6036 { &hf_gtp_chrg_id, { "Charging ID", "gtp.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
6037 { &hf_gtp_chrg_ipv4, { "CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
6038 { &hf_gtp_chrg_ipv6, { "CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
6039 { &hf_gtp_ext_flow_label, { "Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL }},
6040 { &hf_gtp_ext_id, { "Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC, VALS(sminmpec_values), 0, "Extension Identifier", HFILL }},
6041 { &hf_gtp_ext_val, { "Extension value", "gtp.ext_val", FT_BYTES, BASE_HEX, NULL, 0, "Extension Value", HFILL }},
6042 { &hf_gtp_flags, { "Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL }},
6043 { &hf_gtp_flags_ver,
6044 { "Version", "gtp.flags.version",
6045 FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
6046 "GTP Version", HFILL }
6049 { "Protocol type", "gtp.flags.payload",
6050 FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
6051 "Protocol Type", HFILL }
6053 { &hf_gtp_flags_spare1,
6054 { "Reserved", "gtp.flags.reserved",
6055 FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
6056 "Reserved (shall be sent as '111' )", HFILL }
6058 { &hf_gtp_flags_snn, { "Is SNDCP N-PDU included?", "gtp.flags.snn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_SNN_MASK, "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL }},
6059 { &hf_gtp_flags_spare2, { "Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, "Reserved (shall be sent as '1' )", HFILL }},
6060 { &hf_gtp_flags_e, { "Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_E_MASK, "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL }},
6061 { &hf_gtp_flags_s, { "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)", HFILL }},
6062 { &hf_gtp_flags_pn, { "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)", HFILL }},
6063 { &hf_gtp_flow_ii, { "Flow Label Data II ", "gtp.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL }},
6064 { &hf_gtp_flow_label, { "Flow label", "gtp.flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label", HFILL }},
6065 { &hf_gtp_flow_sig, { "Flow label Signalling", "gtp.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, "Flow label signalling", HFILL }},
6066 { &hf_gtp_gsn_addr_len, { "GSN Address Length", "gtp.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, "GSN Address Length", HFILL }},
6067 { &hf_gtp_gsn_addr_type, { "GSN Address Type", "gtp.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, "GSN Address Type", HFILL }},
6068 { &hf_gtp_gsn_ipv4, { "GSN address IPv4", "gtp.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
6069 { &hf_gtp_gsn_ipv6, { "GSN address IPv6", "gtp.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
6070 { &hf_gtp_imsi, { "IMSI", "gtp.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
6071 { &hf_gtp_length, { "Length", "gtp.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
6072 { &hf_gtp_map_cause, { "MAP cause", "gtp.map_cause", FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0, "MAP cause", HFILL }},
6073 { &hf_gtp_message_type, { "Message Type", "gtp.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
6074 { &hf_gtp_ms_reason, { "MS not reachable reason", "gtp.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, "MS Not Reachable Reason", HFILL }},
6075 { &hf_gtp_ms_valid, { "MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
6076 { &hf_gtp_msisdn, { "MSISDN", "gtp.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
6077 { &hf_gtp_next, { "Next extension header type", "gtp.next", FT_UINT8, BASE_HEX, NULL, 0, "Next Extension Header Type", HFILL }},
6078 { &hf_gtp_node_ipv4, { "Node address IPv4", "gtp.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
6079 { &hf_gtp_node_ipv6, { "Node address IPv6", "gtp.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
6080 { &hf_gtp_npdu_number, { "N-PDU Number", "gtp.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, "N-PDU Number", HFILL }},
6081 { &hf_gtp_nsapi, { "NSAPI", "gtp.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
6082 { &hf_gtp_qos_version, { "Version", "gtp.qos_version", FT_STRING, BASE_DEC, NULL, 0, "Version of the QoS Profile", HFILL }},
6083 { &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 }},
6084 { &hf_gtp_qos_delay, { "QoS delay", "gtp.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL }},
6085 { &hf_gtp_qos_reliability, { "QoS reliability", "gtp.qos_reliabilty", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK, "Quality of Service Reliability Class", HFILL }},
6086 { &hf_gtp_qos_peak, { "QoS peak", "gtp.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL }},
6087 { &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 }},
6088 { &hf_gtp_qos_precedence, { "QoS precedence", "gtp.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK, "Quality of Service Precedence Class", HFILL }},
6089 { &hf_gtp_qos_spare3, { "Spare", "gtp.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL }},
6090 { &hf_gtp_qos_mean, { "QoS mean", "gtp.qos_mean", FT_UINT8, BASE_DEC, VALS(qos_mean_type), GTP_EXT_QOS_MEAN_MASK, "Quality of Service Mean Throughput", HFILL }},
6091 { &hf_gtp_qos_al_ret_priority, { "Allocation/Retention priority ","gtp.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, "Allocation/Retention Priority", HFILL }},
6092 { &hf_gtp_qos_traf_class, { "Traffic class", "gtp.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, "Traffic Class", HFILL }},
6093 { &hf_gtp_qos_del_order, { "Delivery order", "gtp.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, "Delivery Order", HFILL }},
6094 { &hf_gtp_qos_del_err_sdu, { "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, "Delivery of Erroneous SDU", HFILL }},
6095 { &hf_gtp_qos_max_sdu_size, { "Maximum SDU size", "gtp.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, "Maximum SDU size", HFILL }},
6096 { &hf_gtp_qos_max_ul, { "Maximum bit rate for uplink", "gtp.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, "Maximum bit rate for uplink", HFILL }},
6097 { &hf_gtp_qos_max_dl, { "Maximum bit rate for downlink", "gtp.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, "Maximum bit rate for downlink", HFILL }},
6098 { &hf_gtp_qos_res_ber, { "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 }},
6099 { &hf_gtp_qos_sdu_err_ratio, { "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", HFILL }},
6100 { &hf_gtp_qos_trans_delay, { "Transfer delay", "gtp.qos_trans_delay", FT_UINT8, BASE_DEC, VALS(qos_trans_delay), GTP_EXT_QOS_TRANS_DELAY_MASK, "Transfer Delay", HFILL }},
6101 { &hf_gtp_qos_traf_handl_prio, { "Traffic handling priority", "gtp.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK, "Traffic Handling Priority", HFILL }},
6102 { &hf_gtp_qos_guar_ul, { "Guaranteed bit rate for uplink", "gtp.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, "Guaranteed bit rate for uplink", HFILL }},
6103 { &hf_gtp_qos_guar_dl, { "Guaranteed bit rate for downlink", "gtp.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, "Guaranteed bit rate for downlink", HFILL }},
6104 { &hf_gtp_pkt_flow_id, { "Packet Flow ID", "gtp.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, "Packet Flow ID", HFILL }},
6105 { &hf_gtp_ptmsi, { "P-TMSI", "gtp.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
6106 { &hf_gtp_ptmsi_sig, { "P-TMSI Signature", "gtp.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
6107 { &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 }},
6108 { &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 }},
6109 { &hf_gtp_rab_pdu_dn, { "Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL }},
6110 { &hf_gtp_rab_pdu_up, { "Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL }},
6111 { &hf_gtp_rai_mcc, { "MCC", "gtp.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
6112 { &hf_gtp_rai_mnc, { "MNC", "gtp.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
6113 { &hf_gtp_rai_rac, { "RAC", "gtp.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
6114 { &hf_gtp_rai_lac, { "LAC", "gtp.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
6115 { &hf_gtp_ranap_cause, { "RANAP cause", "gtp.ranap_cause", FT_UINT8, BASE_DEC, VALS(ranap_cause_type), 0, "RANAP cause", HFILL }},
6116 { &hf_gtp_recovery, { "Recovery", "gtp.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
6117 { &hf_gtp_reorder, { "Reordering required","gtp.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
6118 { &hf_gtp_rnc_ipv4, { "RNC address IPv4", "gtp.rnc_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Radio Network Controller address IPv4", HFILL }},
6119 { &hf_gtp_rnc_ipv6, { "RNC address IPv6", "gtp.rnc_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Radio Network Controller address IPv6", HFILL }},
6120 { &hf_gtp_rp, { "Radio Priority", "gtp.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL }},
6121 { &hf_gtp_rp_nsapi, { "NSAPI in Radio Priority", "gtp.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK, "Network layer Service Access Point Identifier in Radio Priority", HFILL }},
6122 { &hf_gtp_rp_sms, { "Radio Priority SMS", "gtp.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL }},
6123 { &hf_gtp_rp_spare, { "Reserved", "gtp.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL }},
6124 { &hf_gtp_sel_mode, { "Selection mode", "gtp.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
6125 { &hf_gtp_seq_number, { "Sequence number", "gtp.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
6126 { &hf_gtp_sndcp_number, { "SNDCP N-PDU LLC Number", "gtp.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, "SNDCP N-PDU LLC Number", HFILL }},
6127 { &hf_gtp_tear_ind, { "Teardown Indicator", "gtp.tear_ind", FT_BOOLEAN, BASE_NONE,NULL, 0, "Teardown Indicator", HFILL }},
6128 { &hf_gtp_teid, { "TEID", "gtp.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL }},
6129 { &hf_gtp_teid_cp, { "TEID Control Plane", "gtp.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL }},
6130 { &hf_gtp_ulink_teid_cp, { "Uplink TEID Control Plane", "gtp.ulink_teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Uplink Tunnel Endpoint Identifier Control Plane", HFILL }},
6131 { &hf_gtp_teid_data, { "TEID Data I", "gtp.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL }},
6132 { &hf_gtp_ulink_teid_data, { "Uplink TEID Data I", "gtp.ulink_teid_data", FT_UINT32, BASE_HEX, NULL, 0, "UplinkTunnel Endpoint Identifier Data I", HFILL }},
6133 { &hf_gtp_teid_ii, { "TEID Data II", "gtp.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL }},
6134 { &hf_gtp_tft_code, { "TFT operation code", "gtp.tft_code", FT_UINT8, BASE_DEC, VALS (tft_code_type), GTPv1_TFT_CODE_MASK, "TFT operation code", HFILL }},
6135 { &hf_gtp_tft_spare, { "TFT spare bit", "gtp.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, "TFT spare bit", HFILL }},
6136 { &hf_gtp_tft_number, { "Number of packet filters", "gtp.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, "Number of packet filters", HFILL }},
6137 { &hf_gtp_tft_eval, { "Evaluation precedence", "gtp.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, "Evaluation precedence", HFILL }},
6138 { &hf_gtp_tid, { "TID", "gtp.tid", FT_STRING, BASE_DEC, NULL, 0, "Tunnel Identifier", HFILL }},
6139 { &hf_gtp_tlli, { "TLLI", "gtp.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
6140 { &hf_gtp_tr_comm, { "Packet transfer command", "gtp.tr_comm", FT_UINT8, BASE_DEC, VALS (tr_comm_type), 0, "Packat transfer command", HFILL }},
6141 { &hf_gtp_trace_ref, { "Trace reference", "gtp.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, "Trace reference", HFILL }},
6142 { &hf_gtp_trace_type, { "Trace type", "gtp.trace_type", FT_UINT16, BASE_HEX, NULL, 0, "Trace type", HFILL }},
6143 { &hf_gtp_unknown, { "Unknown data (length)", "gtp.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
6144 { &hf_gtp_user_addr_pdp_org, { "PDP type organization", "gtp.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, "PDP type organization", HFILL }},
6145 { &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 }},
6146 { &hf_gtp_user_ipv4, { "End user address IPv4", "gtp.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
6147 { &hf_gtp_user_ipv6, { "End user address IPv6", "gtp.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
6148 { &hf_gtp_security_mode,
6149 { "Security Mode", "gtp.security_mode",
6150 FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
6151 "Security Mode", HFILL }
6153 { &hf_gtp_no_of_vectors,
6154 { "No of Vectors", "gtp.no_of_vectors",
6155 FT_UINT8, BASE_DEC, NULL, 0x38,
6156 "No of Vectors", HFILL }
6158 { &hf_gtp_cipher_algorithm,
6159 { "Cipher Algorithm", "gtp.no_of_vectors",
6160 FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
6161 "Cipher Algorithm", HFILL }
6164 { "Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
6165 FT_UINT8, BASE_DEC, NULL, 0x07,
6169 { "Ciphering Key Sequence Number (CKSN)", "gtp.cksn_ksi",
6170 FT_UINT8, BASE_DEC, NULL, 0x07,
6174 { "Key Set Identifier (KSI)", "gtp.cksn_ksi",
6175 FT_UINT8, BASE_DEC, NULL, 0x07,
6178 { &hf_gtp_ext_length,
6179 { "Length", "gtp.ext_length",
6180 FT_UINT16, BASE_DEC, NULL, 0x0,
6181 "IE Length", HFILL }
6183 { &hf_gtp_ext_apn_res,
6184 { "Restriction Type", "gtp.ext_apn_res",
6185 FT_UINT8, BASE_DEC, NULL, 0x0,
6186 "Restriction Type", HFILL }
6188 { &hf_gtp_ext_rat_type,
6189 { "RAT Type", "gtp.ext_rat_type",
6190 FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
6193 { &hf_gtp_ext_geo_loc_type,
6194 { "Geographic Location Type", "gtp.ext_geo_loc_type",
6195 FT_UINT8, BASE_DEC, NULL, 0x0,
6196 "Geographic Location Type", HFILL }
6199 { "SAC", "gtp.ext_sac",
6200 FT_UINT16, BASE_HEX, NULL, 0x0,
6203 { &hf_gtp_ext_imeisv,
6204 { "IMEI(SV)", "gtp.ext_imeisv",
6205 FT_STRING, BASE_NONE, NULL, 0x0,
6209 { "TargetID", "gtp.targetid",
6210 FT_UINT32, BASE_DEC, VALS(ranap_TargetID_vals), 0,
6211 "TargetID", HFILL }},
6212 { &hf_gtp_bssgp_cause,
6213 { "BSSGP Cause", "gtp.bssgp_cause",
6214 FT_UINT8, BASE_DEC, VALS(tab_cause), 0,
6215 "BSSGP Cause", HFILL }},
6216 { &hf_gtp_cmn_flg_ppc,
6217 { "Prohibit Payload Compression", "gtp.cmn_flg.ppc",
6218 FT_BOOLEAN, 8, NULL, 0x01,
6219 "Prohibit Payload Compression", HFILL}},
6220 { &hf_gtp_cmn_flg_mbs_srv_type,
6221 { "MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
6222 FT_BOOLEAN, 8, NULL, 0x02,
6223 "MBMS Service Type", HFILL}},
6224 { &hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
6225 { "RAN Procedures Ready", "gtp.cmn_flg.ran_pcd_rd",
6226 FT_BOOLEAN, 8, NULL, 0x04,
6227 "RAN Procedures Ready", HFILL}},
6228 { &hf_gtp_cmn_flg_mbs_cnt_inf,
6229 { "MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
6230 FT_BOOLEAN, 8, NULL, 0x08,
6231 "MBMS Counting Information", HFILL}},
6232 { &hf_gtp_cmn_flg_nrsn,
6233 { "NRSN bit field", "gtp.cmn_flg.nrsn",
6234 FT_BOOLEAN, 8, NULL, 0x10,
6235 "NRSN bit field", HFILL}},
6236 { &hf_gtp_cmn_flg_no_qos_neg,
6237 { "No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
6238 FT_BOOLEAN, 8, NULL, 0x20,
6239 "No QoS negotiation", HFILL}},
6240 { &hf_gtp_cmn_flg_upgrd_qos_sup,
6241 { "Upgrade QoS Supported", "gtp.cmn_flg.ran_pcd_rd",
6242 FT_BOOLEAN, 8, NULL, 0x40,
6243 "Upgrade QoS Supported", HFILL}},
6245 { "Temporary Mobile Group Identity (TMGI)", "gtp.cmn_flg.ran_pcd_rd",
6246 FT_BYTES, BASE_HEX, NULL, 0x0,
6247 "Temporary Mobile Group Identity (TMGI)", HFILL}},
6248 { &hf_gtp_no_of_mbms_sa_codes,
6249 { "Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
6250 FT_UINT8, BASE_DEC, NULL, 0x0,
6251 "Number N of MBMS service area codes", HFILL }
6253 { &hf_gtp_mbms_ses_dur_days,
6254 { "Estimated session duration days", "gtp.mbms_ses_dur_days",
6255 FT_UINT8, BASE_DEC, NULL, 0xfe,
6256 "Estimated session duration days", HFILL }
6258 { &hf_gtp_mbms_ses_dur_s,
6259 { "Estimated session duration seconds", "gtp.mbms_ses_dur_s",
6260 FT_UINT24, BASE_DEC, NULL, 0x01ffff,
6261 "Estimated session duration seconds", HFILL }
6263 { &hf_gtp_mbms_sa_code,
6264 { "MBMS service area code", "gtp.mbms_sa_code",
6265 FT_UINT16, BASE_DEC, NULL, 0x0,
6266 "MBMS service area code", HFILL }
6268 { &hf_gtp_mbs_2g_3g_ind,
6269 { "MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
6270 FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
6271 "MBMS 2G/3G Indicator", HFILL }
6273 { &hf_gtp_time_2_dta_tr,
6274 { "Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
6275 FT_UINT8, BASE_DEC, NULL, 0x0,
6276 "Time to MBMS Data Transfer", HFILL }
6280 static gint *ett_gtp_array[] = {
6290 &ett_gtp_pkt_flow_id,
6312 &ett_gtp_ext_tree_apn_res,
6313 &ett_gtp_ext_rat_type,
6314 &ett_gtp_ext_imeisv,
6315 &ett_gtp_ext_ran_tr_cont,
6316 &ett_gtp_ext_pdp_cont_prio,
6317 &ett_gtp_ext_ssgn_no,
6318 &ett_gtp_ext_rab_setup_inf,
6319 &ett_gtp_ext_common_flgs,
6320 &ett_gtp_ext_usr_loc_inf,
6321 &ett_gtp_ext_ms_time_zone,
6322 &ett_gtp_ext_camel_chg_inf_con,
6323 &ett_GTP_EXT_MBMS_UE_CTX,
6326 &ett_gtp_ext_rim_ra,
6327 &ett_gtp_ext_mbms_prot_conf_opt,
6328 &ett_gtp_ext_mbms_sa,
6329 &ett_gtp_ext_bms_ses_dur,
6330 &ett_gtp_ext_src_rnc_pdp_ctx_inf,
6331 &ett_gtp_ext_add_trs_inf,
6332 &ett_gtp_ext_hop_count,
6333 &ett_gtp_ext_sel_plmn_id,
6334 &ett_gtp_ext_mbms_ses_id,
6335 &ett_gtp_ext_mbms_2g_3g_ind,
6336 &ett_gtp_ext_enh_nsapi,
6337 &ett_gtp_ext_ad_mbms_trs_inf,
6338 &ett_gtp_ext_mbms_ses_id_rep_no,
6339 &ett_gtp_ext_mbms_time_to_data_tr,
6340 &ett_gtp_ext_ps_ho_req_ctx,
6341 &ett_gtp_ext_bss_cont,
6342 &ett_gtp_ext_cell_id,
6343 &ett_gtp_ext_pdu_no,
6344 &ett_gtp_ext_bssgp_cause,
6345 &ett_gtp_ext_ra_prio_lcs,
6347 &ett_gtp_utran_cont,
6350 module_t *gtp_module;
6352 proto_gtp = proto_register_protocol ("GPRS Tunneling Protocol", "GTP", "gtp");
6353 proto_register_field_array (proto_gtp, hf_gtp, array_length (hf_gtp));
6354 proto_register_subtree_array (ett_gtp_array, array_length (ett_gtp_array));
6356 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
6358 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 port", "GTPv0 port (default 3386)", 10, &g_gtpv0_port);
6359 prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 control plane (GTP-C) port", "GTPv1 control plane port (default 2123)", 10, &g_gtpv1c_port);
6360 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10, &g_gtpv1u_port);
6361 prefs_register_bool_preference(gtp_module, "dissect_tpdu", "Dissect T-PDU", "Dissect T-PDU", >p_tpdu);
6363 prefs_register_obsolete_preference (gtp_module, "v0_dissect_cdr_as");
6364 prefs_register_obsolete_preference (gtp_module, "v0_check_etsi");
6365 prefs_register_obsolete_preference (gtp_module, "v1_check_etsi");
6366 prefs_register_bool_preference (gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", >p_etsi_order);
6367 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
6369 /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
6370 * The preference is set to TRUE by default forbackward compatibility
6372 prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", >p_over_tcp);
6374 register_dissector("gtp", dissect_gtp, proto_gtp);
6378 proto_reg_handoff_gtp(void)
6380 static int Initialized = FALSE;
6381 static dissector_handle_t gtp_handle;
6385 gtp_handle = find_dissector("gtp");
6386 ppp_subdissector_table = find_dissector_table("ppp.protocol");
6388 radius_register_avp_dissector(VENDOR_THE3GPP,5,dissect_radius_qos_umts);
6392 dissector_delete ("udp.port", gtpv0_port, gtp_handle);
6393 dissector_delete ("udp.port", gtpv1c_port, gtp_handle);
6394 dissector_delete ("udp.port", gtpv1u_port, gtp_handle);
6396 if ( !gtp_over_tcp ) {
6397 dissector_delete ("tcp.port", gtpv0_port, gtp_handle);
6398 dissector_delete ("tcp.port", gtpv1c_port, gtp_handle);
6399 dissector_delete ("tcp.port", gtpv1u_port, gtp_handle);
6404 gtpv0_port = g_gtpv0_port;
6405 gtpv1c_port = g_gtpv1c_port;
6406 gtpv1u_port = g_gtpv1u_port;
6408 dissector_add ("udp.port", g_gtpv0_port, gtp_handle);
6409 dissector_add ("udp.port", g_gtpv1c_port, gtp_handle);
6410 dissector_add ("udp.port", g_gtpv1u_port, gtp_handle);
6413 if ( gtp_over_tcp ) {
6414 dissector_add ("tcp.port", g_gtpv0_port, gtp_handle);
6415 dissector_add ("tcp.port", g_gtpv1c_port, gtp_handle);
6416 dissector_add ("tcp.port", g_gtpv1u_port, gtp_handle);
6419 ip_handle = find_dissector("ip");
6420 ipv6_handle = find_dissector("ipv6");
6421 ppp_handle = find_dissector("ppp");
6422 data_handle = find_dissector("data");
6423 gtpcdr_handle = find_dissector("gtpcdr");
6424 bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
6425 /* AVP Code: 904 MBMS-Session-Duration */
6426 dissector_add("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
6427 /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
6428 dissector_add("diameter.3gpp", 911, new_create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));