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.18 2001/12/03 03:59:34 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"
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 static int hf_gtpv0_flags_e = -1;
87 static int hf_gtpv0_flags_s = -1;
88 static int hf_gtpv0_flags_pn = -1;
89 static int hf_gtpv0_flags_snn = -1;
90 static int hf_gtpv0_message_type = -1;
91 static int hf_gtpv0_length = -1;
92 static int hf_gtpv0_seq_number = -1;
93 static int hf_gtpv0_flow_label = -1;
94 static int hf_gtpv0_sndcp_number = -1;
95 static int hf_gtpv0_npdu_number = -1;
96 static int hf_gtpv0_tid = -1;
97 static int hf_gtpv0_teid = -1;
98 static int hf_gtpv0_next = -1;
99 static int hf_gtpv0_cause = -1;
100 static int hf_gtpv0_imsi = -1;
101 static int hf_gtpv0_rai_mcc = -1;
102 static int hf_gtpv0_rai_mnc = -1;
103 static int hf_gtpv0_rai_rac = -1;
104 static int hf_gtpv0_rai_lac = -1;
105 static int hf_gtpv0_tlli = -1;
106 static int hf_gtpv0_ptmsi = -1;
107 static int hf_gtpv0_qos_spare1 = -1;
108 static int hf_gtpv0_qos_delay = -1;
109 static int hf_gtpv0_qos_mean = -1;
110 static int hf_gtpv0_qos_peak = -1;
111 static int hf_gtpv0_qos_spare2 = -1;
112 static int hf_gtpv0_qos_precedence = -1;
113 static int hf_gtpv0_qos_spare3 = -1;
114 static int hf_gtpv0_qos_reliability = -1;
115 static int hf_gtpv0_reorder = -1;
116 static int hf_gtpv0_map_cause = -1;
117 static int hf_gtpv0_ptmsi_sig = -1;
118 static int hf_gtpv0_ms_valid = -1;
119 static int hf_gtpv0_recovery = -1;
120 static int hf_gtpv0_sel_mode = -1;
121 static int hf_gtpv0_ext_flow_label = -1;
122 static int hf_gtpv0_teid_data = -1; /* 3G */
123 static int hf_gtpv0_flow_sig = -1;
124 static int hf_gtpv0_teid_cp = -1; /* 3G */
125 static int hf_gtpv0_nsapi = -1;
126 static int hf_gtpv0_flow_ii = -1;
127 static int hf_gtpv0_teid_ii = -1; /* 3G */
128 static int hf_gtpv0_ms_reason = -1;
129 static int hf_gtpv0_tear_ind = -1; /* 3G */
130 static int hf_gtpv0_ranap_cause = -1; /* 3G */
131 static int hf_gtpv0_rab_gtpu_dn = -1; /* 3G */
132 static int hf_gtpv0_rab_gtpu_up = -1; /* 3G */
133 static int hf_gtpv0_rab_pdu_dn = -1; /* 3G */
134 static int hf_gtpv0_rab_pdu_up = -1; /* 3G */
135 static int hf_gtpv0_rp_sms = -1; /* 3G */
136 static int hf_gtpv0_rp_spare = -1; /* 3G */
137 static int hf_gtpv0_rp_nsapi = -1; /* 3G */
138 static int hf_gtpv0_rp = -1; /* 3G */
139 static int hf_gtpv0_pkt_flow_id = -1; /* 3G */
140 static int hf_gtpv0_chrg_char_s = -1; /* 3G */
141 static int hf_gtpv0_chrg_char_n = -1; /* 3G */
142 static int hf_gtpv0_chrg_char_p = -1; /* 3G */
143 static int hf_gtpv0_chrg_char_f = -1; /* 3G */
144 static int hf_gtpv0_chrg_char_h = -1; /* 3G */
145 static int hf_gtpv0_chrg_char_r = -1; /* 3G */
146 static int hf_gtpv0_trace_ref = -1; /* 3G */
147 static int hf_gtpv0_trace_type = -1; /* 3G */
148 static int hf_gtpv0_tr_comm = -1; /* charging */
149 static int hf_gtpv0_chrg_id = -1;
150 static int hf_gtpv0_user_ipv4 = -1;
151 static int hf_gtpv0_user_ipv6 = -1;
152 static int hf_gtpv0_user_addr_pdp_org = -1;
153 static int hf_gtpv0_user_addr_pdp_type = -1;
154 static int hf_gtpv0_apn = -1;
155 static int hf_gtpv0_gsn_ipv4 = -1;
156 static int hf_gtpv0_gsn_ipv6 = -1;
157 static int hf_gtpv0_gsn_addr_type = -1;
158 static int hf_gtpv0_gsn_addr_len = -1;
159 static int hf_gtpv0_msisdn = -1;
160 static int hf_gtpv0_qos_al_ret_priority = -1;
161 static int hf_gtpv0_qos_traf_class = -1;
162 static int hf_gtpv0_qos_del_order = -1;
163 static int hf_gtpv0_qos_del_err_sdu = -1;
164 static int hf_gtpv0_qos_max_sdu_size = -1;
165 static int hf_gtpv0_qos_max_ul = -1;
166 static int hf_gtpv0_qos_max_dl = -1;
167 static int hf_gtpv0_qos_res_ber = -1;
168 static int hf_gtpv0_qos_sdu_err_ratio = -1;
169 static int hf_gtpv0_qos_trans_delay = -1;
170 static int hf_gtpv0_qos_traf_handl_prio = -1;
171 static int hf_gtpv0_qos_guar_ul = -1;
172 static int hf_gtpv0_qos_guar_dl = -1;
173 static int hf_gtpv0_rnc_ipv4 = -1;
174 static int hf_gtpv0_rnc_ipv6 = -1;
175 static int hf_gtpv0_chrg_ipv4 = -1;
176 static int hf_gtpv0_chrg_ipv6 = -1;
177 static int hf_gtpv0_node_ipv4 = -1;
178 static int hf_gtpv0_node_ipv6 = -1;
179 static int hf_gtpv0_ext_id = -1;
180 static int hf_gtpv0_ext_val = -1;
181 static int hf_gtpv0_unknown = -1;
183 static int hf_gtpv1_flags = -1;
184 static int hf_gtpv1_flags_ver = -1;
185 static int hf_gtpv1_flags_pt = -1;
186 static int hf_gtpv1_flags_spare = -1;
187 static int hf_gtpv1_flags_e = -1;
188 static int hf_gtpv1_flags_s = -1;
189 static int hf_gtpv1_flags_pn = -1;
190 static int hf_gtpv1_flags_snn = -1;
191 static int hf_gtpv1_message_type = -1;
192 static int hf_gtpv1_length = -1;
193 static int hf_gtpv1_seq_number = -1;
194 static int hf_gtpv1_flow_label = -1;
195 static int hf_gtpv1_sndcp_number = -1;
196 static int hf_gtpv1_npdu_number = -1;
197 static int hf_gtpv1_tid = -1;
198 static int hf_gtpv1_teid = -1;
199 static int hf_gtpv1_next = -1;
200 static int hf_gtpv1_cause = -1;
201 static int hf_gtpv1_imsi = -1;
202 static int hf_gtpv1_rai_mcc = -1;
203 static int hf_gtpv1_rai_mnc = -1;
204 static int hf_gtpv1_rai_rac = -1;
205 static int hf_gtpv1_rai_lac = -1;
206 static int hf_gtpv1_tlli = -1;
207 static int hf_gtpv1_ptmsi = -1;
208 static int hf_gtpv1_qos_spare1 = -1;
209 static int hf_gtpv1_qos_delay = -1;
210 static int hf_gtpv1_qos_mean = -1;
211 static int hf_gtpv1_qos_peak = -1;
212 static int hf_gtpv1_qos_spare2 = -1;
213 static int hf_gtpv1_qos_precedence = -1;
214 static int hf_gtpv1_qos_spare3 = -1;
215 static int hf_gtpv1_qos_reliability = -1;
216 static int hf_gtpv1_reorder = -1;
217 static int hf_gtpv1_map_cause = -1;
218 static int hf_gtpv1_ptmsi_sig = -1;
219 static int hf_gtpv1_ms_valid = -1;
220 static int hf_gtpv1_recovery = -1;
221 static int hf_gtpv1_sel_mode = -1;
222 static int hf_gtpv1_ext_flow_label = -1;
223 static int hf_gtpv1_teid_data = -1; /* 3G */
224 static int hf_gtpv1_flow_sig = -1;
225 static int hf_gtpv1_teid_cp = -1; /* 3G */
226 static int hf_gtpv1_nsapi = -1;
227 static int hf_gtpv1_flow_ii = -1;
228 static int hf_gtpv1_teid_ii = -1; /* 3G */
229 static int hf_gtpv1_ms_reason = -1;
230 static int hf_gtpv1_tear_ind = -1; /* 3G */
231 static int hf_gtpv1_ranap_cause = -1; /* 3G */
232 static int hf_gtpv1_rab_gtpu_dn = -1; /* 3G */
233 static int hf_gtpv1_rab_gtpu_up = -1; /* 3G */
234 static int hf_gtpv1_rab_pdu_dn = -1; /* 3G */
235 static int hf_gtpv1_rab_pdu_up = -1; /* 3G */
236 static int hf_gtpv1_rp_sms = -1; /* 3G */
237 static int hf_gtpv1_rp_spare = -1; /* 3G */
238 static int hf_gtpv1_rp_nsapi = -1; /* 3G */
239 static int hf_gtpv1_rp = -1; /* 3G */
240 static int hf_gtpv1_pkt_flow_id = -1; /* 3G */
241 static int hf_gtpv1_chrg_char_s = -1; /* 3G */
242 static int hf_gtpv1_chrg_char_n = -1; /* 3G */
243 static int hf_gtpv1_chrg_char_p = -1; /* 3G */
244 static int hf_gtpv1_chrg_char_f = -1; /* 3G */
245 static int hf_gtpv1_chrg_char_h = -1; /* 3G */
246 static int hf_gtpv1_chrg_char_r = -1; /* 3G */
247 static int hf_gtpv1_trace_ref = -1; /* 3G */
248 static int hf_gtpv1_trace_type = -1; /* 3G */
249 static int hf_gtpv1_tr_comm = -1; /* charging */
250 static int hf_gtpv1_chrg_id = -1;
251 static int hf_gtpv1_user_ipv4 = -1;
252 static int hf_gtpv1_user_ipv6 = -1;
253 static int hf_gtpv1_user_addr_pdp_org = -1;
254 static int hf_gtpv1_user_addr_pdp_type = -1;
255 static int hf_gtpv1_apn = -1;
256 static int hf_gtpv1_gsn_ipv4 = -1;
257 static int hf_gtpv1_gsn_ipv6 = -1;
258 static int hf_gtpv1_gsn_addr_type = -1;
259 static int hf_gtpv1_gsn_addr_len = -1;
260 static int hf_gtpv1_msisdn = -1;
261 static int hf_gtpv1_qos_al_ret_priority = -1;
262 static int hf_gtpv1_qos_traf_class = -1;
263 static int hf_gtpv1_qos_del_order = -1;
264 static int hf_gtpv1_qos_del_err_sdu = -1;
265 static int hf_gtpv1_qos_max_sdu_size = -1;
266 static int hf_gtpv1_qos_max_ul = -1;
267 static int hf_gtpv1_qos_max_dl = -1;
268 static int hf_gtpv1_qos_res_ber = -1;
269 static int hf_gtpv1_qos_sdu_err_ratio = -1;
270 static int hf_gtpv1_qos_trans_delay = -1;
271 static int hf_gtpv1_qos_traf_handl_prio = -1;
272 static int hf_gtpv1_qos_guar_ul = -1;
273 static int hf_gtpv1_qos_guar_dl = -1;
274 static int hf_gtpv1_rnc_ipv4 = -1;
275 static int hf_gtpv1_rnc_ipv6 = -1;
276 static int hf_gtpv1_chrg_ipv4 = -1;
277 static int hf_gtpv1_chrg_ipv6 = -1;
278 static int hf_gtpv1_node_ipv4 = -1;
279 static int hf_gtpv1_node_ipv6 = -1;
280 static int hf_gtpv1_ext_id = -1;
281 static int hf_gtpv1_ext_val = -1;
282 static int hf_gtpv1_unknown = -1;
284 /* Initialize the subtree pointers */
285 static gint ett_gtp = -1;
286 static gint ett_gtp_flags = -1;
287 static gint ett_gtp_ext = -1;
288 static gint ett_gtp_rai = -1;
289 static gint ett_gtp_qos = -1;
290 static gint ett_gtp_auth_tri = -1;
291 static gint ett_gtp_flow_ii = -1;
292 static gint ett_gtp_rab_cntxt = -1;
293 static gint ett_gtp_rp = -1;
294 static gint ett_gtp_pkt_flow_id = -1;
295 static gint ett_gtp_chrg_char = -1;
296 static gint ett_gtp_user = -1;
297 static gint ett_gtp_mm = -1;
298 static gint ett_gtp_trip = -1;
299 static gint ett_gtp_quint = -1;
300 static gint ett_gtp_pdp = -1;
301 static gint ett_gtp_apn = -1;
302 static gint ett_gtp_proto = -1;
303 static gint ett_gtp_gsn_addr = -1;
304 static gint ett_gtp_tft = -1;
305 static gint ett_gtp_tft_pf = -1;
306 static gint ett_gtp_rab_setup = -1;
307 static gint ett_gtp_hdr_list = -1;
308 static gint ett_gtp_chrg_addr = -1;
309 static gint ett_gtp_node_addr = -1;
310 static gint ett_gtp_rel_pack = -1;
311 static gint ett_gtp_can_pack = -1;
312 static gint ett_gtp_data_resp = -1;
313 static gint ett_gtp_priv_ext = -1;
315 /* Definition of user preferences panel fields */
316 #define DONT_DISSECT_CDRS 2
318 static gboolean gtp_tpdu = TRUE;
319 static gint gtpv0_cdr_as = DONT_DISSECT_CDRS; /* 2 = do not dissect */
320 static gboolean gtpv0_etsi_order = FALSE;
321 static gboolean gtpv1_etsi_order = FALSE;
322 static int gtpv0_port = 0;
323 static int gtpv1c_port = 0;
324 static int gtpv1u_port = 0;
325 static gboolean ppp_reorder = TRUE;
327 /* Definition of flags masks */
328 #define GTP_VER_MASK 0xE0
330 static const value_string ver_types[] = {
331 { 0, "GTP release 97/98 version" },
332 { 1, "GTP release 99 version" },
342 #define GTP_PT_MASK 0x10
343 #define GTP_SPARE_MASK 0x0E
344 #define GTPv1_SPARE_MASK 0x08
345 #define GTPv1_E_MASK 0x04
346 #define GTPv1_S_MASK 0x02
347 #define GTP_SNN_MASK 0x01
348 #define GTPv1_PN_MASK 0x01
350 /* Definition of 3G charging characteristics masks */
351 #define GTP_MASK_CHRG_CHAR_S 0xF000
352 #define GTP_MASK_CHRG_CHAR_N 0x0800
353 #define GTP_MASK_CHRG_CHAR_P 0x0400
354 #define GTP_MASK_CHRG_CHAR_F 0x0200
355 #define GTP_MASK_CHRG_CHAR_H 0x0100
356 #define GTP_MASK_CHRG_CHAR_R 0x00FF
359 /* Definition of GSN Address masks */
360 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
361 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
363 /* Definition of QoS masks */
364 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
365 #define GTP_EXT_QOS_DELAY_MASK 0x38
366 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
367 #define GTP_EXT_QOS_PEAK_MASK 0xF0
368 #define GTP_EXT_QOS_SPARE2_MASK 0x08
369 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
370 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
371 #define GTP_EXT_QOS_MEAN_MASK 0x1F
372 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
373 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
374 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
375 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
376 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
377 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
378 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
380 /* Definition of Radio Priority's masks */
381 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
382 #define GTPv1_EXT_RP_SPARE_MASK 0x08
383 #define GTPv1_EXT_RP_MASK 0x07
385 /* definitions of GTP messages */
386 #define GTP_MSG_UNKNOWN 0x00
387 #define GTP_MSG_ECHO_REQ 0x01
388 #define GTP_MSG_ECHO_RESP 0x02
389 #define GTP_MSG_VER_NOT_SUPP 0x03
390 #define GTP_MSG_NODE_ALIVE_REQ 0x04
391 #define GTP_MSG_NODE_ALIVE_RESP 0x05
392 #define GTP_MSG_REDIR_REQ 0x06
393 #define GTP_MSG_REDIR_RESP 0x07
394 #define GTP_MSG_CREATE_PDP_REQ 0x10
395 #define GTP_MSG_CREATE_PDP_RESP 0x11
396 #define GTP_MSG_UPDATE_PDP_REQ 0x12
397 #define GTP_MSG_UPDATE_PDP_RESP 0x13
398 #define GTP_MSG_DELETE_PDP_REQ 0x14
399 #define GTP_MSG_DELETE_PDP_RESP 0x15
400 #define GTP_MSG_CREATE_AA_PDP_REQ 0x16 /* 2G */
401 #define GTP_MSG_CREATE_AA_PDP_RESP 0x17 /* 2G */
402 #define GTP_MSG_DELETE_AA_PDP_REQ 0x18 /* 2G */
403 #define GTP_MSG_DELETE_AA_PDP_RESP 0x19 /* 2G */
404 #define GTP_MSG_ERR_IND 0x1A
405 #define GTP_MSG_PDU_NOTIFY_REQ 0x1B
406 #define GTP_MSG_PDU_NOTIFY_RESP 0x1C
407 #define GTP_MSG_PDU_NOTIFY_REJ_REQ 0x1D
408 #define GTP_MSG_PDU_NOTIFY_REJ_RESP 0x1E
409 #define GTP_MSG_SUPP_EXT_HDR 0x1F
410 #define GTP_MSG_SEND_ROUT_INFO_REQ 0x20
411 #define GTP_MSG_SEND_ROUT_INFO_RESP 0x21
412 #define GTP_MSG_FAIL_REP_REQ 0x22
413 #define GTP_MSG_FAIL_REP_RESP 0x23
414 #define GTP_MSG_MS_PRESENT_REQ 0x24
415 #define GTP_MSG_MS_PRESENT_RESP 0x25
416 #define GTP_MSG_IDENT_REQ 0x30
417 #define GTP_MSG_IDENT_RESP 0x31
418 #define GTP_MSG_SGSN_CNTXT_REQ 0x32
419 #define GTP_MSG_SGSN_CNTXT_RESP 0x33
420 #define GTP_MSG_SGSN_CNTXT_ACK 0x34
421 #define GTP_MSG_FORW_RELOC_REQ 0x35
422 #define GTP_MSG_FORW_RELOC_RESP 0x36
423 #define GTP_MSG_FORW_RELOC_COMP 0x37
424 #define GTP_MSG_RELOC_CANCEL_REQ 0x38
425 #define GTP_MSG_RELOC_CANCEL_RESP 0x39
426 #define GTP_MSG_FORW_SRNS_CNTXT 0x3A
427 #define GTP_MSG_FORW_RELOC_ACK 0x3B
428 #define GTP_MSG_FORW_SRNS_CNTXT_ACK 0x3C
429 #define GTP_MSG_DATA_TRANSF_REQ 0xF0
430 #define GTP_MSG_DATA_TRANSF_RESP 0xF1
431 #define GTP_MSG_TPDU 0xFF
433 static const value_string message_type[] = {
434 { GTP_MSG_UNKNOWN, "For future use" },
435 { GTP_MSG_ECHO_REQ, "Echo request" },
436 { GTP_MSG_ECHO_RESP, "Echo response" },
437 { GTP_MSG_VER_NOT_SUPP, "Version not supported" },
438 { GTP_MSG_NODE_ALIVE_REQ, "Node alive request" },
439 { GTP_MSG_NODE_ALIVE_RESP, "Node alive response" },
440 { GTP_MSG_REDIR_REQ, "Redirection request" },
441 { GTP_MSG_REDIR_RESP, "Redirection response" },
442 { GTP_MSG_CREATE_PDP_REQ, "Create PDP context request" },
443 { GTP_MSG_CREATE_PDP_RESP, "Create PDP context response" },
444 { GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request" },
445 { GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response" },
446 { GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request" },
447 { GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response" },
448 { GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request" },
449 { GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response" },
450 { GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request" },
451 { GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response" },
452 { GTP_MSG_ERR_IND, "Error indication" },
453 { GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request" },
454 { GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response" },
455 { GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request" },
456 { GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response" },
457 { GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification" },
458 { GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request" },
459 { GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response" },
460 { GTP_MSG_FAIL_REP_REQ, "Failure report request" },
461 { GTP_MSG_FAIL_REP_RESP, "Failure report response" },
462 { GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request" },
463 { GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response" },
464 { GTP_MSG_IDENT_REQ, "Identification request" },
465 { GTP_MSG_IDENT_RESP, "Identification response" },
466 { GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request" },
467 { GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response" },
468 { GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement" },
469 { GTP_MSG_FORW_RELOC_REQ, "Forward relocation request" },
470 { GTP_MSG_FORW_RELOC_RESP, "Forward relocation response" },
471 { GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete" },
472 { GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request" },
473 { GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response" },
474 { GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context" },
475 { GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge" },
476 { GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge" },
477 { GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request" },
478 { GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response" },
479 { GTP_MSG_TPDU, "T-PDU" },
483 /* definitions of fields in extension header */
484 #define GTP_EXT_CAUSE 0x01
485 #define GTP_EXT_IMSI 0x02
486 #define GTP_EXT_RAI 0x03
487 #define GTP_EXT_TLLI 0x04
488 #define GTP_EXT_PTMSI 0x05
489 #define GTP_EXT_QOS_GPRS 0x06
490 #define GTP_EXT_REORDER 0x08
491 #define GTP_EXT_AUTH_TRI 0x09
492 #define GTP_EXT_MAP_CAUSE 0x0B
493 #define GTP_EXT_PTMSI_SIG 0x0C
494 #define GTP_EXT_MS_VALID 0x0D
495 #define GTP_EXT_RECOVER 0x0E
496 #define GTP_EXT_SEL_MODE 0x0F
498 #define GTP_EXT_16 0x10
499 #define GTP_EXT_FLOW_LABEL 0x10
500 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
502 #define GTP_EXT_17 0x11
503 #define GTP_EXT_FLOW_SIG 0x11
504 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
506 #define GTP_EXT_18 0x12
507 #define GTP_EXT_FLOW_II 0x12
508 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G*/
510 #define GTP_EXT_19 0x13
511 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
512 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G*/
514 #define GTP_EXT_NSAPI 0x14 /* 3G */
515 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
516 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
517 #define GTP_EXT_RP_SMS 0x17 /* 3G */
518 #define GTP_EXT_RP 0x18 /* 3G */
519 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
520 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
521 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
522 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
523 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
524 #define GTP_EXT_TR_COMM 0x7E /* charging */
525 #define GTP_EXT_CHRG_ID 0x7F
526 #define GTP_EXT_USER_ADDR 0x80
527 #define GTP_EXT_MM_CNTXT 0x81
528 #define GTP_EXT_PDP_CNTXT 0x82
529 #define GTP_EXT_APN 0x83
530 #define GTP_EXT_PROTO_CONF 0x84
531 #define GTP_EXT_GSN_ADDR 0x85
532 #define GTP_EXT_MSISDN 0x86
533 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
534 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
535 #define GTP_EXT_TFT 0x89 /* 3G */
536 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
537 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
538 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
539 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
540 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G */
541 #define GTP_EXT_OMC_ID 0x8F /* 3G */
542 #define GTP_EXT_REL_PACK 0xF9 /* charging */
543 #define GTP_EXT_CAN_PACK 0xFA /* charging */
544 #define GTP_EXT_CHRG_ADDR 0xFB
545 #define GTP_EXT_DATA_REQ 0xFC /* charging */
546 #define GTP_EXT_DATA_RESP 0xFD /* charging */
547 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
548 #define GTP_EXT_PRIV_EXT 0xFF
550 static const value_string gtp_val[] = {
551 { GTP_EXT_CAUSE, "Cause of operation" },
552 { GTP_EXT_IMSI, "IMSI " },
553 { GTP_EXT_RAI, "Routing Area Identity" },
554 { GTP_EXT_TLLI, "Temporary Logical Link Identity" },
555 { GTP_EXT_PTMSI, "Packet TMSI" },
556 { GTP_EXT_QOS_GPRS, "Quality of Service" },
557 { GTP_EXT_REORDER, "Reorder required" },
558 { GTP_EXT_AUTH_TRI, "Authentication triplets" },
559 { GTP_EXT_MAP_CAUSE, "MAP cause" },
560 { GTP_EXT_PTMSI_SIG, "P-TMSI signature" },
561 { GTP_EXT_MS_VALID, "MS validated" },
562 { GTP_EXT_RECOVER, "Recovery" },
563 { GTP_EXT_SEL_MODE, "Selection mode" },
565 { GTP_EXT_16, "Flow label data I" },
566 { GTP_EXT_FLOW_LABEL, "Flow label data I" },
567 { GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I" }, /* 3G */
569 { GTP_EXT_17, "Flow label signalling" },
570 { GTP_EXT_FLOW_SIG, "Flow label signalling" },
571 { GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane" }, /* 3G */
573 { GTP_EXT_18, "Flow label data II" },
574 { GTP_EXT_FLOW_II, "Flow label data II" },
575 { GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II" }, /* 3G */
577 { GTP_EXT_19, "MS not reachable reason" },
578 { GTP_EXT_MS_REASON, "MS not reachable reason" },
579 { GTP_EXT_TEAR_IND, "Teardown ID" }, /* 3G */
581 { GTP_EXT_NSAPI, "NSAPI" }, /* 3G */
582 { GTP_EXT_RANAP_CAUSE, "RANAP cause" }, /* 3G */
583 { GTP_EXT_RAB_CNTXT, "RAB context" }, /* 3G */
584 { GTP_EXT_RP_SMS, "Radio Priority for MO SMS" }, /* 3G */
585 { GTP_EXT_RP, "Radio Priority" }, /* 3G */
586 { GTP_EXT_PKT_FLOW_ID, "Packet Flow ID " }, /* 3G */
587 { GTP_EXT_CHRG_CHAR, "Charging characteristics" }, /* 3G */
588 { GTP_EXT_TRACE_REF, "Trace references" }, /* 3G */
589 { GTP_EXT_TRACE_TYPE, "Trace type" }, /* 3G */
590 { GTPv1_EXT_MS_REASON, "MS not reachable reason" }, /* 3G */
591 { GTP_EXT_TR_COMM, "Packet transfer command" }, /* charging */
592 { GTP_EXT_CHRG_ID, "Charging ID" },
593 { GTP_EXT_USER_ADDR, "End user address " },
594 { GTP_EXT_MM_CNTXT, "MM context" },
595 { GTP_EXT_PDP_CNTXT, "PDP context" },
596 { GTP_EXT_APN, "Access Point Name" },
597 { GTP_EXT_PROTO_CONF, "Protocol configuration options" },
598 { GTP_EXT_GSN_ADDR, "GSN address" },
599 { GTP_EXT_MSISDN, "MS international PSTN/ISDN number" },
600 { GTP_EXT_QOS_UMTS, "Quality of service (UMTS)" }, /* 3G */
601 { GTP_EXT_AUTH_QUI, "Authentication quintuplets" }, /* 3G */
602 { GTP_EXT_TFT, "Traffic Flow Template (TFT)" }, /* 3G */
603 { GTP_EXT_TARGET_ID, "Target (RNC) identification" }, /* 3G */
604 { GTP_EXT_UTRAN_CONT, "UTRAN transparent field" }, /* 3G */
605 { GTP_EXT_RAB_SETUP, "RAB setup information" }, /* 3G */
606 { GTP_EXT_HDR_LIST, "Extension Header Types List " }, /* 3G */
607 { GTP_EXT_TRIGGER_ID, "Trigger Id " }, /* 3G */
608 { GTP_EXT_OMC_ID, "OMC Identity " }, /* 3G */
609 { GTP_EXT_REL_PACK, "Sequence numbers of released packets IE" }, /* charging */
610 { GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE" }, /* charging */
611 { GTP_EXT_CHRG_ADDR, "Charging Gateway address" },
612 { GTP_EXT_DATA_REQ, "Data record packet" }, /* charging */
613 { GTP_EXT_DATA_RESP, "Requests responded" }, /* charging */
614 { GTP_EXT_NODE_ADDR, "Address of recommended node" }, /* charging */
615 { GTP_EXT_PRIV_EXT, "Private Extension " },
619 /* GPRS: 9.60 v7.6.0, page 37
620 * UMTS: 29.060 v4.0, page 45
622 static const value_string cause_type[] = {
623 { 0, "Request IMSI" },
624 { 1, "Request IMEI" },
625 { 2, "Request IMSI and IMEI" },
626 { 3, "No identity needed" },
628 { 5, "MS is not GPRS responding" },
629 { 59, "System failure" }, /* charging */
630 { 60, "The transmit buffers are becoming full" }, /* charging */
631 { 61, "The receive buffers are becoming full" }, /* charging */
632 { 62, "Another node is about to go down" }, /* charging */
633 { 63, "This node is about to go down" }, /* charging */
634 { 128, "Request accepted" },
635 { 192, "Non-existent" },
636 { 193, "Invalid message format" },
637 { 194, "IMSI not known" },
638 { 195, "MS is GPRS detached" },
639 { 196, "MS is not GPRS responding" },
640 { 197, "MS refuses" },
641 { 198, "Version not supported" },
642 { 199, "No resource available" },
643 { 200, "Service not supported" },
644 { 201, "Mandatory IE incorrect" },
645 { 202, "Mandatory IE missing" },
646 { 203, "Optional IE incorrect" },
647 { 204, "System failure" },
648 { 205, "Roaming restriction" },
649 { 206, "P-TMSI signature mismatch" },
650 { 207, "GPRS connection suspended" },
651 { 208, "Authentication failure" },
652 { 209, "User authentication failed" },
653 { 210, "Context not found" },
654 { 211, "All PDP dynamic addresses are occupied" },
655 { 212, "No memory is available" },
656 { 213, "Relocation failure" },
657 { 214, "Unknown mandatory extension header" },
658 { 215, "Semantic error in the TFT operation" },
659 { 216, "Syntactic error in the TFT operation" },
660 { 217, "Semantic errors in packet filter(s)" },
661 { 218, "Syntactic errors in packet filter(s)" },
662 { 219, "Missing or unknown APN" },
663 { 220, "Unknown PDP address or PDP type" },
664 { 252, "Request related to possibly duplicated packets already fulfilled" }, /* charging */
665 { 253, "Request already fulfilled" }, /* charging */
666 { 254, "Sequence numbers of released/cancelled packets IE incorrect" }, /* charging */
667 { 255, "Request not fulfilled" }, /* charging */
672 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
673 * TODO: Check if all map_cause values are included
675 static const value_string map_cause_type[] = {
676 { 1, "Unknown subscriber" },
677 { 8, "Roaming not allowed" },
678 { 10, "Bearer service not provisioned" },
679 { 11, "Teleservice not provisioned" },
680 { 13, "Call barred" },
681 { 21, "Facility not supported" },
682 { 23, "Update GPRS location" },
683 { 24, "Send routing info for GPRS" },
684 { 26, "Note MS present for GPRS" },
685 { 27, "Absent subscriber" },
686 { 34, "System failure" },
687 { 35, "Data missing" },
688 { 36, "Unexpected data value" },
689 { 44, "Number chenged" },
690 { 45, "Busy subscriber" },
691 { 46, "No subscriber reply" },
692 { 48, "Facility not allowed" },
696 static const value_string gsn_addr_type[] = {
702 static const value_string pdp_type[] = {
705 { 0x02, "OSP:IHOSS" },
711 static const value_string pdp_org_type[] = {
717 static const value_string qos_delay_type[] = {
718 { 0x00, "Subsribed delay class (in MS to network direction)" },
719 { 0x01, "Delay class 1" },
720 { 0x02, "Delay class 2" },
721 { 0x03, "Delay class 3" },
722 { 0x04, "Delay class 4 (best effort)" },
723 { 0x07, "Reserved" },
727 static const value_string qos_reliability_type[] = {
728 { 0x00, "Subscribed reliability class (in MS to network direction)" },
729 { 0x01, "Ack GTP/LLC/RLC, Protected data" },
730 { 0x02, "Unack GTP, Ack LLC/RLC, Protected data" },
731 { 0x03, "Unack GTP/LLC, Ack RLC, Protected data" },
732 { 0x04, "Unack GTP/LLC/RLC, Protected data" },
733 { 0x05, "Unack GTP/LLC/RLC, Unprotected data" },
734 { 0x07, "Reserved" },
738 static const value_string qos_peak_type[] = {
739 { 0x00, "Subscribed peak throughput (in MS to network direction)" },
740 { 0x01, "Up to 1 000 oct/s" },
741 { 0x02, "Up to 2 000 oct/s" },
742 { 0x03, "Up to 4 000 oct/s" },
743 { 0x04, "Up to 8 000 oct/s" },
744 { 0x05, "Up to 16 000 oct/s" },
745 { 0x06, "Up to 32 000 oct/s" },
746 { 0x07, "Up to 64 000 oct/s" },
747 { 0x08, "Up to 128 000 oct/s" },
748 { 0x09, "Up to 256 000 oct/s" },
749 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
750 { 0x0A, "Reserved" },
751 { 0x0B, "Reserved" },
752 { 0x0C, "Reserved" },
753 { 0x0D, "Reserved" },
754 { 0x0E, "Reserved" },
755 { 0x0F, "Reserved" },
759 static const value_string qos_precedence_type[] = {
760 { 0x00, "Subscribed precedence (in MS to network direction)" },
761 { 0x01, "High priority" },
762 { 0x02, "Normal priority" },
763 { 0x03, "Low priority" },
764 { 0x07, "Reserved" },
768 static const value_string qos_mean_type[] = {
769 { 0x00, "Subscribed mean throughput (in MS to network direction)" },
770 { 0x01, "100 oct/h" }, /* Class 2 */
771 { 0x02, "200 oct/h" }, /* Class 3 */
772 { 0x03, "500 oct/h" }, /* Class 4 */
773 { 0x04, "1 000 oct/h" }, /* Class 5 */
774 { 0x05, "2 000 oct/h" }, /* Class 6 */
775 { 0x06, "5 000 oct/h" }, /* Class 7 */
776 { 0x07, "10 000 oct/h" }, /* Class 8 */
777 { 0x08, "20 000 oct/h" }, /* Class 9 */
778 { 0x09, "50 000 oct/h" }, /* Class 10 */
779 { 0x0A, "100 000 oct/h" }, /* Class 11 */
780 { 0x0B, "200 000 oct/h" }, /* Class 12 */
781 { 0x0C, "500 000 oct/h" }, /* Class 13 */
782 { 0x0D, "1 000 000 oct/h" }, /* Class 14 */
783 { 0x0E, "2 000 000 oct/h" }, /* Class 15 */
784 { 0x0F, "5 000 000 oct/h" }, /* Class 16 */
785 { 0x10, "10 000 000 oct/h" }, /* Class 17 */
786 { 0x11, "20 000 000 oct/h" }, /* Class 18 */
787 { 0x12, "50 000 000 oct/h" }, /* Class 19 */
788 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
789 { 0x13, "Reserved" },
790 { 0x14, "Reserved" },
791 { 0x15, "Reserved" },
792 { 0x16, "Reserved" },
793 { 0x17, "Reserved" },
794 { 0x18, "Reserved" },
795 { 0x19, "Reserved" },
796 { 0x1A, "Reserved" },
797 { 0x1B, "Reserved" },
798 { 0x1C, "Reserved" },
799 { 0x1D, "Reserved" },
800 { 0x1E, "Reserved" },
801 { 0x1F, "Best effort" }, /* Class 1 */
805 static const value_string qos_del_err_sdu[] = {
806 { 0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)" },
807 { 0x01, "No detect ('-')" },
808 { 0x02, "Erroneous SDUs are delivered ('yes')" },
809 { 0x03, "Erroneous SDUs are not delivered ('no')" },
810 { 0x07, "Reserved" }, /* All other values are reserved */
814 static const value_string qos_del_order[] = {
815 { 0x00, "Subscribed delivery order (in MS to network direction)" },
816 { 0x01, "With delivery order ('yes')" },
817 { 0x02, "Without delivery order ('no')" },
818 { 0x03, "Reserved" }, /* All other values are reserved */
822 static const value_string qos_traf_class[] = {
823 { 0x00, "Subscribed traffic class (in MS to network direction)" },
824 { 0x01, "Conversational class" },
825 { 0x02, "Streaming class" },
826 { 0x03, "Interactive class" },
827 { 0x04, "Background class" },
828 { 0x07, "Reserved" }, /* All other values are reserved */
832 static const value_string qos_max_sdu_size[] = {
833 { 0x00, "Subscribed maximum SDU size (in MS to network direction" },
834 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
835 { 0x97, "1502 octets" },
836 { 0x98, "1510 octets" },
837 { 0x99, "1520 octets" },
838 { 0, NULL } /* All other values are reserved */
841 static const value_string qos_max_ul[] = {
842 { 0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)" },
843 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
844 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
845 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
850 static const value_string qos_max_dl[] = {
851 { 0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)" },
852 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
853 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
854 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
859 static const value_string qos_res_ber[] = {
860 { 0x00, "Subscribed residual BER (in MS to network direction)" },
861 { 0x01, "1/20 = 5x10^-2" },
862 { 0x02, "1/100 = 1x10^-2" },
863 { 0x03, "1/200 = 5x10^-3" },
864 { 0x04, "1/250 = 4x10^-3" },
865 { 0x05, "1/1 000 = 1x10^-3" },
866 { 0x06, "1/10 000 = 1x10^-4" },
867 { 0x07, "1/100 000 = 1x10^-5" },
868 { 0x08, "1/1 000 000 = 1x10^-6" },
869 { 0x09, "3/50 000 000 = 6x10^-8" },
870 { 0x0F, "Reserved" }, /* All other values are reserved */
874 static const value_string qos_sdu_err_ratio[] = {
875 { 0x00, "Subscribed SDU error ratio (in MS to network direction)" },
876 { 0x01, "1/100 = 1x10^-2" },
877 { 0x02, "7/1000 = 7x10^-3" },
878 { 0x03, "1/1 000 = 1x10^-3" },
879 { 0x04, "1/10 000 = 1x10^-4" },
880 { 0x05, "1/100 000 = 1x10^-5" },
881 { 0x06, "1/1 000 000 = 1x10^-6" },
882 { 0x07, "1/10 = 1x10^-1" },
883 { 0x0F, "Reserved" }, /* All other values are reserved */
887 static const value_string qos_traf_handl_prio[] = {
888 { 0x00, "Subscribed traffic handling priority (in MS to network direction)" },
889 { 0x01, "Priority level 1" },
890 { 0x02, "Priority level 2" },
891 { 0x03, "Priority level 3" },
895 static const value_string qos_trans_delay[] = {
896 { 0x00, "Subscribed Transfer Delay (in MS to network direction)" },
897 { 0x01, "10 ms" }, /* Using a granularity of 10 ms */
912 { 0x10, "200 ms" }, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
928 { 0x20, "1000 ms" }, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
963 static const value_string qos_guar_ul[] = {
964 { 0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)" },
965 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
966 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
967 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
972 static const value_string qos_guar_dl[] = {
973 { 0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)" },
974 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
975 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
976 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
981 static const value_string sel_mode_type[] = {
982 { 0, "MS or network provided APN, subscriber verified" },
983 { 1, "MS provided APN, subscription not verified" },
984 { 2, "Network provided APN, subscription not verified" },
985 { 3, "For future use (Network provided APN, subscription not verified" },/* Shall not be sent. If received, shall be sent as value 2 */
989 static const value_string tr_comm_type[] = {
990 { 1, "Send data record packet" },
991 { 2, "Send possibly duplicated data record packet" },
992 { 3, "Cancel data record packet" },
993 { 4, "Release data record packet"},
997 /* TODO: CHeck if all ms_reasons are included */
998 static const value_string ms_not_reachable_type[] = {
999 { 0, "No paging response via the MSC" },
1000 { 1, "IMSI detached" },
1001 { 2, "Roaming restriction" },
1002 { 3, "Deregistered in the HLR for non GPRS" },
1003 { 4, "MS purge for non GPRS" },
1004 { 5, "No paging response via the SGSN" },
1005 { 6, "GPRS detached" },
1006 { 7, "Deregistered in the HLR for non GPRS" },
1007 { 8, "MS purged for GPRS" },
1008 { 9, "Unidentified subscriber via the MSC" },
1009 { 10, "Unidentified subscriber via the SGSN" },
1013 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1015 static const value_string ranap_cause_type[] = {
1016 /* Radio Network Layer Cause (1-->64) */
1017 { 1, "RAB preempted" },
1018 { 2, "Trelocoverall Expiry" },
1019 { 3, "Trelocprep Expiry" },
1020 { 4, "Treloccomplete Expiry" },
1021 { 5, "Tqueing Expiry" },
1022 { 6, "Relocation Triggered" },
1023 { 7, "TRELOCalloc Expiry" },
1024 { 8, "Unable to Estabish During Relocation" },
1025 { 9, "Unknown Target RNC" },
1026 { 10, "Relocation Cancelled" },
1027 { 11, "Successful Relocation" },
1028 { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported" },
1029 { 13, "Change of Ciphering and/or Integrity Protection is not supported" },
1030 { 14, "Failure in the Radio Interface Procedure" },
1031 { 15, "Release due to UTRAN Generated Reason" },
1032 { 16, "User Inactivity" },
1033 { 17, "Time Critical Relocation" },
1034 { 18, "Requested Traffic Class not Available" },
1035 { 19, "Invalid RAB Parameters Value" },
1036 { 20, "Requested Maximum Bit Rate not Available" },
1037 { 21, "Requested Guaranteed Bit Rate not Available" },
1038 { 22, "Requested Transfer Delay not Achievable" },
1039 { 23, "Invalid RAB Parameters Combination" },
1040 { 24, "Condition Violation for SDU Parameters" },
1041 { 25, "Condition Violation for Traffic Handling Priority" },
1042 { 26, "Condition Violation for Guaranteed Bit Rate" },
1043 { 27, "User Plane Versions not Supported" },
1044 { 28, "Iu UP Failure" },
1045 { 29, "Relocation Failure in Target CN/RNC or Target System" },
1046 { 30, "Invalid RAB ID" },
1047 { 31, "No Remaining RAB" },
1048 { 32, "Interaction with other procedure" },
1049 { 33, "Requested Maximum Bit Rate for DL not Available" },
1050 { 34, "Requested Maximum Bit Rate for UL not Available" },
1051 { 35, "Requested Guaranteed Bit Rate for DL not Available" },
1052 { 36, "Requested Guaranteed Bit Rate for UL not Available" },
1053 { 37, "Repeated Integrity Checking Failure" },
1054 { 38, "Requested Report Type not supported" },
1055 { 39, "Request superseded" },
1056 { 40, "Release due to UE generated signalling connection release" },
1057 { 41, "Resource Optimisation Relocation" },
1058 { 42, "Requested Information Not Available" },
1059 { 43, "Relocation desirable for radio reasons" },
1060 { 44, "Relocation not supported in Target RNC or Target System" },
1061 { 45, "Directed Retry" },
1062 { 46, "Radio Connection With UE Lost" },
1063 /* Transport Layer Cause (65-->80) */
1064 { 65, "Signalling Transport Resource Failure" },
1065 { 66, "Iu Transport Connection Failed to Establish" },
1066 /* NAS Cause (81-->96) */
1067 { 81, "User Restriction Start Indication" },
1068 { 82, "User Restriction End Indication" },
1069 { 83, "Normal Release" },
1070 /* Protocol Cause (97-->112) */
1071 { 97, "Transfer Syntax Error" },
1072 { 98, "Semantic Error" },
1073 { 99, "Message not compatible with receiver state" },
1074 { 100, "Abstract Syntax Error (Reject)" },
1075 { 101, "Abstract Syntax Error (Ignore and Notify)" },
1076 { 102, "Abstract Syntax Error (Falsely Constructed Message" },
1077 /* Miscellaneous Cause (113-->128) */
1078 { 113, "O & M Intervention" },
1079 { 114, "No Resource Available" },
1080 { 115, "Unspecified Failure" },
1081 { 116, "Network Opimisation" },
1082 /* Non-standard Cause (129-->255) */
1086 static const value_string mm_sec_modep[] = {
1087 { 0, "Used cipher value, UMTS keys and Quintuplets" },
1088 { 1, "GSM key and triplets" },
1089 { 2, "UMTS key and quintuplets" },
1090 { 3, "GSM key and quintuplets" },
1094 static const value_string mm_proto_disc[] = {
1095 { 0x00, "Group call control" },
1096 { 0x01, "Broadcast call control" },
1098 { 0x03, "Call control; call related SS messages" },
1100 { 0x05, "Mobility Management messages for non-GPRS services" },
1101 { 0x06, "Radio Resource management messages" },
1102 { 0x08, "Mobility Management messages for GPRS services" },
1104 { 0x0A, "Session Management messages" },
1105 { 0x0B, "Non-call related SS messages" },
1109 static const value_string mm_rr_mess[] = {
1110 { 0x3C, "RR initialization request" },
1111 { 0x3B, "Additional assignment" },
1112 { 0x3F, "Immediate assignment" },
1113 { 0x39, "Immediate assignment extended" },
1114 { 0x3A, "Immediate assignment reject" },
1116 { 0x35, "Ciphering mode command" },
1117 { 0x32, "Ciphering mode complete" },
1119 { 0x30, "Configuration change command" },
1120 { 0x31, "Configuration change ack" },
1121 { 0x33, "Configuration change reject" },
1123 { 0x2E, "Assignment command" },
1124 { 0x29, "Assignment complete" },
1125 { 0x2F, "Assigment failure" },
1126 { 0x2B, "Handover command" },
1127 { 0x2C, "Handover complete" },
1128 { 0x28, "Handover failure" },
1129 { 0x2D, "Physical information" },
1131 { 0x08, "RR-cell change order" },
1132 { 0x23, "PDCH assignment command" },
1134 { 0x0D, "Channel release" },
1135 { 0x0A, "Partial release" },
1136 { 0x0F, "PArtial release complete" },
1138 { 0x21, "Paging request type 1" },
1139 { 0x22, "Paging request type 2" },
1140 { 0x24, "Paging request type 3" },
1141 { 0x27, "Paging response" },
1142 { 0x20, "Notification/NCH" },
1143 { 0x25, "Notification/FACCH" },
1144 { 0x26, "Reserved" },
1145 { 0x0B, "Reserved" },
1147 { 0x18, "System information type 8" },
1148 { 0x19, "System information type 1" },
1149 { 0x1A, "System information type 2" },
1150 { 0x1B, "System information type 3" },
1151 { 0x1C, "System information type 4" },
1152 { 0x1D, "System information type 5" },
1153 { 0x1E, "System information type 6" },
1154 { 0x1F, "System information type 7" },
1156 { 0x02, "System information type 2bis" },
1157 { 0x03, "System information type 2ter" },
1158 { 0x05, "System information type 5bis" },
1159 { 0x06, "System information type 5ter" },
1160 { 0x04, "System information 9" },
1161 { 0x00, "System information 13" },
1162 { 0x01, "System information 14" },
1164 { 0x3D, "System information type 16" },
1165 { 0x3E, "System information type 17" },
1167 { 0x10, "Channel mode modify" },
1168 { 0x12, "RR status" },
1169 { 0x17, "Channel mode modify ack" },
1170 { 0x14, "Frequency redefinition " },
1171 { 0x15, "Measurement report" },
1172 { 0x16, "Classmark change" },
1173 { 0x13, "Classmark enquiry" },
1174 { 0x36, "Extended measurement report" },
1175 { 0x37, "Extended measurement order" },
1176 { 0x34, "GPRS suspension request" },
1178 { 0x09, "VGCS uplink grant" },
1179 { 0x0E, "Uplink release" },
1180 { 0x0C, "Uplink free" },
1181 { 0x2A, "Uplink busy" },
1182 { 0x11, "Talker indication" },
1187 static const value_string mm_mm_mess[] = {
1188 { 0x01, "IMSI DETACH INDICATION" },
1189 { 0x02, "LOCATION UPDATING ACCEPT" },
1190 { 0x04, "LOCATION UPDATING REJECT" },
1191 { 0x08, "LOCATION UPDATING REQUEST" },
1192 { 0x11, "AUTHENTICATION REJECT" },
1193 { 0x12, "AUTHENTICATION REQUEST" },
1194 { 0x14, "AUTHENTICATION RESPONSE" },
1195 { 0x18, "IDENTITY REQUEST" },
1196 { 0x19, "IDENTITY RESPONSE" },
1197 { 0x1A, "TMSI REALLOCATION COMMAND" },
1198 { 0x1B, "TMSI REALLOCATION COMPLETE" },
1199 { 0x21, "CM SERVICE ACCEPT" },
1200 { 0x22, "CM SERVICE REJECT" },
1201 { 0x23, "CM SERVICE ABORT" },
1202 { 0x24, "CM SERVICE REQUEST" },
1203 { 0x25, "CM SERVICE PROMPT" },
1204 { 0x26, "NOTIFICATION RESPONSE" },
1205 { 0x28, "CM RE-ESTABLISHMENT REQUEST" },
1207 { 0x30, "MM NULL" },
1208 { 0x31, "MM STATUS" },
1209 { 0x32, "MM INFORMATION" },
1213 static const value_string mm_cc_mess[] = {
1214 { 0x00, "escape to nationally specific" },
1215 /*{ 0 x 0 0, "- - - Call establishment messages:" },*/
1216 { 0x01, "ALERTING" },
1217 { 0x08, "CALL CONFIRMED" },
1218 { 0x02, "CALL PROCEEDING" },
1219 { 0x07, "CONNECT" },
1220 { 0x0F, "CONNECT ACKNOWLEDGE" },
1221 { 0x0E, "EMERGENCY SETUP" },
1222 { 0x03, "PROGRESS" },
1223 { 0x04, "CC-ESTABLISHMENT" },
1224 { 0x06, "CC-ESTABLISHMENT CONFIRMED" },
1226 { 0x09, "START CC" },
1228 /*{ 0 x 0 1, "- - - Call information phase messages:" },*/
1230 { 0x1F, "MODIFY COMPLETE" },
1231 { 0x13, "MODIFY REJECT" },
1232 { 0x10, "USER INFORMATION" },
1234 { 0x19, "HOLD ACKNOWLEDGE" },
1235 { 0x1A, "HOLD REJECT" },
1236 { 0x1C, "RETRIEVE" },
1237 { 0x1D, "RETRIEVE ACKNOWLEDGE" },
1238 { 0x1E, "RETRIEVE REJECT" },
1239 /*{ 0 x 1 0, "- - - Call clearing messages:" },*/
1240 { 0x25, "DISCONNECT" },
1241 { 0x2D, "RELEASE" },
1242 { 0x2A, "RELEASE COMPLETE" },
1243 /*{ 0 x 1 1, "- - - Miscellaneous messages:" },*/
1244 { 0x39, "CONGESTION CONTROL" },
1247 { 0x34, "STATUS ENQUIRY" },
1248 { 0x35, "START DTMF" },
1249 { 0x31, "STOP DTMF" },
1250 { 0x32, "STOP DTMF ACKNOWLEDGE" },
1251 { 0x36, "START DTMF ACKNOWLEDGE" },
1252 { 0x37, "START DTMF REJECT" },
1253 { 0x3A, "FACILITY" },
1257 static const value_string mm_gprs_mess[] = {
1258 { 0x01, "Attach request" },
1259 { 0x02, "Attach accept" },
1260 { 0x03, "Attach complete" },
1261 { 0x04, "Attach reject" },
1262 { 0x05, "Detach request" },
1263 { 0x06, "Detach accept" },
1264 { 0x08, "Routing area update request" },
1265 { 0x09, "Routing area update accept" },
1266 { 0x0A, "Routing area update complete" },
1267 { 0x0B, "Routing area update reject" },
1268 { 0x10, "P-TMSI reallocation command" },
1269 { 0x11, "P-TMSI reallocation complete" },
1270 { 0x12, "Authentication and ciphering req" },
1271 { 0x13, "Authentication and ciphering resp" },
1272 { 0x14, "Authentication and ciphering rej" },
1273 { 0x15, "Identity request" },
1274 { 0x16, "Identity response" },
1275 { 0x20, "GMM status" },
1276 { 0x21, "GMM information" },
1280 static const value_string tft_code_type[] = {
1282 { 1, "Create new TFT" },
1283 { 2, "Delete existing TFT" },
1284 { 3, "Add packet filters to existing TFT" },
1285 { 4, "Replace packet filters in existing TFT" },
1286 { 5, "Delete packet filters from existing TFT" },
1292 static const value_string cdr_close_type[] = {
1293 { 0, "PDP release" },
1294 { 1, "Volume limit" },
1295 { 2, "Time limit" },
1296 { 3, "SGSN change" },
1297 { 4, "Max changes" },
1298 { 6, "Management" },
1303 static dissector_handle_t ip_handle;
1304 static dissector_handle_t ppp_handle;
1306 static int decode_gtp_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1307 static int decode_gtp_imsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1308 static int decode_gtp_rai (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1309 static int decode_gtp_tlli (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1310 static int decode_gtp_ptmsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1311 static int decode_gtp_qos_gprs (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1312 static int decode_gtp_reorder (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1313 static int decode_gtp_auth_tri (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1314 static int decode_gtp_map_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1315 static int decode_gtp_ptmsi_sig (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1316 static int decode_gtp_ms_valid (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1317 static int decode_gtp_recovery (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1318 static int decode_gtp_sel_mode (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1319 static int decode_gtp_16 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1320 static int decode_gtp_17 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1321 static int decode_gtp_18 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1322 static int decode_gtp_19 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1323 static int decode_gtp_nsapi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1324 static int decode_gtp_ranap_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1325 static int decode_gtp_rab_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1326 static int decode_gtp_rp_sms (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1327 static int decode_gtp_rp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1328 static int decode_gtp_pkt_flow_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1329 static int decode_gtp_chrg_char (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1330 static int decode_gtp_trace_ref (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1331 static int decode_gtp_trace_type (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1332 static int decode_gtp_ms_reason (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1333 static int decode_gtp_tr_comm (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1334 static int decode_gtp_chrg_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1335 static int decode_gtp_user_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1336 static int decode_gtp_mm_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1337 static int decode_gtp_pdp_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1338 static int decode_gtp_apn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1339 static int decode_gtp_gsn_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1340 static int decode_gtp_proto_conf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1341 static int decode_gtp_msisdn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1342 static int decode_gtp_qos_umts (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1343 static int decode_gtp_auth_qui (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1344 static int decode_gtp_tft (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1345 static int decode_gtp_target_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1346 static int decode_gtp_utran_cont (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1347 static int decode_gtp_rab_setup (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1348 static int decode_gtp_hdr_list (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1349 static int decode_gtp_trigger_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1350 static int decode_gtp_omc_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1351 static int decode_gtp_chrg_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1352 static int decode_gtp_rel_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1353 static int decode_gtp_can_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1354 static int decode_gtp_data_req (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1355 static int decode_gtp_data_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1356 static int decode_gtp_node_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1357 static int decode_gtp_priv_ext (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1358 static int decode_gtp_unknown (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1360 typedef struct _gtp_opt {
1363 int (*decode)(tvbuff_t *, int, packet_info *, proto_tree *);
1366 static const gtp_opt_t gtpopt[] = {
1367 { GTP_EXT_CAUSE, decode_gtp_cause },
1368 { GTP_EXT_IMSI, decode_gtp_imsi },
1369 { GTP_EXT_RAI, decode_gtp_rai },
1370 { GTP_EXT_TLLI, decode_gtp_tlli },
1371 { GTP_EXT_PTMSI, decode_gtp_ptmsi },
1372 { GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs },
1373 { GTP_EXT_REORDER, decode_gtp_reorder },
1374 { GTP_EXT_AUTH_TRI, decode_gtp_auth_tri },
1375 { GTP_EXT_MAP_CAUSE, decode_gtp_map_cause },
1376 { GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig },
1377 { GTP_EXT_MS_VALID, decode_gtp_ms_valid },
1378 { GTP_EXT_RECOVER, decode_gtp_recovery },
1379 { GTP_EXT_SEL_MODE, decode_gtp_sel_mode },
1380 { GTP_EXT_16, decode_gtp_16 },
1381 { GTP_EXT_17, decode_gtp_17 },
1382 { GTP_EXT_18, decode_gtp_18 },
1383 { GTP_EXT_19, decode_gtp_19 },
1384 { GTP_EXT_NSAPI, decode_gtp_nsapi },
1385 { GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause },
1386 { GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt },
1387 { GTP_EXT_RP_SMS, decode_gtp_rp_sms },
1388 { GTP_EXT_RP, decode_gtp_rp },
1389 { GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id },
1390 { GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char },
1391 { GTP_EXT_TRACE_REF, decode_gtp_trace_ref },
1392 { GTP_EXT_TRACE_TYPE, decode_gtp_trace_type },
1393 { GTPv1_EXT_MS_REASON, decode_gtp_ms_reason },
1394 { GTP_EXT_TR_COMM, decode_gtp_tr_comm },
1395 { GTP_EXT_CHRG_ID, decode_gtp_chrg_id },
1396 { GTP_EXT_USER_ADDR, decode_gtp_user_addr },
1397 { GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt },
1398 { GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt },
1399 { GTP_EXT_APN, decode_gtp_apn },
1400 { GTP_EXT_PROTO_CONF, decode_gtp_proto_conf },
1401 { GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr },
1402 { GTP_EXT_MSISDN, decode_gtp_msisdn },
1403 { GTP_EXT_QOS_UMTS, decode_gtp_qos_umts }, /* 3G */
1404 { GTP_EXT_AUTH_QUI, decode_gtp_auth_qui }, /* 3G */
1405 { GTP_EXT_TFT, decode_gtp_tft }, /* 3G */
1406 { GTP_EXT_TARGET_ID, decode_gtp_target_id }, /* 3G */
1407 { GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont }, /* 3G */
1408 { GTP_EXT_RAB_SETUP, decode_gtp_rab_setup }, /* 3G */
1409 { GTP_EXT_HDR_LIST, decode_gtp_hdr_list }, /* 3G */
1410 { GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id }, /* 3G */
1411 { GTP_EXT_OMC_ID, decode_gtp_omc_id }, /* 3G */
1412 { GTP_EXT_REL_PACK, decode_gtp_rel_pack }, /* charging */
1413 { GTP_EXT_CAN_PACK, decode_gtp_can_pack }, /* charging */
1414 { GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr },
1415 { GTP_EXT_DATA_REQ, decode_gtp_data_req }, /* charging */
1416 { GTP_EXT_DATA_RESP, decode_gtp_data_resp }, /* charging */
1417 { GTP_EXT_NODE_ADDR, decode_gtp_node_addr },
1418 { GTP_EXT_PRIV_EXT, decode_gtp_priv_ext },
1419 { 0, decode_gtp_unknown }
1440 struct gcdr_ { /* GCDR 118B */
1460 typedef struct change_ {
1470 struct _scdr { /* SCDR 277B */
1480 guint8 msclass_notused[12];
1481 guint8 msclass_caplen;
1483 guint16 msclass_capomit;
1508 typedef struct mmchange_ {
1515 struct _mcdr { /* MCDR 147B */
1523 guint8 msclass_notused[12];
1524 guint8 msclass_caplen;
1526 guint16 msclass_capomit;
1530 guint8 change_count;
1531 mmchange_t change[5];
1534 /* guint8 opening[8]; */
1546 struct _socdr { /* SOCDR 80B */
1553 guint8 msclass_notused[12];
1554 guint8 msclass_caplen;
1556 guint16 msclass_capomit;
1557 guint8 serv_centr[9];
1569 struct _stcdr { /* STCDR 79B */
1576 guint8 msclass_notused[12];
1577 guint8 msclass_caplen;
1579 guint16 msclass_capomit;
1580 guint8 serv_centr[9];
1590 guint8 gtp_version = 0;
1591 char *yesno[] = { "False", "True" };
1594 col_append_str_gtp(frame_data *fd, gint el, gchar *proto_name) {
1598 gchar _tmp[COL_MAX_LEN];
1600 max_len = COL_MAX_LEN;
1602 for (i = 0; i < fd->cinfo->num_cols; i++) {
1603 if (fd->cinfo->fmt_matx[i][el]) {
1604 if (fd->cinfo->col_data[i] != fd->cinfo->col_buf[i]) {
1606 strncpy(fd->cinfo->col_buf[i], fd->cinfo->col_data[i], max_len);
1607 fd->cinfo->col_buf[i][max_len - 1] = '\0';
1611 strcat(_tmp, proto_name);
1613 strcat(_tmp, fd->cinfo->col_buf[i]);
1615 fd->cinfo->col_buf[i][0] = '\0';
1616 strcat(fd->cinfo->col_buf[i], _tmp);
1617 fd->cinfo->col_data[i] = fd->cinfo->col_buf[i];
1623 id_to_str(const guint8 *ad) {
1625 static gchar *str[17];
1627 guint8 bits8to5, bits4to1, i;
1628 static const gchar hex_digits[10] = "0123456789";
1630 p = (gchar *)&str[17];
1634 bits8to5 = (ad[i] >> 4) & 0x0F;
1635 bits4to1 = ad[i] & 0x0F;
1636 if (bits8to5 < 0xA) *--p = hex_digits[bits8to5];
1637 if (bits4to1 < 0xA) *--p = hex_digits[bits4to1];
1645 msisdn_to_str(const guint8 *ad, int len) {
1647 static gchar *str[17];
1649 guint8 bits8to5, bits4to1, i;
1650 static const gchar hex_digits[16] = "0123456789 ";
1652 p = (gchar *)&str[0];
1656 bits8to5 = (ad[i] >> 4) & 0x0F;
1657 bits4to1 = ad[i] & 0x0F;
1658 if (bits4to1 < 0xA) *++p = hex_digits[bits4to1];
1659 if (bits8to5 < 0xA) *++p = hex_digits[bits8to5];
1660 if (i == len-1) break;
1664 return (gchar *)&str[0];
1668 time_int_to_str (guint32 time)
1670 guint hours, mins, secs, month, days;
1671 guint mths_n[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
1672 guint mths_s[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
1673 static gchar *cur, *p, str[3][2+1+2+1+2+1+4+1+2+1+2+2];
1675 if (cur == &str[0][0]) {
1677 } else if (cur == &str[1][0]) {
1684 sprintf (cur, "00:00:00 1970-01-01");
1696 days += time - (time + 2) / 4;
1698 if ((time + 2) % 4) {
1699 for (month=0; month<12; month++) if (days > mths_n[month]) days -= mths_n[month];
1702 for (month=0; month<12; month++)
1703 if (days > mths_s[month]) days -= mths_s[month];
1711 sprintf (p, "%02d:%02d:%02d %u-%02d-%02d", hours, mins, secs, time, month, days);
1716 /* Next definitions and function check_field_presence checks if given field
1717 * in GTP packet is compliant with ETSI
1719 typedef struct _header {
1724 typedef struct _message {
1726 ext_header fields[32];
1729 /* ---------------------
1731 * ---------------------*/
1732 _gtp_mess_items gprs_mess_items[] = {
1736 { GTP_EXT_PRIV_EXT, OPTIONAL },
1741 GTP_MSG_ECHO_RESP, {
1742 { GTP_EXT_RECOVER, MANDATORY },
1743 { GTP_EXT_PRIV_EXT, OPTIONAL },
1748 GTP_MSG_VER_NOT_SUPP, {
1753 GTP_MSG_NODE_ALIVE_REQ, {
1754 { GTP_EXT_NODE_ADDR, MANDATORY },
1755 { GTP_EXT_PRIV_EXT, OPTIONAL },
1760 GTP_MSG_NODE_ALIVE_RESP, {
1761 { GTP_EXT_PRIV_EXT, OPTIONAL },
1766 GTP_MSG_REDIR_REQ, {
1767 { GTP_EXT_CAUSE, MANDATORY },
1768 { GTP_EXT_NODE_ADDR, OPTIONAL },
1769 { GTP_EXT_PRIV_EXT, OPTIONAL },
1774 GTP_MSG_REDIR_RESP, {
1775 { GTP_EXT_CAUSE, MANDATORY },
1776 { GTP_EXT_PRIV_EXT, OPTIONAL },
1781 GTP_MSG_CREATE_PDP_REQ, {
1782 { GTP_EXT_QOS_GPRS, MANDATORY },
1783 { GTP_EXT_RECOVER, OPTIONAL },
1784 { GTP_EXT_SEL_MODE, MANDATORY },
1785 { GTP_EXT_FLOW_LABEL, MANDATORY },
1786 { GTP_EXT_FLOW_SIG, MANDATORY },
1787 { GTP_EXT_MSISDN, MANDATORY },
1788 { GTP_EXT_USER_ADDR, MANDATORY },
1789 { GTP_EXT_APN, MANDATORY },
1790 { GTP_EXT_PROTO_CONF, OPTIONAL },
1791 { GTP_EXT_GSN_ADDR, MANDATORY },
1792 { GTP_EXT_GSN_ADDR, MANDATORY },
1793 { GTP_EXT_PRIV_EXT, OPTIONAL },
1798 GTP_MSG_CREATE_PDP_RESP, {
1799 { GTP_EXT_CAUSE, MANDATORY },
1800 { GTP_EXT_QOS_GPRS, CONDITIONAL },
1801 { GTP_EXT_REORDER, CONDITIONAL },
1802 { GTP_EXT_RECOVER, OPTIONAL },
1803 { GTP_EXT_FLOW_LABEL, CONDITIONAL },
1804 { GTP_EXT_FLOW_SIG, CONDITIONAL },
1805 { GTP_EXT_CHRG_ID, CONDITIONAL },
1806 { GTP_EXT_USER_ADDR, CONDITIONAL },
1807 { GTP_EXT_PROTO_CONF, OPTIONAL },
1808 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1809 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1810 { GTP_EXT_CHRG_ADDR, OPTIONAL },
1811 { GTP_EXT_PRIV_EXT, OPTIONAL },
1816 GTP_MSG_UPDATE_PDP_REQ, {
1817 { GTP_EXT_QOS_GPRS, MANDATORY },
1818 { GTP_EXT_RECOVER, OPTIONAL },
1819 { GTP_EXT_FLOW_LABEL, MANDATORY },
1820 { GTP_EXT_FLOW_SIG, MANDATORY },
1821 { GTP_EXT_GSN_ADDR, MANDATORY },
1822 { GTP_EXT_GSN_ADDR, MANDATORY },
1823 { GTP_EXT_PRIV_EXT, OPTIONAL },
1828 GTP_MSG_UPDATE_PDP_RESP, {
1829 { GTP_EXT_CAUSE, MANDATORY },
1830 { GTP_EXT_QOS_GPRS, CONDITIONAL },
1831 { GTP_EXT_RECOVER, OPTIONAL },
1832 { GTP_EXT_FLOW_LABEL, CONDITIONAL },
1833 { GTP_EXT_FLOW_SIG, CONDITIONAL },
1834 { GTP_EXT_CHRG_ID, CONDITIONAL },
1835 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1836 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1837 { GTP_EXT_CHRG_ADDR, OPTIONAL },
1838 { GTP_EXT_PRIV_EXT, OPTIONAL },
1843 GTP_MSG_DELETE_PDP_REQ, {
1844 { GTP_EXT_PRIV_EXT, OPTIONAL },
1849 GTP_MSG_DELETE_PDP_RESP, {
1850 { GTP_EXT_CAUSE, MANDATORY },
1851 { GTP_EXT_PRIV_EXT, OPTIONAL },
1856 GTP_MSG_CREATE_AA_PDP_REQ, {
1857 { GTP_EXT_QOS_GPRS, MANDATORY },
1858 { GTP_EXT_RECOVER, OPTIONAL },
1859 { GTP_EXT_SEL_MODE, MANDATORY },
1860 { GTP_EXT_FLOW_LABEL, MANDATORY },
1861 { GTP_EXT_FLOW_SIG, MANDATORY },
1862 { GTP_EXT_USER_ADDR, MANDATORY },
1863 { GTP_EXT_APN, MANDATORY },
1864 { GTP_EXT_PROTO_CONF, OPTIONAL },
1865 { GTP_EXT_GSN_ADDR, MANDATORY },
1866 { GTP_EXT_GSN_ADDR, MANDATORY },
1867 { GTP_EXT_PRIV_EXT, OPTIONAL },
1872 GTP_MSG_CREATE_AA_PDP_RESP, {
1873 { GTP_EXT_CAUSE, MANDATORY },
1874 { GTP_EXT_QOS_GPRS, CONDITIONAL },
1875 { GTP_EXT_REORDER, CONDITIONAL },
1876 { GTP_EXT_RECOVER, OPTIONAL },
1877 { GTP_EXT_FLOW_LABEL, CONDITIONAL },
1878 { GTP_EXT_FLOW_SIG, CONDITIONAL },
1879 { GTP_EXT_CHRG_ID, CONDITIONAL },
1880 { GTP_EXT_USER_ADDR, CONDITIONAL },
1881 { GTP_EXT_PROTO_CONF, OPTIONAL },
1882 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1883 { GTP_EXT_GSN_ADDR, CONDITIONAL },
1884 { GTP_EXT_CHRG_ADDR, OPTIONAL },
1885 { GTP_EXT_PRIV_EXT, OPTIONAL },
1890 GTP_MSG_DELETE_AA_PDP_REQ, {
1891 { GTP_EXT_CAUSE, MANDATORY },
1892 { GTP_EXT_PRIV_EXT, OPTIONAL },
1897 GTP_MSG_DELETE_AA_PDP_RESP, {
1898 { GTP_EXT_CAUSE, MANDATORY },
1899 { GTP_EXT_PRIV_EXT, OPTIONAL },
1905 { GTP_EXT_PRIV_EXT, OPTIONAL },
1910 GTP_MSG_PDU_NOTIFY_REQ, {
1911 { GTP_EXT_USER_ADDR, MANDATORY },
1912 { GTP_EXT_PRIV_EXT, OPTIONAL },
1917 GTP_MSG_PDU_NOTIFY_RESP, {
1918 { GTP_EXT_CAUSE, MANDATORY },
1919 { GTP_EXT_PRIV_EXT, OPTIONAL },
1924 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1925 { GTP_EXT_CAUSE, MANDATORY },
1926 { GTP_EXT_USER_ADDR, MANDATORY },
1927 { GTP_EXT_PRIV_EXT, OPTIONAL },
1932 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1933 { GTP_EXT_CAUSE, MANDATORY },
1934 { GTP_EXT_PRIV_EXT, OPTIONAL },
1939 GTP_MSG_SEND_ROUT_INFO_REQ, {
1940 { GTP_EXT_IMSI, MANDATORY },
1941 { GTP_EXT_PRIV_EXT, OPTIONAL },
1946 GTP_MSG_SEND_ROUT_INFO_RESP, {
1947 { GTP_EXT_CAUSE, MANDATORY },
1948 { GTP_EXT_IMSI, MANDATORY },
1949 { GTP_EXT_MAP_CAUSE, OPTIONAL },
1950 { GTP_EXT_MS_REASON, OPTIONAL },
1951 { GTP_EXT_GSN_ADDR, OPTIONAL },
1952 { GTP_EXT_PRIV_EXT, OPTIONAL },
1957 GTP_MSG_FAIL_REP_REQ, {
1958 { GTP_EXT_IMSI, MANDATORY },
1959 { GTP_EXT_PRIV_EXT, OPTIONAL },
1964 GTP_MSG_FAIL_REP_RESP, {
1965 { GTP_EXT_CAUSE, MANDATORY },
1966 { GTP_EXT_MAP_CAUSE, OPTIONAL },
1967 { GTP_EXT_PRIV_EXT, OPTIONAL },
1972 GTP_MSG_MS_PRESENT_REQ, {
1973 { GTP_EXT_IMSI, MANDATORY },
1974 { GTP_EXT_GSN_ADDR, MANDATORY },
1975 { GTP_EXT_PRIV_EXT, OPTIONAL },
1980 GTP_MSG_MS_PRESENT_RESP, {
1981 { GTP_EXT_CAUSE, MANDATORY },
1982 { GTP_EXT_PRIV_EXT, OPTIONAL },
1987 GTP_MSG_IDENT_REQ, {
1988 { GTP_EXT_RAI, MANDATORY },
1989 { GTP_EXT_PTMSI, MANDATORY },
1990 { GTP_EXT_PTMSI_SIG, OPTIONAL },
1991 { GTP_EXT_PRIV_EXT, OPTIONAL },
1996 GTP_MSG_IDENT_RESP, {
1997 { GTP_EXT_CAUSE, MANDATORY },
1998 { GTP_EXT_IMSI, CONDITIONAL },
1999 { GTP_EXT_AUTH_TRI, OPTIONAL },
2000 { GTP_EXT_PRIV_EXT, OPTIONAL },
2005 GTP_MSG_SGSN_CNTXT_REQ, {
2006 { GTP_EXT_IMSI, CONDITIONAL },
2007 { GTP_EXT_RAI, MANDATORY },
2008 { GTP_EXT_TLLI, MANDATORY },
2009 { GTP_EXT_PTMSI_SIG, OPTIONAL },
2010 { GTP_EXT_MS_VALID, OPTIONAL },
2011 { GTP_EXT_FLOW_SIG, MANDATORY },
2016 GTP_MSG_SGSN_CNTXT_RESP, {
2017 { GTP_EXT_CAUSE, MANDATORY },
2018 { GTP_EXT_IMSI, CONDITIONAL },
2019 { GTP_EXT_FLOW_SIG, CONDITIONAL },
2020 { GTP_EXT_MM_CNTXT, CONDITIONAL },
2021 { GTP_EXT_PDP_CNTXT, CONDITIONAL },
2022 { GTP_EXT_PRIV_EXT, OPTIONAL },
2027 GTP_MSG_SGSN_CNTXT_ACK, {
2028 { GTP_EXT_CAUSE, MANDATORY },
2029 { GTP_EXT_FLOW_II, CONDITIONAL },
2030 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2031 { GTP_EXT_PRIV_EXT, OPTIONAL },
2036 GTP_MSG_DATA_TRANSF_REQ, {
2037 { GTP_EXT_TR_COMM, MANDATORY },
2038 { GTP_EXT_DATA_REQ, CONDITIONAL },
2039 { GTP_EXT_REL_PACK, CONDITIONAL },
2040 { GTP_EXT_CAN_PACK, CONDITIONAL },
2041 { GTP_EXT_PRIV_EXT, OPTIONAL },
2046 GTP_MSG_DATA_TRANSF_RESP, {
2047 { GTP_EXT_CAUSE, MANDATORY },
2048 { GTP_EXT_DATA_RESP, MANDATORY },
2049 { GTP_EXT_PRIV_EXT, OPTIONAL },
2060 /* -----------------------------
2062 * -----------------------------*/
2063 _gtp_mess_items umts_mess_items[] = {
2067 { GTP_EXT_PRIV_EXT, OPTIONAL },
2072 GTP_MSG_ECHO_RESP, {
2073 { GTP_EXT_RECOVER, MANDATORY },
2074 { GTP_EXT_PRIV_EXT, OPTIONAL },
2079 GTP_MSG_VER_NOT_SUPP, {
2084 GTP_MSG_NODE_ALIVE_REQ, {
2085 { GTP_EXT_NODE_ADDR, MANDATORY },
2086 { GTP_EXT_PRIV_EXT, OPTIONAL },
2091 GTP_MSG_NODE_ALIVE_RESP, {
2092 { GTP_EXT_PRIV_EXT, OPTIONAL },
2097 GTP_MSG_REDIR_REQ, {
2098 { GTP_EXT_CAUSE, MANDATORY },
2099 { GTP_EXT_NODE_ADDR, OPTIONAL },
2100 { GTP_EXT_PRIV_EXT, OPTIONAL },
2105 GTP_MSG_REDIR_REQ, {
2110 GTP_MSG_CREATE_PDP_REQ, {
2111 { GTP_EXT_IMSI, CONDITIONAL },
2112 { GTP_EXT_RECOVER, OPTIONAL },
2113 { GTP_EXT_SEL_MODE, CONDITIONAL },
2114 { GTP_EXT_TEID, MANDATORY },
2115 { GTP_EXT_TEID_CP, CONDITIONAL },
2116 { GTP_EXT_NSAPI, MANDATORY },
2117 { GTP_EXT_NSAPI, CONDITIONAL },
2118 { GTP_EXT_CHRG_CHAR, OPTIONAL },
2119 { GTP_EXT_TRACE_REF, OPTIONAL },
2120 { GTP_EXT_TRACE_TYPE, OPTIONAL },
2121 { GTP_EXT_USER_ADDR, CONDITIONAL },
2122 { GTP_EXT_APN, CONDITIONAL },
2123 { GTP_EXT_PROTO_CONF, CONDITIONAL },
2124 { GTP_EXT_GSN_ADDR, MANDATORY },
2125 { GTP_EXT_GSN_ADDR, MANDATORY },
2126 { GTP_EXT_MSISDN, CONDITIONAL },
2127 { GTP_EXT_QOS_UMTS, MANDATORY },
2128 { GTP_EXT_TFT, CONDITIONAL },
2129 { GTP_EXT_TRIGGER_ID, OPTIONAL },
2130 { GTP_EXT_OMC_ID, OPTIONAL },
2131 { GTP_EXT_PRIV_EXT, OPTIONAL },
2136 GTP_MSG_CREATE_PDP_RESP, {
2137 { GTP_EXT_CAUSE, MANDATORY },
2138 { GTP_EXT_REORDER, CONDITIONAL },
2139 { GTP_EXT_RECOVER, OPTIONAL },
2140 { GTP_EXT_TEID, CONDITIONAL },
2141 { GTP_EXT_TEID_CP, CONDITIONAL },
2142 { GTP_EXT_CHRG_ID, CONDITIONAL },
2143 { GTP_EXT_USER_ADDR, CONDITIONAL },
2144 { GTP_EXT_PROTO_CONF, OPTIONAL },
2145 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2146 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2147 { GTP_EXT_QOS_UMTS, CONDITIONAL },
2148 { GTP_EXT_CHRG_ADDR, OPTIONAL },
2149 { GTP_EXT_PRIV_EXT, OPTIONAL },
2153 { /* checked, SGSN -> GGSN */
2154 GTP_MSG_UPDATE_PDP_REQ, {
2155 { GTP_EXT_IMSI, CONDITIONAL },
2156 { GTP_EXT_RECOVER, OPTIONAL },
2157 { GTP_EXT_TEID, MANDATORY },
2158 { GTP_EXT_TEID_CP, CONDITIONAL },
2159 { GTP_EXT_NSAPI, MANDATORY },
2160 { GTP_EXT_TRACE_REF, OPTIONAL },
2161 { GTP_EXT_TRACE_TYPE, OPTIONAL },
2162 { GTP_EXT_GSN_ADDR, MANDATORY },
2163 { GTP_EXT_GSN_ADDR, MANDATORY },
2164 { GTP_EXT_QOS_UMTS, MANDATORY },
2165 { GTP_EXT_TFT, OPTIONAL },
2166 { GTP_EXT_TRIGGER_ID, OPTIONAL },
2167 { GTP_EXT_OMC_ID, OPTIONAL },
2168 { GTP_EXT_PRIV_EXT, OPTIONAL },
2172 { /* checked, GGSN -> SGSN */
2173 GTP_MSG_UPDATE_PDP_RESP, {
2174 { GTP_EXT_CAUSE, MANDATORY },
2175 { GTP_EXT_RECOVER, OPTIONAL },
2176 { GTP_EXT_TEID, CONDITIONAL },
2177 { GTP_EXT_TEID_CP, CONDITIONAL },
2178 { GTP_EXT_CHRG_ID, CONDITIONAL },
2179 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2180 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2181 { GTP_EXT_QOS_UMTS, CONDITIONAL },
2182 { GTP_EXT_CHRG_ADDR, OPTIONAL },
2183 { GTP_EXT_PRIV_EXT, OPTIONAL },
2188 GTP_MSG_DELETE_PDP_REQ, {
2189 { GTP_EXT_TEAR_IND, CONDITIONAL },
2190 { GTP_EXT_NSAPI, MANDATORY },
2191 { GTP_EXT_PRIV_EXT, OPTIONAL },
2196 GTP_MSG_DELETE_PDP_RESP, {
2197 { GTP_EXT_CAUSE, MANDATORY },
2198 { GTP_EXT_PRIV_EXT, OPTIONAL },
2204 { GTP_EXT_TEID, MANDATORY },
2205 { GTP_EXT_PRIV_EXT, OPTIONAL },
2210 GTP_MSG_PDU_NOTIFY_REQ, {
2211 { GTP_EXT_IMSI, MANDATORY },
2212 { GTP_EXT_TEID_CP, MANDATORY },
2213 { GTP_EXT_USER_ADDR, MANDATORY },
2214 { GTP_EXT_APN, MANDATORY },
2215 { GTP_EXT_GSN_ADDR, MANDATORY },
2216 { GTP_EXT_PRIV_EXT, OPTIONAL },
2221 GTP_MSG_PDU_NOTIFY_RESP, {
2222 { GTP_EXT_CAUSE, MANDATORY },
2223 { GTP_EXT_PRIV_EXT, OPTIONAL },
2228 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2229 { GTP_EXT_CAUSE, MANDATORY },
2230 { GTP_EXT_TEID_CP, MANDATORY },
2231 { GTP_EXT_USER_ADDR, MANDATORY },
2232 { GTP_EXT_APN, MANDATORY },
2233 { GTP_EXT_PRIV_EXT, OPTIONAL },
2238 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2239 { GTP_EXT_CAUSE, MANDATORY },
2240 { GTP_EXT_PRIV_EXT, OPTIONAL },
2245 GTP_MSG_SUPP_EXT_HDR, {
2246 { GTP_EXT_HDR_LIST, MANDATORY },
2251 GTP_MSG_SEND_ROUT_INFO_REQ, {
2252 { GTP_EXT_IMSI, MANDATORY },
2253 { GTP_EXT_PRIV_EXT, OPTIONAL },
2258 GTP_MSG_SEND_ROUT_INFO_RESP, {
2259 { GTP_EXT_CAUSE, MANDATORY },
2260 { GTP_EXT_IMSI, MANDATORY },
2261 { GTP_EXT_MAP_CAUSE, OPTIONAL },
2262 { GTPv1_EXT_MS_REASON, OPTIONAL },
2263 { GTP_EXT_GSN_ADDR, OPTIONAL },
2264 { GTP_EXT_PRIV_EXT, OPTIONAL },
2269 GTP_MSG_FAIL_REP_REQ, {
2270 { GTP_EXT_IMSI, MANDATORY },
2271 { GTP_EXT_PRIV_EXT, OPTIONAL },
2276 GTP_MSG_FAIL_REP_RESP, {
2277 { GTP_EXT_CAUSE, MANDATORY },
2278 { GTP_EXT_MAP_CAUSE, OPTIONAL },
2279 { GTP_EXT_PRIV_EXT, OPTIONAL },
2284 GTP_MSG_MS_PRESENT_REQ, {
2285 { GTP_EXT_IMSI, MANDATORY },
2286 { GTP_EXT_GSN_ADDR, MANDATORY },
2287 { GTP_EXT_PRIV_EXT, OPTIONAL },
2292 GTP_MSG_MS_PRESENT_RESP, {
2293 { GTP_EXT_CAUSE, MANDATORY },
2294 { GTP_EXT_PRIV_EXT, OPTIONAL },
2299 GTP_MSG_IDENT_REQ, {
2300 { GTP_EXT_RAI, MANDATORY },
2301 { GTP_EXT_PTMSI, MANDATORY },
2302 { GTP_EXT_PTMSI_SIG, CONDITIONAL },
2303 { GTP_EXT_PRIV_EXT, OPTIONAL },
2308 GTP_MSG_IDENT_RESP, {
2309 { GTP_EXT_CAUSE, MANDATORY },
2310 { GTP_EXT_IMSI, CONDITIONAL },
2311 { GTP_EXT_AUTH_TRI, CONDITIONAL },
2312 { GTP_EXT_AUTH_QUI, CONDITIONAL },
2313 { GTP_EXT_PRIV_EXT, OPTIONAL },
2318 GTP_MSG_SGSN_CNTXT_REQ, {
2319 { GTP_EXT_IMSI, CONDITIONAL },
2320 { GTP_EXT_RAI, MANDATORY },
2321 { GTP_EXT_TLLI, CONDITIONAL },
2322 { GTP_EXT_PTMSI, CONDITIONAL },
2323 { GTP_EXT_PTMSI_SIG, CONDITIONAL },
2324 { GTP_EXT_MS_VALID, OPTIONAL },
2325 { GTP_EXT_TEID_CP, MANDATORY },
2326 { GTP_EXT_GSN_ADDR, MANDATORY },
2327 { GTP_EXT_PRIV_EXT, OPTIONAL },
2332 GTP_MSG_SGSN_CNTXT_RESP, {
2333 { GTP_EXT_CAUSE, MANDATORY },
2334 { GTP_EXT_IMSI, CONDITIONAL },
2335 { GTP_EXT_TEID_CP, CONDITIONAL },
2336 { GTP_EXT_RP_SMS, OPTIONAL },
2337 { GTP_EXT_RP, OPTIONAL },
2338 { GTP_EXT_PKT_FLOW_ID, OPTIONAL },
2339 { GTP_EXT_MM_CNTXT, CONDITIONAL },
2340 { GTP_EXT_PDP_CNTXT, CONDITIONAL },
2341 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2342 { GTP_EXT_PRIV_EXT, OPTIONAL },
2347 GTP_MSG_SGSN_CNTXT_ACK, {
2348 { GTP_EXT_CAUSE, MANDATORY },
2349 { GTP_EXT_TEID_II, CONDITIONAL },
2350 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2351 { GTP_EXT_PRIV_EXT, OPTIONAL },
2356 GTP_MSG_FORW_RELOC_REQ, {
2357 { GTP_EXT_IMSI, MANDATORY },
2358 { GTP_EXT_TEID_CP, MANDATORY },
2359 { GTP_EXT_RANAP_CAUSE, MANDATORY },
2360 { GTP_EXT_MM_CNTXT, MANDATORY },
2361 { GTP_EXT_PDP_CNTXT, CONDITIONAL },
2362 { GTP_EXT_GSN_ADDR, MANDATORY },
2363 { GTP_EXT_TARGET_ID, MANDATORY },
2364 { GTP_EXT_UTRAN_CONT, MANDATORY },
2365 { GTP_EXT_PRIV_EXT, OPTIONAL },
2370 GTP_MSG_FORW_RELOC_RESP, {
2371 { GTP_EXT_CAUSE, MANDATORY },
2372 { GTP_EXT_TEID_CP, CONDITIONAL },
2373 { GTP_EXT_RANAP_CAUSE, CONDITIONAL },
2374 { GTP_EXT_GSN_ADDR, CONDITIONAL },
2375 { GTP_EXT_UTRAN_CONT, OPTIONAL },
2376 { GTP_EXT_RAB_SETUP, CONDITIONAL },
2377 { GTP_EXT_PRIV_EXT, OPTIONAL },
2382 GTP_MSG_FORW_RELOC_COMP, {
2383 { GTP_EXT_PRIV_EXT, OPTIONAL },
2388 GTP_MSG_RELOC_CANCEL_REQ, {
2389 { GTP_EXT_IMSI, MANDATORY },
2390 { GTP_EXT_PRIV_EXT, OPTIONAL },
2395 GTP_MSG_RELOC_CANCEL_RESP, {
2396 { GTP_EXT_CAUSE, MANDATORY },
2397 { GTP_EXT_PRIV_EXT, OPTIONAL },
2402 GTP_MSG_FORW_RELOC_ACK, {
2403 { GTP_EXT_CAUSE, MANDATORY },
2404 { GTP_EXT_PRIV_EXT, OPTIONAL },
2409 GTP_MSG_FORW_SRNS_CNTXT, {
2410 { GTP_EXT_RAB_CNTXT, MANDATORY },
2411 { GTP_EXT_PRIV_EXT, OPTIONAL },
2416 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2417 { GTP_EXT_CAUSE, MANDATORY },
2418 { GTP_EXT_PRIV_EXT, OPTIONAL },
2430 check_field_presence(guint8 message, guint8 field, int *position) {
2433 _gtp_mess_items *mess_items;
2435 switch(gtp_version) {
2437 mess_items = gprs_mess_items;
2440 mess_items = umts_mess_items;
2446 while (mess_items[i].code) {
2447 if (mess_items[i].code == message) {
2449 while (mess_items[i].fields[*position].code) {
2450 if (mess_items[i].fields[*position].code == field) {
2454 if (mess_items[i].fields[*position].presence == MANDATORY) {
2455 return mess_items[i].fields[(*position)++].code;
2468 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2470 /* GPRS: 9.60 v7.6.0, chapter
2471 * UMTS: 29.060 v4.0, chapter
2474 decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2478 cause = tvb_get_guint8(tvb, offset+1);
2480 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_cause : hf_gtpv0_cause, tvb, offset, 2, cause);
2485 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2486 * UMTS: 29.060 v4.0, chapter 7.7.2
2489 decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2494 tvb_memcpy(tvb, tid_val, offset+1, 8);
2495 tid_val[1] = tid_val[1] & 0x0F;
2496 tid_str = id_to_str(tid_val);
2498 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_imsi : hf_gtpv0_imsi, tvb, offset, 9, tid_str);
2503 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2504 * UMTS: 29.060 v4.0, chapter 7.7.3
2505 * TODO: Add details about MCC, MNC, LAC, RAC (show each digit) ?
2508 decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2510 proto_tree *ext_tree_rai;
2513 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));
2514 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2516 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mcc : hf_gtpv0_rai_mcc, tvb, offset+1, 2, tvb_get_letohs(tvb, offset+1) & 0xFF0F);
2517 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mnc : hf_gtpv0_rai_mnc, tvb, offset+2, 2, tvb_get_ntohs(tvb, offset+3) & 0xF0FF);
2518 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_lac : hf_gtpv0_rai_lac, tvb, offset+4, 2, tvb_get_letohs(tvb, offset+4));
2519 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));
2524 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2525 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2528 decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2532 tlli = tvb_get_ntohl(tvb, offset+1);
2533 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tlli : hf_gtpv0_tlli, tvb, offset, 5, tlli);
2538 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
2539 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
2542 decode_gtp_ptmsi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2546 ptmsi = tvb_get_ntohl(tvb, offset);
2547 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi : hf_gtpv0_ptmsi, tvb, offset, 5, ptmsi);
2552 /* adjust - how many bytes before offset should be highlighted
2555 decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 adjust) {
2557 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
2558 proto_tree *ext_tree_qos;
2561 spare1 = tvb_get_guint8(tvb, offset) & 0xC0;
2562 delay = tvb_get_guint8(tvb, offset) & 0x38;
2563 reliability = tvb_get_guint8(tvb, offset) & 0x07;
2564 peak = tvb_get_guint8(tvb, offset+1) & 0xF0;
2565 spare2 = tvb_get_guint8(tvb, offset+1) & 0x08;
2566 precedence = tvb_get_guint8(tvb, offset+1) & 0x07;
2567 spare3 = tvb_get_guint8(tvb, offset+2) & 0xE0;
2568 mean = tvb_get_guint8(tvb, offset+2) & 0x1F;
2570 te = proto_tree_add_text(tree, tvb, offset-adjust, 3+adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
2571 qos_str, delay, reliability, peak, precedence, mean);
2572 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
2575 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare1, tvb, offset, 1, spare1);
2576 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_delay, tvb, offset, 1, delay);
2577 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_reliability, tvb, offset, 1, reliability);
2578 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_peak, tvb, offset+1, 1, peak);
2579 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare2, tvb, offset+1, 1, spare2);
2580 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_precedence, tvb, offset+1, 1, precedence);
2581 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare3, tvb, offset+2, 1, spare3);
2582 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_mean, tvb, offset+2, 1, mean);
2588 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
2592 * TODO: check if length is included: ETSI 4.08 vs 9.60
2595 decode_gtp_qos_gprs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2597 return (1+decode_qos_gprs(tvb, offset+1, tree, "Quality of Service", 1));
2601 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
2602 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
2605 decode_gtp_reorder(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2609 reorder = tvb_get_guint8(tvb, offset+1) & 0x01;
2610 proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_reorder : hf_gtpv0_reorder, tvb, offset, 2, reorder);
2615 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
2616 * 4.08 v7.1.2, chapter 10.5.3.1+
2617 * UMTS: 29.060 v4.0, chapter 7.7.7
2618 * TODO: Add blurb support by registering items in the protocol registration
2621 decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2623 proto_tree *ext_tree_auth_tri;
2625 guint32 rand[4], sres, kc[2];
2627 tvb_memcpy(tvb, (guint8 *)&rand, offset+1, 16);
2628 sres = tvb_get_ntohl(tvb, offset+17);
2629 tvb_memcpy(tvb, (guint8 *)&kc, offset+21, 16);
2631 te = proto_tree_add_text(tree, tvb, offset, 29, val_to_str(GTP_EXT_AUTH_TRI, gtp_val, "Unknown message"));
2632 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
2634 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]);
2635 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+17, 4, "SRES: %x", sres);
2636 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+21, 8, "Kc: %x%x", kc[0], kc[1]);
2641 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
2642 * 9.02 v7.7.0, page 1090
2643 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
2644 * 29.002 v4.2.1, chapter 17.5, page 268
2647 decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2651 map_cause = tvb_get_guint8(tvb, offset+1);
2652 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_map_cause : hf_gtpv0_map_cause, tvb, offset, 2, map_cause);
2657 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
2658 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
2661 decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2665 ptmsi_sig = tvb_get_ntoh24(tvb, offset+1);
2666 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi_sig : hf_gtpv0_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
2671 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
2672 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
2675 decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2679 ms_valid = tvb_get_guint8(tvb, offset+1) & 0x01;
2680 proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_ms_valid : hf_gtpv0_ms_valid, tvb, offset, 2, ms_valid);
2685 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
2686 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
2689 decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2693 recovery = tvb_get_guint8(tvb, offset+1);
2694 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_recovery : hf_gtpv0_recovery, tvb, offset, 2, recovery);
2699 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
2700 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
2703 decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2707 sel_mode = tvb_get_guint8(tvb, offset+1) & 0x03;
2708 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_sel_mode : hf_gtpv0_sel_mode, tvb, offset, 2, sel_mode);
2713 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
2714 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
2717 decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2719 guint16 ext_flow_label;
2722 switch (gtp_version) {
2724 ext_flow_label = tvb_get_ntohs(tvb, offset+1);
2725 proto_tree_add_uint(tree, hf_gtpv0_ext_flow_label, tvb, offset, 3, ext_flow_label);
2729 teid_data = tvb_get_ntohl(tvb, offset+1);
2730 proto_tree_add_uint(tree, hf_gtpv1_teid_data, tvb, offset, 5, teid_data);
2734 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
2740 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
2741 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
2744 decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2749 switch (gtp_version) {
2751 flow_sig = tvb_get_ntohs(tvb, offset+1);
2752 proto_tree_add_uint(tree, hf_gtpv0_flow_sig, tvb, offset, 3, flow_sig);
2756 teid_cp = tvb_get_ntohl(tvb, offset+1);
2757 proto_tree_add_uint(tree, hf_gtpv1_teid_cp, tvb, offset, 5, teid_cp);
2761 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
2767 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
2768 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
2771 decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2775 proto_tree *ext_tree_flow_ii;
2778 switch (gtp_version) {
2780 te = proto_tree_add_text(tree, tvb, offset, 4, val_to_str(GTP_EXT_FLOW_II, gtp_val, "Unknown message"));
2781 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
2783 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2785 flow_ii = tvb_get_ntohs(tvb, offset+2);
2786 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_flow_ii, tvb, offset+2, 2, flow_ii);
2790 te = proto_tree_add_text(tree, tvb, offset, 6, val_to_str(GTP_EXT_TEID_II, gtp_val, "Unknown message"));
2791 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
2793 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2796 teid_ii = tvb_get_ntohl(tvb, offset+2);
2797 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_teid_ii, tvb, offset+2, 4, teid_ii);
2801 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
2807 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
2808 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
2809 * Check if all ms_reason types are included
2812 decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2816 field19 = tvb_get_guint8(tvb, offset+1);
2818 switch (gtp_version) {
2820 proto_tree_add_uint(tree, hf_gtpv0_ms_reason, tvb, offset, 2, field19);
2824 proto_tree_add_boolean(tree, hf_gtpv1_tear_ind, tvb, offset, 2, field19 & 0x01);
2828 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
2836 /* GPRS: not present
2837 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
2840 decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2844 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2845 proto_tree_add_uint(tree, hf_gtpv1_nsapi, tvb, offset, 2, nsapi);
2850 /* GPRS: not present
2851 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
2854 decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2858 ranap = tvb_get_guint8(tvb, offset+1);
2860 if(ranap > 0 && ranap <=64)
2861 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);
2863 if(ranap > 64 && ranap <=80)
2864 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);
2866 if(ranap > 80 && ranap <=96)
2867 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);
2869 if(ranap > 96 && ranap <=112)
2870 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);
2872 if(ranap > 112 && ranap <=128)
2873 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);
2875 if(ranap > 128 && ranap <=255)
2876 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);
2881 /* GPRS: not present
2882 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
2885 decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2887 guint8 nsapi, dl_pdcp_seq, ul_pdcp_seq;
2888 guint16 dl_gtpu_seq, ul_gtpu_seq;
2889 proto_tree *ext_tree_rab_cntxt;
2892 te = proto_tree_add_text(tree, tvb, offset, 8, val_to_str(GTP_EXT_RAB_CNTXT, gtp_val, "Unknown message"));
2893 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
2895 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2896 dl_gtpu_seq = tvb_get_ntohs(tvb, offset+2);
2897 ul_gtpu_seq = tvb_get_ntohs(tvb, offset+4);
2898 dl_pdcp_seq = tvb_get_guint8(tvb, offset+6);
2899 ul_pdcp_seq = tvb_get_guint8(tvb, offset+7);
2901 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_nsapi, tvb, offset+1, 1, nsapi);
2902 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_gtpu_dn, tvb, offset+2, 2, dl_gtpu_seq);
2903 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_gtpu_up, tvb, offset+4, 2, ul_gtpu_seq);
2904 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_pdu_dn, tvb, offset+6, 1, dl_pdcp_seq);
2905 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_pdu_up, tvb, offset+7, 1, ul_pdcp_seq);
2911 /* GPRS: not present
2912 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
2915 decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2919 rp_sms = tvb_get_guint8(tvb, offset+1) & 0x07;
2920 proto_tree_add_uint(tree, hf_gtpv1_rp_sms, tvb, offset, 2, rp_sms);
2925 /* GPRS: not present
2926 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
2929 decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2931 proto_tree *ext_tree_rp;
2933 guint8 nsapi, rp, spare;
2935 nsapi = tvb_get_guint8(tvb, offset+1) & 0xF0;
2936 spare = tvb_get_guint8(tvb, offset+1) & 0x08;
2937 rp = tvb_get_guint8(tvb, offset+1) & 0x07;
2939 te = proto_tree_add_uint_format(tree, hf_gtpv1_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
2940 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
2942 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp_nsapi, tvb, offset+1, 1, nsapi);
2943 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp_spare, tvb, offset+1, 1, spare);
2944 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp, tvb, offset+1, 1, rp);
2949 /* GPRS: not present
2950 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
2953 decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2955 proto_tree *ext_tree_pkt_flow_id;
2957 guint8 nsapi, pkt_flow_id;
2959 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2960 pkt_flow_id = tvb_get_guint8(tvb, offset+2);
2962 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);
2963 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
2965 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtpv1_nsapi, tvb, offset+1, 1, nsapi);
2966 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);
2971 /* GPRS: not present
2972 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
2973 * TODO: Differenciate these uints?
2976 decode_gtp_chrg_char(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
2980 proto_tree *ext_tree_chrg_char;
2982 chrg_char = tvb_get_ntohs(tvb, offset+1);
2984 te = proto_tree_add_text(tree, tvb, offset, 3, "%s: %x", val_to_str(GTP_EXT_CHRG_CHAR, gtp_val, "Unknown message"), chrg_char);
2985 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
2987 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_s, tvb, offset+1, 2, chrg_char);
2988 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_n, tvb, offset+1, 2, chrg_char);
2989 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_p, tvb, offset+1, 2, chrg_char);
2990 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_f, tvb, offset+1, 2, chrg_char);
2991 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_h, tvb, offset+1, 2, chrg_char);
2992 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_r, tvb, offset+1, 2, chrg_char);
2997 /* GPRS: not present
2998 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3001 decode_gtp_trace_ref(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3005 trace_ref = tvb_get_ntohs(tvb, offset+1);
3007 proto_tree_add_uint(tree, hf_gtpv1_trace_ref, tvb, offset, 3, trace_ref);
3012 /* GPRS: not present
3013 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3016 decode_gtp_trace_type(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3020 trace_type = tvb_get_ntohs(tvb, offset+1);
3022 proto_tree_add_uint(tree, hf_gtpv1_trace_type, tvb, offset, 3, trace_type);
3027 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3028 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3031 decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3035 reason = tvb_get_guint8(tvb, offset+1);
3037 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ms_reason : hf_gtpv0_ms_reason, tvb, offset, 2, reason);
3047 decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3051 tr_command = tvb_get_ntohl(tvb, offset+1);
3053 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tr_comm : hf_gtpv0_tr_comm, tvb, offset, 2, tr_command);
3058 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3059 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3062 decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3066 chrg_id = tvb_get_ntohl(tvb, offset+1);
3067 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_chrg_id : hf_gtpv0_chrg_id, tvb, offset, 5, chrg_id);
3072 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3073 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3076 decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3079 guint8 pdp_typ, pdp_org;
3081 struct e_in6_addr addr_ipv6;
3082 proto_tree *ext_tree_user;
3086 length = tvb_get_ntohs(tvb, offset+1);
3087 pdp_org = tvb_get_guint8(tvb, offset+3) & 0x0F;
3088 pdp_typ = tvb_get_guint8(tvb, offset+4);
3090 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s (%s/%s)",
3091 val_to_str(GTP_EXT_USER_ADDR, gtp_val, "Unknown message"),
3092 val_to_str(pdp_org, pdp_org_type, "Unknown PDP Organization"),
3093 val_to_str(pdp_typ, pdp_type, "Unknown PDP Type"));
3094 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3096 proto_tree_add_text(ext_tree_user, tvb, offset+1, 2, "Length : %u", length);
3097 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);
3098 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);
3101 if (pdp_org == 0 && pdp_typ == 1)
3102 proto_item_append_text(te, " (Point to Point Protocol)");
3103 else if (pdp_typ == 2)
3104 proto_item_append_text(te, " (Octet Stream Protocol)");
3105 } else if (length > 2) {
3108 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+5, sizeof addr_ipv4);
3109 proto_tree_add_ipv4(ext_tree_user, gtp_version ? hf_gtpv1_user_ipv4 : hf_gtpv0_user_ipv4, tvb, offset+5, 4, addr_ipv4);
3110 proto_item_append_text(te, " : %s", ip_to_str((guint8 *)&addr_ipv4));
3113 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+5, sizeof addr_ipv6);
3114 proto_tree_add_ipv6(ext_tree_user, gtp_version ? hf_gtpv1_user_ipv6 : hf_gtpv0_user_ipv6, tvb, offset+5, 16, (guint8 *)&addr_ipv6);
3115 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3119 proto_item_append_text(te, " : empty PDP Address");
3125 decode_triplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
3127 proto_tree *ext_tree_trip;
3128 proto_item *te_trip;
3129 guint32 rand[4], sres, kc[2];
3132 for (i=0;i<count;i++) {
3134 tvb_memcpy(tvb, (guint8 *)&rand, offset+i*28, 16);
3135 sres = tvb_get_ntohl(tvb, offset+i*28+16);
3136 tvb_memcpy(tvb, (guint8 *)&kc, offset+i*28+20, 8);
3138 te_trip = proto_tree_add_text(tree, tvb, offset+i*28, 28, "Triplet no%x", i);
3139 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3141 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]);
3142 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+16, 4, "SRES: %x", sres);
3143 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+20, 8, "Kc: %x%x", kc[0], kc[1]);
3149 /* adjust - how many bytes before quintuplet should be highlighted
3152 decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count, guint8 adjust) {
3154 proto_tree *ext_tree_quint;
3155 proto_item *te_quint;
3156 guint32 rand[4], q_ck[4], q_ik[4];
3157 guint16 q_len, xres_len, auth_len, q_offset, i;
3161 for (i=0;i<count;i++) {
3163 offset = offset + q_offset;
3165 q_len = tvb_get_ntohs(tvb, offset);
3167 tvb_memcpy(tvb, (guint8 *)&rand, offset+2, 16);
3168 xres_len = tvb_get_ntohs(tvb, offset+18);
3169 /* xres = tvb_get_ptr(tvb, offset+20, xres_len);*/
3170 tvb_memcpy(tvb, (guint8 *)&q_ck, offset+20+xres_len, 16);
3171 tvb_memcpy(tvb, (guint8 *)&q_ik, offset+36+xres_len, 16);
3172 auth_len = tvb_get_ntohs(tvb, offset+52+xres_len);
3173 /* auth = tvb_get_ptr(tvb, offset+54+xres_len, auth_len);*/
3175 te_quint = proto_tree_add_text(tree, tvb, offset-adjust, q_len+adjust, "Quintuplet #%x", i);
3176 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3178 proto_tree_add_text(ext_tree_quint, tvb, offset, 2, "Length: %x", q_len);
3179 proto_tree_add_text(ext_tree_quint, tvb, offset+2, 16, "RAND: %x%x%x%x", rand[0], rand[1], rand[2], rand[3]);
3180 proto_tree_add_text(ext_tree_quint, tvb, offset+18, 2, "XRES length: %x", xres_len);
3181 proto_tree_add_text(ext_tree_quint, tvb, offset+20, xres_len, "XRES");
3182 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]);
3183 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]);
3184 proto_tree_add_text(ext_tree_quint, tvb, offset+52+xres_len, 2, "Authentication length: %x", auth_len);
3185 proto_tree_add_text(ext_tree_quint, tvb, offset+54+xres_len, auth_len, "AUTH");
3187 q_offset = q_offset + q_len + 2;
3193 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3194 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3195 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3196 * - finish displaying last 3 parameters
3199 decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3201 guint16 length, quint_len, net_cap, con_len;
3202 guint8 cksn, count, sec_mode, cipher, trans_id, proto_disc, message, drx_split, drx_len, drx_ccch, non_drx_timer;
3203 guint32 kc[4], ik[4];
3204 proto_tree *ext_tree_mm;
3207 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_MM_CNTXT, gtp_val, "Unknown message"));
3208 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3210 length = tvb_get_ntohs(tvb, offset+1);
3211 if (length < 1) return 3;
3213 cksn = tvb_get_guint8(tvb, offset+3) & 0x07;
3214 sec_mode = (tvb_get_guint8(tvb, offset+4) >> 6) & 0x03;
3215 count = (tvb_get_guint8(tvb, offset+4) >> 3) & 0x07;
3216 cipher = tvb_get_guint8(tvb, offset+4) & 0x07;
3218 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 2, "Length: %x", length);
3219 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Ciphering Key Sequence Number: %u", cksn);
3220 if (gtp_version != 0) {
3221 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Security type: %u", sec_mode);
3226 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "No of triplets: %u", count);
3231 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3233 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3235 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 16);
3236 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]);
3237 tvb_memcpy(tvb, (guint8 *)&ik, offset+21, 16);
3238 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]);
3239 quint_len = tvb_get_ntohs(tvb, offset+37);
3240 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
3242 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
3248 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3250 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3252 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 8);
3253 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %x%x", kc[0], kc[1]);
3255 offset = offset + decode_triplet(tvb, offset+13, ext_tree_mm, count) + 13;
3259 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 16);
3260 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]);
3261 tvb_memcpy(tvb, (guint8 *)&ik, offset+21, 16);
3262 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]);
3263 quint_len = tvb_get_ntohs(tvb, offset+37);
3264 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
3266 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
3271 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3273 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3275 tvb_memcpy(tvb, (guint8 *)&kc, offset+5, 8);
3276 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %x%x", kc[0], kc[1]);
3277 quint_len = tvb_get_ntohs(tvb, offset+13);
3278 proto_tree_add_text(ext_tree_mm, tvb, offset+13, 2, "Quintuplets length: %x", quint_len);
3280 offset = offset + decode_quintuplet(tvb, offset+15, ext_tree_mm, count, 0) + 15;
3288 drx_split = tvb_get_guint8(tvb, offset);
3289 drx_len = (tvb_get_guint8(tvb, offset+1) >> 4) & 0x0F;
3290 drx_ccch = (tvb_get_guint8(tvb, offset+1) >> 3) & 0x01;
3291 non_drx_timer = tvb_get_guint8(tvb, offset+1) & 0x07;
3293 net_cap = tvb_get_ntohs(tvb, offset+2);
3294 con_len = tvb_get_ntohs(tvb, offset+4);
3296 proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "DRX: split PG cycle code: %u", drx_split);
3297 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: CN specific DRX cycle length coefficient: %u", drx_len);
3298 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: split PG cycle on CCCH supported by MS: %s", yesno[drx_ccch]);
3299 if (non_drx_timer == 0) {
3300 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: no non-DRX mode after transfer state");
3302 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);
3305 proto_tree_add_text(ext_tree_mm, tvb, offset+2, 2, "MS network capability: %u", net_cap);
3306 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 2, "Container length: %u", con_len);
3309 trans_id = (tvb_get_guint8(tvb, offset+6) >> 4) & 0x0F;
3310 proto_disc = tvb_get_guint8(tvb, offset+6) & 0x0F;
3311 message = tvb_get_guint8(tvb, offset+7);
3317 /* adjust - how many bytes before offset sould be highligthed
3318 * WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3321 decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 adjust) {
3324 guint8 al_ret_priority;
3325 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3326 guint8 traf_class, del_order, del_err_sdu;
3327 guint8 max_sdu_size, max_ul, max_dl;
3328 guint8 res_ber, sdu_err_ratio;
3329 guint8 trans_delay, traf_handl_prio;
3330 guint8 guar_ul, guar_dl;
3331 proto_tree *ext_tree_qos;
3333 int mss, mu, md, gu, gd;
3335 length = tvb_get_guint8(tvb, offset-1);
3336 al_ret_priority = tvb_get_guint8(tvb, offset);
3338 spare1 = tvb_get_guint8(tvb, offset+1) & 0xC0;
3339 delay = tvb_get_guint8(tvb, offset+1) & 0x38;
3340 reliability = tvb_get_guint8(tvb, offset+1) & 0x07;
3341 peak = tvb_get_guint8(tvb, offset+2) & 0xF0;
3342 spare2 = tvb_get_guint8(tvb, offset+2) & 0x08;
3343 precedence = tvb_get_guint8(tvb, offset+2) & 0x07;
3344 spare3 = tvb_get_guint8(tvb, offset+3) & 0xE0;
3345 mean = tvb_get_guint8(tvb, offset+3) & 0x1F;
3346 traf_class = tvb_get_guint8(tvb, offset+4) & 0xE0;
3347 del_order = tvb_get_guint8(tvb, offset+4) & 0x18;
3348 del_err_sdu = tvb_get_guint8(tvb, offset+4) & 0x07;
3349 max_sdu_size = tvb_get_guint8(tvb, offset+5);
3350 max_dl = tvb_get_guint8(tvb, offset+6);
3351 max_ul = tvb_get_guint8(tvb, offset+7);
3352 res_ber = tvb_get_guint8(tvb, offset+8) & 0xF0;
3353 sdu_err_ratio = tvb_get_guint8(tvb, offset+8) & 0x0F;
3354 trans_delay = tvb_get_guint8(tvb, offset+9) & 0xFC;
3355 traf_handl_prio = tvb_get_guint8(tvb, offset+9) & 0x03;
3356 guar_ul = tvb_get_guint8(tvb, offset+10);
3357 guar_dl = tvb_get_guint8(tvb, offset+11);
3359 te = proto_tree_add_text(tree, tvb, offset-adjust, length+adjust, "%s : length (%u)", qos_str, length);
3360 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3362 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3363 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare1, tvb, offset+1, 1, spare1);
3364 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_delay, tvb, offset+1, 1, delay);
3365 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_reliability, tvb, offset+1, 1, reliability);
3366 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_peak, tvb, offset+2, 1, peak);
3367 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare2, tvb, offset+2, 1, spare2);
3368 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_precedence, tvb, offset+2, 1, precedence);
3369 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare3, tvb, offset+3, 1, spare3);
3370 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_mean, tvb, offset+3, 1, mean);
3371 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_class, tvb, offset+4, 1, traf_class);
3372 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_order, tvb, offset+4, 1, del_order);
3373 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_err_sdu, tvb, offset+4, 1, del_err_sdu);
3375 if (max_sdu_size == 0 || max_sdu_size > 150)
3376 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+5, 1, max_sdu_size);
3377 if (max_sdu_size > 0 && max_sdu_size <= 150) {
3378 mss = max_sdu_size*10;
3379 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);
3382 if(max_ul == 0 || max_ul == 255)
3383 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+6, 1, max_ul);
3384 if(max_ul > 0 && max_ul <= 63)
3385 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);
3386 if(max_ul > 63 && max_ul <=127) {
3387 mu = 64 + ( max_ul - 64 ) * 8;
3388 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);
3391 if(max_ul > 127 && max_ul <=254) {
3392 mu = 576 + ( max_ul - 128 ) * 64;
3393 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);
3396 if(max_dl == 0 || max_dl == 255)
3397 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+7, 1, max_dl);
3398 if(max_dl > 0 && max_dl <= 63)
3399 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);
3400 if(max_dl > 63 && max_dl <=127) {
3401 md = 64 + ( max_dl - 64 ) * 8;
3402 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);
3404 if(max_dl > 127 && max_dl <=254) {
3405 md = 576 + ( max_dl - 128 ) * 64;
3406 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);
3409 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_res_ber, tvb, offset+8, 1, res_ber);
3410 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_sdu_err_ratio, tvb, offset+8, 1, sdu_err_ratio);
3411 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_trans_delay, tvb, offset+9, 1, trans_delay);
3414 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_handl_prio, tvb, offset+9, 1, traf_handl_prio);
3416 if(guar_ul == 0 || guar_ul == 255)
3417 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+10, 1, guar_ul);
3418 if(guar_ul > 0 && guar_ul <= 63)
3419 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);
3420 if(guar_ul > 63 && guar_ul <=127) {
3421 gu = 64 + ( guar_ul - 64 ) * 8;
3422 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);
3424 if(guar_ul > 127 && guar_ul <=254) {
3425 gu = 576 + ( guar_ul - 128 ) * 64;
3426 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);
3429 if(guar_dl == 0 || guar_dl == 255)
3430 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+11, 1, guar_dl);
3431 if(guar_dl > 0 && guar_dl <= 63)
3432 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);
3433 if(guar_dl > 63 && guar_dl <=127) {
3434 gd = 64 + ( guar_dl - 64 ) * 8;
3435 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);
3437 if(guar_dl > 127 && guar_dl <=254) {
3438 gd = 576 + ( guar_dl - 128 ) * 64;
3439 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);
3442 return length + adjust;
3447 decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) {
3450 guint8 name_len, tmp;
3453 apn = g_malloc(length);
3454 tvb_memcpy(tvb, apn, offset+1, length);
3455 name_len = tvb_get_guint8(tvb, offset);
3458 if (name_len >= length-1) break;
3460 name_len = name_len + apn[tmp] + 1;
3463 apn[length-1] = '\0';
3464 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_apn : hf_gtpv0_apn, tvb, offset, length, apn);
3469 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
3470 * UMTS: 29.060 v4.0, chapter 7.7.29
3471 * TODO: unify addr functions
3474 decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3476 guint8 ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id,
3477 pdp_type_org, pdp_type_num, pdp_addr_len;
3478 guint16 length, sn_down, sn_up, up_flow;
3479 guint32 addr_ipv4, up_teid, up_teid_cp;
3480 struct e_in6_addr addr_ipv6;
3481 proto_tree *ext_tree_pdp;
3484 length = tvb_get_ntohs(tvb, offset+1);
3486 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_PDP_CNTXT, gtp_val, "Unknown message"));
3487 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
3489 vaa = (tvb_get_guint8(tvb, offset+3) >> 6) & 0x01;
3490 order = (tvb_get_guint8(tvb, offset+3) >> 4) & 0x01;
3491 nsapi = tvb_get_guint8(tvb, offset+3) & 0x0F;
3492 sapi = tvb_get_guint8(tvb, offset+4) & 0x0F;
3494 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "VPLMN address allowed: %s", yesno[vaa]);
3495 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "Reordering required: %s", yesno[order]);
3496 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "NSAPI: %u", nsapi);
3497 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "SAPI: %u", sapi);
3499 switch (gtp_version) {
3501 decode_qos_gprs(tvb, offset+5, ext_tree_pdp, "QoS subscribed", 0);
3502 decode_qos_gprs(tvb, offset+8, ext_tree_pdp, "QoS requested", 0);
3503 decode_qos_gprs(tvb, offset+11, ext_tree_pdp, "QoS negotiated", 0);
3504 offset = offset + 13;
3507 offset = offset + 5;
3508 offset = offset + decode_qos_umts(tvb, offset+1, ext_tree_pdp, "QoS subscribed", 1);
3509 offset = offset + decode_qos_umts(tvb, offset+1, ext_tree_pdp, "QoS requested", 1);
3510 offset = offset + decode_qos_umts(tvb, offset+1, ext_tree_pdp, "QoS negotiated", 1);
3516 sn_down = tvb_get_ntohs(tvb, offset);
3517 sn_up = tvb_get_ntohs(tvb, offset+2);
3518 pdu_send_no = tvb_get_guint8(tvb, offset+4);
3519 pdu_rec_no = tvb_get_guint8(tvb, offset+5);
3521 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
3522 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 2, "Sequence number up: %u", sn_up);
3523 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "Send N-PDU number: %u", pdu_send_no);
3524 proto_tree_add_text(ext_tree_pdp, tvb, offset+5, 1, "Receive N-PDU number: %u", pdu_rec_no);
3526 switch (gtp_version) {
3528 up_flow = tvb_get_ntohs(tvb, offset+6);
3529 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 2, "Uplink flow label signalling: %u", up_flow);
3530 offset = offset + 8;
3533 up_teid = tvb_get_ntohl(tvb, offset+6);
3534 up_teid_cp = tvb_get_ntohl(tvb, offset+10);
3535 pdp_cntxt_id = tvb_get_guint8(tvb, offset+14);
3536 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 4, "Uplink TEID: %x", up_teid);
3537 proto_tree_add_text(ext_tree_pdp, tvb, offset+10, 4, "Uplink TEID control plane: %x", up_teid_cp);
3538 proto_tree_add_text(ext_tree_pdp, tvb, offset+14, 1, "PDP context identifier: %u", pdp_cntxt_id);
3539 offset = offset + 15;
3545 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
3546 pdp_type_num = tvb_get_guint8(tvb, offset+1);
3547 pdp_addr_len = tvb_get_guint8(tvb, offset+2);
3549 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP type: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP type"));
3550 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 1, "PDP organization: %s", val_to_str(pdp_type_num, pdp_org_type, "Unknown PDP org"));
3551 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 1, "PDP address length: %u", pdp_addr_len);
3553 if (pdp_addr_len > 0) {
3554 switch (pdp_type_num) {
3556 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3557 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 4, "PDP address: %s", ip_to_str((guint8 *)&addr_ipv4));
3560 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3561 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3568 offset = offset + 3 + pdp_addr_len;
3570 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3571 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 1 address length: %u", ggsn_addr_len);
3573 switch (ggsn_addr_len) {
3575 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3576 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 1 address: %s", ip_to_str((guint8 *)&addr_ipv4));
3579 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3580 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 1 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3586 offset = offset + 1 + ggsn_addr_len;
3588 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3589 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
3591 switch (ggsn_addr_len) {
3593 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3594 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
3597 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3598 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3604 offset = offset + 1 + ggsn_addr_len;
3606 apn_len = tvb_get_guint8(tvb, offset);
3607 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
3608 decode_apn(tvb, offset+1, apn_len, ext_tree_pdp);
3610 offset = offset + 1 + apn_len;
3612 trans_id = tvb_get_guint8(tvb, offset);
3613 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "Transaction identifier: %u", trans_id);
3618 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
3619 * UMTS: 29.060, v4.0, chapter 7.7.30
3622 decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3625 proto_tree *ext_tree_apn;
3628 length = tvb_get_ntohs(tvb, offset+1);
3630 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_APN, gtp_val, "Unknown field"));
3631 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
3633 proto_tree_add_text(ext_tree_apn, tvb, offset+1, 2, "APN length : %u", length);
3634 decode_apn(tvb, offset+3, length, ext_tree_apn);
3639 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
3640 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
3641 * UMTS: 29.060 v4.0, chapter 7.7.31
3642 * 24.008, v4.2, chapter 10.5.6.3
3643 * TODO: check if length is 8 or 16 bits
3644 * - proto_conf in 3G */
3646 decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3648 guint16 length, proto_offset;
3649 guint8 *ptr, conf, proto_len, tmp, msg;
3651 proto_tree *ext_tree_proto;
3654 length = tvb_get_ntohs(tvb, offset + 1);
3656 te = proto_tree_add_text(tree, tvb, offset, length + 3, val_to_str(GTP_EXT_PROTO_CONF, gtp_val, "Unknown message"));
3657 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
3659 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
3661 if (length < 1) return 3;
3663 conf = tvb_get_guint8(tvb, offset + 3) & 0x07;
3664 proto_offset = 1; /* ... 1st byte is conf */
3667 if (proto_offset >= length) break;
3668 proto_len = tvb_get_guint8(tvb, offset + 6);
3669 proto_offset += proto_len + 3;
3671 if ((proto_len > 0) && ppp_reorder) {
3673 /* this part changes layout of GTP payload:
3674 * it swaps "length field" with "protocol header" */
3676 ptr = (guint8 *)tvb_get_ptr(tvb, offset + 4, 3);
3683 next_tvb = tvb_new_subset(tvb, offset + 5, proto_len + 2, proto_len + 2);
3684 call_dissector(ppp_handle, next_tvb, pinfo, ext_tree_proto);
3686 if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "GTP");
3688 if (check_col(pinfo->fd, COL_INFO)) {
3690 msg = tvb_get_guint8(tvb, 1);
3692 col_set_str(pinfo->fd, COL_INFO, val_to_str(msg, message_type, "Unknown"));
3700 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
3701 * UMTS: 29.060 v4.0, chapter 7.7.32
3704 decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3706 guint8 addr_type, addr_len;
3709 struct e_in6_addr addr_ipv6;
3710 proto_tree *ext_tree_gsn_addr;
3713 length = tvb_get_ntohs(tvb, offset+1);
3715 te = proto_tree_add_text(tree, tvb, offset, 3+length, "GSN address : ");
3716 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
3720 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3721 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3722 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3723 proto_tree_add_ipv4(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv4 : hf_gtpv0_gsn_ipv4, tvb, offset+3, 4, addr_ipv4);
3726 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3727 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3728 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);
3729 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3730 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);
3731 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+4, sizeof addr_ipv4);
3732 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3733 proto_tree_add_ipv4(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv4 : hf_gtpv0_gsn_ipv4, tvb, offset+4, 4, addr_ipv4);
3736 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3737 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3738 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3739 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);
3742 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3743 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3744 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);
3745 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3746 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);
3747 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+4, sizeof addr_ipv6);
3748 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3749 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);
3752 proto_item_append_text(te, "unknown type or wrong length");
3759 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
3760 * UMTS: 29.060 v4.0, chapter 7.7.33
3763 decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3765 const guint8 *msisdn_val;
3769 length = tvb_get_ntohs(tvb, offset+1);
3771 if (length < 1) return 3;
3773 msisdn_val = tvb_get_ptr(tvb, offset+3, length);
3774 msisdn_str = msisdn_to_str(msisdn_val, length);
3776 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_msisdn : hf_gtpv0_msisdn, tvb, offset, 3+length, msisdn_str);
3781 /* GPRS: not present
3782 * UMTS: 29.060 v4.0, chapter 7.7.34
3783 * 24.008 v4.2, chapter 10.5.6.5
3786 decode_gtp_qos_umts(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3788 return decode_qos_umts(tvb, offset+3, tree, "Quality of Service", 3);
3791 /* GPRS: not present
3792 * UMTS: 29.060 v4.0, chapter 7.7.35
3795 decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3797 return (1 + decode_quintuplet(tvb, offset+1, tree, 1, 1));
3801 /* GPRS: not present
3802 * UMTS: 29.060 v4.0, chapter 7.7.36
3803 * 24.008 v4.2, chapter 10.5.6.12
3806 decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3808 guint16 length, port1, port2, tos;
3809 guint8 tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, pf_offset, proto;
3810 guint32 addr_ipv4, ipsec_id, label;
3811 struct e_in6_addr addr_ipv6;
3812 proto_tree *ext_tree_tft, *ext_tree_tft_pf;
3813 proto_item *te, *tee;
3815 length = tvb_get_ntohs(tvb, offset+1);
3817 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Traffic flow template");
3818 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
3820 tft_code = (tvb_get_guint8(tvb, offset+3) >> 5) & 0x07;
3821 no_packet_filters = tvb_get_guint8(tvb, offset+3) & 0x0F;
3823 proto_tree_add_text(ext_tree_tft, tvb, offset+1, 2, "TFT length: %u", length);
3824 proto_tree_add_text(ext_tree_tft, tvb, offset+3, 1, "TFT operation code: %u", tft_code);
3825 proto_tree_add_text(ext_tree_tft, tvb, offset+3, 1, "Number of packet filters: %u", no_packet_filters);
3827 offset = offset + 4;
3829 for (i=0;i<no_packet_filters;i++) {
3831 pf_id = tvb_get_guint8(tvb, offset);
3833 tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
3834 ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
3836 if (tft_code != 2) {
3838 pf_eval = tvb_get_guint8(tvb, offset+1);
3839 pf_len = tvb_get_guint8(tvb, offset+2);
3841 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+1, 1, "Evaluation precedence: %u", pf_eval);
3842 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+2, 1, "Contents length: %u", pf_len);
3844 offset = offset + 3;
3847 while (pf_offset < pf_len) {
3849 pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
3851 switch (pf_content_id) {
3852 /* address IPv4 and mask = 8 bytes*/
3854 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Address IPv4 and mask (0x10)");
3855 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 1, sizeof addr_ipv4);
3856 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\tAddress: %s", ip_to_str((guint8 *)&addr_ipv4));
3857 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 5, sizeof addr_ipv4);
3858 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 5, 4, "\tNetmask: %s", ip_to_str((guint8 *)&addr_ipv4));
3859 pf_offset = pf_offset + 9;
3861 /* address IPv6 and mask = 32 bytes*/
3863 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Address IPv6 and mask (0x20)");
3864 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+pf_offset+1, sizeof addr_ipv6);
3865 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+offset+1, 16, "\tAddress: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3866 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+pf_offset+17, sizeof addr_ipv6);
3867 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+offset+17, 16, "\tNetmask: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3868 pf_offset = pf_offset + 33;
3870 /* protocol identifier/next header type = 1 byte*/
3872 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "IPv4 protocol identifier/IPv6 next header (0x30)");
3873 proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
3874 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 1, "\t%u", proto);
3875 pf_offset = pf_offset + 2;
3877 /* single destination port type = 2 bytes */
3879 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Destination port (0x40)");
3880 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3881 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", port1);
3882 pf_offset = pf_offset + 3;
3884 /* destination port range type = 4 bytes */
3886 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Destination port range (0x41)");
3887 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3888 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
3889 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%u-%u", port1, port2);
3890 pf_offset = pf_offset + 5;
3892 /* single source port type = 2 bytes */
3894 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Source port (0x50)");
3895 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3896 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", port1);
3897 pf_offset = pf_offset + 3;
3899 /* source port range type = 4 bytes */
3901 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Source port range (0x51)");
3902 port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3903 port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
3904 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%u-%u", port1, port2);
3905 pf_offset = pf_offset + 5;
3907 /* security parameter index type = 4 bytes */
3909 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Security parameter index (0x60)");
3910 ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
3911 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 4, "\t%x", ipsec_id);
3912 pf_offset = pf_offset + 5;
3914 /* type of service/traffic class type = 2 bytes */
3916 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Type of Service/Traffic Class (0x70)");
3917 tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
3918 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 2, "\t%u", tos);
3919 pf_offset = pf_offset + 3;
3921 /* flow label type = 3 bytes */
3923 proto_tree_add_text(ext_tree_tft_pf, tvb, offset+pf_offset, 1, "Flow label (0x80)");
3924 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;;
3925 proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset + 1, 3, "\t%x", label);
3926 pf_offset = pf_offset + 4;
3939 /* GPRS: not present
3940 * UMTS: 29.060 v4.0, chapter 7.7.37
3941 * 25.413 v3.4, chapter ???
3944 decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3948 length = tvb_get_ntohs(tvb, offset + 1);
3950 proto_tree_add_text(tree, tvb, offset, 3 + length, "Targer Identification");
3956 /* GPRS: not present
3957 * UMTS: 29.060 v4.0, chapter 7.7.38
3960 decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3964 length = tvb_get_ntohs(tvb, offset + 1);
3966 proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
3973 /* GPRS: not present
3974 * UMTS: 29.060 v4.0, chapter 7.7.39
3977 decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3979 guint32 teid, addr_ipv4;
3982 struct e_in6_addr addr_ipv6;
3983 proto_tree *ext_tree_rab_setup;
3986 length = tvb_get_ntohs(tvb, offset + 1);
3987 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
3989 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Radio Access Bearer Setup Information");
3990 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
3992 proto_tree_add_text(ext_tree_rab_setup, tvb, offset+1, 2, "RAB setup length : %u", length);
3993 proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_nsapi, tvb, offset+3, 1, nsapi);
3997 teid = tvb_get_ntohl(tvb, offset + 4);
3999 proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_teid_data, tvb, offset+4, 4, teid);
4003 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+8, sizeof addr_ipv4);
4004 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtpv1_rnc_ipv4, tvb, offset+8, 4, addr_ipv4);
4007 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+8, sizeof addr_ipv6);
4008 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtpv1_rnc_ipv6, tvb, offset+8, 16, (guint8 *)&addr_ipv6);
4019 /* GPRS: not present
4020 * UMTS: 29.060 v4.0, chapter 7.7.40
4023 decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4027 proto_tree *ext_tree_hdr_list;
4030 length = tvb_get_guint8(tvb, offset + 1);
4032 te = proto_tree_add_text(tree, tvb, offset, 2+length, "%s", val_to_str(GTP_EXT_HDR_LIST, gtp_val, "Unknown"));
4033 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4035 proto_tree_add_text(ext_tree_hdr_list, tvb, offset+1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4037 for(i=0 ; i<length ; i++) {
4038 hdr = tvb_get_guint8(tvb, offset+2+i);
4040 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);
4046 /* GPRS: not present
4047 * UMTS: 29.060 v4.0, chapter 7.7.41
4048 * TODO: find TriggerID description
4051 decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4055 length = tvb_get_ntohs(tvb, offset + 1);
4057 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_TRIGGER_ID, gtp_val, "Unknown"), length);
4063 /* GPRS: not present
4064 * UMTS: 29.060 v4.0, chapter 7.7.42
4065 * TODO: find OMC-ID description
4068 decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4072 length = tvb_get_ntohs(tvb, offset + 1);
4074 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_OMC_ID, gtp_val, "Unknown"), length);
4080 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
4081 * UMTS: 29.060 v4.0, chapter 7.7.43
4084 decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4088 struct e_in6_addr addr_ipv6;
4089 proto_tree *ext_tree_chrg_addr;
4092 length = tvb_get_ntohs(tvb, offset+1);
4094 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"));
4095 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
4097 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);
4101 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
4102 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4103 proto_tree_add_ipv4(ext_tree_chrg_addr, gtp_version ? hf_gtpv1_chrg_ipv4 : hf_gtpv0_chrg_ipv4, tvb, offset+3, 4, addr_ipv4);
4106 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
4107 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4108 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);
4111 proto_item_append_text(te, "unknown type or wrong length");
4122 decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4124 guint16 length, n, number;
4125 proto_tree *ext_tree_rel_pack;
4128 length = tvb_get_ntohs(tvb, offset + 1);
4130 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
4131 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
4135 while (n < length) {
4137 number = tvb_get_ntohs(tvb, offset + 3 + n);
4138 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
4150 decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4152 guint16 length, n, number;
4153 proto_tree *ext_tree_can_pack;
4156 length = tvb_get_ntohs(tvb, offset + 1);
4158 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
4159 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
4163 while (n < length) {
4165 number = tvb_get_ntohs(tvb, offset + 3 + n);
4166 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
4174 /* CDRs dissector */
4176 decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4178 guint16 length, format_ver, data_len, i, j;
4179 guint8 no, format, rectype;
4180 proto_tree *ext_tree, *cdr_tree;
4181 proto_item *te, *ce;
4183 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
4184 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
4186 length = tvb_get_ntohs(tvb, offset + 1);
4187 no = tvb_get_guint8(tvb, offset + 3);
4188 format = tvb_get_guint8(tvb, offset + 4);
4189 format_ver = tvb_get_ntohs(tvb, offset + 5);
4191 proto_tree_add_text(ext_tree, tvb, offset+1, 2, "Length: %u", length);
4192 proto_tree_add_text(ext_tree, tvb, offset+3, 1, "Number of data records: %u", no);
4193 proto_tree_add_text(ext_tree, tvb, offset+4, 1, "Data record format: %u", format);
4194 proto_tree_add_text(ext_tree, tvb, offset+5, 2, "Data record format version: %u", format_ver);
4197 offset = offset + 7;
4199 if (gtpv0_cdr_as != DONT_DISSECT_CDRS) {
4201 for (i = 0; i < no; i++) {
4202 data_len = tvb_get_ntohs(tvb, offset);
4203 rectype = tvb_get_guint8(tvb, offset+2);
4205 case 0x13: /* GCDR */
4206 if (tvb_length_remaining(tvb, offset) < 3 + 118) {
4207 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "GCDR fragmented, can't dissect");
4211 tvb_memcpy(tvb, gcdr.imsi, offset+3, 8);
4212 tvb_memcpy(tvb, (guint8 *)&gcdr.ggsnaddr, offset+11, sizeof gcdr.ggsnaddr);
4213 gcdr.chrgid = tvb_get_ntohl(tvb, offset+15);
4214 tvb_memcpy(tvb, (guint8 *)&gcdr.sgsnaddr, offset+19, sizeof gcdr.sgsnaddr);
4215 tvb_memcpy(tvb, gcdr.apn, offset+23, 63);
4216 gcdr.pdporg = tvb_get_guint8(tvb, offset+86);
4217 gcdr.pdptype = tvb_get_guint8(tvb, offset+87);
4218 tvb_memcpy(tvb, (guint8 *)&gcdr.pdpaddr, offset+88, sizeof gcdr.pdpaddr);
4219 gcdr.addrflag = tvb_get_guint8(tvb, offset+92);
4220 gcdr.uplink = tvb_get_ntohl(tvb, offset+96);
4221 gcdr.downlink = tvb_get_ntohl(tvb, offset+100);
4222 gcdr.timestamp = tvb_get_ntohl(tvb, offset+104);
4223 gcdr.opening = tvb_get_ntohl(tvb, offset+108);
4224 gcdr.duration = tvb_get_ntohl(tvb, offset+112);
4225 gcdr.closecause = tvb_get_guint8(tvb, offset+116);
4226 gcdr.seqno = tvb_get_ntohl(tvb, offset+117);
4228 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "GCDR (0x13), sequence number: %u", gcdr.seqno);
4229 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4230 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4231 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4232 proto_tree_add_text(cdr_tree, tvb, offset+3, 8, "IMSI: %s", id_to_str(gcdr.imsi));
4233 proto_tree_add_text(cdr_tree, tvb, offset+11, 4, "GGSN address: %s", ip_to_str((guint8 *)&gcdr.ggsnaddr));
4234 proto_tree_add_text(cdr_tree, tvb, offset+15, 4, "Charging ID: %x", gcdr.chrgid);
4235 proto_tree_add_text(cdr_tree, tvb, offset+19, 4, "SGSN address: %s", ip_to_str((guint8 *)&gcdr.sgsnaddr));
4236 proto_tree_add_text(cdr_tree, tvb, offset+23, 63, "APN: %s", gcdr.apn);
4237 proto_tree_add_text(cdr_tree, tvb, offset+86, 1, "PDP org: %s", val_to_str(gcdr.pdporg, pdp_org_type, "Unknown PDP org"));
4238 proto_tree_add_text(cdr_tree, tvb, offset+87, 1, "PDP type: %s", val_to_str(gcdr.pdptype, pdp_type, "Unknown PDP type"));
4239 proto_tree_add_text(cdr_tree, tvb, offset+88, 4, "PDP address: %s", ip_to_str((guint8 *)&gcdr.pdpaddr));
4240 proto_tree_add_text(cdr_tree, tvb, offset+92, 1, "PDP address type: %u", gcdr.addrflag);
4241 decode_qos_gprs(tvb, offset+93, cdr_tree, "QoS", 0);
4242 proto_tree_add_text(cdr_tree, tvb, offset+96, 4, "Uplink volume: %u", gcdr.uplink);
4243 proto_tree_add_text(cdr_tree, tvb, offset+100, 4, "Downlink volume: %u", gcdr.downlink);
4244 proto_tree_add_text(cdr_tree, tvb, offset+104, 4, "Timestamp: %s", time_int_to_str(gcdr.timestamp));
4245 proto_tree_add_text(cdr_tree, tvb, offset+108, 4, "Record opening time: %s", time_int_to_str(gcdr.opening));
4246 proto_tree_add_text(cdr_tree, tvb, offset+112, 4, "Duration: %s", time_int_to_str(gcdr.duration));
4247 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);
4248 proto_tree_add_text(cdr_tree, tvb, offset+117, 4, "Sequence number: %u", gcdr.seqno);
4250 if (data_len > 119) {
4251 proto_tree_add_text(cdr_tree, tvb, offset+121, 8, "MSISDN: ");
4256 case 0x12: /* SCDR */
4257 if (tvb_length_remaining(tvb, offset) < 3 + 277) {
4258 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "SCDR fragmented, can't dissect");
4262 scdr.len = tvb_get_letohs(tvb, offset+3);
4263 scdr.netini = tvb_get_guint8(tvb, offset+5);
4264 scdr.anon = tvb_get_guint8(tvb, offset+6);
4265 scdr.imsilen = tvb_get_guint8(tvb, offset+7);
4266 tvb_memcpy(tvb, scdr.imsi, offset+8, 8);
4267 tvb_memcpy(tvb, scdr.imei, offset+16, 8);
4268 scdr.msisdnlen = tvb_get_guint8(tvb, offset+24);
4269 tvb_memcpy(tvb, scdr.msisdn, offset+25, 10);
4270 tvb_memcpy(tvb, (guint8 *)&scdr.sgsnaddr, offset+35, sizeof scdr.sgsnaddr);
4271 tvb_memcpy(tvb, scdr.msclass_notused, offset+39, 12);
4272 scdr.msclass_caplen = tvb_get_guint8(tvb, offset+51);
4273 scdr.msclass_cap = tvb_get_guint8(tvb, offset+52);
4274 scdr.msclass_capomit = tvb_get_ntohs(tvb, offset+53);
4275 scdr.lac = tvb_get_ntohs(tvb, offset+55);
4276 scdr.rac = tvb_get_guint8(tvb, offset+57);
4277 scdr.cid = tvb_get_ntohs(tvb, offset+58);
4278 scdr.chrgid = tvb_get_ntohl(tvb, offset+60);
4279 tvb_memcpy(tvb, (guint8 *)&scdr.ggsnaddr, offset+64, sizeof scdr.ggsnaddr);
4280 tvb_memcpy(tvb, scdr.apn, offset+68, 64);
4281 scdr.pdporg = tvb_get_guint8(tvb, offset+132);
4282 scdr.pdptype = tvb_get_guint8(tvb, offset+133);
4283 tvb_memcpy(tvb, (guint8 *)&scdr.pdpaddr, offset+134, sizeof scdr.pdpaddr);
4284 scdr.listind = tvb_get_guint8(tvb, offset+138);
4286 scdr.change[j].change = tvb_get_guint8(tvb, offset+139+23*j);
4287 scdr.change[j].time1 = tvb_get_ntohl(tvb, offset+140+23*j);
4288 scdr.change[j].time2 = tvb_get_ntohl(tvb, offset+144+23*j);
4289 scdr.change[j].uplink = tvb_get_ntohl(tvb, offset+148+23*j);
4290 scdr.change[j].downlink = tvb_get_ntohl(tvb, offset+152+23*j);
4291 /* tvb_memcpy(tvb, scdr.change[j].qos_req, offset+156+23*j, 3);
4292 tvb_memcpy(tvb, scdr.change[j].qos_neg, offset+159+23*j, 3);*/
4294 scdr.timestamp = tvb_get_ntohl(tvb, offset+254);
4295 scdr.opening = tvb_get_ntohl(tvb, offset+258);
4296 scdr.duration = tvb_get_ntohl(tvb, offset+262);
4297 scdr.sgsnchange = tvb_get_guint8(tvb, offset+266);
4298 scdr.closecause = tvb_get_guint8(tvb, offset+267);
4299 scdr.diag1 = tvb_get_guint8(tvb, offset+268);
4300 scdr.diag2 = tvb_get_guint8(tvb, offset+269);
4301 scdr.diag3 = tvb_get_guint8(tvb, offset+270);
4302 scdr.diag4 = tvb_get_guint8(tvb, offset+271);
4303 scdr.diag5 = tvb_get_ntohl(tvb, offset+272);
4304 scdr.seqno = tvb_get_ntohl(tvb, offset+276);
4306 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "SCDR (type %x), sequence number: %u", rectype, scdr.seqno);
4307 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4308 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4309 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4310 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "CDR length: %u", scdr.len);
4311 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "Network initiated PDP context: %s", yesno[scdr.netini]);
4312 proto_tree_add_text(cdr_tree, tvb, offset+6, 1, "Anonymous acces: %s", yesno[scdr.anon]);
4313 proto_tree_add_text(cdr_tree, tvb, offset+7, 1, "IMSI length: %u", scdr.imsilen);
4314 proto_tree_add_text(cdr_tree, tvb, offset+8, 8, "IMSI: %s", id_to_str(scdr.imsi));
4315 proto_tree_add_text(cdr_tree, tvb, offset+16, 8, "IMEI: %s", id_to_str(scdr.imei));
4316 proto_tree_add_text(cdr_tree, tvb, offset+24, 1, "MSISDN length: %u", scdr.msisdnlen);
4317 proto_tree_add_text(cdr_tree, tvb, offset+25, 10, "MSISDN: %s", msisdn_to_str(scdr.msisdn, 10));
4318 proto_tree_add_text(cdr_tree, tvb, offset+35, 4, "SGSN address: %s", ip_to_str((guint8 *)&scdr.sgsnaddr));
4319 proto_tree_add_text(cdr_tree, tvb, offset+39, 12, "(not used)");
4320 proto_tree_add_text(cdr_tree, tvb, offset+51, 1, "MS network capability length: %u", scdr.msclass_caplen);
4322 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+52, 1, "MS network capability: %u", scdr.msclass_cap);
4323 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4324 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+52, 1, scdr.cap);
4325 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+52, 1, scdr.cap);
4326 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+52, 1, scdr.cap);
4327 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+52, 1, scdr.cap);
4328 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+52, 1, scdr.cap);
4329 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+52, 1, scdr.cap);
4330 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_pad, tvb, offset+52, 1, scdr.cap);
4333 proto_tree_add_text(cdr_tree, tvb, offset+53, 2, "MS network capability omitted: %u", scdr.msclass_capomit);
4334 proto_tree_add_text(cdr_tree, tvb, offset+55, 2, "LAC: %u", scdr.lac);
4335 proto_tree_add_text(cdr_tree, tvb, offset+57, 1, "RAC: %u", scdr.rac);
4336 proto_tree_add_text(cdr_tree, tvb, offset+58, 2, "Cell ID: %u", scdr.cid);
4337 proto_tree_add_text(cdr_tree, tvb, offset+60, 4, "Charging ID: %x", scdr.chrgid);
4338 proto_tree_add_text(cdr_tree, tvb, offset+64, 4, "GGSN address: %s", ip_to_str((guint8 *)&scdr.ggsnaddr));
4339 proto_tree_add_text(cdr_tree, tvb, offset+68, 64, "APN: %s", scdr.apn);
4340 proto_tree_add_text(cdr_tree, tvb, offset+132, 1, "PDP org: %s", val_to_str(scdr.pdporg, pdp_org_type, "Unknown PDP org"));
4341 proto_tree_add_text(cdr_tree, tvb, offset+133, 1, "PDP type: %s", val_to_str(scdr.pdptype, pdp_type, "Unknown PDP type"));
4342 proto_tree_add_text(cdr_tree, tvb, offset+134, 4, "PDP address: %s", ip_to_str((guint8 *)&scdr.pdpaddr));
4343 proto_tree_add_text(cdr_tree, tvb, offset+138, 1, "List of data volume index: %u", scdr.listind);
4345 proto_tree_add_text(cdr_tree, tvb, offset+139+23*j, 1, "List of data vol change condition: %u", scdr.change[j].change);
4346 proto_tree_add_text(cdr_tree, tvb, offset+140+23*j, 4, "Time1: %x", scdr.change[j].time1);
4347 proto_tree_add_text(cdr_tree, tvb, offset+144+23*j, 4, "Time2: %x", scdr.change[j].time2);
4348 proto_tree_add_text(cdr_tree, tvb, offset+148+23*j, 4, "Uplink: %x", scdr.change[j].uplink);
4349 proto_tree_add_text(cdr_tree, tvb, offset+152+23*j, 4, "Downlink: %x", scdr.change[j].downlink);
4350 decode_qos_gprs(tvb, offset+156, cdr_tree, "QoS requested", 0);
4351 decode_qos_gprs(tvb, offset+159, cdr_tree, "QoS negotiated", 0);
4353 proto_tree_add_text(cdr_tree, tvb, offset+254, 4, "Timestamp: %s", time_int_to_str(scdr.timestamp));
4354 proto_tree_add_text(cdr_tree, tvb, offset+258, 4, "Opening: %s", time_int_to_str(scdr.opening));
4355 proto_tree_add_text(cdr_tree, tvb, offset+262, 4, "Duration: %s", time_int_to_str(scdr.duration));
4356 proto_tree_add_text(cdr_tree, tvb, offset+266, 1, "SGSN change: %u", scdr.sgsnchange);
4357 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);
4358 proto_tree_add_text(cdr_tree, tvb, offset+268, 1, "Diagnostics 1: %u", scdr.diag1);
4359 proto_tree_add_text(cdr_tree, tvb, offset+269, 1, "Diagnostics 2: %u", scdr.diag2);
4360 proto_tree_add_text(cdr_tree, tvb, offset+270, 1, "Diagnostics 3: %u", scdr.diag3);
4361 proto_tree_add_text(cdr_tree, tvb, offset+271, 1, "Diagnostics 4: %u", scdr.diag4);
4362 proto_tree_add_text(cdr_tree, tvb, offset+272, 4, "Diagnostics 5: %u", scdr.diag5);
4363 proto_tree_add_text(cdr_tree, tvb, offset+276, 4, "Sequence number: %u", scdr.seqno);
4365 case 0x14: /* MCDR */
4366 if (tvb_length_remaining(tvb, offset) < 3 + 147) {
4367 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "MCDR fragmented, can't dissect");
4371 mcdr.len = tvb_get_ntohs(tvb, offset+3);
4372 mcdr.imsilen = tvb_get_guint8(tvb, offset+5);
4373 tvb_memcpy(tvb, mcdr.imsi, offset+6, 8);
4374 tvb_memcpy(tvb, mcdr.imei, offset+14, 8);
4375 mcdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4376 tvb_memcpy(tvb, mcdr.msisdn, offset+23, 10);
4377 tvb_memcpy(tvb, (guint8 *)&mcdr.sgsnaddr, offset+33, sizeof mcdr.sgsnaddr);
4378 tvb_memcpy(tvb, mcdr.msclass_notused, offset+37, 12);
4379 mcdr.msclass_caplen = tvb_get_guint8(tvb, offset+49);
4380 mcdr.msclass_cap = tvb_get_guint8(tvb, offset+50);
4381 mcdr.msclass_capomit = tvb_get_ntohs(tvb, offset+51);
4382 mcdr.lac = tvb_get_ntohs(tvb, offset+53);
4383 mcdr.rac = tvb_get_guint8(tvb, offset+55);
4384 mcdr.cid = tvb_get_ntohs(tvb, offset+56);
4385 mcdr.change_count = tvb_get_guint8(tvb, offset+58);
4387 mcdr.change[j].lac = tvb_get_ntohs(tvb, offset+59+13*j);
4388 mcdr.change[j].rac = tvb_get_guint8(tvb, offset+61+13*j);
4389 mcdr.change[j].cid = tvb_get_ntohs(tvb, offset+62+13*j);
4390 tvb_memcpy(tvb, mcdr.change[j].omit, offset+64+13*j, 8);
4392 mcdr.timestamp = tvb_get_ntohl(tvb, offset+124);
4393 mcdr.opening = tvb_get_ntohl(tvb, offset+128);
4394 mcdr.duration = tvb_get_ntohl(tvb, offset+132);
4395 mcdr.sgsnchange = tvb_get_guint8(tvb, offset+136);
4396 mcdr.closecause = tvb_get_guint8(tvb, offset+137);
4397 mcdr.diag1 = tvb_get_guint8(tvb, offset+138);
4398 mcdr.diag2 = tvb_get_guint8(tvb, offset+139);
4399 mcdr.diag3 = tvb_get_guint8(tvb, offset+140);
4400 mcdr.diag4 = tvb_get_guint8(tvb, offset+141);
4401 mcdr.diag5 = tvb_get_ntohl(tvb, offset+142);
4402 mcdr.seqno = tvb_get_ntohl(tvb, offset+146);
4404 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "MCDR (0x14), sequence number: %u", mcdr.seqno);
4405 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4406 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4407 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4408 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", mcdr.len);
4409 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", mcdr.imsilen);
4410 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(mcdr.imsi));
4411 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(mcdr.imei));
4412 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", mcdr.msisdnlen);
4413 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(mcdr.msisdn, 10));
4414 proto_tree_add_text(cdr_tree, tvb, offset+33, 4, "SGSN address: %s", ip_to_str((guint8 *)&mcdr.sgsnaddr));
4415 proto_tree_add_text(cdr_tree, tvb, offset+37, 12, "(not used)");
4416 proto_tree_add_text(cdr_tree, tvb, offset+49, 1, "MS network capability length: %u", mcdr.msclass_caplen);
4418 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+50, 1, "MS network capability: %u", mcdr.msclass_cap);
4419 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4420 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+50, 1, mcdr.cap);
4421 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+50, 1, mcdr.cap);
4422 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+50, 1, mcdr.cap);
4423 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+50, 1, mcdr.cap);
4424 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+50, 1, mcdr.cap);
4425 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+50, 1, mcdr.cap);
4426 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_pad, tvb, offset+50, 1, mcdr.cap);
4428 proto_tree_add_text(cdr_tree, tvb, offset+51, 2, "MS network capability omitted: %u", mcdr.msclass_capomit);
4429 proto_tree_add_text(cdr_tree, tvb, offset+53, 2, "LAC: %u", mcdr.lac);
4430 proto_tree_add_text(cdr_tree, tvb, offset+55, 1, "RAC: %u", mcdr.rac);
4431 proto_tree_add_text(cdr_tree, tvb, offset+56, 2, "Cell ID: %u", mcdr.cid);
4432 proto_tree_add_text(cdr_tree, tvb, offset+58, 1, "List of data volume changes: %u", mcdr.change_count);
4434 proto_tree_add_text(cdr_tree, tvb, offset+59+13*j, 2, "LAC: %u", mcdr.change[j].lac);
4435 proto_tree_add_text(cdr_tree, tvb, offset+61+13*j, 1, "RAC: %u", mcdr.change[j].rac);
4436 proto_tree_add_text(cdr_tree, tvb, offset+62+13*j, 2, "CID: %u", mcdr.change[j].cid);
4437 proto_tree_add_text(cdr_tree, tvb, offset+64+13*j, 8, "(omitted)");
4440 proto_tree_add_text(cdr_tree, tvb, offset+124, 4, "Timestamp: %s", time_int_to_str(mcdr.timestamp));
4441 proto_tree_add_text(cdr_tree, tvb, offset+128, 4, "Record opening time: %s", time_int_to_str(mcdr.opening));
4442 proto_tree_add_text(cdr_tree, tvb, offset+132, 4, "Duration: %s", time_int_to_str(mcdr.duration));
4443 proto_tree_add_text(cdr_tree, tvb, offset+136, 1, "SGSN change: %u", mcdr.sgsnchange);
4444 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);
4445 proto_tree_add_text(cdr_tree, tvb, offset+138, 1, "Diagnostics 1: %u", mcdr.diag1);
4446 proto_tree_add_text(cdr_tree, tvb, offset+139, 1, "Diagnostics 2: %u", mcdr.diag2);
4447 proto_tree_add_text(cdr_tree, tvb, offset+140, 1, "Diagnostics 3: %u", mcdr.diag3);
4448 proto_tree_add_text(cdr_tree, tvb, offset+141, 1, "Diagnostics 4: %u", mcdr.diag4);
4449 proto_tree_add_text(cdr_tree, tvb, offset+142, 4, "Diagnostics 5: %u", mcdr.diag5);
4450 proto_tree_add_text(cdr_tree, tvb, offset+146, 4, "Sequence number: %u", mcdr.seqno);
4453 case 0x15: /* SOCDR */
4454 if (tvb_length_remaining(tvb, offset) < 3 + 80) {
4455 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "SOCDR fragmented, can't dissect");
4459 socdr.len = tvb_get_ntohs(tvb, offset+3);
4460 socdr.imsilen = tvb_get_guint8(tvb, offset+5);
4461 tvb_memcpy(tvb, socdr.imsi, offset+6, 8);
4462 tvb_memcpy(tvb, socdr.imei, offset+14, 8);
4463 socdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4464 tvb_memcpy(tvb, socdr.msisdn, offset+23, 10);
4465 tvb_memcpy(tvb, socdr.msclass_notused, offset+33, 12);
4466 socdr.msclass_caplen = tvb_get_guint8(tvb, offset+45);
4467 socdr.msclass_cap = tvb_get_guint8(tvb, offset+46);
4468 socdr.msclass_capomit = tvb_get_ntohs(tvb, offset+47);
4469 tvb_memcpy(tvb, socdr.serv_centr, offset+49, 9);
4470 tvb_memcpy(tvb, socdr.rec_ent, offset+58, 9);
4471 socdr.lac = tvb_get_ntohs(tvb, offset+67);
4472 socdr.rac = tvb_get_guint8(tvb, offset+69);
4473 socdr.cid = tvb_get_ntohs(tvb, offset+70);
4474 socdr.time1 = tvb_get_ntohl(tvb, offset+72);
4475 socdr.time2 = tvb_get_ntohl(tvb, offset+76);
4476 socdr.messref = tvb_get_guint8(tvb, offset+80);
4477 socdr.smsres = tvb_get_ntohs(tvb, offset+81);
4479 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "SOCDR (0x15)");
4480 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4481 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4482 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4483 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", socdr.len);
4484 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", socdr.imsilen);
4485 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(socdr.imsi));
4486 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(socdr.imei));
4487 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", socdr.msisdnlen);
4488 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(socdr.msisdn, 10));
4489 proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
4490 proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", socdr.msclass_caplen);
4492 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", socdr.msclass_cap);
4493 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4494 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, socdr.cap);
4495 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+46, 1, socdr.cap);
4496 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+46, 1, socdr.cap);
4497 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+46, 1, socdr.cap);
4498 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+46, 1, socdr.cap);
4499 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+46, 1, socdr.cap);
4501 proto_tree_add_text(cdr_tree, tvb, offset+47, 2, "MS network capability omitted: %u", stcdr.msclass_capomit);
4502 proto_tree_add_text(cdr_tree, tvb, offset+49, 9, "SMSC E.164 address: %s", msisdn_to_str(socdr.serv_centr, 9));
4503 proto_tree_add_text(cdr_tree, tvb, offset+58, 9, "SGSN E.164 address: %s", msisdn_to_str(socdr.rec_ent, 9));
4504 proto_tree_add_text(cdr_tree, tvb, offset+67, 2, "LAC: %u", socdr.lac);
4505 proto_tree_add_text(cdr_tree, tvb, offset+69, 1, "RAC: %u", socdr.rac);
4506 proto_tree_add_text(cdr_tree, tvb, offset+70, 2, "Cell ID: %u", socdr.cid);
4507 proto_tree_add_text(cdr_tree, tvb, offset+72, 4, "Time1: %s", time_int_to_str(socdr.time1));
4508 proto_tree_add_text(cdr_tree, tvb, offset+76, 4, "Time2: %s", time_int_to_str(socdr.time2));
4509 proto_tree_add_text(cdr_tree, tvb, offset+80, 1, "Message reference: %u", socdr.messref);
4510 proto_tree_add_text(cdr_tree, tvb, offset+81, 2, "Delivery result: %u", socdr.smsres);
4513 case 0x16: /* STCDR */
4514 if (tvb_length_remaining(tvb, offset) < 3 + 79) {
4515 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "STCDR fragmented, can't dissect");
4519 stcdr.len = tvb_get_ntohs(tvb, offset+3);
4520 stcdr.imsilen = tvb_get_guint8(tvb, offset+5);
4521 tvb_memcpy(tvb, stcdr.imsi, offset+6, 8);
4522 tvb_memcpy(tvb, stcdr.imei, offset+14, 8);
4523 stcdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4524 tvb_memcpy(tvb, stcdr.msisdn, offset+23, 10);
4525 tvb_memcpy(tvb, stcdr.msclass_notused, offset+33, 12);
4526 stcdr.msclass_caplen = tvb_get_guint8(tvb, offset+45);
4527 stcdr.msclass_cap = tvb_get_guint8(tvb, offset+46);
4528 stcdr.msclass_capomit = tvb_get_ntohs(tvb, offset+47);
4529 tvb_memcpy(tvb, stcdr.serv_centr, offset+49, 9);
4530 tvb_memcpy(tvb, stcdr.rec_ent, offset+58, 9);
4531 stcdr.lac = tvb_get_ntohs(tvb, offset+67);
4532 stcdr.rac = tvb_get_guint8(tvb, offset+69);
4533 stcdr.cid = tvb_get_ntohs(tvb, offset+70);
4534 stcdr.time1 = tvb_get_ntohl(tvb, offset+72);
4535 stcdr.time2 = tvb_get_ntohl(tvb, offset+76);
4536 stcdr.smsres = tvb_get_ntohs(tvb, offset+80);
4538 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "STCDR (0x16)");
4539 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4540 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4541 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4542 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", stcdr.len);
4543 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", stcdr.imsilen);
4544 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(stcdr.imsi));
4545 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(stcdr.imei));
4546 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", stcdr.msisdnlen);
4547 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(stcdr.msisdn, 10));
4548 proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
4549 proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", stcdr.msclass_caplen);
4551 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", stcdr.msclass_cap);
4552 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4553 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, stcdr.cap);
4554 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+46, 1, stcdr.cap);
4555 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+46, 1, stcdr.cap);
4556 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+46, 1, stcdr.cap);
4557 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+46, 1, stcdr.cap);
4558 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+46, 1, stcdr.cap);
4560 proto_tree_add_text(cdr_tree, tvb, offset+47, 2, "MS network capability omitted: %u", stcdr.msclass_capomit);
4561 proto_tree_add_text(cdr_tree, tvb, offset+49, 9, "SMSC E.164 address: %s", msisdn_to_str(stcdr.serv_centr, 9));
4562 proto_tree_add_text(cdr_tree, tvb, offset+58, 9, "SGSN E.164 address: %s", msisdn_to_str(stcdr.rec_ent, 9));
4563 proto_tree_add_text(cdr_tree, tvb, offset+67, 2, "LAC: %u", stcdr.lac);
4564 proto_tree_add_text(cdr_tree, tvb, offset+69, 1, "RAC: %u", stcdr.rac);
4565 proto_tree_add_text(cdr_tree, tvb, offset+70, 2, "Cell ID: %u", stcdr.cid);
4566 proto_tree_add_text(cdr_tree, tvb, offset+72, 4, "Time1: %s", time_int_to_str(stcdr.time1));
4567 proto_tree_add_text(cdr_tree, tvb, offset+76, 4, "Time2: %s", time_int_to_str(stcdr.time2));
4568 proto_tree_add_text(cdr_tree, tvb, offset+80, 2, "Delivery result: %u", stcdr.smsres);
4571 offset = offset + 2 + data_len;
4581 decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4583 guint16 length, n, number;
4584 proto_tree *ext_tree_data_resp;
4587 length = tvb_get_ntohs(tvb, offset + 1);
4589 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
4590 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
4594 while (n < length) {
4596 number = tvb_get_ntohs(tvb, offset + 3 + n);
4597 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
4610 decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4614 struct e_in6_addr addr_ipv6;
4615 proto_tree *ext_tree_node_addr;
4618 length = tvb_get_ntohs(tvb, offset+1);
4620 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Node address: ");
4621 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
4623 proto_tree_add_text(ext_tree_node_addr, tvb, offset+1, 2, "Node address length: %u", length);
4627 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
4628 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4629 proto_tree_add_ipv4(ext_tree_node_addr, gtp_version ? hf_gtpv1_node_ipv4 : hf_gtpv0_node_ipv4, tvb, offset+3, 4, addr_ipv4);
4632 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
4633 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4634 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);
4637 proto_item_append_text(te, "unknown type or wrong length");
4645 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
4646 * UMTS: 29.060 v4.0, chapter 7.7.44
4649 decode_gtp_priv_ext(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4651 guint16 length, ext_id;
4653 proto_tree *ext_tree_priv_ext;
4656 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_PRIV_EXT, gtp_val, "Unknown message"));
4657 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
4659 length = tvb_get_ntohs(tvb, offset+1);
4660 if (length < 1) return 3+length;
4662 ext_id = tvb_get_ntohs(tvb, offset+3);
4663 tvb_memcpy(tvb, ext_val, offset+5, length > 65 ? 63 : length-2);
4664 ext_val[length > 65 ? 64 : length-1] = '\0';
4665 proto_tree_add_uint(ext_tree_priv_ext, gtp_version ? hf_gtpv1_ext_id : hf_gtpv0_ext_id, tvb, offset+3, 2, ext_id);
4666 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);
4672 decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
4674 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
4676 return tvb_length_remaining(tvb, offset);
4680 dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4683 _gtpv0_hdr gtpv0_hdr;
4684 proto_item *ti, *tf;
4685 proto_tree *gtpv0_tree, *flags_tree;
4688 const guint8 *tid_val;
4690 int offset, length, i, mandatory, checked_field;
4692 if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "GTP");
4693 if (check_col(pinfo->fd, COL_INFO)) col_clear(pinfo->fd, COL_INFO);
4695 tvb_memcpy(tvb, (guint8 *)>pv0_hdr, 0, 12);
4696 tid_val = tvb_get_ptr(tvb, 12, 8);
4697 tid_str = id_to_str(tid_val);
4698 gtp_version = (gtpv0_hdr.flags >> 5) & 0x07;
4700 if (!((gtpv0_hdr.flags >> 4) & 1)) {
4701 if (check_col(pinfo->fd, COL_PROTOCOL))
4702 col_set_str(pinfo->fd, COL_PROTOCOL, "GTP-CDR");
4704 switch ((gtpv0_hdr.flags >> 5) & 0x07) {
4705 case 0: if (check_col(pinfo->fd, COL_PROTOCOL))
4706 col_set_str(pinfo->fd, COL_PROTOCOL, "GTP");
4708 case 1: if (check_col(pinfo->fd, COL_PROTOCOL))
4709 col_set_str(pinfo->fd, COL_PROTOCOL, "GTPv1");
4710 default: if (check_col(pinfo->fd, COL_PROTOCOL))
4711 col_set_str(pinfo->fd, COL_PROTOCOL, "GTPv?");
4716 if (check_col(pinfo->fd, COL_INFO)) col_add_str(pinfo->fd, COL_INFO, val_to_str(gtpv0_hdr.message, message_type, "Unknown"));
4720 /* dissect GTP header */
4721 ti = proto_tree_add_item(tree, proto_gtpv0, tvb, 0, tvb_length(tvb), FALSE);
4722 gtpv0_tree = proto_item_add_subtree(ti, ett_gtp);
4724 tf = proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flags, tvb, 0, 1, gtpv0_hdr.flags);
4726 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
4727 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_ver, tvb, 0, 1, gtpv0_hdr.flags);
4728 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_pt, tvb, 0, 1, gtpv0_hdr.flags);
4729 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_spare, tvb, 0, 1, gtpv0_hdr.flags);
4730 proto_tree_add_boolean(flags_tree, hf_gtpv0_flags_snn, tvb, 0, 1, gtpv0_hdr.flags);
4732 gtpv0_hdr.length = ntohs(gtpv0_hdr.length);
4733 gtpv0_hdr.seq_no = ntohs(gtpv0_hdr.seq_no);
4734 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_message_type, tvb, 1, 1, gtpv0_hdr.message);
4735 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_length, tvb, 2, 2, gtpv0_hdr.length);
4736 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_seq_number, tvb, 4, 2, gtpv0_hdr.seq_no);
4737 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flow_label, tvb, 6, 2, gtpv0_hdr.flow_label);
4738 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_sndcp_number, tvb, 8, 1, gtpv0_hdr.sndcp_no);
4739 proto_tree_add_string(gtpv0_tree, hf_gtpv0_tid, tvb, 12, 8, tid_str);
4741 if (gtpv0_hdr.message != GTP_MSG_TPDU) {
4743 proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[--- end of GTPv0 header, beginning of extension headers ---]");
4745 offset = GTPv0_HDR_LENGTH;
4746 length = tvb_length(tvb);
4748 mandatory = 0; /* check order of GTP fields against ETSI */
4752 if (offset >= length) break;
4753 ext_hdr_val = tvb_get_guint8(tvb, offset);
4755 if (gtpv0_etsi_order) {
4756 checked_field = check_field_presence (gtpv0_hdr.message, ext_hdr_val , (int *)&mandatory);
4757 switch (checked_field) {
4758 case -2: proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[WARNING] message not found");
4760 case -1: proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[WARNING] field not present");
4763 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"));
4768 while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
4769 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv0_tree);
4774 /* next part dissects sublayers of GTP
4775 * right now it's only IP */
4777 if ((gtpv0_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
4778 next_tvb = tvb_new_subset(tvb, 20, -1, -1);
4779 call_dissector(ip_handle, next_tvb, pinfo, tree);
4780 if (check_col(pinfo->fd, COL_PROTOCOL)) col_append_str_gtp(pinfo->fd, COL_PROTOCOL, "GTP");
4785 /* GTP v1 dissector */
4787 dissect_gtpv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
4789 _gtpv1_hdr gtpv1_hdr;
4790 proto_item *ti, *tf;
4791 proto_tree *gtpv1_tree, *flags_tree;
4793 guint8 ext_hdr_val, i, hdr_offset = 4, next_hdr, npdu_no, probe;
4795 int offset, length, mandatory, checked_field;
4797 if (check_col(pinfo->fd, COL_PROTOCOL)) col_set_str(pinfo->fd, COL_PROTOCOL, "GTP-C");
4798 if (check_col(pinfo->fd, COL_INFO)) col_clear(pinfo->fd, COL_INFO);
4800 tvb_memcpy(tvb, (guint8 *)>pv1_hdr, 0, 8);
4801 gtp_version = (gtpv1_hdr.flags >> 5) & 0x07;
4803 if (check_col(pinfo->fd, COL_INFO)) col_add_str(pinfo->fd, COL_INFO, val_to_str(gtpv1_hdr.message, message_type, "Unknown"));
4807 ti = proto_tree_add_item(tree, proto_gtpv1, tvb, 0, tvb_length(tvb), FALSE);
4808 gtpv1_tree = proto_item_add_subtree(ti, ett_gtp);
4810 tf = proto_tree_add_uint(gtpv1_tree, hf_gtpv1_flags, tvb, 0, 1, gtpv1_hdr.flags);
4811 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
4813 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_ver, tvb, 0, 1, gtpv1_hdr.flags);
4814 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_pt, tvb, 0, 1, gtpv1_hdr.flags);
4815 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_spare, tvb, 0, 1, gtpv1_hdr.flags);
4816 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_e, tvb, 0, 1, gtpv1_hdr.flags);
4817 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_s, tvb, 0, 1, gtpv1_hdr.flags);
4818 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_pn, tvb, 0, 1, gtpv1_hdr.flags);
4820 gtpv1_hdr.length = ntohs(gtpv1_hdr.length);
4821 gtpv1_hdr.teid = ntohl(gtpv1_hdr.teid);
4823 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_message_type, tvb, 1, 1, gtpv1_hdr.message);
4824 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_length, tvb, 2, 2, gtpv1_hdr.length);
4825 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_teid, tvb, 4, 4, gtpv1_hdr.teid);
4829 if (gtpv1_hdr.flags & 0x02) {
4830 seq_no = tvb_get_ntohs(tvb, 8);
4831 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_seq_number, tvb, 8, 2, seq_no);
4833 hdr_offset = hdr_offset + 2;
4836 if ((gtpv1_hdr.flags & 0x01 ) || (gtpv1_hdr.message != 0xFF)) {
4837 npdu_no = tvb_get_guint8(tvb, 10 - hdr_offset);
4838 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_npdu_number, tvb, 10 - hdr_offset, 1, npdu_no);
4840 hdr_offset = hdr_offset + 1;
4843 if ((gtpv1_hdr.flags & 0x04) || (gtpv1_hdr.message != 0xFF)) {
4844 next_hdr = tvb_get_guint8(tvb, 11 - hdr_offset);
4845 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_next, tvb, 11 - hdr_offset, 1, next_hdr);
4847 hdr_offset = hdr_offset + 1;
4850 if (gtpv1_hdr.message != GTP_MSG_TPDU) {
4852 proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[--- end of GTP v1 header, beginning of extension headers ---]");
4854 offset = GTPv1_HDR_LENGTH - hdr_offset;
4855 length = tvb_length(tvb);
4857 mandatory = 0; /* check order of GTP fields against ETSI */
4861 if (offset >= length) break;
4862 ext_hdr_val = tvb_get_guint8(tvb, offset);
4864 if (gtpv1_etsi_order) {
4865 checked_field = check_field_presence (gtpv1_hdr.message, ext_hdr_val , (int *)&mandatory);
4866 switch (checked_field) {
4867 case -2: proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[WARNING] message not found");
4869 case -1: proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[WARNING] field not present");
4872 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"));
4877 while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
4878 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv1_tree);
4883 if (gtpv1_hdr.message == GTP_MSG_ERR_IND)
4884 if (check_col(pinfo->fd, COL_PROTOCOL)) col_add_str(pinfo->fd, COL_PROTOCOL, "GTP-U");
4887 if ((gtpv1_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
4889 hdr_offset = (gtpv1_hdr.flags & 0x02) ? 0 : 2;
4891 /* some stupid checking, because some vendors do not respect
4892 * ETSI recommendation */
4894 probe = tvb_get_guint8(tvb, 10 - hdr_offset);
4896 probe = tvb_get_guint8(tvb, 11 - hdr_offset);
4897 if (probe != 0) hdr_offset++;
4899 hdr_offset = hdr_offset + 2;
4902 next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset, -1, -1);
4903 call_dissector(ip_handle, next_tvb, pinfo, tree);
4904 if (check_col(pinfo->fd, COL_PROTOCOL)) col_append_str_gtp(pinfo->fd, COL_PROTOCOL, "GTP-U");
4908 static const true_false_string yes_no_tfs = {
4914 proto_register_gtp(void)
4917 static hf_register_info hf_gtpv0[] = {
4919 { &hf_gtpv0_flags, { "Flags", "gtpv0.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare/SNN", HFILL }},
4920 { &hf_gtpv0_flags_ver, { "Version", "gtpv0.flags.version", FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, "GTP Version", HFILL }},
4921 { &hf_gtpv0_flags_pt, { "Protocol type", "gtpv0.flags.payload", FT_UINT8, BASE_DEC, NULL, GTP_PT_MASK, "Protocol Type (1 = GTP, 0 = GTP' )", HFILL }},
4922 { &hf_gtpv0_flags_spare, { "Reserved", "gtpv0.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE_MASK, "Reserved (shall be sent as '111' )", HFILL }},
4923 { &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 }},
4924 { &hf_gtpv0_message_type, { "Message type", "gtpv0.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
4925 { &hf_gtpv0_length, { "Length", "gtpv0.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
4926 { &hf_gtpv0_seq_number, { "Sequence number", "gtpv0.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
4927 { &hf_gtpv0_flow_label, { "Flow label", "gtpv0.flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label", HFILL }},
4928 { &hf_gtpv0_sndcp_number, { "SNDCP N-PDU LLC Number", "gtpv0.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, "SNDCP N-PDU LLC Number", HFILL }},
4929 { &hf_gtpv0_tid, { "TID", "gtpv0.tid", FT_STRING, BASE_DEC, NULL, 0, "Tunnel Identifier", HFILL }},
4930 { &hf_gtpv0_cause, { "Cause", "gtpv0.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
4931 { &hf_gtpv0_imsi, { "IMSI", "gtpv0.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
4932 { &hf_gtpv0_rai_mcc, { "MCC", "gtpv0.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
4933 { &hf_gtpv0_rai_mnc, { "MNC", "gtpv0.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
4934 { &hf_gtpv0_rai_rac, { "RAC", "gtpv0.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
4935 { &hf_gtpv0_rai_lac, { "LAC", "gtpv0.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
4936 { &hf_gtpv0_tlli, { "TLLI", "gtpv0.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
4937 { &hf_gtpv0_ptmsi, { "P-TMSI", "gtpv0.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
4938 { &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 }},
4939 { &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 }},
4940 { &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 }},
4941 { &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 }},
4942 { &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 }},
4943 { &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 }},
4944 { &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 }},
4945 { &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 }},
4946 { &hf_gtpv0_reorder, { "Reordering required","gtpv0.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
4947 { &hf_gtpv0_map_cause, { "MAP cause", "gtpv0.map_cause", FT_UINT8, BASE_DEC, VALS(map_cause_type), 0, "MAP cause", HFILL }},
4948 { &hf_gtpv0_ptmsi_sig, { "P-TMSI signature", "gtpv0.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
4949 { &hf_gtpv0_ms_valid, { "MS validated", "gtpv0.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
4950 { &hf_gtpv0_recovery, { "Recovery", "gtpv0.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
4951 { &hf_gtpv0_sel_mode, { "Selection mode", "gtpv0.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
4952 { &hf_gtpv0_ext_flow_label, { "Flow Label Data I", "gtpv0.ext_flow_label", FT_UINT16, BASE_DEC, NULL, 0, "Flow label data", HFILL }},
4953 { &hf_gtpv0_flow_sig, { "Flow label Signalling", "gtpv0.flow_sig", FT_UINT16, BASE_DEC, NULL, 0, "Flow label signalling", HFILL }},
4954 { &hf_gtpv0_nsapi, { "NSAPI ", "gtpv0.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
4955 { &hf_gtpv0_flow_ii, { "Flow Label Data II ","gtpv0.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL }},
4956 { &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 }},
4957 { &hf_gtpv0_tr_comm, { "Packet transfer command", "gtpv0.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL }},
4958 { &hf_gtpv0_chrg_id, { "Charging ID ", "gtpv0.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
4959 { &hf_gtpv0_user_ipv4, { "End user address IPv4", "gtpv0.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
4960 { &hf_gtpv0_user_ipv6, { "End user address IPv6", "gtpv0.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
4961 { &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 }},
4962 { &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 }},
4963 { &hf_gtpv0_apn, { "APN", "gtpv0.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
4964 { &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 }},
4965 { &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 }},
4966 { &hf_gtpv0_gsn_ipv4, { "GSN address IPv4", "gtpv0.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
4967 { &hf_gtpv0_gsn_ipv6, { "GSN address IPv6", "gtpv0.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
4968 { &hf_gtpv0_msisdn, { "MSISDN", "gtpv0.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
4969 { &hf_gtpv0_chrg_ipv4, { "CG address IPv4", "gtpv0.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
4970 { &hf_gtpv0_chrg_ipv6, { "CG address IPv6", "gtpv0.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
4971 { &hf_gtpv0_node_ipv4, { "Node address IPv4", "gtpv0.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
4972 { &hf_gtpv0_node_ipv6, { "Node address IPv6", "gtpv0.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
4973 { &hf_gtpv0_ext_id, { "Extension identifier", "gtpv0.ext_id", FT_UINT16, BASE_DEC, NULL, 0, "Extension Identifier", HFILL }},
4974 { &hf_gtpv0_ext_val, { "Extension value", "gtpv0.ext_val", FT_STRING, BASE_DEC, NULL, 0, "Extension Value", HFILL }},
4975 { &hf_gtpv0_unknown, { "Unknown data (length)", "gtpv0.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
4980 static hf_register_info hf_gtpv1[] = {
4982 { &hf_gtpv1_flags, { "Flags", "gtpv1.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare/E/S/PN", HFILL }},
4983 { &hf_gtpv1_flags_ver, { "Version", "gtpv1.flags.version", FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, "GTP Version", HFILL }},
4984 { &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 }},
4985 { &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 }},
4986 { &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 }},
4987 { &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 }},
4988 { &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 }},
4989 { &hf_gtpv1_message_type, { "Message Type", "gtpv1.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
4990 { &hf_gtpv1_length, { "Length", "gtpv1.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
4991 { &hf_gtpv1_seq_number, { "Sequence Number", "gtpv1.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
4992 { &hf_gtpv1_teid, { "TEID", "gtpv1.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL }},
4993 { &hf_gtpv1_npdu_number, { "N-PDU Number", "gtpv1.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, "N-PDU Number", HFILL }},
4994 { &hf_gtpv1_next, { "Next extension header type", "gtpv1.next", FT_UINT8, BASE_HEX, NULL, 0, "Next Extension Header Type", HFILL }},
4995 { &hf_gtpv1_cause, { "Cause ", "gtpv1.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
4996 { &hf_gtpv1_imsi, { "IMSI", "gtpv1.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
4997 { &hf_gtpv1_rai_mcc, { "MCC", "gtpv1.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
4998 { &hf_gtpv1_rai_mnc, { "MNC", "gtpv1.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
4999 { &hf_gtpv1_rai_rac, { "RAC", "gtpv1.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
5000 { &hf_gtpv1_rai_lac, { "LAC", "gtpv1.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
5001 { &hf_gtpv1_tlli, { "TLLI", "gtpv1.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
5002 { &hf_gtpv1_ptmsi, { "P-TMSI", "gtpv1.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
5003 { &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 }},
5004 { &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 }},
5005 { &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 }},
5006 { &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 }},
5007 { &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 }},
5008 { &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 }},
5009 { &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 }},
5010 { &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 }},
5011 { &hf_gtpv1_reorder, { "Reordering required","gtpv1.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
5012 { &hf_gtpv1_map_cause, { "MAP cause", "gtpv1.map_cause", FT_UINT8, BASE_DEC, VALS(map_cause_type), 0, "MAP cause", HFILL }},
5013 { &hf_gtpv1_ptmsi_sig, { "P-TMSI Signature", "gtpv1.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
5014 { &hf_gtpv1_ms_valid, { "MS validated", "gtpv1.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
5015 { &hf_gtpv1_recovery, { "Recovery", "gtpv1.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
5016 { &hf_gtpv1_sel_mode, { "Selection Mode", "gtpv1.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
5017 { &hf_gtpv1_teid_data, { "TEID Data I", "gtpv1.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL }},
5018 { &hf_gtpv1_teid_cp, { "TEID Control Plane", "gtpv1.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL }},
5019 { &hf_gtpv1_nsapi, { "NSAPI", "gtpv1.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
5020 { &hf_gtpv1_teid_ii, { "TEID Data II", "gtpv1.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL }},
5021 { &hf_gtpv1_tear_ind, { "Teardown indication","gtpv1.tear_ind", FT_BOOLEAN, BASE_NONE,NULL, 0, "Teardown Indication", HFILL }},
5022 { &hf_gtpv1_ranap_cause, { "RANAP cause", "gtpv1.ranap_cause", FT_UINT8, BASE_DEC, VALS(ranap_cause_type), 0, "RANAP cause", HFILL }},
5023 { &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 }},
5024 { &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 }},
5025 { &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 }},
5026 { &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 }},
5027 { &hf_gtpv1_rp_sms, { "Radio Priority SMS", "gtpv1.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL }},
5028 { &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 }},
5029 { &hf_gtpv1_rp_spare, { "Reserved", "gtpv1.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL }},
5030 { &hf_gtpv1_rp, { "Radio Priority", "gtpv1.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL }},
5031 { &hf_gtpv1_pkt_flow_id, { "Packet Flow ID", "gtpv1.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, "Packet Flow ID", HFILL }},
5032 { &hf_gtpv1_chrg_char_s, { "Spare", "gtpv1.chrg_char_s", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, "Spare", HFILL }},
5033 { &hf_gtpv1_chrg_char_n, { "Normal charging", "gtpv1.chrg_char_n", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, "Normal charging", HFILL }},
5034 { &hf_gtpv1_chrg_char_p, { "Prepaid charging", "gtpv1.chrg_char_p", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, "Prepaid charging", HFILL }},
5035 { &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 }},
5036 { &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 }},
5037 { &hf_gtpv1_chrg_char_r, { "Reserved", "gtpv1.chrg_char_r", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, "Reserved", HFILL }},
5038 { &hf_gtpv1_trace_ref, { "Trace reference", "gtpv1.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, "Trace reference", HFILL }},
5039 { &hf_gtpv1_trace_type, { "Trace type", "gtpv1.trace_type", FT_UINT16, BASE_HEX, NULL, 0, "Trace type", HFILL }},
5040 { &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 }},
5041 { &hf_gtpv1_tr_comm, { "Packet transfer command", "gtpv1.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL }},
5042 { &hf_gtpv1_chrg_id, { "Charging ID", "gtpv1.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
5043 { &hf_gtpv1_user_ipv4, { "End user address IPv4", "gtpv1.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
5044 { &hf_gtpv1_user_ipv6, { "End user address IPv6", "gtpv1.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
5045 { &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 }},
5046 { &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 }},
5047 { &hf_gtpv1_apn, { "APN", "gtpv1.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
5048 { &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 }},
5049 { &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 }},
5050 { &hf_gtpv1_gsn_ipv4, { "GSN address IPv4", "gtpv1.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
5051 { &hf_gtpv1_gsn_ipv6, { "GSN address IPv6", "gtpv1.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
5052 { &hf_gtpv1_msisdn, { "MSISDN", "gtpv1.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
5053 { &hf_gtpv1_qos_al_ret_priority, { "Allocation/Retention priority ","gtpv1.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, "Allocation/Retention Priority", HFILL }},
5054 { &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 }},
5055 { &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 }},
5056 { &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 }},
5057 { &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 }},
5058 { &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 }},
5059 { &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 }},
5060 { &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 }},
5061 { &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 }},
5062 { &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 }},
5063 { &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 }},
5064 { &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 }},
5065 { &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 }},
5066 { &hf_gtpv1_rnc_ipv4, { "RNC address IPv4", "gtpv1.rnc_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Radio Network Controller address IPv4", HFILL }},
5067 { &hf_gtpv1_rnc_ipv6, { "RNC address IPv6", "gtpv1.rnc_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Radio Network Controller address IPv6", HFILL }},
5068 { &hf_gtpv1_chrg_ipv4, { "CG address IPv4", "gtpv1.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
5069 { &hf_gtpv1_chrg_ipv6, { "CG address IPv6", "gtpv1.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
5070 { &hf_gtpv1_node_ipv4, { "Node address IPv4", "gtpv1.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
5071 { &hf_gtpv1_node_ipv6, { "Node address IPv6", "gtpv1.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
5072 { &hf_gtpv1_ext_id, { "Extensio Identifier","gtpv1.ext_id", FT_UINT16, BASE_DEC, NULL, 0, "Extension Identifier", HFILL }},
5073 { &hf_gtpv1_ext_val, { "Extension Value", "gtpv1.ext_val", FT_STRING, BASE_DEC, NULL, 0, "Extension Value", HFILL }},
5074 { &hf_gtpv1_unknown, { "Unknown data (length)", "gtpv1.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
5078 static gint *ett_gtp_array[] = {
5088 &ett_gtp_pkt_flow_id,
5110 module_t *gtp_module;
5112 static enum_val_t gtpv0_cdr_options[] = {
5119 proto_gtpv0 = proto_register_protocol("GPRS Tunnelling Protocol v0", "GTPv0", "gtpv0");
5120 proto_register_field_array(proto_gtpv0, hf_gtpv0, array_length(hf_gtpv0));
5121 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
5123 proto_gtpv1 = proto_register_protocol("GPRS Tunnelling Protocol v1", "GTPv1", "gtpv1");
5124 proto_register_field_array(proto_gtpv1, hf_gtpv1, array_length(hf_gtpv1));
5125 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
5127 gtp_module = prefs_register_protocol(proto_gtpv0, proto_reg_handoff_gtp);
5129 prefs_register_uint_preference(gtp_module, "gtpv0_port", "GTPv0 port ", "GTPv0 port (default 3386)", 10, &g_gtpv0_port);
5130 prefs_register_uint_preference(gtp_module, "gtpv1c_port", "GTPv1 control plane (GTP-C) port ", "GTPv1 control plane port (default 2123)", 10, &g_gtpv1c_port);
5131 prefs_register_uint_preference(gtp_module, "gtpv1u_port", "GTPv1 user plane (GTP-U) port ", "GTPv1 user plane port (default 2152)", 10, &g_gtpv1u_port);
5132 prefs_register_bool_preference(gtp_module, "gtp_dissect_tpdu", "Dissect T-PDU ", "Dissect T-PDU", >p_tpdu);
5133 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);
5134 prefs_register_bool_preference(gtp_module, "gtpv0_check_etsi", "Compare GTPv0 order with ETSI ", "GTPv0 ETSI order", >pv0_etsi_order);
5135 prefs_register_bool_preference(gtp_module, "gtpv1_check_etsi", "Compare GTPv1 order with ETSI ", "GTPv1 ETSI order", >pv1_etsi_order);
5136 prefs_register_bool_preference(gtp_module, "ppp_reorder", "Reorder & dissect PPP in Protocol conf. options", "PPP reorder & dissect", &ppp_reorder);
5138 register_dissector("gtpv0", dissect_gtpv0, proto_gtpv0);
5139 register_dissector("gtpv1", dissect_gtpv1, proto_gtpv1);
5144 proto_reg_handoff_gtp(void)
5146 static int Initialized = FALSE;
5147 static dissector_handle_t gtpv0_handle;
5148 static dissector_handle_t gtpv1_handle;
5152 gtpv0_handle = find_dissector("gtpv0");
5154 gtpv1_handle = find_dissector("gtpv1");
5160 dissector_delete("udp.port", gtpv0_port, gtpv0_handle);
5161 dissector_delete("tcp.port", gtpv0_port, gtpv0_handle);
5163 dissector_delete("udp.port", gtpv1c_port, gtpv1_handle);
5164 dissector_delete("tcp.port", gtpv1c_port, gtpv1_handle);
5165 dissector_delete("udp.port", gtpv1u_port, gtpv1_handle);
5166 dissector_delete("tcp.port", gtpv1u_port, gtpv1_handle);
5169 gtpv0_port = g_gtpv0_port;
5170 gtpv1c_port = g_gtpv1c_port;
5171 gtpv1u_port = g_gtpv1u_port;
5175 dissector_add("udp.port", g_gtpv0_port, gtpv0_handle);
5176 dissector_add("tcp.port", g_gtpv0_port, gtpv0_handle);
5180 dissector_add("udp.port", g_gtpv1c_port, gtpv1_handle);
5181 dissector_add("tcp.port", g_gtpv1c_port, gtpv1_handle);
5182 dissector_add("udp.port", g_gtpv1u_port, gtpv1_handle);
5183 dissector_add("tcp.port", g_gtpv1u_port, gtpv1_handle);
5185 ip_handle = find_dissector("ip");
5186 ppp_handle = find_dissector("ppp");