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.56 2003/08/26 05:52:45 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.
38 #include <epan/packet.h>
40 #include "packet-gtp.h"
41 #include "packet-ipv6.h"
42 #include "packet-ppp.h"
44 static dissector_table_t ppp_subdissector_table;
47 * All data related to GTP v0 (GPRS) uses "gtpv0" or "GTPv0",
48 * all data related to GTP v1 (UMTS) uses "gtpv1" or "GTPv1",
49 * if there is any gtp alone statement it means that this data is common
50 * for both: GPRS and UMTS
53 #define GTPv0_PORT 3386
54 #define GTPv1C_PORT 2123 /* 3G Control PDU */
55 #define GTPv1U_PORT 2152 /* 3G T-PDU */
57 #define GTPv0_HDR_LENGTH 20
58 #define GTPv1_HDR_LENGTH 12
59 #define GTP_PRIME_HDR_LENGTH 6
61 /* for function checking compliance with ETSI */
62 #define GTP_MANDATORY 1
63 #define GTP_OPTIONAL 2
64 #define GTP_CONDITIONAL 4
66 static int g_gtpv0_port = GTPv0_PORT;
67 static int g_gtpv1c_port = GTPv1C_PORT;
68 static int g_gtpv1u_port = GTPv1U_PORT;
70 void proto_reg_handoff_gtp(void);
72 static int proto_gtp = -1;
73 static int proto_gtpv0 = -1;
74 static int proto_gtpv1 = -1;
76 static int hf_gtpv0_flags = -1;
77 static int hf_gtpv0_flags_ver = -1;
78 static int hf_gtpv0_flags_pt = -1;
79 static int hf_gtpv0_flags_spare = -1;
80 #ifdef GTP_UNUSED_HANDLES
81 static int hf_gtpv0_flags_e = -1;
82 static int hf_gtpv0_flags_s = -1;
83 static int hf_gtpv0_flags_pn = -1;
85 static int hf_gtpv0_flags_snn = -1;
86 static int hf_gtpv0_message_type = -1;
87 static int hf_gtpv0_length = -1;
88 static int hf_gtpv0_seq_number = -1;
89 static int hf_gtpv0_flow_label = -1;
90 static int hf_gtpv0_sndcp_number = -1;
91 #ifdef GTP_UNUSED_HANDLES
92 static int hf_gtpv0_npdu_number = -1;
94 static int hf_gtpv0_tid = -1;
95 #ifdef GTP_UNUSED_HANDLES
96 static int hf_gtpv0_teid = -1;
97 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 #ifdef GTP_UNUSED_HANDLES
123 static int hf_gtpv0_teid_data = -1; /* 3G */
125 static int hf_gtpv0_flow_sig = -1;
126 #ifdef GTP_UNUSED_HANDLES
127 static int hf_gtpv0_teid_cp = -1; /* 3G */
129 static int hf_gtpv0_nsapi = -1;
130 static int hf_gtpv0_flow_ii = -1;
131 #ifdef GTP_UNUSED_HANDLES
132 static int hf_gtpv0_teid_ii = -1; /* 3G */
134 static int hf_gtpv0_ms_reason = -1;
135 #ifdef GTP_UNUSED_HANDLES
136 static int hf_gtpv0_tear_ind = -1; /* 3G */
137 static int hf_gtpv0_ranap_cause = -1; /* 3G */
138 static int hf_gtpv0_rab_gtpu_dn = -1; /* 3G */
139 static int hf_gtpv0_rab_gtpu_up = -1; /* 3G */
140 static int hf_gtpv0_rab_pdu_dn = -1; /* 3G */
141 static int hf_gtpv0_rab_pdu_up = -1; /* 3G */
142 static int hf_gtpv0_rp_sms = -1; /* 3G */
143 static int hf_gtpv0_rp_spare = -1; /* 3G */
144 static int hf_gtpv0_rp_nsapi = -1; /* 3G */
145 static int hf_gtpv0_rp = -1; /* 3G */
146 static int hf_gtpv0_pkt_flow_id = -1; /* 3G */
147 static int hf_gtpv0_chrg_char_s = -1; /* 3G */
148 static int hf_gtpv0_chrg_char_n = -1; /* 3G */
149 static int hf_gtpv0_chrg_char_p = -1; /* 3G */
150 static int hf_gtpv0_chrg_char_f = -1; /* 3G */
151 static int hf_gtpv0_chrg_char_h = -1; /* 3G */
152 static int hf_gtpv0_chrg_char_r = -1; /* 3G */
153 static int hf_gtpv0_trace_ref = -1; /* 3G */
154 static int hf_gtpv0_trace_type = -1; /* 3G */
156 static int hf_gtpv0_tr_comm = -1; /* charging */
157 static int hf_gtpv0_chrg_id = -1;
158 static int hf_gtpv0_user_ipv4 = -1;
159 static int hf_gtpv0_user_ipv6 = -1;
160 static int hf_gtpv0_user_addr_pdp_org = -1;
161 static int hf_gtpv0_user_addr_pdp_type = -1;
162 static int hf_gtpv0_apn = -1;
163 static int hf_gtpv0_gsn_ipv4 = -1;
164 static int hf_gtpv0_gsn_ipv6 = -1;
165 static int hf_gtpv0_gsn_addr_type = -1;
166 static int hf_gtpv0_gsn_addr_len = -1;
167 static int hf_gtpv0_msisdn = -1;
168 #ifdef GTP_UNUSED_HANDLES
169 static int hf_gtpv0_qos_al_ret_priority = -1;
170 static int hf_gtpv0_qos_traf_class = -1;
171 static int hf_gtpv0_qos_del_order = -1;
172 static int hf_gtpv0_qos_del_err_sdu = -1;
173 static int hf_gtpv0_qos_max_sdu_size = -1;
174 static int hf_gtpv0_qos_max_ul = -1;
175 static int hf_gtpv0_qos_max_dl = -1;
176 static int hf_gtpv0_qos_res_ber = -1;
177 static int hf_gtpv0_qos_sdu_err_ratio = -1;
178 static int hf_gtpv0_qos_trans_delay = -1;
179 static int hf_gtpv0_qos_traf_handl_prio = -1;
180 static int hf_gtpv0_qos_guar_ul = -1;
181 static int hf_gtpv0_qos_guar_dl = -1;
182 static int hf_gtpv0_rnc_ipv4 = -1;
183 static int hf_gtpv0_rnc_ipv6 = -1;
185 static int hf_gtpv0_chrg_ipv4 = -1;
186 static int hf_gtpv0_chrg_ipv6 = -1;
187 static int hf_gtpv0_node_ipv4 = -1;
188 static int hf_gtpv0_node_ipv6 = -1;
189 static int hf_gtpv0_ext_id = -1;
190 static int hf_gtpv0_ext_val = -1;
191 static int hf_gtpv0_unknown = -1;
193 static int hf_gtpv1_flags = -1;
194 static int hf_gtpv1_flags_ver = -1;
195 static int hf_gtpv1_flags_pt = -1;
196 static int hf_gtpv1_flags_spare = -1;
197 static int hf_gtpv1_flags_e = -1;
198 static int hf_gtpv1_flags_s = -1;
199 static int hf_gtpv1_flags_pn = -1;
200 #ifdef GTP_UNUSED_HANDLES
201 static int hf_gtpv1_flags_snn = -1;
203 static int hf_gtpv1_message_type = -1;
204 static int hf_gtpv1_length = -1;
205 static int hf_gtpv1_seq_number = -1;
206 #ifdef GTP_UNUSED_HANDLES
207 static int hf_gtpv1_flow_label = -1;
208 static int hf_gtpv1_sndcp_number = -1;
210 static int hf_gtpv1_npdu_number = -1;
211 #ifdef GTP_UNUSED_HANDLES
212 static int hf_gtpv1_tid = -1;
214 static int hf_gtpv1_teid = -1;
215 static int hf_gtpv1_next = -1;
216 static int hf_gtpv1_cause = -1;
217 static int hf_gtpv1_imsi = -1;
218 static int hf_gtpv1_rai_mcc = -1;
219 static int hf_gtpv1_rai_mnc = -1;
220 static int hf_gtpv1_rai_rac = -1;
221 static int hf_gtpv1_rai_lac = -1;
222 static int hf_gtpv1_tlli = -1;
223 static int hf_gtpv1_ptmsi = -1;
224 static int hf_gtpv1_qos_spare1 = -1;
225 static int hf_gtpv1_qos_delay = -1;
226 static int hf_gtpv1_qos_mean = -1;
227 static int hf_gtpv1_qos_peak = -1;
228 static int hf_gtpv1_qos_spare2 = -1;
229 static int hf_gtpv1_qos_precedence = -1;
230 static int hf_gtpv1_qos_spare3 = -1;
231 static int hf_gtpv1_qos_reliability = -1;
232 static int hf_gtpv1_reorder = -1;
233 static int hf_gtpv1_map_cause = -1;
234 static int hf_gtpv1_ptmsi_sig = -1;
235 static int hf_gtpv1_ms_valid = -1;
236 static int hf_gtpv1_recovery = -1;
237 static int hf_gtpv1_sel_mode = -1;
238 #ifdef GTP_UNUSED_HANDLES
239 static int hf_gtpv1_ext_flow_label = -1;
241 static int hf_gtpv1_teid_data = -1; /* 3G */
242 #ifdef GTP_UNUSED_HANDLES
243 static int hf_gtpv1_flow_sig = -1;
245 static int hf_gtpv1_teid_cp = -1; /* 3G */
246 static int hf_gtpv1_nsapi = -1;
247 #ifdef GTP_UNUSED_HANDLES
248 static int hf_gtpv1_flow_ii = -1;
250 static int hf_gtpv1_teid_ii = -1; /* 3G */
251 static int hf_gtpv1_ms_reason = -1;
252 static int hf_gtpv1_tear_ind = -1; /* 3G */
253 static int hf_gtpv1_ranap_cause = -1; /* 3G */
254 static int hf_gtpv1_rab_gtpu_dn = -1; /* 3G */
255 static int hf_gtpv1_rab_gtpu_up = -1; /* 3G */
256 static int hf_gtpv1_rab_pdu_dn = -1; /* 3G */
257 static int hf_gtpv1_rab_pdu_up = -1; /* 3G */
258 static int hf_gtpv1_rp_sms = -1; /* 3G */
259 static int hf_gtpv1_rp_spare = -1; /* 3G */
260 static int hf_gtpv1_rp_nsapi = -1; /* 3G */
261 static int hf_gtpv1_rp = -1; /* 3G */
262 static int hf_gtpv1_pkt_flow_id = -1; /* 3G */
263 static int hf_gtpv1_chrg_char_s = -1; /* 3G */
264 static int hf_gtpv1_chrg_char_n = -1; /* 3G */
265 static int hf_gtpv1_chrg_char_p = -1; /* 3G */
266 static int hf_gtpv1_chrg_char_f = -1; /* 3G */
267 static int hf_gtpv1_chrg_char_h = -1; /* 3G */
268 static int hf_gtpv1_chrg_char_r = -1; /* 3G */
269 static int hf_gtpv1_trace_ref = -1; /* 3G */
270 static int hf_gtpv1_trace_type = -1; /* 3G */
271 static int hf_gtpv1_tr_comm = -1; /* charging */
272 static int hf_gtpv1_chrg_id = -1;
273 static int hf_gtpv1_user_ipv4 = -1;
274 static int hf_gtpv1_user_ipv6 = -1;
275 static int hf_gtpv1_user_addr_pdp_org = -1;
276 static int hf_gtpv1_user_addr_pdp_type = -1;
277 static int hf_gtpv1_apn = -1;
278 static int hf_gtpv1_gsn_ipv4 = -1;
279 static int hf_gtpv1_gsn_ipv6 = -1;
280 static int hf_gtpv1_gsn_addr_type = -1;
281 static int hf_gtpv1_gsn_addr_len = -1;
282 static int hf_gtpv1_msisdn = -1;
283 static int hf_gtpv1_qos_al_ret_priority = -1;
284 static int hf_gtpv1_qos_traf_class = -1;
285 static int hf_gtpv1_qos_del_order = -1;
286 static int hf_gtpv1_qos_del_err_sdu = -1;
287 static int hf_gtpv1_qos_max_sdu_size = -1;
288 static int hf_gtpv1_qos_max_ul = -1;
289 static int hf_gtpv1_qos_max_dl = -1;
290 static int hf_gtpv1_qos_res_ber = -1;
291 static int hf_gtpv1_qos_sdu_err_ratio = -1;
292 static int hf_gtpv1_qos_trans_delay = -1;
293 static int hf_gtpv1_qos_traf_handl_prio = -1;
294 static int hf_gtpv1_qos_guar_ul = -1;
295 static int hf_gtpv1_qos_guar_dl = -1;
296 static int hf_gtpv1_tft_code = -1;
297 static int hf_gtpv1_tft_spare = -1;
298 static int hf_gtpv1_tft_number = -1;
299 static int hf_gtpv1_tft_eval = -1;
300 static int hf_gtpv1_rnc_ipv4 = -1;
301 static int hf_gtpv1_rnc_ipv6 = -1;
302 static int hf_gtpv1_chrg_ipv4 = -1;
303 static int hf_gtpv1_chrg_ipv6 = -1;
304 static int hf_gtpv1_node_ipv4 = -1;
305 static int hf_gtpv1_node_ipv6 = -1;
306 static int hf_gtpv1_ext_id = -1;
307 static int hf_gtpv1_ext_val = -1;
308 static int hf_gtpv1_unknown = -1;
310 /* Initialize the subtree pointers */
311 static gint ett_gtp = -1;
312 static gint ett_gtp_flags = -1;
313 static gint ett_gtp_ext = -1;
314 static gint ett_gtp_rai = -1;
315 static gint ett_gtp_qos = -1;
316 static gint ett_gtp_auth_tri = -1;
317 static gint ett_gtp_flow_ii = -1;
318 static gint ett_gtp_rab_cntxt = -1;
319 static gint ett_gtp_rp = -1;
320 static gint ett_gtp_pkt_flow_id = -1;
321 static gint ett_gtp_chrg_char = -1;
322 static gint ett_gtp_user = -1;
323 static gint ett_gtp_mm = -1;
324 static gint ett_gtp_trip = -1;
325 static gint ett_gtp_quint = -1;
326 static gint ett_gtp_pdp = -1;
327 static gint ett_gtp_apn = -1;
328 static gint ett_gtp_proto = -1;
329 static gint ett_gtp_gsn_addr = -1;
330 static gint ett_gtp_tft = -1;
331 static gint ett_gtp_tft_pf = -1;
332 static gint ett_gtp_tft_flags = -1;
333 static gint ett_gtp_rab_setup = -1;
334 static gint ett_gtp_hdr_list = -1;
335 static gint ett_gtp_chrg_addr = -1;
336 static gint ett_gtp_node_addr = -1;
337 static gint ett_gtp_rel_pack = -1;
338 static gint ett_gtp_can_pack = -1;
339 static gint ett_gtp_data_resp = -1;
340 static gint ett_gtp_priv_ext = -1;
342 /* Definition of user preferences panel fields */
343 #define DONT_DISSECT_CDRS 2
345 static gboolean gtp_tpdu = TRUE;
346 static gint gtpv0_cdr_as = DONT_DISSECT_CDRS; /* 2 = do not dissect */
347 static gboolean gtpv0_etsi_order = FALSE;
348 static gboolean gtpv1_etsi_order = FALSE;
349 static int gtpv0_port = 0;
350 static int gtpv1c_port = 0;
351 static int gtpv1u_port = 0;
353 /* Definition of flags masks */
354 #define GTP_VER_MASK 0xE0
356 static const value_string ver_types[] = {
357 { 0, "GTP release 97/98 version" },
358 { 1, "GTP release 99 version" },
368 #define GTP_PT_MASK 0x10
369 #define GTP_SPARE_MASK 0x0E
370 #define GTPv1_SPARE_MASK 0x08
371 #define GTPv1_E_MASK 0x04
372 #define GTPv1_S_MASK 0x02
373 #define GTP_SNN_MASK 0x01
374 #define GTPv1_PN_MASK 0x01
376 /* Definition of 3G charging characteristics masks */
377 #define GTP_MASK_CHRG_CHAR_S 0xF000
378 #define GTP_MASK_CHRG_CHAR_N 0x0800
379 #define GTP_MASK_CHRG_CHAR_P 0x0400
380 #define GTP_MASK_CHRG_CHAR_F 0x0200
381 #define GTP_MASK_CHRG_CHAR_H 0x0100
382 #define GTP_MASK_CHRG_CHAR_R 0x00FF
384 /* Traffic Flow Templates mask */
385 #define GTPv1_TFT_CODE_MASK 0xE0
386 #define GTPv1_TFT_SPARE_MASK 0x10
387 #define GTPv1_TFT_NUMBER_MASK 0x0F
389 /* Definition of GSN Address masks */
390 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
391 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
393 /* Definition of QoS masks */
394 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
395 #define GTP_EXT_QOS_DELAY_MASK 0x38
396 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
397 #define GTP_EXT_QOS_PEAK_MASK 0xF0
398 #define GTP_EXT_QOS_SPARE2_MASK 0x08
399 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
400 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
401 #define GTP_EXT_QOS_MEAN_MASK 0x1F
402 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
403 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
404 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
405 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
406 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
407 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
408 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
410 /* Definition of Radio Priority's masks */
411 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
412 #define GTPv1_EXT_RP_SPARE_MASK 0x08
413 #define GTPv1_EXT_RP_MASK 0x07
415 /* definitions of GTP messages */
416 #define GTP_MSG_UNKNOWN 0x00
417 #define GTP_MSG_ECHO_REQ 0x01
418 #define GTP_MSG_ECHO_RESP 0x02
419 #define GTP_MSG_VER_NOT_SUPP 0x03
420 #define GTP_MSG_NODE_ALIVE_REQ 0x04
421 #define GTP_MSG_NODE_ALIVE_RESP 0x05
422 #define GTP_MSG_REDIR_REQ 0x06
423 #define GTP_MSG_REDIR_RESP 0x07
424 #define GTP_MSG_CREATE_PDP_REQ 0x10
425 #define GTP_MSG_CREATE_PDP_RESP 0x11
426 #define GTP_MSG_UPDATE_PDP_REQ 0x12
427 #define GTP_MSG_UPDATE_PDP_RESP 0x13
428 #define GTP_MSG_DELETE_PDP_REQ 0x14
429 #define GTP_MSG_DELETE_PDP_RESP 0x15
430 #define GTP_MSG_CREATE_AA_PDP_REQ 0x16 /* 2G */
431 #define GTP_MSG_CREATE_AA_PDP_RESP 0x17 /* 2G */
432 #define GTP_MSG_DELETE_AA_PDP_REQ 0x18 /* 2G */
433 #define GTP_MSG_DELETE_AA_PDP_RESP 0x19 /* 2G */
434 #define GTP_MSG_ERR_IND 0x1A
435 #define GTP_MSG_PDU_NOTIFY_REQ 0x1B
436 #define GTP_MSG_PDU_NOTIFY_RESP 0x1C
437 #define GTP_MSG_PDU_NOTIFY_REJ_REQ 0x1D
438 #define GTP_MSG_PDU_NOTIFY_REJ_RESP 0x1E
439 #define GTP_MSG_SUPP_EXT_HDR 0x1F
440 #define GTP_MSG_SEND_ROUT_INFO_REQ 0x20
441 #define GTP_MSG_SEND_ROUT_INFO_RESP 0x21
442 #define GTP_MSG_FAIL_REP_REQ 0x22
443 #define GTP_MSG_FAIL_REP_RESP 0x23
444 #define GTP_MSG_MS_PRESENT_REQ 0x24
445 #define GTP_MSG_MS_PRESENT_RESP 0x25
446 #define GTP_MSG_IDENT_REQ 0x30
447 #define GTP_MSG_IDENT_RESP 0x31
448 #define GTP_MSG_SGSN_CNTXT_REQ 0x32
449 #define GTP_MSG_SGSN_CNTXT_RESP 0x33
450 #define GTP_MSG_SGSN_CNTXT_ACK 0x34
451 #define GTP_MSG_FORW_RELOC_REQ 0x35
452 #define GTP_MSG_FORW_RELOC_RESP 0x36
453 #define GTP_MSG_FORW_RELOC_COMP 0x37
454 #define GTP_MSG_RELOC_CANCEL_REQ 0x38
455 #define GTP_MSG_RELOC_CANCEL_RESP 0x39
456 #define GTP_MSG_FORW_SRNS_CNTXT 0x3A
457 #define GTP_MSG_FORW_RELOC_ACK 0x3B
458 #define GTP_MSG_FORW_SRNS_CNTXT_ACK 0x3C
459 #define GTP_MSG_DATA_TRANSF_REQ 0xF0
460 #define GTP_MSG_DATA_TRANSF_RESP 0xF1
461 #define GTP_MSG_TPDU 0xFF
463 static const value_string message_type[] = {
464 { GTP_MSG_UNKNOWN, "For future use" },
465 { GTP_MSG_ECHO_REQ, "Echo request" },
466 { GTP_MSG_ECHO_RESP, "Echo response" },
467 { GTP_MSG_VER_NOT_SUPP, "Version not supported" },
468 { GTP_MSG_NODE_ALIVE_REQ, "Node alive request" },
469 { GTP_MSG_NODE_ALIVE_RESP, "Node alive response" },
470 { GTP_MSG_REDIR_REQ, "Redirection request" },
471 { GTP_MSG_REDIR_RESP, "Redirection response" },
472 { GTP_MSG_CREATE_PDP_REQ, "Create PDP context request" },
473 { GTP_MSG_CREATE_PDP_RESP, "Create PDP context response" },
474 { GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request" },
475 { GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response" },
476 { GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request" },
477 { GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response" },
478 { GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request" },
479 { GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response" },
480 { GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request" },
481 { GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response" },
482 { GTP_MSG_ERR_IND, "Error indication" },
483 { GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request" },
484 { GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response" },
485 { GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request" },
486 { GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response" },
487 { GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification" },
488 { GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request" },
489 { GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response" },
490 { GTP_MSG_FAIL_REP_REQ, "Failure report request" },
491 { GTP_MSG_FAIL_REP_RESP, "Failure report response" },
492 { GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request" },
493 { GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response" },
494 { GTP_MSG_IDENT_REQ, "Identification request" },
495 { GTP_MSG_IDENT_RESP, "Identification response" },
496 { GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request" },
497 { GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response" },
498 { GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement" },
499 { GTP_MSG_FORW_RELOC_REQ, "Forward relocation request" },
500 { GTP_MSG_FORW_RELOC_RESP, "Forward relocation response" },
501 { GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete" },
502 { GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request" },
503 { GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response" },
504 { GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context" },
505 { GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge" },
506 { GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge" },
507 { GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request" },
508 { GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response" },
509 { GTP_MSG_TPDU, "T-PDU" },
513 /* definitions of fields in extension header */
514 #define GTP_EXT_CAUSE 0x01
515 #define GTP_EXT_IMSI 0x02
516 #define GTP_EXT_RAI 0x03
517 #define GTP_EXT_TLLI 0x04
518 #define GTP_EXT_PTMSI 0x05
519 #define GTP_EXT_QOS_GPRS 0x06
520 #define GTP_EXT_REORDER 0x08
521 #define GTP_EXT_AUTH_TRI 0x09
522 #define GTP_EXT_MAP_CAUSE 0x0B
523 #define GTP_EXT_PTMSI_SIG 0x0C
524 #define GTP_EXT_MS_VALID 0x0D
525 #define GTP_EXT_RECOVER 0x0E
526 #define GTP_EXT_SEL_MODE 0x0F
528 #define GTP_EXT_16 0x10
529 #define GTP_EXT_FLOW_LABEL 0x10
530 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
532 #define GTP_EXT_17 0x11
533 #define GTP_EXT_FLOW_SIG 0x11
534 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
536 #define GTP_EXT_18 0x12
537 #define GTP_EXT_FLOW_II 0x12
538 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G*/
540 #define GTP_EXT_19 0x13
541 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
542 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G*/
544 #define GTP_EXT_NSAPI 0x14 /* 3G */
545 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
546 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
547 #define GTP_EXT_RP_SMS 0x17 /* 3G */
548 #define GTP_EXT_RP 0x18 /* 3G */
549 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
550 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
551 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
552 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
553 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
554 #define GTP_EXT_TR_COMM 0x7E /* charging */
555 #define GTP_EXT_CHRG_ID 0x7F
556 #define GTP_EXT_USER_ADDR 0x80
557 #define GTP_EXT_MM_CNTXT 0x81
558 #define GTP_EXT_PDP_CNTXT 0x82
559 #define GTP_EXT_APN 0x83
560 #define GTP_EXT_PROTO_CONF 0x84
561 #define GTP_EXT_GSN_ADDR 0x85
562 #define GTP_EXT_MSISDN 0x86
563 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
564 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
565 #define GTP_EXT_TFT 0x89 /* 3G */
566 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
567 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
568 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
569 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
570 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G */
571 #define GTP_EXT_OMC_ID 0x8F /* 3G */
572 #define GTP_EXT_REL_PACK 0xF9 /* charging */
573 #define GTP_EXT_CAN_PACK 0xFA /* charging */
574 #define GTP_EXT_CHRG_ADDR 0xFB
575 #define GTP_EXT_DATA_REQ 0xFC /* charging */
576 #define GTP_EXT_DATA_RESP 0xFD /* charging */
577 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
578 #define GTP_EXT_PRIV_EXT 0xFF
580 static const value_string gtp_val[] = {
581 { GTP_EXT_CAUSE, "Cause of operation" },
582 { GTP_EXT_IMSI, "IMSI" },
583 { GTP_EXT_RAI, "Routing Area Identity" },
584 { GTP_EXT_TLLI, "Temporary Logical Link Identity" },
585 { GTP_EXT_PTMSI, "Packet TMSI" },
586 { GTP_EXT_QOS_GPRS, "Quality of Service" },
587 { GTP_EXT_REORDER, "Reorder required" },
588 { GTP_EXT_AUTH_TRI, "Authentication triplets" },
589 { GTP_EXT_MAP_CAUSE, "MAP cause" },
590 { GTP_EXT_PTMSI_SIG, "P-TMSI signature" },
591 { GTP_EXT_MS_VALID, "MS validated" },
592 { GTP_EXT_RECOVER, "Recovery" },
593 { GTP_EXT_SEL_MODE, "Selection mode" },
595 { GTP_EXT_16, "Flow label data I" },
596 { GTP_EXT_FLOW_LABEL, "Flow label data I" },
597 { GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I" }, /* 3G */
599 { GTP_EXT_17, "Flow label signalling" },
600 { GTP_EXT_FLOW_SIG, "Flow label signalling" },
601 { GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane" }, /* 3G */
603 { GTP_EXT_18, "Flow label data II" },
604 { GTP_EXT_FLOW_II, "Flow label data II" },
605 { GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II" }, /* 3G */
607 { GTP_EXT_19, "MS not reachable reason" },
608 { GTP_EXT_MS_REASON, "MS not reachable reason" },
609 { GTP_EXT_TEAR_IND, "Teardown ID" }, /* 3G */
611 { GTP_EXT_NSAPI, "NSAPI" }, /* 3G */
612 { GTP_EXT_RANAP_CAUSE, "RANAP cause" }, /* 3G */
613 { GTP_EXT_RAB_CNTXT, "RAB context" }, /* 3G */
614 { GTP_EXT_RP_SMS, "Radio Priority for MO SMS" }, /* 3G */
615 { GTP_EXT_RP, "Radio Priority" }, /* 3G */
616 { GTP_EXT_PKT_FLOW_ID, "Packet Flow ID" }, /* 3G */
617 { GTP_EXT_CHRG_CHAR, "Charging characteristics" }, /* 3G */
618 { GTP_EXT_TRACE_REF, "Trace references" }, /* 3G */
619 { GTP_EXT_TRACE_TYPE, "Trace type" }, /* 3G */
620 { GTPv1_EXT_MS_REASON, "MS not reachable reason" }, /* 3G */
621 { GTP_EXT_TR_COMM, "Packet transfer command" }, /* charging */
622 { GTP_EXT_CHRG_ID, "Charging ID" },
623 { GTP_EXT_USER_ADDR, "End user address" },
624 { GTP_EXT_MM_CNTXT, "MM context" },
625 { GTP_EXT_PDP_CNTXT, "PDP context" },
626 { GTP_EXT_APN, "Access Point Name" },
627 { GTP_EXT_PROTO_CONF, "Protocol configuration options" },
628 { GTP_EXT_GSN_ADDR, "GSN address" },
629 { GTP_EXT_MSISDN, "MS international PSTN/ISDN number" },
630 { GTP_EXT_QOS_UMTS, "Quality of service (UMTS)" }, /* 3G */
631 { GTP_EXT_AUTH_QUI, "Authentication quintuplets" }, /* 3G */
632 { GTP_EXT_TFT, "Traffic Flow Template (TFT)" }, /* 3G */
633 { GTP_EXT_TARGET_ID, "Target (RNC) identification" }, /* 3G */
634 { GTP_EXT_UTRAN_CONT, "UTRAN transparent field" }, /* 3G */
635 { GTP_EXT_RAB_SETUP, "RAB setup information" }, /* 3G */
636 { GTP_EXT_HDR_LIST, "Extension Header Types List" }, /* 3G */
637 { GTP_EXT_TRIGGER_ID, "Trigger Id" }, /* 3G */
638 { GTP_EXT_OMC_ID, "OMC Identity" }, /* 3G */
639 { GTP_EXT_REL_PACK, "Sequence numbers of released packets IE" }, /* charging */
640 { GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE" }, /* charging */
641 { GTP_EXT_CHRG_ADDR, "Charging Gateway address" },
642 { GTP_EXT_DATA_REQ, "Data record packet" }, /* charging */
643 { GTP_EXT_DATA_RESP, "Requests responded" }, /* charging */
644 { GTP_EXT_NODE_ADDR, "Address of recommended node" }, /* charging */
645 { GTP_EXT_PRIV_EXT, "Private Extension" },
649 /* GPRS: 9.60 v7.6.0, page 37
650 * UMTS: 29.060 v4.0, page 45
652 static const value_string cause_type[] = {
653 { 0, "Request IMSI" },
654 { 1, "Request IMEI" },
655 { 2, "Request IMSI and IMEI" },
656 { 3, "No identity needed" },
658 { 5, "MS is not GPRS responding" },
659 { 59, "System failure" }, /* charging */
660 { 60, "The transmit buffers are becoming full" }, /* charging */
661 { 61, "The receive buffers are becoming full" }, /* charging */
662 { 62, "Another node is about to go down" }, /* charging */
663 { 63, "This node is about to go down" }, /* charging */
664 { 128, "Request accepted" },
665 { 192, "Non-existent" },
666 { 193, "Invalid message format" },
667 { 194, "IMSI not known" },
668 { 195, "MS is GPRS detached" },
669 { 196, "MS is not GPRS responding" },
670 { 197, "MS refuses" },
671 { 198, "Version not supported" },
672 { 199, "No resource available" },
673 { 200, "Service not supported" },
674 { 201, "Mandatory IE incorrect" },
675 { 202, "Mandatory IE missing" },
676 { 203, "Optional IE incorrect" },
677 { 204, "System failure" },
678 { 205, "Roaming restriction" },
679 { 206, "P-TMSI signature mismatch" },
680 { 207, "GPRS connection suspended" },
681 { 208, "Authentication failure" },
682 { 209, "User authentication failed" },
683 { 210, "Context not found" },
684 { 211, "All PDP dynamic addresses are occupied" },
685 { 212, "No memory is available" },
686 { 213, "Relocation failure" },
687 { 214, "Unknown mandatory extension header" },
688 { 215, "Semantic error in the TFT operation" },
689 { 216, "Syntactic error in the TFT operation" },
690 { 217, "Semantic errors in packet filter(s)" },
691 { 218, "Syntactic errors in packet filter(s)" },
692 { 219, "Missing or unknown APN" },
693 { 220, "Unknown PDP address or PDP type" },
694 { 252, "Request related to possibly duplicated packets already fulfilled" }, /* charging */
695 { 253, "Request already fulfilled" }, /* charging */
696 { 254, "Sequence numbers of released/cancelled packets IE incorrect" }, /* charging */
697 { 255, "Request not fulfilled" }, /* charging */
702 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
703 * TODO: Check if all map_cause values are included
705 static const value_string map_cause_type[] = {
706 { 1, "Unknown subscriber" },
707 { 8, "Roaming not allowed" },
708 { 10, "Bearer service not provisioned" },
709 { 11, "Teleservice not provisioned" },
710 { 13, "Call barred" },
711 { 21, "Facility not supported" },
712 { 23, "Update GPRS location" },
713 { 24, "Send routing info for GPRS" },
714 { 26, "Note MS present for GPRS" },
715 { 27, "Absent subscriber" },
716 { 34, "System failure" },
717 { 35, "Data missing" },
718 { 36, "Unexpected data value" },
719 { 44, "Number chenged" },
720 { 45, "Busy subscriber" },
721 { 46, "No subscriber reply" },
722 { 48, "Facility not allowed" },
726 static const value_string gsn_addr_type[] = {
732 static const value_string pdp_type[] = {
735 { 0x02, "OSP:IHOSS" },
741 static const value_string pdp_org_type[] = {
747 static const value_string qos_delay_type[] = {
748 { 0x00, "Subsribed delay class (in MS to network direction)" },
749 { 0x01, "Delay class 1" },
750 { 0x02, "Delay class 2" },
751 { 0x03, "Delay class 3" },
752 { 0x04, "Delay class 4 (best effort)" },
753 { 0x07, "Reserved" },
757 static const value_string qos_reliability_type[] = {
758 { 0x00, "Subscribed reliability class (in MS to network direction)" },
759 { 0x01, "Ack GTP/LLC/RLC, Protected data" },
760 { 0x02, "Unack GTP, Ack LLC/RLC, Protected data" },
761 { 0x03, "Unack GTP/LLC, Ack RLC, Protected data" },
762 { 0x04, "Unack GTP/LLC/RLC, Protected data" },
763 { 0x05, "Unack GTP/LLC/RLC, Unprotected data" },
764 { 0x07, "Reserved" },
768 static const value_string qos_peak_type[] = {
769 { 0x00, "Subscribed peak throughput (in MS to network direction)" },
770 { 0x01, "Up to 1 000 oct/s" },
771 { 0x02, "Up to 2 000 oct/s" },
772 { 0x03, "Up to 4 000 oct/s" },
773 { 0x04, "Up to 8 000 oct/s" },
774 { 0x05, "Up to 16 000 oct/s" },
775 { 0x06, "Up to 32 000 oct/s" },
776 { 0x07, "Up to 64 000 oct/s" },
777 { 0x08, "Up to 128 000 oct/s" },
778 { 0x09, "Up to 256 000 oct/s" },
779 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
780 { 0x0A, "Reserved" },
781 { 0x0B, "Reserved" },
782 { 0x0C, "Reserved" },
783 { 0x0D, "Reserved" },
784 { 0x0E, "Reserved" },
785 { 0x0F, "Reserved" },
789 static const value_string qos_precedence_type[] = {
790 { 0x00, "Subscribed precedence (in MS to network direction)" },
791 { 0x01, "High priority" },
792 { 0x02, "Normal priority" },
793 { 0x03, "Low priority" },
794 { 0x07, "Reserved" },
798 static const value_string qos_mean_type[] = {
799 { 0x00, "Subscribed mean throughput (in MS to network direction)" },
800 { 0x01, "100 oct/h" }, /* Class 2 */
801 { 0x02, "200 oct/h" }, /* Class 3 */
802 { 0x03, "500 oct/h" }, /* Class 4 */
803 { 0x04, "1 000 oct/h" }, /* Class 5 */
804 { 0x05, "2 000 oct/h" }, /* Class 6 */
805 { 0x06, "5 000 oct/h" }, /* Class 7 */
806 { 0x07, "10 000 oct/h" }, /* Class 8 */
807 { 0x08, "20 000 oct/h" }, /* Class 9 */
808 { 0x09, "50 000 oct/h" }, /* Class 10 */
809 { 0x0A, "100 000 oct/h" }, /* Class 11 */
810 { 0x0B, "200 000 oct/h" }, /* Class 12 */
811 { 0x0C, "500 000 oct/h" }, /* Class 13 */
812 { 0x0D, "1 000 000 oct/h" }, /* Class 14 */
813 { 0x0E, "2 000 000 oct/h" }, /* Class 15 */
814 { 0x0F, "5 000 000 oct/h" }, /* Class 16 */
815 { 0x10, "10 000 000 oct/h" }, /* Class 17 */
816 { 0x11, "20 000 000 oct/h" }, /* Class 18 */
817 { 0x12, "50 000 000 oct/h" }, /* Class 19 */
818 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
819 { 0x13, "Reserved" },
820 { 0x14, "Reserved" },
821 { 0x15, "Reserved" },
822 { 0x16, "Reserved" },
823 { 0x17, "Reserved" },
824 { 0x18, "Reserved" },
825 { 0x19, "Reserved" },
826 { 0x1A, "Reserved" },
827 { 0x1B, "Reserved" },
828 { 0x1C, "Reserved" },
829 { 0x1D, "Reserved" },
830 { 0x1E, "Reserved" },
831 { 0x1F, "Best effort" }, /* Class 1 */
835 static const value_string qos_del_err_sdu[] = {
836 { 0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)" },
837 { 0x01, "No detect ('-')" },
838 { 0x02, "Erroneous SDUs are delivered ('yes')" },
839 { 0x03, "Erroneous SDUs are not delivered ('no')" },
840 { 0x07, "Reserved" }, /* All other values are reserved */
844 static const value_string qos_del_order[] = {
845 { 0x00, "Subscribed delivery order (in MS to network direction)" },
846 { 0x01, "With delivery order ('yes')" },
847 { 0x02, "Without delivery order ('no')" },
848 { 0x03, "Reserved" }, /* All other values are reserved */
852 static const value_string qos_traf_class[] = {
853 { 0x00, "Subscribed traffic class (in MS to network direction)" },
854 { 0x01, "Conversational class" },
855 { 0x02, "Streaming class" },
856 { 0x03, "Interactive class" },
857 { 0x04, "Background class" },
858 { 0x07, "Reserved" }, /* All other values are reserved */
862 static const value_string qos_max_sdu_size[] = {
863 { 0x00, "Subscribed maximum SDU size (in MS to network direction" },
864 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
865 { 0x97, "1502 octets" },
866 { 0x98, "1510 octets" },
867 { 0x99, "1520 octets" },
868 { 0, NULL } /* All other values are reserved */
871 static const value_string qos_max_ul[] = {
872 { 0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)" },
873 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
874 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
875 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
880 static const value_string qos_max_dl[] = {
881 { 0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)" },
882 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
883 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
884 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
889 static const value_string qos_res_ber[] = {
890 { 0x00, "Subscribed residual BER (in MS to network direction)" },
891 { 0x01, "1/20 = 5x10^-2" },
892 { 0x02, "1/100 = 1x10^-2" },
893 { 0x03, "1/200 = 5x10^-3" },
894 { 0x04, "1/250 = 4x10^-3" },
895 { 0x05, "1/1 000 = 1x10^-3" },
896 { 0x06, "1/10 000 = 1x10^-4" },
897 { 0x07, "1/100 000 = 1x10^-5" },
898 { 0x08, "1/1 000 000 = 1x10^-6" },
899 { 0x09, "3/50 000 000 = 6x10^-8" },
900 { 0x0F, "Reserved" }, /* All other values are reserved */
904 static const value_string qos_sdu_err_ratio[] = {
905 { 0x00, "Subscribed SDU error ratio (in MS to network direction)" },
906 { 0x01, "1/100 = 1x10^-2" },
907 { 0x02, "7/1000 = 7x10^-3" },
908 { 0x03, "1/1 000 = 1x10^-3" },
909 { 0x04, "1/10 000 = 1x10^-4" },
910 { 0x05, "1/100 000 = 1x10^-5" },
911 { 0x06, "1/1 000 000 = 1x10^-6" },
912 { 0x07, "1/10 = 1x10^-1" },
913 { 0x0F, "Reserved" }, /* All other values are reserved */
917 static const value_string qos_traf_handl_prio[] = {
918 { 0x00, "Subscribed traffic handling priority (in MS to network direction)" },
919 { 0x01, "Priority level 1" },
920 { 0x02, "Priority level 2" },
921 { 0x03, "Priority level 3" },
925 static const value_string qos_trans_delay[] = {
926 { 0x00, "Subscribed Transfer Delay (in MS to network direction)" },
927 { 0x01, "10 ms" }, /* Using a granularity of 10 ms */
942 { 0x10, "200 ms" }, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
958 { 0x20, "1000 ms" }, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
993 static const value_string qos_guar_ul[] = {
994 { 0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)" },
995 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
996 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
997 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1002 static const value_string qos_guar_dl[] = {
1003 { 0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)" },
1004 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1005 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1006 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1011 static const value_string sel_mode_type[] = {
1012 { 0, "MS or network provided APN, subscribed verified" },
1013 { 1, "MS provided APN, subscription not verified" },
1014 { 2, "Network provided APN, subscription not verified" },
1015 { 3, "For future use (Network provided APN, subscription not verified" },/* Shall not be sent. If received, shall be sent as value 2 */
1019 static const value_string tr_comm_type[] = {
1020 { 1, "Send data record packet" },
1021 { 2, "Send possibly duplicated data record packet" },
1022 { 3, "Cancel data record packet" },
1023 { 4, "Release data record packet"},
1027 /* TODO: CHeck if all ms_reasons are included */
1028 static const value_string ms_not_reachable_type[] = {
1029 { 0, "No paging response via the MSC" },
1030 { 1, "IMSI detached" },
1031 { 2, "Roaming restriction" },
1032 { 3, "Deregistered in the HLR for non GPRS" },
1033 { 4, "MS purge for non GPRS" },
1034 { 5, "No paging response via the SGSN" },
1035 { 6, "GPRS detached" },
1036 { 7, "Deregistered in the HLR for non GPRS" },
1037 { 8, "MS purged for GPRS" },
1038 { 9, "Unidentified subscriber via the MSC" },
1039 { 10, "Unidentified subscriber via the SGSN" },
1043 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
1045 static const value_string ranap_cause_type[] = {
1046 /* Radio Network Layer Cause (1-->64) */
1047 { 1, "RAB preempted" },
1048 { 2, "Trelocoverall Expiry" },
1049 { 3, "Trelocprep Expiry" },
1050 { 4, "Treloccomplete Expiry" },
1051 { 5, "Tqueing Expiry" },
1052 { 6, "Relocation Triggered" },
1053 { 7, "TRELOCalloc Expiry" },
1054 { 8, "Unable to Estabish During Relocation" },
1055 { 9, "Unknown Target RNC" },
1056 { 10, "Relocation Cancelled" },
1057 { 11, "Successful Relocation" },
1058 { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported" },
1059 { 13, "Change of Ciphering and/or Integrity Protection is not supported" },
1060 { 14, "Failure in the Radio Interface Procedure" },
1061 { 15, "Release due to UTRAN Generated Reason" },
1062 { 16, "User Inactivity" },
1063 { 17, "Time Critical Relocation" },
1064 { 18, "Requested Traffic Class not Available" },
1065 { 19, "Invalid RAB Parameters Value" },
1066 { 20, "Requested Maximum Bit Rate not Available" },
1067 { 21, "Requested Guaranteed Bit Rate not Available" },
1068 { 22, "Requested Transfer Delay not Achievable" },
1069 { 23, "Invalid RAB Parameters Combination" },
1070 { 24, "Condition Violation for SDU Parameters" },
1071 { 25, "Condition Violation for Traffic Handling Priority" },
1072 { 26, "Condition Violation for Guaranteed Bit Rate" },
1073 { 27, "User Plane Versions not Supported" },
1074 { 28, "Iu UP Failure" },
1075 { 29, "Relocation Failure in Target CN/RNC or Target System" },
1076 { 30, "Invalid RAB ID" },
1077 { 31, "No Remaining RAB" },
1078 { 32, "Interaction with other procedure" },
1079 { 33, "Requested Maximum Bit Rate for DL not Available" },
1080 { 34, "Requested Maximum Bit Rate for UL not Available" },
1081 { 35, "Requested Guaranteed Bit Rate for DL not Available" },
1082 { 36, "Requested Guaranteed Bit Rate for UL not Available" },
1083 { 37, "Repeated Integrity Checking Failure" },
1084 { 38, "Requested Report Type not supported" },
1085 { 39, "Request superseded" },
1086 { 40, "Release due to UE generated signalling connection release" },
1087 { 41, "Resource Optimisation Relocation" },
1088 { 42, "Requested Information Not Available" },
1089 { 43, "Relocation desirable for radio reasons" },
1090 { 44, "Relocation not supported in Target RNC or Target System" },
1091 { 45, "Directed Retry" },
1092 { 46, "Radio Connection With UE Lost" },
1093 /* Transport Layer Cause (65-->80) */
1094 { 65, "Signalling Transport Resource Failure" },
1095 { 66, "Iu Transport Connection Failed to Establish" },
1096 /* NAS Cause (81-->96) */
1097 { 81, "User Restriction Start Indication" },
1098 { 82, "User Restriction End Indication" },
1099 { 83, "Normal Release" },
1100 /* Protocol Cause (97-->112) */
1101 { 97, "Transfer Syntax Error" },
1102 { 98, "Semantic Error" },
1103 { 99, "Message not compatible with receiver state" },
1104 { 100, "Abstract Syntax Error (Reject)" },
1105 { 101, "Abstract Syntax Error (Ignore and Notify)" },
1106 { 102, "Abstract Syntax Error (Falsely Constructed Message" },
1107 /* Miscellaneous Cause (113-->128) */
1108 { 113, "O & M Intervention" },
1109 { 114, "No Resource Available" },
1110 { 115, "Unspecified Failure" },
1111 { 116, "Network Opimisation" },
1112 /* Non-standard Cause (129-->255) */
1116 static const value_string mm_sec_modep[] = {
1117 { 0, "Used cipher value, UMTS keys and Quintuplets" },
1118 { 1, "GSM key and triplets" },
1119 { 2, "UMTS key and quintuplets" },
1120 { 3, "GSM key and quintuplets" },
1124 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
1125 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
1126 #define MM_PROTO_PDSS1 0x02
1127 #define MM_PROTO_CALL_CONTROL 0x03
1128 #define MM_PROTO_PDSS2 0x04
1129 #define MM_PROTO_MM_NON_GPRS 0x05
1130 #define MM_PROTO_RR_MGMT 0x06
1131 #define MM_PROTO_MM_GPRS 0x08
1132 #define MM_PROTO_SMS 0x09
1133 #define MM_PROTO_SESSION_MGMT 0x0A
1134 #define MM_PROTO_NON_CALL_RELATED 0x0B
1136 static const value_string mm_proto_disc[] = {
1137 { MM_PROTO_GROUP_CALL_CONTROL, "Group call control" },
1138 { MM_PROTO_BROADCAST_CALL_CONTROL, "Broadcast call control" },
1139 { MM_PROTO_PDSS1, "PDSS1" },
1140 { MM_PROTO_CALL_CONTROL, "Call control; call related SS messages" },
1141 { MM_PROTO_PDSS2, "PDSS2" },
1142 { MM_PROTO_MM_NON_GPRS, "Mobility Management messages for non-GPRS services" },
1143 { MM_PROTO_RR_MGMT, "Radio Resource management messages" },
1144 { MM_PROTO_MM_GPRS, "Mobility Management messages for GPRS services" },
1145 { MM_PROTO_SMS, "SMS" },
1146 { MM_PROTO_SESSION_MGMT, "Session Management messages" },
1147 { MM_PROTO_NON_CALL_RELATED, "Non-call related SS messages" },
1151 static const value_string mm_rr_mess[] = {
1152 { 0x3C, "RR initialization request" },
1153 { 0x3B, "Additional assignment" },
1154 { 0x3F, "Immediate assignment" },
1155 { 0x39, "Immediate assignment extended" },
1156 { 0x3A, "Immediate assignment reject" },
1158 { 0x35, "Ciphering mode command" },
1159 { 0x32, "Ciphering mode complete" },
1161 { 0x30, "Configuration change command" },
1162 { 0x31, "Configuration change ack" },
1163 { 0x33, "Configuration change reject" },
1165 { 0x2E, "Assignment command" },
1166 { 0x29, "Assignment complete" },
1167 { 0x2F, "Assigment failure" },
1168 { 0x2B, "Handover command" },
1169 { 0x2C, "Handover complete" },
1170 { 0x28, "Handover failure" },
1171 { 0x2D, "Physical information" },
1173 { 0x08, "RR-cell change order" },
1174 { 0x23, "PDCH assignment command" },
1176 { 0x0D, "Channel release" },
1177 { 0x0A, "Partial release" },
1178 { 0x0F, "PArtial release complete" },
1180 { 0x21, "Paging request type 1" },
1181 { 0x22, "Paging request type 2" },
1182 { 0x24, "Paging request type 3" },
1183 { 0x27, "Paging response" },
1184 { 0x20, "Notification/NCH" },
1185 { 0x25, "Notification/FACCH" },
1186 { 0x26, "Reserved" },
1187 { 0x0B, "Reserved" },
1189 { 0x18, "System information type 8" },
1190 { 0x19, "System information type 1" },
1191 { 0x1A, "System information type 2" },
1192 { 0x1B, "System information type 3" },
1193 { 0x1C, "System information type 4" },
1194 { 0x1D, "System information type 5" },
1195 { 0x1E, "System information type 6" },
1196 { 0x1F, "System information type 7" },
1198 { 0x02, "System information type 2bis" },
1199 { 0x03, "System information type 2ter" },
1200 { 0x05, "System information type 5bis" },
1201 { 0x06, "System information type 5ter" },
1202 { 0x04, "System information 9" },
1203 { 0x00, "System information 13" },
1204 { 0x01, "System information 14" },
1206 { 0x3D, "System information type 16" },
1207 { 0x3E, "System information type 17" },
1209 { 0x10, "Channel mode modify" },
1210 { 0x12, "RR status" },
1211 { 0x17, "Channel mode modify ack" },
1212 { 0x14, "Frequency redefinition" },
1213 { 0x15, "Measurement report" },
1214 { 0x16, "Classmark change" },
1215 { 0x13, "Classmark enquiry" },
1216 { 0x36, "Extended measurement report" },
1217 { 0x37, "Extended measurement order" },
1218 { 0x34, "GPRS suspension request" },
1220 { 0x09, "VGCS uplink grant" },
1221 { 0x0E, "Uplink release" },
1222 { 0x0C, "Uplink free" },
1223 { 0x2A, "Uplink busy" },
1224 { 0x11, "Talker indication" },
1229 static const value_string mm_mm_mess[] = {
1230 { 0x01, "IMSI DETACH INDICATION" },
1231 { 0x02, "LOCATION UPDATING ACCEPT" },
1232 { 0x04, "LOCATION UPDATING REJECT" },
1233 { 0x08, "LOCATION UPDATING REQUEST" },
1234 { 0x11, "AUTHENTICATION REJECT" },
1235 { 0x12, "AUTHENTICATION REQUEST" },
1236 { 0x14, "AUTHENTICATION RESPONSE" },
1237 { 0x18, "IDENTITY REQUEST" },
1238 { 0x19, "IDENTITY RESPONSE" },
1239 { 0x1A, "TMSI REALLOCATION COMMAND" },
1240 { 0x1B, "TMSI REALLOCATION COMPLETE" },
1241 { 0x21, "CM SERVICE ACCEPT" },
1242 { 0x22, "CM SERVICE REJECT" },
1243 { 0x23, "CM SERVICE ABORT" },
1244 { 0x24, "CM SERVICE REQUEST" },
1245 { 0x25, "CM SERVICE PROMPT" },
1246 { 0x26, "NOTIFICATION RESPONSE" },
1247 { 0x28, "CM RE-ESTABLISHMENT REQUEST" },
1249 { 0x30, "MM NULL" },
1250 { 0x31, "MM STATUS" },
1251 { 0x32, "MM INFORMATION" },
1255 static const value_string mm_cc_mess[] = {
1256 { 0x00, "escape to nationally specific" },
1257 /*{ 0 x 0 0, "- - - Call establishment messages:" },*/
1258 { 0x01, "ALERTING" },
1259 { 0x08, "CALL CONFIRMED" },
1260 { 0x02, "CALL PROCEEDING" },
1261 { 0x07, "CONNECT" },
1262 { 0x0F, "CONNECT ACKNOWLEDGE" },
1263 { 0x0E, "EMERGENCY SETUP" },
1264 { 0x03, "PROGRESS" },
1265 { 0x04, "CC-ESTABLISHMENT" },
1266 { 0x06, "CC-ESTABLISHMENT CONFIRMED" },
1268 { 0x09, "START CC" },
1270 /*{ 0 x 0 1, "- - - Call information phase messages:" },*/
1272 { 0x1F, "MODIFY COMPLETE" },
1273 { 0x13, "MODIFY REJECT" },
1274 { 0x10, "USER INFORMATION" },
1276 { 0x19, "HOLD ACKNOWLEDGE" },
1277 { 0x1A, "HOLD REJECT" },
1278 { 0x1C, "RETRIEVE" },
1279 { 0x1D, "RETRIEVE ACKNOWLEDGE" },
1280 { 0x1E, "RETRIEVE REJECT" },
1281 /*{ 0 x 1 0, "- - - Call clearing messages:" },*/
1282 { 0x25, "DISCONNECT" },
1283 { 0x2D, "RELEASE" },
1284 { 0x2A, "RELEASE COMPLETE" },
1285 /*{ 0 x 1 1, "- - - Miscellaneous messages:" },*/
1286 { 0x39, "CONGESTION CONTROL" },
1289 { 0x34, "STATUS ENQUIRY" },
1290 { 0x35, "START DTMF" },
1291 { 0x31, "STOP DTMF" },
1292 { 0x32, "STOP DTMF ACKNOWLEDGE" },
1293 { 0x36, "START DTMF ACKNOWLEDGE" },
1294 { 0x37, "START DTMF REJECT" },
1295 { 0x3A, "FACILITY" },
1299 static const value_string mm_gprs_mess[] = {
1300 { 0x01, "Attach request" },
1301 { 0x02, "Attach accept" },
1302 { 0x03, "Attach complete" },
1303 { 0x04, "Attach reject" },
1304 { 0x05, "Detach request" },
1305 { 0x06, "Detach accept" },
1306 { 0x08, "Routing area update request" },
1307 { 0x09, "Routing area update accept" },
1308 { 0x0A, "Routing area update complete" },
1309 { 0x0B, "Routing area update reject" },
1310 { 0x10, "P-TMSI reallocation command" },
1311 { 0x11, "P-TMSI reallocation complete" },
1312 { 0x12, "Authentication and ciphering req" },
1313 { 0x13, "Authentication and ciphering resp" },
1314 { 0x14, "Authentication and ciphering rej" },
1315 { 0x15, "Identity request" },
1316 { 0x16, "Identity response" },
1317 { 0x20, "GMM status" },
1318 { 0x21, "GMM information" },
1322 static const value_string tft_code_type[] = {
1324 { 1, "Create new TFT" },
1325 { 2, "Delete existing TFT" },
1326 { 3, "Add packet filters to existing TFT" },
1327 { 4, "Replace packet filters in existing TFT" },
1328 { 5, "Delete packet filters from existing TFT" },
1334 static const value_string cdr_close_type[] = {
1335 { 0, "PDP release" },
1336 { 1, "Volume limit" },
1337 { 2, "Time limit" },
1338 { 3, "SGSN change" },
1339 { 4, "Max changes" },
1340 { 6, "Management" },
1345 static dissector_handle_t ip_handle;
1346 static dissector_handle_t ipv6_handle;
1347 static dissector_handle_t ppp_handle;
1348 static dissector_handle_t data_handle;
1350 static int decode_gtp_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1351 static int decode_gtp_imsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1352 static int decode_gtp_rai (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1353 static int decode_gtp_tlli (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1354 static int decode_gtp_ptmsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1355 static int decode_gtp_qos_gprs (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1356 static int decode_gtp_reorder (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1357 static int decode_gtp_auth_tri (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1358 static int decode_gtp_map_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1359 static int decode_gtp_ptmsi_sig (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1360 static int decode_gtp_ms_valid (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1361 static int decode_gtp_recovery (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1362 static int decode_gtp_sel_mode (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1363 static int decode_gtp_16 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1364 static int decode_gtp_17 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1365 static int decode_gtp_18 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1366 static int decode_gtp_19 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1367 static int decode_gtp_nsapi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1368 static int decode_gtp_ranap_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1369 static int decode_gtp_rab_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1370 static int decode_gtp_rp_sms (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1371 static int decode_gtp_rp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1372 static int decode_gtp_pkt_flow_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1373 static int decode_gtp_chrg_char (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1374 static int decode_gtp_trace_ref (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1375 static int decode_gtp_trace_type (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1376 static int decode_gtp_ms_reason (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1377 static int decode_gtp_tr_comm (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1378 static int decode_gtp_chrg_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1379 static int decode_gtp_user_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1380 static int decode_gtp_mm_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1381 static int decode_gtp_pdp_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1382 static int decode_gtp_apn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1383 static int decode_gtp_gsn_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1384 static int decode_gtp_proto_conf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1385 static int decode_gtp_msisdn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1386 static int decode_gtp_qos_umts (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1387 static int decode_gtp_auth_qui (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1388 static int decode_gtp_tft (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1389 static int decode_gtp_target_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1390 static int decode_gtp_utran_cont (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1391 static int decode_gtp_rab_setup (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1392 static int decode_gtp_hdr_list (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1393 static int decode_gtp_trigger_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1394 static int decode_gtp_omc_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1395 static int decode_gtp_chrg_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1396 static int decode_gtp_rel_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1397 static int decode_gtp_can_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1398 static int decode_gtp_data_req (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1399 static int decode_gtp_data_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1400 static int decode_gtp_node_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1401 static int decode_gtp_priv_ext (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1402 static int decode_gtp_unknown (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1404 typedef struct _gtp_opt {
1407 int (*decode)(tvbuff_t *, int, packet_info *, proto_tree *);
1410 static const gtp_opt_t gtpopt[] = {
1411 { GTP_EXT_CAUSE, decode_gtp_cause },
1412 { GTP_EXT_IMSI, decode_gtp_imsi },
1413 { GTP_EXT_RAI, decode_gtp_rai },
1414 { GTP_EXT_TLLI, decode_gtp_tlli },
1415 { GTP_EXT_PTMSI, decode_gtp_ptmsi },
1416 { GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs },
1417 { GTP_EXT_REORDER, decode_gtp_reorder },
1418 { GTP_EXT_AUTH_TRI, decode_gtp_auth_tri },
1419 { GTP_EXT_MAP_CAUSE, decode_gtp_map_cause },
1420 { GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig },
1421 { GTP_EXT_MS_VALID, decode_gtp_ms_valid },
1422 { GTP_EXT_RECOVER, decode_gtp_recovery },
1423 { GTP_EXT_SEL_MODE, decode_gtp_sel_mode },
1424 { GTP_EXT_16, decode_gtp_16 },
1425 { GTP_EXT_17, decode_gtp_17 },
1426 { GTP_EXT_18, decode_gtp_18 },
1427 { GTP_EXT_19, decode_gtp_19 },
1428 { GTP_EXT_NSAPI, decode_gtp_nsapi },
1429 { GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause },
1430 { GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt },
1431 { GTP_EXT_RP_SMS, decode_gtp_rp_sms },
1432 { GTP_EXT_RP, decode_gtp_rp },
1433 { GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id },
1434 { GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char },
1435 { GTP_EXT_TRACE_REF, decode_gtp_trace_ref },
1436 { GTP_EXT_TRACE_TYPE, decode_gtp_trace_type },
1437 { GTPv1_EXT_MS_REASON, decode_gtp_ms_reason },
1438 { GTP_EXT_TR_COMM, decode_gtp_tr_comm },
1439 { GTP_EXT_CHRG_ID, decode_gtp_chrg_id },
1440 { GTP_EXT_USER_ADDR, decode_gtp_user_addr },
1441 { GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt },
1442 { GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt },
1443 { GTP_EXT_APN, decode_gtp_apn },
1444 { GTP_EXT_PROTO_CONF, decode_gtp_proto_conf },
1445 { GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr },
1446 { GTP_EXT_MSISDN, decode_gtp_msisdn },
1447 { GTP_EXT_QOS_UMTS, decode_gtp_qos_umts }, /* 3G */
1448 { GTP_EXT_AUTH_QUI, decode_gtp_auth_qui }, /* 3G */
1449 { GTP_EXT_TFT, decode_gtp_tft }, /* 3G */
1450 { GTP_EXT_TARGET_ID, decode_gtp_target_id }, /* 3G */
1451 { GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont }, /* 3G */
1452 { GTP_EXT_RAB_SETUP, decode_gtp_rab_setup }, /* 3G */
1453 { GTP_EXT_HDR_LIST, decode_gtp_hdr_list }, /* 3G */
1454 { GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id }, /* 3G */
1455 { GTP_EXT_OMC_ID, decode_gtp_omc_id }, /* 3G */
1456 { GTP_EXT_REL_PACK, decode_gtp_rel_pack }, /* charging */
1457 { GTP_EXT_CAN_PACK, decode_gtp_can_pack }, /* charging */
1458 { GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr },
1459 { GTP_EXT_DATA_REQ, decode_gtp_data_req }, /* charging */
1460 { GTP_EXT_DATA_RESP, decode_gtp_data_resp }, /* charging */
1461 { GTP_EXT_NODE_ADDR, decode_gtp_node_addr },
1462 { GTP_EXT_PRIV_EXT, decode_gtp_priv_ext },
1463 { 0, decode_gtp_unknown }
1484 static struct gcdr_ { /* GCDR 118B */
1505 typedef struct change_ {
1515 static struct _scdr { /* SCDR 277B */
1525 guint8 msclass_notused[12];
1526 guint8 msclass_caplen;
1528 guint16 msclass_capomit;
1553 typedef struct mmchange_ {
1560 static struct _mcdr { /* MCDR 147B */
1568 guint8 msclass_notused[12];
1569 guint8 msclass_caplen;
1571 guint16 msclass_capomit;
1575 guint8 change_count;
1576 mmchange_t change[5];
1579 /* guint8 opening[8]; */
1591 static struct _socdr { /* SOCDR 80B */
1598 guint8 msclass_notused[12];
1599 guint8 msclass_caplen;
1601 guint16 msclass_capomit;
1602 guint8 serv_centr[9];
1614 static struct _stcdr { /* STCDR 79B */
1621 guint8 msclass_notused[12];
1622 guint8 msclass_caplen;
1624 guint16 msclass_capomit;
1625 guint8 serv_centr[9];
1635 static guint8 gtp_version = 0;
1636 static char *yesno[] = { "False", "True" };
1639 col_append_str_gtp(column_info *cinfo, gint el, gchar *proto_name) {
1643 gchar _tmp[COL_MAX_LEN];
1645 max_len = COL_MAX_LEN;
1647 for (i = 0; i < cinfo->num_cols; i++) {
1648 if (cinfo->fmt_matx[i][el]) {
1649 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
1651 strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
1652 cinfo->col_buf[i][max_len - 1] = '\0';
1656 strcat(_tmp, proto_name);
1658 strcat(_tmp, cinfo->col_buf[i]);
1660 cinfo->col_buf[i][0] = '\0';
1661 strcat(cinfo->col_buf[i], _tmp);
1662 cinfo->col_data[i] = cinfo->col_buf[i];
1668 id_to_str(const guint8 *ad) {
1670 static gchar *str[17];
1672 guint8 bits8to5, bits4to1, i;
1673 static const gchar hex_digits[10] = "0123456789";
1675 p = (gchar *)&str[17];
1679 bits8to5 = (ad[i] >> 4) & 0x0F;
1680 bits4to1 = ad[i] & 0x0F;
1681 if (bits8to5 < 0xA) *--p = hex_digits[bits8to5];
1682 if (bits4to1 < 0xA) *--p = hex_digits[bits4to1];
1690 imsi_to_str(const guint8 *ad) {
1692 static gchar *str[16];
1696 p = (gchar *)&str[0];
1698 if ((ad[i] & 0x0F) <= 9) p[j++] = (ad[i] & 0x0F) + 0x30;
1699 if (((ad[i] >> 4) & 0x0F) <= 9) p[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
1707 msisdn_to_str(const guint8 *ad, int len) {
1709 static gchar *str[17];
1711 guint8 bits8to5, bits4to1, i;
1712 static const gchar hex_digits[16] = "0123456789 ";
1714 p = (gchar *)&str[0];
1718 bits8to5 = (ad[i] >> 4) & 0x0F;
1719 bits4to1 = ad[i] & 0x0F;
1720 if (bits4to1 < 0xA) *++p = hex_digits[bits4to1];
1721 if (bits8to5 < 0xA) *++p = hex_digits[bits8to5];
1722 if (i == len-1) break;
1726 return (gchar *)&str[0];
1730 time_int_to_str (guint32 time)
1738 return abs_time_to_str (&nstime);
1742 rel_time_int_to_str (guint32 time)
1750 return rel_time_to_str (&nstime);
1753 /* Next definitions and function check_field_presence checks if given field
1754 * in GTP packet is compliant with ETSI
1756 typedef struct _header {
1761 typedef struct _message {
1763 ext_header fields[32];
1766 /* ---------------------
1768 * ---------------------*/
1769 static _gtp_mess_items gprs_mess_items[] = {
1773 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1778 GTP_MSG_ECHO_RESP, {
1779 { GTP_EXT_RECOVER, GTP_MANDATORY },
1780 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1785 GTP_MSG_VER_NOT_SUPP, {
1790 GTP_MSG_NODE_ALIVE_REQ, {
1791 { GTP_EXT_NODE_ADDR, GTP_MANDATORY },
1792 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1797 GTP_MSG_NODE_ALIVE_RESP, {
1798 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1803 GTP_MSG_REDIR_REQ, {
1804 { GTP_EXT_CAUSE, GTP_MANDATORY },
1805 { GTP_EXT_NODE_ADDR, GTP_OPTIONAL },
1806 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1811 GTP_MSG_REDIR_RESP, {
1812 { GTP_EXT_CAUSE, GTP_MANDATORY },
1813 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1818 GTP_MSG_CREATE_PDP_REQ, {
1819 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1820 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1821 { GTP_EXT_SEL_MODE, GTP_MANDATORY },
1822 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1823 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1824 { GTP_EXT_MSISDN, GTP_MANDATORY },
1825 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1826 { GTP_EXT_APN, GTP_MANDATORY },
1827 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1828 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1829 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1830 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1835 GTP_MSG_CREATE_PDP_RESP, {
1836 { GTP_EXT_CAUSE, GTP_MANDATORY },
1837 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1838 { GTP_EXT_REORDER, GTP_CONDITIONAL },
1839 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1840 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1841 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1842 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1843 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1844 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1845 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1846 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1847 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1848 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1853 GTP_MSG_UPDATE_PDP_REQ, {
1854 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1855 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1856 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1857 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1858 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1859 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1860 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1865 GTP_MSG_UPDATE_PDP_RESP, {
1866 { GTP_EXT_CAUSE, GTP_MANDATORY },
1867 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1868 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1869 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1870 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1871 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1872 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1873 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1874 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1875 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1880 GTP_MSG_DELETE_PDP_REQ, {
1881 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1886 GTP_MSG_DELETE_PDP_RESP, {
1887 { GTP_EXT_CAUSE, GTP_MANDATORY },
1888 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1893 GTP_MSG_CREATE_AA_PDP_REQ, {
1894 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1895 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1896 { GTP_EXT_SEL_MODE, GTP_MANDATORY },
1897 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1898 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1899 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1900 { GTP_EXT_APN, GTP_MANDATORY },
1901 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1902 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1903 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1904 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1909 GTP_MSG_CREATE_AA_PDP_RESP, {
1910 { GTP_EXT_CAUSE, GTP_MANDATORY },
1911 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1912 { GTP_EXT_REORDER, GTP_CONDITIONAL },
1913 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1914 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1915 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1916 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1917 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1918 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1919 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1920 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1921 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1922 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1927 GTP_MSG_DELETE_AA_PDP_REQ, {
1928 { GTP_EXT_CAUSE, GTP_MANDATORY },
1929 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1934 GTP_MSG_DELETE_AA_PDP_RESP, {
1935 { GTP_EXT_CAUSE, GTP_MANDATORY },
1936 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1942 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1947 GTP_MSG_PDU_NOTIFY_REQ, {
1948 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1949 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1954 GTP_MSG_PDU_NOTIFY_RESP, {
1955 { GTP_EXT_CAUSE, GTP_MANDATORY },
1956 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1961 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1962 { GTP_EXT_CAUSE, GTP_MANDATORY },
1963 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1964 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1969 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1970 { GTP_EXT_CAUSE, GTP_MANDATORY },
1971 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1976 GTP_MSG_SEND_ROUT_INFO_REQ, {
1977 { GTP_EXT_IMSI, GTP_MANDATORY },
1978 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1983 GTP_MSG_SEND_ROUT_INFO_RESP, {
1984 { GTP_EXT_CAUSE, GTP_MANDATORY },
1985 { GTP_EXT_IMSI, GTP_MANDATORY },
1986 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
1987 { GTP_EXT_MS_REASON, GTP_OPTIONAL },
1988 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL },
1989 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1994 GTP_MSG_FAIL_REP_REQ, {
1995 { GTP_EXT_IMSI, GTP_MANDATORY },
1996 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2001 GTP_MSG_FAIL_REP_RESP, {
2002 { GTP_EXT_CAUSE, GTP_MANDATORY },
2003 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
2004 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2009 GTP_MSG_MS_PRESENT_REQ, {
2010 { GTP_EXT_IMSI, GTP_MANDATORY },
2011 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2012 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2017 GTP_MSG_MS_PRESENT_RESP, {
2018 { GTP_EXT_CAUSE, GTP_MANDATORY },
2019 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2024 GTP_MSG_IDENT_REQ, {
2025 { GTP_EXT_RAI, GTP_MANDATORY },
2026 { GTP_EXT_PTMSI, GTP_MANDATORY },
2027 { GTP_EXT_PTMSI_SIG, GTP_OPTIONAL },
2028 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2033 GTP_MSG_IDENT_RESP, {
2034 { GTP_EXT_CAUSE, GTP_MANDATORY },
2035 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2036 { GTP_EXT_AUTH_TRI, GTP_OPTIONAL },
2037 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2042 GTP_MSG_SGSN_CNTXT_REQ, {
2043 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2044 { GTP_EXT_RAI, GTP_MANDATORY },
2045 { GTP_EXT_TLLI, GTP_MANDATORY },
2046 { GTP_EXT_PTMSI_SIG, GTP_OPTIONAL },
2047 { GTP_EXT_MS_VALID, GTP_OPTIONAL },
2048 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
2053 GTP_MSG_SGSN_CNTXT_RESP, {
2054 { GTP_EXT_CAUSE, GTP_MANDATORY },
2055 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2056 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
2057 { GTP_EXT_MM_CNTXT, GTP_CONDITIONAL },
2058 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
2059 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2064 GTP_MSG_SGSN_CNTXT_ACK, {
2065 { GTP_EXT_CAUSE, GTP_MANDATORY },
2066 { GTP_EXT_FLOW_II, GTP_CONDITIONAL },
2067 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2068 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2073 GTP_MSG_DATA_TRANSF_REQ, {
2074 { GTP_EXT_TR_COMM, GTP_MANDATORY },
2075 { GTP_EXT_DATA_REQ, GTP_CONDITIONAL },
2076 { GTP_EXT_REL_PACK, GTP_CONDITIONAL },
2077 { GTP_EXT_CAN_PACK, GTP_CONDITIONAL },
2078 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2083 GTP_MSG_DATA_TRANSF_RESP, {
2084 { GTP_EXT_CAUSE, GTP_MANDATORY },
2085 { GTP_EXT_DATA_RESP, GTP_MANDATORY },
2086 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2097 /* -----------------------------
2099 * -----------------------------*/
2100 static _gtp_mess_items umts_mess_items[] = {
2104 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2109 GTP_MSG_ECHO_RESP, {
2110 { GTP_EXT_RECOVER, GTP_MANDATORY },
2111 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2116 GTP_MSG_VER_NOT_SUPP, {
2121 GTP_MSG_NODE_ALIVE_REQ, {
2122 { GTP_EXT_NODE_ADDR, GTP_MANDATORY },
2123 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2128 GTP_MSG_NODE_ALIVE_RESP, {
2129 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2134 GTP_MSG_REDIR_REQ, {
2135 { GTP_EXT_CAUSE, GTP_MANDATORY },
2136 { GTP_EXT_NODE_ADDR, GTP_OPTIONAL },
2137 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2142 GTP_MSG_REDIR_REQ, {
2147 GTP_MSG_CREATE_PDP_REQ, {
2148 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2149 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2150 { GTP_EXT_SEL_MODE, GTP_CONDITIONAL },
2151 { GTP_EXT_TEID, GTP_MANDATORY },
2152 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2153 { GTP_EXT_NSAPI, GTP_MANDATORY },
2154 { GTP_EXT_NSAPI, GTP_CONDITIONAL },
2155 { GTP_EXT_CHRG_CHAR, GTP_OPTIONAL },
2156 { GTP_EXT_TRACE_REF, GTP_OPTIONAL },
2157 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL },
2158 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
2159 { GTP_EXT_APN, GTP_CONDITIONAL },
2160 { GTP_EXT_PROTO_CONF, GTP_CONDITIONAL },
2161 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2162 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2163 { GTP_EXT_MSISDN, GTP_CONDITIONAL },
2164 { GTP_EXT_QOS_UMTS, GTP_MANDATORY },
2165 { GTP_EXT_TFT, GTP_CONDITIONAL },
2166 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL },
2167 { GTP_EXT_OMC_ID, GTP_OPTIONAL },
2168 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2173 GTP_MSG_CREATE_PDP_RESP, {
2174 { GTP_EXT_CAUSE, GTP_MANDATORY },
2175 { GTP_EXT_REORDER, GTP_CONDITIONAL },
2176 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2177 { GTP_EXT_TEID, GTP_CONDITIONAL },
2178 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2179 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
2180 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
2181 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
2182 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2183 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2184 { GTP_EXT_QOS_UMTS, GTP_CONDITIONAL },
2185 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
2186 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2190 { /* checked, SGSN -> GGSN */
2191 GTP_MSG_UPDATE_PDP_REQ, {
2192 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2193 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2194 { GTP_EXT_TEID, GTP_MANDATORY },
2195 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2196 { GTP_EXT_NSAPI, GTP_MANDATORY },
2197 { GTP_EXT_TRACE_REF, GTP_OPTIONAL },
2198 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL },
2199 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2200 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2201 { GTP_EXT_QOS_UMTS, GTP_MANDATORY },
2202 { GTP_EXT_TFT, GTP_OPTIONAL },
2203 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL },
2204 { GTP_EXT_OMC_ID, GTP_OPTIONAL },
2205 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2209 { /* checked, GGSN -> SGSN */
2210 GTP_MSG_UPDATE_PDP_RESP, {
2211 { GTP_EXT_CAUSE, GTP_MANDATORY },
2212 { GTP_EXT_RECOVER, GTP_OPTIONAL },
2213 { GTP_EXT_TEID, GTP_CONDITIONAL },
2214 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2215 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
2216 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2217 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2218 { GTP_EXT_QOS_UMTS, GTP_CONDITIONAL },
2219 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
2220 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2225 GTP_MSG_DELETE_PDP_REQ, {
2226 { GTP_EXT_TEAR_IND, GTP_CONDITIONAL },
2227 { GTP_EXT_NSAPI, GTP_MANDATORY },
2228 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2233 GTP_MSG_DELETE_PDP_RESP, {
2234 { GTP_EXT_CAUSE, GTP_MANDATORY },
2235 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2241 { GTP_EXT_TEID, GTP_MANDATORY },
2242 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2247 GTP_MSG_PDU_NOTIFY_REQ, {
2248 { GTP_EXT_IMSI, GTP_MANDATORY },
2249 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2250 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
2251 { GTP_EXT_APN, GTP_MANDATORY },
2252 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2253 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2258 GTP_MSG_PDU_NOTIFY_RESP, {
2259 { GTP_EXT_CAUSE, GTP_MANDATORY },
2260 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2265 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2266 { GTP_EXT_CAUSE, GTP_MANDATORY },
2267 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2268 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
2269 { GTP_EXT_APN, GTP_MANDATORY },
2270 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2275 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2276 { GTP_EXT_CAUSE, GTP_MANDATORY },
2277 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2282 GTP_MSG_SUPP_EXT_HDR, {
2283 { GTP_EXT_HDR_LIST, GTP_MANDATORY },
2288 GTP_MSG_SEND_ROUT_INFO_REQ, {
2289 { GTP_EXT_IMSI, GTP_MANDATORY },
2290 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2295 GTP_MSG_SEND_ROUT_INFO_RESP, {
2296 { GTP_EXT_CAUSE, GTP_MANDATORY },
2297 { GTP_EXT_IMSI, GTP_MANDATORY },
2298 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
2299 { GTPv1_EXT_MS_REASON, GTP_OPTIONAL },
2300 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL },
2301 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2306 GTP_MSG_FAIL_REP_REQ, {
2307 { GTP_EXT_IMSI, GTP_MANDATORY },
2308 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2313 GTP_MSG_FAIL_REP_RESP, {
2314 { GTP_EXT_CAUSE, GTP_MANDATORY },
2315 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
2316 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2321 GTP_MSG_MS_PRESENT_REQ, {
2322 { GTP_EXT_IMSI, GTP_MANDATORY },
2323 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2324 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2329 GTP_MSG_MS_PRESENT_RESP, {
2330 { GTP_EXT_CAUSE, GTP_MANDATORY },
2331 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2336 GTP_MSG_IDENT_REQ, {
2337 { GTP_EXT_RAI, GTP_MANDATORY },
2338 { GTP_EXT_PTMSI, GTP_MANDATORY },
2339 { GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL },
2340 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2345 GTP_MSG_IDENT_RESP, {
2346 { GTP_EXT_CAUSE, GTP_MANDATORY },
2347 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2348 { GTP_EXT_AUTH_TRI, GTP_CONDITIONAL },
2349 { GTP_EXT_AUTH_QUI, GTP_CONDITIONAL },
2350 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2355 GTP_MSG_SGSN_CNTXT_REQ, {
2356 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2357 { GTP_EXT_RAI, GTP_MANDATORY },
2358 { GTP_EXT_TLLI, GTP_CONDITIONAL },
2359 { GTP_EXT_PTMSI, GTP_CONDITIONAL },
2360 { GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL },
2361 { GTP_EXT_MS_VALID, GTP_OPTIONAL },
2362 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2363 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2364 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2369 GTP_MSG_SGSN_CNTXT_RESP, {
2370 { GTP_EXT_CAUSE, GTP_MANDATORY },
2371 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2372 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2373 { GTP_EXT_RP_SMS, GTP_OPTIONAL },
2374 { GTP_EXT_RP, GTP_OPTIONAL },
2375 { GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL },
2376 { GTP_EXT_MM_CNTXT, GTP_CONDITIONAL },
2377 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
2378 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2379 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2384 GTP_MSG_SGSN_CNTXT_ACK, {
2385 { GTP_EXT_CAUSE, GTP_MANDATORY },
2386 { GTP_EXT_TEID_II, GTP_CONDITIONAL },
2387 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2388 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2393 GTP_MSG_FORW_RELOC_REQ, {
2394 { GTP_EXT_IMSI, GTP_MANDATORY },
2395 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2396 { GTP_EXT_RANAP_CAUSE, GTP_MANDATORY },
2397 { GTP_EXT_MM_CNTXT, GTP_MANDATORY },
2398 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
2399 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2400 { GTP_EXT_TARGET_ID, GTP_MANDATORY },
2401 { GTP_EXT_UTRAN_CONT, GTP_MANDATORY },
2402 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2407 GTP_MSG_FORW_RELOC_RESP, {
2408 { GTP_EXT_CAUSE, GTP_MANDATORY },
2409 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2410 { GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL },
2411 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2412 { GTP_EXT_UTRAN_CONT, GTP_OPTIONAL },
2413 { GTP_EXT_RAB_SETUP, GTP_CONDITIONAL },
2414 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2419 GTP_MSG_FORW_RELOC_COMP, {
2420 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2425 GTP_MSG_RELOC_CANCEL_REQ, {
2426 { GTP_EXT_IMSI, GTP_MANDATORY },
2427 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2432 GTP_MSG_RELOC_CANCEL_RESP, {
2433 { GTP_EXT_CAUSE, GTP_MANDATORY },
2434 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2439 GTP_MSG_FORW_RELOC_ACK, {
2440 { GTP_EXT_CAUSE, GTP_MANDATORY },
2441 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2446 GTP_MSG_FORW_SRNS_CNTXT, {
2447 { GTP_EXT_RAB_CNTXT, GTP_MANDATORY },
2448 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2453 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2454 { GTP_EXT_CAUSE, GTP_MANDATORY },
2455 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2467 check_field_presence(guint8 message, guint8 field, int *position) {
2470 _gtp_mess_items *mess_items;
2472 switch(gtp_version) {
2474 mess_items = gprs_mess_items;
2477 mess_items = umts_mess_items;
2483 while (mess_items[i].code) {
2484 if (mess_items[i].code == message) {
2486 while (mess_items[i].fields[*position].code) {
2487 if (mess_items[i].fields[*position].code == field) {
2491 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
2492 return mess_items[i].fields[(*position)++].code;
2505 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2507 /* GPRS: 9.60 v7.6.0, chapter
2508 * UMTS: 29.060 v4.0, chapter
2511 decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2515 cause = tvb_get_guint8(tvb, offset+1);
2517 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_cause : hf_gtpv0_cause, tvb, offset, 2, cause);
2522 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2523 * UMTS: 29.060 v4.0, chapter 7.7.2
2526 decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2531 tvb_memcpy(tvb, imsi_val, offset+1, 8);
2532 imsi_str = imsi_to_str (imsi_val);
2534 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_imsi : hf_gtpv0_imsi, tvb, offset, 9, imsi_str);
2539 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2540 * UMTS: 29.060 v4.0, chapter 7.7.3
2541 * TODO: Add details about MCC, MNC, LAC, RAC (show each digit) ?
2544 decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2546 proto_tree *ext_tree_rai;
2550 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));
2551 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2553 /* tvb_memcpy (tvb, (guint8 *)&byte, offset + 1, 3); */
2554 byte[1] = tvb_get_guint8 (tvb, offset + 1);
2555 byte[2] = tvb_get_guint8 (tvb, offset + 2);
2556 byte[3] = tvb_get_guint8 (tvb, offset + 3);
2559 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mcc : hf_gtpv0_rai_mcc, tvb, offset+1, 2, (byte[1] & 0x0F) * 100 + ((byte[1] & 0xF0) >> 4) * 10 + (byte[2] & 0x0F ));
2560 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_mnc : hf_gtpv0_rai_mnc, tvb, offset+2, 2, ((byte[3] & 0xF0) >> 4 ) * 10 + (byte[3] & 0x0F));
2561 proto_tree_add_uint(ext_tree_rai, gtp_version ? hf_gtpv1_rai_lac : hf_gtpv0_rai_lac, tvb, offset+4, 2, tvb_get_ntohs (tvb, offset+4));
2562 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));
2567 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2568 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2571 decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2575 tlli = tvb_get_ntohl(tvb, offset+1);
2576 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tlli : hf_gtpv0_tlli, tvb, offset, 5, tlli);
2581 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
2582 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
2585 decode_gtp_ptmsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2589 ptmsi = tvb_get_ntohl(tvb, offset);
2590 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi : hf_gtpv0_ptmsi, tvb, offset, 5, ptmsi);
2595 /* adjust - how many bytes before offset should be highlighted
2598 decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 adjust) {
2600 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
2601 proto_tree *ext_tree_qos;
2604 spare1 = tvb_get_guint8(tvb, offset) & 0xC0;
2605 delay = tvb_get_guint8(tvb, offset) & 0x38;
2606 reliability = tvb_get_guint8(tvb, offset) & 0x07;
2607 peak = tvb_get_guint8(tvb, offset+1) & 0xF0;
2608 spare2 = tvb_get_guint8(tvb, offset+1) & 0x08;
2609 precedence = tvb_get_guint8(tvb, offset+1) & 0x07;
2610 spare3 = tvb_get_guint8(tvb, offset+2) & 0xE0;
2611 mean = tvb_get_guint8(tvb, offset+2) & 0x1F;
2613 te = proto_tree_add_text(tree, tvb, offset-adjust, 3+adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
2614 qos_str, delay, reliability, peak, precedence, mean);
2615 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
2618 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare1, tvb, offset, 1, spare1);
2619 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_delay, tvb, offset, 1, delay);
2620 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_reliability, tvb, offset, 1, reliability);
2621 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_peak, tvb, offset+1, 1, peak);
2622 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare2, tvb, offset+1, 1, spare2);
2623 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_precedence, tvb, offset+1, 1, precedence);
2624 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_spare3, tvb, offset+2, 1, spare3);
2625 proto_tree_add_uint(ext_tree_qos, hf_gtpv0_qos_mean, tvb, offset+2, 1, mean);
2631 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
2635 * TODO: check if length is included: ETSI 4.08 vs 9.60
2638 decode_gtp_qos_gprs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2640 return (1+decode_qos_gprs(tvb, offset+1, tree, "Quality of Service", 1));
2644 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
2645 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
2648 decode_gtp_reorder(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2652 reorder = tvb_get_guint8(tvb, offset+1) & 0x01;
2653 proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_reorder : hf_gtpv0_reorder, tvb, offset, 2, reorder);
2658 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
2659 * 4.08 v7.1.2, chapter 10.5.3.1+
2660 * UMTS: 29.060 v4.0, chapter 7.7.7
2661 * TODO: Add blurb support by registering items in the protocol registration
2664 decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2666 proto_tree *ext_tree_auth_tri;
2669 te = proto_tree_add_text(tree, tvb, offset, 29, val_to_str(GTP_EXT_AUTH_TRI, gtp_val, "Unknown message"));
2670 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
2672 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+1, 16));
2673 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset+17, 4));
2674 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset+21, 8));
2679 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
2680 * 9.02 v7.7.0, page 1090
2681 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
2682 * 29.002 v4.2.1, chapter 17.5, page 268
2685 decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2689 map_cause = tvb_get_guint8(tvb, offset+1);
2690 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_map_cause : hf_gtpv0_map_cause, tvb, offset, 2, map_cause);
2695 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
2696 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
2699 decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2703 ptmsi_sig = tvb_get_ntoh24(tvb, offset+1);
2704 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ptmsi_sig : hf_gtpv0_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
2709 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
2710 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
2713 decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2717 ms_valid = tvb_get_guint8(tvb, offset+1) & 0x01;
2718 proto_tree_add_boolean(tree, gtp_version ? hf_gtpv1_ms_valid : hf_gtpv0_ms_valid, tvb, offset, 2, ms_valid);
2723 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
2724 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
2727 decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2731 recovery = tvb_get_guint8(tvb, offset+1);
2732 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_recovery : hf_gtpv0_recovery, tvb, offset, 2, recovery);
2737 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
2738 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
2741 decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2745 sel_mode = tvb_get_guint8(tvb, offset+1) & 0x03;
2746 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_sel_mode : hf_gtpv0_sel_mode, tvb, offset, 2, sel_mode);
2751 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
2752 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
2755 decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2757 guint16 ext_flow_label;
2760 switch (gtp_version) {
2762 ext_flow_label = tvb_get_ntohs(tvb, offset+1);
2763 proto_tree_add_uint(tree, hf_gtpv0_ext_flow_label, tvb, offset, 3, ext_flow_label);
2767 teid_data = tvb_get_ntohl(tvb, offset+1);
2768 proto_tree_add_uint(tree, hf_gtpv1_teid_data, tvb, offset, 5, teid_data);
2772 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
2778 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
2779 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
2782 decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2787 switch (gtp_version) {
2789 flow_sig = tvb_get_ntohs(tvb, offset+1);
2790 proto_tree_add_uint(tree, hf_gtpv0_flow_sig, tvb, offset, 3, flow_sig);
2794 teid_cp = tvb_get_ntohl(tvb, offset+1);
2795 proto_tree_add_uint(tree, hf_gtpv1_teid_cp, tvb, offset, 5, teid_cp);
2799 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
2805 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
2806 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
2809 decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2813 proto_tree *ext_tree_flow_ii;
2816 switch (gtp_version) {
2818 te = proto_tree_add_text(tree, tvb, offset, 4, val_to_str(GTP_EXT_FLOW_II, gtp_val, "Unknown message"));
2819 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
2821 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2823 flow_ii = tvb_get_ntohs(tvb, offset+2);
2824 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv0_flow_ii, tvb, offset+2, 2, flow_ii);
2828 te = proto_tree_add_text(tree, tvb, offset, 6, val_to_str(GTP_EXT_TEID_II, gtp_val, "Unknown message"));
2829 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
2831 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2834 teid_ii = tvb_get_ntohl(tvb, offset+2);
2835 proto_tree_add_uint(ext_tree_flow_ii, hf_gtpv1_teid_ii, tvb, offset+2, 4, teid_ii);
2839 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
2845 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
2846 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
2847 * Check if all ms_reason types are included
2850 decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2854 field19 = tvb_get_guint8(tvb, offset+1);
2856 switch (gtp_version) {
2858 proto_tree_add_uint(tree, hf_gtpv0_ms_reason, tvb, offset, 2, field19);
2862 proto_tree_add_boolean(tree, hf_gtpv1_tear_ind, tvb, offset, 2, field19 & 0x01);
2866 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
2874 /* GPRS: not present
2875 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
2878 decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2882 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2883 proto_tree_add_uint(tree, hf_gtpv1_nsapi, tvb, offset, 2, nsapi);
2888 /* GPRS: not present
2889 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
2892 decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2896 ranap = tvb_get_guint8(tvb, offset+1);
2898 if(ranap > 0 && ranap <=64)
2899 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);
2901 if(ranap > 64 && ranap <=80)
2902 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);
2904 if(ranap > 80 && ranap <=96)
2905 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);
2907 if(ranap > 96 && ranap <=112)
2908 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);
2910 if(ranap > 112 && ranap <=128)
2911 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);
2913 if(ranap > 128 && ranap <=255)
2914 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);
2919 /* GPRS: not present
2920 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
2923 decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2925 guint8 nsapi, dl_pdcp_seq, ul_pdcp_seq;
2926 guint16 dl_gtpu_seq, ul_gtpu_seq;
2927 proto_tree *ext_tree_rab_cntxt;
2930 te = proto_tree_add_text(tree, tvb, offset, 8, val_to_str(GTP_EXT_RAB_CNTXT, gtp_val, "Unknown message"));
2931 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
2933 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2934 dl_gtpu_seq = tvb_get_ntohs(tvb, offset+2);
2935 ul_gtpu_seq = tvb_get_ntohs(tvb, offset+4);
2936 dl_pdcp_seq = tvb_get_guint8(tvb, offset+6);
2937 ul_pdcp_seq = tvb_get_guint8(tvb, offset+7);
2939 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_nsapi, tvb, offset+1, 1, nsapi);
2940 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_gtpu_dn, tvb, offset+2, 2, dl_gtpu_seq);
2941 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_gtpu_up, tvb, offset+4, 2, ul_gtpu_seq);
2942 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_pdu_dn, tvb, offset+6, 1, dl_pdcp_seq);
2943 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtpv1_rab_pdu_up, tvb, offset+7, 1, ul_pdcp_seq);
2949 /* GPRS: not present
2950 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
2953 decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2957 rp_sms = tvb_get_guint8(tvb, offset+1) & 0x07;
2958 proto_tree_add_uint(tree, hf_gtpv1_rp_sms, tvb, offset, 2, rp_sms);
2963 /* GPRS: not present
2964 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
2967 decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2969 proto_tree *ext_tree_rp;
2971 guint8 nsapi, rp, spare;
2973 nsapi = tvb_get_guint8(tvb, offset+1) & 0xF0;
2974 spare = tvb_get_guint8(tvb, offset+1) & 0x08;
2975 rp = tvb_get_guint8(tvb, offset+1) & 0x07;
2977 te = proto_tree_add_uint_format(tree, hf_gtpv1_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
2978 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
2980 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp_nsapi, tvb, offset+1, 1, nsapi);
2981 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp_spare, tvb, offset+1, 1, spare);
2982 proto_tree_add_uint(ext_tree_rp, hf_gtpv1_rp, tvb, offset+1, 1, rp);
2987 /* GPRS: not present
2988 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
2991 decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2993 proto_tree *ext_tree_pkt_flow_id;
2995 guint8 nsapi, pkt_flow_id;
2997 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2998 pkt_flow_id = tvb_get_guint8(tvb, offset+2);
3000 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);
3001 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
3003 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtpv1_nsapi, tvb, offset+1, 1, nsapi);
3004 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);
3009 /* GPRS: not present
3010 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
3011 * TODO: Differenciate these uints?
3014 decode_gtp_chrg_char(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3018 proto_tree *ext_tree_chrg_char;
3020 chrg_char = tvb_get_ntohs(tvb, offset+1);
3022 te = proto_tree_add_text(tree, tvb, offset, 3, "%s: %x", val_to_str(GTP_EXT_CHRG_CHAR, gtp_val, "Unknown message"), chrg_char);
3023 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
3025 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_s, tvb, offset+1, 2, chrg_char);
3026 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_n, tvb, offset+1, 2, chrg_char);
3027 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_p, tvb, offset+1, 2, chrg_char);
3028 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_f, tvb, offset+1, 2, chrg_char);
3029 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_h, tvb, offset+1, 2, chrg_char);
3030 proto_tree_add_uint(ext_tree_chrg_char, hf_gtpv1_chrg_char_r, tvb, offset+1, 2, chrg_char);
3035 /* GPRS: not present
3036 * UMTS: 29.060 v4.0, chapter 7.7.24, page
3039 decode_gtp_trace_ref(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3043 trace_ref = tvb_get_ntohs(tvb, offset+1);
3045 proto_tree_add_uint(tree, hf_gtpv1_trace_ref, tvb, offset, 3, trace_ref);
3050 /* GPRS: not present
3051 * UMTS: 29.060 v4.0, chapter 7.7.25, page
3054 decode_gtp_trace_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3058 trace_type = tvb_get_ntohs(tvb, offset+1);
3060 proto_tree_add_uint(tree, hf_gtpv1_trace_type, tvb, offset, 3, trace_type);
3065 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
3066 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
3069 decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3073 reason = tvb_get_guint8(tvb, offset+1);
3075 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_ms_reason : hf_gtpv0_ms_reason, tvb, offset, 2, reason);
3081 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
3085 decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3089 tr_command = tvb_get_guint8(tvb, offset+1);
3091 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_tr_comm : hf_gtpv0_tr_comm, tvb, offset, 2, tr_command);
3096 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
3097 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
3100 decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3104 chrg_id = tvb_get_ntohl(tvb, offset+1);
3105 proto_tree_add_uint(tree, gtp_version ? hf_gtpv1_chrg_id : hf_gtpv0_chrg_id, tvb, offset, 5, chrg_id);
3110 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
3111 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
3114 decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3117 guint8 pdp_typ, pdp_org;
3119 struct e_in6_addr addr_ipv6;
3120 proto_tree *ext_tree_user;
3124 length = tvb_get_ntohs(tvb, offset+1);
3125 pdp_org = tvb_get_guint8(tvb, offset+3) & 0x0F;
3126 pdp_typ = tvb_get_guint8(tvb, offset+4);
3128 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s (%s/%s)",
3129 val_to_str(GTP_EXT_USER_ADDR, gtp_val, "Unknown message"),
3130 val_to_str(pdp_org, pdp_org_type, "Unknown PDP Organization"),
3131 val_to_str(pdp_typ, pdp_type, "Unknown PDP Type"));
3132 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
3134 proto_tree_add_text(ext_tree_user, tvb, offset+1, 2, "Length : %u", length);
3135 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);
3136 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);
3139 if (pdp_org == 0 && pdp_typ == 1)
3140 proto_item_append_text(te, " (Point to Point Protocol)");
3141 else if (pdp_typ == 2)
3142 proto_item_append_text(te, " (Octet Stream Protocol)");
3143 } else if (length > 2) {
3146 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+5, sizeof addr_ipv4);
3147 proto_tree_add_ipv4(ext_tree_user, gtp_version ? hf_gtpv1_user_ipv4 : hf_gtpv0_user_ipv4, tvb, offset+5, 4, addr_ipv4);
3148 proto_item_append_text(te, " : %s", ip_to_str((guint8 *)&addr_ipv4));
3151 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+5, sizeof addr_ipv6);
3152 proto_tree_add_ipv6(ext_tree_user, gtp_version ? hf_gtpv1_user_ipv6 : hf_gtpv0_user_ipv6, tvb, offset+5, 16, (guint8 *)&addr_ipv6);
3153 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3157 proto_item_append_text(te, " : empty PDP Address");
3163 decode_triplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
3165 proto_tree *ext_tree_trip;
3166 proto_item *te_trip;
3169 for (i=0;i<count;i++) {
3170 te_trip = proto_tree_add_text(tree, tvb, offset+i*28, 28, "Triplet no%x", i);
3171 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
3173 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+i*28, 16));
3174 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+16, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset+i*28+16, 4));
3175 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28+20, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset+i*28+20, 8));
3181 /* adjust - how many bytes before quintuplet should be highlighted
3184 decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count, guint8 adjust) {
3186 proto_tree *ext_tree_quint;
3187 proto_item *te_quint;
3188 guint16 q_len, xres_len, auth_len, q_offset, i;
3192 for (i=0;i<count;i++) {
3194 offset = offset + q_offset;
3196 q_len = tvb_get_ntohs(tvb, offset);
3198 te_quint = proto_tree_add_text(tree, tvb, offset-adjust, q_len+adjust, "Quintuplet #%x", i);
3199 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
3201 proto_tree_add_text(ext_tree_quint, tvb, offset, 2, "Length: %x", q_len);
3202 proto_tree_add_text(ext_tree_quint, tvb, offset+2, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+2, 16));
3203 xres_len = tvb_get_ntohs(tvb, offset+18);
3204 proto_tree_add_text(ext_tree_quint, tvb, offset+18, 2, "XRES length: %u", xres_len);
3205 proto_tree_add_text(ext_tree_quint, tvb, offset+20, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset+20, xres_len));
3206 proto_tree_add_text(ext_tree_quint, tvb, offset+20+xres_len, 16, "Quintuplet ciphering key: %s", tvb_bytes_to_str(tvb, offset+20+xres_len, 16));
3207 proto_tree_add_text(ext_tree_quint, tvb, offset+36+xres_len, 16, "Quintuplet integrity key: %s", tvb_bytes_to_str(tvb, offset+36+xres_len, 16));
3208 auth_len = tvb_get_ntohs(tvb, offset+52+xres_len);
3209 proto_tree_add_text(ext_tree_quint, tvb, offset+52+xres_len, 2, "Authentication length: %u", auth_len);
3210 proto_tree_add_text(ext_tree_quint, tvb, offset+54+xres_len, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset+54+xres_len, auth_len));
3212 q_offset = q_offset + q_len + 2;
3218 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
3219 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
3220 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
3221 * - finish displaying last 3 parameters
3224 decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3226 guint16 length, quint_len, net_cap, con_len;
3227 guint8 cksn, count, sec_mode, cipher, trans_id, proto_disc, message, drx_split, drx_len, drx_ccch, non_drx_timer;
3228 proto_tree *ext_tree_mm;
3231 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_MM_CNTXT, gtp_val, "Unknown message"));
3232 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
3234 length = tvb_get_ntohs(tvb, offset+1);
3235 if (length < 1) return 3;
3237 cksn = tvb_get_guint8(tvb, offset+3) & 0x07;
3238 sec_mode = (tvb_get_guint8(tvb, offset+4) >> 6) & 0x03;
3239 count = (tvb_get_guint8(tvb, offset+4) >> 3) & 0x07;
3240 cipher = tvb_get_guint8(tvb, offset+4) & 0x07;
3242 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 2, "Length: %x", length);
3243 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Ciphering Key Sequence Number: %u", cksn);
3244 if (gtp_version != 0) {
3245 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Security type: %u (%s)", sec_mode,
3246 val_to_str(sec_mode, mm_sec_modep, "Unknown"));
3251 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "No of triplets: %u", count);
3256 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3258 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3260 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset+5, 16));
3261 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key CK: %s", tvb_bytes_to_str(tvb, offset+21, 16));
3262 quint_len = tvb_get_ntohs(tvb, offset+37);
3263 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
3265 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 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset+5, 8));
3277 offset = offset + decode_triplet(tvb, offset+13, ext_tree_mm, count) + 13;
3281 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset+5, 16));
3282 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key CK: %s", tvb_bytes_to_str(tvb, offset+21, 16));
3283 quint_len = tvb_get_ntohs(tvb, offset+37);
3284 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
3286 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
3291 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
3293 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
3295 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset+5, 8));
3296 quint_len = tvb_get_ntohs(tvb, offset+13);
3297 proto_tree_add_text(ext_tree_mm, tvb, offset+13, 2, "Quintuplets length: %x", quint_len);
3299 offset = offset + decode_quintuplet(tvb, offset+15, ext_tree_mm, count, 0) + 15;
3307 drx_split = tvb_get_guint8(tvb, offset);
3308 drx_len = (tvb_get_guint8(tvb, offset+1) >> 4) & 0x0F;
3309 drx_ccch = (tvb_get_guint8(tvb, offset+1) >> 3) & 0x01;
3310 non_drx_timer = tvb_get_guint8(tvb, offset+1) & 0x07;
3312 net_cap = tvb_get_ntohs(tvb, offset+2);
3313 con_len = tvb_get_ntohs(tvb, offset+4);
3315 proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "DRX: split PG cycle code: %u", drx_split);
3316 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: CN specific DRX cycle length coefficient: %u", drx_len);
3317 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: split PG cycle on CCCH supported by MS: %s", yesno[drx_ccch]);
3318 if (non_drx_timer == 0) {
3319 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: no non-DRX mode after transfer state");
3321 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);
3324 proto_tree_add_text(ext_tree_mm, tvb, offset+2, 2, "MS network capability: %u", net_cap);
3325 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 2, "Container length: %u", con_len);
3328 trans_id = (tvb_get_guint8(tvb, offset+6) >> 4) & 0x0F;
3329 proto_tree_add_text(ext_tree_mm, tvb, offset+6, 1, "Transaction identifier: 0x%x", trans_id);
3330 proto_disc = tvb_get_guint8(tvb, offset+6) & 0x0F;
3331 proto_tree_add_text(ext_tree_mm, tvb, offset+6, 1, "Protocol discriminator: 0x%x (%s)", proto_disc,
3332 val_to_str(proto_disc, mm_proto_disc, "Unknown"));
3333 message = tvb_get_guint8(tvb, offset+7);
3336 case MM_PROTO_RR_MGMT:
3337 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3338 val_to_str(message, mm_rr_mess, "Unknown"));
3341 case MM_PROTO_MM_NON_GPRS:
3342 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3343 val_to_str(message, mm_mm_mess, "Unknown"));
3346 case MM_PROTO_CALL_CONTROL:
3347 case MM_PROTO_GROUP_CALL_CONTROL:
3348 case MM_PROTO_BROADCAST_CALL_CONTROL:
3349 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3350 val_to_str(message, mm_cc_mess, "Unknown"));
3353 case MM_PROTO_MM_GPRS:
3354 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3355 val_to_str(message, mm_gprs_mess, "Unknown"));
3359 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x", message);
3362 /* XXX - dissect additional IEs from GSM L3 message */
3368 /* Function to extract the value of an hexadecimal octet. Only the lower
3369 * nybble will be non-zero in the output.
3371 static guint8 hex2dec (guint8 x)
3373 if ((x >= 'a') && (x <= 'f'))
3375 else if ((x >= 'A') && (x <= 'F'))
3377 else if ((x >= '0') && (x <= '9'))
3384 /* Wrapper function to add UTF-8 decoding for QoS attributes in
3387 static guint8 wrapped_tvb_get_guint8(
3388 tvbuff_t *tvb, int offset, int type)
3391 return (hex2dec(tvb_get_guint8(tvb, offset)) << 4
3392 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
3394 return tvb_get_guint8(tvb, offset);
3397 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3398 * so type means length of length :-)
3400 * WARNING :) type does not mean length of length any more... see below for
3404 decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 type) {
3407 guint8 al_ret_priority;
3408 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3409 guint8 traf_class, del_order, del_err_sdu;
3410 guint8 max_sdu_size, max_ul, max_dl;
3411 guint8 res_ber, sdu_err_ratio;
3412 guint8 trans_delay, traf_handl_prio;
3413 guint8 guar_ul, guar_dl;
3414 proto_tree *ext_tree_qos;
3416 int mss, mu, md, gu, gd;
3418 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
3419 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
3420 * to one byte to be dissected).
3421 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
3422 * corresponds to one byte to be dissected)
3424 guint8 utf8_type = 1;
3426 /* In RADIUS messages the QoS has a version field of two octets prepended.
3427 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
3428 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
3429 * inconsistent and unuseful, I will check hyphen presence here and
3430 * will signal its presence.
3432 guint8 version_buffer[2];
3435 /* Will keep the value that will be returned
3441 length = tvb_get_guint8 (tvb, offset);
3442 te = proto_tree_add_text (tree, tvb, offset, length + 1, "%s", qos_str);
3443 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3444 proto_tree_add_text (ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3446 retval = length + 1;
3449 length = tvb_get_ntohs (tvb, offset + 1);
3450 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3451 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3452 proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3453 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
3454 retval = length + 3;
3457 /* For QoS inside RADIUS Client messages from GGSN */
3460 /* The field in the RADIUS message starts one byte before :) */
3461 length = tvb_get_guint8 (tvb, offset);
3462 te = proto_tree_add_text (tree, tvb, offset - 1, length, "%s", qos_str);
3464 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3465 version_buffer[0] = tvb_get_guint8(tvb, offset + 1);
3466 version_buffer[1] = tvb_get_guint8(tvb, offset + 2);
3467 proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Version: %c%c", version_buffer[0], version_buffer[1]);
3469 /* Hyphen handling */
3470 hyphen = tvb_get_guint8(tvb, offset + 3);
3471 if (hyphen == ((guint8) '-'))
3473 /* Hyphen is present, put in protocol tree */
3474 proto_tree_add_text (ext_tree_qos, tvb, offset + 3, 1, "Hyphen separator: -");
3475 offset++; /* "Get rid" of hyphen */
3478 /* Now, we modify offset here and in order to use type later
3481 retval = length + 3; /* Actually, will be ignored. */
3484 /* XXX - what should we do with the length here? */
3487 ext_tree_qos = NULL;
3491 /* In RADIUS messages there is no allocation-retention priority
3492 * so I don't need to wrap the following call to tvb_get_guint8
3494 al_ret_priority = tvb_get_guint8 (tvb, offset);
3496 /* All calls are wrapped to take into account the possibility that the
3497 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
3498 * of the offset will be the same as in the previous version of this
3499 * dissector, and the wrapped function will serve as a dumb wrapper;
3500 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
3501 * two bytes for needed shift, and the wrapped function will unencode
3502 * two values from the input.
3504 spare1 = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0xC0;
3505 delay = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x38;
3506 reliability = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x07;
3507 peak = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3508 spare2 = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x08;
3509 precedence = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x07;
3510 spare3 = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3511 mean = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0x1F;
3513 /* In RADIUS messages there is no allocation-retention priority */
3515 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3517 /* All additions must take care of the fact that QoS fields in RADIUS
3518 * messages are UTF-8 encoded, so we have to use the same trick as above.
3520 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare1, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, spare1);
3521 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_delay, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, delay);
3522 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_reliability, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, reliability);
3523 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_peak, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, peak);
3524 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare2, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, spare2);
3525 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_precedence, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, precedence);
3526 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_spare3, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, spare3);
3527 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_mean, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, mean);
3531 /* See above for the need of wrapping
3533 traf_class = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3534 del_order = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x18;
3535 del_err_sdu = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x07;
3536 max_sdu_size = wrapped_tvb_get_guint8(tvb, offset+(5 - 1) * utf8_type + 1, utf8_type);
3537 max_ul = wrapped_tvb_get_guint8(tvb, offset+(6 - 1) * utf8_type + 1, utf8_type);
3538 max_dl = wrapped_tvb_get_guint8(tvb, offset+(7 - 1) * utf8_type + 1, utf8_type);
3539 res_ber = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3540 sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0x0F;
3541 trans_delay = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0xFC;
3542 traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0x03;
3543 guar_ul = wrapped_tvb_get_guint8(tvb, offset+(10 - 1) * utf8_type + 1, utf8_type);
3544 guar_dl = wrapped_tvb_get_guint8(tvb, offset+(11 - 1) * utf8_type + 1, utf8_type);
3546 /* See above comments for the changes
3548 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_class, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, traf_class);
3549 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_order, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, del_order);
3550 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_del_err_sdu, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, del_err_sdu);
3551 if (max_sdu_size == 0 || max_sdu_size > 150)
3552 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+(5 - 1) * utf8_type + 1, utf8_type, max_sdu_size);
3553 if (max_sdu_size > 0 && max_sdu_size <= 150) {
3554 mss = max_sdu_size*10;
3555 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_sdu_size, tvb, offset+(5 - 1) * utf8_type + 1, utf8_type, mss, "Maximum SDU size : %u octets", mss);
3558 if(max_ul == 0 || max_ul == 255)
3559 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul);
3560 if(max_ul > 0 && max_ul <= 63)
3561 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul, "Maximum bit rate for uplink : %u kbps", max_ul);
3562 if(max_ul > 63 && max_ul <=127) {
3563 mu = 64 + ( max_ul - 64 ) * 8;
3564 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
3567 if(max_ul > 127 && max_ul <=254) {
3568 mu = 576 + ( max_ul - 128 ) * 64;
3569 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
3572 if(max_dl == 0 || max_dl == 255)
3573 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl);
3574 if(max_dl > 0 && max_dl <= 63)
3575 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl, "Maximum bit rate for downlink : %u kbps", max_dl);
3576 if(max_dl > 63 && max_dl <=127) {
3577 md = 64 + ( max_dl - 64 ) * 8;
3578 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
3580 if(max_dl > 127 && max_dl <=254) {
3581 md = 576 + ( max_dl - 128 ) * 64;
3582 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
3585 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_res_ber, tvb, offset+(8 - 1) * utf8_type + 1, utf8_type, res_ber);
3586 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_sdu_err_ratio, tvb, offset+(8 - 1) * utf8_type + 1, utf8_type, sdu_err_ratio);
3587 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_trans_delay, tvb, offset+(9 - 1) * utf8_type + 1, utf8_type, trans_delay);
3588 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_traf_handl_prio, tvb, offset+(9 - 1) * utf8_type + 1, utf8_type, traf_handl_prio);
3590 if(guar_ul == 0 || guar_ul == 255)
3591 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul);
3592 if(guar_ul > 0 && guar_ul <= 63)
3593 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul, "Guaranteed bit rate for uplink : %u kbps", guar_ul);
3594 if(guar_ul > 63 && guar_ul <=127) {
3595 gu = 64 + ( guar_ul - 64 ) * 8;
3596 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3598 if(guar_ul > 127 && guar_ul <=254) {
3599 gu = 576 + ( guar_ul - 128 ) * 64;
3600 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3603 if(guar_dl == 0 || guar_dl == 255)
3604 proto_tree_add_uint(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl);
3605 if(guar_dl > 0 && guar_dl <= 63)
3606 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl, "Guaranteed bit rate for downlink : %u kbps", guar_dl);
3607 if(guar_dl > 63 && guar_dl <=127) {
3608 gd = 64 + ( guar_dl - 64 ) * 8;
3609 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3611 if(guar_dl > 127 && guar_dl <=254) {
3612 gd = 576 + ( guar_dl - 128 ) * 64;
3613 proto_tree_add_uint_format(ext_tree_qos, hf_gtpv1_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3622 decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) {
3625 guint8 name_len, tmp;
3628 apn = g_malloc (length + 1);
3629 name_len = tvb_get_guint8 (tvb, offset);
3631 if (name_len < 0x20) {
3632 tvb_memcpy (tvb, apn, offset + 1, length);
3634 if (name_len >= length - 1) break;
3636 name_len = name_len + apn[tmp] + 1;
3640 tvb_memcpy (tvb, apn, offset, length);
3643 apn[length-1] = '\0';
3644 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_apn : hf_gtpv0_apn, tvb, offset, length, apn);
3649 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
3650 * UMTS: 29.060 v4.0, chapter 7.7.29
3651 * TODO: unify addr functions
3654 decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3656 guint8 ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id,
3657 pdp_type_org, pdp_type_num, pdp_addr_len;
3658 guint16 length, sn_down, sn_up, up_flow;
3659 guint32 addr_ipv4, up_teid, up_teid_cp;
3660 struct e_in6_addr addr_ipv6;
3661 proto_tree *ext_tree_pdp;
3664 length = tvb_get_ntohs(tvb, offset+1);
3666 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_PDP_CNTXT, gtp_val, "Unknown message"));
3667 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
3669 vaa = (tvb_get_guint8(tvb, offset+3) >> 6) & 0x01;
3670 order = (tvb_get_guint8(tvb, offset+3) >> 4) & 0x01;
3671 nsapi = tvb_get_guint8(tvb, offset+3) & 0x0F;
3672 sapi = tvb_get_guint8(tvb, offset+4) & 0x0F;
3674 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "VPLMN address allowed: %s", yesno[vaa]);
3675 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "Reordering required: %s", yesno[order]);
3676 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "NSAPI: %u", nsapi);
3677 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "SAPI: %u", sapi);
3679 switch (gtp_version) {
3681 decode_qos_gprs(tvb, offset+5, ext_tree_pdp, "QoS subscribed", 0);
3682 decode_qos_gprs(tvb, offset+8, ext_tree_pdp, "QoS requested", 0);
3683 decode_qos_gprs(tvb, offset+11, ext_tree_pdp, "QoS negotiated", 0);
3684 offset = offset + 14;
3687 offset = offset + 5;
3688 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
3689 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
3690 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
3696 sn_down = tvb_get_ntohs(tvb, offset);
3697 sn_up = tvb_get_ntohs(tvb, offset+2);
3698 pdu_send_no = tvb_get_guint8(tvb, offset+4);
3699 pdu_rec_no = tvb_get_guint8(tvb, offset+5);
3701 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
3702 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 2, "Sequence number up: %u", sn_up);
3703 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "Send N-PDU number: %u", pdu_send_no);
3704 proto_tree_add_text(ext_tree_pdp, tvb, offset+5, 1, "Receive N-PDU number: %u", pdu_rec_no);
3706 switch (gtp_version) {
3708 up_flow = tvb_get_ntohs(tvb, offset+6);
3709 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 2, "Uplink flow label signalling: %u", up_flow);
3710 offset = offset + 8;
3713 up_teid = tvb_get_ntohl(tvb, offset+6);
3714 up_teid_cp = tvb_get_ntohl(tvb, offset+10);
3715 pdp_cntxt_id = tvb_get_guint8(tvb, offset+14);
3716 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 4, "Uplink TEID: %x", up_teid);
3717 proto_tree_add_text(ext_tree_pdp, tvb, offset+10, 4, "Uplink TEID control plane: %x", up_teid_cp);
3718 proto_tree_add_text(ext_tree_pdp, tvb, offset+14, 1, "PDP context identifier: %u", pdp_cntxt_id);
3719 offset = offset + 15;
3725 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
3726 pdp_type_num = tvb_get_guint8(tvb, offset+1);
3727 pdp_addr_len = tvb_get_guint8(tvb, offset+2);
3729 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP org"));
3730 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 1, "PDP type: %s", val_to_str(pdp_type_num, pdp_org_type, "Unknown PDP type"));
3731 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 1, "PDP address length: %u", pdp_addr_len);
3733 if (pdp_addr_len > 0) {
3734 switch (pdp_type_num) {
3736 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3737 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 4, "PDP address: %s", ip_to_str((guint8 *)&addr_ipv4));
3740 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3741 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3748 offset = offset + 3 + pdp_addr_len;
3750 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3751 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
3753 switch (ggsn_addr_len) {
3755 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3756 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN address: %s", ip_to_str((guint8 *)&addr_ipv4));
3759 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3760 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3766 offset = offset + 1 + ggsn_addr_len;
3768 if (gtp_version == 1) {
3770 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3771 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
3773 switch (ggsn_addr_len) {
3775 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3776 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
3779 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3780 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3785 offset = offset + 1 + ggsn_addr_len;
3789 apn_len = tvb_get_guint8(tvb, offset);
3790 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
3791 decode_apn(tvb, offset+1, apn_len, ext_tree_pdp);
3793 offset = offset + 1 + apn_len;
3795 trans_id = tvb_get_guint8(tvb, offset);
3796 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "Transaction identifier: %u", trans_id);
3801 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
3802 * UMTS: 29.060, v4.0, chapter 7.7.30
3805 decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3808 proto_tree *ext_tree_apn;
3811 length = tvb_get_ntohs(tvb, offset+1);
3813 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_APN, gtp_val, "Unknown field"));
3814 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
3816 proto_tree_add_text(ext_tree_apn, tvb, offset+1, 2, "APN length : %u", length);
3817 decode_apn(tvb, offset+3, length, ext_tree_apn);
3822 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
3823 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
3824 * UMTS: 29.060 v4.0, chapter 7.7.31
3825 * 24.008, v4.2, chapter 10.5.6.3
3828 decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3830 guint16 length, proto_offset;
3832 guint8 conf, proto_len, cnt = 1;
3834 proto_tree *ext_tree_proto;
3836 gboolean save_writable;
3838 length = tvb_get_ntohs(tvb, offset + 1);
3840 te = proto_tree_add_text(tree, tvb, offset, length + 3, val_to_str(GTP_EXT_PROTO_CONF, gtp_val, "Unknown message"));
3841 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
3843 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
3845 if (length < 1) return 3;
3847 conf = tvb_get_guint8 (tvb, offset + 3) & 0x07;
3848 proto_tree_add_text (ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
3850 proto_offset = 1; /* ... 1st byte is conf */
3854 if (proto_offset >= length) break;
3855 proto_id = tvb_get_ntohs (tvb, offset);
3856 proto_len = tvb_get_guint8 (tvb, offset + 2);
3857 proto_offset += proto_len + 3; /* 3 = proto id + length byte */
3859 if (proto_len > 0) {
3861 proto_tree_add_text (ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)",
3862 cnt, val_to_str(proto_id, ppp_vals, "Unknown"),
3864 proto_tree_add_text (ext_tree_proto, tvb, offset+2, 1, "Protocol %u length: %u", cnt, proto_len);
3867 * Don't allow the dissector for the configuration
3868 * protocol in question to update the columns - this
3871 save_writable = col_get_writable(pinfo->cinfo);
3872 col_set_writable(pinfo->cinfo, FALSE);
3875 * XXX - should we have our own dissector table,
3876 * solely for configuration protocols, so that bogus
3877 * values don't cause us to dissect the protocol
3878 * data as, for example, IP?
3880 next_tvb = tvb_new_subset (tvb, offset + 3, proto_len, proto_len);
3881 if (!dissector_try_port(ppp_subdissector_table,
3882 proto_id, next_tvb, pinfo, ext_tree_proto)) {
3883 call_dissector(data_handle, next_tvb, pinfo,
3887 col_set_writable(pinfo->cinfo, save_writable);
3890 offset += proto_len + 3;
3897 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
3898 * UMTS: 29.060 v4.0, chapter 7.7.32
3901 decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3903 guint8 addr_type, addr_len;
3906 struct e_in6_addr addr_ipv6;
3907 proto_tree *ext_tree_gsn_addr;
3910 length = tvb_get_ntohs(tvb, offset+1);
3912 te = proto_tree_add_text(tree, tvb, offset, 3+length, "GSN address : ");
3913 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
3917 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3918 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3919 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3920 proto_tree_add_ipv4(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv4 : hf_gtpv0_gsn_ipv4, tvb, offset+3, 4, addr_ipv4);
3923 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3924 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3925 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);
3926 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3927 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);
3928 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+4, sizeof addr_ipv4);
3929 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3930 proto_tree_add_ipv4(ext_tree_gsn_addr, gtp_version ? hf_gtpv1_gsn_ipv4 : hf_gtpv0_gsn_ipv4, tvb, offset+4, 4, addr_ipv4);
3933 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3934 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3935 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3936 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);
3939 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3940 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3941 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);
3942 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3943 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);
3944 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+4, sizeof addr_ipv6);
3945 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3946 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);
3949 proto_item_append_text(te, "unknown type or wrong length");
3956 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
3957 * UMTS: 29.060 v4.0, chapter 7.7.33
3960 decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3962 const guint8 *msisdn_val;
3966 length = tvb_get_ntohs(tvb, offset+1);
3968 if (length < 1) return 3;
3970 msisdn_val = tvb_get_ptr(tvb, offset+3, length);
3971 msisdn_str = msisdn_to_str(msisdn_val, length);
3973 proto_tree_add_string(tree, gtp_version ? hf_gtpv1_msisdn : hf_gtpv0_msisdn, tvb, offset, 3+length, msisdn_str);
3978 /* GPRS: not present
3979 * UMTS: 29.060 v4.0, chapter 7.7.34
3980 * 24.008 v4.2, chapter 10.5.6.5
3983 decode_gtp_qos_umts(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3985 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
3988 /* GPRS: not present
3989 * UMTS: 29.060 v4.0, chapter 7.7.35
3992 decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3994 return (1 + decode_quintuplet(tvb, offset+1, tree, 1, 1));
3998 /* GPRS: not present
3999 * UMTS: 29.060 v4.0, chapter 7.7.36
4000 * 24.008 v4.2, chapter 10.5.6.12
4003 decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4005 guint16 length, port1, port2, tos;
4006 guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto, spare;
4008 guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
4009 struct e_in6_addr addr_ipv6, mask_ipv6;
4010 proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
4011 proto_item *te, *tee, *tef;
4013 length = tvb_get_ntohs(tvb, offset+1);
4015 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Traffic flow template");
4016 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
4018 tft_flags = tvb_get_guint8(tvb, offset+3);
4019 tft_code = (tft_flags >> 5) & 0x07;
4020 spare = (tft_flags >> 4) & 0x01;
4021 no_packet_filters = tft_flags & 0x0F;
4023 proto_tree_add_text(ext_tree_tft, tvb, offset+1, 2, "TFT length: %u", length);
4025 tef = proto_tree_add_text (ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
4026 ext_tree_tft_flags = proto_item_add_subtree (tef, ett_gtp_tft_flags);
4027 proto_tree_add_uint (ext_tree_tft_flags, hf_gtpv1_tft_code, tvb, offset + 3, 1, tft_flags);
4028 proto_tree_add_uint (ext_tree_tft_flags, hf_gtpv1_tft_spare, tvb, offset + 3, 1, tft_flags);
4029 proto_tree_add_uint (ext_tree_tft_flags, hf_gtpv1_tft_number, tvb, offset + 3, 1, tft_flags);
4031 offset = offset + 4;
4033 for (i=0;i<no_packet_filters;i++) {
4035 pf_id = tvb_get_guint8(tvb, offset);
4037 tee = proto_tree_add_text (ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
4038 ext_tree_tft_pf = proto_item_add_subtree (tee, ett_gtp_tft_pf);
4041 if (tft_code != 2) {
4043 pf_eval = tvb_get_guint8(tvb, offset);
4044 pf_len = tvb_get_guint8(tvb, offset + 1);
4046 proto_tree_add_uint (ext_tree_tft_pf, hf_gtpv1_tft_eval, tvb, offset, 1, pf_eval);
4047 proto_tree_add_text (ext_tree_tft_pf, tvb, offset+1, 1, "Content length: %u", pf_len);
4049 offset = offset + 2;
4052 while (pf_offset < pf_len) {
4054 pf_content_id = tvb_get_guint8 (tvb, offset + pf_offset);
4056 switch (pf_content_id) {
4057 /* address IPv4 and mask = 8 bytes*/
4059 tvb_memcpy (tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 1, sizeof addr_ipv4);
4060 tvb_memcpy (tvb, (guint8 *)&mask_ipv4, offset + pf_offset + 5, sizeof mask_ipv4);
4061 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 9, "ID 0x10: IPv4/mask: %s/%s", ip_to_str ((guint8 *)&addr_ipv4), ip_to_str ((guint8 *)&mask_ipv4));
4062 pf_offset = pf_offset + 9;
4064 /* address IPv6 and mask = 32 bytes*/
4066 tvb_memcpy (tvb, (guint8 *)&addr_ipv6, offset+pf_offset+1, sizeof addr_ipv6);
4067 tvb_memcpy (tvb, (guint8 *)&mask_ipv6, offset+pf_offset+17, sizeof mask_ipv6);
4068 proto_tree_add_text (ext_tree_tft_pf, tvb, offset+pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s", ip6_to_str ((struct e_in6_addr*)&addr_ipv6), ip6_to_str ((struct e_in6_addr*)&mask_ipv6));
4069 pf_offset = pf_offset + 33;
4071 /* protocol identifier/next header type = 1 byte*/
4073 proto = tvb_get_guint8 (tvb, offset + pf_offset + 1);
4074 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)", proto, proto);
4075 pf_offset = pf_offset + 2;
4077 /* single destination port type = 2 bytes */
4079 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4080 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
4081 pf_offset = pf_offset + 3;
4083 /* destination port range type = 4 bytes */
4085 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4086 port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
4087 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
4088 pf_offset = pf_offset + 5;
4090 /* single source port type = 2 bytes */
4092 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4093 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
4094 pf_offset = pf_offset + 3;
4096 /* source port range type = 4 bytes */
4098 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4099 port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
4100 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
4101 pf_offset = pf_offset + 5;
4103 /* security parameter index type = 4 bytes */
4105 ipsec_id = tvb_get_ntohl (tvb, offset + pf_offset + 1);
4106 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
4107 pf_offset = pf_offset + 5;
4109 /* type of service/traffic class type = 2 bytes */
4111 tos = tvb_get_ntohs (tvb, offset + pf_offset + 1);
4112 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
4113 pf_offset = pf_offset + 3;
4115 /* flow label type = 3 bytes */
4117 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;;
4118 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
4119 pf_offset = pf_offset + 4;
4123 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
4124 pf_offset++; /* to avoid infinite loop */
4129 offset = offset + pf_offset;
4136 /* GPRS: not present
4137 * UMTS: 29.060 v4.0, chapter 7.7.37
4138 * 25.413 v3.4, chapter ???
4141 decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4145 length = tvb_get_ntohs(tvb, offset + 1);
4147 proto_tree_add_text(tree, tvb, offset, 3 + length, "Targer Identification");
4153 /* GPRS: not present
4154 * UMTS: 29.060 v4.0, chapter 7.7.38
4157 decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4161 length = tvb_get_ntohs(tvb, offset + 1);
4163 proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
4170 /* GPRS: not present
4171 * UMTS: 29.060 v4.0, chapter 7.7.39
4174 decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4176 guint32 teid, addr_ipv4;
4179 struct e_in6_addr addr_ipv6;
4180 proto_tree *ext_tree_rab_setup;
4183 length = tvb_get_ntohs(tvb, offset + 1);
4184 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
4186 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Radio Access Bearer Setup Information");
4187 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
4189 proto_tree_add_text(ext_tree_rab_setup, tvb, offset+1, 2, "RAB setup length : %u", length);
4190 proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_nsapi, tvb, offset+3, 1, nsapi);
4194 teid = tvb_get_ntohl(tvb, offset + 4);
4196 proto_tree_add_uint(ext_tree_rab_setup, hf_gtpv1_teid_data, tvb, offset+4, 4, teid);
4200 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+8, sizeof addr_ipv4);
4201 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtpv1_rnc_ipv4, tvb, offset+8, 4, addr_ipv4);
4204 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+8, sizeof addr_ipv6);
4205 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtpv1_rnc_ipv6, tvb, offset+8, 16, (guint8 *)&addr_ipv6);
4216 /* GPRS: not present
4217 * UMTS: 29.060 v4.0, chapter 7.7.40
4220 decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4224 proto_tree *ext_tree_hdr_list;
4227 length = tvb_get_guint8(tvb, offset + 1);
4229 te = proto_tree_add_text(tree, tvb, offset, 2+length, "%s", val_to_str(GTP_EXT_HDR_LIST, gtp_val, "Unknown"));
4230 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
4232 proto_tree_add_text(ext_tree_hdr_list, tvb, offset+1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
4234 for(i=0 ; i<length ; i++) {
4235 hdr = tvb_get_guint8(tvb, offset+2+i);
4237 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);
4243 /* GPRS: not present
4244 * UMTS: 29.060 v4.0, chapter 7.7.41
4245 * TODO: find TriggerID description
4248 decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4252 length = tvb_get_ntohs(tvb, offset + 1);
4254 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_TRIGGER_ID, gtp_val, "Unknown"), length);
4260 /* GPRS: not present
4261 * UMTS: 29.060 v4.0, chapter 7.7.42
4262 * TODO: find OMC-ID description
4265 decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4269 length = tvb_get_ntohs(tvb, offset + 1);
4271 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_OMC_ID, gtp_val, "Unknown"), length);
4277 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
4278 * UMTS: 29.060 v4.0, chapter 7.7.43
4281 decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4285 struct e_in6_addr addr_ipv6;
4286 proto_tree *ext_tree_chrg_addr;
4289 length = tvb_get_ntohs(tvb, offset+1);
4291 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"));
4292 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
4294 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);
4298 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
4299 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4300 proto_tree_add_ipv4(ext_tree_chrg_addr, gtp_version ? hf_gtpv1_chrg_ipv4 : hf_gtpv0_chrg_ipv4, tvb, offset+3, 4, addr_ipv4);
4303 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
4304 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4305 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);
4308 proto_item_append_text(te, "unknown type or wrong length");
4319 decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4321 guint16 length, n, number;
4322 proto_tree *ext_tree_rel_pack;
4325 length = tvb_get_ntohs(tvb, offset + 1);
4327 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
4328 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
4332 while (n < length) {
4334 number = tvb_get_ntohs(tvb, offset + 3 + n);
4335 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
4347 decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4349 guint16 length, n, number;
4350 proto_tree *ext_tree_can_pack;
4353 length = tvb_get_ntohs(tvb, offset + 1);
4355 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
4356 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
4360 while (n < length) {
4362 number = tvb_get_ntohs(tvb, offset + 3 + n);
4363 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
4371 /* CDRs dissector */
4373 decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4375 guint16 length, format_ver, data_len, i, j;
4376 guint8 no, format, rectype;
4377 proto_tree *ext_tree, *cdr_tree;
4378 proto_item *te, *ce;
4380 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
4381 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
4383 length = tvb_get_ntohs(tvb, offset + 1);
4384 no = tvb_get_guint8(tvb, offset + 3);
4385 format = tvb_get_guint8(tvb, offset + 4);
4386 format_ver = tvb_get_ntohs(tvb, offset + 5);
4388 proto_tree_add_text(ext_tree, tvb, offset+1, 2, "Length: %u", length);
4389 proto_tree_add_text(ext_tree, tvb, offset+3, 1, "Number of data records: %u", no);
4390 proto_tree_add_text(ext_tree, tvb, offset+4, 1, "Data record format: %u", format);
4391 proto_tree_add_text(ext_tree, tvb, offset+5, 2, "Data record format version: %u", format_ver);
4394 offset = offset + 7;
4396 if (gtpv0_cdr_as != DONT_DISSECT_CDRS) {
4398 for (i = 0; i < no; i++) {
4399 data_len = tvb_get_ntohs(tvb, offset);
4400 rectype = tvb_get_guint8(tvb, offset+2);
4402 case 0x13: /* GCDR */
4403 if (tvb_length_remaining(tvb, offset) < 3 + 118) {
4404 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "GCDR fragmented, can't dissect");
4408 tvb_memcpy(tvb, gcdr.imsi, offset+3, 8);
4409 tvb_memcpy(tvb, (guint8 *)&gcdr.ggsnaddr, offset+11, sizeof gcdr.ggsnaddr);
4410 gcdr.chrgid = tvb_get_ntohl(tvb, offset+15);
4411 tvb_memcpy(tvb, (guint8 *)&gcdr.sgsnaddr, offset+19, sizeof gcdr.sgsnaddr);
4412 tvb_memcpy(tvb, gcdr.apn, offset+23, 63);
4413 gcdr.pdporg = tvb_get_guint8(tvb, offset+86);
4414 gcdr.pdptype = tvb_get_guint8(tvb, offset+87);
4415 tvb_memcpy(tvb, (guint8 *)&gcdr.pdpaddr, offset+88, sizeof gcdr.pdpaddr);
4416 gcdr.addrflag = tvb_get_guint8(tvb, offset+92);
4417 gcdr.uplink = tvb_get_ntohl(tvb, offset+96);
4418 gcdr.downlink = tvb_get_ntohl(tvb, offset+100);
4419 gcdr.timestamp = tvb_get_ntohl(tvb, offset+104);
4420 gcdr.opening = tvb_get_ntohl(tvb, offset+108);
4421 gcdr.duration = tvb_get_ntohl(tvb, offset+112);
4422 gcdr.closecause = tvb_get_guint8(tvb, offset+116);
4423 gcdr.seqno = tvb_get_ntohl(tvb, offset+117);
4425 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "GCDR (0x13), sequence number: %u", gcdr.seqno);
4426 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4427 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4428 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4429 proto_tree_add_text(cdr_tree, tvb, offset+3, 8, "IMSI: %s", id_to_str(gcdr.imsi));
4430 proto_tree_add_text(cdr_tree, tvb, offset+11, 4, "GGSN address: %s", ip_to_str((guint8 *)&gcdr.ggsnaddr));
4431 proto_tree_add_text(cdr_tree, tvb, offset+15, 4, "Charging ID: %x", gcdr.chrgid);
4432 proto_tree_add_text(cdr_tree, tvb, offset+19, 4, "SGSN address: %s", ip_to_str((guint8 *)&gcdr.sgsnaddr));
4433 proto_tree_add_text(cdr_tree, tvb, offset+23, 63, "APN: %s", gcdr.apn);
4434 proto_tree_add_text(cdr_tree, tvb, offset+86, 1, "PDP org: %s", val_to_str(gcdr.pdporg, pdp_org_type, "Unknown PDP org"));
4435 proto_tree_add_text(cdr_tree, tvb, offset+87, 1, "PDP type: %s", val_to_str(gcdr.pdptype, pdp_type, "Unknown PDP type"));
4436 proto_tree_add_text(cdr_tree, tvb, offset+88, 4, "PDP address: %s", ip_to_str((guint8 *)&gcdr.pdpaddr));
4437 proto_tree_add_text(cdr_tree, tvb, offset+92, 1, "PDP address type: %u", gcdr.addrflag);
4438 decode_qos_gprs(tvb, offset+93, cdr_tree, "QoS", 0);
4439 proto_tree_add_text(cdr_tree, tvb, offset+96, 4, "Uplink volume: %u", gcdr.uplink);
4440 proto_tree_add_text(cdr_tree, tvb, offset+100, 4, "Downlink volume: %u", gcdr.downlink);
4441 proto_tree_add_text(cdr_tree, tvb, offset+104, 4, "Timestamp: %s", time_int_to_str(gcdr.timestamp));
4442 proto_tree_add_text(cdr_tree, tvb, offset+108, 4, "Record opening time: %s", time_int_to_str(gcdr.opening));
4443 proto_tree_add_text(cdr_tree, tvb, offset+112, 4, "Duration: %s", rel_time_int_to_str(gcdr.duration));
4444 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);
4445 proto_tree_add_text(cdr_tree, tvb, offset+117, 4, "Sequence number: %u", gcdr.seqno);
4447 if (data_len > 119) {
4448 tvb_memcpy (tvb, gcdr.msisdn, offset + 121, 9);
4449 proto_tree_add_text(cdr_tree, tvb, offset+121, 9, "MSISDN: %s", msisdn_to_str (gcdr.msisdn, 9));
4454 case 0x12: /* SCDR */
4455 if (tvb_length_remaining(tvb, offset) < 3 + 277) {
4456 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "SCDR fragmented, can't dissect");
4460 scdr.len = tvb_get_letohs(tvb, offset+3);
4461 scdr.netini = tvb_get_guint8(tvb, offset+5);
4462 scdr.anon = tvb_get_guint8(tvb, offset+6);
4463 scdr.imsilen = tvb_get_guint8(tvb, offset+7);
4464 tvb_memcpy(tvb, scdr.imsi, offset+8, 8);
4465 tvb_memcpy(tvb, scdr.imei, offset+16, 8);
4466 scdr.msisdnlen = tvb_get_guint8(tvb, offset+24);
4467 tvb_memcpy(tvb, scdr.msisdn, offset+25, 10);
4468 tvb_memcpy(tvb, (guint8 *)&scdr.sgsnaddr, offset+35, sizeof scdr.sgsnaddr);
4469 tvb_memcpy(tvb, scdr.msclass_notused, offset+39, 12);
4470 scdr.msclass_caplen = tvb_get_guint8(tvb, offset+51);
4471 scdr.msclass_cap = tvb_get_guint8(tvb, offset+52);
4472 scdr.msclass_capomit = tvb_get_ntohs(tvb, offset+53);
4473 scdr.lac = tvb_get_ntohs(tvb, offset+55);
4474 scdr.rac = tvb_get_guint8(tvb, offset+57);
4475 scdr.cid = tvb_get_ntohs(tvb, offset+58);
4476 scdr.chrgid = tvb_get_ntohl(tvb, offset+60);
4477 tvb_memcpy(tvb, (guint8 *)&scdr.ggsnaddr, offset+64, sizeof scdr.ggsnaddr);
4478 tvb_memcpy(tvb, scdr.apn, offset+68, 64);
4479 scdr.pdporg = tvb_get_guint8(tvb, offset+132);
4480 scdr.pdptype = tvb_get_guint8(tvb, offset+133);
4481 tvb_memcpy(tvb, (guint8 *)&scdr.pdpaddr, offset+134, sizeof scdr.pdpaddr);
4482 scdr.listind = tvb_get_guint8(tvb, offset+138);
4484 scdr.change[j].change = tvb_get_guint8(tvb, offset+139+23*j);
4485 scdr.change[j].time1 = tvb_get_ntohl(tvb, offset+140+23*j);
4486 scdr.change[j].time2 = tvb_get_ntohl(tvb, offset+144+23*j);
4487 scdr.change[j].uplink = tvb_get_ntohl(tvb, offset+148+23*j);
4488 scdr.change[j].downlink = tvb_get_ntohl(tvb, offset+152+23*j);
4489 /* tvb_memcpy(tvb, scdr.change[j].qos_req, offset+156+23*j, 3);
4490 tvb_memcpy(tvb, scdr.change[j].qos_neg, offset+159+23*j, 3);*/
4492 scdr.timestamp = tvb_get_ntohl(tvb, offset+254);
4493 scdr.opening = tvb_get_ntohl(tvb, offset+258);
4494 scdr.duration = tvb_get_ntohl(tvb, offset+262);
4495 scdr.sgsnchange = tvb_get_guint8(tvb, offset+266);
4496 scdr.closecause = tvb_get_guint8(tvb, offset+267);
4497 scdr.diag1 = tvb_get_guint8(tvb, offset+268);
4498 scdr.diag2 = tvb_get_guint8(tvb, offset+269);
4499 scdr.diag3 = tvb_get_guint8(tvb, offset+270);
4500 scdr.diag4 = tvb_get_guint8(tvb, offset+271);
4501 scdr.diag5 = tvb_get_ntohl(tvb, offset+272);
4502 scdr.seqno = tvb_get_ntohl(tvb, offset+276);
4504 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "SCDR (type %x), sequence number: %u", rectype, scdr.seqno);
4505 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4506 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4507 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4508 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "CDR length: %u", scdr.len);
4509 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "Network initiated PDP context: %s", yesno[scdr.netini]);
4510 proto_tree_add_text(cdr_tree, tvb, offset+6, 1, "Anonymous acces: %s", yesno[scdr.anon]);
4511 proto_tree_add_text(cdr_tree, tvb, offset+7, 1, "IMSI length: %u", scdr.imsilen);
4512 proto_tree_add_text(cdr_tree, tvb, offset+8, 8, "IMSI: %s", id_to_str(scdr.imsi));
4513 proto_tree_add_text(cdr_tree, tvb, offset+16, 8, "IMEI: %s", id_to_str(scdr.imei));
4514 proto_tree_add_text(cdr_tree, tvb, offset+24, 1, "MSISDN length: %u", scdr.msisdnlen);
4515 proto_tree_add_text(cdr_tree, tvb, offset+25, 10, "MSISDN: %s", msisdn_to_str(scdr.msisdn, 10));
4516 proto_tree_add_text(cdr_tree, tvb, offset+35, 4, "SGSN address: %s", ip_to_str((guint8 *)&scdr.sgsnaddr));
4517 proto_tree_add_text(cdr_tree, tvb, offset+39, 12, "(not used)");
4518 proto_tree_add_text(cdr_tree, tvb, offset+51, 1, "MS network capability length: %u", scdr.msclass_caplen);
4520 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+52, 1, "MS network capability: %u", scdr.msclass_cap);
4521 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4522 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+52, 1, scdr.cap);
4523 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+52, 1, scdr.cap);
4524 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+52, 1, scdr.cap);
4525 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+52, 1, scdr.cap);
4526 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+52, 1, scdr.cap);
4527 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+52, 1, scdr.cap);
4528 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_pad, tvb, offset+52, 1, scdr.cap);
4531 proto_tree_add_text(cdr_tree, tvb, offset+53, 2, "MS network capability omitted: %u", scdr.msclass_capomit);
4532 proto_tree_add_text(cdr_tree, tvb, offset+55, 2, "LAC: %u", scdr.lac);
4533 proto_tree_add_text(cdr_tree, tvb, offset+57, 1, "RAC: %u", scdr.rac);
4534 proto_tree_add_text(cdr_tree, tvb, offset+58, 2, "Cell ID: %u", scdr.cid);
4535 proto_tree_add_text(cdr_tree, tvb, offset+60, 4, "Charging ID: %x", scdr.chrgid);
4536 proto_tree_add_text(cdr_tree, tvb, offset+64, 4, "GGSN address: %s", ip_to_str((guint8 *)&scdr.ggsnaddr));
4537 proto_tree_add_text(cdr_tree, tvb, offset+68, 64, "APN: %s", scdr.apn);
4538 proto_tree_add_text(cdr_tree, tvb, offset+132, 1, "PDP org: %s", val_to_str(scdr.pdporg, pdp_org_type, "Unknown PDP org"));
4539 proto_tree_add_text(cdr_tree, tvb, offset+133, 1, "PDP type: %s", val_to_str(scdr.pdptype, pdp_type, "Unknown PDP type"));
4540 proto_tree_add_text(cdr_tree, tvb, offset+134, 4, "PDP address: %s", ip_to_str((guint8 *)&scdr.pdpaddr));
4541 proto_tree_add_text(cdr_tree, tvb, offset+138, 1, "List of data volume index: %u", scdr.listind);
4543 proto_tree_add_text(cdr_tree, tvb, offset+139+23*j, 1, "List of data vol change condition: %u", scdr.change[j].change);
4544 proto_tree_add_text(cdr_tree, tvb, offset+140+23*j, 4, "Time1: %x", scdr.change[j].time1);
4545 proto_tree_add_text(cdr_tree, tvb, offset+144+23*j, 4, "Time2: %x", scdr.change[j].time2);
4546 proto_tree_add_text(cdr_tree, tvb, offset+148+23*j, 4, "Uplink: %x", scdr.change[j].uplink);
4547 proto_tree_add_text(cdr_tree, tvb, offset+152+23*j, 4, "Downlink: %x", scdr.change[j].downlink);
4548 decode_qos_gprs(tvb, offset+156, cdr_tree, "QoS requested", 0);
4549 decode_qos_gprs(tvb, offset+159, cdr_tree, "QoS negotiated", 0);
4551 proto_tree_add_text(cdr_tree, tvb, offset+254, 4, "Timestamp: %s", time_int_to_str(scdr.timestamp));
4552 proto_tree_add_text(cdr_tree, tvb, offset+258, 4, "Opening: %s", time_int_to_str(scdr.opening));
4553 proto_tree_add_text(cdr_tree, tvb, offset+262, 4, "Duration: %s", rel_time_int_to_str(scdr.duration));
4554 proto_tree_add_text(cdr_tree, tvb, offset+266, 1, "SGSN change: %u", scdr.sgsnchange);
4555 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);
4556 proto_tree_add_text(cdr_tree, tvb, offset+268, 1, "Diagnostics 1: %u", scdr.diag1);
4557 proto_tree_add_text(cdr_tree, tvb, offset+269, 1, "Diagnostics 2: %u", scdr.diag2);
4558 proto_tree_add_text(cdr_tree, tvb, offset+270, 1, "Diagnostics 3: %u", scdr.diag3);
4559 proto_tree_add_text(cdr_tree, tvb, offset+271, 1, "Diagnostics 4: %u", scdr.diag4);
4560 proto_tree_add_text(cdr_tree, tvb, offset+272, 4, "Diagnostics 5: %u", scdr.diag5);
4561 proto_tree_add_text(cdr_tree, tvb, offset+276, 4, "Sequence number: %u", scdr.seqno);
4563 case 0x14: /* MCDR */
4564 if (tvb_length_remaining(tvb, offset) < 3 + 147) {
4565 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "MCDR fragmented, can't dissect");
4569 mcdr.len = tvb_get_ntohs(tvb, offset+3);
4570 mcdr.imsilen = tvb_get_guint8(tvb, offset+5);
4571 tvb_memcpy(tvb, mcdr.imsi, offset+6, 8);
4572 tvb_memcpy(tvb, mcdr.imei, offset+14, 8);
4573 mcdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4574 tvb_memcpy(tvb, mcdr.msisdn, offset+23, 10);
4575 tvb_memcpy(tvb, (guint8 *)&mcdr.sgsnaddr, offset+33, sizeof mcdr.sgsnaddr);
4576 tvb_memcpy(tvb, mcdr.msclass_notused, offset+37, 12);
4577 mcdr.msclass_caplen = tvb_get_guint8(tvb, offset+49);
4578 mcdr.msclass_cap = tvb_get_guint8(tvb, offset+50);
4579 mcdr.msclass_capomit = tvb_get_ntohs(tvb, offset+51);
4580 mcdr.lac = tvb_get_ntohs(tvb, offset+53);
4581 mcdr.rac = tvb_get_guint8(tvb, offset+55);
4582 mcdr.cid = tvb_get_ntohs(tvb, offset+56);
4583 mcdr.change_count = tvb_get_guint8(tvb, offset+58);
4585 mcdr.change[j].lac = tvb_get_ntohs(tvb, offset+59+13*j);
4586 mcdr.change[j].rac = tvb_get_guint8(tvb, offset+61+13*j);
4587 mcdr.change[j].cid = tvb_get_ntohs(tvb, offset+62+13*j);
4588 tvb_memcpy(tvb, mcdr.change[j].omit, offset+64+13*j, 8);
4590 mcdr.timestamp = tvb_get_ntohl(tvb, offset+124);
4591 mcdr.opening = tvb_get_ntohl(tvb, offset+128);
4592 mcdr.duration = tvb_get_ntohl(tvb, offset+132);
4593 mcdr.sgsnchange = tvb_get_guint8(tvb, offset+136);
4594 mcdr.closecause = tvb_get_guint8(tvb, offset+137);
4595 mcdr.diag1 = tvb_get_guint8(tvb, offset+138);
4596 mcdr.diag2 = tvb_get_guint8(tvb, offset+139);
4597 mcdr.diag3 = tvb_get_guint8(tvb, offset+140);
4598 mcdr.diag4 = tvb_get_guint8(tvb, offset+141);
4599 mcdr.diag5 = tvb_get_ntohl(tvb, offset+142);
4600 mcdr.seqno = tvb_get_ntohl(tvb, offset+146);
4602 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "MCDR (0x14), sequence number: %u", mcdr.seqno);
4603 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4604 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4605 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4606 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", mcdr.len);
4607 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", mcdr.imsilen);
4608 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(mcdr.imsi));
4609 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(mcdr.imei));
4610 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", mcdr.msisdnlen);
4611 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(mcdr.msisdn, 10));
4612 proto_tree_add_text(cdr_tree, tvb, offset+33, 4, "SGSN address: %s", ip_to_str((guint8 *)&mcdr.sgsnaddr));
4613 proto_tree_add_text(cdr_tree, tvb, offset+37, 12, "(not used)");
4614 proto_tree_add_text(cdr_tree, tvb, offset+49, 1, "MS network capability length: %u", mcdr.msclass_caplen);
4616 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+50, 1, "MS network capability: %u", mcdr.msclass_cap);
4617 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4618 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+50, 1, mcdr.cap);
4619 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+50, 1, mcdr.cap);
4620 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+50, 1, mcdr.cap);
4621 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+50, 1, mcdr.cap);
4622 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+50, 1, mcdr.cap);
4623 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+50, 1, mcdr.cap);
4624 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_pad, tvb, offset+50, 1, mcdr.cap);
4626 proto_tree_add_text(cdr_tree, tvb, offset+51, 2, "MS network capability omitted: %u", mcdr.msclass_capomit);
4627 proto_tree_add_text(cdr_tree, tvb, offset+53, 2, "LAC: %u", mcdr.lac);
4628 proto_tree_add_text(cdr_tree, tvb, offset+55, 1, "RAC: %u", mcdr.rac);
4629 proto_tree_add_text(cdr_tree, tvb, offset+56, 2, "Cell ID: %u", mcdr.cid);
4630 proto_tree_add_text(cdr_tree, tvb, offset+58, 1, "List of data volume changes: %u", mcdr.change_count);
4632 proto_tree_add_text(cdr_tree, tvb, offset+59+13*j, 2, "LAC: %u", mcdr.change[j].lac);
4633 proto_tree_add_text(cdr_tree, tvb, offset+61+13*j, 1, "RAC: %u", mcdr.change[j].rac);
4634 proto_tree_add_text(cdr_tree, tvb, offset+62+13*j, 2, "CID: %u", mcdr.change[j].cid);
4635 proto_tree_add_text(cdr_tree, tvb, offset+64+13*j, 8, "(omitted)");
4638 proto_tree_add_text(cdr_tree, tvb, offset+124, 4, "Timestamp: %s", time_int_to_str(mcdr.timestamp));
4639 proto_tree_add_text(cdr_tree, tvb, offset+128, 4, "Record opening time: %s", time_int_to_str(mcdr.opening));
4640 proto_tree_add_text(cdr_tree, tvb, offset+132, 4, "Duration: %s", rel_time_int_to_str(mcdr.duration));
4641 proto_tree_add_text(cdr_tree, tvb, offset+136, 1, "SGSN change: %u", mcdr.sgsnchange);
4642 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);
4643 proto_tree_add_text(cdr_tree, tvb, offset+138, 1, "Diagnostics 1: %u", mcdr.diag1);
4644 proto_tree_add_text(cdr_tree, tvb, offset+139, 1, "Diagnostics 2: %u", mcdr.diag2);
4645 proto_tree_add_text(cdr_tree, tvb, offset+140, 1, "Diagnostics 3: %u", mcdr.diag3);
4646 proto_tree_add_text(cdr_tree, tvb, offset+141, 1, "Diagnostics 4: %u", mcdr.diag4);
4647 proto_tree_add_text(cdr_tree, tvb, offset+142, 4, "Diagnostics 5: %u", mcdr.diag5);
4648 proto_tree_add_text(cdr_tree, tvb, offset+146, 4, "Sequence number: %u", mcdr.seqno);
4651 case 0x15: /* SOCDR */
4652 if (tvb_length_remaining(tvb, offset) < 3 + 80) {
4653 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "SOCDR fragmented, can't dissect");
4657 socdr.len = tvb_get_ntohs(tvb, offset+3);
4658 socdr.imsilen = tvb_get_guint8(tvb, offset+5);
4659 tvb_memcpy(tvb, socdr.imsi, offset+6, 8);
4660 tvb_memcpy(tvb, socdr.imei, offset+14, 8);
4661 socdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4662 tvb_memcpy(tvb, socdr.msisdn, offset+23, 10);
4663 tvb_memcpy(tvb, socdr.msclass_notused, offset+33, 12);
4664 socdr.msclass_caplen = tvb_get_guint8(tvb, offset+45);
4665 socdr.msclass_cap = tvb_get_guint8(tvb, offset+46);
4666 socdr.msclass_capomit = tvb_get_ntohs(tvb, offset+47);
4667 tvb_memcpy(tvb, socdr.serv_centr, offset+49, 9);
4668 tvb_memcpy(tvb, socdr.rec_ent, offset+58, 9);
4669 socdr.lac = tvb_get_ntohs(tvb, offset+67);
4670 socdr.rac = tvb_get_guint8(tvb, offset+69);
4671 socdr.cid = tvb_get_ntohs(tvb, offset+70);
4672 socdr.time1 = tvb_get_ntohl(tvb, offset+72);
4673 socdr.time2 = tvb_get_ntohl(tvb, offset+76);
4674 socdr.messref = tvb_get_guint8(tvb, offset+80);
4675 socdr.smsres = tvb_get_ntohs(tvb, offset+81);
4677 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "SOCDR (0x15)");
4678 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4679 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4680 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4681 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", socdr.len);
4682 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", socdr.imsilen);
4683 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(socdr.imsi));
4684 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(socdr.imei));
4685 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", socdr.msisdnlen);
4686 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(socdr.msisdn, 10));
4687 proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
4688 proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", socdr.msclass_caplen);
4690 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", socdr.msclass_cap);
4691 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4692 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, socdr.cap);
4693 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+46, 1, socdr.cap);
4694 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+46, 1, socdr.cap);
4695 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+46, 1, socdr.cap);
4696 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+46, 1, socdr.cap);
4697 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+46, 1, socdr.cap);
4699 proto_tree_add_text(cdr_tree, tvb, offset+47, 2, "MS network capability omitted: %u", stcdr.msclass_capomit);
4700 proto_tree_add_text(cdr_tree, tvb, offset+49, 9, "SMSC E.164 address: %s", msisdn_to_str(socdr.serv_centr, 9));
4701 proto_tree_add_text(cdr_tree, tvb, offset+58, 9, "SGSN E.164 address: %s", msisdn_to_str(socdr.rec_ent, 9));
4702 proto_tree_add_text(cdr_tree, tvb, offset+67, 2, "LAC: %u", socdr.lac);
4703 proto_tree_add_text(cdr_tree, tvb, offset+69, 1, "RAC: %u", socdr.rac);
4704 proto_tree_add_text(cdr_tree, tvb, offset+70, 2, "Cell ID: %u", socdr.cid);
4705 proto_tree_add_text(cdr_tree, tvb, offset+72, 4, "Time1: %s", time_int_to_str(socdr.time1));
4706 proto_tree_add_text(cdr_tree, tvb, offset+76, 4, "Time2: %s", time_int_to_str(socdr.time2));
4707 proto_tree_add_text(cdr_tree, tvb, offset+80, 1, "Message reference: %u", socdr.messref);
4708 proto_tree_add_text(cdr_tree, tvb, offset+81, 2, "Delivery result: %u", socdr.smsres);
4711 case 0x16: /* STCDR */
4712 if (tvb_length_remaining(tvb, offset) < 3 + 79) {
4713 proto_tree_add_text(ext_tree, tvb, offset, tvb_length_remaining(tvb, offset), "STCDR fragmented, can't dissect");
4717 stcdr.len = tvb_get_ntohs(tvb, offset+3);
4718 stcdr.imsilen = tvb_get_guint8(tvb, offset+5);
4719 tvb_memcpy(tvb, stcdr.imsi, offset+6, 8);
4720 tvb_memcpy(tvb, stcdr.imei, offset+14, 8);
4721 stcdr.msisdnlen = tvb_get_guint8(tvb, offset+22);
4722 tvb_memcpy(tvb, stcdr.msisdn, offset+23, 10);
4723 tvb_memcpy(tvb, stcdr.msclass_notused, offset+33, 12);
4724 stcdr.msclass_caplen = tvb_get_guint8(tvb, offset+45);
4725 stcdr.msclass_cap = tvb_get_guint8(tvb, offset+46);
4726 stcdr.msclass_capomit = tvb_get_ntohs(tvb, offset+47);
4727 tvb_memcpy(tvb, stcdr.serv_centr, offset+49, 9);
4728 tvb_memcpy(tvb, stcdr.rec_ent, offset+58, 9);
4729 stcdr.lac = tvb_get_ntohs(tvb, offset+67);
4730 stcdr.rac = tvb_get_guint8(tvb, offset+69);
4731 stcdr.cid = tvb_get_ntohs(tvb, offset+70);
4732 stcdr.time1 = tvb_get_ntohl(tvb, offset+72);
4733 stcdr.time2 = tvb_get_ntohl(tvb, offset+76);
4734 stcdr.smsres = tvb_get_ntohs(tvb, offset+80);
4736 ce = proto_tree_add_text(ext_tree, tvb, offset, data_len + 2, "STCDR (0x16)");
4737 cdr_tree = proto_item_add_subtree(ce, ett_gtp_ext);
4738 proto_tree_add_text(cdr_tree, tvb, offset, 2, "Length: %u", data_len);
4739 proto_tree_add_text(cdr_tree, tvb, offset+2, 1, "Type: %u (%x)", rectype, rectype);
4740 proto_tree_add_text(cdr_tree, tvb, offset+3, 2, "MCDR length: %u", stcdr.len);
4741 proto_tree_add_text(cdr_tree, tvb, offset+5, 1, "IMSI length: %u", stcdr.imsilen);
4742 proto_tree_add_text(cdr_tree, tvb, offset+6, 8, "IMSI: %s", id_to_str(stcdr.imsi));
4743 proto_tree_add_text(cdr_tree, tvb, offset+14, 8, "IMEI: %s", id_to_str(stcdr.imei));
4744 proto_tree_add_text(cdr_tree, tvb, offset+22, 1, "MSISDN length: %u", stcdr.msisdnlen);
4745 proto_tree_add_text(cdr_tree, tvb, offset+23, 10, "MSISDN: %s", msisdn_to_str(stcdr.msisdn, 10));
4746 proto_tree_add_text(cdr_tree, tvb, offset+33, 12, "(not used)");
4747 proto_tree_add_text(cdr_tree, tvb, offset+45, 1, "MS network capability length: %u", stcdr.msclass_caplen);
4749 /* cap_id = proto_tree_add_text(cdr_tree, tvb, offset+46, 1, "MS network capability: %u", stcdr.msclass_cap);
4750 cap_tree = proto_item_add_subtree(cap_id, ett_chrg_cap);
4751 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_gea, tvb, offset+46, 1, stcdr.cap);
4752 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gsm, tvb, offset+46, 1, stcdr.cap);
4753 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_sm_gprs, tvb, offset+46, 1, stcdr.cap);
4754 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ucs2, tvb, offset+46, 1, stcdr.cap);
4755 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_ss, tvb, offset+46, 1, stcdr.cap);
4756 proto_tree_add_uint(cap_tree, hf_gtpv0_chrg_cap_solsa, tvb, offset+46, 1, stcdr.cap);
4758 proto_tree_add_text(cdr_tree, tvb, offset+47, 2, "MS network capability omitted: %u", stcdr.msclass_capomit);
4759 proto_tree_add_text(cdr_tree, tvb, offset+49, 9, "SMSC E.164 address: %s", msisdn_to_str(stcdr.serv_centr, 9));
4760 proto_tree_add_text(cdr_tree, tvb, offset+58, 9, "SGSN E.164 address: %s", msisdn_to_str(stcdr.rec_ent, 9));
4761 proto_tree_add_text(cdr_tree, tvb, offset+67, 2, "LAC: %u", stcdr.lac);
4762 proto_tree_add_text(cdr_tree, tvb, offset+69, 1, "RAC: %u", stcdr.rac);
4763 proto_tree_add_text(cdr_tree, tvb, offset+70, 2, "Cell ID: %u", stcdr.cid);
4764 proto_tree_add_text(cdr_tree, tvb, offset+72, 4, "Time1: %s", time_int_to_str(stcdr.time1));
4765 proto_tree_add_text(cdr_tree, tvb, offset+76, 4, "Time2: %s", time_int_to_str(stcdr.time2));
4766 proto_tree_add_text(cdr_tree, tvb, offset+80, 2, "Delivery result: %u", stcdr.smsres);
4769 offset = offset + 2 + data_len;
4779 decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4781 guint16 length, n, number;
4782 proto_tree *ext_tree_data_resp;
4785 length = tvb_get_ntohs(tvb, offset + 1);
4787 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
4788 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
4792 while (n < length) {
4794 number = tvb_get_ntohs(tvb, offset + 3 + n);
4795 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
4808 decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4812 struct e_in6_addr addr_ipv6;
4813 proto_tree *ext_tree_node_addr;
4816 length = tvb_get_ntohs(tvb, offset+1);
4818 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Node address: ");
4819 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
4821 proto_tree_add_text(ext_tree_node_addr, tvb, offset+1, 2, "Node address length: %u", length);
4825 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
4826 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4827 proto_tree_add_ipv4(ext_tree_node_addr, gtp_version ? hf_gtpv1_node_ipv4 : hf_gtpv0_node_ipv4, tvb, offset+3, 4, addr_ipv4);
4830 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
4831 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4832 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);
4835 proto_item_append_text(te, "unknown type or wrong length");
4843 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
4844 * UMTS: 29.060 v4.0, chapter 7.7.44
4847 decode_gtp_priv_ext(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4849 guint16 length, ext_id;
4851 proto_tree *ext_tree_priv_ext;
4854 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_PRIV_EXT, gtp_val, "Unknown message"));
4855 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
4857 length = tvb_get_ntohs(tvb, offset+1);
4858 if (length < 1) return 3+length;
4860 ext_id = tvb_get_ntohs(tvb, offset+3);
4861 tvb_memcpy(tvb, ext_val, offset+5, length > 65 ? 63 : length-2);
4862 ext_val[length > 65 ? 64 : length-1] = '\0';
4863 proto_tree_add_uint(ext_tree_priv_ext, gtp_version ? hf_gtpv1_ext_id : hf_gtpv0_ext_id, tvb, offset+3, 2, ext_id);
4864 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);
4870 decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4872 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
4874 return tvb_length_remaining(tvb, offset);
4878 dissect_gtpv0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4881 _gtpv0_hdr gtpv0_hdr;
4882 proto_item *ti, *tf;
4883 proto_tree *gtpv0_tree, *flags_tree;
4886 const guint8 *tid_val;
4888 int offset, length, i, mandatory, checked_field, gtp_prime = 0;
4890 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4891 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
4892 if (check_col(pinfo->cinfo, COL_INFO))
4893 col_clear(pinfo->cinfo, COL_INFO);
4895 tvb_memcpy(tvb, (guint8 *)>pv0_hdr, 0, 12);
4896 tid_val = tvb_get_ptr(tvb, 12, 8);
4897 tid_str = id_to_str(tid_val);
4898 gtp_version = (gtpv0_hdr.flags >> 5) & 0x07;
4900 if (!((gtpv0_hdr.flags >> 4) & 1)) {
4902 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4903 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP-CDR");
4905 switch ((gtpv0_hdr.flags >> 5) & 0x07) {
4906 case 0: if (check_col(pinfo->cinfo, COL_PROTOCOL))
4907 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
4909 case 1: if (check_col(pinfo->cinfo, COL_PROTOCOL))
4910 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv1");
4911 default: if (check_col(pinfo->cinfo, COL_PROTOCOL))
4912 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTPv?");
4917 if (check_col(pinfo->cinfo, COL_INFO))
4918 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtpv0_hdr.message, message_type, "Unknown"));
4922 /* dissect GTP header */
4923 ti = proto_tree_add_item(tree, proto_gtpv0, tvb, 0, -1, FALSE);
4924 gtpv0_tree = proto_item_add_subtree(ti, ett_gtp);
4926 tf = proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flags, tvb, 0, 1, gtpv0_hdr.flags);
4928 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
4929 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_ver, tvb, 0, 1, gtpv0_hdr.flags);
4930 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_pt, tvb, 0, 1, gtpv0_hdr.flags);
4931 proto_tree_add_uint(flags_tree, hf_gtpv0_flags_spare, tvb, 0, 1, gtpv0_hdr.flags);
4932 proto_tree_add_boolean(flags_tree, hf_gtpv0_flags_snn, tvb, 0, 1, gtpv0_hdr.flags);
4934 gtpv0_hdr.length = g_ntohs(gtpv0_hdr.length);
4935 gtpv0_hdr.seq_no = g_ntohs(gtpv0_hdr.seq_no);
4936 gtpv0_hdr.flow_label = g_ntohs(gtpv0_hdr.flow_label);
4937 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_message_type, tvb, 1, 1, gtpv0_hdr.message);
4938 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_length, tvb, 2, 2, gtpv0_hdr.length);
4939 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_seq_number, tvb, 4, 2, gtpv0_hdr.seq_no);
4941 /* GTP' has 6 bytes of length */
4943 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_flow_label, tvb, 6, 2, gtpv0_hdr.flow_label);
4944 proto_tree_add_uint(gtpv0_tree, hf_gtpv0_sndcp_number, tvb, 8, 1, gtpv0_hdr.sndcp_no);
4945 proto_tree_add_string(gtpv0_tree, hf_gtpv0_tid, tvb, 12, 8, tid_str);
4948 if (gtpv0_hdr.message != GTP_MSG_TPDU) {
4950 proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[--- end of GTPv0 header, beginning of extension headers ---]");
4952 offset = gtp_prime ? GTP_PRIME_HDR_LENGTH : GTPv0_HDR_LENGTH;
4954 length = tvb_length(tvb);
4956 mandatory = 0; /* check order of GTP fields against ETSI */
4960 if (offset >= length) break;
4961 ext_hdr_val = tvb_get_guint8(tvb, offset);
4963 if (gtpv0_etsi_order) {
4964 checked_field = check_field_presence (gtpv0_hdr.message, ext_hdr_val , (int *)&mandatory);
4965 switch (checked_field) {
4966 case -2: proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[WARNING] message not found");
4968 case -1: proto_tree_add_text(gtpv0_tree, tvb, 0, 0, "[WARNING] field not present");
4971 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"));
4976 while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
4977 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv0_tree);
4982 /* next part dissects sublayers of GTP */
4984 if ((gtpv0_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
4987 sub_proto = tvb_get_guint8(tvb,GTPv0_HDR_LENGTH);
4989 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
4990 /* this is most likely an IPv4 packet */
4991 /* we can exclude 0x40 - 0x44 because the minimum header size is 20 octets */
4992 /* 0x4f is excluded because PPP protocol type "IPv6 header compression"
4993 with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
4995 next_tvb = tvb_new_subset(tvb, GTPv0_HDR_LENGTH, -1, -1);
4996 call_dissector(ip_handle, next_tvb, pinfo, tree);
4998 if ((sub_proto & 0xf0) == 0x60) {
4999 /* this is most likely an IPv6 packet */
5000 next_tvb = tvb_new_subset(tvb, GTPv0_HDR_LENGTH, -1, -1);
5001 call_dissector(ipv6_handle, next_tvb, pinfo, tree);
5003 /* this seems to be a PPP packet */
5004 guint8 acfield_len = 0;
5006 if (sub_proto == 0xff) {
5007 /* this might be an address field, even it shouldn't be here */
5008 guint8 control_field = tvb_get_guint8(tvb,GTPv0_HDR_LENGTH + 1);
5009 if (control_field == 0x03) {
5010 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
5014 next_tvb = tvb_new_subset(tvb, GTPv0_HDR_LENGTH + acfield_len, -1, -1);
5015 call_dissector(ppp_handle, next_tvb, pinfo, tree);
5017 if (check_col(pinfo->cinfo, COL_PROTOCOL))
5018 col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP");
5022 /* GTP v1 dissector */
5024 dissect_gtpv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
5026 _gtpv1_hdr gtpv1_hdr;
5027 proto_item *ti, *tf;
5028 proto_tree *gtpv1_tree, *flags_tree;
5030 guint8 ext_hdr_val, i, hdr_offset = 4, next_hdr, npdu_no, sub_proto;
5032 int offset, length, mandatory, checked_field, gtp_prime = 0;
5034 if (check_col(pinfo->cinfo, COL_PROTOCOL))
5035 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP-C");
5036 if (check_col(pinfo->cinfo, COL_INFO))
5037 col_clear(pinfo->cinfo, COL_INFO);
5039 tvb_memcpy(tvb, (guint8 *)>pv1_hdr, 0, 8);
5040 gtp_version = (gtpv1_hdr.flags >> 5) & 0x07;
5042 if (check_col(pinfo->cinfo, COL_INFO))
5043 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtpv1_hdr.message, message_type, "Unknown"));
5047 ti = proto_tree_add_item(tree, proto_gtpv1, tvb, 0, -1, FALSE);
5048 gtpv1_tree = proto_item_add_subtree(ti, ett_gtp);
5050 tf = proto_tree_add_uint(gtpv1_tree, hf_gtpv1_flags, tvb, 0, 1, gtpv1_hdr.flags);
5051 flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
5053 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_ver, tvb, 0, 1, gtpv1_hdr.flags);
5054 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_pt, tvb, 0, 1, gtpv1_hdr.flags);
5055 proto_tree_add_uint(flags_tree, hf_gtpv1_flags_spare, tvb, 0, 1, gtpv1_hdr.flags);
5056 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_e, tvb, 0, 1, gtpv1_hdr.flags);
5057 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_s, tvb, 0, 1, gtpv1_hdr.flags);
5058 proto_tree_add_boolean(flags_tree, hf_gtpv1_flags_pn, tvb, 0, 1, gtpv1_hdr.flags);
5060 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_message_type, tvb, 1, 1, gtpv1_hdr.message);
5062 gtpv1_hdr.length = g_ntohs(gtpv1_hdr.length);
5063 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_length, tvb, 2, 2, gtpv1_hdr.length);
5065 gtp_prime = (gtpv1_hdr.flags & 0x01) >> 4;
5067 /* GTP' has 6 bytes of length */
5071 gtpv1_hdr.teid = g_ntohl(gtpv1_hdr.teid);
5072 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_teid, tvb, 4, 4, gtpv1_hdr.teid);
5074 if (gtpv1_hdr.flags & 0x07) {
5075 seq_no = tvb_get_ntohs (tvb, 8);
5076 proto_tree_add_uint (gtpv1_tree, hf_gtpv1_seq_number, tvb, 8, 2, seq_no);
5077 npdu_no = tvb_get_guint8 (tvb, 10);
5078 proto_tree_add_uint (gtpv1_tree, hf_gtpv1_npdu_number, tvb, 10, 1, npdu_no);
5079 next_hdr = tvb_get_guint8(tvb, 11);
5080 proto_tree_add_uint(gtpv1_tree, hf_gtpv1_next, tvb, 11, 1, next_hdr);
5083 if (next_hdr) hdr_offset = 1;
5084 else hdr_offset = 0;
5088 if (gtpv1_hdr.message != GTP_MSG_TPDU) {
5090 proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[--- end of GTP v1 header, beginning of extension headers ---]");
5092 offset = gtp_prime ? GTP_PRIME_HDR_LENGTH: GTPv1_HDR_LENGTH - hdr_offset;
5093 length = tvb_length(tvb);
5095 mandatory = 0; /* check order of GTP fields against ETSI */
5099 if (offset >= length) break;
5100 ext_hdr_val = tvb_get_guint8(tvb, offset);
5102 if (gtpv1_etsi_order) {
5103 checked_field = check_field_presence (gtpv1_hdr.message, ext_hdr_val , (int *)&mandatory);
5104 switch (checked_field) {
5105 case -2: proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[WARNING] message not found");
5107 case -1: proto_tree_add_text(gtpv1_tree, tvb, 0, 0, "[WARNING] field not present");
5110 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"));
5115 while (gtpopt[++i].optcode) if (gtpopt[i].optcode == ext_hdr_val) break;
5116 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtpv1_tree);
5121 if (gtpv1_hdr.message == GTP_MSG_ERR_IND)
5122 if (check_col(pinfo->cinfo, COL_PROTOCOL))
5123 col_add_str(pinfo->cinfo, COL_PROTOCOL, "GTP-U");
5126 if ((gtpv1_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
5128 if (gtpv1_hdr.flags & 0x07) {
5129 if (tvb_get_guint8 (tvb, 11))
5130 hdr_offset = 1; /* if next_hdr != 0 */
5135 sub_proto = tvb_get_guint8(tvb,GTPv1_HDR_LENGTH - hdr_offset);
5137 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
5138 /* this is most likely an IPv4 packet */
5139 /* we can exclude 0x40 - 0x44 because the minimum header size is 20 octets */
5140 /* 0x4f is excluded because PPP protocol type "IPv6 header compression"
5141 with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
5143 next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset, -1, -1);
5144 call_dissector(ip_handle, next_tvb, pinfo, tree);
5146 if ((sub_proto & 0xf0) == 0x60)
5148 /* this is most likely an IPv6 packet */
5149 next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset, -1, -1);
5150 call_dissector(ipv6_handle, next_tvb, pinfo, tree);
5152 /* this seems to be a PPP packet */
5153 guint8 acfield_len = 0;
5155 if (sub_proto == 0xff) {
5156 /* this might be an address field, even it shouldn't be here */
5157 guint8 control_field;
5158 control_field = tvb_get_guint8(tvb,GTPv1_HDR_LENGTH - hdr_offset + 1);
5159 if (control_field == 0x03)
5161 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
5165 next_tvb = tvb_new_subset(tvb, GTPv1_HDR_LENGTH - hdr_offset + acfield_len, -1, -1);
5166 call_dissector(ppp_handle, next_tvb, pinfo, tree);
5168 if (check_col(pinfo->cinfo, COL_PROTOCOL))
5169 col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP-U");
5173 static const true_false_string yes_no_tfs = {
5179 proto_register_gtp(void)
5182 static hf_register_info hf_gtpv0[] = {
5184 { &hf_gtpv0_flags, { "Flags", "gtpv0.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare/SNN", HFILL }},
5185 { &hf_gtpv0_flags_ver, { "Version", "gtpv0.flags.version", FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, "GTP Version", HFILL }},
5186 { &hf_gtpv0_flags_pt, { "Protocol type", "gtpv0.flags.payload", FT_UINT8, BASE_DEC, NULL, GTP_PT_MASK, "Protocol Type (1 = GTP, 0 = GTP' )", HFILL }},
5187 { &hf_gtpv0_flags_spare, { "Reserved", "gtpv0.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE_MASK, "Reserved (shall be sent as '111' )", HFILL }},
5188 { &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 }},
5189 { &hf_gtpv0_message_type, { "Message type", "gtpv0.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
5190 { &hf_gtpv0_length, { "Length", "gtpv0.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
5191 { &hf_gtpv0_seq_number, { "Sequence number", "gtpv0.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
5192 { &hf_gtpv0_flow_label, { "Flow label", "gtpv0.flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label", HFILL }},
5193 { &hf_gtpv0_sndcp_number, { "SNDCP N-PDU LLC Number", "gtpv0.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, "SNDCP N-PDU LLC Number", HFILL }},
5194 { &hf_gtpv0_tid, { "TID", "gtpv0.tid", FT_STRING, BASE_DEC, NULL, 0, "Tunnel Identifier", HFILL }},
5195 { &hf_gtpv0_cause, { "Cause", "gtpv0.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
5196 { &hf_gtpv0_imsi, { "IMSI", "gtpv0.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
5197 { &hf_gtpv0_rai_mcc, { "MCC", "gtpv0.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
5198 { &hf_gtpv0_rai_mnc, { "MNC", "gtpv0.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
5199 { &hf_gtpv0_rai_rac, { "RAC", "gtpv0.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
5200 { &hf_gtpv0_rai_lac, { "LAC", "gtpv0.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
5201 { &hf_gtpv0_tlli, { "TLLI", "gtpv0.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
5202 { &hf_gtpv0_ptmsi, { "P-TMSI", "gtpv0.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
5203 { &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 }},
5204 { &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 }},
5205 { &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 }},
5206 { &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 }},
5207 { &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 }},
5208 { &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 }},
5209 { &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 }},
5210 { &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 }},
5211 { &hf_gtpv0_reorder, { "Reordering required","gtpv0.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
5212 { &hf_gtpv0_map_cause, { "MAP cause", "gtpv0.map_cause", FT_UINT8, BASE_DEC, VALS(map_cause_type), 0, "MAP cause", HFILL }},
5213 { &hf_gtpv0_ptmsi_sig, { "P-TMSI signature", "gtpv0.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
5214 { &hf_gtpv0_ms_valid, { "MS validated", "gtpv0.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
5215 { &hf_gtpv0_recovery, { "Recovery", "gtpv0.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
5216 { &hf_gtpv0_sel_mode, { "Selection mode", "gtpv0.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
5217 { &hf_gtpv0_ext_flow_label, { "Flow Label Data I", "gtpv0.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL }},
5218 { &hf_gtpv0_flow_sig, { "Flow label Signalling", "gtpv0.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, "Flow label signalling", HFILL }},
5219 { &hf_gtpv0_nsapi, { "NSAPI ", "gtpv0.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
5220 { &hf_gtpv0_flow_ii, { "Flow Label Data II ","gtpv0.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL }},
5221 { &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 }},
5222 { &hf_gtpv0_tr_comm, { "Packet transfer command", "gtpv0.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL }},
5223 { &hf_gtpv0_chrg_id, { "Charging ID ", "gtpv0.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
5224 { &hf_gtpv0_user_ipv4, { "End user address IPv4", "gtpv0.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
5225 { &hf_gtpv0_user_ipv6, { "End user address IPv6", "gtpv0.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
5226 { &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 }},
5227 { &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 }},
5228 { &hf_gtpv0_apn, { "APN", "gtpv0.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
5229 { &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 }},
5230 { &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 }},
5231 { &hf_gtpv0_gsn_ipv4, { "GSN address IPv4", "gtpv0.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
5232 { &hf_gtpv0_gsn_ipv6, { "GSN address IPv6", "gtpv0.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
5233 { &hf_gtpv0_msisdn, { "MSISDN", "gtpv0.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
5234 { &hf_gtpv0_chrg_ipv4, { "CG address IPv4", "gtpv0.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
5235 { &hf_gtpv0_chrg_ipv6, { "CG address IPv6", "gtpv0.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
5236 { &hf_gtpv0_node_ipv4, { "Node address IPv4", "gtpv0.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
5237 { &hf_gtpv0_node_ipv6, { "Node address IPv6", "gtpv0.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
5238 { &hf_gtpv0_ext_id, { "Extension identifier", "gtpv0.ext_id", FT_UINT16, BASE_DEC, NULL, 0, "Extension Identifier", HFILL }},
5239 { &hf_gtpv0_ext_val, { "Extension value", "gtpv0.ext_val", FT_STRING, BASE_DEC, NULL, 0, "Extension Value", HFILL }},
5240 { &hf_gtpv0_unknown, { "Unknown data (length)", "gtpv0.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
5245 static hf_register_info hf_gtpv1[] = {
5247 { &hf_gtpv1_flags, { "Flags", "gtpv1.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare/E/S/PN", HFILL }},
5248 { &hf_gtpv1_flags_ver, { "Version", "gtpv1.flags.version", FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, "GTP Version", HFILL }},
5249 { &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 }},
5250 { &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 }},
5251 { &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 }},
5252 { &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 }},
5253 { &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 }},
5254 { &hf_gtpv1_message_type, { "Message Type", "gtpv1.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
5255 { &hf_gtpv1_length, { "Length", "gtpv1.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
5256 { &hf_gtpv1_seq_number, { "Sequence Number", "gtpv1.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
5257 { &hf_gtpv1_teid, { "TEID", "gtpv1.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL }},
5258 { &hf_gtpv1_npdu_number, { "N-PDU Number", "gtpv1.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, "N-PDU Number", HFILL }},
5259 { &hf_gtpv1_next, { "Next extension header type", "gtpv1.next", FT_UINT8, BASE_HEX, NULL, 0, "Next Extension Header Type", HFILL }},
5260 { &hf_gtpv1_cause, { "Cause ", "gtpv1.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
5261 { &hf_gtpv1_imsi, { "IMSI", "gtpv1.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
5262 { &hf_gtpv1_rai_mcc, { "MCC", "gtpv1.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
5263 { &hf_gtpv1_rai_mnc, { "MNC", "gtpv1.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
5264 { &hf_gtpv1_rai_rac, { "RAC", "gtpv1.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
5265 { &hf_gtpv1_rai_lac, { "LAC", "gtpv1.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
5266 { &hf_gtpv1_tlli, { "TLLI", "gtpv1.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
5267 { &hf_gtpv1_ptmsi, { "P-TMSI", "gtpv1.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
5268 { &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 }},
5269 { &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 }},
5270 { &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 }},
5271 { &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 }},
5272 { &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 }},
5273 { &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 }},
5274 { &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 }},
5275 { &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 }},
5276 { &hf_gtpv1_reorder, { "Reordering required","gtpv1.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
5277 { &hf_gtpv1_map_cause, { "MAP cause", "gtpv1.map_cause", FT_UINT8, BASE_DEC, VALS(map_cause_type), 0, "MAP cause", HFILL }},
5278 { &hf_gtpv1_ptmsi_sig, { "P-TMSI Signature", "gtpv1.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
5279 { &hf_gtpv1_ms_valid, { "MS validated", "gtpv1.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
5280 { &hf_gtpv1_recovery, { "Recovery", "gtpv1.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
5281 { &hf_gtpv1_sel_mode, { "Selection Mode", "gtpv1.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
5282 { &hf_gtpv1_teid_data, { "TEID Data I", "gtpv1.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL }},
5283 { &hf_gtpv1_teid_cp, { "TEID Control Plane", "gtpv1.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL }},
5284 { &hf_gtpv1_nsapi, { "NSAPI", "gtpv1.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
5285 { &hf_gtpv1_teid_ii, { "TEID Data II", "gtpv1.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL }},
5286 { &hf_gtpv1_tear_ind, { "Teardown Indicator","gtpv1.tear_ind", FT_BOOLEAN, BASE_NONE,NULL, 0, "Teardown Indicator", HFILL }},
5287 { &hf_gtpv1_ranap_cause, { "RANAP cause", "gtpv1.ranap_cause", FT_UINT8, BASE_DEC, VALS(ranap_cause_type), 0, "RANAP cause", HFILL }},
5288 { &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 }},
5289 { &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 }},
5290 { &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 }},
5291 { &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 }},
5292 { &hf_gtpv1_rp_sms, { "Radio Priority SMS", "gtpv1.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL }},
5293 { &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 }},
5294 { &hf_gtpv1_rp_spare, { "Reserved", "gtpv1.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL }},
5295 { &hf_gtpv1_rp, { "Radio Priority", "gtpv1.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL }},
5296 { &hf_gtpv1_pkt_flow_id, { "Packet Flow ID", "gtpv1.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, "Packet Flow ID", HFILL }},
5297 { &hf_gtpv1_chrg_char_s, { "Spare", "gtpv1.chrg_char_s", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, "Spare", HFILL }},
5298 { &hf_gtpv1_chrg_char_n, { "Normal charging", "gtpv1.chrg_char_n", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, "Normal charging", HFILL }},
5299 { &hf_gtpv1_chrg_char_p, { "Prepaid charging", "gtpv1.chrg_char_p", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, "Prepaid charging", HFILL }},
5300 { &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 }},
5301 { &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 }},
5302 { &hf_gtpv1_chrg_char_r, { "Reserved", "gtpv1.chrg_char_r", FT_UINT8, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, "Reserved", HFILL }},
5303 { &hf_gtpv1_trace_ref, { "Trace reference", "gtpv1.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, "Trace reference", HFILL }},
5304 { &hf_gtpv1_trace_type, { "Trace type", "gtpv1.trace_type", FT_UINT16, BASE_HEX, NULL, 0, "Trace type", HFILL }},
5305 { &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 }},
5306 { &hf_gtpv1_tr_comm, { "Packet transfer command", "gtpv1.tr_comm", FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0, "Packat transfer command", HFILL }},
5307 { &hf_gtpv1_chrg_id, { "Charging ID", "gtpv1.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
5308 { &hf_gtpv1_user_ipv4, { "End user address IPv4", "gtpv1.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
5309 { &hf_gtpv1_user_ipv6, { "End user address IPv6", "gtpv1.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
5310 { &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 }},
5311 { &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 }},
5312 { &hf_gtpv1_apn, { "APN", "gtpv1.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
5313 { &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 }},
5314 { &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 }},
5315 { &hf_gtpv1_gsn_ipv4, { "GSN address IPv4", "gtpv1.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
5316 { &hf_gtpv1_gsn_ipv6, { "GSN address IPv6", "gtpv1.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
5317 { &hf_gtpv1_msisdn, { "MSISDN", "gtpv1.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
5318 { &hf_gtpv1_qos_al_ret_priority, { "Allocation/Retention priority ","gtpv1.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, "Allocation/Retention Priority", HFILL }},
5319 { &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 }},
5320 { &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 }},
5321 { &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 }},
5322 { &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 }},
5323 { &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 }},
5324 { &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 }},
5325 { &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 }},
5326 { &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 }},
5327 { &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 }},
5328 { &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 }},
5329 { &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 }},
5330 { &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 }},
5332 { &hf_gtpv1_tft_code, { "TFT operation code", "gtpv1.tft_code", FT_UINT8, BASE_DEC, VALS (tft_code_type), GTPv1_TFT_CODE_MASK, "TFT operation code", HFILL }},
5333 { &hf_gtpv1_tft_spare, { "TFT spare bit", "gtpv1.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, "TFT spare bit", HFILL }},
5334 { &hf_gtpv1_tft_number, { "Number of packet filters", "gtpv1.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, "Number of packet filters", HFILL }},
5335 { &hf_gtpv1_tft_eval, { "Evaluation precedence", "gtpv1.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, "Evaluation precedence", HFILL }},
5337 { &hf_gtpv1_rnc_ipv4, { "RNC address IPv4", "gtpv1.rnc_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Radio Network Controller address IPv4", HFILL }},
5338 { &hf_gtpv1_rnc_ipv6, { "RNC address IPv6", "gtpv1.rnc_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Radio Network Controller address IPv6", HFILL }},
5339 { &hf_gtpv1_chrg_ipv4, { "CG address IPv4", "gtpv1.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
5340 { &hf_gtpv1_chrg_ipv6, { "CG address IPv6", "gtpv1.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
5341 { &hf_gtpv1_node_ipv4, { "Node address IPv4", "gtpv1.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
5342 { &hf_gtpv1_node_ipv6, { "Node address IPv6", "gtpv1.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
5343 { &hf_gtpv1_ext_id, { "Extensio Identifier","gtpv1.ext_id", FT_UINT16, BASE_DEC, NULL, 0, "Extension Identifier", HFILL }},
5344 { &hf_gtpv1_ext_val, { "Extension Value", "gtpv1.ext_val", FT_STRING, BASE_DEC, NULL, 0, "Extension Value", HFILL }},
5345 { &hf_gtpv1_unknown, { "Unknown data (length)", "gtpv1.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
5349 static gint *ett_gtp_array[] = {
5359 &ett_gtp_pkt_flow_id,
5382 module_t *gtp_module;
5384 static enum_val_t gtpv0_cdr_options[] = {
5385 { "GSM 12.15 (not implemented yet)", 0 },
5391 /* proto_gtp defined only for preference tab */
5392 proto_gtp = proto_register_protocol ("GPRS Tunneling Protocol", "GTP", "gtp");
5394 proto_gtpv0 = proto_register_protocol ("GPRS Tunnelling Protocol v0", "GTPv0", "gtpv0");
5395 proto_register_field_array(proto_gtpv0, hf_gtpv0, array_length(hf_gtpv0));
5396 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
5398 proto_gtpv1 = proto_register_protocol("GPRS Tunnelling Protocol v1", "GTPv1", "gtpv1");
5399 proto_register_field_array(proto_gtpv1, hf_gtpv1, array_length(hf_gtpv1));
5400 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
5402 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
5404 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 port", "GTPv0 port (default 3386)", 10, &g_gtpv0_port);
5405 prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 control plane (GTP-C) port", "GTPv1 control plane port (default 2123)", 10, &g_gtpv1c_port);
5406 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10, &g_gtpv1u_port);
5407 prefs_register_bool_preference(gtp_module, "dissect_tpdu", "Dissect T-PDU", "Dissect T-PDU", >p_tpdu);
5408 prefs_register_enum_preference(gtp_module, "v0_dissect_cdr_as", "Dissect GTP'v0 CDRs as", "Dissect GTP'v0 CDRs as", >pv0_cdr_as, gtpv0_cdr_options, FALSE);
5409 prefs_register_bool_preference(gtp_module, "v0_check_etsi", "Compare GTPv0 order with ETSI", "GTPv0 ETSI order", >pv0_etsi_order);
5410 prefs_register_bool_preference(gtp_module, "v1_check_etsi", "Compare GTPv1 order with ETSI", "GTPv1 ETSI order", >pv1_etsi_order);
5411 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
5413 register_dissector("gtpv0", dissect_gtpv0, proto_gtpv0);
5414 register_dissector("gtpv1", dissect_gtpv1, proto_gtpv1);
5418 proto_reg_handoff_gtp(void)
5420 static int Initialized = FALSE;
5421 static dissector_handle_t gtpv0_handle;
5422 static dissector_handle_t gtpv1_handle;
5426 gtpv0_handle = find_dissector("gtpv0");
5428 gtpv1_handle = find_dissector("gtpv1");
5430 ppp_subdissector_table = find_dissector_table("ppp.protocol");
5436 dissector_delete("udp.port", gtpv0_port, gtpv0_handle);
5437 dissector_delete("tcp.port", gtpv0_port, gtpv0_handle);
5439 dissector_delete("udp.port", gtpv1c_port, gtpv1_handle);
5440 dissector_delete("tcp.port", gtpv1c_port, gtpv1_handle);
5441 dissector_delete("udp.port", gtpv1u_port, gtpv1_handle);
5442 dissector_delete("tcp.port", gtpv1u_port, gtpv1_handle);
5445 gtpv0_port = g_gtpv0_port;
5446 gtpv1c_port = g_gtpv1c_port;
5447 gtpv1u_port = g_gtpv1u_port;
5451 dissector_add("udp.port", g_gtpv0_port, gtpv0_handle);
5452 dissector_add("tcp.port", g_gtpv0_port, gtpv0_handle);
5456 dissector_add("udp.port", g_gtpv1c_port, gtpv1_handle);
5457 dissector_add("tcp.port", g_gtpv1c_port, gtpv1_handle);
5458 dissector_add("udp.port", g_gtpv1u_port, gtpv1_handle);
5459 dissector_add("tcp.port", g_gtpv1u_port, gtpv1_handle);
5461 ip_handle = find_dissector("ip");
5462 ipv6_handle = find_dissector("ipv6");
5463 ppp_handle = find_dissector("ppp");
5464 data_handle = find_dissector("data");