3 * Routines for GTP dissection
4 * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
5 * Nicolas Balkota <balkota@mac.com>
7 * $Id: packet-gtp.c,v 1.28 2002/05/10 23:20:38 guy Exp $
9 * Ethereal - Network traffic analyzer
10 * By Gerald Combs <gerald@ethereal.com>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 #ifdef HAVE_SYS_TYPES_H
37 # include <sys/types.h>
40 #ifdef HAVE_NETINET_IN_H
41 # include <netinet/in.h>
46 #ifdef NEED_SNPRINTF_H
47 # include "snprintf.h"
50 #include <epan/packet.h>
51 #include "packet-ipv6.h"
55 * All data related to GTP v0 (GPRS) uses "gtpv0" or "GTPv0",
56 * all data related to GTP v1 (UMTS) uses "gtpv1" or "GTPv1",
57 * if there is any gtp alone statement it means that this data is common
58 * for both: GPRS and UMTS
61 #define GTPv0_PORT 3386
62 #define GTPv1C_PORT 2123 /* 3G Control PDU */
63 #define GTPv1U_PORT 2152 /* 3G T-PDU */
65 #define GTPv0_HDR_LENGTH 20
66 #define GTPv1_HDR_LENGTH 12
68 /* for function checking compliance with ETSI */
73 static int g_gtpv0_port = GTPv0_PORT;
74 static int g_gtpv1c_port = GTPv1C_PORT;
75 static int g_gtpv1u_port = GTPv1U_PORT;
77 void proto_reg_handoff_gtp(void);
79 static int proto_gtpv0 = -1;
80 static int proto_gtpv1 = -1;
82 static int hf_gtpv0_flags = -1;
83 static int hf_gtpv0_flags_ver = -1;
84 static int hf_gtpv0_flags_pt = -1;
85 static int hf_gtpv0_flags_spare = -1;
86 #ifdef GTP_UNUSED_HANDLES
87 static int hf_gtpv0_flags_e = -1;
88 static int hf_gtpv0_flags_s = -1;
89 static int hf_gtpv0_flags_pn = -1;
91 static int hf_gtpv0_flags_snn = -1;
92 static int hf_gtpv0_message_type = -1;
93 static int hf_gtpv0_length = -1;
94 static int hf_gtpv0_seq_number = -1;
95 static int hf_gtpv0_flow_label = -1;
96 static int hf_gtpv0_sndcp_number = -1;
97 #ifdef GTP_UNUSED_HANDLES
98 static int hf_gtpv0_npdu_number = -1;
100 static int hf_gtpv0_tid = -1;
101 #ifdef GTP_UNUSED_HANDLES
102 static int hf_gtpv0_teid = -1;
103 static int hf_gtpv0_next = -1;
105 static int hf_gtpv0_cause = -1;
106 static int hf_gtpv0_imsi = -1;
107 static int hf_gtpv0_rai_mcc = -1;
108 static int hf_gtpv0_rai_mnc = -1;
109 static int hf_gtpv0_rai_rac = -1;
110 static int hf_gtpv0_rai_lac = -1;
111 static int hf_gtpv0_tlli = -1;
112 static int hf_gtpv0_ptmsi = -1;
113 static int hf_gtpv0_qos_spare1 = -1;
114 static int hf_gtpv0_qos_delay = -1;
115 static int hf_gtpv0_qos_mean = -1;
116 static int hf_gtpv0_qos_peak = -1;
117 static int hf_gtpv0_qos_spare2 = -1;
118 static int hf_gtpv0_qos_precedence = -1;
119 static int hf_gtpv0_qos_spare3 = -1;
120 static int hf_gtpv0_qos_reliability = -1;
121 static int hf_gtpv0_reorder = -1;
122 static int hf_gtpv0_map_cause = -1;
123 static int hf_gtpv0_ptmsi_sig = -1;
124 static int hf_gtpv0_ms_valid = -1;
125 static int hf_gtpv0_recovery = -1;
126 static int hf_gtpv0_sel_mode = -1;
127 static int hf_gtpv0_ext_flow_label = -1;
128 #ifdef GTP_UNUSED_HANDLES
129 static int hf_gtpv0_teid_data = -1; /* 3G */
131 static int hf_gtpv0_flow_sig = -1;
132 #ifdef GTP_UNUSED_HANDLES
133 static int hf_gtpv0_teid_cp = -1; /* 3G */
135 static int hf_gtpv0_nsapi = -1;
136 static int hf_gtpv0_flow_ii = -1;
137 #ifdef GTP_UNUSED_HANDLES
138 static int hf_gtpv0_teid_ii = -1; /* 3G */
140 static int hf_gtpv0_ms_reason = -1;
141 #ifdef GTP_UNUSED_HANDLES
142 static int hf_gtpv0_tear_ind = -1; /* 3G */
143 static int hf_gtpv0_ranap_cause = -1; /* 3G */
144 static int hf_gtpv0_rab_gtpu_dn = -1; /* 3G */
145 static int hf_gtpv0_rab_gtpu_up = -1; /* 3G */
146 static int hf_gtpv0_rab_pdu_dn = -1; /* 3G */
147 static int hf_gtpv0_rab_pdu_up = -1; /* 3G */
148 static int hf_gtpv0_rp_sms = -1; /* 3G */
149 static int hf_gtpv0_rp_spare = -1; /* 3G */
150 static int hf_gtpv0_rp_nsapi = -1; /* 3G */
151 static int hf_gtpv0_rp = -1; /* 3G */
152 static int hf_gtpv0_pkt_flow_id = -1; /* 3G */
153 static int hf_gtpv0_chrg_char_s = -1; /* 3G */
154 static int hf_gtpv0_chrg_char_n = -1; /* 3G */
155 static int hf_gtpv0_chrg_char_p = -1; /* 3G */
156 static int hf_gtpv0_chrg_char_f = -1; /* 3G */
157 static int hf_gtpv0_chrg_char_h = -1; /* 3G */
158 static int hf_gtpv0_chrg_char_r = -1; /* 3G */
159 static int hf_gtpv0_trace_ref = -1; /* 3G */
160 static int hf_gtpv0_trace_type = -1; /* 3G */
162 static int hf_gtpv0_tr_comm = -1; /* charging */
163 static int hf_gtpv0_chrg_id = -1;
164 static int hf_gtpv0_user_ipv4 = -1;
165 static int hf_gtpv0_user_ipv6 = -1;
166 static int hf_gtpv0_user_addr_pdp_org = -1;
167 static int hf_gtpv0_user_addr_pdp_type = -1;
168 static int hf_gtpv0_apn = -1;
169 static int hf_gtpv0_gsn_ipv4 = -1;
170 static int hf_gtpv0_gsn_ipv6 = -1;
171 static int hf_gtpv0_gsn_addr_type = -1;
172 static int hf_gtpv0_gsn_addr_len = -1;
173 static int hf_gtpv0_msisdn = -1;
174 #ifdef GTP_UNUSED_HANDLES
175 static int hf_gtpv0_qos_al_ret_priority = -1;
176 static int hf_gtpv0_qos_traf_class = -1;
177 static int hf_gtpv0_qos_del_order = -1;
178 static int hf_gtpv0_qos_del_err_sdu = -1;
179 static int hf_gtpv0_qos_max_sdu_size = -1;
180 static int hf_gtpv0_qos_max_ul = -1;
181 static int hf_gtpv0_qos_max_dl = -1;
182 static int hf_gtpv0_qos_res_ber = -1;
183 static int hf_gtpv0_qos_sdu_err_ratio = -1;
184 static int hf_gtpv0_qos_trans_delay = -1;
185 static int hf_gtpv0_qos_traf_handl_prio = -1;
186 static int hf_gtpv0_qos_guar_ul = -1;
187 static int hf_gtpv0_qos_guar_dl = -1;
188 static int hf_gtpv0_rnc_ipv4 = -1;
189 static int hf_gtpv0_rnc_ipv6 = -1;
191 static int hf_gtpv0_chrg_ipv4 = -1;
192 static int hf_gtpv0_chrg_ipv6 = -1;
193 static int hf_gtpv0_node_ipv4 = -1;
194 static int hf_gtpv0_node_ipv6 = -1;
195 static int hf_gtpv0_ext_id = -1;
196 static int hf_gtpv0_ext_val = -1;
197 static int hf_gtpv0_unknown = -1;
199 static int hf_gtpv1_flags = -1;
200 static int hf_gtpv1_flags_ver = -1;
201 static int hf_gtpv1_flags_pt = -1;
202 static int hf_gtpv1_flags_spare = -1;
203 static int hf_gtpv1_flags_e = -1;
204 static int hf_gtpv1_flags_s = -1;
205 static int hf_gtpv1_flags_pn = -1;
206 #ifdef GTP_UNUSED_HANDLES
207 static int hf_gtpv1_flags_snn = -1;
209 static int hf_gtpv1_message_type = -1;
210 static int hf_gtpv1_length = -1;
211 static int hf_gtpv1_seq_number = -1;
212 #ifdef GTP_UNUSED_HANDLES
213 static int hf_gtpv1_flow_label = -1;
214 static int hf_gtpv1_sndcp_number = -1;
216 static int hf_gtpv1_npdu_number = -1;
217 #ifdef GTP_UNUSED_HANDLES
218 static int hf_gtpv1_tid = -1;
220 static int hf_gtpv1_teid = -1;
221 static int hf_gtpv1_next = -1;
222 static int hf_gtpv1_cause = -1;
223 static int hf_gtpv1_imsi = -1;
224 static int hf_gtpv1_rai_mcc = -1;
225 static int hf_gtpv1_rai_mnc = -1;
226 static int hf_gtpv1_rai_rac = -1;
227 static int hf_gtpv1_rai_lac = -1;
228 static int hf_gtpv1_tlli = -1;
229 static int hf_gtpv1_ptmsi = -1;
230 static int hf_gtpv1_qos_spare1 = -1;
231 static int hf_gtpv1_qos_delay = -1;
232 static int hf_gtpv1_qos_mean = -1;
233 static int hf_gtpv1_qos_peak = -1;
234 static int hf_gtpv1_qos_spare2 = -1;
235 static int hf_gtpv1_qos_precedence = -1;
236 static int hf_gtpv1_qos_spare3 = -1;
237 static int hf_gtpv1_qos_reliability = -1;
238 static int hf_gtpv1_reorder = -1;
239 static int hf_gtpv1_map_cause = -1;
240 static int hf_gtpv1_ptmsi_sig = -1;
241 static int hf_gtpv1_ms_valid = -1;
242 static int hf_gtpv1_recovery = -1;
243 static int hf_gtpv1_sel_mode = -1;
244 #ifdef GTP_UNUSED_HANDLES
245 static int hf_gtpv1_ext_flow_label = -1;
247 static int hf_gtpv1_teid_data = -1; /* 3G */
248 #ifdef GTP_UNUSED_HANDLES
249 static int hf_gtpv1_flow_sig = -1;
251 static int hf_gtpv1_teid_cp = -1; /* 3G */
252 static int hf_gtpv1_nsapi = -1;
253 #ifdef GTP_UNUSED_HANDLES
254 static int hf_gtpv1_flow_ii = -1;
256 static int hf_gtpv1_teid_ii = -1; /* 3G */
257 static int hf_gtpv1_ms_reason = -1;
258 static int hf_gtpv1_tear_ind = -1; /* 3G */
259 static int hf_gtpv1_ranap_cause = -1; /* 3G */
260 static int hf_gtpv1_rab_gtpu_dn = -1; /* 3G */
261 static int hf_gtpv1_rab_gtpu_up = -1; /* 3G */
262 static int hf_gtpv1_rab_pdu_dn = -1; /* 3G */
263 static int hf_gtpv1_rab_pdu_up = -1; /* 3G */
264 static int hf_gtpv1_rp_sms = -1; /* 3G */
265 static int hf_gtpv1_rp_spare = -1; /* 3G */
266 static int hf_gtpv1_rp_nsapi = -1; /* 3G */
267 static int hf_gtpv1_rp = -1; /* 3G */
268 static int hf_gtpv1_pkt_flow_id = -1; /* 3G */
269 static int hf_gtpv1_chrg_char_s = -1; /* 3G */
270 static int hf_gtpv1_chrg_char_n = -1; /* 3G */
271 static int hf_gtpv1_chrg_char_p = -1; /* 3G */
272 static int hf_gtpv1_chrg_char_f = -1; /* 3G */
273 static int hf_gtpv1_chrg_char_h = -1; /* 3G */
274 static int hf_gtpv1_chrg_char_r = -1; /* 3G */
275 static int hf_gtpv1_trace_ref = -1; /* 3G */
276 static int hf_gtpv1_trace_type = -1; /* 3G */
277 static int hf_gtpv1_tr_comm = -1; /* charging */
278 static int hf_gtpv1_chrg_id = -1;
279 static int hf_gtpv1_user_ipv4 = -1;
280 static int hf_gtpv1_user_ipv6 = -1;
281 static int hf_gtpv1_user_addr_pdp_org = -1;
282 static int hf_gtpv1_user_addr_pdp_type = -1;
283 static int hf_gtpv1_apn = -1;
284 static int hf_gtpv1_gsn_ipv4 = -1;
285 static int hf_gtpv1_gsn_ipv6 = -1;
286 static int hf_gtpv1_gsn_addr_type = -1;
287 static int hf_gtpv1_gsn_addr_len = -1;
288 static int hf_gtpv1_msisdn = -1;
289 static int hf_gtpv1_qos_al_ret_priority = -1;
290 static int hf_gtpv1_qos_traf_class = -1;
291 static int hf_gtpv1_qos_del_order = -1;
292 static int hf_gtpv1_qos_del_err_sdu = -1;
293 static int hf_gtpv1_qos_max_sdu_size = -1;
294 static int hf_gtpv1_qos_max_ul = -1;
295 static int hf_gtpv1_qos_max_dl = -1;
296 static int hf_gtpv1_qos_res_ber = -1;
297 static int hf_gtpv1_qos_sdu_err_ratio = -1;
298 static int hf_gtpv1_qos_trans_delay = -1;
299 static int hf_gtpv1_qos_traf_handl_prio = -1;
300 static int hf_gtpv1_qos_guar_ul = -1;
301 static int hf_gtpv1_qos_guar_dl = -1;
302 static int hf_gtpv1_rnc_ipv4 = -1;
303 static int hf_gtpv1_rnc_ipv6 = -1;
304 static int hf_gtpv1_chrg_ipv4 = -1;
305 static int hf_gtpv1_chrg_ipv6 = -1;
306 static int hf_gtpv1_node_ipv4 = -1;
307 static int hf_gtpv1_node_ipv6 = -1;
308 static int hf_gtpv1_ext_id = -1;
309 static int hf_gtpv1_ext_val = -1;
310 static int hf_gtpv1_unknown = -1;
312 /* Initialize the subtree pointers */
313 static gint ett_gtp = -1;
314 static gint ett_gtp_flags = -1;
315 static gint ett_gtp_ext = -1;
316 static gint ett_gtp_rai = -1;
317 static gint ett_gtp_qos = -1;
318 static gint ett_gtp_auth_tri = -1;
319 static gint ett_gtp_flow_ii = -1;
320 static gint ett_gtp_rab_cntxt = -1;
321 static gint ett_gtp_rp = -1;
322 static gint ett_gtp_pkt_flow_id = -1;
323 static gint ett_gtp_chrg_char = -1;
324 static gint ett_gtp_user = -1;
325 static gint ett_gtp_mm = -1;
326 static gint ett_gtp_trip = -1;
327 static gint ett_gtp_quint = -1;
328 static gint ett_gtp_pdp = -1;
329 static gint ett_gtp_apn = -1;
330 static gint ett_gtp_proto = -1;
331 static gint ett_gtp_gsn_addr = -1;
332 static gint ett_gtp_tft = -1;
333 static gint ett_gtp_tft_pf = -1;
334 static gint ett_gtp_rab_setup = -1;
335 static gint ett_gtp_hdr_list = -1;
336 static gint ett_gtp_chrg_addr = -1;
337 static gint ett_gtp_node_addr = -1;
338 static gint ett_gtp_rel_pack = -1;
339 static gint ett_gtp_can_pack = -1;
340 static gint ett_gtp_data_resp = -1;
341 static gint ett_gtp_priv_ext = -1;
343 /* Definition of user preferences panel fields */
344 #define DONT_DISSECT_CDRS 2
346 static gboolean gtp_tpdu = TRUE;
347 static gint gtpv0_cdr_as = DONT_DISSECT_CDRS; /* 2 = do not dissect */
348 static gboolean gtpv0_etsi_order = FALSE;
349 static gboolean gtpv1_etsi_order = FALSE;
350 static int gtpv0_port = 0;
351 static int gtpv1c_port = 0;
352 static int gtpv1u_port = 0;
353 static gboolean ppp_reorder = TRUE;
355 /* Definition of flags masks */
356 #define GTP_VER_MASK 0xE0
358 static const value_string ver_types[] = {
359 { 0, "GTP release 97/98 version" },
360 { 1, "GTP release 99 version" },
370 #define GTP_PT_MASK 0x10
371 #define GTP_SPARE_MASK 0x0E
372 #define GTPv1_SPARE_MASK 0x08
373 #define GTPv1_E_MASK 0x04
374 #define GTPv1_S_MASK 0x02
375 #define GTP_SNN_MASK 0x01
376 #define GTPv1_PN_MASK 0x01
378 /* Definition of 3G charging characteristics masks */
379 #define GTP_MASK_CHRG_CHAR_S 0xF000
380 #define GTP_MASK_CHRG_CHAR_N 0x0800
381 #define GTP_MASK_CHRG_CHAR_P 0x0400
382 #define GTP_MASK_CHRG_CHAR_F 0x0200
383 #define GTP_MASK_CHRG_CHAR_H 0x0100
384 #define GTP_MASK_CHRG_CHAR_R 0x00FF
387 /* Definition of GSN Address masks */
388 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
389 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
391 /* Definition of QoS masks */
392 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
393 #define GTP_EXT_QOS_DELAY_MASK 0x38
394 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
395 #define GTP_EXT_QOS_PEAK_MASK 0xF0
396 #define GTP_EXT_QOS_SPARE2_MASK 0x08
397 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
398 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
399 #define GTP_EXT_QOS_MEAN_MASK 0x1F
400 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
401 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
402 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
403 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
404 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
405 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
406 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
408 /* Definition of Radio Priority's masks */
409 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
410 #define GTPv1_EXT_RP_SPARE_MASK 0x08
411 #define GTPv1_EXT_RP_MASK 0x07
413 /* definitions of GTP messages */
414 #define GTP_MSG_UNKNOWN 0x00
415 #define GTP_MSG_ECHO_REQ 0x01
416 #define GTP_MSG_ECHO_RESP 0x02
417 #define GTP_MSG_VER_NOT_SUPP 0x03
418 #define GTP_MSG_NODE_ALIVE_REQ 0x04
419 #define GTP_MSG_NODE_ALIVE_RESP 0x05
420 #define GTP_MSG_REDIR_REQ 0x06
421 #define GTP_MSG_REDIR_RESP 0x07
422 #define GTP_MSG_CREATE_PDP_REQ 0x10
423 #define GTP_MSG_CREATE_PDP_RESP 0x11
424 #define GTP_MSG_UPDATE_PDP_REQ 0x12
425 #define GTP_MSG_UPDATE_PDP_RESP 0x13
426 #define GTP_MSG_DELETE_PDP_REQ 0x14
427 #define GTP_MSG_DELETE_PDP_RESP 0x15
428 #define GTP_MSG_CREATE_AA_PDP_REQ 0x16 /* 2G */
429 #define GTP_MSG_CREATE_AA_PDP_RESP 0x17 /* 2G */
430 #define GTP_MSG_DELETE_AA_PDP_REQ 0x18 /* 2G */
431 #define GTP_MSG_DELETE_AA_PDP_RESP 0x19 /* 2G */
432 #define GTP_MSG_ERR_IND 0x1A
433 #define GTP_MSG_PDU_NOTIFY_REQ 0x1B
434 #define GTP_MSG_PDU_NOTIFY_RESP 0x1C
435 #define GTP_MSG_PDU_NOTIFY_REJ_REQ 0x1D
436 #define GTP_MSG_PDU_NOTIFY_REJ_RESP 0x1E
437 #define GTP_MSG_SUPP_EXT_HDR 0x1F
438 #define GTP_MSG_SEND_ROUT_INFO_REQ 0x20
439 #define GTP_MSG_SEND_ROUT_INFO_RESP 0x21
440 #define GTP_MSG_FAIL_REP_REQ 0x22
441 #define GTP_MSG_FAIL_REP_RESP 0x23
442 #define GTP_MSG_MS_PRESENT_REQ 0x24
443 #define GTP_MSG_MS_PRESENT_RESP 0x25
444 #define GTP_MSG_IDENT_REQ 0x30
445 #define GTP_MSG_IDENT_RESP 0x31
446 #define GTP_MSG_SGSN_CNTXT_REQ 0x32
447 #define GTP_MSG_SGSN_CNTXT_RESP 0x33
448 #define GTP_MSG_SGSN_CNTXT_ACK 0x34
449 #define GTP_MSG_FORW_RELOC_REQ 0x35
450 #define GTP_MSG_FORW_RELOC_RESP 0x36
451 #define GTP_MSG_FORW_RELOC_COMP 0x37
452 #define GTP_MSG_RELOC_CANCEL_REQ 0x38
453 #define GTP_MSG_RELOC_CANCEL_RESP 0x39
454 #define GTP_MSG_FORW_SRNS_CNTXT 0x3A
455 #define GTP_MSG_FORW_RELOC_ACK 0x3B
456 #define GTP_MSG_FORW_SRNS_CNTXT_ACK 0x3C
457 #define GTP_MSG_DATA_TRANSF_REQ 0xF0
458 #define GTP_MSG_DATA_TRANSF_RESP 0xF1
459 #define GTP_MSG_TPDU 0xFF
461 static const value_string message_type[] = {
462 { GTP_MSG_UNKNOWN, "For future use" },
463 { GTP_MSG_ECHO_REQ, "Echo request" },
464 { GTP_MSG_ECHO_RESP, "Echo response" },
465 { GTP_MSG_VER_NOT_SUPP, "Version not supported" },
466 { GTP_MSG_NODE_ALIVE_REQ, "Node alive request" },
467 { GTP_MSG_NODE_ALIVE_RESP, "Node alive response" },
468 { GTP_MSG_REDIR_REQ, "Redirection request" },
469 { GTP_MSG_REDIR_RESP, "Redirection response" },
470 { GTP_MSG_CREATE_PDP_REQ, "Create PDP context request" },
471 { GTP_MSG_CREATE_PDP_RESP, "Create PDP context response" },
472 { GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request" },
473 { GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response" },
474 { GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request" },
475 { GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response" },
476 { GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request" },
477 { GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response" },
478 { GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request" },
479 { GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response" },
480 { GTP_MSG_ERR_IND, "Error indication" },
481 { GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request" },
482 { GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response" },
483 { GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request" },
484 { GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response" },
485 { GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification" },
486 { GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request" },
487 { GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response" },
488 { GTP_MSG_FAIL_REP_REQ, "Failure report request" },
489 { GTP_MSG_FAIL_REP_RESP, "Failure report response" },
490 { GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request" },
491 { GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response" },
492 { GTP_MSG_IDENT_REQ, "Identification request" },
493 { GTP_MSG_IDENT_RESP, "Identification response" },
494 { GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request" },
495 { GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response" },
496 { GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement" },
497 { GTP_MSG_FORW_RELOC_REQ, "Forward relocation request" },
498 { GTP_MSG_FORW_RELOC_RESP, "Forward relocation response" },
499 { GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete" },
500 { GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request" },
501 { GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response" },
502 { GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context" },
503 { GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge" },
504 { GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge" },
505 { GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request" },
506 { GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response" },
507 { GTP_MSG_TPDU, "T-PDU" },
511 /* definitions of fields in extension header */
512 #define GTP_EXT_CAUSE 0x01
513 #define GTP_EXT_IMSI 0x02
514 #define GTP_EXT_RAI 0x03
515 #define GTP_EXT_TLLI 0x04
516 #define GTP_EXT_PTMSI 0x05
517 #define GTP_EXT_QOS_GPRS 0x06
518 #define GTP_EXT_REORDER 0x08
519 #define GTP_EXT_AUTH_TRI 0x09
520 #define GTP_EXT_MAP_CAUSE 0x0B
521 #define GTP_EXT_PTMSI_SIG 0x0C
522 #define GTP_EXT_MS_VALID 0x0D
523 #define GTP_EXT_RECOVER 0x0E
524 #define GTP_EXT_SEL_MODE 0x0F
526 #define GTP_EXT_16 0x10
527 #define GTP_EXT_FLOW_LABEL 0x10
528 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
530 #define GTP_EXT_17 0x11
531 #define GTP_EXT_FLOW_SIG 0x11
532 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
534 #define GTP_EXT_18 0x12
535 #define GTP_EXT_FLOW_II 0x12
536 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G*/
538 #define GTP_EXT_19 0x13
539 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
540 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G*/
542 #define GTP_EXT_NSAPI 0x14 /* 3G */
543 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
544 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
545 #define GTP_EXT_RP_SMS 0x17 /* 3G */
546 #define GTP_EXT_RP 0x18 /* 3G */
547 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
548 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
549 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
550 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
551 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
552 #define GTP_EXT_TR_COMM 0x7E /* charging */
553 #define GTP_EXT_CHRG_ID 0x7F
554 #define GTP_EXT_USER_ADDR 0x80
555 #define GTP_EXT_MM_CNTXT 0x81
556 #define GTP_EXT_PDP_CNTXT 0x82
557 #define GTP_EXT_APN 0x83
558 #define GTP_EXT_PROTO_CONF 0x84
559 #define GTP_EXT_GSN_ADDR 0x85
560 #define GTP_EXT_MSISDN 0x86
561 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
562 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
563 #define GTP_EXT_TFT 0x89 /* 3G */
564 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
565 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
566 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
567 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
568 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G */
569 #define GTP_EXT_OMC_ID 0x8F /* 3G */
570 #define GTP_EXT_REL_PACK 0xF9 /* charging */
571 #define GTP_EXT_CAN_PACK 0xFA /* charging */
572 #define GTP_EXT_CHRG_ADDR 0xFB
573 #define GTP_EXT_DATA_REQ 0xFC /* charging */
574 #define GTP_EXT_DATA_RESP 0xFD /* charging */
575 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
576 #define GTP_EXT_PRIV_EXT 0xFF
578 static const value_string gtp_val[] = {
579 { GTP_EXT_CAUSE, "Cause of operation" },
580 { GTP_EXT_IMSI, "IMSI " },
581 { GTP_EXT_RAI, "Routing Area Identity" },
582 { GTP_EXT_TLLI, "Temporary Logical Link Identity" },
583 { GTP_EXT_PTMSI, "Packet TMSI" },
584 { GTP_EXT_QOS_GPRS, "Quality of Service" },
585 { GTP_EXT_REORDER, "Reorder required" },
586 { GTP_EXT_AUTH_TRI, "Authentication triplets" },
587 { GTP_EXT_MAP_CAUSE, "MAP cause" },
588 { GTP_EXT_PTMSI_SIG, "P-TMSI signature" },
589 { GTP_EXT_MS_VALID, "MS validated" },
590 { GTP_EXT_RECOVER, "Recovery" },
591 { GTP_EXT_SEL_MODE, "Selection mode" },
593 { GTP_EXT_16, "Flow label data I" },
594 { GTP_EXT_FLOW_LABEL, "Flow label data I" },
595 { GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I" }, /* 3G */
597 { GTP_EXT_17, "Flow label signalling" },
598 { GTP_EXT_FLOW_SIG, "Flow label signalling" },
599 { GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane" }, /* 3G */
601 { GTP_EXT_18, "Flow label data II" },
602 { GTP_EXT_FLOW_II, "Flow label data II" },
603 { GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II" }, /* 3G */
605 { GTP_EXT_19, "MS not reachable reason" },
606 { GTP_EXT_MS_REASON, "MS not reachable reason" },
607 { GTP_EXT_TEAR_IND, "Teardown ID" }, /* 3G */
609 { GTP_EXT_NSAPI, "NSAPI" }, /* 3G */
610 { GTP_EXT_RANAP_CAUSE, "RANAP cause" }, /* 3G */
611 { GTP_EXT_RAB_CNTXT, "RAB context" }, /* 3G */
612 { GTP_EXT_RP_SMS, "Radio Priority for MO SMS" }, /* 3G */
613 { GTP_EXT_RP, "Radio Priority" }, /* 3G */
614 { GTP_EXT_PKT_FLOW_ID, "Packet Flow ID " }, /* 3G */
615 { GTP_EXT_CHRG_CHAR, "Charging characteristics" }, /* 3G */
616 { GTP_EXT_TRACE_REF, "Trace references" }, /* 3G */
617 { GTP_EXT_TRACE_TYPE, "Trace type" }, /* 3G */
618 { GTPv1_EXT_MS_REASON, "MS not reachable reason" }, /* 3G */
619 { GTP_EXT_TR_COMM, "Packet transfer command" }, /* charging */
620 { GTP_EXT_CHRG_ID, "Charging ID" },
621 { GTP_EXT_USER_ADDR, "End user address " },
622 { GTP_EXT_MM_CNTXT, "MM context" },
623 { GTP_EXT_PDP_CNTXT, "PDP context" },
624 { GTP_EXT_APN, "Access Point Name" },
625 { GTP_EXT_PROTO_CONF, "Protocol configuration options" },
626 { GTP_EXT_GSN_ADDR, "GSN address" },
627 { GTP_EXT_MSISDN, "MS international PSTN/ISDN number" },
628 { GTP_EXT_QOS_UMTS, "Quality of service (UMTS)" }, /* 3G */
629 { GTP_EXT_AUTH_QUI, "Authentication quintuplets" }, /* 3G */
630 { GTP_EXT_TFT, "Traffic Flow Template (TFT)" }, /* 3G */
631 { GTP_EXT_TARGET_ID, "Target (RNC) identification" }, /* 3G */
632 { GTP_EXT_UTRAN_CONT, "UTRAN transparent field" }, /* 3G */
633 { GTP_EXT_RAB_SETUP, "RAB setup information" }, /* 3G */
634 { GTP_EXT_HDR_LIST, "Extension Header Types List " }, /* 3G */
635 { GTP_EXT_TRIGGER_ID, "Trigger Id " }, /* 3G */
636 { GTP_EXT_OMC_ID, "OMC Identity " }, /* 3G */
637 { GTP_EXT_REL_PACK, "Sequence numbers of released packets IE" }, /* charging */
638 { GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE" }, /* charging */
639 { GTP_EXT_CHRG_ADDR, "Charging Gateway address" },
640 { GTP_EXT_DATA_REQ, "Data record packet" }, /* charging */
641 { GTP_EXT_DATA_RESP, "Requests responded" }, /* charging */
642 { GTP_EXT_NODE_ADDR, "Address of recommended node" }, /* charging */
643 { GTP_EXT_PRIV_EXT, "Private Extension " },
647 /* GPRS: 9.60 v7.6.0, page 37
648 * UMTS: 29.060 v4.0, page 45
650 static const value_string cause_type[] = {
651 { 0, "Request IMSI" },
652 { 1, "Request IMEI" },
653 { 2, "Request IMSI and IMEI" },
654 { 3, "No identity needed" },
656 { 5, "MS is not GPRS responding" },
657 { 59, "System failure" }, /* charging */
658 { 60, "The transmit buffers are becoming full" }, /* charging */
659 { 61, "The receive buffers are becoming full" }, /* charging */
660 { 62, "Another node is about to go down" }, /* charging */
661 { 63, "This node is about to go down" }, /* charging */
662 { 128, "Request accepted" },
663 { 192, "Non-existent" },
664 { 193, "Invalid message format" },
665 { 194, "IMSI not known" },
666 { 195, "MS is GPRS detached" },
667 { 196, "MS is not GPRS responding" },
668 { 197, "MS refuses" },
669 { 198, "Version not supported" },
670 { 199, "No resource available" },
671 { 200, "Service not supported" },
672 { 201, "Mandatory IE incorrect" },
673 { 202, "Mandatory IE missing" },
674 { 203, "Optional IE incorrect" },
675 { 204, "System failure" },
676 { 205, "Roaming restriction" },
677 { 206, "P-TMSI signature mismatch" },
678 { 207, "GPRS connection suspended" },
679 { 208, "Authentication failure" },
680 { 209, "User authentication failed" },
681 { 210, "Context not found" },
682 { 211, "All PDP dynamic addresses are occupied" },
683 { 212, "No memory is available" },
684 { 213, "Relocation failure" },
685 { 214, "Unknown mandatory extension header" },
686 { 215, "Semantic error in the TFT operation" },
687 { 216, "Syntactic error in the TFT operation" },
688 { 217, "Semantic errors in packet filter(s)" },
689 { 218, "Syntactic errors in packet filter(s)" },
690 { 219, "Missing or unknown APN" },
691 { 220, "Unknown PDP address or PDP type" },
692 { 252, "Request related to possibly duplicated packets already fulfilled" }, /* charging */
693 { 253, "Request already fulfilled" }, /* charging */
694 { 254, "Sequence numbers of released/cancelled packets IE incorrect" }, /* charging */
695 { 255, "Request not fulfilled" }, /* charging */
700 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
701 * TODO: Check if all map_cause values are included
703 static const value_string map_cause_type[] = {
704 { 1, "Unknown subscriber" },
705 { 8, "Roaming not allowed" },
706 { 10, "Bearer service not provisioned" },
707 { 11, "Teleservice not provisioned" },
708 { 13, "Call barred" },
709 { 21, "Facility not supported" },
710 { 23, "Update GPRS location" },
711 { 24, "Send routing info for GPRS" },
712 { 26, "Note MS present for GPRS" },
713 { 27, "Absent subscriber" },
714 { 34, "System failure" },
715 { 35, "Data missing" },
716 { 36, "Unexpected data value" },
717 { 44, "Number chenged" },
718 { 45, "Busy subscriber" },
719 { 46, "No subscriber reply" },
720 { 48, "Facility not allowed" },
724 static const value_string gsn_addr_type[] = {
730 static const value_string pdp_type[] = {
733 { 0x02, "OSP:IHOSS" },
739 static const value_string pdp_org_type[] = {
745 static const value_string qos_delay_type[] = {
746 { 0x00, "Subsribed delay class (in MS to network direction)" },
747 { 0x01, "Delay class 1" },
748 { 0x02, "Delay class 2" },
749 { 0x03, "Delay class 3" },
750 { 0x04, "Delay class 4 (best effort)" },
751 { 0x07, "Reserved" },
755 static const value_string qos_reliability_type[] = {
756 { 0x00, "Subscribed reliability class (in MS to network direction)" },
757 { 0x01, "Ack GTP/LLC/RLC, Protected data" },
758 { 0x02, "Unack GTP, Ack LLC/RLC, Protected data" },
759 { 0x03, "Unack GTP/LLC, Ack RLC, Protected data" },
760 { 0x04, "Unack GTP/LLC/RLC, Protected data" },
761 { 0x05, "Unack GTP/LLC/RLC, Unprotected data" },
762 { 0x07, "Reserved" },
766 static const value_string qos_peak_type[] = {
767 { 0x00, "Subscribed peak throughput (in MS to network direction)" },
768 { 0x01, "Up to 1 000 oct/s" },
769 { 0x02, "Up to 2 000 oct/s" },
770 { 0x03, "Up to 4 000 oct/s" },
771 { 0x04, "Up to 8 000 oct/s" },
772 { 0x05, "Up to 16 000 oct/s" },
773 { 0x06, "Up to 32 000 oct/s" },
774 { 0x07, "Up to 64 000 oct/s" },
775 { 0x08, "Up to 128 000 oct/s" },
776 { 0x09, "Up to 256 000 oct/s" },
777 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
778 { 0x0A, "Reserved" },
779 { 0x0B, "Reserved" },
780 { 0x0C, "Reserved" },
781 { 0x0D, "Reserved" },
782 { 0x0E, "Reserved" },
783 { 0x0F, "Reserved" },
787 static const value_string qos_precedence_type[] = {
788 { 0x00, "Subscribed precedence (in MS to network direction)" },
789 { 0x01, "High priority" },
790 { 0x02, "Normal priority" },
791 { 0x03, "Low priority" },
792 { 0x07, "Reserved" },
796 static const value_string qos_mean_type[] = {
797 { 0x00, "Subscribed mean throughput (in MS to network direction)" },
798 { 0x01, "100 oct/h" }, /* Class 2 */
799 { 0x02, "200 oct/h" }, /* Class 3 */
800 { 0x03, "500 oct/h" }, /* Class 4 */
801 { 0x04, "1 000 oct/h" }, /* Class 5 */
802 { 0x05, "2 000 oct/h" }, /* Class 6 */
803 { 0x06, "5 000 oct/h" }, /* Class 7 */
804 { 0x07, "10 000 oct/h" }, /* Class 8 */
805 { 0x08, "20 000 oct/h" }, /* Class 9 */
806 { 0x09, "50 000 oct/h" }, /* Class 10 */
807 { 0x0A, "100 000 oct/h" }, /* Class 11 */
808 { 0x0B, "200 000 oct/h" }, /* Class 12 */
809 { 0x0C, "500 000 oct/h" }, /* Class 13 */
810 { 0x0D, "1 000 000 oct/h" }, /* Class 14 */
811 { 0x0E, "2 000 000 oct/h" }, /* Class 15 */
812 { 0x0F, "5 000 000 oct/h" }, /* Class 16 */
813 { 0x10, "10 000 000 oct/h" }, /* Class 17 */
814 { 0x11, "20 000 000 oct/h" }, /* Class 18 */
815 { 0x12, "50 000 000 oct/h" }, /* Class 19 */
816 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
817 { 0x13, "Reserved" },
818 { 0x14, "Reserved" },
819 { 0x15, "Reserved" },
820 { 0x16, "Reserved" },
821 { 0x17, "Reserved" },
822 { 0x18, "Reserved" },
823 { 0x19, "Reserved" },
824 { 0x1A, "Reserved" },
825 { 0x1B, "Reserved" },
826 { 0x1C, "Reserved" },
827 { 0x1D, "Reserved" },
828 { 0x1E, "Reserved" },
829 { 0x1F, "Best effort" }, /* Class 1 */
833 static const value_string qos_del_err_sdu[] = {
834 { 0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)" },
835 { 0x01, "No detect ('-')" },
836 { 0x02, "Erroneous SDUs are delivered ('yes')" },
837 { 0x03, "Erroneous SDUs are not delivered ('no')" },
838 { 0x07, "Reserved" }, /* All other values are reserved */
842 static const value_string qos_del_order[] = {
843 { 0x00, "Subscribed delivery order (in MS to network direction)" },
844 { 0x01, "With delivery order ('yes')" },
845 { 0x02, "Without delivery order ('no')" },
846 { 0x03, "Reserved" }, /* All other values are reserved */
850 static const value_string qos_traf_class[] = {
851 { 0x00, "Subscribed traffic class (in MS to network direction)" },
852 { 0x01, "Conversational class" },
853 { 0x02, "Streaming class" },
854 { 0x03, "Interactive class" },
855 { 0x04, "Background class" },
856 { 0x07, "Reserved" }, /* All other values are reserved */
860 static const value_string qos_max_sdu_size[] = {
861 { 0x00, "Subscribed maximum SDU size (in MS to network direction" },
862 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
863 { 0x97, "1502 octets" },
864 { 0x98, "1510 octets" },
865 { 0x99, "1520 octets" },
866 { 0, NULL } /* All other values are reserved */
869 static const value_string qos_max_ul[] = {
870 { 0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)" },
871 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
872 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
873 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
878 static const value_string qos_max_dl[] = {
879 { 0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)" },
880 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
881 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
882 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
887 static const value_string qos_res_ber[] = {
888 { 0x00, "Subscribed residual BER (in MS to network direction)" },
889 { 0x01, "1/20 = 5x10^-2" },
890 { 0x02, "1/100 = 1x10^-2" },
891 { 0x03, "1/200 = 5x10^-3" },
892 { 0x04, "1/250 = 4x10^-3" },
893 { 0x05, "1/1 000 = 1x10^-3" },
894 { 0x06, "1/10 000 = 1x10^-4" },
895 { 0x07, "1/100 000 = 1x10^-5" },
896 { 0x08, "1/1 000 000 = 1x10^-6" },
897 { 0x09, "3/50 000 000 = 6x10^-8" },
898 { 0x0F, "Reserved" }, /* All other values are reserved */
902 static const value_string qos_sdu_err_ratio[] = {
903 { 0x00, "Subscribed SDU error ratio (in MS to network direction)" },
904 { 0x01, "1/100 = 1x10^-2" },
905 { 0x02, "7/1000 = 7x10^-3" },
906 { 0x03, "1/1 000 = 1x10^-3" },
907 { 0x04, "1/10 000 = 1x10^-4" },
908 { 0x05, "1/100 000 = 1x10^-5" },
909 { 0x06, "1/1 000 000 = 1x10^-6" },
910 { 0x07, "1/10 = 1x10^-1" },
911 { 0x0F, "Reserved" }, /* All other values are reserved */
915 static const value_string qos_traf_handl_prio[] = {
916 { 0x00, "Subscribed traffic handling priority (in MS to network direction)" },
917 { 0x01, "Priority level 1" },
918 { 0x02, "Priority level 2" },
919 { 0x03, "Priority level 3" },
923 static const value_string qos_trans_delay[] = {
924 { 0x00, "Subscribed Transfer Delay (in MS to network direction)" },
925 { 0x01, "10 ms" }, /* Using a granularity of 10 ms */
940 { 0x10, "200 ms" }, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
956 { 0x20, "1000 ms" }, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
991 static const value_string qos_guar_ul[] = {
992 { 0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)" },
993 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
994 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
995 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1000 static const value_string qos_guar_dl[] = {
1001 { 0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)" },
1002 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1003 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1004 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1009 static const value_string sel_mode_type[] = {
1010 { 0, "MS or network provided APN, subscriber verified" },
1011 { 1, "MS provided APN, subscription not verified" },
1012 { 2, "Network provided APN, subscription not verified" },
1013 { 3, "For future use (Network provided APN, subscription not verified" },/* Shall not be sent. If received, shall be sent as value 2 */
1017 static const value_string tr_comm_type[] = {
1018 { 1, "Send data record packet" },
1019 { 2, "Send possibly duplicated data record packet" },
1020 { 3, "Cancel data record packet" },
1021 { 4, "Release data record packet"},
1025 /* TODO: CHeck if all ms_reasons are included */
1026 static const value_string ms_not_reachable_type[] = {
1027 { 0, "No paging response via the MSC" },
1028 { 1, "IMSI detached" },
1029 { 2, "Roaming restriction" },
1030 { 3, "Deregistered in the HLR for non GPRS" },
1031 { 4, "MS purge for non GPRS" },
1032 { 5, "No paging response via the SGSN" },
1033 { 6, "GPRS detached" },
1034 { 7, "Deregistered in the HLR for non GPRS" },
1035 { 8, "MS purged for GPRS" },
1036 { 9, "Unidentified subscriber via the MSC" },
1037 { 10, "Unidentified subscriber via the SGSN" },
1041 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1043 static const value_string ranap_cause_type[] = {
1044 /* Radio Network Layer Cause (1-->64) */
1045 { 1, "RAB preempted" },
1046 { 2, "Trelocoverall Expiry" },
1047 { 3, "Trelocprep Expiry" },
1048 { 4, "Treloccomplete Expiry" },
1049 { 5, "Tqueing Expiry" },
1050 { 6, "Relocation Triggered" },
1051 { 7, "TRELOCalloc Expiry" },
1052 { 8, "Unable to Estabish During Relocation" },
1053 { 9, "Unknown Target RNC" },
1054 { 10, "Relocation Cancelled" },
1055 { 11, "Successful Relocation" },
1056 { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported" },
1057 { 13, "Change of Ciphering and/or Integrity Protection is not supported" },
1058 { 14, "Failure in the Radio Interface Procedure" },
1059 { 15, "Release due to UTRAN Generated Reason" },
1060 { 16, "User Inactivity" },
1061 { 17, "Time Critical Relocation" },
1062 { 18, "Requested Traffic Class not Available" },
1063 { 19, "Invalid RAB Parameters Value" },
1064 { 20, "Requested Maximum Bit Rate not Available" },
1065 { 21, "Requested Guaranteed Bit Rate not Available" },
1066 { 22, "Requested Transfer Delay not Achievable" },
1067 { 23, "Invalid RAB Parameters Combination" },
1068 { 24, "Condition Violation for SDU Parameters" },
1069 { 25, "Condition Violation for Traffic Handling Priority" },
1070 { 26, "Condition Violation for Guaranteed Bit Rate" },
1071 { 27, "User Plane Versions not Supported" },
1072 { 28, "Iu UP Failure" },
1073 { 29, "Relocation Failure in Target CN/RNC or Target System" },
1074 { 30, "Invalid RAB ID" },
1075 { 31, "No Remaining RAB" },
1076 { 32, "Interaction with other procedure" },
1077 { 33, "Requested Maximum Bit Rate for DL not Available" },
1078 { 34, "Requested Maximum Bit Rate for UL not Available" },
1079 { 35, "Requested Guaranteed Bit Rate for DL not Available" },
1080 { 36, "Requested Guaranteed Bit Rate for UL not Available" },
1081 { 37, "Repeated Integrity Checking Failure" },
1082 { 38, "Requested Report Type not supported" },
1083 { 39, "Request superseded" },
1084 { 40, "Release due to UE generated signalling connection release" },
1085 { 41, "Resource Optimisation Relocation" },
1086 { 42, "Requested Information Not Available" },
1087 { 43, "Relocation desirable for radio reasons" },
1088 { 44, "Relocation not supported in Target RNC or Target System" },
1089 { 45, "Directed Retry" },
1090 { 46, "Radio Connection With UE Lost" },
1091 /* Transport Layer Cause (65-->80) */
1092 { 65, "Signalling Transport Resource Failure" },
1093 { 66, "Iu Transport Connection Failed to Establish" },
1094 /* NAS Cause (81-->96) */
1095 { 81, "User Restriction Start Indication" },
1096 { 82, "User Restriction End Indication" },
1097 { 83, "Normal Release" },
1098 /* Protocol Cause (97-->112) */
1099 { 97, "Transfer Syntax Error" },
1100 { 98, "Semantic Error" },
1101 { 99, "Message not compatible with receiver state" },
1102 { 100, "Abstract Syntax Error (Reject)" },
1103 { 101, "Abstract Syntax Error (Ignore and Notify)" },
1104 { 102, "Abstract Syntax Error (Falsely Constructed Message" },
1105 /* Miscellaneous Cause (113-->128) */
1106 { 113, "O & M Intervention" },
1107 { 114, "No Resource Available" },
1108 { 115, "Unspecified Failure" },
1109 { 116, "Network Opimisation" },
1110 /* Non-standard Cause (129-->255) */
1114 static const value_string mm_sec_modep[] = {
1115 { 0, "Used cipher value, UMTS keys and Quintuplets" },
1116 { 1, "GSM key and triplets" },
1117 { 2, "UMTS key and quintuplets" },
1118 { 3, "GSM key and quintuplets" },
1122 static const value_string mm_proto_disc[] = {
1123 { 0x00, "Group call control" },
1124 { 0x01, "Broadcast call control" },
1126 { 0x03, "Call control; call related SS messages" },
1128 { 0x05, "Mobility Management messages for non-GPRS services" },
1129 { 0x06, "Radio Resource management messages" },
1130 { 0x08, "Mobility Management messages for GPRS services" },
1132 { 0x0A, "Session Management messages" },
1133 { 0x0B, "Non-call related SS messages" },
1137 static const value_string mm_rr_mess[] = {
1138 { 0x3C, "RR initialization request" },
1139 { 0x3B, "Additional assignment" },
1140 { 0x3F, "Immediate assignment" },
1141 { 0x39, "Immediate assignment extended" },
1142 { 0x3A, "Immediate assignment reject" },
1144 { 0x35, "Ciphering mode command" },
1145 { 0x32, "Ciphering mode complete" },
1147 { 0x30, "Configuration change command" },
1148 { 0x31, "Configuration change ack" },
1149 { 0x33, "Configuration change reject" },
1151 { 0x2E, "Assignment command" },
1152 { 0x29, "Assignment complete" },
1153 { 0x2F, "Assigment failure" },
1154 { 0x2B, "Handover command" },
1155 { 0x2C, "Handover complete" },
1156 { 0x28, "Handover failure" },
1157 { 0x2D, "Physical information" },
1159 { 0x08, "RR-cell change order" },
1160 { 0x23, "PDCH assignment command" },
1162 { 0x0D, "Channel release" },
1163 { 0x0A, "Partial release" },
1164 { 0x0F, "PArtial release complete" },
1166 { 0x21, "Paging request type 1" },
1167 { 0x22, "Paging request type 2" },
1168 { 0x24, "Paging request type 3" },
1169 { 0x27, "Paging response" },
1170 { 0x20, "Notification/NCH" },
1171 { 0x25, "Notification/FACCH" },
1172 { 0x26, "Reserved" },
1173 { 0x0B, "Reserved" },
1175 { 0x18, "System information type 8" },
1176 { 0x19, "System information type 1" },
1177 { 0x1A, "System information type 2" },
1178 { 0x1B, "System information type 3" },
1179 { 0x1C, "System information type 4" },
1180 { 0x1D, "System information type 5" },
1181 { 0x1E, "System information type 6" },
1182 { 0x1F, "System information type 7" },
1184 { 0x02, "System information type 2bis" },
1185 { 0x03, "System information type 2ter" },
1186 { 0x05, "System information type 5bis" },
1187 { 0x06, "System information type 5ter" },
1188 { 0x04, "System information 9" },
1189 { 0x00, "System information 13" },
1190 { 0x01, "System information 14" },
1192 { 0x3D, "System information type 16" },
1193 { 0x3E, "System information type 17" },
1195 { 0x10, "Channel mode modify" },
1196 { 0x12, "RR status" },
1197 { 0x17, "Channel mode modify ack" },
1198 { 0x14, "Frequency redefinition " },
1199 { 0x15, "Measurement report" },
1200 { 0x16, "Classmark change" },
1201 { 0x13, "Classmark enquiry" },
1202 { 0x36, "Extended measurement report" },
1203 { 0x37, "Extended measurement order" },
1204 { 0x34, "GPRS suspension request" },
1206 { 0x09, "VGCS uplink grant" },
1207 { 0x0E, "Uplink release" },
1208 { 0x0C, "Uplink free" },
1209 { 0x2A, "Uplink busy" },
1210 { 0x11, "Talker indication" },
1215 static const value_string mm_mm_mess[] = {
1216 { 0x01, "IMSI DETACH INDICATION" },
1217 { 0x02, "LOCATION UPDATING ACCEPT" },
1218 { 0x04, "LOCATION UPDATING REJECT" },
1219 { 0x08, "LOCATION UPDATING REQUEST" },
1220 { 0x11, "AUTHENTICATION REJECT" },
1221 { 0x12, "AUTHENTICATION REQUEST" },
1222 { 0x14, "AUTHENTICATION RESPONSE" },
1223 { 0x18, "IDENTITY REQUEST" },
1224 { 0x19, "IDENTITY RESPONSE" },
1225 { 0x1A, "TMSI REALLOCATION COMMAND" },
1226 { 0x1B, "TMSI REALLOCATION COMPLETE" },
1227 { 0x21, "CM SERVICE ACCEPT" },
1228 { 0x22, "CM SERVICE REJECT" },
1229 { 0x23, "CM SERVICE ABORT" },
1230 { 0x24, "CM SERVICE REQUEST" },
1231 { 0x25, "CM SERVICE PROMPT" },
1232 { 0x26, "NOTIFICATION RESPONSE" },
1233 { 0x28, "CM RE-ESTABLISHMENT REQUEST" },
1235 { 0x30, "MM NULL" },
1236 { 0x31, "MM STATUS" },
1237 { 0x32, "MM INFORMATION" },
1241 static const value_string mm_cc_mess[] = {
1242 { 0x00, "escape to nationally specific" },
1243 /*{ 0 x 0 0, "- - - Call establishment messages:" },*/
1244 { 0x01, "ALERTING" },
1245 { 0x08, "CALL CONFIRMED" },
1246 { 0x02, "CALL PROCEEDING" },
1247 { 0x07, "CONNECT" },
1248 { 0x0F, "CONNECT ACKNOWLEDGE" },
1249 { 0x0E, "EMERGENCY SETUP" },
1250 { 0x03, "PROGRESS" },
1251 { 0x04, "CC-ESTABLISHMENT" },
1252 { 0x06, "CC-ESTABLISHMENT CONFIRMED" },
1254 { 0x09, "START CC" },
1256 /*{ 0 x 0 1, "- - - Call information phase messages:" },*/
1258 { 0x1F, "MODIFY COMPLETE" },
1259 { 0x13, "MODIFY REJECT" },
1260 { 0x10, "USER INFORMATION" },
1262 { 0x19, "HOLD ACKNOWLEDGE" },
1263 { 0x1A, "HOLD REJECT" },
1264 { 0x1C, "RETRIEVE" },
1265 { 0x1D, "RETRIEVE ACKNOWLEDGE" },
1266 { 0x1E, "RETRIEVE REJECT" },
1267 /*{ 0 x 1 0, "- - - Call clearing messages:" },*/
1268 { 0x25, "DISCONNECT" },
1269 { 0x2D, "RELEASE" },
1270 { 0x2A, "RELEASE COMPLETE" },
1271 /*{ 0 x 1 1, "- - - Miscellaneous messages:" },*/
1272 { 0x39, "CONGESTION CONTROL" },
1275 { 0x34, "STATUS ENQUIRY" },
1276 { 0x35, "START DTMF" },
1277 { 0x31, "STOP DTMF" },
1278 { 0x32, "STOP DTMF ACKNOWLEDGE" },
1279 { 0x36, "START DTMF ACKNOWLEDGE" },
1280 { 0x37, "START DTMF REJECT" },
1281 { 0x3A, "FACILITY" },
1285 static const value_string mm_gprs_mess[] = {
1286 { 0x01, "Attach request" },
1287 { 0x02, "Attach accept" },
1288 { 0x03, "Attach complete" },
1289 { 0x04, "Attach reject" },
1290 { 0x05, "Detach request" },
1291 { 0x06, "Detach accept" },
1292 { 0x08, "Routing area update request" },
1293 { 0x09, "Routing area update accept" },
1294 { 0x0A, "Routing area update complete" },
1295 { 0x0B, "Routing area update reject" },
1296 { 0x10, "P-TMSI reallocation command" },
1297 { 0x11, "P-TMSI reallocation complete" },
1298 { 0x12, "Authentication and ciphering req" },
1299 { 0x13, "Authentication and ciphering resp" },
1300 { 0x14, "Authentication and ciphering rej" },
1301 { 0x15, "Identity request" },
1302 { 0x16, "Identity response" },
1303 { 0x20, "GMM status" },
1304 { 0x21, "GMM information" },
1308 static const value_string tft_code_type[] = {
1310 { 1, "Create new TFT" },
1311 { 2, "Delete existing TFT" },
1312 { 3, "Add packet filters to existing TFT" },
1313 { 4, "Replace packet filters in existing TFT" },
1314 { 5, "Delete packet filters from existing TFT" },
1320 static const value_string cdr_close_type[] = {
1321 { 0, "PDP release" },
1322 { 1, "Volume limit" },
1323 { 2, "Time limit" },
1324 { 3, "SGSN change" },
1325 { 4, "Max changes" },
1326 { 6, "Management" },
1331 static dissector_handle_t ip_handle;
1332 static dissector_handle_t ppp_handle;
1334 static int decode_gtp_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1335 static int decode_gtp_imsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1336 static int decode_gtp_rai (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1337 static int decode_gtp_tlli (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1338 static int decode_gtp_ptmsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1339 static int decode_gtp_qos_gprs (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1340 static int decode_gtp_reorder (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1341 static int decode_gtp_auth_tri (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1342 static int decode_gtp_map_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1343 static int decode_gtp_ptmsi_sig (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1344 static int decode_gtp_ms_valid (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1345 static int decode_gtp_recovery (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1346 static int decode_gtp_sel_mode (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1347 static int decode_gtp_16 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1348 static int decode_gtp_17 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1349 static int decode_gtp_18 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1350 static int decode_gtp_19 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1351 static int decode_gtp_nsapi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1352 static int decode_gtp_ranap_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1353 static int decode_gtp_rab_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1354 static int decode_gtp_rp_sms (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1355 static int decode_gtp_rp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1356 static int decode_gtp_pkt_flow_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1357 static int decode_gtp_chrg_char (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1358 static int decode_gtp_trace_ref (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1359 static int decode_gtp_trace_type (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1360 static int decode_gtp_ms_reason (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1361 static int decode_gtp_tr_comm (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1362 static int decode_gtp_chrg_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1363 static int decode_gtp_user_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1364 static int decode_gtp_mm_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1365 static int decode_gtp_pdp_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1366 static int decode_gtp_apn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1367 static int decode_gtp_gsn_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1368 static int decode_gtp_proto_conf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1369 static int decode_gtp_msisdn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1370 static int decode_gtp_qos_umts (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1371 static int decode_gtp_auth_qui (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1372 static int decode_gtp_tft (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1373 static int decode_gtp_target_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1374 static int decode_gtp_utran_cont (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1375 static int decode_gtp_rab_setup (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1376 static int decode_gtp_hdr_list (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1377 static int decode_gtp_trigger_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1378 static int decode_gtp_omc_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1379 static int decode_gtp_chrg_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1380 static int decode_gtp_rel_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1381 static int decode_gtp_can_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1382 static int decode_gtp_data_req (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1383 static int decode_gtp_data_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1384 static int decode_gtp_node_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1385 static int decode_gtp_priv_ext (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1386 static int decode_gtp_unknown (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1388 typedef struct _gtp_opt {
1391 int (*decode)(tvbuff_t *, int, packet_info *, proto_tree *);
1394 static const gtp_opt_t gtpopt[] = {
1395 { GTP_EXT_CAUSE, decode_gtp_cause },
1396 { GTP_EXT_IMSI, decode_gtp_imsi },
1397 { GTP_EXT_RAI, decode_gtp_rai },
1398 { GTP_EXT_TLLI, decode_gtp_tlli },
1399 { GTP_EXT_PTMSI, decode_gtp_ptmsi },
1400 { GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs },
1401 { GTP_EXT_REORDER, decode_gtp_reorder },
1402 { GTP_EXT_AUTH_TRI, decode_gtp_auth_tri },
1403 { GTP_EXT_MAP_CAUSE, decode_gtp_map_cause },
1404 { GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig },
1405 { GTP_EXT_MS_VALID, decode_gtp_ms_valid },
1406 { GTP_EXT_RECOVER, decode_gtp_recovery },
1407 { GTP_EXT_SEL_MODE, decode_gtp_sel_mode },
1408 { GTP_EXT_16, decode_gtp_16 },
1409 { GTP_EXT_17, decode_gtp_17 },
1410 { GTP_EXT_18, decode_gtp_18 },
1411 { GTP_EXT_19, decode_gtp_19 },
1412 { GTP_EXT_NSAPI, decode_gtp_nsapi },
1413 { GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause },
1414 { GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt },
1415 { GTP_EXT_RP_SMS, decode_gtp_rp_sms },
1416 { GTP_EXT_RP, decode_gtp_rp },
1417 { GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id },
1418 { GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char },
1419 { GTP_EXT_TRACE_REF, decode_gtp_trace_ref },
1420 { GTP_EXT_TRACE_TYPE, decode_gtp_trace_type },
1421 { GTPv1_EXT_MS_REASON, decode_gtp_ms_reason },
1422 { GTP_EXT_TR_COMM, decode_gtp_tr_comm },
1423 { GTP_EXT_CHRG_ID, decode_gtp_chrg_id },
1424 { GTP_EXT_USER_ADDR, decode_gtp_user_addr },
1425 { GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt },
1426 { GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt },
1427 { GTP_EXT_APN, decode_gtp_apn },
1428 { GTP_EXT_PROTO_CONF, decode_gtp_proto_conf },
1429 { GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr },
1430 { GTP_EXT_MSISDN, decode_gtp_msisdn },
1431 { GTP_EXT_QOS_UMTS, decode_gtp_qos_umts }, /* 3G */
1432 { GTP_EXT_AUTH_QUI, decode_gtp_auth_qui }, /* 3G */
1433 { GTP_EXT_TFT, decode_gtp_tft }, /* 3G */
1434 { GTP_EXT_TARGET_ID, decode_gtp_target_id }, /* 3G */
1435 { GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont }, /* 3G */
1436 { GTP_EXT_RAB_SETUP, decode_gtp_rab_setup }, /* 3G */
1437 { GTP_EXT_HDR_LIST, decode_gtp_hdr_list }, /* 3G */
1438 { GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id }, /* 3G */
1439 { GTP_EXT_OMC_ID, decode_gtp_omc_id }, /* 3G */
1440 { GTP_EXT_REL_PACK, decode_gtp_rel_pack }, /* charging */
1441 { GTP_EXT_CAN_PACK, decode_gtp_can_pack }, /* charging */
1442 { GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr },
1443 { GTP_EXT_DATA_REQ, decode_gtp_data_req }, /* charging */
1444 { GTP_EXT_DATA_RESP, decode_gtp_data_resp }, /* charging */
1445 { GTP_EXT_NODE_ADDR, decode_gtp_node_addr },
1446 { GTP_EXT_PRIV_EXT, decode_gtp_priv_ext },
1447 { 0, decode_gtp_unknown }
1468 static struct gcdr_ { /* GCDR 118B */
1489 typedef struct change_ {
1499 static struct _scdr { /* SCDR 277B */
1509 guint8 msclass_notused[12];
1510 guint8 msclass_caplen;
1512 guint16 msclass_capomit;
1537 typedef struct mmchange_ {
1544 static struct _mcdr { /* MCDR 147B */
1552 guint8 msclass_notused[12];
1553 guint8 msclass_caplen;
1555 guint16 msclass_capomit;
1559 guint8 change_count;
1560 mmchange_t change[5];
1563 /* guint8 opening[8]; */
1575 static struct _socdr { /* SOCDR 80B */
1582 guint8 msclass_notused[12];
1583 guint8 msclass_caplen;
1585 guint16 msclass_capomit;
1586 guint8 serv_centr[9];
1598 static struct _stcdr { /* STCDR 79B */
1605 guint8 msclass_notused[12];
1606 guint8 msclass_caplen;
1608 guint16 msclass_capomit;
1609 guint8 serv_centr[9];
1619 static guint8 gtp_version = 0;
1620 static char *yesno[] = { "False", "True" };
1623 col_append_str_gtp(column_info *cinfo, gint el, gchar *proto_name) {
1627 gchar _tmp[COL_MAX_LEN];
1629 max_len = COL_MAX_LEN;
1631 for (i = 0; i < cinfo->num_cols; i++) {
1632 if (cinfo->fmt_matx[i][el]) {
1633 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
1635 strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
1636 cinfo->col_buf[i][max_len - 1] = '\0';
1640 strcat(_tmp, proto_name);
1642 strcat(_tmp, cinfo->col_buf[i]);
1644 cinfo->col_buf[i][0] = '\0';
1645 strcat(cinfo->col_buf[i], _tmp);
1646 cinfo->col_data[i] = cinfo->col_buf[i];
1652 id_to_str(const guint8 *ad) {
1654 static gchar *str[17];
1656 guint8 bits8to5, bits4to1, i;
1657 static const gchar hex_digits[10] = "0123456789";
1659 p = (gchar *)&str[17];
1663 bits8to5 = (ad[i] >> 4) & 0x0F;
1664 bits4to1 = ad[i] & 0x0F;
1665 if (bits8to5 < 0xA) *--p = hex_digits[bits8to5];
1666 if (bits4to1 < 0xA) *--p = hex_digits[bits4to1];
1674 msisdn_to_str(const guint8 *ad, int len) {
1676 static gchar *str[17];
1678 guint8 bits8to5, bits4to1, i;
1679 static const gchar hex_digits[16] = "0123456789 ";
1681 p = (gchar *)&str[0];
1685 bits8to5 = (ad[i] >> 4) & 0x0F;
1686 bits4to1 = ad[i] & 0x0F;
1687 if (bits4to1 < 0xA) *++p = hex_digits[bits4to1];
1688 if (bits8to5 < 0xA) *++p = hex_digits[bits8to5];
1689 if (i == len-1) break;
1693 return (gchar *)&str[0];
1697 time_int_to_str (guint32 time)
1705 return abs_time_to_str (&nstime);
1709 rel_time_int_to_str (guint32 time)
1717 return rel_time_to_str (&nstime);
1720 /* Next definitions and function check_field_presence checks if given field
1721 * in GTP packet is compliant with ETSI
1723 typedef struct _header {
1728 typedef struct _message {
1730 ext_header fields[32];
1733 /* ---------------------
1735 * ---------------------*/
1736 static _gtp_mess_items gprs_mess_items[] = {
1740 { GTP_EXT_PRIV_EXT, OPTIONAL },
1745 GTP_MSG_ECHO_RESP, {
1746 { GTP_EXT_RECOVER, MANDATORY },
1747 { GTP_EXT_PRIV_EXT, OPTIONAL },
1752 GTP_MSG_VER_NOT_SUPP, {
1757 GTP_MSG_NODE_ALIVE_REQ, {
1758 { GTP_EXT_NODE_ADDR, MANDATORY },
1759 { GTP_EXT_PRIV_EXT, OPTIONAL },
1764 GTP_MSG_NODE_ALIVE_RESP, {
1765 { GTP_EXT_PRIV_EXT, OPTIONAL },
1770 GTP_MSG_REDIR_REQ, {
1771 { GTP_EXT_CAUSE, MANDATORY },
1772 { GTP_EXT_NODE_ADDR, OPTIONAL },
1773 { GTP_EXT_PRIV_EXT, OPTIONAL },
1778 GTP_MSG_REDIR_RESP, {
1779 { GTP_EXT_CAUSE, MANDATORY },
1780 { GTP_EXT_PRIV_EXT, OPTIONAL },
1785 GTP_MSG_CREATE_PDP_REQ, {
1786 { GTP_EXT_QOS_GPRS, MANDATORY },
1787 { GTP_EXT_RECOVER, OPTIONAL },
1788 { GTP_EXT_SEL_MODE, MANDATORY },
1789 { GTP_EXT_FLOW_LABEL, MANDATORY },
1790 { GTP_EXT_FLOW_SIG, MANDATORY },
1791 { GTP_EXT_MSISDN, MANDATORY },
1792 { GTP_EXT_USER_ADDR, MANDATORY },
1793 { GTP_EXT_APN, MANDATORY },
1794 { GTP_EXT_PROTO_CONF, OPTIONAL },
1795 { GTP_EXT_GSN_ADDR, MANDATORY },
1796 { GTP_EXT_GSN_ADDR, MANDATORY },
1797 { GTP_EXT_PRIV_EXT, OPTIONAL },
1802 GTP_MSG_CREATE_PDP_RESP, {
1803 { GTP_EXT_CAUSE, MANDATORY },
1804 { GTP_EXT_QOS_GPRS, CONDITIONAL },
1805 { GTP_EXT_REORDER, CONDITIONAL },
1806 { GTP_EXT_RECOVER, OPTIONAL },
1807 { GTP_EXT_FLOW_LABEL, CONDITIONAL },
1808 { GTP_EXT_FLOW_SIG, CONDITIONAL },
1809 { GTP_EXT_CHRG_ID, CONDITIONAL },
1810 { GTP_EXT_USER_ADDR, CONDITIONAL },
1811 { GTP_EXT_PROTO_CONF, OPTIONAL },
1812 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1813 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1814 { GTP_EXT_CHRG_ADDR, OPTIONAL },
1815 { GTP_EXT_PRIV_EXT, OPTIONAL },
1820 GTP_MSG_UPDATE_PDP_REQ, {
1821 { GTP_EXT_QOS_GPRS, MANDATORY },
1822 { GTP_EXT_RECOVER, OPTIONAL },
1823 { GTP_EXT_FLOW_LABEL, MANDATORY },
1824 { GTP_EXT_FLOW_SIG, MANDATORY },
1825 { GTP_EXT_GSN_ADDR, MANDATORY },
1826 { GTP_EXT_GSN_ADDR, MANDATORY },
1827 { GTP_EXT_PRIV_EXT, OPTIONAL },
1832 GTP_MSG_UPDATE_PDP_RESP, {
1833 { GTP_EXT_CAUSE, MANDATORY },
1834 { GTP_EXT_QOS_GPRS, CONDITIONAL },
1835 { GTP_EXT_RECOVER, OPTIONAL },
1836 { GTP_EXT_FLOW_LABEL, CONDITIONAL },
1837 { GTP_EXT_FLOW_SIG, CONDITIONAL },
1838 { GTP_EXT_CHRG_ID, CONDITIONAL },
1839 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1840 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1841 { GTP_EXT_CHRG_ADDR, OPTIONAL },
1842 { GTP_EXT_PRIV_EXT, OPTIONAL },
1847 GTP_MSG_DELETE_PDP_REQ, {
1848 { GTP_EXT_PRIV_EXT, OPTIONAL },
1853 GTP_MSG_DELETE_PDP_RESP, {
1854 { GTP_EXT_CAUSE, MANDATORY },
1855 { GTP_EXT_PRIV_EXT, OPTIONAL },
1860 GTP_MSG_CREATE_AA_PDP_REQ, {
1861 { GTP_EXT_QOS_GPRS, MANDATORY },
1862 { GTP_EXT_RECOVER, OPTIONAL },
1863 { GTP_EXT_SEL_MODE, MANDATORY },
1864 { GTP_EXT_FLOW_LABEL, MANDATORY },
1865 { GTP_EXT_FLOW_SIG, MANDATORY },
1866 { GTP_EXT_USER_ADDR, MANDATORY },
1867 { GTP_EXT_APN, MANDATORY },
1868 { GTP_EXT_PROTO_CONF, OPTIONAL },
1869 { GTP_EXT_GSN_ADDR, MANDATORY },
1870 { GTP_EXT_GSN_ADDR, MANDATORY },
1871 { GTP_EXT_PRIV_EXT, OPTIONAL },
1876 GTP_MSG_CREATE_AA_PDP_RESP, {
1877 { GTP_EXT_CAUSE, MANDATORY },
1878 { GTP_EXT_QOS_GPRS, CONDITIONAL },
1879 { GTP_EXT_REORDER, CONDITIONAL },
1880 { GTP_EXT_RECOVER, OPTIONAL },
1881 { GTP_EXT_FLOW_LABEL, CONDITIONAL },
1882 { GTP_EXT_FLOW_SIG, CONDITIONAL },
1883 { GTP_EXT_CHRG_ID, CONDITIONAL },
1884 { GTP_EXT_USER_ADDR, CONDITIONAL },
1885 { GTP_EXT_PROTO_CONF, OPTIONAL },
1886 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1887 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1888 { GTP_EXT_CHRG_ADDR, OPTIONAL },
1889 { GTP_EXT_PRIV_EXT, OPTIONAL },
1894 GTP_MSG_DELETE_AA_PDP_REQ, {
1895 { GTP_EXT_CAUSE, MANDATORY },
1896 { GTP_EXT_PRIV_EXT, OPTIONAL },
1901 GTP_MSG_DELETE_AA_PDP_RESP, {
1902 { GTP_EXT_CAUSE, MANDATORY },
1903 { GTP_EXT_PRIV_EXT, OPTIONAL },
1909 { GTP_EXT_PRIV_EXT, OPTIONAL },
1914 GTP_MSG_PDU_NOTIFY_REQ, {
1915 { GTP_EXT_USER_ADDR, MANDATORY },
1916 { GTP_EXT_PRIV_EXT, OPTIONAL },
1921 GTP_MSG_PDU_NOTIFY_RESP, {
1922 { GTP_EXT_CAUSE, MANDATORY },
1923 { GTP_EXT_PRIV_EXT, OPTIONAL },
1928 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1929 { GTP_EXT_CAUSE, MANDATORY },
1930 { GTP_EXT_USER_ADDR, MANDATORY },
1931 { GTP_EXT_PRIV_EXT, OPTIONAL },
1936 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1937 { GTP_EXT_CAUSE, MANDATORY },
1938 { GTP_EXT_PRIV_EXT, OPTIONAL },
1943 GTP_MSG_SEND_ROUT_INFO_REQ, {
1944 { GTP_EXT_IMSI, MANDATORY },
1945 { GTP_EXT_PRIV_EXT, OPTIONAL },
1950 GTP_MSG_SEND_ROUT_INFO_RESP, {
1951 { GTP_EXT_CAUSE, MANDATORY },
1952 { GTP_EXT_IMSI, MANDATORY },
1953 { GTP_EXT_MAP_CAUSE, OPTIONAL },
1954 { GTP_EXT_MS_REASON, OPTIONAL },
1955 { GTP_EXT_GSN_ADDR, OPTIONAL },
1956 { GTP_EXT_PRIV_EXT, OPTIONAL },
1961 GTP_MSG_FAIL_REP_REQ, {
1962 { GTP_EXT_IMSI, MANDATORY },
1963 { GTP_EXT_PRIV_EXT, OPTIONAL },
1968 GTP_MSG_FAIL_REP_RESP, {
1969 { GTP_EXT_CAUSE, MANDATORY },
1970 { GTP_EXT_MAP_CAUSE, OPTIONAL },
1971 { GTP_EXT_PRIV_EXT, OPTIONAL },
1976 GTP_MSG_MS_PRESENT_REQ, {
1977 { GTP_EXT_IMSI, MANDATORY },
1978 { GTP_EXT_GSN_ADDR, MANDATORY },
1979 { GTP_EXT_PRIV_EXT, OPTIONAL },
1984 GTP_MSG_MS_PRESENT_RESP, {
1985 { GTP_EXT_CAUSE, MANDATORY },
1986 { GTP_EXT_PRIV_EXT, OPTIONAL },
1991 GTP_MSG_IDENT_REQ, {
1992 { GTP_EXT_RAI, MANDATORY },
1993 { GTP_EXT_PTMSI, MANDATORY },
1994 { GTP_EXT_PTMSI_SIG, OPTIONAL },
1995 { GTP_EXT_PRIV_EXT, OPTIONAL },
2000 GTP_MSG_IDENT_RESP, {
2001 { GTP_EXT_CAUSE, MANDATORY },
2002 { GTP_EXT_IMSI, CONDITIONAL },
2003 { GTP_EXT_AUTH_TRI, OPTIONAL },
2004 { GTP_EXT_PRIV_EXT, OPTIONAL },
2009 GTP_MSG_SGSN_CNTXT_REQ, {
2010 { GTP_EXT_IMSI, CONDITIONAL },
2011 { GTP_EXT_RAI, MANDATORY },
2012 { GTP_EXT_TLLI, MANDATORY },
2013 { GTP_EXT_PTMSI_SIG, OPTIONAL },
2014 { GTP_EXT_MS_VALID, OPTIONAL },
2015 { GTP_EXT_FLOW_SIG, MANDATORY },
2020 GTP_MSG_SGSN_CNTXT_RESP, {
2021 { GTP_EXT_CAUSE, MANDATORY },
2022 { GTP_EXT_IMSI, CONDITIONAL },
2023 { GTP_EXT_FLOW_SIG, CONDITIONAL },
2024 { GTP_EXT_MM_CNTXT, CONDITIONAL },
2025 { GTP_EXT_PDP_CNTXT, CONDITIONAL },
2026 { GTP_EXT_PRIV_EXT, OPTIONAL },
2031 GTP_MSG_SGSN_CNTXT_ACK, {
2032 { GTP_EXT_CAUSE, MANDATORY },
2033 { GTP_EXT_FLOW_II, CONDITIONAL },
2034 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2035 { GTP_EXT_PRIV_EXT, OPTIONAL },
2040 GTP_MSG_DATA_TRANSF_REQ, {
2041 { GTP_EXT_TR_COMM, MANDATORY },
2042 { GTP_EXT_DATA_REQ, CONDITIONAL },
2043 { GTP_EXT_REL_PACK, CONDITIONAL },
2044 { GTP_EXT_CAN_PACK, CONDITIONAL },
2045 { GTP_EXT_PRIV_EXT, OPTIONAL },
2050 GTP_MSG_DATA_TRANSF_RESP, {
2051 { GTP_EXT_CAUSE, MANDATORY },
2052 { GTP_EXT_DATA_RESP, MANDATORY },
2053 { GTP_EXT_PRIV_EXT, OPTIONAL },
2064 /* -----------------------------
2066 * -----------------------------*/
2067 static _gtp_mess_items umts_mess_items[] = {
2071 { GTP_EXT_PRIV_EXT, OPTIONAL },
2076 GTP_MSG_ECHO_RESP, {
2077 { GTP_EXT_RECOVER, MANDATORY },
2078 { GTP_EXT_PRIV_EXT, OPTIONAL },
2083 GTP_MSG_VER_NOT_SUPP, {
2088 GTP_MSG_NODE_ALIVE_REQ, {
2089 { GTP_EXT_NODE_ADDR, MANDATORY },
2090 { GTP_EXT_PRIV_EXT, OPTIONAL },
2095 GTP_MSG_NODE_ALIVE_RESP, {
2096 { GTP_EXT_PRIV_EXT, OPTIONAL },
2101 GTP_MSG_REDIR_REQ, {
2102 { GTP_EXT_CAUSE, MANDATORY },
2103 { GTP_EXT_NODE_ADDR, OPTIONAL },
2104 { GTP_EXT_PRIV_EXT, OPTIONAL },
2109 GTP_MSG_REDIR_REQ, {
2114 GTP_MSG_CREATE_PDP_REQ, {
2115 { GTP_EXT_IMSI, CONDITIONAL },
2116 { GTP_EXT_RECOVER, OPTIONAL },
2117 { GTP_EXT_SEL_MODE, CONDITIONAL },
2118 { GTP_EXT_TEID, MANDATORY },
2119 { GTP_EXT_TEID_CP, CONDITIONAL },
2120 { GTP_EXT_NSAPI, MANDATORY },
2121 { GTP_EXT_NSAPI, CONDITIONAL },
2122 { GTP_EXT_CHRG_CHAR, OPTIONAL },
2123 { GTP_EXT_TRACE_REF, OPTIONAL },
2124 { GTP_EXT_TRACE_TYPE, OPTIONAL },
2125 { GTP_EXT_USER_ADDR, CONDITIONAL },
2126 { GTP_EXT_APN, CONDITIONAL },
2127 { GTP_EXT_PROTO_CONF, CONDITIONAL },
2128 { GTP_EXT_GSN_ADDR, MANDATORY },
2129 { GTP_EXT_GSN_ADDR, MANDATORY },
2130 { GTP_EXT_MSISDN, CONDITIONAL },
2131 { GTP_EXT_QOS_UMTS, MANDATORY },
2132 { GTP_EXT_TFT, CONDITIONAL },
2133 { GTP_EXT_TRIGGER_ID, OPTIONAL },
2134 { GTP_EXT_OMC_ID, OPTIONAL },
2135 { GTP_EXT_PRIV_EXT, OPTIONAL },
2140 GTP_MSG_CREATE_PDP_RESP, {
2141 { GTP_EXT_CAUSE, MANDATORY },
2142 { GTP_EXT_REORDER, CONDITIONAL },
2143 { GTP_EXT_RECOVER, OPTIONAL },
2144 { GTP_EXT_TEID, CONDITIONAL },
2145 { GTP_EXT_TEID_CP, CONDITIONAL },
2146 { GTP_EXT_CHRG_ID, CONDITIONAL },
2147 { GTP_EXT_USER_ADDR, CONDITIONAL },
2148 { GTP_EXT_PROTO_CONF, OPTIONAL },
2149 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2150 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2151 { GTP_EXT_QOS_UMTS, CONDITIONAL },
2152 { GTP_EXT_CHRG_ADDR, OPTIONAL },
2153 { GTP_EXT_PRIV_EXT, OPTIONAL },
2157 { /* checked, SGSN -> GGSN */
2158 GTP_MSG_UPDATE_PDP_REQ, {
2159 { GTP_EXT_IMSI, CONDITIONAL },
2160 { GTP_EXT_RECOVER, OPTIONAL },
2161 { GTP_EXT_TEID, MANDATORY },
2162 { GTP_EXT_TEID_CP, CONDITIONAL },
2163 { GTP_EXT_NSAPI, MANDATORY },
2164 { GTP_EXT_TRACE_REF, OPTIONAL },
2165 { GTP_EXT_TRACE_TYPE, OPTIONAL },
2166 { GTP_EXT_GSN_ADDR, MANDATORY },
2167 { GTP_EXT_GSN_ADDR, MANDATORY },
2168 { GTP_EXT_QOS_UMTS, MANDATORY },
2169 { GTP_EXT_TFT, OPTIONAL },
2170 { GTP_EXT_TRIGGER_ID, OPTIONAL },
2171 { GTP_EXT_OMC_ID, OPTIONAL },
2172 { GTP_EXT_PRIV_EXT, OPTIONAL },
2176 { /* checked, GGSN -> SGSN */
2177 GTP_MSG_UPDATE_PDP_RESP, {
2178 { GTP_EXT_CAUSE, MANDATORY },
2179 { GTP_EXT_RECOVER, OPTIONAL },
2180 { GTP_EXT_TEID, CONDITIONAL },
2181 { GTP_EXT_TEID_CP, CONDITIONAL },
2182 { GTP_EXT_CHRG_ID, CONDITIONAL },
2183 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2184 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2185 { GTP_EXT_QOS_UMTS, CONDITIONAL },
2186 { GTP_EXT_CHRG_ADDR, OPTIONAL },
2187 { GTP_EXT_PRIV_EXT, OPTIONAL },
2192 GTP_MSG_DELETE_PDP_REQ, {
2193 { GTP_EXT_TEAR_IND, CONDITIONAL },
2194 { GTP_EXT_NSAPI, MANDATORY },
2195 { GTP_EXT_PRIV_EXT, OPTIONAL },
2200 GTP_MSG_DELETE_PDP_RESP, {
2201 { GTP_EXT_CAUSE, MANDATORY },
2202 { GTP_EXT_PRIV_EXT, OPTIONAL },
2208 { GTP_EXT_TEID, MANDATORY },
2209 { GTP_EXT_PRIV_EXT, OPTIONAL },
2214 GTP_MSG_PDU_NOTIFY_REQ, {
2215 { GTP_EXT_IMSI, MANDATORY },
2216 { GTP_EXT_TEID_CP, MANDATORY },
2217 { GTP_EXT_USER_ADDR, MANDATORY },
2218 { GTP_EXT_APN, MANDATORY },
2219 { GTP_EXT_GSN_ADDR, MANDATORY },
2220 { GTP_EXT_PRIV_EXT, OPTIONAL },
2225 GTP_MSG_PDU_NOTIFY_RESP, {
2226 { GTP_EXT_CAUSE, MANDATORY },
2227 { GTP_EXT_PRIV_EXT, OPTIONAL },
2232 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2233 { GTP_EXT_CAUSE, MANDATORY },
2234 { GTP_EXT_TEID_CP, MANDATORY },
2235 { GTP_EXT_USER_ADDR, MANDATORY },
2236 { GTP_EXT_APN, MANDATORY },
2237 { GTP_EXT_PRIV_EXT, OPTIONAL },
2242 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2243 { GTP_EXT_CAUSE, MANDATORY },
2244 { GTP_EXT_PRIV_EXT, OPTIONAL },
2249 GTP_MSG_SUPP_EXT_HDR, {
2250 { GTP_EXT_HDR_LIST, MANDATORY },
2255 GTP_MSG_SEND_ROUT_INFO_REQ, {
2256 { GTP_EXT_IMSI, MANDATORY },
2257 { GTP_EXT_PRIV_EXT, OPTIONAL },
2262 GTP_MSG_SEND_ROUT_INFO_RESP, {
2263 { GTP_EXT_CAUSE, MANDATORY },
2264 { GTP_EXT_IMSI, MANDATORY },
2265 { GTP_EXT_MAP_CAUSE, OPTIONAL },
2266 { GTPv1_EXT_MS_REASON, OPTIONAL },
2267 { GTP_EXT_GSN_ADDR, OPTIONAL },
2268 { GTP_EXT_PRIV_EXT, OPTIONAL },
2273 GTP_MSG_FAIL_REP_REQ, {
2274 { GTP_EXT_IMSI, MANDATORY },
2275 { GTP_EXT_PRIV_EXT, OPTIONAL },
2280 GTP_MSG_FAIL_REP_RESP, {
2281 { GTP_EXT_CAUSE, MANDATORY },
2282 { GTP_EXT_MAP_CAUSE, OPTIONAL },
2283 { GTP_EXT_PRIV_EXT, OPTIONAL },
2288 GTP_MSG_MS_PRESENT_REQ, {
2289 { GTP_EXT_IMSI, MANDATORY },
2290 { GTP_EXT_GSN_ADDR, MANDATORY },
2291 { GTP_EXT_PRIV_EXT, OPTIONAL },
2296 GTP_MSG_MS_PRESENT_RESP, {
2297 { GTP_EXT_CAUSE, MANDATORY },
2298 { GTP_EXT_PRIV_EXT, OPTIONAL },
2303 GTP_MSG_IDENT_REQ, {
2304 { GTP_EXT_RAI, MANDATORY },
2305 { GTP_EXT_PTMSI, MANDATORY },
2306 { GTP_EXT_PTMSI_SIG, CONDITIONAL },
2307 { GTP_EXT_PRIV_EXT, OPTIONAL },
2312 GTP_MSG_IDENT_RESP, {
2313 { GTP_EXT_CAUSE, MANDATORY },
2314 { GTP_EXT_IMSI, CONDITIONAL },
2315 { GTP_EXT_AUTH_TRI, CONDITIONAL },
2316 { GTP_EXT_AUTH_QUI, CONDITIONAL },
2317 { GTP_EXT_PRIV_EXT, OPTIONAL },
2322 GTP_MSG_SGSN_CNTXT_REQ, {
2323 { GTP_EXT_IMSI, CONDITIONAL },
2324 { GTP_EXT_RAI, MANDATORY },
2325 { GTP_EXT_TLLI, CONDITIONAL },
2326 { GTP_EXT_PTMSI, CONDITIONAL },
2327 { GTP_EXT_PTMSI_SIG, CONDITIONAL },
2328 { GTP_EXT_MS_VALID, OPTIONAL },
2329 { GTP_EXT_TEID_CP, MANDATORY },
2330 { GTP_EXT_GSN_ADDR, MANDATORY },
2331 { GTP_EXT_PRIV_EXT, OPTIONAL },
2336 GTP_MSG_SGSN_CNTXT_RESP, {
2337 { GTP_EXT_CAUSE, MANDATORY },
2338 { GTP_EXT_IMSI, CONDITIONAL },
2339 { GTP_EXT_TEID_CP, CONDITIONAL },
2340 { GTP_EXT_RP_SMS, OPTIONAL },
2341 { GTP_EXT_RP, OPTIONAL },
2342 { GTP_EXT_PKT_FLOW_ID, OPTIONAL },
2343 { GTP_EXT_MM_CNTXT, CONDITIONAL },
2344 { GTP_EXT_PDP_CNTXT, CONDITIONAL },
2345 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2346 { GTP_EXT_PRIV_EXT, OPTIONAL },
2351 GTP_MSG_SGSN_CNTXT_ACK, {
2352 { GTP_EXT_CAUSE, MANDATORY },
2353 { GTP_EXT_TEID_II, CONDITIONAL },
2354 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2355 { GTP_EXT_PRIV_EXT, OPTIONAL },
2360 GTP_MSG_FORW_RELOC_REQ, {
2361 { GTP_EXT_IMSI, MANDATORY },
2362 { GTP_EXT_TEID_CP, MANDATORY },
2363 { GTP_EXT_RANAP_CAUSE, MANDATORY },
2364 { GTP_EXT_MM_CNTXT, MANDATORY },
2365 { GTP_EXT_PDP_CNTXT, CONDITIONAL },
2366 { GTP_EXT_GSN_ADDR, MANDATORY },
2367 { GTP_EXT_TARGET_ID, MANDATORY },
2368 { GTP_EXT_UTRAN_CONT, MANDATORY },
2369 { GTP_EXT_PRIV_EXT, OPTIONAL },
2374 GTP_MSG_FORW_RELOC_RESP, {
2375 { GTP_EXT_CAUSE, MANDATORY },
2376 { GTP_EXT_TEID_CP, CONDITIONAL },
2377 { GTP_EXT_RANAP_CAUSE, CONDITIONAL },
2378 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2379 { GTP_EXT_UTRAN_CONT, OPTIONAL },
2380 { GTP_EXT_RAB_SETUP, CONDITIONAL },
2381 { GTP_EXT_PRIV_EXT, OPTIONAL },
2386 GTP_MSG_FORW_RELOC_COMP, {
2387 { GTP_EXT_PRIV_EXT, OPTIONAL },
2392 GTP_MSG_RELOC_CANCEL_REQ, {
2393 { GTP_EXT_IMSI, MANDATORY },
2394 { GTP_EXT_PRIV_EXT, OPTIONAL },
2399 GTP_MSG_RELOC_CANCEL_RESP, {
2400 { GTP_EXT_CAUSE, MANDATORY },
2401 { GTP_EXT_PRIV_EXT, OPTIONAL },
2406 GTP_MSG_FORW_RELOC_ACK, {
2407 { GTP_EXT_CAUSE, MANDATORY },
2408 { GTP_EXT_PRIV_EXT, OPTIONAL },
2413 GTP_MSG_FORW_SRNS_CNTXT, {
2414 { GTP_EXT_RAB_CNTXT, MANDATORY },
2415 { GTP_EXT_PRIV_EXT, OPTIONAL },
2420 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2421 { GTP_EXT_CAUSE, MANDATORY },
2422 { GTP_EXT_PRIV_EXT, OPTIONAL },
2434 check_field_presence(guint8 message, guint8 field, int *position) {
2437 _gtp_mess_items *mess_items;
2439 switch(gtp_version) {
2441 mess_items = gprs_mess_items;
2444 mess_items = umts_mess_items;
2450 while (mess_items[i].code) {
2451 if (mess_items[i].code == message) {
2453 while (mess_items[i].fields[*position].code) {
2454 if (mess_items[i].fields[*position].code == field) {
2458 if (mess_items[i].fields[*position].presence == MANDATORY) {
2459 return mess_items[i].fields[(*position)++].code;
2472 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2474 /* GPRS: 9.60 v7.6.0, chapter
2475 * UMTS: 29.060 v4.0, chapter
2478 decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2482 cause = tvb_get_guint8(tvb, offset+1);
2484 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_cause : hf_gtpv0_cause, tvb, offset, 2, cause);
2489 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2490 * UMTS: 29.060 v4.0, chapter 7.7.2
2493 decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2498 tvb_memcpy(tvb, tid_val, offset+1, 8);
2499 tid_val[1] = tid_val[1] & 0x0F;
2500 tid_str = id_to_str(tid_val);
2502 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_imsi : hf_gtpv0_imsi, tvb, offset, 9, tid_str);
2507 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2508 * UMTS: 29.060 v4.0, chapter 7.7.3
2509 * TODO: Add details about MCC, MNC, LAC, RAC (show each digit) ?
2512 decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2514 proto_tree *ext_tree_rai;
2518 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));
2519 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2521 /* tvb_memcpy (tvb, (guint8 *)&byte, offset + 1, 3); */
2522 byte[1] = tvb_get_guint8 (tvb, offset + 1);
2523 byte[2] = tvb_get_guint8 (tvb, offset + 2);
2524 byte[3] = tvb_get_guint8 (tvb, offset + 3);
2527 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mcc : hf_gtpv0_rai_mcc, tvb, offset+1, 2, (byte[1] & 0x0F) * 100 + ((byte[1] & 0xF0) >> 4) * 10 + (byte[2] & 0x0F ));
2528 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mnc : hf_gtpv0_rai_mnc, tvb, offset+2, 2, ((byte[3] & 0xF0) >> 4 ) * 10 + (byte[3] & 0x0F));
2529 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_lac : hf_gtpv0_rai_lac, tvb, offset+4, 2, tvb_get_ntohs (tvb, offset+4));
2530 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_rac : hf_gtpv0_rai_rac, tvb, offset+6, 1, tvb_get_guint8 (tvb, offset+6));
2535 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2536 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2539 decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2543 tlli = tvb_get_ntohl(tvb, offset+1);
2544 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tlli : hf_gtpv0_tlli, tvb, offset, 5, tlli);
2549 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
2550 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
2553 decode_gtp_ptmsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2557 ptmsi = tvb_get_ntohl(tvb, offset);
2558 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi : hf_gtpv0_ptmsi, tvb, offset, 5, ptmsi);
2563 /* adjust - how many bytes before offset should be highlighted
2566 decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 adjust) {
2568 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
2569 proto_tree *ext_tree_qos;
2572 spare1 = tvb_get_guint8(tvb, offset) & 0xC0;
2573 delay = tvb_get_guint8(tvb, offset) & 0x38;
2574 reliability = tvb_get_guint8(tvb, offset) & 0x07;
2575 peak = tvb_get_guint8(tvb, offset+1) & 0xF0;
2576 spare2 = tvb_get_guint8(tvb, offset+1) & 0x08;
2577 precedence = tvb_get_guint8(tvb, offset+1) & 0x07;
2578 spare3 = tvb_get_guint8(tvb, offset+2) & 0xE0;
2579 mean = tvb_get_guint8(tvb, offset+2) & 0x1F;
2581 te = proto_tree_add_text(tree, tvb, offset-adjust, 3+adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
2582 qos_str, delay, reliability, peak, precedence, mean);
2583 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
2586 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare1, tvb, offset, 1, spare1);
2587 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_delay, tvb, offset, 1, delay);
2588 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_reliability, tvb, offset, 1, reliability);
2589 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_peak, tvb, offset+1, 1, peak);
2590 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare2, tvb, offset+1, 1, spare2);
2591 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_precedence, tvb, offset+1, 1, precedence);
2592 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare3, tvb, offset+2, 1, spare3);
2593 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_mean, tvb, offset+2, 1, mean);
2599 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
2603 * TODO: check if length is included: ETSI 4.08 vs 9.60
2606 decode_gtp_qos_gprs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2608 return (1+decode_qos_gprs(tvb, offset+1, tree, "Quality of Service", 1));
2612 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
2613 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
2616 decode_gtp_reorder(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2620 reorder = tvb_get_guint8(tvb, offset+1) & 0x01;
2621 proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_reorder : hf_gtpv0_reorder, tvb, offset, 2, reorder);
2626 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
2627 * 4.08 v7.1.2, chapter 10.5.3.1+
2628 * UMTS: 29.060 v4.0, chapter 7.7.7
2629 * TODO: Add blurb support by registering items in the protocol registration
2632 decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2634 proto_tree *ext_tree_auth_tri;
2636 guint32 rand[4], sres, kc[2];
2638 tvb_memcpy(tvb, (guint8 *)&rand, offset+1, 16);
2639 sres = tvb_get_ntohl(tvb, offset+17);
2640 tvb_memcpy(tvb, (guint8 *)&kc, offset+21, 16);
2642 te = proto_tree_add_text(tree, tvb, offset, 29, val_to_str(GTP_EXT_AUTH_TRI, gtp_val, "Unknown message"));
2643 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
2645 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+1, 16, "RAND: %x%x%x%x", rand[0], rand[1], rand[2], rand[3]);
2646 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+17, 4, "SRES: %x", sres);
2647 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+21, 8, "Kc: %x%x", kc[0], kc[1]);
2652 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
2653 * 9.02 v7.7.0, page 1090
2654 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
2655 * 29.002 v4.2.1, chapter 17.5, page 268
2658 decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2662 map_cause = tvb_get_guint8(tvb, offset+1);
2663 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_map_cause : hf_gtpv0_map_cause, tvb, offset, 2, map_cause);
2668 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
2669 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
2672 decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2676 ptmsi_sig = tvb_get_ntoh24(tvb, offset+1);
2677 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi_sig : hf_gtpv0_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
2682 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
2683 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
2686 decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2690 ms_valid = tvb_get_guint8(tvb, offset+1) & 0x01;
2691 proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_ms_valid : hf_gtpv0_ms_valid, tvb, offset, 2, ms_valid);
2696 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
2697 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
2700 decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2704 recovery = tvb_get_guint8(tvb, offset+1);
2705 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_recovery : hf_gtpv0_recovery, tvb, offset, 2, recovery);
2710 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
2711 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
2714 decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2718 sel_mode = tvb_get_guint8(tvb, offset+1) & 0x03;
2719 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_sel_mode : hf_gtpv0_sel_mode, tvb, offset, 2, sel_mode);
2724 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
2725 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
2728 decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2730 guint16 ext_flow_label;
2733 switch (gtp_version) {
2735 ext_flow_label = tvb_get_ntohs(tvb, offset+1);
2736 proto_tree_add_uint(tree, hf_gtpv0_ext_flow_label, tvb, offset, 3, ext_flow_label);
2740 teid_data = tvb_get_ntohl(tvb, offset+1);
2741 proto_tree_add_uint(tree, hf_gtpv1_teid_data, tvb, offset, 5, teid_data);
2745 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
2751 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
2752 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
2755 decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2760 switch (gtp_version) {
2762 flow_sig = tvb_get_ntohs(tvb, offset+1);
2763 proto_tree_add_uint(tree, hf_gtpv0_flow_sig, tvb, offset, 3, flow_sig);
2767 teid_cp = tvb_get_ntohl(tvb, offset+1);
2768 proto_tree_add_uint(tree, hf_gtpv1_teid_cp, tvb, offset, 5, teid_cp);
2772 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
2778 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
2779 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
2782 decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2786 proto_tree *ext_tree_flow_ii;
2789 switch (gtp_version) {
2791 te = proto_tree_add_text(tree, tvb, offset, 4, val_to_str(GTP_EXT_FLOW_II, gtp_val, "Unknown message"));
2792 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
2794 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2796 flow_ii = tvb_get_ntohs(tvb, offset+2);
2797 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_flow_ii, tvb, offset+2, 2, flow_ii);
2801 te = proto_tree_add_text(tree, tvb, offset, 6, val_to_str(GTP_EXT_TEID_II, gtp_val, "Unknown message"));
2802 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
2804 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2807 teid_ii = tvb_get_ntohl(tvb, offset+2);
2808 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_teid_ii, tvb, offset+2, 4, teid_ii);
2812 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
2818 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
2819 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
2820 * Check if all ms_reason types are included
2823 decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2827 field19 = tvb_get_guint8(tvb, offset+1);
2829 switch (gtp_version) {
2831 proto_tree_add_uint(tree, hf_gtpv0_ms_reason, tvb, offset, 2, field19);
2835 proto_tree_add_boolean(tree, hf_gtpv1_tear_ind, tvb, offset, 2, field19 & 0x01);
2839 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
2847 /* GPRS: not present
2848 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
2851 decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2855 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2856 proto_tree_add_uint(tree, hf_gtpv1_nsapi, tvb, offset, 2, nsapi);
2861 /* GPRS: not present
2862 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
2865 decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2869 ranap = tvb_get_guint8(tvb, offset+1);
2871 if(ranap > 0 && ranap <=64)
2872 proto_tree_add_uint_format(tree, hf_gtpv1_ranap_cause, tvb, offset, 2, ranap, "%s (Radio Network Layer Cause) : %s (%u)", val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"), val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2874 if(ranap > 64 && ranap <=80)
2875 proto_tree_add_uint_format(tree, hf_gtpv1_ranap_cause, tvb, offset, 2, ranap, "%s (Transport Layer Cause) : %s (%u)", val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"), val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2877 if(ranap > 80 && ranap <=96)
2878 proto_tree_add_uint_format(tree, hf_gtpv1_ranap_cause, tvb, offset, 2, ranap, "%s (NAS Cause) : %s (%u)", val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"), val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2880 if(ranap > 96 && ranap <=112)
2881 proto_tree_add_uint_format(tree, hf_gtpv1_ranap_cause, tvb, offset, 2, ranap, "%s (Protocol Cause) : %s (%u)", val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"), val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2883 if(ranap > 112 && ranap <=128)
2884 proto_tree_add_uint_format(tree, hf_gtpv1_ranap_cause, tvb, offset, 2, ranap, "%s (Miscellaneous Cause) : %s (%u)", val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"), val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2886 if(ranap > 128 && ranap <=255)
2887 proto_tree_add_uint_format(tree, hf_gtpv1_ranap_cause, tvb, offset, 2, ranap, "%s (Non-standard Cause) : %s (%u)", val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"), val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2892 /* GPRS: not present
2893 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
2896 decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2898 guint8 nsapi, dl_pdcp_seq, ul_pdcp_seq;
2899 guint16 dl_gtpu_seq, ul_gtpu_seq;
2900 proto_tree *ext_tree_rab_cntxt;
2903 te = proto_tree_add_text(tree, tvb, offset, 8, val_to_str(GTP_EXT_RAB_CNTXT, gtp_val, "Unknown message"));
2904 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
2906 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2907 dl_gtpu_seq = tvb_get_ntohs(tvb, offset+2);
2908 ul_gtpu_seq = tvb_get_ntohs(tvb, offset+4);
2909 dl_pdcp_seq = tvb_get_guint8(tvb, offset+6);
2910 ul_pdcp_seq = tvb_get_guint8(tvb, offset+7);
2912 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_nsapi, tvb, offset+1, 1, nsapi);
2913 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_gtpu_dn, tvb, offset+2, 2, dl_gtpu_seq);
2914 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_gtpu_up, tvb, offset+4, 2, ul_gtpu_seq);
2915 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_pdu_dn, tvb, offset+6, 1, dl_pdcp_seq);
2916 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_pdu_up, tvb, offset+7, 1, ul_pdcp_seq);
2922 /* GPRS: not present
2923 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
2926 decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2930 rp_sms = tvb_get_guint8(tvb, offset+1) & 0x07;
2931 proto_tree_add_uint(tree, hf_gtpv1_rp_sms, tvb, offset, 2, rp_sms);
2936 /* GPRS: not present
2937 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
2940 decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2942 proto_tree *ext_tree_rp;
2944 guint8 nsapi, rp, spare;
2946 nsapi = tvb_get_guint8(tvb, offset+1) & 0xF0;
2947 spare = tvb_get_guint8(tvb, offset+1) & 0x08;
2948 rp = tvb_get_guint8(tvb, offset+1) & 0x07;
2950 te = proto_tree_add_uint_format(tree, hf_gtpv1_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
2951 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
2953 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp_nsapi, tvb, offset+1, 1, nsapi);
2954 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp_spare, tvb, offset+1, 1, spare);
2955 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp, tvb, offset+1, 1, rp);
2960 /* GPRS: not present
2961 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
2964 decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2966 proto_tree *ext_tree_pkt_flow_id;
2968 guint8 nsapi, pkt_flow_id;
2970 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2971 pkt_flow_id = tvb_get_guint8(tvb, offset+2);
2973 te = proto_tree_add_uint_format(tree, hf_gtpv1_pkt_flow_id, tvb, offset, 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi, pkt_flow_id);
2974 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
2976 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtpv1_nsapi, tvb, offset+1, 1, nsapi);
2977 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtpv1_pkt_flow_id, tvb, offset+2, 1, pkt_flow_id, "%s : %u", val_to_str(GTP_EXT_PKT_FLOW_ID, gtp_val, "Unknown message"), pkt_flow_id);
2982 /* GPRS: not present
2983 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
2984 * TODO: Differenciate these uints?
2987 decode_gtp_chrg_char(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2991 proto_tree *ext_tree_chrg_char;
2993 chrg_char = tvb_get_ntohs(tvb, offset+1);
2995 te = proto_tree_add_text(tree, tvb, offset, 3, "%s: %x", val_to_str(GTP_EXT_CHRG_CHAR, gtp_val, "Unknown message"), chrg_char);
2996 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
2998 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_s, tvb, offset+1, 2, chrg_char);
2999 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_n, tvb, offset+1, 2, chrg_char);
3000 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_p, tvb, offset+1, 2, chrg_char);
3001 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_f, tvb, offset+1, 2, chrg_char);
3002 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_h, tvb, offset+1, 2, chrg_char);
3003 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_r, tvb, offset+1, 2, chrg_char);
3008 /* GPRS: not present
3009 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3012 decode_gtp_trace_ref(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3016 trace_ref = tvb_get_ntohs(tvb, offset+1);
3018 proto_tree_add_uint(tree, hf_gtpv1_trace_ref, tvb, offset, 3, trace_ref);
3023 /* GPRS: not present
3024 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3027 decode_gtp_trace_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3031 trace_type = tvb_get_ntohs(tvb, offset+1);
3033 proto_tree_add_uint(tree, hf_gtpv1_trace_type, tvb, offset, 3, trace_type);
3038 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3039 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3042 decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3046 reason = tvb_get_guint8(tvb, offset+1);
3048 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ms_reason : hf_gtpv0_ms_reason, tvb, offset, 2, reason);
3058 decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3062 tr_command = tvb_get_ntohl(tvb, offset+1);
3064 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tr_comm : hf_gtpv0_tr_comm, tvb, offset, 2, tr_command);
3069 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3070 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3073 decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3077 chrg_id = tvb_get_ntohl(tvb, offset+1);
3078 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_chrg_id : hf_gtpv0_chrg_id, tvb, offset, 5, chrg_id);
3083 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3084 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3087 decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3090 guint8 pdp_typ, pdp_org;
3092 struct e_in6_addr addr_ipv6;
3093 proto_tree *ext_tree_user;
3097 length = tvb_get_ntohs(tvb, offset+1);
3098 pdp_org = tvb_get_guint8(tvb, offset+3) & 0x0F;
3099 pdp_typ = tvb_get_guint8(tvb, offset+4);
3101 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s (%s/%s)",
3102 val_to_str(GTP_EXT_USER_ADDR, gtp_val, "Unknown message"),
3103 val_to_str(pdp_org, pdp_org_type, "Unknown PDP Organization"),
3104 val_to_str(pdp_typ, pdp_type, "Unknown PDP Type"));
3105 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3107 proto_tree_add_text(ext_tree_user, tvb, offset+1, 2, "Length : %u", length);
3108 proto_tree_add_uint(ext_tree_user, gtp_version ? hf_gtpv1_user_addr_pdp_org : hf_gtpv0_user_addr_pdp_org, tvb, offset+3, 1, pdp_org);
3109 proto_tree_add_uint(ext_tree_user, gtp_version ? hf_gtpv1_user_addr_pdp_type : hf_gtpv0_user_addr_pdp_type, tvb, offset+4, 1, pdp_typ);
3112 if (pdp_org == 0 && pdp_typ == 1)
3113 proto_item_append_text(te, " (Point to Point Protocol)");
3114 else if (pdp_typ == 2)
3115 proto_item_append_text(te, " (Octet Stream Protocol)");
3116 } else if (length > 2) {
3119 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+5, sizeof addr_ipv4);
3120 proto_tree_add_ipv4(ext_tree_user, gtp_version ? hf_gtpv1_user_ipv4 : hf_gtpv0_user_ipv4, tvb, offset+5, 4, addr_ipv4);
3121 proto_item_append_text(te, " : %s", ip_to_str((guint8 *)&addr_ipv4));
3124 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+5, sizeof addr_ipv6);
3125 proto_tree_add_ipv6(ext_tree_user, gtp_version ? hf_gtpv1_user_ipv6 : hf_gtpv0_user_ipv6, tvb, offset+5, 16, (guint8 *)&addr_ipv6);
3126 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3130 proto_item_append_text(te, " : empty PDP Address");
3136 decode_triplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
3138 proto_tree *ext_tree_trip;
3139 proto_item *te_trip;
3140 guint32 rand[4], sres, kc[2];
3143 for (i=0;i<count;i++) {
3145 tvb_memcpy(tvb, (guint8 *)&rand, offset+i*28, 16);
3146 sres = tvb_get_ntohl(tvb, offset+i*28+16);
3147 tvb_memcpy(tvb, (guint8 *)&kc, offset+i*28+20, 8);
3149 te_trip = proto_tree_add_text(tree, tvb, offset+i*28, 28, "Triplet no%x", i);
3150 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3152 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28, 16, "RAND: %x%x%x%x", rand[0], rand[1], rand[2], rand[3]);
3153 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+16, 4, "SRES: %x", sres);
3154 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+20, 8, "Kc: %x%x", kc[0], kc[1]);
3160 /* adjust - how many bytes before quintuplet should be highlighted
3163 decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count, guint8 adjust) {
3165 proto_tree *ext_tree_quint;
3166 proto_item *te_quint;
3167 guint32 rand[4], q_ck[4], q_ik[4];
3168 guint16 q_len, xres_len, auth_len, q_offset, i;
3172 for (i=0;i<count;i++) {
3174 offset = offset + q_offset;
3176 q_len = tvb_get_ntohs(tvb, offset);
3178 tvb_memcpy(tvb, (guint8 *)&rand, offset+2, 16);
3179 xres_len = tvb_get_ntohs(tvb, offset+18);
3180 /* xres = tvb_get_ptr(tvb, offset+20, xres_len);*/
3181 tvb_memcpy(tvb, (guint8 *)&q_ck, offset+20+xres_len, 16);
3182 tvb_memcpy(tvb, (guint8 *)&q_ik, offset+36+xres_len, 16);
3183 auth_len = tvb_get_ntohs(tvb, offset+52+xres_len);
3184 /* auth = tvb_get_ptr(tvb, offset+54+xres_len, auth_len);*/
3186 te_quint = proto_tree_add_text(tree, tvb, offset-adjust, q_len+adjust, "Quintuplet #%x", i);
3187 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3189 proto_tree_add_text(ext_tree_quint, tvb, offset, 2, "Length: %x", q_len);
3190 proto_tree_add_text(ext_tree_quint, tvb, offset+2, 16, "RAND: %x%x%x%x", rand[0], rand[1], rand[2], rand[3]);
3191 proto_tree_add_text(ext_tree_quint, tvb, offset+18, 2, "XRES length: %x", xres_len);
3192 proto_tree_add_text(ext_tree_quint, tvb, offset+20, xres_len, "XRES");
3193 proto_tree_add_text(ext_tree_quint, tvb, offset+20+xres_len, 16, "Quintuplet ciphering key: %x%x%x%x", q_ck[0], q_ck[1], q_ck[2], q_ck[3]);
3194 proto_tree_add_text(ext_tree_quint, tvb, offset+36+xres_len, 16, "Quintuplet integrity key: %x%x%x%x", q_ik[0], q_ik[1], q_ik[2], q_ik[3]);
3195 proto_tree_add_text(ext_tree_quint, tvb, offset+52+xres_len, 2, "Authentication length: %x", auth_len);
3196 proto_tree_add_text(ext_tree_quint, tvb, offset+54+xres_len, auth_len, "AUTH");
3198 q_offset = q_offset + q_len + 2;
3204 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3205 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3206 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3207 * - finish displaying last 3 parameters
3210 decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3212 guint16 length, quint_len, net_cap, con_len;
3213 guint8 cksn, count, sec_mode, cipher, trans_id, proto_disc, message, drx_split, drx_len, drx_ccch, non_drx_timer;
3214 guint32 kc[4], ik[4];
3215 proto_tree *ext_tree_mm;
3218 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_MM_CNTXT, gtp_val, "Unknown message"));
3219 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3221 length = tvb_get_ntohs(tvb, offset+1);
3222 if (length < 1) return 3;
3224 cksn = tvb_get_guint8(tvb, offset+3) & 0x07;
3225 sec_mode = (tvb_get_guint8(tvb, offset+4) >> 6) & 0x03;
3226 count = (tvb_get_guint8(tvb, offset+4) >> 3) & 0x07;
3227 cipher = tvb_get_guint8(tvb, offset+4) & 0x07;
3229 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 2, "Length: %x", length);
3230 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Ciphering Key Sequence Number: %u", cksn);
3231 if (gtp_version != 0) {
3232 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Security type: %u", sec_mode);
3237 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "No of triplets: %u", count);
3242 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3244 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3246 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 16);
3247 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %x%x%x%x", kc[0], kc[1], kc[2], kc[3]);
3248 tvb_memcpy(tvb, (guint8 *)&ik, offset+21, 16);
3249 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key CK: %x%x%x%x", ik[0], ik[1], ik[2], ik[3]);
3250 quint_len = tvb_get_ntohs(tvb, offset+37);
3251 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
3253 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
3259 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3261 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3263 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 8);
3264 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %x%x", kc[0], kc[1]);
3266 offset = offset + decode_triplet(tvb, offset+13, ext_tree_mm, count) + 13;
3270 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 16);
3271 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %x%x%x%x", kc[0], kc[1], kc[2], kc[3]);
3272 tvb_memcpy(tvb, (guint8 *)&ik, offset+21, 16);
3273 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key CK: %x%x%x%x", ik[0], ik[1], ik[2], ik[3]);
3274 quint_len = tvb_get_ntohs(tvb, offset+37);
3275 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
3277 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
3282 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3284 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3286 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 8);
3287 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %x%x", kc[0], kc[1]);
3288 quint_len = tvb_get_ntohs(tvb, offset+13);
3289 proto_tree_add_text(ext_tree_mm, tvb, offset+13, 2, "Quintuplets length: %x", quint_len);
3291 offset = offset + decode_quintuplet(tvb, offset+15, ext_tree_mm, count, 0) + 15;
3299 drx_split = tvb_get_guint8(tvb, offset);
3300 drx_len = (tvb_get_guint8(tvb, offset+1) >> 4) & 0x0F;
3301 drx_ccch = (tvb_get_guint8(tvb, offset+1) >> 3) & 0x01;
3302 non_drx_timer = tvb_get_guint8(tvb, offset+1) & 0x07;
3304 net_cap = tvb_get_ntohs(tvb, offset+2);
3305 con_len = tvb_get_ntohs(tvb, offset+4);
3307 proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "DRX: split PG cycle code: %u", drx_split);
3308 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: CN specific DRX cycle length coefficient: %u", drx_len);
3309 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: split PG cycle on CCCH supported by MS: %s", yesno[drx_ccch]);
3310 if (non_drx_timer == 0) {
3311 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: no non-DRX mode after transfer state");
3313 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: max sec non-DRX mode after transfer state: 2^%u", non_drx_timer-1);
3316 proto_tree_add_text(ext_tree_mm, tvb, offset+2, 2, "MS network capability: %u", net_cap);
3317 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 2, "Container length: %u", con_len);
3320 trans_id = (tvb_get_guint8(tvb, offset+6) >> 4) & 0x0F;
3321 proto_disc = tvb_get_guint8(tvb, offset+6) & 0x0F;
3322 message = tvb_get_guint8(tvb, offset+7);
3328 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3329 * so type means length of length :-)
3332 decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 type) {
3335 guint8 al_ret_priority;
3336 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3337 guint8 traf_class, del_order, del_err_sdu;
3338 guint8 max_sdu_size, max_ul, max_dl;
3339 guint8 res_ber, sdu_err_ratio;
3340 guint8 trans_delay, traf_handl_prio;
3341 guint8 guar_ul, guar_dl;
3342 proto_tree *ext_tree_qos;
3344 int mss, mu, md, gu, gd;
3348 length = tvb_get_guint8 (tvb, offset);
3349 te = proto_tree_add_text (tree, tvb, offset, length + 1, "%s", qos_str);
3350 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3351 proto_tree_add_text (ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3354 length = tvb_get_ntohs (tvb, offset + 1);
3355 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3356 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3357 proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3358 type++; /* +1 because of first 0x86 byte for UMTS QoS */
3361 /* XXX - what should we do with the length here? */
3363 ext_tree_qos = NULL;
3369 al_ret_priority = tvb_get_guint8 (tvb, offset);
3371 spare1 = tvb_get_guint8(tvb, offset+1) & 0xC0;
3372 delay = tvb_get_guint8(tvb, offset+1) & 0x38;
3373 reliability = tvb_get_guint8(tvb, offset+1) & 0x07;
3374 peak = tvb_get_guint8(tvb, offset+2) & 0xF0;
3375 spare2 = tvb_get_guint8(tvb, offset+2) & 0x08;
3376 precedence = tvb_get_guint8(tvb, offset+2) & 0x07;
3377 spare3 = tvb_get_guint8(tvb, offset+3) & 0xE0;
3378 mean = tvb_get_guint8(tvb, offset+3) & 0x1F;
3380 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3381 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare1, tvb, offset+1, 1, spare1);
3382 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_delay, tvb, offset+1, 1, delay);
3383 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_reliability, tvb, offset+1, 1, reliability);
3384 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_peak, tvb, offset+2, 1, peak);
3385 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare2, tvb, offset+2, 1, spare2);
3386 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_precedence, tvb, offset+2, 1, precedence);
3387 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare3, tvb, offset+3, 1, spare3);
3388 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_mean, tvb, offset+3, 1, mean);
3392 traf_class = tvb_get_guint8(tvb, offset+4) & 0xE0;
3393 del_order = tvb_get_guint8(tvb, offset+4) & 0x18;
3394 del_err_sdu = tvb_get_guint8(tvb, offset+4) & 0x07;
3395 max_sdu_size = tvb_get_guint8(tvb, offset+5);
3396 max_dl = tvb_get_guint8(tvb, offset+6);
3397 max_ul = tvb_get_guint8(tvb, offset+7);
3398 res_ber = tvb_get_guint8(tvb, offset+8) & 0xF0;
3399 sdu_err_ratio = tvb_get_guint8(tvb, offset+8) & 0x0F;
3400 trans_delay = tvb_get_guint8(tvb, offset+9) & 0xFC;
3401 traf_handl_prio = tvb_get_guint8(tvb, offset+9) & 0x03;
3402 guar_ul = tvb_get_guint8(tvb, offset+10);
3403 guar_dl = tvb_get_guint8(tvb, offset+11);
3405 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_class, tvb, offset+4, 1, traf_class);
3406 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_order, tvb, offset+4, 1, del_order);
3407 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_err_sdu, tvb, offset+4, 1, del_err_sdu);
3408 if (max_sdu_size == 0 || max_sdu_size > 150)
3409 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+5, 1, max_sdu_size);
3410 if (max_sdu_size > 0 && max_sdu_size <= 150) {
3411 mss = max_sdu_size*10;
3412 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+5, 1, mss, "Maximum SDU size : %u octets", mss);
3415 if(max_ul == 0 || max_ul == 255)
3416 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, max_ul);
3417 if(max_ul > 0 && max_ul <= 63)
3418 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, max_ul, "Maximum bit rate for uplink : %u kbps", max_ul);
3419 if(max_ul > 63 && max_ul <=127) {
3420 mu = 64 + ( max_ul - 64 ) * 8;
3421 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, mu, "Maximum bit rate for uplink : %u kbps", mu);
3424 if(max_ul > 127 && max_ul <=254) {
3425 mu = 576 + ( max_ul - 128 ) * 64;
3426 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, mu, "Maximum bit rate for uplink : %u kbps", mu);
3429 if(max_dl == 0 || max_dl == 255)
3430 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, max_dl);
3431 if(max_dl > 0 && max_dl <= 63)
3432 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, max_dl, "Maximum bit rate for downlink : %u kbps", max_dl);
3433 if(max_dl > 63 && max_dl <=127) {
3434 md = 64 + ( max_dl - 64 ) * 8;
3435 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, md, "Maximum bit rate for downlink : %u kbps", md);
3437 if(max_dl > 127 && max_dl <=254) {
3438 md = 576 + ( max_dl - 128 ) * 64;
3439 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, md, "Maximum bit rate for downlink : %u kbps", md);
3442 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_res_ber, tvb, offset+8, 1, res_ber);
3443 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_sdu_err_ratio, tvb, offset+8, 1, sdu_err_ratio);
3444 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_trans_delay, tvb, offset+9, 1, trans_delay);
3445 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_handl_prio, tvb, offset+9, 1, traf_handl_prio);
3447 if(guar_ul == 0 || guar_ul == 255)
3448 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, guar_ul);
3449 if(guar_ul > 0 && guar_ul <= 63)
3450 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, guar_ul, "Guaranteed bit rate for uplink : %u kbps", guar_ul);
3451 if(guar_ul > 63 && guar_ul <=127) {
3452 gu = 64 + ( guar_ul - 64 ) * 8;
3453 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3455 if(guar_ul > 127 && guar_ul <=254) {
3456 gu = 576 + ( guar_ul - 128 ) * 64;
3457 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3460 if(guar_dl == 0 || guar_dl == 255)
3461 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, guar_dl);
3462 if(guar_dl > 0 && guar_dl <= 63)
3463 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, guar_dl, "Guaranteed bit rate for downlink : %u kbps", guar_dl);
3464 if(guar_dl > 63 && guar_dl <=127) {
3465 gd = 64 + ( guar_dl - 64 ) * 8;
3466 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3468 if(guar_dl > 127 && guar_dl <=254) {
3469 gd = 576 + ( guar_dl - 128 ) * 64;
3470 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3475 return length + type;
3480 decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) {
3483 guint8 name_len, tmp;
3486 apn = g_malloc (length + 1);
3487 name_len = tvb_get_guint8 (tvb, offset);
3489 if (name_len < 0x20) {
3490 tvb_memcpy (tvb, apn, offset + 1, length);
3492 if (name_len >= length - 1) break;
3494 name_len = name_len + apn[tmp] + 1;
3498 tvb_memcpy (tvb, apn, offset, length);
3501 apn[length-1] = '\0';
3502 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_apn : hf_gtpv0_apn, tvb, offset, length, apn);
3507 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
3508 * UMTS: 29.060 v4.0, chapter 7.7.29
3509 * TODO: unify addr functions
3512 decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3514 guint8 ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id,
3515 pdp_type_org, pdp_type_num, pdp_addr_len;
3516 guint16 length, sn_down, sn_up, up_flow;
3517 guint32 addr_ipv4, up_teid, up_teid_cp;
3518 struct e_in6_addr addr_ipv6;
3519 proto_tree *ext_tree_pdp;
3522 length = tvb_get_ntohs(tvb, offset+1);
3524 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_PDP_CNTXT, gtp_val, "Unknown message"));
3525 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
3527 vaa = (tvb_get_guint8(tvb, offset+3) >> 6) & 0x01;
3528 order = (tvb_get_guint8(tvb, offset+3) >> 4) & 0x01;
3529 nsapi = tvb_get_guint8(tvb, offset+3) & 0x0F;
3530 sapi = tvb_get_guint8(tvb, offset+4) & 0x0F;
3532 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "VPLMN address allowed: %s", yesno[vaa]);
3533 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "Reordering required: %s", yesno[order]);
3534 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "NSAPI: %u", nsapi);
3535 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "SAPI: %u", sapi);
3537 switch (gtp_version) {
3539 decode_qos_gprs(tvb, offset+5, ext_tree_pdp, "QoS subscribed", 0);
3540 decode_qos_gprs(tvb, offset+8, ext_tree_pdp, "QoS requested", 0);
3541 decode_qos_gprs(tvb, offset+11, ext_tree_pdp, "QoS negotiated", 0);
3542 offset = offset + 14;
3545 offset = offset + 5;
3546 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
3547 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
3548 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
3554 sn_down = tvb_get_ntohs(tvb, offset);
3555 sn_up = tvb_get_ntohs(tvb, offset+2);
3556 pdu_send_no = tvb_get_guint8(tvb, offset+4);
3557 pdu_rec_no = tvb_get_guint8(tvb, offset+5);
3559 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
3560 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 2, "Sequence number up: %u", sn_up);
3561 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "Send N-PDU number: %u", pdu_send_no);
3562 proto_tree_add_text(ext_tree_pdp, tvb, offset+5, 1, "Receive N-PDU number: %u", pdu_rec_no);
3564 switch (gtp_version) {
3566 up_flow = tvb_get_ntohs(tvb, offset+6);
3567 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 2, "Uplink flow label signalling: %u", up_flow);
3568 offset = offset + 8;
3571 up_teid = tvb_get_ntohl(tvb, offset+6);
3572 up_teid_cp = tvb_get_ntohl(tvb, offset+10);
3573 pdp_cntxt_id = tvb_get_guint8(tvb, offset+14);
3574 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 4, "Uplink TEID: %x", up_teid);
3575 proto_tree_add_text(ext_tree_pdp, tvb, offset+10, 4, "Uplink TEID control plane: %x", up_teid_cp);
3576 proto_tree_add_text(ext_tree_pdp, tvb, offset+14, 1, "PDP context identifier: %u", pdp_cntxt_id);
3577 offset = offset + 15;
3583 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
3584 pdp_type_num = tvb_get_guint8(tvb, offset+1);
3585 pdp_addr_len = tvb_get_guint8(tvb, offset+2);
3587 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP org"));
3588 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 1, "PDP type: %s", val_to_str(pdp_type_num, pdp_org_type, "Unknown PDP type"));
3589 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 1, "PDP address length: %u", pdp_addr_len);
3591 if (pdp_addr_len > 0) {
3592 switch (pdp_type_num) {
3594 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3595 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 4, "PDP address: %s", ip_to_str((guint8 *)&addr_ipv4));
3598 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3599 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3606 offset = offset + 3 + pdp_addr_len;
3608 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3609 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
3611 switch (ggsn_addr_len) {
3613 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3614 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN address: %s", ip_to_str((guint8 *)&addr_ipv4));
3617 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3618 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3624 offset = offset + 1 + ggsn_addr_len;
3626 if (gtp_version == 1) {
3628 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3629 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
3631 switch (ggsn_addr_len) {
3633 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3634 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
3637 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3638 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3643 offset = offset + 1 + ggsn_addr_len;
3647 apn_len = tvb_get_guint8(tvb, offset);
3648 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
3649 decode_apn(tvb, offset+1, apn_len, ext_tree_pdp);
3651 offset = offset + 1 + apn_len;
3653 trans_id = tvb_get_guint8(tvb, offset);
3654 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "Transaction identifier: %u", trans_id);
3659 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
3660 * UMTS: 29.060, v4.0, chapter 7.7.30
3663 decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3666 proto_tree *ext_tree_apn;
3669 length = tvb_get_ntohs(tvb, offset+1);
3671 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_APN, gtp_val, "Unknown field"));
3672 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
3674 proto_tree_add_text(ext_tree_apn, tvb, offset+1, 2, "APN length : %u", length);
3675 decode_apn(tvb, offset+3, length, ext_tree_apn);
3680 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
3681 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
3682 * UMTS: 29.060 v4.0, chapter 7.7.31
3683 * 24.008, v4.2, chapter 10.5.6.3
3684 * TODO: check if length is 8 or 16 bits
3685 * - proto_conf in 3G */
3687 decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3689 guint16 length, proto_offset;
3690 guint8 *ptr, conf, proto_len, tmp, msg;
3692 proto_tree *ext_tree_proto;
3695 length = tvb_get_ntohs(tvb, offset + 1);
3697 te = proto_tree_add_text(tree, tvb, offset, length + 3, val_to_str(GTP_EXT_PROTO_CONF, gtp_val, "Unknown message"));
3698 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
3700 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
3702 if (length < 1) return 3;
3704 conf = tvb_get_guint8(tvb, offset + 3) & 0x07;
3705 proto_offset = 1; /* ... 1st byte is conf */
3708 if (proto_offset >= length) break;
3709 proto_len = tvb_get_guint8(tvb, offset + 6);
3710 proto_offset += proto_len + 3;
3712 if ((proto_len > 0) && ppp_reorder) {
3714 /* this part changes layout of GTP payload:
3715 * it swaps "length field" with "protocol header" */
3717 ptr = (guint8 *)tvb_get_ptr(tvb, offset + 4, 3);
3724 next_tvb = tvb_new_subset(tvb, offset + 5, proto_len + 2, proto_len + 2);
3725 call_dissector(ppp_handle, next_tvb, pinfo, ext_tree_proto);
3727 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3728 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
3730 if (check_col(pinfo->cinfo, COL_INFO)) {
3732 msg = tvb_get_guint8(tvb, 1);
3734 col_set_str(pinfo->cinfo, COL_INFO, val_to_str(msg, message_type, "Unknown"));
3742 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
3743 * UMTS: 29.060 v4.0, chapter 7.7.32
3746 decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3748 guint8 addr_type, addr_len;
3751 struct e_in6_addr addr_ipv6;
3752 proto_tree *ext_tree_gsn_addr;
3755 length = tvb_get_ntohs(tvb, offset+1);
3757 te = proto_tree_add_text(tree, tvb, offset, 3+length, "GSN address : ");
3758 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
3762 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3763 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3764 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3765 proto_tree_add_ipv4(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv4 : hf_gtpv0_gsn_ipv4, tvb, offset+3, 4, addr_ipv4);
3768 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3769 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3770 proto_tree_add_uint(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_addr_type : hf_gtpv0_gsn_addr_type, tvb, offset+3, 1, addr_type);
3771 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3772 proto_tree_add_uint(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_addr_len : hf_gtpv0_gsn_addr_len, tvb, offset+3, 1, addr_len);
3773 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+4, sizeof addr_ipv4);
3774 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3775 proto_tree_add_ipv4(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv4 : hf_gtpv0_gsn_ipv4, tvb, offset+4, 4, addr_ipv4);
3778 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3779 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3780 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3781 proto_tree_add_ipv6(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv6 : hf_gtpv0_gsn_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
3784 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3785 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3786 proto_tree_add_uint(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_addr_type : hf_gtpv0_gsn_addr_type, tvb, offset+3, 1, addr_type);
3787 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3788 proto_tree_add_uint(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_addr_len : hf_gtpv0_gsn_addr_len, tvb, offset+3, 1, addr_len);
3789 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+4, sizeof addr_ipv6);
3790 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3791 proto_tree_add_ipv6(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv6 : hf_gtpv0_gsn_ipv6, tvb, offset+4, 16, (guint8*)&addr_ipv6);
3794 proto_item_append_text(te, "unknown type or wrong length");
3801 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
3802 * UMTS: 29.060 v4.0, chapter 7.7.33
3805 decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3807 const guint8 *msisdn_val;
3811 length = tvb_get_ntohs(tvb, offset+1);
3813 if (length < 1) return 3;
3815 msisdn_val = tvb_get_ptr(tvb, offset+3, length);
3816 msisdn_str = msisdn_to_str(msisdn_val, length);
3818 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_msisdn : hf_gtpv0_msisdn, tvb, offset, 3+length, msisdn_str);
3823 /* GPRS: not present
3824 * UMTS: 29.060 v4.0, chapter 7.7.34
3825 * 24.008 v4.2, chapter 10.5.6.5
3828 decode_gtp_qos_umts(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3830 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
3833 /* GPRS: not present
3834 * UMTS: 29.060 v4.0, chapter 7.7.35
3837 decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3839 return (1 + decode_quintuplet(tvb, offset+1, tree, 1, 1));
3843 /* GPRS: not present
3844 * UMTS: 29.060 v4.0, chapter 7.7.36
3845 * 24.008 v4.2, chapter 10.5.6.12
3848 decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3850 guint16 length, port1, port2, tos;
3851 guint8 tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, pf_offset, proto;
3852 guint32 addr_ipv4, ipsec_id, label;
3853 struct e_in6_addr addr_ipv6;
3854 proto_tree *ext_tree_tft, *ext_tree_tft_pf;
3855 proto_item *te, *tee;
3857 length = tvb_get_ntohs(tvb, offset+1);
3859 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Traffic flow template");
3860 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
3862 tft_code = (tvb_get_guint8(tvb, offset+3) >> 5) & 0x07;
3863 no_packet_filters = tvb_get_guint8(tvb, offset+3) & 0x0F;
3865 proto_tree_add_text(ext_tree_tft, tvb, offset+1, 2, "TFT length: %u", length);
3866 proto_tree_add_text(ext_tree_tft, tvb, offset+3, 1, "TFT operation code: %u", tft_code);
3867 proto_tree_add_text(ext_tree_tft, tvb, offset+3, 1, "Number of packet filters: %u", no_packet_filters);
3869 offset = offset + 4;
3871 for (i=0;i<no_packet_filters;i++) {
3873 pf_id = tvb_get_guint8(tvb, offset);
3875 tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
3876 ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
3878 if (tft_code != 2) {
3880 pf_eval = tvb_get_guint8(tvb, offset+1);
3881 pf_len = tvb_get_guint8(tvb, offset+2);
3883 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+1, 1, "Evaluation precedence: %u", pf_eval);
3884 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+2, 1, "Contents length: %u", pf_len);
3886 offset = offset + 3;
3889 while (pf_offset < pf_len) {
3891 pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
3893 switch (pf_content_id) {
3894 /* address IPv4 and mask = 8 bytes*/
3896 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Address IPv4 and mask (0x10)");
3897 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 1, sizeof addr_ipv4);
3898 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\tAddress: %s", ip_to_str((guint8 *)&addr_ipv4));
3899 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 5, sizeof addr_ipv4);
3900 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 5, 4, "\tNetmask: %s", ip_to_str((guint8 *)&addr_ipv4));
3901 pf_offset = pf_offset + 9;
3903 /* address IPv6 and mask = 32 bytes*/
3905 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Address IPv6 and mask (0x20)");
3906 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+pf_offset+1, sizeof addr_ipv6);
3907 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+offset+1, 16, "\tAddress: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3908 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+pf_offset+17, sizeof addr_ipv6);
3909 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+offset+17, 16, "\tNetmask: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3910 pf_offset = pf_offset + 33;
3912 /* protocol identifier/next header type = 1 byte*/
3914 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "IPv4 protocol identifier/IPv6 next header (0x30)");
3915 proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
3916 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 1, "\t%u", proto);
3917 pf_offset = pf_offset + 2;
3919 /* single destination port type = 2 bytes */
3921 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Destination port (0x40)");
3922 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3923 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", port1);
3924 pf_offset = pf_offset + 3;
3926 /* destination port range type = 4 bytes */
3928 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Destination port range (0x41)");
3929 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3930 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
3931 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%u-%u", port1, port2);
3932 pf_offset = pf_offset + 5;
3934 /* single source port type = 2 bytes */
3936 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Source port (0x50)");
3937 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3938 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", port1);
3939 pf_offset = pf_offset + 3;
3941 /* source port range type = 4 bytes */
3943 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Source port range (0x51)");
3944 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3945 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
3946 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%u-%u", port1, port2);
3947 pf_offset = pf_offset + 5;
3949 /* security parameter index type = 4 bytes */
3951 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Security parameter index (0x60)");
3952 ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
3953 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%x", ipsec_id);
3954 pf_offset = pf_offset + 5;
3956 /* type of service/traffic class type = 2 bytes */
3958 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Type of Service/Traffic Class (0x70)");
3959 tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3960 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", tos);
3961 pf_offset = pf_offset + 3;
3963 /* flow label type = 3 bytes */
3965 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Flow label (0x80)");
3966 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;;
3967 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 3, "\t%x", label);
3968 pf_offset = pf_offset + 4;
3981 /* GPRS: not present
3982 * UMTS: 29.060 v4.0, chapter 7.7.37
3983 * 25.413 v3.4, chapter ???
3986 decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3990 length = tvb_get_ntohs(tvb, offset + 1);
3992 proto_tree_add_text(tree, tvb, offset, 3 + length, "Targer Identification");
3998 /* GPRS: not present
3999 * UMTS: 29.060 v4.0, chapter 7.7.38
4002 decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4006 length = tvb_get_ntohs(tvb, offset + 1);
4008 proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
4015 /* GPRS: not present
4016 * UMTS: 29.060 v4.0, chapter 7.7.39
4019 decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4021 guint32 teid, addr_ipv4;
4024 struct e_in6_addr addr_ipv6;
4025 proto_tree *ext_tree_rab_setup;
4028 length = tvb_get_ntohs(tvb, offset + 1);
4029 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4031 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Radio Access Bearer Setup Information");
4032 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
4034 proto_tree_add_text(ext_tree_rab_setup, tvb, offset+1, 2, "RAB setup length : %u", length);
4035 proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_nsapi, tvb, offset+3, 1, nsapi);
4039 teid = tvb_get_ntohl(tvb, offset + 4);
4041 proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_teid_data, tvb, offset+4, 4, teid);
4045 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+8, sizeof addr_ipv4);
4046 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtpv1_rnc_ipv4, tvb, offset+8, 4, addr_ipv4);
4049 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+8, sizeof addr_ipv6);
4050 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtpv1_rnc_ipv6, tvb, offset+8, 16, (guint8 *)&addr_ipv6);
4061 /* GPRS: not present
4062 * UMTS: 29.060 v4.0, chapter 7.7.40
4065 decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4069 proto_tree *ext_tree_hdr_list;
4072 length = tvb_get_guint8(tvb, offset + 1);
4074 te = proto_tree_add_text(tree, tvb, offset, 2+length, "%s", val_to_str(GTP_EXT_HDR_LIST, gtp_val, "Unknown"));
4075 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4077 proto_tree_add_text(ext_tree_hdr_list, tvb, offset+1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4079 for(i=0 ; i<length ; i++) {
4080 hdr = tvb_get_guint8(tvb, offset+2+i);
4082 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);
4088 /* GPRS: not present
4089 * UMTS: 29.060 v4.0, chapter 7.7.41
4090 * TODO: find TriggerID description
4093 decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4097 length = tvb_get_ntohs(tvb, offset + 1);
4099 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_TRIGGER_ID, gtp_val, "Unknown"), length);
4105 /* GPRS: not present
4106 * UMTS: 29.060 v4.0, chapter 7.7.42
4107 * TODO: find OMC-ID description
4110 decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4114 length = tvb_get_ntohs(tvb, offset + 1);
4116 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_OMC_ID, gtp_val, "Unknown"), length);
4122 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
4123 * UMTS: 29.060 v4.0, chapter 7.7.43
4126 decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4130 struct e_in6_addr addr_ipv6;
4131 proto_tree *ext_tree_chrg_addr;
4134 length = tvb_get_ntohs(tvb, offset+1);
4136 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"));
4137 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
4139 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);
4143 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
4144 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4145 proto_tree_add_ipv4(ext_tree_chrg_addr, gtp_version ? hf_gtpv1_chrg_ipv4 : hf_gtpv0_chrg_ipv4, tvb, offset+3, 4, addr_ipv4);
4148 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
4149 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4150 proto_tree_add_ipv6(ext_tree_chrg_addr, gtp_version ? hf_gtpv1_chrg_ipv6 : hf_gtpv0_chrg_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
4153 proto_item_append_text(te, "unknown type or wrong length");
4164 decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4166 guint16 length, n, number;
4167 proto_tree *ext_tree_rel_pack;
4170 length = tvb_get_ntohs(tvb, offset + 1);
4172 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
4173 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
4177 while (n < length) {
4179 number = tvb_get_ntohs(tvb, offset + 3 + n);
4180 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
4192 decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4194 guint16 length, n, number;
4195 proto_tree *ext_tree_can_pack;
4198 length = tvb_get_ntohs(tvb, offset + 1);
4200 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
4201 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
4205 while (n < length) {
4207 number = tvb_get_ntohs(tvb, offset + 3 + n);
4208 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
4216 /* CDRs dissector */
4218 decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4220 guint16 length, format_ver, data_len, i, j;
4221 guint8 no, format, rectype;
4222 proto_tree *ext_tree, *cdr_tree;
4223 proto_item *te, *ce;
4225 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
4226 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
4228 length = tvb_get_ntohs(tvb, offset + 1);
4229 no = tvb_get_guint8(tvb, offset + 3);
4230 format = tvb_get_guint8(tvb, offset + 4);
4231 format_ver = tvb_get_ntohs(tvb, offset + 5);
4233 proto_tree_add_text(ext_tree, tvb, offset+1, 2, "Length: %u", length);
4234 proto_tree_add_text(ext_tree, tvb, offset+3, 1, "Number of data records: %u", no);
4235 proto_tree_add_text(ext_tree, tvb, offset+4, 1, "Data record format: %u", format);
4236 proto_tree_add_text(ext_tree, tvb, offset+5, 2, "Data record format version: %u", format_ver);
4239 offset = offset + 7;
4241 if (gtpv0_cdr_as != DONT_DISSECT_CDRS) {
4243 for (i = 0; i < no; i++) {
4244 data_len = tvb_get_ntohs(tvb, offset);
4245 rectype = tvb_get_guint8(tvb, offset+2);
4247 case 0x13: /* GCDR */
4248 if (tvb_length_remaining(tvb, offset) < 3 + 118) {
4249 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "GCDR fragmented, can't dissect");
4253 tvb_memcpy(tvb, gcdr.imsi, offset+3, 8);
4254 tvb_memcpy(tvb, (guint8 *)&gcdr.ggsnaddr, offset+11, sizeof gcdr.ggsnaddr);
4255 gcdr.chrgid = tvb_get_ntohl(tvb, offset+15);
4256 tvb_memcpy(tvb, (guint8 *)&gcdr.sgsnaddr, offset+19, sizeof gcdr.sgsnaddr);
4257 tvb_memcpy(tvb, gcdr.apn, offset+23, 63);
4258 gcdr.pdporg = tvb_get_guint8(tvb, offset+86);
4259 gcdr.pdptype = tvb_get_guint8(tvb, offset+87);
4260 tvb_memcpy(tvb, (guint8 *)&gcdr.pdpaddr, offset+88, sizeof gcdr.pdpaddr);
4261 gcdr.addrflag = tvb_get_guint8(tvb, offset+92);
4262 gcdr.uplink = tvb_get_ntohl(tvb, offset+96);
4263 gcdr.downlink = tvb_get_ntohl(tvb, offset+100);
4264 gcdr.timestamp = tvb_get_ntohl(tvb, offset+104);
4265 gcdr.opening = tvb_get_ntohl(tvb, offset+108);
4266 gcdr.duration = tvb_get_ntohl(tvb, offset+112);
4267 gcdr.closecause = tvb_get_guint8(tvb, offset+116);
4268 gcdr.seqno = tvb_get_ntohl(tvb, offset+117);
4270 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "GCDR (0x13), sequence number: %u", gcdr.seqno);
4271 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4272 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4273 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4274 proto_tree_add_text(cdr_tree, tvb, offset+3, 8, "IMSI: %s", id_to_str(gcdr.imsi));
4275 proto_tree_add_text(cdr_tree, tvb, offset+11, 4, "GGSN address: %s", ip_to_str((guint8 *)&gcdr.ggsnaddr));
4276 proto_tree_add_text(cdr_tree, tvb, offset+15, 4, "Charging ID: %x", gcdr.chrgid);
4277 proto_tree_add_text(cdr_tree, tvb, offset+19, 4, "SGSN address: %s", ip_to_str((guint8 *)&gcdr.sgsnaddr));
4278 proto_tree_add_text(cdr_tree, tvb, offset+23, 63, "APN: %s", gcdr.apn);
4279 proto_tree_add_text(cdr_tree, tvb, offset+86, 1, "PDP org: %s", val_to_str(gcdr.pdporg, pdp_org_type, "Unknown PDP org"));
4280 proto_tree_add_text(cdr_tree, tvb, offset+87, 1, "PDP type: %s", val_to_str(gcdr.pdptype, pdp_type, "Unknown PDP type"));
4281 proto_tree_add_text(cdr_tree, tvb, offset+88, 4, "PDP address: %s", ip_to_str((guint8 *)&gcdr.pdpaddr));
4282 proto_tree_add_text(cdr_tree, tvb, offset+92, 1, "PDP address type: %u", gcdr.addrflag);
4283 decode_qos_gprs(tvb, offset+93, cdr_tree, "QoS", 0);
4284 proto_tree_add_text(cdr_tree, tvb, offset+96, 4, "Uplink volume: %u", gcdr.uplink);
4285 proto_tree_add_text(cdr_tree, tvb, offset+100, 4, "Downlink volume: %u", gcdr.downlink);
4286 proto_tree_add_text(cdr_tree, tvb, offset+104, 4, "Timestamp: %s", time_int_to_str(gcdr.timestamp));
4287 proto_tree_add_text(cdr_tree, tvb, offset+108, 4, "Record opening time: %s", time_int_to_str(gcdr.opening));
4288 proto_tree_add_text(cdr_tree, tvb, offset+112, 4, "Duration: %s", rel_time_int_to_str(gcdr.duration));
4289 proto_tree_add_text(cdr_tree, tvb, offset+116, 1, "Cause for close: %s (%u)", val_to_str(gcdr.closecause, cdr_close_type, "Unknown cause"), gcdr.closecause);
4290 proto_tree_add_text(cdr_tree, tvb, offset+117, 4, "Sequence number: %u", gcdr.seqno);
4292 if (data_len > 119) {
4293 tvb_memcpy (tvb, gcdr.msisdn, offset + 121, 9);
4294 proto_tree_add_text(cdr_tree, tvb, offset+121, 9, "MSISDN: %s", msisdn_to_str (gcdr.msisdn, 9));
4299 case 0x12: /* SCDR */
4300 if (tvb_length_remaining(tvb, offset) < 3 + 277) {
4301 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "SCDR fragmented, can't dissect");
4305 scdr.len = tvb_get_letohs(tvb, offset+3);
4306 scdr.netini = tvb_get_guint8(tvb, offset+5);
4307 scdr.anon = tvb_get_guint8(tvb, offset+6);
4308 scdr.imsilen = tvb_get_guint8(tvb, offset+7);
4309 tvb_memcpy(tvb, scdr.imsi, offset+8, 8);
4310 tvb_memcpy(tvb, scdr.imei, offset+16, 8);
4311 scdr.msisdnlen = tvb_get_guint8(tvb, offset+24);
4312 tvb_memcpy(tvb, scdr.msisdn, offset+25, 10);
4313 tvb_memcpy(tvb, (guint8 *)&scdr.sgsnaddr, offset+35, sizeof scdr.sgsnaddr);
4314 tvb_memcpy(tvb, scdr.msclass_notused, offset+39, 12);
4315 scdr.msclass_caplen = tvb_get_guint8(tvb, offset+51);
4316 scdr.msclass_cap = tvb_get_guint8(tvb, offset+52);
4317 scdr.msclass_capomit = tvb_get_ntohs(tvb, offset+53);
4318 scdr.lac = tvb_get_ntohs(tvb, offset+55);
4319 scdr.rac = tvb_get_guint8(tvb, offset+57);
4320 scdr.cid = tvb_get_ntohs(tvb, offset+58);
4321 scdr.chrgid = tvb_get_ntohl(tvb, offset+60);
4322 tvb_memcpy(tvb, (guint8 *)&scdr.ggsnaddr, offset+64, sizeof scdr.ggsnaddr);
4323 tvb_memcpy(tvb, scdr.apn, offset+68, 64);
4324 scdr.pdporg = tvb_get_guint8(tvb, offset+132);
4325 scdr.pdptype = tvb_get_guint8(tvb, offset+133);
4326 tvb_memcpy(tvb, (guint8 *)&scdr.pdpaddr, offset+134, sizeof scdr.pdpaddr);
4327 scdr.listind = tvb_get_guint8(tvb, offset+138);
4329 scdr.change[j].change = tvb_get_guint8(tvb, offset+139+23*j);
4330 scdr.change[j].time1 = tvb_get_ntohl(tvb, offset+140+23*j);
4331 scdr.change[j].time2 = tvb_get_ntohl(tvb, offset+144+23*j);
4332 scdr.change[j].uplink = tvb_get_ntohl(tvb, offset+148+23*j);
4333 scdr.change[j].downlink = tvb_get_ntohl(tvb, offset+152+23*j);
4334 /* tvb_memcpy(tvb, scdr.change[j].qos_req, offset+156+23*j, 3);
4335 tvb_memcpy(tvb, scdr.change[j].qos_neg, offset+159+23*j, 3);*/
4337 scdr.timestamp = tvb_get_ntohl(tvb, offset+254);
4338 scdr.opening = tvb_get_ntohl(tvb, offset+258);
4339 scdr.duration = tvb_get_ntohl(tvb, offset+262);
4340 scdr.sgsnchange = tvb_get_guint8(tvb, offset+266);
4341 scdr.closecause = tvb_get_guint8(tvb, offset+267);
4342 scdr.diag1 = tvb_get_guint8(tvb, offset+268);
4343 scdr.diag2 = tvb_get_guint8(tvb, offset+269);
4344 scdr.diag3 = tvb_get_guint8(tvb, offset+270);
4345 scdr.diag4 = tvb_get_guint8(tvb, offset+271);
4346 scdr.diag5 = tvb_get_ntohl(tvb, offset+272);
4347 scdr.seqno = tvb_get_ntohl(tvb, offset+276);
4349 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "SCDR (type %x), sequence number: %u", rectype, scdr.seqno);
4350 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4351 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4352 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4353 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "CDR length: %u", scdr.len);
4354 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "Network initiated PDP context: %s", yesno[scdr.netini]);
4355 proto_tree_add_text(cdr_tree, tvb, offset+6, 1, "Anonymous acces: %s", yesno[scdr.anon]);
4356 proto_tree_add_text(cdr_tree, tvb, offset+7, 1, "IMSI length: %u", scdr.imsilen);
4357 proto_tree_add_text(cdr_tree, tvb, offset+8, 8, "IMSI: %s", id_to_str(scdr.imsi));
4358 proto_tree_add_text(cdr_tree, tvb, offset+16, 8, "IMEI: %s", id_to_str(scdr.imei));
4359 proto_tree_add_text(cdr_tree, tvb, offset+24, 1, "MSISDN length: %u", scdr.msisdnlen);
4360 proto_tree_add_text(cdr_tree, tvb, offset+25, 10, "MSISDN: %s", msisdn_to_str(scdr.msisdn, 10));
4361 proto_tree_add_text(cdr_tree, tvb, offset+35, 4, "SGSN address: %s", ip_to_str((guint8 *)&scdr.sgsnaddr));
4362 proto_tree_add_text(cdr_tree, tvb, offset+39, 12, "(not used)");
4363 proto_tree_add_text(cdr_tree, tvb, offset+51, 1, "MS network capability length: %u", scdr.msclass_caplen);
4365 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+52, 1, "MS network capability: %u", scdr.msclass_cap);
4366 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4367 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+52, 1, scdr.cap);
4368 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+52, 1, scdr.cap);
4369 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+52, 1, scdr.cap);
4370 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+52, 1, scdr.cap);
4371 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+52, 1, scdr.cap);
4372 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+52, 1, scdr.cap);
4373 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_pad, tvb, offset+52, 1, scdr.cap);
4376 proto_tree_add_text(cdr_tree, tvb, offset+53, 2, "MS network capability omitted: %u", scdr.msclass_capomit);
4377 proto_tree_add_text(cdr_tree, tvb, offset+55, 2, "LAC: %u", scdr.lac);
4378 proto_tree_add_text(cdr_tree, tvb, offset+57, 1, "RAC: %u", scdr.rac);
4379 proto_tree_add_text(cdr_tree, tvb, offset+58, 2, "Cell ID: %u", scdr.cid);
4380 proto_tree_add_text(cdr_tree, tvb, offset+60, 4, "Charging ID: %x", scdr.chrgid);
4381 proto_tree_add_text(cdr_tree, tvb, offset+64, 4, "GGSN address: %s", ip_to_str((guint8 *)&scdr.ggsnaddr));
4382 proto_tree_add_text(cdr_tree, tvb, offset+68, 64, "APN: %s", scdr.apn);
4383 proto_tree_add_text(cdr_tree, tvb, offset+132, 1, "PDP org: %s", val_to_str(scdr.pdporg, pdp_org_type, "Unknown PDP org"));
4384 proto_tree_add_text(cdr_tree, tvb, offset+133, 1, "PDP type: %s", val_to_str(scdr.pdptype, pdp_type, "Unknown PDP type"));
4385 proto_tree_add_text(cdr_tree, tvb, offset+134, 4, "PDP address: %s", ip_to_str((guint8 *)&scdr.pdpaddr));
4386 proto_tree_add_text(cdr_tree, tvb, offset+138, 1, "List of data volume index: %u", scdr.listind);
4388 proto_tree_add_text(cdr_tree, tvb, offset+139+23*j, 1, "List of data vol change condition: %u", scdr.change[j].change);
4389 proto_tree_add_text(cdr_tree, tvb, offset+140+23*j, 4, "Time1: %x", scdr.change[j].time1);
4390 proto_tree_add_text(cdr_tree, tvb, offset+144+23*j, 4, "Time2: %x", scdr.change[j].time2);
4391 proto_tree_add_text(cdr_tree, tvb, offset+148+23*j, 4, "Uplink: %x", scdr.change[j].uplink);
4392 proto_tree_add_text(cdr_tree, tvb, offset+152+23*j, 4, "Downlink: %x", scdr.change[j].downlink);
4393 decode_qos_gprs(tvb, offset+156, cdr_tree, "QoS requested", 0);
4394 decode_qos_gprs(tvb, offset+159, cdr_tree, "QoS negotiated", 0);
4396 proto_tree_add_text(cdr_tree, tvb, offset+254, 4, "Timestamp: %s", time_int_to_str(scdr.timestamp));
4397 proto_tree_add_text(cdr_tree, tvb, offset+258, 4, "Opening: %s", time_int_to_str(scdr.opening));
4398 proto_tree_add_text(cdr_tree, tvb, offset+262, 4, "Duration: %s", rel_time_int_to_str(scdr.duration));
4399 proto_tree_add_text(cdr_tree, tvb, offset+266, 1, "SGSN change: %u", scdr.sgsnchange);
4400 proto_tree_add_text(cdr_tree, tvb, offset+267, 1, "Cause for close: %s (%u)", val_to_str(scdr.closecause, cdr_close_type, "Unknown cause"), scdr.closecause);
4401 proto_tree_add_text(cdr_tree, tvb, offset+268, 1, "Diagnostics 1: %u", scdr.diag1);
4402 proto_tree_add_text(cdr_tree, tvb, offset+269, 1, "Diagnostics 2: %u", scdr.diag2);
4403 proto_tree_add_text(cdr_tree, tvb, offset+270, 1, "Diagnostics 3: %u", scdr.diag3);
4404 proto_tree_add_text(cdr_tree, tvb, offset+271, 1, "Diagnostics 4: %u", scdr.diag4);
4405 proto_tree_add_text(cdr_tree, tvb, offset+272, 4, "Diagnostics 5: %u", scdr.diag5);
4406 proto_tree_add_text(cdr_tree, tvb, offset+276, 4, "Sequence number: %u", scdr.seqno);
4408 case 0x14: /* MCDR */
4409 if (tvb_length_remaining(tvb, offset) < 3 + 147) {
4410 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "MCDR fragmented, can't dissect");
4414 mcdr.len = tvb_get_ntohs(tvb, offset+3);
4415 mcdr.imsilen = tvb_get_guint8(tvb, offset+5);
4416 tvb_memcpy(tvb, mcdr.imsi, offset+6, 8);
4417 tvb_memcpy(tvb, mcdr.imei, offset+14, 8);
4418 mcdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4419 tvb_memcpy(tvb, mcdr.msisdn, offset+23, 10);
4420 tvb_memcpy(tvb, (guint8 *)&mcdr.sgsnaddr, offset+33, sizeof mcdr.sgsnaddr);
4421 tvb_memcpy(tvb, mcdr.msclass_notused, offset+37, 12);
4422 mcdr.msclass_caplen = tvb_get_guint8(tvb, offset+49);
4423 mcdr.msclass_cap = tvb_get_guint8(tvb, offset+50);
4424 mcdr.msclass_capomit = tvb_get_ntohs(tvb, offset+51);
4425 mcdr.lac = tvb_get_ntohs(tvb, offset+53);
4426 mcdr.rac = tvb_get_guint8(tvb, offset+55);
4427 mcdr.cid = tvb_get_ntohs(tvb, offset+56);
4428 mcdr.change_count = tvb_get_guint8(tvb, offset+58);
4430 mcdr.change[j].lac = tvb_get_ntohs(tvb, offset+59+13*j);
4431 mcdr.change[j].rac = tvb_get_guint8(tvb, offset+61+13*j);
4432 mcdr.change[j].cid = tvb_get_ntohs(tvb, offset+62+13*j);
4433 tvb_memcpy(tvb, mcdr.change[j].omit, offset+64+13*j, 8);
4435 mcdr.timestamp = tvb_get_ntohl(tvb, offset+124);
4436 mcdr.opening = tvb_get_ntohl(tvb, offset+128);
4437 mcdr.duration = tvb_get_ntohl(tvb, offset+132);
4438 mcdr.sgsnchange = tvb_get_guint8(tvb, offset+136);
4439 mcdr.closecause = tvb_get_guint8(tvb, offset+137);
4440 mcdr.diag1 = tvb_get_guint8(tvb, offset+138);
4441 mcdr.diag2 = tvb_get_guint8(tvb, offset+139);
4442 mcdr.diag3 = tvb_get_guint8(tvb, offset+140);
4443 mcdr.diag4 = tvb_get_guint8(tvb, offset+141);
4444 mcdr.diag5 = tvb_get_ntohl(tvb, offset+142);
4445 mcdr.seqno = tvb_get_ntohl(tvb, offset+146);
4447 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "MCDR (0x14), sequence number: %u", mcdr.seqno);
4448 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4449 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4450 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4451 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", mcdr.len);
4452 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", mcdr.imsilen);
4453 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(mcdr.imsi));
4454 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(mcdr.imei));
4455 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", mcdr.msisdnlen);
4456 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(mcdr.msisdn, 10));
4457 proto_tree_add_text(cdr_tree, tvb, offset+33, 4, "SGSN address: %s", ip_to_str((guint8 *)&mcdr.sgsnaddr));
4458 proto_tree_add_text(cdr_tree, tvb, offset+37, 12, "(not used)");
4459 proto_tree_add_text(cdr_tree, tvb, offset+49, 1, "MS network capability length: %u", mcdr.msclass_caplen);
4461 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+50, 1, "MS network capability: %u", mcdr.msclass_cap);
4462 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4463 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+50, 1, mcdr.cap);
4464 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+50, 1, mcdr.cap);
4465 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+50, 1, mcdr.cap);
4466 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+50, 1, mcdr.cap);
4467 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+50, 1, mcdr.cap);
4468 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+50, 1, mcdr.cap);
4469 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_pad, tvb, offset+50, 1, mcdr.cap);
4471 proto_tree_add_text(cdr_tree, tvb, offset+51, 2, "MS network capability omitted: %u", mcdr.msclass_capomit);
4472 proto_tree_add_text(cdr_tree, tvb, offset+53, 2, "LAC: %u", mcdr.lac);
4473 proto_tree_add_text(cdr_tree, tvb, offset+55, 1, "RAC: %u", mcdr.rac);
4474 proto_tree_add_text(cdr_tree, tvb, offset+56, 2, "Cell ID: %u", mcdr.cid);
4475 proto_tree_add_text(cdr_tree, tvb, offset+58, 1, "List of data volume changes: %u", mcdr.change_count);
4477 proto_tree_add_text(cdr_tree, tvb, offset+59+13*j, 2, "LAC: %u", mcdr.change[j].lac);
4478 proto_tree_add_text(cdr_tree, tvb, offset+61+13*j, 1, "RAC: %u", mcdr.change[j].rac);
4479 proto_tree_add_text(cdr_tree, tvb, offset+62+13*j, 2, "CID: %u", mcdr.change[j].cid);
4480 proto_tree_add_text(cdr_tree, tvb, offset+64+13*j, 8, "(omitted)");
4483 proto_tree_add_text(cdr_tree, tvb, offset+124, 4, "Timestamp: %s", time_int_to_str(mcdr.timestamp));
4484 proto_tree_add_text(cdr_tree, tvb, offset+128, 4, "Record opening time: %s", time_int_to_str(mcdr.opening));
4485 proto_tree_add_text(cdr_tree, tvb, offset+132, 4, "Duration: %s", rel_time_int_to_str(mcdr.duration));
4486 proto_tree_add_text(cdr_tree, tvb, offset+136, 1, "SGSN change: %u", mcdr.sgsnchange);
4487 proto_tree_add_text(cdr_tree, tvb, offset+137, 1, "Cause for close: %s (%u)", val_to_str(mcdr.closecause, cdr_close_type, "Unknown cause"), mcdr.closecause);
4488 proto_tree_add_text(cdr_tree, tvb, offset+138, 1, "Diagnostics 1: %u", mcdr.diag1);
4489 proto_tree_add_text(cdr_tree, tvb, offset+139, 1, "Diagnostics 2: %u", mcdr.diag2);
4490 proto_tree_add_text(cdr_tree, tvb, offset+140, 1, "Diagnostics 3: %u", mcdr.diag3);
4491 proto_tree_add_text(cdr_tree, tvb, offset+141, 1, "Diagnostics 4: %u", mcdr.diag4);
4492 proto_tree_add_text(cdr_tree, tvb, offset+142, 4, "Diagnostics 5: %u", mcdr.diag5);
4493 proto_tree_add_text(cdr_tree, tvb, offset+146, 4, "Sequence number: %u", mcdr.seqno);
4496 case 0x15: /* SOCDR */
4497 if (tvb_length_remaining(tvb, offset) < 3 + 80) {
4498 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "SOCDR fragmented, can't dissect");
4502 socdr.len = tvb_get_ntohs(tvb, offset+3);
4503 socdr.imsilen = tvb_get_guint8(tvb, offset+5);
4504 tvb_memcpy(tvb, socdr.imsi, offset+6, 8);
4505 tvb_memcpy(tvb, socdr.imei, offset+14, 8);
4506 socdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4507 tvb_memcpy(tvb, socdr.msisdn, offset+23, 10);
4508 tvb_memcpy(tvb, socdr.msclass_notused, offset+33, 12);
4509 socdr.msclass_caplen = tvb_get_guint8(tvb, offset+45);
4510 socdr.msclass_cap = tvb_get_guint8(tvb, offset+46);
4511 socdr.msclass_capomit = tvb_get_ntohs(tvb, offset+47);
4512 tvb_memcpy(tvb, socdr.serv_centr, offset+49, 9);
4513 tvb_memcpy(tvb, socdr.rec_ent, offset+58, 9);
4514 socdr.lac = tvb_get_ntohs(tvb, offset+67);
4515 socdr.rac = tvb_get_guint8(tvb, offset+69);
4516 socdr.cid = tvb_get_ntohs(tvb, offset+70);
4517 socdr.time1 = tvb_get_ntohl(tvb, offset+72);
4518 socdr.time2 = tvb_get_ntohl(tvb, offset+76);
4519 socdr.messref = tvb_get_guint8(tvb, offset+80);
4520 socdr.smsres = tvb_get_ntohs(tvb, offset+81);
4522 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "SOCDR (0x15)");
4523 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4524 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4525 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4526 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", socdr.len);
4527 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", socdr.imsilen);
4528 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(socdr.imsi));
4529 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(socdr.imei));
4530 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", socdr.msisdnlen);
4531 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(socdr.msisdn, 10));
4532 proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
4533 proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", socdr.msclass_caplen);
4535 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", socdr.msclass_cap);
4536 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4537 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, socdr.cap);
4538 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+46, 1, socdr.cap);
4539 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+46, 1, socdr.cap);
4540 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+46, 1, socdr.cap);
4541 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+46, 1, socdr.cap);
4542 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+46, 1, socdr.cap);
4544 proto_tree_add_text(cdr_tree, tvb, offset+47, 2, "MS network capability omitted: %u", stcdr.msclass_capomit);
4545 proto_tree_add_text(cdr_tree, tvb, offset+49, 9, "SMSC E.164 address: %s", msisdn_to_str(socdr.serv_centr, 9));
4546 proto_tree_add_text(cdr_tree, tvb, offset+58, 9, "SGSN E.164 address: %s", msisdn_to_str(socdr.rec_ent, 9));
4547 proto_tree_add_text(cdr_tree, tvb, offset+67, 2, "LAC: %u", socdr.lac);
4548 proto_tree_add_text(cdr_tree, tvb, offset+69, 1, "RAC: %u", socdr.rac);
4549 proto_tree_add_text(cdr_tree, tvb, offset+70, 2, "Cell ID: %u", socdr.cid);
4550 proto_tree_add_text(cdr_tree, tvb, offset+72, 4, "Time1: %s", time_int_to_str(socdr.time1));
4551 proto_tree_add_text(cdr_tree, tvb, offset+76, 4, "Time2: %s", time_int_to_str(socdr.time2));
4552 proto_tree_add_text(cdr_tree, tvb, offset+80, 1, "Message reference: %u", socdr.messref);
4553 proto_tree_add_text(cdr_tree, tvb, offset+81, 2, "Delivery result: %u", socdr.smsres);
4556 case 0x16: /* STCDR */
4557 if (tvb_length_remaining(tvb, offset) < 3 + 79) {
4558 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "STCDR fragmented, can't dissect");
4562 stcdr.len = tvb_get_ntohs(tvb, offset+3);
4563 stcdr.imsilen = tvb_get_guint8(tvb, offset+5);
4564 tvb_memcpy(tvb, stcdr.imsi, offset+6, 8);
4565 tvb_memcpy(tvb, stcdr.imei, offset+14, 8);
4566 stcdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4567 tvb_memcpy(tvb, stcdr.msisdn, offset+23, 10);
4568 tvb_memcpy(tvb, stcdr.msclass_notused, offset+33, 12);
4569 stcdr.msclass_caplen = tvb_get_guint8(tvb, offset+45);
4570 stcdr.msclass_cap = tvb_get_guint8(tvb, offset+46);
4571 stcdr.msclass_capomit = tvb_get_ntohs(tvb, offset+47);
4572 tvb_memcpy(tvb, stcdr.serv_centr, offset+49, 9);
4573 tvb_memcpy(tvb, stcdr.rec_ent, offset+58, 9);
4574 stcdr.lac = tvb_get_ntohs(tvb, offset+67);
4575 stcdr.rac = tvb_get_guint8(tvb, offset+69);
4576 stcdr.cid = tvb_get_ntohs(tvb, offset+70);
4577 stcdr.time1 = tvb_get_ntohl(tvb, offset+72);
4578 stcdr.time2 = tvb_get_ntohl(tvb, offset+76);
4579 stcdr.smsres = tvb_get_ntohs(tvb, offset+80);
4581 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "STCDR (0x16)");
4582 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4583 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4584 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4585 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", stcdr.len);
4586 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", stcdr.imsilen);
4587 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(stcdr.imsi));
4588 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(stcdr.imei));
4589 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", stcdr.msisdnlen);
4590 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(stcdr.msisdn, 10));
4591 proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
4592 proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", stcdr.msclass_caplen);
4594 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", stcdr.msclass_cap);
4595 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4596 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, stcdr.cap);
4597 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+46, 1, stcdr.cap);
4598 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+46, 1, stcdr.cap);
4599 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+46, 1, stcdr.cap);
4600 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+46, 1, stcdr.cap);
4601 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+46, 1, stcdr.cap);
4603 proto_tree_add_text(cdr_tree, tvb, offset+47, 2, "MS network capability omitted: %u", stcdr.msclass_capomit);
4604 proto_tree_add_text(cdr_tree, tvb, offset+49, 9, "SMSC E.164 address: %s", msisdn_to_str(stcdr.serv_centr, 9));
4605 proto_tree_add_text(cdr_tree, tvb, offset+58, 9, "SGSN E.164 address: %s", msisdn_to_str(stcdr.rec_ent, 9));
4606 proto_tree_add_text(cdr_tree, tvb, offset+67, 2, "LAC: %u", stcdr.lac);
4607 proto_tree_add_text(cdr_tree, tvb, offset+69, 1, "RAC: %u", stcdr.rac);
4608 proto_tree_add_text(cdr_tree, tvb, offset+70, 2, "Cell ID: %u", stcdr.cid);
4609 proto_tree_add_text(cdr_tree, tvb, offset+72, 4, "Time1: %s", time_int_to_str(stcdr.time1));
4610 proto_tree_add_text(cdr_tree, tvb, offset+76, 4, "Time2: %s", time_int_to_str(stcdr.time2));
4611 proto_tree_add_text(cdr_tree, tvb, offset+80, 2, "Delivery result: %u", stcdr.smsres);
4614 offset = offset + 2 + data_len;
4624 decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4626 guint16 length, n, number;
4627 proto_tree *ext_tree_data_resp;
4630 length = tvb_get_ntohs(tvb, offset + 1);
4632 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
4633 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
4637 while (n < length) {
4639 number = tvb_get_ntohs(tvb, offset + 3 + n);
4640 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
4653 decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4657 struct e_in6_addr addr_ipv6;
4658 proto_tree *ext_tree_node_addr;
4661 length = tvb_get_ntohs(tvb, offset+1);
4663 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Node address: ");
4664 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
4666 proto_tree_add_text(ext_tree_node_addr, tvb, offset+1, 2, "Node address length: %u", length);
4670 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
4671 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4672 proto_tree_add_ipv4(ext_tree_node_addr, gtp_version ? hf_gtpv1_node_ipv4 : hf_gtpv0_node_ipv4, tvb, offset+3, 4, addr_ipv4);
4675 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
4676 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4677 proto_tree_add_ipv6(ext_tree_node_addr, gtp_version ? hf_gtpv1_node_ipv6 : hf_gtpv0_node_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
4680 proto_item_append_text(te, "unknown type or wrong length");
4688 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
4689 * UMTS: 29.060 v4.0, chapter 7.7.44
4692 decode_gtp_priv_ext(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4694 guint16 length, ext_id;
4696 proto_tree *ext_tree_priv_ext;
4699 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_PRIV_EXT, gtp_val, "Unknown message"));
4700 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
4702 length = tvb_get_ntohs(tvb, offset+1);
4703 if (length < 1) return 3+length;
4705 ext_id = tvb_get_ntohs(tvb, offset+3);
4706 tvb_memcpy(tvb, ext_val, offset+5, length > 65 ? 63 : length-2);
4707 ext_val[length > 65 ? 64 : length-1] = '\0';
4708 proto_tree_add_uint(ext_tree_priv_ext, gtp_version ? hf_gtpv1_ext_id : hf_gtpv0_ext_id, tvb, offset+3, 2, ext_id);
4709 proto_tree_add_string(ext_tree_priv_ext, gtp_version ? hf_gtpv1_ext_val : hf_gtpv0_ext_val, tvb, offset+5, length-2, ext_val);
4715 decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4717 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
4719 return tvb_length_remaining(tvb, offset);
4723 dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4726 _gtpv0_hdr gtpv0_hdr;
4727 proto_item *ti, *tf;
4728 proto_tree *gtpv0_tree, *flags_tree;
4731 const guint8 *tid_val;
4733 int offset, length, i, mandatory, checked_field;
4735 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4736 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
4737 if (check_col(pinfo->cinfo, COL_INFO))
4738 col_clear(pinfo->cinfo, COL_INFO);
4740 tvb_memcpy(tvb, (guint8 *)>pv0_hdr, 0, 12);
4741 tid_val = tvb_get_ptr(tvb, 12, 8);
4742 tid_str = id_to_str(tid_val);
4743 gtp_version = (gtpv0_hdr.flags >> 5) & 0x07;
4745 if (!((gtpv0_hdr.flags >> 4) & 1)) {
4746 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4747 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP-CDR");
4749 switch ((gtpv0_hdr.flags >> 5) & 0x07) {
4750 case 0: if (check_col(pinfo->cinfo, COL_PROTOCOL))
4751 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
4753 case 1: if (check_col(pinfo->cinfo, COL_PROTOCOL))
4754 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv1");
4755 default: if (check_col(pinfo->cinfo, COL_PROTOCOL))
4756 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv?");
4761 if (check_col(pinfo->cinfo, COL_INFO))
4762 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtpv0_hdr.message, message_type, "Unknown"));
4766 /* dissect GTP header */
4767 ti = proto_tree_add_item(tree, proto_gtpv0, tvb, 0, -1, FALSE);
4768 gtpv0_tree = proto_item_add_subtree(ti, ett_gtp);
4770 tf = proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flags, tvb, 0, 1, gtpv0_hdr.flags);
4772 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
4773 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_ver, tvb, 0, 1, gtpv0_hdr.flags);
4774 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_pt, tvb, 0, 1, gtpv0_hdr.flags);
4775 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_spare, tvb, 0, 1, gtpv0_hdr.flags);
4776 proto_tree_add_boolean(flags_tree, hf_gtpv0_flags_snn, tvb, 0, 1, gtpv0_hdr.flags);
4778 gtpv0_hdr.length = ntohs(gtpv0_hdr.length);
4779 gtpv0_hdr.seq_no = ntohs(gtpv0_hdr.seq_no);
4780 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_message_type, tvb, 1, 1, gtpv0_hdr.message);
4781 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_length, tvb, 2, 2, gtpv0_hdr.length);
4782 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_seq_number, tvb, 4, 2, gtpv0_hdr.seq_no);
4783 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flow_label, tvb, 6, 2, gtpv0_hdr.flow_label);
4784 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_sndcp_number, tvb, 8, 1, gtpv0_hdr.sndcp_no);
4785 proto_tree_add_string(gtpv0_tree, hf_gtpv0_tid, tvb, 12, 8, tid_str);
4787 if (gtpv0_hdr.message != GTP_MSG_TPDU) {
4789 proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[--- end of GTPv0 header, beginning of extension headers ---]");
4791 offset = GTPv0_HDR_LENGTH;
4792 length = tvb_length(tvb);
4794 mandatory = 0; /* check order of GTP fields against ETSI */
4798 if (offset >= length) break;
4799 ext_hdr_val = tvb_get_guint8(tvb, offset);
4801 if (gtpv0_etsi_order) {
4802 checked_field = check_field_presence (gtpv0_hdr.message, ext_hdr_val , (int *)&mandatory);
4803 switch (checked_field) {
4804 case -2: proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[WARNING] message not found");
4806 case -1: proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[WARNING] field not present");
4809 default: proto_tree_add_text(gtpv0_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s", val_to_str(checked_field, gtp_val, "Unknown extension field"));
4814 while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
4815 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv0_tree);
4820 /* next part dissects sublayers of GTP
4821 * right now it's only IP */
4823 if ((gtpv0_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
4824 next_tvb = tvb_new_subset(tvb, 20, -1, -1);
4825 call_dissector(ip_handle, next_tvb, pinfo, tree);
4826 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4827 col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP");
4832 /* GTP v1 dissector */
4834 dissect_gtpv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
4836 _gtpv1_hdr gtpv1_hdr;
4837 proto_item *ti, *tf;
4838 proto_tree *gtpv1_tree, *flags_tree;
4840 guint8 ext_hdr_val, i, hdr_offset = 4, next_hdr, npdu_no;
4842 int offset, length, mandatory, checked_field;
4844 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4845 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP-C");
4846 if (check_col(pinfo->cinfo, COL_INFO))
4847 col_clear(pinfo->cinfo, COL_INFO);
4849 tvb_memcpy(tvb, (guint8 *)>pv1_hdr, 0, 8);
4850 gtp_version = (gtpv1_hdr.flags >> 5) & 0x07;
4852 if (check_col(pinfo->cinfo, COL_INFO))
4853 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtpv1_hdr.message, message_type, "Unknown"));
4857 ti = proto_tree_add_item(tree, proto_gtpv1, tvb, 0, -1, FALSE);
4858 gtpv1_tree = proto_item_add_subtree(ti, ett_gtp);
4860 tf = proto_tree_add_uint(gtpv1_tree, hf_gtpv1_flags, tvb, 0, 1, gtpv1_hdr.flags);
4861 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
4863 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_ver, tvb, 0, 1, gtpv1_hdr.flags);
4864 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_pt, tvb, 0, 1, gtpv1_hdr.flags);
4865 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_spare, tvb, 0, 1, gtpv1_hdr.flags);
4866 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_e, tvb, 0, 1, gtpv1_hdr.flags);
4867 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_s, tvb, 0, 1, gtpv1_hdr.flags);
4868 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_pn, tvb, 0, 1, gtpv1_hdr.flags);
4870 gtpv1_hdr.length = ntohs(gtpv1_hdr.length);
4871 gtpv1_hdr.teid = ntohl(gtpv1_hdr.teid);
4873 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_message_type, tvb, 1, 1, gtpv1_hdr.message);
4874 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_length, tvb, 2, 2, gtpv1_hdr.length);
4875 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_teid, tvb, 4, 4, gtpv1_hdr.teid);
4877 if (gtpv1_hdr.flags & 0x07) {
4878 seq_no = tvb_get_ntohs (tvb, 8);
4879 proto_tree_add_uint (gtpv1_tree, hf_gtpv1_seq_number, tvb, 8, 2, seq_no);
4880 npdu_no = tvb_get_guint8 (tvb, 10);
4881 proto_tree_add_uint (gtpv1_tree, hf_gtpv1_npdu_number, tvb, 10, 1, npdu_no);
4882 next_hdr = tvb_get_guint8(tvb, 11);
4883 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_next, tvb, 11, 1, next_hdr);
4886 if (next_hdr) hdr_offset = 1;
4887 else hdr_offset = 0;
4890 if (gtpv1_hdr.message != GTP_MSG_TPDU) {
4892 proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[--- end of GTP v1 header, beginning of extension headers ---]");
4894 offset = GTPv1_HDR_LENGTH - hdr_offset;
4895 length = tvb_length(tvb);
4897 mandatory = 0; /* check order of GTP fields against ETSI */
4901 if (offset >= length) break;
4902 ext_hdr_val = tvb_get_guint8(tvb, offset);
4904 if (gtpv1_etsi_order) {
4905 checked_field = check_field_presence (gtpv1_hdr.message, ext_hdr_val , (int *)&mandatory);
4906 switch (checked_field) {
4907 case -2: proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[WARNING] message not found");
4909 case -1: proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[WARNING] field not present");
4912 default: proto_tree_add_text(gtpv1_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s", val_to_str(checked_field, gtp_val, "Unknown extension field"));
4917 while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
4918 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv1_tree);
4923 if (gtpv1_hdr.message == GTP_MSG_ERR_IND)
4924 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4925 col_add_str(pinfo->cinfo, COL_PROTOCOL, "GTP-U");
4928 if ((gtpv1_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
4930 if (gtpv1_hdr.flags & 0x07) {
4931 if (tvb_get_guint8 (tvb, 11)) hdr_offset = 1; /* if next_hdr != 0 */
4932 else hdr_offset = 0;
4935 next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset, -1, -1);
4936 call_dissector(ip_handle, next_tvb, pinfo, tree);
4937 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4938 col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP-U");
4942 static const true_false_string yes_no_tfs = {
4948 proto_register_gtp(void)
4951 static hf_register_info hf_gtpv0[] = {
4953 { &hf_gtpv0_flags, { "Flags", "gtpv0.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare/SNN", HFILL }},
4954 { &hf_gtpv0_flags_ver, { "Version", "gtpv0.flags.version", FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, "GTP Version", HFILL }},
4955 { &hf_gtpv0_flags_pt, { "Protocol type", "gtpv0.flags.payload", FT_UINT8, BASE_DEC, NULL, GTP_PT_MASK, "Protocol Type (1 = GTP, 0 = GTP' )", HFILL }},
4956 { &hf_gtpv0_flags_spare, { "Reserved", "gtpv0.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE_MASK, "Reserved (shall be sent as '111' )", HFILL }},
4957 { &hf_gtpv0_flags_snn, { "Is SNDCP N-PDU included?", "gtpv0.flags.snn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_SNN_MASK, "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL }},
4958 { &hf_gtpv0_message_type, { "Message type", "gtpv0.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
4959 { &hf_gtpv0_length, { "Length", "gtpv0.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
4960 { &hf_gtpv0_seq_number, { "Sequence number", "gtpv0.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
4961 { &hf_gtpv0_flow_label, { "Flow label", "gtpv0.flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label", HFILL }},
4962 { &hf_gtpv0_sndcp_number, { "SNDCP N-PDU LLC Number", "gtpv0.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, "SNDCP N-PDU LLC Number", HFILL }},
4963 { &hf_gtpv0_tid, { "TID", "gtpv0.tid", FT_STRING, BASE_DEC, NULL, 0, "Tunnel Identifier", HFILL }},
4964 { &hf_gtpv0_cause, { "Cause", "gtpv0.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
4965 { &hf_gtpv0_imsi, { "IMSI", "gtpv0.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
4966 { &hf_gtpv0_rai_mcc, { "MCC", "gtpv0.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
4967 { &hf_gtpv0_rai_mnc, { "MNC", "gtpv0.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
4968 { &hf_gtpv0_rai_rac, { "RAC", "gtpv0.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
4969 { &hf_gtpv0_rai_lac, { "LAC", "gtpv0.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
4970 { &hf_gtpv0_tlli, { "TLLI", "gtpv0.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
4971 { &hf_gtpv0_ptmsi, { "P-TMSI", "gtpv0.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
4972 { &hf_gtpv0_qos_spare1, { "Spare", "gtpv0.qos_spare1", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK, "Spare (shall be sent as '00' )", HFILL }},
4973 { &hf_gtpv0_qos_delay, { "QoS delay", "gtpv0.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL }},
4974 { &hf_gtpv0_qos_reliability, { "QoS reliability", "gtpv0.qos_reliabilty", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK, "Quality of Service Reliability Class", HFILL }},
4975 { &hf_gtpv0_qos_peak, { "QoS peak", "gtpv0.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL }},
4976 { &hf_gtpv0_qos_spare2, { "Spare", "gtpv0.qos_spare2", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK, "Spare (shall be sent as 0)", HFILL }},
4977 { &hf_gtpv0_qos_precedence, { "QoS precedence", "gtpv0.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK, "Quality of Service Precedence Class", HFILL }},
4978 { &hf_gtpv0_qos_spare3, { "Spare", "gtpv0.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL }},
4979 { &hf_gtpv0_qos_mean, { "QoS mean", "gtpv0.qos_mean", FT_UINT8, BASE_DEC, VALS(qos_mean_type), GTP_EXT_QOS_MEAN_MASK, "Quality of Service Mean Throughput", HFILL }},
4980 { &hf_gtpv0_reorder, { "Reordering required","gtpv0.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
4981 { &hf_gtpv0_map_cause, { "MAP cause", "gtpv0.map_cause", FT_UINT8, BASE_DEC, VALS(map_cause_type), 0, "MAP cause", HFILL }},
4982 { &hf_gtpv0_ptmsi_sig, { "P-TMSI signature", "gtpv0.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
4983 { &hf_gtpv0_ms_valid, { "MS validated", "gtpv0.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
4984 { &hf_gtpv0_recovery, { "Recovery", "gtpv0.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
4985 { &hf_gtpv0_sel_mode, { "Selection mode", "gtpv0.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
4986 { &hf_gtpv0_ext_flow_label, { "Flow Label Data I", "gtpv0.ext_flow_label", FT_UINT16, BASE_DEC, NULL, 0, "Flow label data", HFILL }},
4987 { &hf_gtpv0_flow_sig, { "Flow label Signalling", "gtpv0.flow_sig", FT_UINT16, BASE_DEC, NULL, 0, "Flow label signalling", HFILL }},
4988 { &hf_gtpv0_nsapi, { "NSAPI ", "gtpv0.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
4989 { &hf_gtpv0_flow_ii, { "Flow Label Data II ","gtpv0.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL }},
4990 { &hf_gtpv0_ms_reason, { "MS not reachable reason", "gtpv0.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, "MS Not Reachable Reason", HFILL }},
4991 { &hf_gtpv0_tr_comm, { "Packet transfer command", "gtpv0.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL }},
4992 { &hf_gtpv0_chrg_id, { "Charging ID ", "gtpv0.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
4993 { &hf_gtpv0_user_ipv4, { "End user address IPv4", "gtpv0.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
4994 { &hf_gtpv0_user_ipv6, { "End user address IPv6", "gtpv0.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
4995 { &hf_gtpv0_user_addr_pdp_org, { "PDP type organization", "gtpv0.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, "PDP type organization", HFILL }},
4996 { &hf_gtpv0_user_addr_pdp_type, { "PDP type number", "gtpv0.user_addr_pdp_type", FT_UINT8, BASE_HEX, VALS(pdp_type), 0, "PDP type", HFILL }},
4997 { &hf_gtpv0_apn, { "APN", "gtpv0.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
4998 { &hf_gtpv0_gsn_addr_type, { "GSN address type", "gtpv0.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, "GSN Address Type", HFILL }},
4999 { &hf_gtpv0_gsn_addr_len, { "GSN address length", "gtpv0.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, "GSN Address Length", HFILL }},
5000 { &hf_gtpv0_gsn_ipv4, { "GSN address IPv4", "gtpv0.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
5001 { &hf_gtpv0_gsn_ipv6, { "GSN address IPv6", "gtpv0.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
5002 { &hf_gtpv0_msisdn, { "MSISDN", "gtpv0.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
5003 { &hf_gtpv0_chrg_ipv4, { "CG address IPv4", "gtpv0.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
5004 { &hf_gtpv0_chrg_ipv6, { "CG address IPv6", "gtpv0.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
5005 { &hf_gtpv0_node_ipv4, { "Node address IPv4", "gtpv0.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
5006 { &hf_gtpv0_node_ipv6, { "Node address IPv6", "gtpv0.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
5007 { &hf_gtpv0_ext_id, { "Extension identifier", "gtpv0.ext_id", FT_UINT16, BASE_DEC, NULL, 0, "Extension Identifier", HFILL }},
5008 { &hf_gtpv0_ext_val, { "Extension value", "gtpv0.ext_val", FT_STRING, BASE_DEC, NULL, 0, "Extension Value", HFILL }},
5009 { &hf_gtpv0_unknown, { "Unknown data (length)", "gtpv0.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
5014 static hf_register_info hf_gtpv1[] = {
5016 { &hf_gtpv1_flags, { "Flags", "gtpv1.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare/E/S/PN", HFILL }},
5017 { &hf_gtpv1_flags_ver, { "Version", "gtpv1.flags.version", FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, "GTP Version", HFILL }},
5018 { &hf_gtpv1_flags_pt, { "Protocol type", "gtpv1.flags.payload_type", FT_UINT8, BASE_DEC, NULL, GTP_PT_MASK, "Protocol Type (1 = GTP, 0 = GPRS charging protocol : GTP' )", HFILL }},
5019 { &hf_gtpv1_flags_spare, { "Spare bit", "gtpv1.flags.spare", FT_UINT8, BASE_DEC, NULL, GTPv1_SPARE_MASK, "Spare bit (shall be sent as 0)", HFILL }},
5020 { &hf_gtpv1_flags_e, { "Is Next Extension Header present?", "gtpv1.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTPv1_E_MASK, "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL }},
5021 { &hf_gtpv1_flags_s, { "Is Sequence Number present?", "gtpv1.flags.s", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTPv1_S_MASK, "Is Sequence Number present? (1 = yes, 0 = no)", HFILL }},
5022 { &hf_gtpv1_flags_pn, { "Is N-PDU number present?", "gtpv1.flags.pn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTPv1_PN_MASK, "Is N-PDU number present? (1 = yes, 0 = no)", HFILL }},
5023 { &hf_gtpv1_message_type, { "Message Type", "gtpv1.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
5024 { &hf_gtpv1_length, { "Length", "gtpv1.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
5025 { &hf_gtpv1_seq_number, { "Sequence Number", "gtpv1.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
5026 { &hf_gtpv1_teid, { "TEID", "gtpv1.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL }},
5027 { &hf_gtpv1_npdu_number, { "N-PDU Number", "gtpv1.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, "N-PDU Number", HFILL }},
5028 { &hf_gtpv1_next, { "Next extension header type", "gtpv1.next", FT_UINT8, BASE_HEX, NULL, 0, "Next Extension Header Type", HFILL }},
5029 { &hf_gtpv1_cause, { "Cause ", "gtpv1.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
5030 { &hf_gtpv1_imsi, { "IMSI", "gtpv1.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
5031 { &hf_gtpv1_rai_mcc, { "MCC", "gtpv1.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
5032 { &hf_gtpv1_rai_mnc, { "MNC", "gtpv1.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
5033 { &hf_gtpv1_rai_rac, { "RAC", "gtpv1.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
5034 { &hf_gtpv1_rai_lac, { "LAC", "gtpv1.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
5035 { &hf_gtpv1_tlli, { "TLLI", "gtpv1.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
5036 { &hf_gtpv1_ptmsi, { "P-TMSI", "gtpv1.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
5037 { &hf_gtpv1_qos_spare1, { "Spare", "gtpv1.qos_spare1", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK, "Spare (shall be sent as '00' )", HFILL }},
5038 { &hf_gtpv1_qos_delay, { "QoS Delay", "gtpv1.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL }},
5039 { &hf_gtpv1_qos_reliability, { "QoS Reliability", "gtpv1.qos_reliabilty", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK, "Quality of Service Reliability Class", HFILL }},
5040 { &hf_gtpv1_qos_peak, { "QoS Peak", "gtpv1.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL }},
5041 { &hf_gtpv1_qos_spare2, { "Spare", "gtpv1.qos_spare2", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK, "Spare (shall be sent as 0)", HFILL }},
5042 { &hf_gtpv1_qos_precedence, { "QoS Precedence", "gtpv1.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK, "Quality of Service Precedence Class", HFILL }},
5043 { &hf_gtpv1_qos_spare3, { "Spare", "gtpv1.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL }},
5044 { &hf_gtpv1_qos_mean, { "QoS Mean", "gtpv1.qos_mean", FT_UINT8, BASE_DEC, VALS(qos_mean_type), GTP_EXT_QOS_MEAN_MASK, "Quality of Service Mean Throughput", HFILL }},
5045 { &hf_gtpv1_reorder, { "Reordering required","gtpv1.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
5046 { &hf_gtpv1_map_cause, { "MAP cause", "gtpv1.map_cause", FT_UINT8, BASE_DEC, VALS(map_cause_type), 0, "MAP cause", HFILL }},
5047 { &hf_gtpv1_ptmsi_sig, { "P-TMSI Signature", "gtpv1.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
5048 { &hf_gtpv1_ms_valid, { "MS validated", "gtpv1.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
5049 { &hf_gtpv1_recovery, { "Recovery", "gtpv1.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
5050 { &hf_gtpv1_sel_mode, { "Selection Mode", "gtpv1.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
5051 { &hf_gtpv1_teid_data, { "TEID Data I", "gtpv1.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL }},
5052 { &hf_gtpv1_teid_cp, { "TEID Control Plane", "gtpv1.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL }},
5053 { &hf_gtpv1_nsapi, { "NSAPI", "gtpv1.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
5054 { &hf_gtpv1_teid_ii, { "TEID Data II", "gtpv1.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL }},
5055 { &hf_gtpv1_tear_ind, { "Teardown indication","gtpv1.tear_ind", FT_BOOLEAN, BASE_NONE,NULL, 0, "Teardown Indication", HFILL }},
5056 { &hf_gtpv1_ranap_cause, { "RANAP cause", "gtpv1.ranap_cause", FT_UINT8, BASE_DEC, VALS(ranap_cause_type), 0, "RANAP cause", HFILL }},
5057 { &hf_gtpv1_rab_gtpu_dn, { "Downlink GTP-U seq number", "gtpv1.rab_gtp_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink GTP-U sequence number", HFILL }},
5058 { &hf_gtpv1_rab_gtpu_up, { "Uplink GTP-U seq number", "gtpv1.rab_gtp_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink GTP-U sequence number", HFILL }},
5059 { &hf_gtpv1_rab_pdu_dn, { "Downlink next PDCP-PDU seq number", "gtpv1.rab_pdu_dn", FT_UINT8, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL }},
5060 { &hf_gtpv1_rab_pdu_up, { "Uplink next PDCP-PDU seq number", "gtpv1.rab_pdu_up", FT_UINT8, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL }},
5061 { &hf_gtpv1_rp_sms, { "Radio Priority SMS", "gtpv1.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL }},
5062 { &hf_gtpv1_rp_nsapi, { "NSAPI in Radio Priority", "gtpv1.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK, "Network layer Service Access Point Identifier in Radio Priority", HFILL }},
5063 { &hf_gtpv1_rp_spare, { "Reserved", "gtpv1.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL }},
5064 { &hf_gtpv1_rp, { "Radio Priority", "gtpv1.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL }},
5065 { &hf_gtpv1_pkt_flow_id, { "Packet Flow ID", "gtpv1.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, "Packet Flow ID", HFILL }},
5066 { &hf_gtpv1_chrg_char_s, { "Spare", "gtpv1.chrg_char_s", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, "Spare", HFILL }},
5067 { &hf_gtpv1_chrg_char_n, { "Normal charging", "gtpv1.chrg_char_n", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, "Normal charging", HFILL }},
5068 { &hf_gtpv1_chrg_char_p, { "Prepaid charging", "gtpv1.chrg_char_p", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, "Prepaid charging", HFILL }},
5069 { &hf_gtpv1_chrg_char_f, { "Flat rate charging", "gtpv1.chrg_char_f", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, "Flat rate charging", HFILL }},
5070 { &hf_gtpv1_chrg_char_h, { "Hot billing charging", "gtpv1.chrg_char_h", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, "Hot billing charging", HFILL }},
5071 { &hf_gtpv1_chrg_char_r, { "Reserved", "gtpv1.chrg_char_r", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, "Reserved", HFILL }},
5072 { &hf_gtpv1_trace_ref, { "Trace reference", "gtpv1.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, "Trace reference", HFILL }},
5073 { &hf_gtpv1_trace_type, { "Trace type", "gtpv1.trace_type", FT_UINT16, BASE_HEX, NULL, 0, "Trace type", HFILL }},
5074 { &hf_gtpv1_ms_reason, { "MS not reachable reason", "gtpv1.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, "MS not reachable reason", HFILL }},
5075 { &hf_gtpv1_tr_comm, { "Packet transfer command", "gtpv1.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL }},
5076 { &hf_gtpv1_chrg_id, { "Charging ID", "gtpv1.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
5077 { &hf_gtpv1_user_ipv4, { "End user address IPv4", "gtpv1.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
5078 { &hf_gtpv1_user_ipv6, { "End user address IPv6", "gtpv1.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
5079 { &hf_gtpv1_user_addr_pdp_org, { "PDP type organization", "gtpv1.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, "PDP type organization", HFILL }},
5080 { &hf_gtpv1_user_addr_pdp_type, { "PDP type number", "gtpv1.user_addr_pdp_type", FT_UINT8, BASE_HEX, VALS(pdp_type), 0, "PDP type", HFILL }},
5081 { &hf_gtpv1_apn, { "APN", "gtpv1.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
5082 { &hf_gtpv1_gsn_addr_type, { "GSN Address Type", "gtpv1.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, "GSN Address Type", HFILL }},
5083 { &hf_gtpv1_gsn_addr_len, { "GSN Address Length", "gtpv1.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, "GSN Address Length", HFILL }},
5084 { &hf_gtpv1_gsn_ipv4, { "GSN address IPv4", "gtpv1.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
5085 { &hf_gtpv1_gsn_ipv6, { "GSN address IPv6", "gtpv1.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
5086 { &hf_gtpv1_msisdn, { "MSISDN", "gtpv1.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
5087 { &hf_gtpv1_qos_al_ret_priority, { "Allocation/Retention priority ","gtpv1.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, "Allocation/Retention Priority", HFILL }},
5088 { &hf_gtpv1_qos_traf_class, { "Traffic class", "gtpv1.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, "Traffic Class", HFILL }},
5089 { &hf_gtpv1_qos_del_order, { "Delivery order", "gtpv1.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, "Delivery Order", HFILL }},
5090 { &hf_gtpv1_qos_del_err_sdu, { "Delivery of erroneous SDU", "gtpv1.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 }},
5091 { &hf_gtpv1_qos_max_sdu_size, { "Maximum SDU size", "gtpv1.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, "Maximum SDU size", HFILL }},
5092 { &hf_gtpv1_qos_max_ul, { "Maximum bit rate for uplink", "gtpv1.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, "Maximum bit rate for uplink", HFILL }},
5093 { &hf_gtpv1_qos_max_dl, { "Maximum bit rate for downlink", "gtpv1.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, "Maximum bit rate for downlink", HFILL }},
5094 { &hf_gtpv1_qos_res_ber, { "Residual BER", "gtpv1.qos_res_ber", FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK, "Residual Bit Error Rate", HFILL }},
5095 { &hf_gtpv1_qos_sdu_err_ratio, { "SDU Error ratio", "gtpv1.qos_sdu_err_ratio", FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK, "SDU Error Ratio", HFILL }},
5096 { &hf_gtpv1_qos_trans_delay, { "Transfer delay", "gtpv1.qos_trans_delay", FT_UINT8, BASE_DEC, VALS(qos_trans_delay), GTP_EXT_QOS_TRANS_DELAY_MASK, "Transfer Delay", HFILL }},
5097 { &hf_gtpv1_qos_traf_handl_prio, { "Traffic handling priority", "gtpv1.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK, "Traffic Handling Priority", HFILL }},
5098 { &hf_gtpv1_qos_guar_ul, { "Guaranteed bit rate for uplink", "gtpv1.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, "Guaranteed bit rate for uplink", HFILL }},
5099 { &hf_gtpv1_qos_guar_dl, { "Guaranteed bit rate for downlink", "gtpv1.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, "Guaranteed bit rate for downlink", HFILL }},
5100 { &hf_gtpv1_rnc_ipv4, { "RNC address IPv4", "gtpv1.rnc_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Radio Network Controller address IPv4", HFILL }},
5101 { &hf_gtpv1_rnc_ipv6, { "RNC address IPv6", "gtpv1.rnc_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Radio Network Controller address IPv6", HFILL }},
5102 { &hf_gtpv1_chrg_ipv4, { "CG address IPv4", "gtpv1.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
5103 { &hf_gtpv1_chrg_ipv6, { "CG address IPv6", "gtpv1.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
5104 { &hf_gtpv1_node_ipv4, { "Node address IPv4", "gtpv1.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
5105 { &hf_gtpv1_node_ipv6, { "Node address IPv6", "gtpv1.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
5106 { &hf_gtpv1_ext_id, { "Extensio Identifier","gtpv1.ext_id", FT_UINT16, BASE_DEC, NULL, 0, "Extension Identifier", HFILL }},
5107 { &hf_gtpv1_ext_val, { "Extension Value", "gtpv1.ext_val", FT_STRING, BASE_DEC, NULL, 0, "Extension Value", HFILL }},
5108 { &hf_gtpv1_unknown, { "Unknown data (length)", "gtpv1.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
5112 static gint *ett_gtp_array[] = {
5122 &ett_gtp_pkt_flow_id,
5144 module_t *gtp_module;
5146 static enum_val_t gtpv0_cdr_options[] = {
5153 proto_gtpv0 = proto_register_protocol("GPRS Tunnelling Protocol v0", "GTPv0", "gtpv0");
5154 proto_register_field_array(proto_gtpv0, hf_gtpv0, array_length(hf_gtpv0));
5155 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
5157 proto_gtpv1 = proto_register_protocol("GPRS Tunnelling Protocol v1", "GTPv1", "gtpv1");
5158 proto_register_field_array(proto_gtpv1, hf_gtpv1, array_length(hf_gtpv1));
5159 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
5161 gtp_module = prefs_register_protocol(proto_gtpv0, proto_reg_handoff_gtp);
5163 prefs_register_uint_preference(gtp_module, "gtpv0_port", "GTPv0 port ", "GTPv0 port (default 3386)", 10, &g_gtpv0_port);
5164 prefs_register_uint_preference(gtp_module, "gtpv1c_port", "GTPv1 control plane (GTP-C) port ", "GTPv1 control plane port (default 2123)", 10, &g_gtpv1c_port);
5165 prefs_register_uint_preference(gtp_module, "gtpv1u_port", "GTPv1 user plane (GTP-U) port ", "GTPv1 user plane port (default 2152)", 10, &g_gtpv1u_port);
5166 prefs_register_bool_preference(gtp_module, "gtp_dissect_tpdu", "Dissect T-PDU ", "Dissect T-PDU", >p_tpdu);
5167 prefs_register_enum_preference(gtp_module, "gtpv0_dissect_cdr_as", "Dissect GTP'v0 CDRs as ", "Dissect GTP'v0 CDRs as", >pv0_cdr_as, gtpv0_cdr_options, FALSE);
5168 prefs_register_bool_preference(gtp_module, "gtpv0_check_etsi", "Compare GTPv0 order with ETSI ", "GTPv0 ETSI order", >pv0_etsi_order);
5169 prefs_register_bool_preference(gtp_module, "gtpv1_check_etsi", "Compare GTPv1 order with ETSI ", "GTPv1 ETSI order", >pv1_etsi_order);
5170 prefs_register_bool_preference(gtp_module, "ppp_reorder", "Reorder & dissect PPP in Protocol conf. options", "PPP reorder & dissect", &ppp_reorder);
5172 register_dissector("gtpv0", dissect_gtpv0, proto_gtpv0);
5173 register_dissector("gtpv1", dissect_gtpv1, proto_gtpv1);
5178 proto_reg_handoff_gtp(void)
5180 static int Initialized = FALSE;
5181 static dissector_handle_t gtpv0_handle;
5182 static dissector_handle_t gtpv1_handle;
5186 gtpv0_handle = find_dissector("gtpv0");
5188 gtpv1_handle = find_dissector("gtpv1");
5194 dissector_delete("udp.port", gtpv0_port, gtpv0_handle);
5195 dissector_delete("tcp.port", gtpv0_port, gtpv0_handle);
5197 dissector_delete("udp.port", gtpv1c_port, gtpv1_handle);
5198 dissector_delete("tcp.port", gtpv1c_port, gtpv1_handle);
5199 dissector_delete("udp.port", gtpv1u_port, gtpv1_handle);
5200 dissector_delete("tcp.port", gtpv1u_port, gtpv1_handle);
5203 gtpv0_port = g_gtpv0_port;
5204 gtpv1c_port = g_gtpv1c_port;
5205 gtpv1u_port = g_gtpv1u_port;
5209 dissector_add("udp.port", g_gtpv0_port, gtpv0_handle);
5210 dissector_add("tcp.port", g_gtpv0_port, gtpv0_handle);
5214 dissector_add("udp.port", g_gtpv1c_port, gtpv1_handle);
5215 dissector_add("tcp.port", g_gtpv1c_port, gtpv1_handle);
5216 dissector_add("udp.port", g_gtpv1u_port, gtpv1_handle);
5217 dissector_add("tcp.port", g_gtpv1u_port, gtpv1_handle);
5219 ip_handle = find_dissector("ip");
5220 ppp_handle = find_dissector("ppp");