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.73 2004/02/27 09:25:27 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;
46 #define GTPv0_PORT 3386
47 #define GTPv1C_PORT 2123 /* 3G Control PDU */
48 #define GTPv1U_PORT 2152 /* 3G T-PDU */
50 #define GTPv0_HDR_LENGTH 20
51 #define GTPv1_HDR_LENGTH 12
52 #define GTP_PRIME_HDR_LENGTH 6
54 /* to check compliance with ETSI */
55 #define GTP_MANDATORY 1
56 #define GTP_OPTIONAL 2
57 #define GTP_CONDITIONAL 4
59 static int g_gtpv0_port = GTPv0_PORT;
60 static int g_gtpv1c_port = GTPv1C_PORT;
61 static int g_gtpv1u_port = GTPv1U_PORT;
63 void proto_reg_handoff_gtp(void);
65 static int proto_gtp = -1;
67 static int hf_gtp_apn = -1;
68 static int hf_gtp_cause = -1;
69 static int hf_gtp_chrg_char = -1;
70 static int hf_gtp_chrg_char_s = -1;
71 static int hf_gtp_chrg_char_n = -1;
72 static int hf_gtp_chrg_char_p = -1;
73 static int hf_gtp_chrg_char_f = -1;
74 static int hf_gtp_chrg_char_h = -1;
75 static int hf_gtp_chrg_char_r = -1;
76 static int hf_gtp_chrg_id = -1;
77 static int hf_gtp_chrg_ipv4 = -1;
78 static int hf_gtp_chrg_ipv6 = -1;
79 static int hf_gtp_ext_flow_label = -1;
80 static int hf_gtp_ext_id = -1;
81 static int hf_gtp_ext_val = -1;
82 static int hf_gtp_flags = -1;
83 static int hf_gtp_flags_ver = -1;
84 static int hf_gtp_flags_pt = -1;
85 static int hf_gtp_flags_spare1 = -1;
86 static int hf_gtp_flags_snn = -1;
87 static int hf_gtp_flags_spare2 = -1;
88 static int hf_gtp_flags_e = -1;
89 static int hf_gtp_flags_s = -1;
90 static int hf_gtp_flags_pn = -1;
91 static int hf_gtp_flow_ii = -1;
92 static int hf_gtp_flow_label = -1;
93 static int hf_gtp_flow_sig = -1;
94 static int hf_gtp_gsn_addr_len = -1;
95 static int hf_gtp_gsn_addr_type = -1;
96 static int hf_gtp_gsn_ipv4 = -1;
97 static int hf_gtp_gsn_ipv6 = -1;
98 static int hf_gtp_imsi = -1;
99 static int hf_gtp_length = -1;
100 static int hf_gtp_map_cause = -1;
101 static int hf_gtp_message_type = -1;
102 static int hf_gtp_ms_reason = -1;
103 static int hf_gtp_ms_valid = -1;
104 static int hf_gtp_msisdn = -1;
105 static int hf_gtp_next = -1;
106 static int hf_gtp_npdu_number = -1;
107 static int hf_gtp_node_ipv4 = -1;
108 static int hf_gtp_node_ipv6 = -1;
109 static int hf_gtp_nsapi = -1;
110 static int hf_gtp_ptmsi = -1;
111 static int hf_gtp_ptmsi_sig = -1;
112 static int hf_gtp_qos_spare1 = -1;
113 static int hf_gtp_qos_delay = -1;
114 static int hf_gtp_qos_mean = -1;
115 static int hf_gtp_qos_peak = -1;
116 static int hf_gtp_qos_spare2 = -1;
117 static int hf_gtp_qos_precedence = -1;
118 static int hf_gtp_qos_spare3 = -1;
119 static int hf_gtp_qos_reliability = -1;
120 static int hf_gtp_qos_al_ret_priority = -1;
121 static int hf_gtp_qos_traf_class = -1;
122 static int hf_gtp_qos_del_order = -1;
123 static int hf_gtp_qos_del_err_sdu = -1;
124 static int hf_gtp_qos_max_sdu_size = -1;
125 static int hf_gtp_qos_max_ul = -1;
126 static int hf_gtp_qos_max_dl = -1;
127 static int hf_gtp_qos_res_ber = -1;
128 static int hf_gtp_qos_sdu_err_ratio = -1;
129 static int hf_gtp_qos_trans_delay = -1;
130 static int hf_gtp_qos_traf_handl_prio = -1;
131 static int hf_gtp_qos_guar_ul = -1;
132 static int hf_gtp_qos_guar_dl = -1;
133 static int hf_gtp_pkt_flow_id = -1;
134 static int hf_gtp_rab_gtpu_dn = -1;
135 static int hf_gtp_rab_gtpu_up = -1;
136 static int hf_gtp_rab_pdu_dn = -1;
137 static int hf_gtp_rab_pdu_up = -1;
138 static int hf_gtp_rai_mcc = -1;
139 static int hf_gtp_rai_mnc = -1;
140 static int hf_gtp_rai_rac = -1;
141 static int hf_gtp_rai_lac = -1;
142 static int hf_gtp_ranap_cause = -1;
143 static int hf_gtp_recovery = -1;
144 static int hf_gtp_reorder = -1;
145 static int hf_gtp_rnc_ipv4 = -1;
146 static int hf_gtp_rnc_ipv6 = -1;
147 static int hf_gtp_rp = -1;
148 static int hf_gtp_rp_nsapi = -1;
149 static int hf_gtp_rp_sms = -1;
150 static int hf_gtp_rp_spare = -1;
151 static int hf_gtp_sel_mode = -1;
152 static int hf_gtp_seq_number = -1;
153 static int hf_gtp_sndcp_number = -1;
154 static int hf_gtp_tear_ind = -1;
155 static int hf_gtp_teid = -1;
156 static int hf_gtp_teid_cp = -1;
157 static int hf_gtp_teid_data = -1;
158 static int hf_gtp_teid_ii = -1;
159 static int hf_gtp_tft_code = -1;
160 static int hf_gtp_tft_spare = -1;
161 static int hf_gtp_tft_number = -1;
162 static int hf_gtp_tft_eval = -1;
163 static int hf_gtp_tid = -1;
164 static int hf_gtp_tlli = -1;
165 static int hf_gtp_tr_comm = -1;
166 static int hf_gtp_trace_ref = -1;
167 static int hf_gtp_trace_type = -1;
168 static int hf_gtp_unknown = -1;
169 static int hf_gtp_user_addr_pdp_org = -1;
170 static int hf_gtp_user_addr_pdp_type = -1;
171 static int hf_gtp_user_ipv4 = -1;
172 static int hf_gtp_user_ipv6 = -1;
174 /* Initialize the subtree pointers */
175 static gint ett_gtp = -1;
176 static gint ett_gtp_flags = -1;
177 static gint ett_gtp_ext = -1;
178 static gint ett_gtp_rai = -1;
179 static gint ett_gtp_qos = -1;
180 static gint ett_gtp_auth_tri = -1;
181 static gint ett_gtp_flow_ii = -1;
182 static gint ett_gtp_rab_cntxt = -1;
183 static gint ett_gtp_rp = -1;
184 static gint ett_gtp_pkt_flow_id = -1;
185 static gint ett_gtp_chrg_char = -1;
186 static gint ett_gtp_user = -1;
187 static gint ett_gtp_mm = -1;
188 static gint ett_gtp_trip = -1;
189 static gint ett_gtp_quint = -1;
190 static gint ett_gtp_pdp = -1;
191 static gint ett_gtp_apn = -1;
192 static gint ett_gtp_proto = -1;
193 static gint ett_gtp_gsn_addr = -1;
194 static gint ett_gtp_tft = -1;
195 static gint ett_gtp_tft_pf = -1;
196 static gint ett_gtp_tft_flags = -1;
197 static gint ett_gtp_rab_setup = -1;
198 static gint ett_gtp_hdr_list = -1;
199 static gint ett_gtp_chrg_addr = -1;
200 static gint ett_gtp_node_addr = -1;
201 static gint ett_gtp_rel_pack = -1;
202 static gint ett_gtp_can_pack = -1;
203 static gint ett_gtp_data_resp = -1;
204 static gint ett_gtp_priv_ext = -1;
206 static gboolean gtp_tpdu = TRUE;
207 static gboolean gtp_etsi_order = FALSE;
208 static int gtpv0_port = 0;
209 static int gtpv1c_port = 0;
210 static int gtpv1u_port = 0;
212 /* Definition of flags masks */
213 #define GTP_VER_MASK 0xE0
215 static const value_string ver_types[] = {
216 { 0, "GTP release 97/98 version" },
217 { 1, "GTP release 99 version" },
227 #define GTP_PT_MASK 0x10
228 #define GTP_SPARE1_MASK 0x0E
229 #define GTP_SPARE2_MASK 0x08
230 #define GTP_E_MASK 0x04
231 #define GTP_S_MASK 0x02
232 #define GTP_SNN_MASK 0x01
233 #define GTP_PN_MASK 0x01
235 /* Definition of 3G charging characteristics masks */
236 #define GTP_MASK_CHRG_CHAR_S 0xF000
237 #define GTP_MASK_CHRG_CHAR_N 0x0800
238 #define GTP_MASK_CHRG_CHAR_P 0x0400
239 #define GTP_MASK_CHRG_CHAR_F 0x0200
240 #define GTP_MASK_CHRG_CHAR_H 0x0100
241 #define GTP_MASK_CHRG_CHAR_R 0x00FF
243 /* Traffic Flow Templates mask */
244 #define GTPv1_TFT_CODE_MASK 0xE0
245 #define GTPv1_TFT_SPARE_MASK 0x10
246 #define GTPv1_TFT_NUMBER_MASK 0x0F
248 /* Definition of GSN Address masks */
249 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
250 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
252 /* Definition of QoS masks */
253 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
254 #define GTP_EXT_QOS_DELAY_MASK 0x38
255 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
256 #define GTP_EXT_QOS_PEAK_MASK 0xF0
257 #define GTP_EXT_QOS_SPARE2_MASK 0x08
258 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
259 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
260 #define GTP_EXT_QOS_MEAN_MASK 0x1F
261 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
262 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
263 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
264 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
265 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
266 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
267 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
269 /* Definition of Radio Priority's masks */
270 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
271 #define GTPv1_EXT_RP_SPARE_MASK 0x08
272 #define GTPv1_EXT_RP_MASK 0x07
274 /* definitions of GTP messages */
275 #define GTP_MSG_UNKNOWN 0x00
276 #define GTP_MSG_ECHO_REQ 0x01
277 #define GTP_MSG_ECHO_RESP 0x02
278 #define GTP_MSG_VER_NOT_SUPP 0x03
279 #define GTP_MSG_NODE_ALIVE_REQ 0x04
280 #define GTP_MSG_NODE_ALIVE_RESP 0x05
281 #define GTP_MSG_REDIR_REQ 0x06
282 #define GTP_MSG_REDIR_RESP 0x07
283 #define GTP_MSG_CREATE_PDP_REQ 0x10
284 #define GTP_MSG_CREATE_PDP_RESP 0x11
285 #define GTP_MSG_UPDATE_PDP_REQ 0x12
286 #define GTP_MSG_UPDATE_PDP_RESP 0x13
287 #define GTP_MSG_DELETE_PDP_REQ 0x14
288 #define GTP_MSG_DELETE_PDP_RESP 0x15
289 #define GTP_MSG_CREATE_AA_PDP_REQ 0x16 /* 2G */
290 #define GTP_MSG_CREATE_AA_PDP_RESP 0x17 /* 2G */
291 #define GTP_MSG_DELETE_AA_PDP_REQ 0x18 /* 2G */
292 #define GTP_MSG_DELETE_AA_PDP_RESP 0x19 /* 2G */
293 #define GTP_MSG_ERR_IND 0x1A
294 #define GTP_MSG_PDU_NOTIFY_REQ 0x1B
295 #define GTP_MSG_PDU_NOTIFY_RESP 0x1C
296 #define GTP_MSG_PDU_NOTIFY_REJ_REQ 0x1D
297 #define GTP_MSG_PDU_NOTIFY_REJ_RESP 0x1E
298 #define GTP_MSG_SUPP_EXT_HDR 0x1F
299 #define GTP_MSG_SEND_ROUT_INFO_REQ 0x20
300 #define GTP_MSG_SEND_ROUT_INFO_RESP 0x21
301 #define GTP_MSG_FAIL_REP_REQ 0x22
302 #define GTP_MSG_FAIL_REP_RESP 0x23
303 #define GTP_MSG_MS_PRESENT_REQ 0x24
304 #define GTP_MSG_MS_PRESENT_RESP 0x25
305 #define GTP_MSG_IDENT_REQ 0x30
306 #define GTP_MSG_IDENT_RESP 0x31
307 #define GTP_MSG_SGSN_CNTXT_REQ 0x32
308 #define GTP_MSG_SGSN_CNTXT_RESP 0x33
309 #define GTP_MSG_SGSN_CNTXT_ACK 0x34
310 #define GTP_MSG_FORW_RELOC_REQ 0x35
311 #define GTP_MSG_FORW_RELOC_RESP 0x36
312 #define GTP_MSG_FORW_RELOC_COMP 0x37
313 #define GTP_MSG_RELOC_CANCEL_REQ 0x38
314 #define GTP_MSG_RELOC_CANCEL_RESP 0x39
315 #define GTP_MSG_FORW_SRNS_CNTXT 0x3A
316 #define GTP_MSG_FORW_RELOC_ACK 0x3B
317 #define GTP_MSG_FORW_SRNS_CNTXT_ACK 0x3C
318 #define GTP_MSG_DATA_TRANSF_REQ 0xF0
319 #define GTP_MSG_DATA_TRANSF_RESP 0xF1
320 #define GTP_MSG_TPDU 0xFF
322 static const value_string message_type[] = {
323 { GTP_MSG_UNKNOWN, "For future use" },
324 { GTP_MSG_ECHO_REQ, "Echo request" },
325 { GTP_MSG_ECHO_RESP, "Echo response" },
326 { GTP_MSG_VER_NOT_SUPP, "Version not supported" },
327 { GTP_MSG_NODE_ALIVE_REQ, "Node alive request" },
328 { GTP_MSG_NODE_ALIVE_RESP, "Node alive response" },
329 { GTP_MSG_REDIR_REQ, "Redirection request" },
330 { GTP_MSG_REDIR_RESP, "Redirection response" },
331 { GTP_MSG_CREATE_PDP_REQ, "Create PDP context request" },
332 { GTP_MSG_CREATE_PDP_RESP, "Create PDP context response" },
333 { GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request" },
334 { GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response" },
335 { GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request" },
336 { GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response" },
337 { GTP_MSG_CREATE_AA_PDP_REQ, "Create AA PDP Context Request" },
338 { GTP_MSG_CREATE_AA_PDP_RESP, "Create AA PDP Context Response" },
339 { GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request" },
340 { GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response" },
341 { GTP_MSG_ERR_IND, "Error indication" },
342 { GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request" },
343 { GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response" },
344 { GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request" },
345 { GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response" },
346 { GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification" },
347 { GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request" },
348 { GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response" },
349 { GTP_MSG_FAIL_REP_REQ, "Failure report request" },
350 { GTP_MSG_FAIL_REP_RESP, "Failure report response" },
351 { GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request" },
352 { GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response" },
353 { GTP_MSG_IDENT_REQ, "Identification request" },
354 { GTP_MSG_IDENT_RESP, "Identification response" },
355 { GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request" },
356 { GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response" },
357 { GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement" },
358 { GTP_MSG_FORW_RELOC_REQ, "Forward relocation request" },
359 { GTP_MSG_FORW_RELOC_RESP, "Forward relocation response" },
360 { GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete" },
361 { GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request" },
362 { GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response" },
363 { GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context" },
364 { GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge" },
365 { GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge" },
366 { GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request" },
367 { GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response" },
368 { GTP_MSG_TPDU, "T-PDU" },
372 /* definitions of fields in extension header */
373 #define GTP_EXT_CAUSE 0x01
374 #define GTP_EXT_IMSI 0x02
375 #define GTP_EXT_RAI 0x03
376 #define GTP_EXT_TLLI 0x04
377 #define GTP_EXT_PTMSI 0x05
378 #define GTP_EXT_QOS_GPRS 0x06
379 #define GTP_EXT_REORDER 0x08
380 #define GTP_EXT_AUTH_TRI 0x09
381 #define GTP_EXT_MAP_CAUSE 0x0B
382 #define GTP_EXT_PTMSI_SIG 0x0C
383 #define GTP_EXT_MS_VALID 0x0D
384 #define GTP_EXT_RECOVER 0x0E
385 #define GTP_EXT_SEL_MODE 0x0F
387 #define GTP_EXT_16 0x10
388 #define GTP_EXT_FLOW_LABEL 0x10
389 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
391 #define GTP_EXT_17 0x11
392 #define GTP_EXT_FLOW_SIG 0x11
393 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
395 #define GTP_EXT_18 0x12
396 #define GTP_EXT_FLOW_II 0x12
397 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G*/
399 #define GTP_EXT_19 0x13
400 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
401 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G*/
403 #define GTP_EXT_NSAPI 0x14 /* 3G */
404 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
405 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
406 #define GTP_EXT_RP_SMS 0x17 /* 3G */
407 #define GTP_EXT_RP 0x18 /* 3G */
408 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
409 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
410 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
411 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
412 #define GTPv1_EXT_MS_REASON 0x1D /* 3G */
413 #define GTP_EXT_TR_COMM 0x7E /* charging */
414 #define GTP_EXT_CHRG_ID 0x7F
415 #define GTP_EXT_USER_ADDR 0x80
416 #define GTP_EXT_MM_CNTXT 0x81
417 #define GTP_EXT_PDP_CNTXT 0x82
418 #define GTP_EXT_APN 0x83
419 #define GTP_EXT_PROTO_CONF 0x84
420 #define GTP_EXT_GSN_ADDR 0x85
421 #define GTP_EXT_MSISDN 0x86
422 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
423 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
424 #define GTP_EXT_TFT 0x89 /* 3G */
425 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
426 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
427 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
428 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
429 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G */
430 #define GTP_EXT_OMC_ID 0x8F /* 3G */
431 #define GTP_EXT_C1 0xC1
432 #define GTP_EXT_C2 0xC2
433 #define GTP_EXT_REL_PACK 0xF9 /* charging */
434 #define GTP_EXT_CAN_PACK 0xFA /* charging */
435 #define GTP_EXT_CHRG_ADDR 0xFB
436 #define GTP_EXT_DATA_REQ 0xFC /* charging */
437 #define GTP_EXT_DATA_RESP 0xFD /* charging */
438 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
439 #define GTP_EXT_PRIV_EXT 0xFF
441 static const value_string gtp_val[] = {
442 { GTP_EXT_CAUSE, "Cause of operation" },
443 { GTP_EXT_IMSI, "IMSI" },
444 { GTP_EXT_RAI, "Routing Area Identity" },
445 { GTP_EXT_TLLI, "Temporary Logical Link Identity" },
446 { GTP_EXT_PTMSI, "Packet TMSI" },
447 { GTP_EXT_QOS_GPRS, "Quality of Service" },
448 { GTP_EXT_REORDER, "Reorder required" },
449 { GTP_EXT_AUTH_TRI, "Authentication triplets" },
450 { GTP_EXT_MAP_CAUSE, "MAP cause" },
451 { GTP_EXT_PTMSI_SIG, "P-TMSI signature" },
452 { GTP_EXT_MS_VALID, "MS validated" },
453 { GTP_EXT_RECOVER, "Recovery" },
454 { GTP_EXT_SEL_MODE, "Selection mode" },
456 { GTP_EXT_16, "Flow label data I" },
457 { GTP_EXT_FLOW_LABEL, "Flow label data I" },
458 { GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I" }, /* 3G */
460 { GTP_EXT_17, "Flow label signalling" },
461 { GTP_EXT_FLOW_SIG, "Flow label signalling" },
462 { GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane" }, /* 3G */
464 { GTP_EXT_18, "Flow label data II" },
465 { GTP_EXT_FLOW_II, "Flow label data II" },
466 { GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II" }, /* 3G */
468 { GTP_EXT_19, "MS not reachable reason" },
469 { GTP_EXT_MS_REASON, "MS not reachable reason" },
470 { GTP_EXT_TEAR_IND, "Teardown ID" }, /* 3G */
472 { GTP_EXT_NSAPI, "NSAPI" }, /* 3G */
473 { GTP_EXT_RANAP_CAUSE, "RANAP cause" }, /* 3G */
474 { GTP_EXT_RAB_CNTXT, "RAB context" }, /* 3G */
475 { GTP_EXT_RP_SMS, "Radio Priority for MO SMS" }, /* 3G */
476 { GTP_EXT_RP, "Radio Priority" }, /* 3G */
477 { GTP_EXT_PKT_FLOW_ID, "Packet Flow ID" }, /* 3G */
478 { GTP_EXT_CHRG_CHAR, "Charging characteristics" }, /* 3G */
479 { GTP_EXT_TRACE_REF, "Trace references" }, /* 3G */
480 { GTP_EXT_TRACE_TYPE, "Trace type" }, /* 3G */
481 { GTPv1_EXT_MS_REASON, "MS not reachable reason" }, /* 3G */
482 { GTP_EXT_TR_COMM, "Packet transfer command" }, /* charging */
483 { GTP_EXT_CHRG_ID, "Charging ID" },
484 { GTP_EXT_USER_ADDR, "End user address" },
485 { GTP_EXT_MM_CNTXT, "MM context" },
486 { GTP_EXT_PDP_CNTXT, "PDP context" },
487 { GTP_EXT_APN, "Access Point Name" },
488 { GTP_EXT_PROTO_CONF, "Protocol configuration options" },
489 { GTP_EXT_GSN_ADDR, "GSN address" },
490 { GTP_EXT_MSISDN, "MS international PSTN/ISDN number" },
491 { GTP_EXT_QOS_UMTS, "Quality of service (UMTS)" }, /* 3G */
492 { GTP_EXT_AUTH_QUI, "Authentication quintuplets" }, /* 3G */
493 { GTP_EXT_TFT, "Traffic Flow Template (TFT)" }, /* 3G */
494 { GTP_EXT_TARGET_ID, "Target (RNC) identification" }, /* 3G */
495 { GTP_EXT_UTRAN_CONT, "UTRAN transparent field" }, /* 3G */
496 { GTP_EXT_RAB_SETUP, "RAB setup information" }, /* 3G */
497 { GTP_EXT_HDR_LIST, "Extension Header Types List" }, /* 3G */
498 { GTP_EXT_TRIGGER_ID, "Trigger Id" }, /* 3G */
499 { GTP_EXT_OMC_ID, "OMC Identity" }, /* 3G */
500 { GTP_EXT_REL_PACK, "Sequence numbers of released packets IE" }, /* charging */
501 { GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE" }, /* charging */
502 { GTP_EXT_CHRG_ADDR, "Charging Gateway address" },
503 { GTP_EXT_DATA_REQ, "Data record packet" }, /* charging */
504 { GTP_EXT_DATA_RESP, "Requests responded" }, /* charging */
505 { GTP_EXT_NODE_ADDR, "Address of recommended node" }, /* charging */
506 { GTP_EXT_PRIV_EXT, "Private Extension" },
510 /* GPRS: 9.60 v7.6.0, page 37
511 * UMTS: 29.060 v4.0, page 45
513 static const value_string cause_type[] = {
514 { 0, "Request IMSI" },
515 { 1, "Request IMEI" },
516 { 2, "Request IMSI and IMEI" },
517 { 3, "No identity needed" },
519 { 5, "MS is not GPRS responding" },
520 { 59, "System failure" }, /* charging */
521 { 60, "The transmit buffers are becoming full" }, /* charging */
522 { 61, "The receive buffers are becoming full" }, /* charging */
523 { 62, "Another node is about to go down" }, /* charging */
524 { 63, "This node is about to go down" }, /* charging */
525 { 128, "Request accepted" },
526 { 192, "Non-existent" },
527 { 193, "Invalid message format" },
528 { 194, "IMSI not known" },
529 { 195, "MS is GPRS detached" },
530 { 196, "MS is not GPRS responding" },
531 { 197, "MS refuses" },
532 { 198, "Version not supported" },
533 { 199, "No resource available" },
534 { 200, "Service not supported" },
535 { 201, "Mandatory IE incorrect" },
536 { 202, "Mandatory IE missing" },
537 { 203, "Optional IE incorrect" },
538 { 204, "System failure" },
539 { 205, "Roaming restriction" },
540 { 206, "P-TMSI signature mismatch" },
541 { 207, "GPRS connection suspended" },
542 { 208, "Authentication failure" },
543 { 209, "User authentication failed" },
544 { 210, "Context not found" },
545 { 211, "All PDP dynamic addresses are occupied" },
546 { 212, "No memory is available" },
547 { 213, "Relocation failure" },
548 { 214, "Unknown mandatory extension header" },
549 { 215, "Semantic error in the TFT operation" },
550 { 216, "Syntactic error in the TFT operation" },
551 { 217, "Semantic errors in packet filter(s)" },
552 { 218, "Syntactic errors in packet filter(s)" },
553 { 219, "Missing or unknown APN" },
554 { 220, "Unknown PDP address or PDP type" },
555 { 252, "Request related to possibly duplicated packets already fulfilled" }, /* charging */
556 { 253, "Request already fulfilled" }, /* charging */
557 { 254, "Sequence numbers of released/cancelled packets IE incorrect" }, /* charging */
558 { 255, "Request not fulfilled" }, /* charging */
563 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
564 * TODO: Check if all map_cause values are included
566 static const value_string map_cause_type[] = {
567 { 1, "Unknown subscriber" },
568 { 8, "Roaming not allowed" },
569 { 10, "Bearer service not provisioned" },
570 { 11, "Teleservice not provisioned" },
571 { 13, "Call barred" },
572 { 21, "Facility not supported" },
573 { 23, "Update GPRS location" },
574 { 24, "Send routing info for GPRS" },
575 { 26, "Note MS present for GPRS" },
576 { 27, "Absent subscriber" },
577 { 34, "System failure" },
578 { 35, "Data missing" },
579 { 36, "Unexpected data value" },
580 { 44, "Number chenged" },
581 { 45, "Busy subscriber" },
582 { 46, "No subscriber reply" },
583 { 48, "Facility not allowed" },
587 static const value_string gsn_addr_type[] = {
593 static const value_string pdp_type[] = {
596 { 0x02, "OSP:IHOSS" },
602 static const value_string pdp_org_type[] = {
608 static const value_string qos_delay_type[] = {
609 { 0x00, "Subsribed delay class (in MS to network direction)" },
610 { 0x01, "Delay class 1" },
611 { 0x02, "Delay class 2" },
612 { 0x03, "Delay class 3" },
613 { 0x04, "Delay class 4 (best effort)" },
614 { 0x07, "Reserved" },
618 static const value_string qos_reliability_type[] = {
619 { 0x00, "Subscribed reliability class (in MS to network direction)" },
620 { 0x01, "Ack GTP/LLC/RLC, Protected data" },
621 { 0x02, "Unack GTP, Ack LLC/RLC, Protected data" },
622 { 0x03, "Unack GTP/LLC, Ack RLC, Protected data" },
623 { 0x04, "Unack GTP/LLC/RLC, Protected data" },
624 { 0x05, "Unack GTP/LLC/RLC, Unprotected data" },
625 { 0x07, "Reserved" },
629 static const value_string qos_peak_type[] = {
630 { 0x00, "Subscribed peak throughput (in MS to network direction)" },
631 { 0x01, "Up to 1 000 oct/s" },
632 { 0x02, "Up to 2 000 oct/s" },
633 { 0x03, "Up to 4 000 oct/s" },
634 { 0x04, "Up to 8 000 oct/s" },
635 { 0x05, "Up to 16 000 oct/s" },
636 { 0x06, "Up to 32 000 oct/s" },
637 { 0x07, "Up to 64 000 oct/s" },
638 { 0x08, "Up to 128 000 oct/s" },
639 { 0x09, "Up to 256 000 oct/s" },
640 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
641 { 0x0A, "Reserved" },
642 { 0x0B, "Reserved" },
643 { 0x0C, "Reserved" },
644 { 0x0D, "Reserved" },
645 { 0x0E, "Reserved" },
646 { 0x0F, "Reserved" },
650 static const value_string qos_precedence_type[] = {
651 { 0x00, "Subscribed precedence (in MS to network direction)" },
652 { 0x01, "High priority" },
653 { 0x02, "Normal priority" },
654 { 0x03, "Low priority" },
655 { 0x07, "Reserved" },
659 static const value_string qos_mean_type[] = {
660 { 0x00, "Subscribed mean throughput (in MS to network direction)" },
661 { 0x01, "100 oct/h" }, /* Class 2 */
662 { 0x02, "200 oct/h" }, /* Class 3 */
663 { 0x03, "500 oct/h" }, /* Class 4 */
664 { 0x04, "1 000 oct/h" }, /* Class 5 */
665 { 0x05, "2 000 oct/h" }, /* Class 6 */
666 { 0x06, "5 000 oct/h" }, /* Class 7 */
667 { 0x07, "10 000 oct/h" }, /* Class 8 */
668 { 0x08, "20 000 oct/h" }, /* Class 9 */
669 { 0x09, "50 000 oct/h" }, /* Class 10 */
670 { 0x0A, "100 000 oct/h" }, /* Class 11 */
671 { 0x0B, "200 000 oct/h" }, /* Class 12 */
672 { 0x0C, "500 000 oct/h" }, /* Class 13 */
673 { 0x0D, "1 000 000 oct/h" }, /* Class 14 */
674 { 0x0E, "2 000 000 oct/h" }, /* Class 15 */
675 { 0x0F, "5 000 000 oct/h" }, /* Class 16 */
676 { 0x10, "10 000 000 oct/h" }, /* Class 17 */
677 { 0x11, "20 000 000 oct/h" }, /* Class 18 */
678 { 0x12, "50 000 000 oct/h" }, /* Class 19 */
679 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
680 { 0x13, "Reserved" },
681 { 0x14, "Reserved" },
682 { 0x15, "Reserved" },
683 { 0x16, "Reserved" },
684 { 0x17, "Reserved" },
685 { 0x18, "Reserved" },
686 { 0x19, "Reserved" },
687 { 0x1A, "Reserved" },
688 { 0x1B, "Reserved" },
689 { 0x1C, "Reserved" },
690 { 0x1D, "Reserved" },
691 { 0x1E, "Reserved" },
692 { 0x1F, "Best effort" }, /* Class 1 */
696 static const value_string qos_del_err_sdu[] = {
697 { 0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)" },
698 { 0x01, "No detect ('-')" },
699 { 0x02, "Erroneous SDUs are delivered ('yes')" },
700 { 0x03, "Erroneous SDUs are not delivered ('no')" },
701 { 0x07, "Reserved" }, /* All other values are reserved */
705 static const value_string qos_del_order[] = {
706 { 0x00, "Subscribed delivery order (in MS to network direction)" },
707 { 0x01, "With delivery order ('yes')" },
708 { 0x02, "Without delivery order ('no')" },
709 { 0x03, "Reserved" }, /* All other values are reserved */
713 static const value_string qos_traf_class[] = {
714 { 0x00, "Subscribed traffic class (in MS to network direction)" },
715 { 0x01, "Conversational class" },
716 { 0x02, "Streaming class" },
717 { 0x03, "Interactive class" },
718 { 0x04, "Background class" },
719 { 0x07, "Reserved" }, /* All other values are reserved */
723 static const value_string qos_max_sdu_size[] = {
724 { 0x00, "Subscribed maximum SDU size (in MS to network direction" },
725 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
726 { 0x97, "1502 octets" },
727 { 0x98, "1510 octets" },
728 { 0x99, "1520 octets" },
729 { 0, NULL } /* All other values are reserved */
732 static const value_string qos_max_ul[] = {
733 { 0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)" },
734 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
735 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
736 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
741 static const value_string qos_max_dl[] = {
742 { 0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)" },
743 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
744 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
745 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
750 static const value_string qos_res_ber[] = {
751 { 0x00, "Subscribed residual BER (in MS to network direction)" },
752 { 0x01, "1/20 = 5x10^-2" },
753 { 0x02, "1/100 = 1x10^-2" },
754 { 0x03, "1/200 = 5x10^-3" },
755 { 0x04, "1/250 = 4x10^-3" },
756 { 0x05, "1/1 000 = 1x10^-3" },
757 { 0x06, "1/10 000 = 1x10^-4" },
758 { 0x07, "1/100 000 = 1x10^-5" },
759 { 0x08, "1/1 000 000 = 1x10^-6" },
760 { 0x09, "3/50 000 000 = 6x10^-8" },
761 { 0x0F, "Reserved" }, /* All other values are reserved */
765 static const value_string qos_sdu_err_ratio[] = {
766 { 0x00, "Subscribed SDU error ratio (in MS to network direction)" },
767 { 0x01, "1/100 = 1x10^-2" },
768 { 0x02, "7/1000 = 7x10^-3" },
769 { 0x03, "1/1 000 = 1x10^-3" },
770 { 0x04, "1/10 000 = 1x10^-4" },
771 { 0x05, "1/100 000 = 1x10^-5" },
772 { 0x06, "1/1 000 000 = 1x10^-6" },
773 { 0x07, "1/10 = 1x10^-1" },
774 { 0x0F, "Reserved" }, /* All other values are reserved */
778 static const value_string qos_traf_handl_prio[] = {
779 { 0x00, "Subscribed traffic handling priority (in MS to network direction)" },
780 { 0x01, "Priority level 1" },
781 { 0x02, "Priority level 2" },
782 { 0x03, "Priority level 3" },
786 static const value_string qos_trans_delay[] = {
787 { 0x00, "Subscribed Transfer Delay (in MS to network direction)" },
788 { 0x01, "10 ms" }, /* Using a granularity of 10 ms */
803 { 0x10, "200 ms" }, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
819 { 0x20, "1000 ms" }, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
854 static const value_string qos_guar_ul[] = {
855 { 0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)" },
856 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
857 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
858 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
863 static const value_string qos_guar_dl[] = {
864 { 0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)" },
865 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
866 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
867 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
872 static const value_string sel_mode_type[] = {
873 { 0, "MS or network provided APN, subscribed verified" },
874 { 1, "MS provided APN, subscription not verified" },
875 { 2, "Network provided APN, subscription not verified" },
876 { 3, "For future use (Network provided APN, subscription not verified" },/* Shall not be sent. If received, shall be sent as value 2 */
880 static const value_string tr_comm_type[] = {
881 { 1, "Send data record packet" },
882 { 2, "Send possibly duplicated data record packet" },
883 { 3, "Cancel data record packet" },
884 { 4, "Release data record packet"},
888 /* TODO: CHeck if all ms_reasons are included */
889 static const value_string ms_not_reachable_type[] = {
890 { 0, "No paging response via the MSC" },
891 { 1, "IMSI detached" },
892 { 2, "Roaming restriction" },
893 { 3, "Deregistered in the HLR for non GPRS" },
894 { 4, "MS purge for non GPRS" },
895 { 5, "No paging response via the SGSN" },
896 { 6, "GPRS detached" },
897 { 7, "Deregistered in the HLR for non GPRS" },
898 { 8, "MS purged for GPRS" },
899 { 9, "Unidentified subscriber via the MSC" },
900 { 10, "Unidentified subscriber via the SGSN" },
904 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
906 static const value_string ranap_cause_type[] = {
907 /* Radio Network Layer Cause (1-->64) */
908 { 1, "RAB preempted" },
909 { 2, "Trelocoverall Expiry" },
910 { 3, "Trelocprep Expiry" },
911 { 4, "Treloccomplete Expiry" },
912 { 5, "Tqueing Expiry" },
913 { 6, "Relocation Triggered" },
914 { 7, "TRELOCalloc Expiry" },
915 { 8, "Unable to Estabish During Relocation" },
916 { 9, "Unknown Target RNC" },
917 { 10, "Relocation Cancelled" },
918 { 11, "Successful Relocation" },
919 { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported" },
920 { 13, "Change of Ciphering and/or Integrity Protection is not supported" },
921 { 14, "Failure in the Radio Interface Procedure" },
922 { 15, "Release due to UTRAN Generated Reason" },
923 { 16, "User Inactivity" },
924 { 17, "Time Critical Relocation" },
925 { 18, "Requested Traffic Class not Available" },
926 { 19, "Invalid RAB Parameters Value" },
927 { 20, "Requested Maximum Bit Rate not Available" },
928 { 21, "Requested Guaranteed Bit Rate not Available" },
929 { 22, "Requested Transfer Delay not Achievable" },
930 { 23, "Invalid RAB Parameters Combination" },
931 { 24, "Condition Violation for SDU Parameters" },
932 { 25, "Condition Violation for Traffic Handling Priority" },
933 { 26, "Condition Violation for Guaranteed Bit Rate" },
934 { 27, "User Plane Versions not Supported" },
935 { 28, "Iu UP Failure" },
936 { 29, "Relocation Failure in Target CN/RNC or Target System" },
937 { 30, "Invalid RAB ID" },
938 { 31, "No Remaining RAB" },
939 { 32, "Interaction with other procedure" },
940 { 33, "Requested Maximum Bit Rate for DL not Available" },
941 { 34, "Requested Maximum Bit Rate for UL not Available" },
942 { 35, "Requested Guaranteed Bit Rate for DL not Available" },
943 { 36, "Requested Guaranteed Bit Rate for UL not Available" },
944 { 37, "Repeated Integrity Checking Failure" },
945 { 38, "Requested Report Type not supported" },
946 { 39, "Request superseded" },
947 { 40, "Release due to UE generated signalling connection release" },
948 { 41, "Resource Optimisation Relocation" },
949 { 42, "Requested Information Not Available" },
950 { 43, "Relocation desirable for radio reasons" },
951 { 44, "Relocation not supported in Target RNC or Target System" },
952 { 45, "Directed Retry" },
953 { 46, "Radio Connection With UE Lost" },
954 /* Transport Layer Cause (65-->80) */
955 { 65, "Signalling Transport Resource Failure" },
956 { 66, "Iu Transport Connection Failed to Establish" },
957 /* NAS Cause (81-->96) */
958 { 81, "User Restriction Start Indication" },
959 { 82, "User Restriction End Indication" },
960 { 83, "Normal Release" },
961 /* Protocol Cause (97-->112) */
962 { 97, "Transfer Syntax Error" },
963 { 98, "Semantic Error" },
964 { 99, "Message not compatible with receiver state" },
965 { 100, "Abstract Syntax Error (Reject)" },
966 { 101, "Abstract Syntax Error (Ignore and Notify)" },
967 { 102, "Abstract Syntax Error (Falsely Constructed Message" },
968 /* Miscellaneous Cause (113-->128) */
969 { 113, "O & M Intervention" },
970 { 114, "No Resource Available" },
971 { 115, "Unspecified Failure" },
972 { 116, "Network Opimisation" },
973 /* Non-standard Cause (129-->255) */
977 static const value_string mm_sec_modep[] = {
978 { 0, "Used cipher value, UMTS keys and Quintuplets" },
979 { 1, "GSM key and triplets" },
980 { 2, "UMTS key and quintuplets" },
981 { 3, "GSM key and quintuplets" },
985 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
986 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
987 #define MM_PROTO_PDSS1 0x02
988 #define MM_PROTO_CALL_CONTROL 0x03
989 #define MM_PROTO_PDSS2 0x04
990 #define MM_PROTO_MM_NON_GPRS 0x05
991 #define MM_PROTO_RR_MGMT 0x06
992 #define MM_PROTO_MM_GPRS 0x08
993 #define MM_PROTO_SMS 0x09
994 #define MM_PROTO_SESSION_MGMT 0x0A
995 #define MM_PROTO_NON_CALL_RELATED 0x0B
997 static const value_string mm_proto_disc[] = {
998 { MM_PROTO_GROUP_CALL_CONTROL, "Group call control" },
999 { MM_PROTO_BROADCAST_CALL_CONTROL, "Broadcast call control" },
1000 { MM_PROTO_PDSS1, "PDSS1" },
1001 { MM_PROTO_CALL_CONTROL, "Call control; call related SS messages" },
1002 { MM_PROTO_PDSS2, "PDSS2" },
1003 { MM_PROTO_MM_NON_GPRS, "Mobility Management messages for non-GPRS services" },
1004 { MM_PROTO_RR_MGMT, "Radio Resource management messages" },
1005 { MM_PROTO_MM_GPRS, "Mobility Management messages for GPRS services" },
1006 { MM_PROTO_SMS, "SMS" },
1007 { MM_PROTO_SESSION_MGMT, "Session Management messages" },
1008 { MM_PROTO_NON_CALL_RELATED, "Non-call related SS messages" },
1012 static const value_string mm_rr_mess[] = {
1013 { 0x3C, "RR initialization request" },
1014 { 0x3B, "Additional assignment" },
1015 { 0x3F, "Immediate assignment" },
1016 { 0x39, "Immediate assignment extended" },
1017 { 0x3A, "Immediate assignment reject" },
1019 { 0x35, "Ciphering mode command" },
1020 { 0x32, "Ciphering mode complete" },
1022 { 0x30, "Configuration change command" },
1023 { 0x31, "Configuration change ack" },
1024 { 0x33, "Configuration change reject" },
1026 { 0x2E, "Assignment command" },
1027 { 0x29, "Assignment complete" },
1028 { 0x2F, "Assigment failure" },
1029 { 0x2B, "Handover command" },
1030 { 0x2C, "Handover complete" },
1031 { 0x28, "Handover failure" },
1032 { 0x2D, "Physical information" },
1034 { 0x08, "RR-cell change order" },
1035 { 0x23, "PDCH assignment command" },
1037 { 0x0D, "Channel release" },
1038 { 0x0A, "Partial release" },
1039 { 0x0F, "PArtial release complete" },
1041 { 0x21, "Paging request type 1" },
1042 { 0x22, "Paging request type 2" },
1043 { 0x24, "Paging request type 3" },
1044 { 0x27, "Paging response" },
1045 { 0x20, "Notification/NCH" },
1046 { 0x25, "Notification/FACCH" },
1047 { 0x26, "Reserved" },
1048 { 0x0B, "Reserved" },
1050 { 0x18, "System information type 8" },
1051 { 0x19, "System information type 1" },
1052 { 0x1A, "System information type 2" },
1053 { 0x1B, "System information type 3" },
1054 { 0x1C, "System information type 4" },
1055 { 0x1D, "System information type 5" },
1056 { 0x1E, "System information type 6" },
1057 { 0x1F, "System information type 7" },
1059 { 0x02, "System information type 2bis" },
1060 { 0x03, "System information type 2ter" },
1061 { 0x05, "System information type 5bis" },
1062 { 0x06, "System information type 5ter" },
1063 { 0x04, "System information 9" },
1064 { 0x00, "System information 13" },
1065 { 0x01, "System information 14" },
1067 { 0x3D, "System information type 16" },
1068 { 0x3E, "System information type 17" },
1070 { 0x10, "Channel mode modify" },
1071 { 0x12, "RR status" },
1072 { 0x17, "Channel mode modify ack" },
1073 { 0x14, "Frequency redefinition" },
1074 { 0x15, "Measurement report" },
1075 { 0x16, "Classmark change" },
1076 { 0x13, "Classmark enquiry" },
1077 { 0x36, "Extended measurement report" },
1078 { 0x37, "Extended measurement order" },
1079 { 0x34, "GPRS suspension request" },
1081 { 0x09, "VGCS uplink grant" },
1082 { 0x0E, "Uplink release" },
1083 { 0x0C, "Uplink free" },
1084 { 0x2A, "Uplink busy" },
1085 { 0x11, "Talker indication" },
1090 static const value_string mm_mm_mess[] = {
1091 { 0x01, "IMSI DETACH INDICATION" },
1092 { 0x02, "LOCATION UPDATING ACCEPT" },
1093 { 0x04, "LOCATION UPDATING REJECT" },
1094 { 0x08, "LOCATION UPDATING REQUEST" },
1095 { 0x11, "AUTHENTICATION REJECT" },
1096 { 0x12, "AUTHENTICATION REQUEST" },
1097 { 0x14, "AUTHENTICATION RESPONSE" },
1098 { 0x18, "IDENTITY REQUEST" },
1099 { 0x19, "IDENTITY RESPONSE" },
1100 { 0x1A, "TMSI REALLOCATION COMMAND" },
1101 { 0x1B, "TMSI REALLOCATION COMPLETE" },
1102 { 0x21, "CM SERVICE ACCEPT" },
1103 { 0x22, "CM SERVICE REJECT" },
1104 { 0x23, "CM SERVICE ABORT" },
1105 { 0x24, "CM SERVICE REQUEST" },
1106 { 0x25, "CM SERVICE PROMPT" },
1107 { 0x26, "NOTIFICATION RESPONSE" },
1108 { 0x28, "CM RE-ESTABLISHMENT REQUEST" },
1110 { 0x30, "MM NULL" },
1111 { 0x31, "MM STATUS" },
1112 { 0x32, "MM INFORMATION" },
1116 static const value_string mm_cc_mess[] = {
1117 { 0x00, "escape to nationally specific" },
1118 /*{ 0 x 0 0, "- - - Call establishment messages:" },*/
1119 { 0x01, "ALERTING" },
1120 { 0x08, "CALL CONFIRMED" },
1121 { 0x02, "CALL PROCEEDING" },
1122 { 0x07, "CONNECT" },
1123 { 0x0F, "CONNECT ACKNOWLEDGE" },
1124 { 0x0E, "EMERGENCY SETUP" },
1125 { 0x03, "PROGRESS" },
1126 { 0x04, "CC-ESTABLISHMENT" },
1127 { 0x06, "CC-ESTABLISHMENT CONFIRMED" },
1129 { 0x09, "START CC" },
1131 /*{ 0 x 0 1, "- - - Call information phase messages:" },*/
1133 { 0x1F, "MODIFY COMPLETE" },
1134 { 0x13, "MODIFY REJECT" },
1135 { 0x10, "USER INFORMATION" },
1137 { 0x19, "HOLD ACKNOWLEDGE" },
1138 { 0x1A, "HOLD REJECT" },
1139 { 0x1C, "RETRIEVE" },
1140 { 0x1D, "RETRIEVE ACKNOWLEDGE" },
1141 { 0x1E, "RETRIEVE REJECT" },
1142 /*{ 0 x 1 0, "- - - Call clearing messages:" },*/
1143 { 0x25, "DISCONNECT" },
1144 { 0x2D, "RELEASE" },
1145 { 0x2A, "RELEASE COMPLETE" },
1146 /*{ 0 x 1 1, "- - - Miscellaneous messages:" },*/
1147 { 0x39, "CONGESTION CONTROL" },
1150 { 0x34, "STATUS ENQUIRY" },
1151 { 0x35, "START DTMF" },
1152 { 0x31, "STOP DTMF" },
1153 { 0x32, "STOP DTMF ACKNOWLEDGE" },
1154 { 0x36, "START DTMF ACKNOWLEDGE" },
1155 { 0x37, "START DTMF REJECT" },
1156 { 0x3A, "FACILITY" },
1160 static const value_string mm_gprs_mess[] = {
1161 { 0x01, "Attach request" },
1162 { 0x02, "Attach accept" },
1163 { 0x03, "Attach complete" },
1164 { 0x04, "Attach reject" },
1165 { 0x05, "Detach request" },
1166 { 0x06, "Detach accept" },
1167 { 0x08, "Routing area update request" },
1168 { 0x09, "Routing area update accept" },
1169 { 0x0A, "Routing area update complete" },
1170 { 0x0B, "Routing area update reject" },
1171 { 0x10, "P-TMSI reallocation command" },
1172 { 0x11, "P-TMSI reallocation complete" },
1173 { 0x12, "Authentication and ciphering req" },
1174 { 0x13, "Authentication and ciphering resp" },
1175 { 0x14, "Authentication and ciphering rej" },
1176 { 0x15, "Identity request" },
1177 { 0x16, "Identity response" },
1178 { 0x20, "GMM status" },
1179 { 0x21, "GMM information" },
1183 static const value_string tft_code_type[] = {
1185 { 1, "Create new TFT" },
1186 { 2, "Delete existing TFT" },
1187 { 3, "Add packet filters to existing TFT" },
1188 { 4, "Replace packet filters in existing TFT" },
1189 { 5, "Delete packet filters from existing TFT" },
1196 static dissector_handle_t ip_handle;
1197 static dissector_handle_t ipv6_handle;
1198 static dissector_handle_t ppp_handle;
1199 static dissector_handle_t data_handle;
1200 static dissector_handle_t gtpcdr_handle;
1202 static int decode_gtp_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1203 static int decode_gtp_imsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1204 static int decode_gtp_rai (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1205 static int decode_gtp_tlli (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1206 static int decode_gtp_ptmsi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1207 static int decode_gtp_qos_gprs (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1208 static int decode_gtp_reorder (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1209 static int decode_gtp_auth_tri (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1210 static int decode_gtp_map_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1211 static int decode_gtp_ptmsi_sig (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1212 static int decode_gtp_ms_valid (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1213 static int decode_gtp_recovery (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1214 static int decode_gtp_sel_mode (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1215 static int decode_gtp_16 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1216 static int decode_gtp_17 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1217 static int decode_gtp_18 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1218 static int decode_gtp_19 (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1219 static int decode_gtp_nsapi (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1220 static int decode_gtp_ranap_cause (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1221 static int decode_gtp_rab_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1222 static int decode_gtp_rp_sms (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1223 static int decode_gtp_rp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1224 static int decode_gtp_pkt_flow_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1225 static int decode_gtp_chrg_char (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1226 static int decode_gtp_trace_ref (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1227 static int decode_gtp_trace_type (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1228 static int decode_gtp_ms_reason (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1229 static int decode_gtp_tr_comm (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1230 static int decode_gtp_chrg_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1231 static int decode_gtp_user_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1232 static int decode_gtp_mm_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1233 static int decode_gtp_pdp_cntxt (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1234 static int decode_gtp_apn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1235 static int decode_gtp_gsn_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1236 static int decode_gtp_proto_conf (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1237 static int decode_gtp_msisdn (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1238 static int decode_gtp_qos_umts (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1239 static int decode_gtp_auth_qui (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1240 static int decode_gtp_tft (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1241 static int decode_gtp_target_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1242 static int decode_gtp_utran_cont (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1243 static int decode_gtp_rab_setup (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1244 static int decode_gtp_hdr_list (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1245 static int decode_gtp_trigger_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1246 static int decode_gtp_omc_id (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1247 static int decode_gtp_chrg_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1248 static int decode_gtp_rel_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1249 static int decode_gtp_can_pack (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1250 static int decode_gtp_data_req (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1251 static int decode_gtp_data_resp (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1252 static int decode_gtp_node_addr (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1253 static int decode_gtp_priv_ext (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1254 static int decode_gtp_unknown (tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
1256 typedef struct _gtp_opt {
1258 int (*decode)(tvbuff_t *, int, packet_info *, proto_tree *);
1261 static const gtp_opt_t gtpopt[] = {
1262 { GTP_EXT_CAUSE, decode_gtp_cause },
1263 { GTP_EXT_IMSI, decode_gtp_imsi },
1264 { GTP_EXT_RAI, decode_gtp_rai },
1265 { GTP_EXT_TLLI, decode_gtp_tlli },
1266 { GTP_EXT_PTMSI, decode_gtp_ptmsi },
1267 { GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs },
1268 { GTP_EXT_REORDER, decode_gtp_reorder },
1269 { GTP_EXT_AUTH_TRI, decode_gtp_auth_tri },
1270 { GTP_EXT_MAP_CAUSE, decode_gtp_map_cause },
1271 { GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig },
1272 { GTP_EXT_MS_VALID, decode_gtp_ms_valid },
1273 { GTP_EXT_RECOVER, decode_gtp_recovery },
1274 { GTP_EXT_SEL_MODE, decode_gtp_sel_mode },
1275 { GTP_EXT_16, decode_gtp_16 },
1276 { GTP_EXT_17, decode_gtp_17 },
1277 { GTP_EXT_18, decode_gtp_18 },
1278 { GTP_EXT_19, decode_gtp_19 },
1279 { GTP_EXT_NSAPI, decode_gtp_nsapi },
1280 { GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause },
1281 { GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt },
1282 { GTP_EXT_RP_SMS, decode_gtp_rp_sms },
1283 { GTP_EXT_RP, decode_gtp_rp },
1284 { GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id },
1285 { GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char },
1286 { GTP_EXT_TRACE_REF, decode_gtp_trace_ref },
1287 { GTP_EXT_TRACE_TYPE, decode_gtp_trace_type },
1288 { GTPv1_EXT_MS_REASON, decode_gtp_ms_reason },
1289 { GTP_EXT_TR_COMM, decode_gtp_tr_comm },
1290 { GTP_EXT_CHRG_ID, decode_gtp_chrg_id },
1291 { GTP_EXT_USER_ADDR, decode_gtp_user_addr },
1292 { GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt },
1293 { GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt },
1294 { GTP_EXT_APN, decode_gtp_apn },
1295 { GTP_EXT_PROTO_CONF, decode_gtp_proto_conf },
1296 { GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr },
1297 { GTP_EXT_MSISDN, decode_gtp_msisdn },
1298 { GTP_EXT_QOS_UMTS, decode_gtp_qos_umts }, /* 3G */
1299 { GTP_EXT_AUTH_QUI, decode_gtp_auth_qui }, /* 3G */
1300 { GTP_EXT_TFT, decode_gtp_tft }, /* 3G */
1301 { GTP_EXT_TARGET_ID, decode_gtp_target_id }, /* 3G */
1302 { GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont }, /* 3G */
1303 { GTP_EXT_RAB_SETUP, decode_gtp_rab_setup }, /* 3G */
1304 { GTP_EXT_HDR_LIST, decode_gtp_hdr_list }, /* 3G */
1305 { GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id }, /* 3G */
1306 { GTP_EXT_OMC_ID, decode_gtp_omc_id }, /* 3G */
1307 { GTP_EXT_REL_PACK, decode_gtp_rel_pack }, /* charging */
1308 { GTP_EXT_CAN_PACK, decode_gtp_can_pack }, /* charging */
1309 { GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr },
1310 { GTP_EXT_DATA_REQ, decode_gtp_data_req }, /* charging */
1311 { GTP_EXT_DATA_RESP, decode_gtp_data_resp }, /* charging */
1312 { GTP_EXT_NODE_ADDR, decode_gtp_node_addr },
1313 { GTP_EXT_PRIV_EXT, decode_gtp_priv_ext },
1314 { 0, decode_gtp_unknown }
1323 static guint8 gtp_version = 0;
1324 static char *yesno[] = { "no", "yes" };
1327 col_append_str_gtp(column_info *cinfo, gint el, gchar *proto_name) {
1331 gchar _tmp[COL_MAX_LEN];
1333 max_len = COL_MAX_LEN;
1335 for (i = 0; i < cinfo->num_cols; i++) {
1336 if (cinfo->fmt_matx[i][el]) {
1337 if (cinfo->col_data[i] != cinfo->col_buf[i]) {
1339 strncpy(cinfo->col_buf[i], cinfo->col_data[i], max_len);
1340 cinfo->col_buf[i][max_len - 1] = '\0';
1344 strcat(_tmp, proto_name);
1346 strcat(_tmp, cinfo->col_buf[i]);
1348 cinfo->col_buf[i][0] = '\0';
1349 strcat(cinfo->col_buf[i], _tmp);
1350 cinfo->col_data[i] = cinfo->col_buf[i];
1356 id_to_str(const guint8 *ad) {
1358 static gchar str[17] = " ";
1359 guint8 bits8to5, bits4to1;
1361 static const gchar hex_digits[10] = "0123456789";
1363 for (i = 0; i < 8; i++) {
1364 bits8to5 = (ad[i] >> 4) & 0x0F;
1365 bits4to1 = ad[i] & 0x0F;
1367 str[j++] = hex_digits[bits4to1];
1369 str[j++] = hex_digits[bits8to5];
1376 imsi_to_str(const guint8 *ad) {
1378 static gchar str[17] = " ";
1381 for (i = 0; i < 8; i++) {
1382 if ((ad[i] & 0x0F) <= 9) str[j++] = (ad[i] & 0x0F) + 0x30;
1383 if (((ad[i] >> 4) & 0x0F) <= 9) str[j++] = ((ad[i] >> 4) & 0x0F) + 0x30;
1391 msisdn_to_str(const guint8 *ad, int len) {
1393 static gchar str[18] = "+ ";
1394 guint8 bits8to5, bits4to1;
1396 static const gchar hex_digits[10] = "0123456789";
1398 for (i = 1; i < len && i < 9; i++) {
1399 bits8to5 = (ad[i] >> 4) & 0x0F;
1400 bits4to1 = ad[i] & 0x0F;
1402 str[j++] = hex_digits[bits4to1];
1404 str[j++] = hex_digits[bits8to5];
1411 /* Next definitions and function check_field_presence checks if given field
1412 * in GTP packet is compliant with ETSI
1414 typedef struct _header {
1419 typedef struct _message {
1421 ext_header fields[32];
1424 /* ---------------------
1426 * ---------------------*/
1427 static _gtp_mess_items gprs_mess_items[] = {
1431 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1436 GTP_MSG_ECHO_RESP, {
1437 { GTP_EXT_RECOVER, GTP_MANDATORY },
1438 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1443 GTP_MSG_VER_NOT_SUPP, {
1448 GTP_MSG_NODE_ALIVE_REQ, {
1449 { GTP_EXT_NODE_ADDR, GTP_MANDATORY },
1450 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1455 GTP_MSG_NODE_ALIVE_RESP, {
1456 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1461 GTP_MSG_REDIR_REQ, {
1462 { GTP_EXT_CAUSE, GTP_MANDATORY },
1463 { GTP_EXT_NODE_ADDR, GTP_OPTIONAL },
1464 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1469 GTP_MSG_REDIR_RESP, {
1470 { GTP_EXT_CAUSE, GTP_MANDATORY },
1471 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1476 GTP_MSG_CREATE_PDP_REQ, {
1477 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1478 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1479 { GTP_EXT_SEL_MODE, GTP_MANDATORY },
1480 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1481 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1482 { GTP_EXT_MSISDN, GTP_MANDATORY },
1483 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1484 { GTP_EXT_APN, GTP_MANDATORY },
1485 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1486 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1487 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1488 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1493 GTP_MSG_CREATE_PDP_RESP, {
1494 { GTP_EXT_CAUSE, GTP_MANDATORY },
1495 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1496 { GTP_EXT_REORDER, GTP_CONDITIONAL },
1497 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1498 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1499 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1500 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1501 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1502 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1503 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1504 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1505 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1506 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1511 GTP_MSG_UPDATE_PDP_REQ, {
1512 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1513 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1514 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1515 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1516 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1517 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1518 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1523 GTP_MSG_UPDATE_PDP_RESP, {
1524 { GTP_EXT_CAUSE, GTP_MANDATORY },
1525 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1526 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1527 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1528 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1529 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1530 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1531 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1532 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1533 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1538 GTP_MSG_DELETE_PDP_REQ, {
1539 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1544 GTP_MSG_DELETE_PDP_RESP, {
1545 { GTP_EXT_CAUSE, GTP_MANDATORY },
1546 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1551 GTP_MSG_CREATE_AA_PDP_REQ, {
1552 { GTP_EXT_QOS_GPRS, GTP_MANDATORY },
1553 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1554 { GTP_EXT_SEL_MODE, GTP_MANDATORY },
1555 { GTP_EXT_FLOW_LABEL, GTP_MANDATORY },
1556 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1557 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1558 { GTP_EXT_APN, GTP_MANDATORY },
1559 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1560 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1561 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1562 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1567 GTP_MSG_CREATE_AA_PDP_RESP, {
1568 { GTP_EXT_CAUSE, GTP_MANDATORY },
1569 { GTP_EXT_QOS_GPRS, GTP_CONDITIONAL },
1570 { GTP_EXT_REORDER, GTP_CONDITIONAL },
1571 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1572 { GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL },
1573 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1574 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1575 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1576 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1577 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1578 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1579 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1580 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1585 GTP_MSG_DELETE_AA_PDP_REQ, {
1586 { GTP_EXT_CAUSE, GTP_MANDATORY },
1587 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1592 GTP_MSG_DELETE_AA_PDP_RESP, {
1593 { GTP_EXT_CAUSE, GTP_MANDATORY },
1594 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1600 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1605 GTP_MSG_PDU_NOTIFY_REQ, {
1606 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1607 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1612 GTP_MSG_PDU_NOTIFY_RESP, {
1613 { GTP_EXT_CAUSE, GTP_MANDATORY },
1614 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1619 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1620 { GTP_EXT_CAUSE, GTP_MANDATORY },
1621 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1622 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1627 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1628 { GTP_EXT_CAUSE, GTP_MANDATORY },
1629 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1634 GTP_MSG_SEND_ROUT_INFO_REQ, {
1635 { GTP_EXT_IMSI, GTP_MANDATORY },
1636 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1641 GTP_MSG_SEND_ROUT_INFO_RESP, {
1642 { GTP_EXT_CAUSE, GTP_MANDATORY },
1643 { GTP_EXT_IMSI, GTP_MANDATORY },
1644 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
1645 { GTP_EXT_MS_REASON, GTP_OPTIONAL },
1646 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL },
1647 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1652 GTP_MSG_FAIL_REP_REQ, {
1653 { GTP_EXT_IMSI, GTP_MANDATORY },
1654 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1659 GTP_MSG_FAIL_REP_RESP, {
1660 { GTP_EXT_CAUSE, GTP_MANDATORY },
1661 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
1662 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1667 GTP_MSG_MS_PRESENT_REQ, {
1668 { GTP_EXT_IMSI, GTP_MANDATORY },
1669 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1670 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1675 GTP_MSG_MS_PRESENT_RESP, {
1676 { GTP_EXT_CAUSE, GTP_MANDATORY },
1677 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1682 GTP_MSG_IDENT_REQ, {
1683 { GTP_EXT_RAI, GTP_MANDATORY },
1684 { GTP_EXT_PTMSI, GTP_MANDATORY },
1685 { GTP_EXT_PTMSI_SIG, GTP_OPTIONAL },
1686 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1691 GTP_MSG_IDENT_RESP, {
1692 { GTP_EXT_CAUSE, GTP_MANDATORY },
1693 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1694 { GTP_EXT_AUTH_TRI, GTP_OPTIONAL },
1695 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1700 GTP_MSG_SGSN_CNTXT_REQ, {
1701 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1702 { GTP_EXT_RAI, GTP_MANDATORY },
1703 { GTP_EXT_TLLI, GTP_MANDATORY },
1704 { GTP_EXT_PTMSI_SIG, GTP_OPTIONAL },
1705 { GTP_EXT_MS_VALID, GTP_OPTIONAL },
1706 { GTP_EXT_FLOW_SIG, GTP_MANDATORY },
1711 GTP_MSG_SGSN_CNTXT_RESP, {
1712 { GTP_EXT_CAUSE, GTP_MANDATORY },
1713 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1714 { GTP_EXT_FLOW_SIG, GTP_CONDITIONAL },
1715 { GTP_EXT_MM_CNTXT, GTP_CONDITIONAL },
1716 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
1717 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1722 GTP_MSG_SGSN_CNTXT_ACK, {
1723 { GTP_EXT_CAUSE, GTP_MANDATORY },
1724 { GTP_EXT_FLOW_II, GTP_CONDITIONAL },
1725 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1726 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1731 GTP_MSG_DATA_TRANSF_REQ, {
1732 { GTP_EXT_TR_COMM, GTP_MANDATORY },
1733 { GTP_EXT_DATA_REQ, GTP_CONDITIONAL },
1734 { GTP_EXT_REL_PACK, GTP_CONDITIONAL },
1735 { GTP_EXT_CAN_PACK, GTP_CONDITIONAL },
1736 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1741 GTP_MSG_DATA_TRANSF_RESP, {
1742 { GTP_EXT_CAUSE, GTP_MANDATORY },
1743 { GTP_EXT_DATA_RESP, GTP_MANDATORY },
1744 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1755 /* -----------------------------
1757 * -----------------------------*/
1758 static _gtp_mess_items umts_mess_items[] = {
1762 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1767 GTP_MSG_ECHO_RESP, {
1768 { GTP_EXT_RECOVER, GTP_MANDATORY },
1769 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1774 GTP_MSG_VER_NOT_SUPP, {
1779 GTP_MSG_NODE_ALIVE_REQ, {
1780 { GTP_EXT_NODE_ADDR, GTP_MANDATORY },
1781 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1786 GTP_MSG_NODE_ALIVE_RESP, {
1787 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1792 GTP_MSG_REDIR_REQ, {
1793 { GTP_EXT_CAUSE, GTP_MANDATORY },
1794 { GTP_EXT_NODE_ADDR, GTP_OPTIONAL },
1795 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1800 GTP_MSG_REDIR_REQ, {
1805 GTP_MSG_CREATE_PDP_REQ, {
1806 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1807 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1808 { GTP_EXT_SEL_MODE, GTP_CONDITIONAL },
1809 { GTP_EXT_TEID, GTP_MANDATORY },
1810 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
1811 { GTP_EXT_NSAPI, GTP_MANDATORY },
1812 { GTP_EXT_NSAPI, GTP_CONDITIONAL },
1813 { GTP_EXT_CHRG_CHAR, GTP_OPTIONAL },
1814 { GTP_EXT_TRACE_REF, GTP_OPTIONAL },
1815 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL },
1816 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1817 { GTP_EXT_APN, GTP_CONDITIONAL },
1818 { GTP_EXT_PROTO_CONF, GTP_CONDITIONAL },
1819 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1820 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1821 { GTP_EXT_MSISDN, GTP_CONDITIONAL },
1822 { GTP_EXT_QOS_UMTS, GTP_MANDATORY },
1823 { GTP_EXT_TFT, GTP_CONDITIONAL },
1824 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL },
1825 { GTP_EXT_OMC_ID, GTP_OPTIONAL },
1826 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1831 GTP_MSG_CREATE_PDP_RESP, {
1832 { GTP_EXT_CAUSE, GTP_MANDATORY },
1833 { GTP_EXT_REORDER, GTP_CONDITIONAL },
1834 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1835 { GTP_EXT_TEID, GTP_CONDITIONAL },
1836 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
1837 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1838 { GTP_EXT_USER_ADDR, GTP_CONDITIONAL },
1839 { GTP_EXT_PROTO_CONF, GTP_OPTIONAL },
1840 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1841 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1842 { GTP_EXT_QOS_UMTS, GTP_CONDITIONAL },
1843 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1844 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1848 { /* checked, SGSN -> GGSN */
1849 GTP_MSG_UPDATE_PDP_REQ, {
1850 { GTP_EXT_IMSI, GTP_CONDITIONAL },
1851 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1852 { GTP_EXT_TEID, GTP_MANDATORY },
1853 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
1854 { GTP_EXT_NSAPI, GTP_MANDATORY },
1855 { GTP_EXT_TRACE_REF, GTP_OPTIONAL },
1856 { GTP_EXT_TRACE_TYPE, GTP_OPTIONAL },
1857 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1858 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1859 { GTP_EXT_QOS_UMTS, GTP_MANDATORY },
1860 { GTP_EXT_TFT, GTP_OPTIONAL },
1861 { GTP_EXT_TRIGGER_ID, GTP_OPTIONAL },
1862 { GTP_EXT_OMC_ID, GTP_OPTIONAL },
1863 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1867 { /* checked, GGSN -> SGSN */
1868 GTP_MSG_UPDATE_PDP_RESP, {
1869 { GTP_EXT_CAUSE, GTP_MANDATORY },
1870 { GTP_EXT_RECOVER, GTP_OPTIONAL },
1871 { GTP_EXT_TEID, GTP_CONDITIONAL },
1872 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
1873 { GTP_EXT_CHRG_ID, GTP_CONDITIONAL },
1874 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1875 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
1876 { GTP_EXT_QOS_UMTS, GTP_CONDITIONAL },
1877 { GTP_EXT_CHRG_ADDR, GTP_OPTIONAL },
1878 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1883 GTP_MSG_DELETE_PDP_REQ, {
1884 { GTP_EXT_TEAR_IND, GTP_CONDITIONAL },
1885 { GTP_EXT_NSAPI, GTP_MANDATORY },
1886 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1891 GTP_MSG_DELETE_PDP_RESP, {
1892 { GTP_EXT_CAUSE, GTP_MANDATORY },
1893 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1899 { GTP_EXT_TEID, GTP_MANDATORY },
1900 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1905 GTP_MSG_PDU_NOTIFY_REQ, {
1906 { GTP_EXT_IMSI, GTP_MANDATORY },
1907 { GTP_EXT_TEID_CP, GTP_MANDATORY },
1908 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1909 { GTP_EXT_APN, GTP_MANDATORY },
1910 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1911 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1916 GTP_MSG_PDU_NOTIFY_RESP, {
1917 { GTP_EXT_CAUSE, GTP_MANDATORY },
1918 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1923 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
1924 { GTP_EXT_CAUSE, GTP_MANDATORY },
1925 { GTP_EXT_TEID_CP, GTP_MANDATORY },
1926 { GTP_EXT_USER_ADDR, GTP_MANDATORY },
1927 { GTP_EXT_APN, GTP_MANDATORY },
1928 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1933 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
1934 { GTP_EXT_CAUSE, GTP_MANDATORY },
1935 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1940 GTP_MSG_SUPP_EXT_HDR, {
1941 { GTP_EXT_HDR_LIST, GTP_MANDATORY },
1946 GTP_MSG_SEND_ROUT_INFO_REQ, {
1947 { GTP_EXT_IMSI, GTP_MANDATORY },
1948 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1953 GTP_MSG_SEND_ROUT_INFO_RESP, {
1954 { GTP_EXT_CAUSE, GTP_MANDATORY },
1955 { GTP_EXT_IMSI, GTP_MANDATORY },
1956 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
1957 { GTPv1_EXT_MS_REASON, GTP_OPTIONAL },
1958 { GTP_EXT_GSN_ADDR, GTP_OPTIONAL },
1959 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1964 GTP_MSG_FAIL_REP_REQ, {
1965 { GTP_EXT_IMSI, GTP_MANDATORY },
1966 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1971 GTP_MSG_FAIL_REP_RESP, {
1972 { GTP_EXT_CAUSE, GTP_MANDATORY },
1973 { GTP_EXT_MAP_CAUSE, GTP_OPTIONAL },
1974 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1979 GTP_MSG_MS_PRESENT_REQ, {
1980 { GTP_EXT_IMSI, GTP_MANDATORY },
1981 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
1982 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1987 GTP_MSG_MS_PRESENT_RESP, {
1988 { GTP_EXT_CAUSE, GTP_MANDATORY },
1989 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
1994 GTP_MSG_IDENT_REQ, {
1995 { GTP_EXT_RAI, GTP_MANDATORY },
1996 { GTP_EXT_PTMSI, GTP_MANDATORY },
1997 { GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL },
1998 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2003 GTP_MSG_IDENT_RESP, {
2004 { GTP_EXT_CAUSE, GTP_MANDATORY },
2005 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2006 { GTP_EXT_AUTH_TRI, GTP_CONDITIONAL },
2007 { GTP_EXT_AUTH_QUI, GTP_CONDITIONAL },
2008 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2013 GTP_MSG_SGSN_CNTXT_REQ, {
2014 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2015 { GTP_EXT_RAI, GTP_MANDATORY },
2016 { GTP_EXT_TLLI, GTP_CONDITIONAL },
2017 { GTP_EXT_PTMSI, GTP_CONDITIONAL },
2018 { GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL },
2019 { GTP_EXT_MS_VALID, GTP_OPTIONAL },
2020 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2021 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2022 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2027 GTP_MSG_SGSN_CNTXT_RESP, {
2028 { GTP_EXT_CAUSE, GTP_MANDATORY },
2029 { GTP_EXT_IMSI, GTP_CONDITIONAL },
2030 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2031 { GTP_EXT_RP_SMS, GTP_OPTIONAL },
2032 { GTP_EXT_RP, GTP_OPTIONAL },
2033 { GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL },
2034 { GTP_EXT_MM_CNTXT, GTP_CONDITIONAL },
2035 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
2036 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2037 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2042 GTP_MSG_SGSN_CNTXT_ACK, {
2043 { GTP_EXT_CAUSE, GTP_MANDATORY },
2044 { GTP_EXT_TEID_II, GTP_CONDITIONAL },
2045 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2046 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2051 GTP_MSG_FORW_RELOC_REQ, {
2052 { GTP_EXT_IMSI, GTP_MANDATORY },
2053 { GTP_EXT_TEID_CP, GTP_MANDATORY },
2054 { GTP_EXT_RANAP_CAUSE, GTP_MANDATORY },
2055 { GTP_EXT_MM_CNTXT, GTP_MANDATORY },
2056 { GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL },
2057 { GTP_EXT_GSN_ADDR, GTP_MANDATORY },
2058 { GTP_EXT_TARGET_ID, GTP_MANDATORY },
2059 { GTP_EXT_UTRAN_CONT, GTP_MANDATORY },
2060 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2065 GTP_MSG_FORW_RELOC_RESP, {
2066 { GTP_EXT_CAUSE, GTP_MANDATORY },
2067 { GTP_EXT_TEID_CP, GTP_CONDITIONAL },
2068 { GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL },
2069 { GTP_EXT_GSN_ADDR, GTP_CONDITIONAL },
2070 { GTP_EXT_UTRAN_CONT, GTP_OPTIONAL },
2071 { GTP_EXT_RAB_SETUP, GTP_CONDITIONAL },
2072 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2077 GTP_MSG_FORW_RELOC_COMP, {
2078 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2083 GTP_MSG_RELOC_CANCEL_REQ, {
2084 { GTP_EXT_IMSI, GTP_MANDATORY },
2085 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2090 GTP_MSG_RELOC_CANCEL_RESP, {
2091 { GTP_EXT_CAUSE, GTP_MANDATORY },
2092 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2097 GTP_MSG_FORW_RELOC_ACK, {
2098 { GTP_EXT_CAUSE, GTP_MANDATORY },
2099 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2104 GTP_MSG_FORW_SRNS_CNTXT, {
2105 { GTP_EXT_RAB_CNTXT, GTP_MANDATORY },
2106 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2111 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2112 { GTP_EXT_CAUSE, GTP_MANDATORY },
2113 { GTP_EXT_PRIV_EXT, GTP_OPTIONAL },
2125 check_field_presence(guint8 message, guint8 field, int *position) {
2128 _gtp_mess_items *mess_items;
2130 switch(gtp_version) {
2132 mess_items = gprs_mess_items;
2135 mess_items = umts_mess_items;
2141 while (mess_items[i].code) {
2142 if (mess_items[i].code == message) {
2144 while (mess_items[i].fields[*position].code) {
2145 if (mess_items[i].fields[*position].code == field) {
2149 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
2150 return mess_items[i].fields[(*position)++].code;
2163 /* Decoders of fields in extension headers, each function returns no of bytes from field */
2165 /* GPRS: 9.60 v7.6.0, chapter
2166 * UMTS: 29.060 v4.0, chapter
2169 decode_gtp_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2173 cause = tvb_get_guint8(tvb, offset+1);
2175 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
2180 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
2181 * UMTS: 29.060 v4.0, chapter 7.7.2
2184 decode_gtp_imsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2189 tvb_memcpy(tvb, imsi_val, offset+1, 8);
2190 imsi_str = imsi_to_str (imsi_val);
2192 proto_tree_add_string (tree, hf_gtp_imsi, tvb, offset, 9, imsi_str);
2197 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
2198 * UMTS: 29.060 v4.0, chapter 7.7.3
2201 decode_gtp_rai(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2203 proto_tree *ext_tree_rai;
2208 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_RAI, gtp_val, "Unknown message"));
2209 ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
2211 byte[1] = tvb_get_guint8 (tvb, offset + 1);
2212 byte[2] = tvb_get_guint8 (tvb, offset + 2);
2213 byte[3] = tvb_get_guint8 (tvb, offset + 3);
2214 mcc = (byte[1] & 0x0F) * 100 + ((byte[1] & 0xF0) >> 4) * 10 + (byte[2] & 0x0F );
2215 if ((byte[2] & 0xF0) == 0xF0)
2216 mnc = (byte[3] & 0x0F) * 10 + ((byte[3] & 0xF0) >> 4);
2218 mnc = (byte[3] & 0x0F) * 100 + ((byte[3] & 0xF0) >> 4 ) * 10 + ((byte[2] & 0xF0) >> 4);
2220 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mcc, tvb, offset+1, 2, mcc);
2221 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_mnc, tvb, offset+2, 2, mnc);
2222 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_lac, tvb, offset+4, 2, tvb_get_ntohs (tvb, offset+4));
2223 proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_rac, tvb, offset+6, 1, tvb_get_guint8 (tvb, offset+6));
2228 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
2229 * UMTS: 29.060 v4.0, chapter 7.7.4, page 47
2232 decode_gtp_tlli(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2236 tlli = tvb_get_ntohl(tvb, offset+1);
2237 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
2242 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
2243 * UMTS: 29.060 v4.0, chapter 7.7.5, page 47
2246 decode_gtp_ptmsi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2250 ptmsi = tvb_get_ntohl (tvb, offset+1);
2251 proto_tree_add_uint (tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
2256 /* adjust - how many bytes before offset should be highlighted
2259 decode_qos_gprs(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 adjust) {
2261 guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
2262 proto_tree *ext_tree_qos;
2265 spare1 = tvb_get_guint8(tvb, offset) & 0xC0;
2266 delay = tvb_get_guint8(tvb, offset) & 0x38;
2267 reliability = tvb_get_guint8(tvb, offset) & 0x07;
2268 peak = tvb_get_guint8(tvb, offset+1) & 0xF0;
2269 spare2 = tvb_get_guint8(tvb, offset+1) & 0x08;
2270 precedence = tvb_get_guint8(tvb, offset+1) & 0x07;
2271 spare3 = tvb_get_guint8(tvb, offset+2) & 0xE0;
2272 mean = tvb_get_guint8(tvb, offset+2) & 0x1F;
2274 te = proto_tree_add_text(tree, tvb, offset-adjust, 3+adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
2275 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
2276 ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
2279 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
2280 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
2281 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
2282 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset+1, 1, peak);
2283 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset+1, 1, spare2);
2284 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset+1, 1, precedence);
2285 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset+2, 1, spare3);
2286 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset+2, 1, mean);
2292 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
2296 * TODO: check if length is included: ETSI 4.08 vs 9.60
2299 decode_gtp_qos_gprs(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2301 return (1+decode_qos_gprs(tvb, offset+1, tree, "Quality of Service", 1));
2305 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
2306 * UMTS: 29.060 v4.0, chapter 7.7.6, page 47
2309 decode_gtp_reorder(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2313 reorder = tvb_get_guint8(tvb, offset+1) & 0x01;
2314 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
2319 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
2320 * 4.08 v7.1.2, chapter 10.5.3.1+
2321 * UMTS: 29.060 v4.0, chapter 7.7.7
2322 * TODO: Add blurb support by registering items in the protocol registration
2325 decode_gtp_auth_tri(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2327 proto_tree *ext_tree_auth_tri;
2330 te = proto_tree_add_text(tree, tvb, offset, 29, val_to_str(GTP_EXT_AUTH_TRI, gtp_val, "Unknown message"));
2331 ext_tree_auth_tri = proto_item_add_subtree(tree, ett_gtp_auth_tri);
2333 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+1, 16));
2334 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset+17, 4));
2335 proto_tree_add_text(ext_tree_auth_tri, tvb, offset+21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset+21, 8));
2340 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
2341 * 9.02 v7.7.0, page 1090
2342 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
2343 * 29.002 v4.2.1, chapter 17.5, page 268
2346 decode_gtp_map_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2350 map_cause = tvb_get_guint8(tvb, offset+1);
2351 proto_tree_add_uint (tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
2356 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
2357 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
2360 decode_gtp_ptmsi_sig(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2364 ptmsi_sig = tvb_get_ntoh24(tvb, offset+1);
2365 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
2370 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
2371 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
2374 decode_gtp_ms_valid(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2378 ms_valid = tvb_get_guint8(tvb, offset+1) & 0x01;
2379 proto_tree_add_boolean (tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
2384 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
2385 * UMTS: 29.060 v4.0, chapter 7.7.11, page 49
2388 decode_gtp_recovery(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2392 recovery = tvb_get_guint8(tvb, offset+1);
2393 proto_tree_add_uint (tree, hf_gtp_recovery, tvb, offset, 2, recovery);
2398 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
2399 * UMTS: 29.060 v4.0, chapter 7.7.12, page 49
2402 decode_gtp_sel_mode(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2406 sel_mode = tvb_get_guint8(tvb, offset+1) & 0x03;
2407 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, offset, 2, sel_mode);
2412 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
2413 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
2416 decode_gtp_16(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2418 guint16 ext_flow_label;
2421 switch (gtp_version) {
2423 ext_flow_label = tvb_get_ntohs(tvb, offset+1);
2424 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
2428 teid_data = tvb_get_ntohl(tvb, offset+1);
2429 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
2433 proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
2439 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
2440 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
2443 decode_gtp_17(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2448 switch (gtp_version) {
2450 flow_sig = tvb_get_ntohs(tvb, offset+1);
2451 proto_tree_add_uint (tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
2454 teid_cp = tvb_get_ntohl(tvb, offset+1);
2455 proto_tree_add_uint (tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
2458 proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
2463 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
2464 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
2467 decode_gtp_18(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2471 proto_tree *ext_tree_flow_ii;
2474 switch (gtp_version) {
2476 te = proto_tree_add_text(tree, tvb, offset, 4, val_to_str(GTP_EXT_FLOW_II, gtp_val, "Unknown message"));
2477 ext_tree_flow_ii = proto_item_add_subtree (te, ett_gtp_flow_ii);
2479 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2481 flow_ii = tvb_get_ntohs(tvb, offset+2);
2482 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset+2, 2, flow_ii);
2486 te = proto_tree_add_text (tree, tvb, offset, 6, val_to_str(GTP_EXT_TEID_II, gtp_val, "Unknown message"));
2487 ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
2489 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset+1, 1, tvb_get_guint8(tvb, offset+1) & 0x0F);
2492 teid_ii = tvb_get_ntohl(tvb, offset+2);
2493 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset+2, 4, teid_ii);
2497 proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
2503 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
2504 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
2505 * Check if all ms_reason types are included
2508 decode_gtp_19(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2512 field19 = tvb_get_guint8(tvb, offset+1);
2514 switch (gtp_version) {
2516 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
2519 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
2522 proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
2529 /* GPRS: not present
2530 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
2533 decode_gtp_nsapi(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2537 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2538 proto_tree_add_uint(tree, hf_gtp_nsapi, tvb, offset, 2, nsapi);
2543 /* GPRS: not present
2544 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
2547 decode_gtp_ranap_cause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2551 ranap = tvb_get_guint8(tvb, offset+1);
2553 if(ranap > 0 && ranap <=64)
2554 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
2555 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
2556 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
2557 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2559 if(ranap > 64 && ranap <=80)
2560 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
2561 ranap, "%s (Transport Layer Cause) : %s (%u)",
2562 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
2563 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2565 if(ranap > 80 && ranap <=96)
2566 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
2567 ranap, "%s (NAS Cause) : %s (%u)",
2568 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
2569 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2571 if(ranap > 96 && ranap <=112)
2572 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
2573 "%s (Protocol Cause) : %s (%u)",
2574 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
2575 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2577 if(ranap > 112 && ranap <=128)
2578 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
2579 "%s (Miscellaneous Cause) : %s (%u)",
2580 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
2581 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2583 if(ranap > 128 /* && ranap <=255 */)
2584 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
2585 "%s (Non-standard Cause) : %s (%u)",
2586 val_to_str(GTP_EXT_RANAP_CAUSE, gtp_val, "Unknown"),
2587 val_to_str(ranap, ranap_cause_type, "Unknown RANAP Cause"), ranap);
2592 /* GPRS: not present
2593 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
2596 decode_gtp_rab_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2598 guint8 nsapi, dl_pdcp_seq, ul_pdcp_seq;
2599 guint16 dl_gtpu_seq, ul_gtpu_seq;
2600 proto_tree *ext_tree_rab_cntxt;
2603 te = proto_tree_add_text(tree, tvb, offset, 8, val_to_str(GTP_EXT_RAB_CNTXT, gtp_val, "Unknown message"));
2604 ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
2606 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2607 dl_gtpu_seq = tvb_get_ntohs(tvb, offset+2);
2608 ul_gtpu_seq = tvb_get_ntohs(tvb, offset+4);
2609 dl_pdcp_seq = tvb_get_guint8(tvb, offset+6);
2610 ul_pdcp_seq = tvb_get_guint8(tvb, offset+7);
2612 proto_tree_add_uint (ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset+1, 1, nsapi);
2613 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset+2, 2, dl_gtpu_seq);
2614 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset+4, 2, ul_gtpu_seq);
2615 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset+6, 1, dl_pdcp_seq);
2616 proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset+7, 1, ul_pdcp_seq);
2622 /* GPRS: not present
2623 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
2626 decode_gtp_rp_sms(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2630 rp_sms = tvb_get_guint8(tvb, offset+1) & 0x07;
2631 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
2636 /* GPRS: not present
2637 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
2640 decode_gtp_rp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2642 proto_tree *ext_tree_rp;
2644 guint8 nsapi, rp, spare;
2646 nsapi = tvb_get_guint8(tvb, offset+1) & 0xF0;
2647 spare = tvb_get_guint8(tvb, offset+1) & 0x08;
2648 rp = tvb_get_guint8(tvb, offset+1) & 0x07;
2650 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
2651 ext_tree_rp = proto_item_add_subtree(tree, ett_gtp_rp);
2653 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset+1, 1, nsapi);
2654 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset+1, 1, spare);
2655 proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset+1, 1, rp);
2660 /* GPRS: not present
2661 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
2664 decode_gtp_pkt_flow_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2666 proto_tree *ext_tree_pkt_flow_id;
2668 guint8 nsapi, pkt_flow_id;
2670 nsapi = tvb_get_guint8(tvb, offset+1) & 0x0F;
2671 pkt_flow_id = tvb_get_guint8(tvb, offset+2);
2673 te = proto_tree_add_uint_format (tree, hf_gtp_pkt_flow_id, tvb, offset,
2674 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi,
2676 ext_tree_pkt_flow_id = proto_item_add_subtree(tree, ett_gtp_pkt_flow_id);
2678 proto_tree_add_uint(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset+1, 1, nsapi);
2679 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
2680 offset+2, 1, pkt_flow_id, "%s : %u",
2681 val_to_str(GTP_EXT_PKT_FLOW_ID, gtp_val, "Unknown message"),
2687 /* GPRS: not present
2688 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
2689 * TODO: Differenciate these uints?
2692 decode_gtp_chrg_char(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2696 proto_tree *ext_tree_chrg_char;
2698 chrg_char = tvb_get_ntohs(tvb, offset+1);
2700 te = proto_tree_add_uint (tree, hf_gtp_chrg_char, tvb, offset, 3, chrg_char);
2701 /*"%s: %x", val_to_str (GTP_EXT_CHRG_CHAR, gtp_val, "Unknown message"), chrg_char);*/
2702 ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_chrg_char);
2704 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_s, tvb, offset+1, 2, chrg_char);
2705 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_n, tvb, offset+1, 2, chrg_char);
2706 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_p, tvb, offset+1, 2, chrg_char);
2707 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_f, tvb, offset+1, 2, chrg_char);
2708 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_h, tvb, offset+1, 2, chrg_char);
2709 proto_tree_add_uint (ext_tree_chrg_char, hf_gtp_chrg_char_r, tvb, offset+1, 2, chrg_char);
2714 /* GPRS: not present
2715 * UMTS: 29.060 v4.0, chapter 7.7.24, page
2718 decode_gtp_trace_ref(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2722 trace_ref = tvb_get_ntohs(tvb, offset+1);
2724 proto_tree_add_uint (tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
2729 /* GPRS: not present
2730 * UMTS: 29.060 v4.0, chapter 7.7.25, page
2733 decode_gtp_trace_type(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2737 trace_type = tvb_get_ntohs(tvb, offset+1);
2739 proto_tree_add_uint (tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
2744 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
2745 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
2748 decode_gtp_ms_reason(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2752 reason = tvb_get_guint8(tvb, offset+1);
2754 proto_tree_add_uint (tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
2760 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
2764 decode_gtp_tr_comm(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2768 tr_command = tvb_get_guint8(tvb, offset+1);
2770 proto_tree_add_uint (tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
2775 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
2776 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
2779 decode_gtp_chrg_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2783 chrg_id = tvb_get_ntohl(tvb, offset+1);
2784 proto_tree_add_uint (tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
2789 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
2790 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
2793 decode_gtp_user_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2796 guint8 pdp_typ, pdp_org;
2798 struct e_in6_addr addr_ipv6;
2799 proto_tree *ext_tree_user;
2803 length = tvb_get_ntohs(tvb, offset+1);
2804 pdp_org = tvb_get_guint8(tvb, offset+3) & 0x0F;
2805 pdp_typ = tvb_get_guint8(tvb, offset+4);
2807 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s (%s/%s)",
2808 val_to_str(GTP_EXT_USER_ADDR, gtp_val, "Unknown message"),
2809 val_to_str(pdp_org, pdp_org_type, "Unknown PDP Organization"),
2810 val_to_str(pdp_typ, pdp_type, "Unknown PDP Type"));
2811 ext_tree_user = proto_item_add_subtree(te, ett_gtp_user);
2813 proto_tree_add_text(ext_tree_user, tvb, offset+1, 2, "Length : %u", length);
2814 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset+3, 1, pdp_org);
2815 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset+4, 1, pdp_typ);
2818 if (pdp_org == 0 && pdp_typ == 1)
2819 proto_item_append_text(te, " (Point to Point Protocol)");
2820 else if (pdp_typ == 2)
2821 proto_item_append_text(te, " (Octet Stream Protocol)");
2822 } else if (length > 2) {
2825 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+5, sizeof addr_ipv4);
2826 proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset+5, 4, addr_ipv4);
2827 proto_item_append_text(te, " : %s", ip_to_str((guint8 *)&addr_ipv4));
2830 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+5, sizeof addr_ipv6);
2831 proto_tree_add_ipv6 (ext_tree_user, hf_gtp_user_ipv6, tvb, offset+5, 16, (guint8 *)&addr_ipv6);
2832 proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
2836 proto_item_append_text(te, " : empty PDP Address");
2842 decode_triplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count) {
2844 proto_tree *ext_tree_trip;
2845 proto_item *te_trip;
2848 for (i=0;i<count;i++) {
2849 te_trip = proto_tree_add_text(tree, tvb, offset+i*28, 28, "Triplet no%x", i);
2850 ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
2852 proto_tree_add_text(ext_tree_trip, tvb, offset+i*28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+i*28, 16));
2853 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));
2854 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));
2860 /* adjust - how many bytes before quintuplet should be highlighted
2863 decode_quintuplet(tvbuff_t *tvb, int offset, proto_tree *tree, guint16 count, guint8 adjust) {
2865 proto_tree *ext_tree_quint;
2866 proto_item *te_quint;
2867 guint16 q_len, xres_len, auth_len, q_offset, i;
2871 for (i=0;i<count;i++) {
2873 offset = offset + q_offset;
2875 q_len = tvb_get_ntohs(tvb, offset);
2877 te_quint = proto_tree_add_text(tree, tvb, offset-adjust, q_len+adjust, "Quintuplet #%x", i);
2878 ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
2880 proto_tree_add_text(ext_tree_quint, tvb, offset, 2, "Length: %x", q_len);
2881 proto_tree_add_text(ext_tree_quint, tvb, offset+2, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset+2, 16));
2882 xres_len = tvb_get_ntohs(tvb, offset+18);
2883 proto_tree_add_text(ext_tree_quint, tvb, offset+18, 2, "XRES length: %u", xres_len);
2884 proto_tree_add_text(ext_tree_quint, tvb, offset+20, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset+20, xres_len));
2885 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));
2886 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));
2887 auth_len = tvb_get_ntohs(tvb, offset+52+xres_len);
2888 proto_tree_add_text(ext_tree_quint, tvb, offset+52+xres_len, 2, "Authentication length: %u", auth_len);
2889 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));
2891 q_offset = q_offset + q_len + 2;
2897 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
2898 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
2899 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
2900 * - finish displaying last 3 parameters
2903 decode_gtp_mm_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
2905 guint16 length, quint_len, net_cap, con_len;
2906 guint8 cksn, count, sec_mode, cipher, trans_id, proto_disc, message, drx_split, drx_len, drx_ccch, non_drx_timer;
2907 proto_tree *ext_tree_mm;
2910 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_MM_CNTXT, gtp_val, "Unknown message"));
2911 ext_tree_mm = proto_item_add_subtree(te, ett_gtp_mm);
2913 length = tvb_get_ntohs(tvb, offset+1);
2914 if (length < 1) return 3;
2916 cksn = tvb_get_guint8(tvb, offset+3) & 0x07;
2917 sec_mode = (tvb_get_guint8(tvb, offset+4) >> 6) & 0x03;
2918 count = (tvb_get_guint8(tvb, offset+4) >> 3) & 0x07;
2919 cipher = tvb_get_guint8(tvb, offset+4) & 0x07;
2921 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 2, "Length: %x", length);
2922 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Ciphering Key Sequence Number: %u", cksn);
2923 if (gtp_version != 0) {
2924 proto_tree_add_text(ext_tree_mm, tvb, offset+3, 1, "Security type: %u (%s)", sec_mode,
2925 val_to_str(sec_mode, mm_sec_modep, "Unknown"));
2930 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "No of triplets: %u", count);
2935 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
2937 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
2939 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset+5, 16));
2940 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key CK: %s", tvb_bytes_to_str(tvb, offset+21, 16));
2941 quint_len = tvb_get_ntohs(tvb, offset+37);
2942 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
2944 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
2950 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
2952 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
2954 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset+5, 8));
2956 offset = offset + decode_triplet(tvb, offset+13, ext_tree_mm, count) + 13;
2960 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset+5, 16));
2961 proto_tree_add_text(ext_tree_mm, tvb, offset+21, 16, "Integrity key CK: %s", tvb_bytes_to_str(tvb, offset+21, 16));
2962 quint_len = tvb_get_ntohs(tvb, offset+37);
2963 proto_tree_add_text(ext_tree_mm, tvb, offset+37, 2, "Quintuplets length: %x", quint_len);
2965 offset = offset + decode_quintuplet(tvb, offset+39, ext_tree_mm, count, 0) + 39;
2970 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: no ciphering");
2972 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 1, "Ciphering: GEA/%u", cipher);
2974 proto_tree_add_text(ext_tree_mm, tvb, offset+5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset+5, 8));
2975 quint_len = tvb_get_ntohs(tvb, offset+13);
2976 proto_tree_add_text(ext_tree_mm, tvb, offset+13, 2, "Quintuplets length: %x", quint_len);
2978 offset = offset + decode_quintuplet(tvb, offset+15, ext_tree_mm, count, 0) + 15;
2986 drx_split = tvb_get_guint8(tvb, offset);
2987 drx_len = (tvb_get_guint8(tvb, offset+1) >> 4) & 0x0F;
2988 drx_ccch = (tvb_get_guint8(tvb, offset+1) >> 3) & 0x01;
2989 non_drx_timer = tvb_get_guint8(tvb, offset+1) & 0x07;
2991 net_cap = tvb_get_ntohs(tvb, offset+2);
2992 con_len = tvb_get_ntohs(tvb, offset+4);
2994 proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "DRX: split PG cycle code: %u", drx_split);
2995 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: CN specific DRX cycle length coefficient: %u", drx_len);
2996 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: split PG cycle on CCCH supported by MS: %s", yesno[drx_ccch]);
2997 if (non_drx_timer == 0) {
2998 proto_tree_add_text(ext_tree_mm, tvb, offset+1, 1, "DRX: no non-DRX mode after transfer state");
3000 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);
3003 proto_tree_add_text(ext_tree_mm, tvb, offset+2, 2, "MS network capability: %u", net_cap);
3004 proto_tree_add_text(ext_tree_mm, tvb, offset+4, 2, "Container length: %u", con_len);
3007 trans_id = (tvb_get_guint8(tvb, offset+6) >> 4) & 0x0F;
3008 proto_tree_add_text(ext_tree_mm, tvb, offset+6, 1, "Transaction identifier: 0x%x", trans_id);
3009 proto_disc = tvb_get_guint8(tvb, offset+6) & 0x0F;
3010 proto_tree_add_text(ext_tree_mm, tvb, offset+6, 1, "Protocol discriminator: 0x%x (%s)", proto_disc,
3011 val_to_str(proto_disc, mm_proto_disc, "Unknown"));
3012 message = tvb_get_guint8(tvb, offset+7);
3015 case MM_PROTO_RR_MGMT:
3016 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3017 val_to_str(message, mm_rr_mess, "Unknown"));
3020 case MM_PROTO_MM_NON_GPRS:
3021 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3022 val_to_str(message, mm_mm_mess, "Unknown"));
3025 case MM_PROTO_CALL_CONTROL:
3026 case MM_PROTO_GROUP_CALL_CONTROL:
3027 case MM_PROTO_BROADCAST_CALL_CONTROL:
3028 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3029 val_to_str(message, mm_cc_mess, "Unknown"));
3032 case MM_PROTO_MM_GPRS:
3033 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x (%s)", message,
3034 val_to_str(message, mm_gprs_mess, "Unknown"));
3038 proto_tree_add_text(ext_tree_mm, tvb, offset+7, 1, "Message type: 0x%02x", message);
3041 /* XXX - dissect additional IEs from GSM L3 message */
3047 /* Function to extract the value of an hexadecimal octet. Only the lower
3048 * nybble will be non-zero in the output.
3050 static guint8 hex2dec (guint8 x)
3052 if ((x >= 'a') && (x <= 'f'))
3054 else if ((x >= 'A') && (x <= 'F'))
3056 else if ((x >= '0') && (x <= '9'))
3063 /* Wrapper function to add UTF-8 decoding for QoS attributes in
3066 static guint8 wrapped_tvb_get_guint8( tvbuff_t *tvb, int offset, int type)
3069 return (hex2dec(tvb_get_guint8(tvb, offset)) << 4
3070 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
3072 return tvb_get_guint8(tvb, offset);
3075 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
3076 * so type means length of length :-)
3078 * WARNING :) type does not mean length of length any more... see below for
3082 decode_qos_umts(tvbuff_t *tvb, int offset, proto_tree *tree, gchar* qos_str, guint8 type) {
3085 guint8 al_ret_priority;
3086 guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
3087 guint8 traf_class, del_order, del_err_sdu;
3088 guint8 max_sdu_size, max_ul, max_dl;
3089 guint8 res_ber, sdu_err_ratio;
3090 guint8 trans_delay, traf_handl_prio;
3091 guint8 guar_ul, guar_dl;
3092 proto_tree *ext_tree_qos;
3094 int mss, mu, md, gu, gd;
3096 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
3097 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
3098 * to one byte to be dissected).
3099 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
3100 * corresponds to one byte to be dissected)
3102 guint8 utf8_type = 1;
3104 /* In RADIUS messages the QoS has a version field of two octets prepended.
3105 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
3106 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
3107 * inconsistent and unuseful, I will check hyphen presence here and
3108 * will signal its presence.
3110 guint8 version_buffer[2];
3113 /* Will keep the value that will be returned
3119 length = tvb_get_guint8 (tvb, offset);
3120 te = proto_tree_add_text (tree, tvb, offset, length + 1, "%s", qos_str);
3121 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3122 proto_tree_add_text (ext_tree_qos, tvb, offset, 1, "Length: %u", length);
3124 retval = length + 1;
3127 length = tvb_get_ntohs (tvb, offset + 1);
3128 te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
3129 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3130 proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
3131 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
3132 retval = length + 3;
3135 /* For QoS inside RADIUS Client messages from GGSN */
3138 /* The field in the RADIUS message starts one byte before :) */
3139 length = tvb_get_guint8 (tvb, offset);
3140 te = proto_tree_add_text (tree, tvb, offset - 1, length, "%s", qos_str);
3142 ext_tree_qos = proto_item_add_subtree (te, ett_gtp_qos);
3143 version_buffer[0] = tvb_get_guint8(tvb, offset + 1);
3144 version_buffer[1] = tvb_get_guint8(tvb, offset + 2);
3145 proto_tree_add_text (ext_tree_qos, tvb, offset + 1, 2, "Version: %c%c", version_buffer[0], version_buffer[1]);
3147 /* Hyphen handling */
3148 hyphen = tvb_get_guint8(tvb, offset + 3);
3149 if (hyphen == ((guint8) '-'))
3151 /* Hyphen is present, put in protocol tree */
3152 proto_tree_add_text (ext_tree_qos, tvb, offset + 3, 1, "Hyphen separator: -");
3153 offset++; /* "Get rid" of hyphen */
3156 /* Now, we modify offset here and in order to use type later
3159 retval = length + 3; /* Actually, will be ignored. */
3162 /* XXX - what should we do with the length here? */
3165 ext_tree_qos = NULL;
3169 /* In RADIUS messages there is no allocation-retention priority
3170 * so I don't need to wrap the following call to tvb_get_guint8
3172 al_ret_priority = tvb_get_guint8 (tvb, offset);
3174 /* All calls are wrapped to take into account the possibility that the
3175 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
3176 * of the offset will be the same as in the previous version of this
3177 * dissector, and the wrapped function will serve as a dumb wrapper;
3178 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
3179 * two bytes for needed shift, and the wrapped function will unencode
3180 * two values from the input.
3182 spare1 = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0xC0;
3183 delay = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x38;
3184 reliability = wrapped_tvb_get_guint8(tvb, offset+(1 - 1) * utf8_type + 1, utf8_type) & 0x07;
3185 peak = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3186 spare2 = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x08;
3187 precedence = wrapped_tvb_get_guint8(tvb, offset+(2 - 1) * utf8_type + 1, utf8_type) & 0x07;
3188 spare3 = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3189 mean = wrapped_tvb_get_guint8(tvb, offset+(3 - 1) * utf8_type + 1, utf8_type) & 0x1F;
3191 /* In RADIUS messages there is no allocation-retention priority */
3193 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
3195 /* All additions must take care of the fact that QoS fields in RADIUS
3196 * messages are UTF-8 encoded, so we have to use the same trick as above.
3198 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, spare1);
3199 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, delay);
3200 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset+(1 - 1) * utf8_type + 1, utf8_type, reliability);
3201 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, peak);
3202 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, spare2);
3203 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset+(2 - 1) * utf8_type + 1, utf8_type, precedence);
3204 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, spare3);
3205 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset+(3 - 1) * utf8_type + 1, utf8_type, mean);
3209 /* See above for the need of wrapping
3211 traf_class = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0xE0;
3212 del_order = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x18;
3213 del_err_sdu = wrapped_tvb_get_guint8(tvb, offset+(4 - 1) * utf8_type + 1, utf8_type) & 0x07;
3214 max_sdu_size = wrapped_tvb_get_guint8(tvb, offset+(5 - 1) * utf8_type + 1, utf8_type);
3215 max_ul = wrapped_tvb_get_guint8(tvb, offset+(6 - 1) * utf8_type + 1, utf8_type);
3216 max_dl = wrapped_tvb_get_guint8(tvb, offset+(7 - 1) * utf8_type + 1, utf8_type);
3217 res_ber = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0xF0;
3218 sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset+(8 - 1) * utf8_type + 1, utf8_type) & 0x0F;
3219 trans_delay = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0xFC;
3220 traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset+(9 - 1) * utf8_type + 1, utf8_type) & 0x03;
3221 guar_ul = wrapped_tvb_get_guint8(tvb, offset+(10 - 1) * utf8_type + 1, utf8_type);
3222 guar_dl = wrapped_tvb_get_guint8(tvb, offset+(11 - 1) * utf8_type + 1, utf8_type);
3224 /* See above comments for the changes
3226 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, traf_class);
3227 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, del_order);
3228 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_err_sdu, tvb, offset+(4 - 1) * utf8_type + 1, utf8_type, del_err_sdu);
3229 if (max_sdu_size == 0 || max_sdu_size > 150)
3230 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset+(5 - 1) * utf8_type + 1, utf8_type, max_sdu_size);
3231 if (max_sdu_size > 0 && max_sdu_size <= 150) {
3232 mss = max_sdu_size*10;
3233 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset+(5 - 1) * utf8_type + 1, utf8_type, mss, "Maximum SDU size : %u octets", mss);
3236 if(max_ul == 0 || max_ul == 255)
3237 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul);
3238 if(max_ul > 0 && max_ul <= 63)
3239 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, max_ul, "Maximum bit rate for uplink : %u kbps", max_ul);
3240 if(max_ul > 63 && max_ul <=127) {
3241 mu = 64 + ( max_ul - 64 ) * 8;
3242 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
3245 if(max_ul > 127 && max_ul <=254) {
3246 mu = 576 + ( max_ul - 128 ) * 64;
3247 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset+(6 - 1) * utf8_type + 1, utf8_type, mu, "Maximum bit rate for uplink : %u kbps", mu);
3250 if(max_dl == 0 || max_dl == 255)
3251 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl);
3252 if(max_dl > 0 && max_dl <= 63)
3253 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, max_dl, "Maximum bit rate for downlink : %u kbps", max_dl);
3254 if(max_dl > 63 && max_dl <=127) {
3255 md = 64 + ( max_dl - 64 ) * 8;
3256 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
3258 if(max_dl > 127 && max_dl <=254) {
3259 md = 576 + ( max_dl - 128 ) * 64;
3260 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset+(7 - 1) * utf8_type + 1, utf8_type, md, "Maximum bit rate for downlink : %u kbps", md);
3263 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset+(8 - 1) * utf8_type + 1, utf8_type, res_ber);
3264 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_sdu_err_ratio, tvb, offset+(8 - 1) * utf8_type + 1, utf8_type, sdu_err_ratio);
3265 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset+(9 - 1) * utf8_type + 1, utf8_type, trans_delay);
3266 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_handl_prio, tvb, offset+(9 - 1) * utf8_type + 1, utf8_type, traf_handl_prio);
3268 if(guar_ul == 0 || guar_ul == 255)
3269 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul);
3270 if(guar_ul > 0 && guar_ul <= 63)
3271 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, guar_ul, "Guaranteed bit rate for uplink : %u kbps", guar_ul);
3272 if(guar_ul > 63 && guar_ul <=127) {
3273 gu = 64 + ( guar_ul - 64 ) * 8;
3274 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3276 if(guar_ul > 127 && guar_ul <=254) {
3277 gu = 576 + ( guar_ul - 128 ) * 64;
3278 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset+(10 - 1) * utf8_type + 1, utf8_type, gu, "Guaranteed bit rate for uplink : %u kbps", gu);
3281 if(guar_dl == 0 || guar_dl == 255)
3282 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl);
3283 if(guar_dl > 0 && guar_dl <= 63)
3284 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, guar_dl, "Guaranteed bit rate for downlink : %u kbps", guar_dl);
3285 if(guar_dl > 63 && guar_dl <=127) {
3286 gd = 64 + ( guar_dl - 64 ) * 8;
3287 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3289 if(guar_dl > 127 && guar_dl <=254) {
3290 gd = 576 + ( guar_dl - 128 ) * 64;
3291 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset+(11 - 1) * utf8_type + 1, utf8_type, gd, "Guaranteed bit rate for downlink : %u kbps", gd);
3300 decode_apn(tvbuff_t *tvb, int offset, guint16 length, proto_tree *tree) {
3303 guint8 name_len, tmp;
3306 name_len = tvb_get_guint8 (tvb, offset);
3308 if (name_len < 0x20) {
3309 apn = tvb_get_string(tvb, offset + 1, length - 1);
3311 if (name_len >= length - 1) break;
3313 name_len = name_len + apn[tmp] + 1;
3317 apn = tvb_get_string(tvb, offset, length);
3319 proto_tree_add_string (tree, hf_gtp_apn, tvb, offset, length, apn);
3324 /* GPRS: 9.60 v7.6.0, chapter 7.9.20
3325 * UMTS: 29.060 v4.0, chapter 7.7.29
3326 * TODO: unify addr functions
3329 decode_gtp_pdp_cntxt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3331 guint8 ggsn_addr_len, apn_len, trans_id, vaa, order, nsapi, sapi, pdu_send_no, pdu_rec_no, pdp_cntxt_id,
3332 pdp_type_org, pdp_type_num, pdp_addr_len;
3333 guint16 length, sn_down, sn_up, up_flow;
3334 guint32 addr_ipv4, up_teid, up_teid_cp;
3335 struct e_in6_addr addr_ipv6;
3336 proto_tree *ext_tree_pdp;
3339 length = tvb_get_ntohs(tvb, offset+1);
3341 te = proto_tree_add_text(tree, tvb, offset, length+3, val_to_str(GTP_EXT_PDP_CNTXT, gtp_val, "Unknown message"));
3342 ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_pdp);
3344 vaa = (tvb_get_guint8(tvb, offset+3) >> 6) & 0x01;
3345 order = (tvb_get_guint8(tvb, offset+3) >> 4) & 0x01;
3346 nsapi = tvb_get_guint8(tvb, offset+3) & 0x0F;
3347 sapi = tvb_get_guint8(tvb, offset+4) & 0x0F;
3349 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "VPLMN address allowed: %s", yesno[vaa]);
3350 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "Reordering required: %s", yesno[order]);
3351 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 1, "NSAPI: %u", nsapi);
3352 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "SAPI: %u", sapi);
3354 switch (gtp_version) {
3356 decode_qos_gprs(tvb, offset+5, ext_tree_pdp, "QoS subscribed", 0);
3357 decode_qos_gprs(tvb, offset+8, ext_tree_pdp, "QoS requested", 0);
3358 decode_qos_gprs(tvb, offset+11, ext_tree_pdp, "QoS negotiated", 0);
3359 offset = offset + 14;
3362 offset = offset + 5;
3363 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
3364 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
3365 offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
3371 sn_down = tvb_get_ntohs(tvb, offset);
3372 sn_up = tvb_get_ntohs(tvb, offset+2);
3373 pdu_send_no = tvb_get_guint8(tvb, offset+4);
3374 pdu_rec_no = tvb_get_guint8(tvb, offset+5);
3376 proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
3377 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 2, "Sequence number up: %u", sn_up);
3378 proto_tree_add_text(ext_tree_pdp, tvb, offset+4, 1, "Send N-PDU number: %u", pdu_send_no);
3379 proto_tree_add_text(ext_tree_pdp, tvb, offset+5, 1, "Receive N-PDU number: %u", pdu_rec_no);
3381 switch (gtp_version) {
3383 up_flow = tvb_get_ntohs(tvb, offset+6);
3384 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 2, "Uplink flow label signalling: %u", up_flow);
3385 offset = offset + 8;
3388 up_teid = tvb_get_ntohl(tvb, offset+6);
3389 up_teid_cp = tvb_get_ntohl(tvb, offset+10);
3390 pdp_cntxt_id = tvb_get_guint8(tvb, offset+14);
3391 proto_tree_add_text(ext_tree_pdp, tvb, offset+6, 4, "Uplink TEID: %x", up_teid);
3392 proto_tree_add_text(ext_tree_pdp, tvb, offset+10, 4, "Uplink TEID control plane: %x", up_teid_cp);
3393 proto_tree_add_text(ext_tree_pdp, tvb, offset+14, 1, "PDP context identifier: %u", pdp_cntxt_id);
3394 offset = offset + 15;
3400 pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
3401 pdp_type_num = tvb_get_guint8(tvb, offset+1);
3402 pdp_addr_len = tvb_get_guint8(tvb, offset+2);
3404 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str(pdp_type_org, pdp_type, "Unknown PDP org"));
3405 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"));
3406 proto_tree_add_text(ext_tree_pdp, tvb, offset+2, 1, "PDP address length: %u", pdp_addr_len);
3408 if (pdp_addr_len > 0) {
3409 switch (pdp_type_num) {
3411 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3412 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 4, "PDP address: %s", ip_to_str((guint8 *)&addr_ipv4));
3415 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3416 proto_tree_add_text(ext_tree_pdp, tvb, offset+3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3423 offset = offset + 3 + pdp_addr_len;
3425 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3426 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
3428 switch (ggsn_addr_len) {
3430 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3431 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN address: %s", ip_to_str((guint8 *)&addr_ipv4));
3434 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3435 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3441 offset = offset + 1 + ggsn_addr_len;
3443 if (gtp_version == 1) {
3445 ggsn_addr_len = tvb_get_guint8(tvb, offset);
3446 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
3448 switch (ggsn_addr_len) {
3450 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+1, sizeof addr_ipv4);
3451 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *)&addr_ipv4));
3454 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+1, sizeof addr_ipv6);
3455 proto_tree_add_text(ext_tree_pdp, tvb, offset+1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3460 offset = offset + 1 + ggsn_addr_len;
3464 apn_len = tvb_get_guint8(tvb, offset);
3465 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
3466 decode_apn(tvb, offset+1, apn_len, ext_tree_pdp);
3468 offset = offset + 1 + apn_len;
3470 trans_id = tvb_get_guint8(tvb, offset);
3471 proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "Transaction identifier: %u", trans_id);
3476 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
3477 * UMTS: 29.060, v4.0, chapter 7.7.30
3480 decode_gtp_apn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3483 proto_tree *ext_tree_apn;
3486 length = tvb_get_ntohs(tvb, offset+1);
3488 te = proto_tree_add_text (tree, tvb, offset, length+3, val_to_str(GTP_EXT_APN, gtp_val, "Unknown field"));
3489 ext_tree_apn = proto_item_add_subtree(te, ett_gtp_apn);
3491 proto_tree_add_text (ext_tree_apn, tvb, offset+1, 2, "APN length : %u", length);
3492 decode_apn (tvb, offset+3, length, ext_tree_apn);
3497 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
3498 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
3499 * UMTS: 29.060 v4.0, chapter 7.7.31
3500 * 24.008, v4.2, chapter 10.5.6.3
3503 decode_gtp_proto_conf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) {
3505 guint16 length, proto_offset;
3507 guint8 conf, proto_len, cnt = 1;
3509 proto_tree *ext_tree_proto;
3511 gboolean save_writable;
3513 length = tvb_get_ntohs(tvb, offset + 1);
3515 te = proto_tree_add_text(tree, tvb, offset, length + 3, val_to_str(GTP_EXT_PROTO_CONF, gtp_val, "Unknown message"));
3516 ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
3518 proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
3520 if (length < 1) return 3;
3522 conf = tvb_get_guint8 (tvb, offset + 3) & 0x07;
3523 proto_tree_add_text (ext_tree_proto, tvb, offset + 3, 1, "Configuration protocol (00000xxx): %u", conf);
3525 proto_offset = 1; /* ... 1st byte is conf */
3529 if (proto_offset >= length) break;
3530 proto_id = tvb_get_ntohs (tvb, offset);
3531 proto_len = tvb_get_guint8 (tvb, offset + 2);
3532 proto_offset += proto_len + 3; /* 3 = proto id + length byte */
3534 if (proto_len > 0) {
3536 proto_tree_add_text (ext_tree_proto, tvb, offset, 2, "Protocol %u ID: %s (0x%04x)",
3537 cnt, val_to_str(proto_id, ppp_vals, "Unknown"),
3539 proto_tree_add_text (ext_tree_proto, tvb, offset+2, 1, "Protocol %u length: %u", cnt, proto_len);
3542 * Don't allow the dissector for the configuration
3543 * protocol in question to update the columns - this
3546 save_writable = col_get_writable(pinfo->cinfo);
3547 col_set_writable(pinfo->cinfo, FALSE);
3550 * XXX - should we have our own dissector table,
3551 * solely for configuration protocols, so that bogus
3552 * values don't cause us to dissect the protocol
3553 * data as, for example, IP?
3555 next_tvb = tvb_new_subset (tvb, offset + 3, proto_len, proto_len);
3556 if (!dissector_try_port(ppp_subdissector_table,
3557 proto_id, next_tvb, pinfo, ext_tree_proto)) {
3558 call_dissector(data_handle, next_tvb, pinfo,
3562 col_set_writable(pinfo->cinfo, save_writable);
3565 offset += proto_len + 3;
3572 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
3573 * UMTS: 29.060 v4.0, chapter 7.7.32
3576 decode_gtp_gsn_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3578 guint8 addr_type, addr_len;
3581 struct e_in6_addr addr_ipv6;
3582 proto_tree *ext_tree_gsn_addr;
3585 length = tvb_get_ntohs(tvb, offset+1);
3587 te = proto_tree_add_text(tree, tvb, offset, 3+length, "GSN address : ");
3588 ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
3592 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3593 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3594 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3595 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset+3, 4, addr_ipv4);
3598 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3599 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3600 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset+3, 1, addr_type);
3601 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3602 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset+3, 1, addr_len);
3603 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+4, sizeof addr_ipv4);
3604 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3605 proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset+4, 4, addr_ipv4);
3608 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address length : %u", length);
3609 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3610 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3611 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
3614 proto_tree_add_text(ext_tree_gsn_addr, tvb, offset+1, 2, "GSN address Information Element length : %u", length);
3615 addr_type = tvb_get_guint8(tvb, offset+3) & 0xC0;
3616 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset+3, 1, addr_type);
3617 addr_len = tvb_get_guint8(tvb, offset+3) & 0x3F;
3618 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset+3, 1, addr_len);
3619 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+4, sizeof addr_ipv6);
3620 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3621 proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset+4, 16, (guint8*)&addr_ipv6);
3624 proto_item_append_text(te, "unknown type or wrong length");
3631 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
3632 * UMTS: 29.060 v4.0, chapter 7.7.33
3635 decode_gtp_msisdn(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3637 const guint8 *msisdn_val;
3641 length = tvb_get_ntohs(tvb, offset+1);
3643 if (length < 1) return 3;
3645 msisdn_val = tvb_get_ptr(tvb, offset+3, length);
3646 msisdn_str = msisdn_to_str(msisdn_val, length);
3648 proto_tree_add_string(tree, hf_gtp_msisdn, tvb, offset, 3+length, msisdn_str);
3653 /* GPRS: not present
3654 * UMTS: 29.060 v4.0, chapter 7.7.34
3655 * 24.008 v4.2, chapter 10.5.6.5
3658 decode_gtp_qos_umts(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3660 return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
3663 /* GPRS: not present
3664 * UMTS: 29.060 v4.0, chapter 7.7.35
3667 decode_gtp_auth_qui(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3669 return (1 + decode_quintuplet(tvb, offset+1, tree, 1, 1));
3673 /* GPRS: not present
3674 * UMTS: 29.060 v4.0, chapter 7.7.36
3675 * 24.008 v4.2, chapter 10.5.6.12
3678 decode_gtp_tft(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3680 guint16 length, port1, port2, tos;
3681 guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto, spare;
3683 guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
3684 struct e_in6_addr addr_ipv6, mask_ipv6;
3685 proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
3686 proto_item *te, *tee, *tef;
3688 length = tvb_get_ntohs(tvb, offset+1);
3690 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Traffic flow template");
3691 ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
3693 tft_flags = tvb_get_guint8(tvb, offset+3);
3694 tft_code = (tft_flags >> 5) & 0x07;
3695 spare = (tft_flags >> 4) & 0x01;
3696 no_packet_filters = tft_flags & 0x0F;
3698 proto_tree_add_text(ext_tree_tft, tvb, offset+1, 2, "TFT length: %u", length);
3700 tef = proto_tree_add_text (ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
3701 ext_tree_tft_flags = proto_item_add_subtree (tef, ett_gtp_tft_flags);
3702 proto_tree_add_uint (ext_tree_tft_flags, hf_gtp_tft_code, tvb, offset + 3, 1, tft_flags);
3703 proto_tree_add_uint (ext_tree_tft_flags, hf_gtp_tft_spare, tvb, offset + 3, 1, tft_flags);
3704 proto_tree_add_uint (ext_tree_tft_flags, hf_gtp_tft_number, tvb, offset + 3, 1, tft_flags);
3706 offset = offset + 4;
3708 for (i=0;i<no_packet_filters;i++) {
3710 pf_id = tvb_get_guint8(tvb, offset);
3712 tee = proto_tree_add_text (ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
3713 ext_tree_tft_pf = proto_item_add_subtree (tee, ett_gtp_tft_pf);
3716 if (tft_code != 2) {
3718 pf_eval = tvb_get_guint8(tvb, offset);
3719 pf_len = tvb_get_guint8(tvb, offset + 1);
3721 proto_tree_add_uint (ext_tree_tft_pf, hf_gtp_tft_eval, tvb, offset, 1, pf_eval);
3722 proto_tree_add_text (ext_tree_tft_pf, tvb, offset+1, 1, "Content length: %u", pf_len);
3724 offset = offset + 2;
3727 while (pf_offset < pf_len) {
3729 pf_content_id = tvb_get_guint8 (tvb, offset + pf_offset);
3731 switch (pf_content_id) {
3732 /* address IPv4 and mask = 8 bytes*/
3734 tvb_memcpy (tvb, (guint8 *)&addr_ipv4, offset + pf_offset + 1, sizeof addr_ipv4);
3735 tvb_memcpy (tvb, (guint8 *)&mask_ipv4, offset + pf_offset + 5, sizeof mask_ipv4);
3736 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));
3737 pf_offset = pf_offset + 9;
3739 /* address IPv6 and mask = 32 bytes*/
3741 tvb_memcpy (tvb, (guint8 *)&addr_ipv6, offset+pf_offset+1, sizeof addr_ipv6);
3742 tvb_memcpy (tvb, (guint8 *)&mask_ipv6, offset+pf_offset+17, sizeof mask_ipv6);
3743 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));
3744 pf_offset = pf_offset + 33;
3746 /* protocol identifier/next header type = 1 byte*/
3748 proto = tvb_get_guint8 (tvb, offset + pf_offset + 1);
3749 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);
3750 pf_offset = pf_offset + 2;
3752 /* single destination port type = 2 bytes */
3754 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
3755 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
3756 pf_offset = pf_offset + 3;
3758 /* destination port range type = 4 bytes */
3760 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
3761 port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
3762 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
3763 pf_offset = pf_offset + 5;
3765 /* single source port type = 2 bytes */
3767 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
3768 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
3769 pf_offset = pf_offset + 3;
3771 /* source port range type = 4 bytes */
3773 port1 = tvb_get_ntohs (tvb, offset + pf_offset + 1);
3774 port2 = tvb_get_ntohs (tvb, offset + pf_offset + 3);
3775 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
3776 pf_offset = pf_offset + 5;
3778 /* security parameter index type = 4 bytes */
3780 ipsec_id = tvb_get_ntohl (tvb, offset + pf_offset + 1);
3781 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
3782 pf_offset = pf_offset + 5;
3784 /* type of service/traffic class type = 2 bytes */
3786 tos = tvb_get_ntohs (tvb, offset + pf_offset + 1);
3787 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
3788 pf_offset = pf_offset + 3;
3790 /* flow label type = 3 bytes */
3792 label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;
3793 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
3794 pf_offset = pf_offset + 4;
3798 proto_tree_add_text (ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
3799 pf_offset++; /* to avoid infinite loop */
3804 offset = offset + pf_offset;
3811 /* GPRS: not present
3812 * UMTS: 29.060 v4.0, chapter 7.7.37
3813 * 25.413 v3.4, chapter ???
3816 decode_gtp_target_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3820 length = tvb_get_ntohs(tvb, offset + 1);
3822 proto_tree_add_text(tree, tvb, offset, 3 + length, "Targer Identification");
3828 /* GPRS: not present
3829 * UMTS: 29.060 v4.0, chapter 7.7.38
3832 decode_gtp_utran_cont(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3836 length = tvb_get_ntohs(tvb, offset + 1);
3838 proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent field");
3845 /* GPRS: not present
3846 * UMTS: 29.060 v4.0, chapter 7.7.39
3849 decode_gtp_rab_setup(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3851 guint32 teid, addr_ipv4;
3854 struct e_in6_addr addr_ipv6;
3855 proto_tree *ext_tree_rab_setup;
3858 length = tvb_get_ntohs(tvb, offset + 1);
3859 nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
3861 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Radio Access Bearer Setup Information");
3862 ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
3864 proto_tree_add_text(ext_tree_rab_setup, tvb, offset+1, 2, "RAB setup length : %u", length);
3865 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset+3, 1, nsapi);
3869 teid = tvb_get_ntohl(tvb, offset + 4);
3871 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset+4, 4, teid);
3875 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+8, sizeof addr_ipv4);
3876 proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset+8, 4, addr_ipv4);
3879 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+8, sizeof addr_ipv6);
3880 proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset+8, 16, (guint8 *)&addr_ipv6);
3891 /* GPRS: not present
3892 * UMTS: 29.060 v4.0, chapter 7.7.40
3895 decode_gtp_hdr_list(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3899 proto_tree *ext_tree_hdr_list;
3902 length = tvb_get_guint8(tvb, offset + 1);
3904 te = proto_tree_add_text(tree, tvb, offset, 2+length, "%s", val_to_str(GTP_EXT_HDR_LIST, gtp_val, "Unknown"));
3905 ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
3907 proto_tree_add_text(ext_tree_hdr_list, tvb, offset+1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
3909 for(i=0 ; i<length ; i++) {
3910 hdr = tvb_get_guint8(tvb, offset+2+i);
3912 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);
3918 /* GPRS: not present
3919 * UMTS: 29.060 v4.0, chapter 7.7.41
3920 * TODO: find TriggerID description
3923 decode_gtp_trigger_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3927 length = tvb_get_ntohs(tvb, offset + 1);
3929 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_TRIGGER_ID, gtp_val, "Unknown"), length);
3935 /* GPRS: not present
3936 * UMTS: 29.060 v4.0, chapter 7.7.42
3937 * TODO: find OMC-ID description
3940 decode_gtp_omc_id(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3944 length = tvb_get_ntohs(tvb, offset + 1);
3946 proto_tree_add_text(tree, tvb, offset, 3+length, "%s length : %u", val_to_str(GTP_EXT_OMC_ID, gtp_val, "Unknown"), length);
3952 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
3953 * UMTS: 29.060 v4.0, chapter 7.7.43
3956 decode_gtp_chrg_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3960 struct e_in6_addr addr_ipv6;
3961 proto_tree *ext_tree_chrg_addr;
3964 length = tvb_get_ntohs(tvb, offset+1);
3966 te = proto_tree_add_text(tree, tvb, offset, 3+length, "%s : ", val_to_str(GTP_EXT_CHRG_ADDR, gtp_val, "Unknown"));
3967 ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_chrg_addr);
3969 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);
3973 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
3974 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
3975 proto_tree_add_ipv4 (ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset+3, 4, addr_ipv4);
3978 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
3979 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
3980 proto_tree_add_ipv6 (ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
3983 proto_item_append_text(te, "unknown type or wrong length");
3994 decode_gtp_rel_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
3996 guint16 length, n, number;
3997 proto_tree *ext_tree_rel_pack;
4000 length = tvb_get_ntohs(tvb, offset + 1);
4002 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
4003 ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
4007 while (n < length) {
4009 number = tvb_get_ntohs(tvb, offset + 3 + n);
4010 proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
4022 decode_gtp_can_pack(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4024 guint16 length, n, number;
4025 proto_tree *ext_tree_can_pack;
4028 length = tvb_get_ntohs(tvb, offset + 1);
4030 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
4031 ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
4035 while (n < length) {
4037 number = tvb_get_ntohs(tvb, offset + 3 + n);
4038 proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
4045 /* CDRs dissector */
4047 decode_gtp_data_req(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4049 guint16 length, format_ver;
4051 proto_tree *ext_tree;
4055 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_DATA_REQ, gtp_val, "Unknown message"));
4056 ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
4058 length = tvb_get_ntohs(tvb, offset + 1);
4059 no = tvb_get_guint8(tvb, offset + 3);
4060 format = tvb_get_guint8(tvb, offset + 4);
4061 format_ver = tvb_get_ntohs(tvb, offset + 5);
4063 proto_tree_add_text(ext_tree, tvb, offset+1, 2, "Length: %u", length);
4064 proto_tree_add_text(ext_tree, tvb, offset+3, 1, "Number of data records: %u", no);
4065 proto_tree_add_text(ext_tree, tvb, offset+4, 1, "Data record format: %u", format);
4066 proto_tree_add_text(ext_tree, tvb, offset+5, 2, "Data record format version: %u", format_ver);
4068 if (gtpcdr_handle) {
4069 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
4070 call_dissector (gtpcdr_handle, next_tvb, pinfo, tree);
4073 proto_tree_add_text (tree, tvb, offset, 0, "Data");
4082 decode_gtp_data_resp(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4084 guint16 length, n, number;
4085 proto_tree *ext_tree_data_resp;
4088 length = tvb_get_ntohs(tvb, offset + 1);
4090 te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
4091 ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
4095 while (n < length) {
4097 number = tvb_get_ntohs(tvb, offset + 3 + n);
4098 proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
4111 decode_gtp_node_addr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4115 struct e_in6_addr addr_ipv6;
4116 proto_tree *ext_tree_node_addr;
4119 length = tvb_get_ntohs(tvb, offset+1);
4121 te = proto_tree_add_text(tree, tvb, offset, 3+length, "Node address: ");
4122 ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
4124 proto_tree_add_text (ext_tree_node_addr, tvb, offset+1, 2, "Node address length: %u", length);
4128 tvb_memcpy(tvb, (guint8 *)&addr_ipv4, offset+3, sizeof addr_ipv4);
4129 proto_item_append_text(te, "%s", ip_to_str((guint8 *)&addr_ipv4));
4130 proto_tree_add_ipv4 (ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset+3, 4, addr_ipv4);
4133 tvb_memcpy(tvb, (guint8 *)&addr_ipv6, offset+3, sizeof addr_ipv6);
4134 proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr*)&addr_ipv6));
4135 proto_tree_add_ipv6 (ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset+3, 16, (guint8*)&addr_ipv6);
4138 proto_item_append_text(te, "unknown type or wrong length");
4146 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
4147 * UMTS: 29.060 v4.0, chapter 7.7.44
4150 decode_gtp_priv_ext(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4152 guint16 length, ext_id;
4154 proto_tree *ext_tree_priv_ext;
4157 te = proto_tree_add_text(tree, tvb, offset, 1, val_to_str(GTP_EXT_PRIV_EXT, gtp_val, "Unknown message"));
4158 ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
4160 length = tvb_get_ntohs(tvb, offset+1);
4161 if (length < 1) return 3+length;
4163 ext_id = tvb_get_ntohs(tvb, offset+3);
4164 tvb_memcpy(tvb, ext_val, offset+5, length > 65 ? 63 : length-2);
4165 ext_val[length > 65 ? 64 : length-1] = '\0';
4166 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset+3, 2, ext_id);
4167 proto_tree_add_string(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset+5, length-2, ext_val);
4173 decode_gtp_unknown(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
4175 proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
4177 return tvb_length_remaining(tvb, offset);
4181 dissect_gtp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4183 struct _gtp_hdr gtp_hdr;
4184 proto_tree *gtp_tree, *flags_tree;
4185 proto_item *ti, *tf;
4186 int i, offset, length, gtp_prime, checked_field, mandatory;
4187 int seq_no, flow_label;
4188 guint8 pdu_no, next_hdr = 0, ext_hdr_val;
4189 const guint8 *tid_val;
4193 guint8 sub_proto, acfield_len = 0, control_field;
4195 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4196 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
4197 if (check_col(pinfo->cinfo, COL_INFO))
4198 col_clear(pinfo->cinfo, COL_INFO);
4200 tvb_memcpy(tvb, (guint8 *)>p_hdr, 0, 4);
4202 if (!(gtp_hdr.flags & 0x10))
4207 switch ((gtp_hdr.flags >> 5) & 0x07) {
4219 if (check_col(pinfo->cinfo, COL_INFO))
4220 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(gtp_hdr.message, message_type, "Unknown"));
4223 ti = proto_tree_add_item (tree, proto_gtp, tvb, 0, -1, FALSE);
4224 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
4226 tf = proto_tree_add_uint (gtp_tree, hf_gtp_flags, tvb, 0, 1, gtp_hdr.flags);
4227 flags_tree = proto_item_add_subtree (tf, ett_gtp_flags);
4229 proto_tree_add_uint (flags_tree, hf_gtp_flags_ver, tvb, 0, 1, gtp_hdr.flags);
4230 proto_tree_add_uint (flags_tree, hf_gtp_flags_pt, tvb, 0, 1, gtp_hdr.flags);
4232 switch (gtp_version) {
4234 proto_tree_add_uint (flags_tree, hf_gtp_flags_spare1, tvb, 0, 1, gtp_hdr.flags);
4235 proto_tree_add_boolean (flags_tree, hf_gtp_flags_snn, tvb, 0, 1, gtp_hdr.flags);
4238 proto_tree_add_uint (flags_tree, hf_gtp_flags_spare2, tvb, 0, 1, gtp_hdr.flags);
4239 proto_tree_add_boolean (flags_tree, hf_gtp_flags_e, tvb, 0, 1, gtp_hdr.flags);
4240 proto_tree_add_boolean (flags_tree, hf_gtp_flags_s, tvb, 0, 1, gtp_hdr.flags);
4241 proto_tree_add_boolean (flags_tree, hf_gtp_flags_pn, tvb, 0, 1, gtp_hdr.flags);
4247 proto_tree_add_uint (gtp_tree, hf_gtp_message_type, tvb, 1, 1, gtp_hdr.message);
4249 gtp_hdr.length = g_ntohs (gtp_hdr.length);
4250 proto_tree_add_uint (gtp_tree, hf_gtp_length, tvb, 2, 2, gtp_hdr.length);
4255 seq_no = tvb_get_ntohs (tvb, offset);
4256 proto_tree_add_uint (gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
4259 switch (gtp_version) {
4261 seq_no = tvb_get_ntohs (tvb, offset);
4262 proto_tree_add_uint (gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
4265 flow_label = tvb_get_ntohs (tvb, offset);
4266 proto_tree_add_uint (gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
4269 pdu_no = tvb_get_guint8 (tvb, offset);
4270 proto_tree_add_uint (gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
4273 tid_val = tvb_get_ptr(tvb, offset, 8);
4274 tid_str = id_to_str (tid_val);
4275 proto_tree_add_string (gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
4279 teid = tvb_get_ntohl (tvb, offset);
4280 proto_tree_add_uint (gtp_tree, hf_gtp_teid, tvb, offset, 4, teid);
4283 if (gtp_hdr.flags & 0x07) {
4284 seq_no = tvb_get_ntohs (tvb, offset);
4285 proto_tree_add_uint (gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
4288 pdu_no = tvb_get_guint8 (tvb, offset);
4289 proto_tree_add_uint (gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, pdu_no);
4292 next_hdr = tvb_get_guint8 (tvb, offset);
4293 proto_tree_add_uint (gtp_tree, hf_gtp_next, tvb, offset, 1, next_hdr);
4303 if (gtp_hdr.message != GTP_MSG_TPDU) {
4304 proto_tree_add_text(gtp_tree, tvb, 0, 0, "[--- end of GTP header, beginning of extension headers ---]");
4305 length = tvb_length (tvb);
4306 mandatory = 0; /* check order of GTP fields against ETSI */
4308 if (offset >= length)
4311 ext_hdr_val = next_hdr;
4315 ext_hdr_val = tvb_get_guint8 (tvb, offset);
4316 if (gtp_etsi_order) {
4317 checked_field = check_field_presence (gtp_hdr.message, ext_hdr_val , (int *)&mandatory);
4318 switch (checked_field) {
4319 case -2: proto_tree_add_text (gtp_tree, tvb, 0, 0, "[WARNING] message not found");
4321 case -1: proto_tree_add_text (gtp_tree, tvb, 0, 0, "[WARNING] field not present");
4324 default: proto_tree_add_text (gtp_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s", val_to_str(checked_field, gtp_val, "Unknown extension field"));
4330 while (gtpopt[++i].optcode)
4331 if (gtpopt[i].optcode == ext_hdr_val)
4333 offset = offset + (*gtpopt[i].decode)(tvb, offset, pinfo, gtp_tree);
4338 if ((gtp_hdr.message == GTP_MSG_TPDU) && gtp_tpdu) {
4343 if (gtp_version == 1) {
4344 if (gtp_hdr.flags & 0x07) {
4346 if (tvb_get_guint8 (tvb, offset) == 0)
4355 sub_proto = tvb_get_guint8 (tvb, offset);
4357 if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
4358 /* this is most likely an IPv4 packet
4359 * we can exclude 0x40 - 0x44 because the minimum header size is 20 octets
4360 * 0x4f is excluded because PPP protocol type "IPv6 header compression"
4361 * with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
4363 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
4364 call_dissector(ip_handle, next_tvb, pinfo, tree);
4367 if ((sub_proto & 0xf0) == 0x60){
4368 /* this is most likely an IPv6 packet */
4369 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
4370 call_dissector (ipv6_handle, next_tvb, pinfo, tree);
4372 /* this seems to be a PPP packet */
4374 if (sub_proto == 0xff) {
4375 /* this might be an address field, even it shouldn't be here */
4376 control_field = tvb_get_guint8 (tvb, offset + 1);
4377 if (control_field == 0x03)
4378 /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
4382 next_tvb = tvb_new_subset (tvb, offset + acfield_len, -1, -1);
4383 call_dissector (ppp_handle, next_tvb, pinfo, tree);
4386 if (check_col(pinfo->cinfo, COL_PROTOCOL))
4387 col_append_str_gtp(pinfo->cinfo, COL_PROTOCOL, "GTP");
4391 static const true_false_string yes_no_tfs = {
4397 proto_register_gtp(void)
4399 static hf_register_info hf_gtp[] = {
4400 { &hf_gtp_apn, { "APN", "gtp.apn", FT_STRING, BASE_DEC, NULL, 0, "Access Point Name", HFILL }},
4401 { &hf_gtp_cause, { "Cause ", "gtp.cause", FT_UINT8, BASE_DEC, VALS(cause_type), 0, "Cause of operation", HFILL }},
4402 { &hf_gtp_chrg_char, { "Charging characteristics", "gtp.chrg_char", FT_UINT16, BASE_DEC, NULL, 0, "Charging characteristics", HFILL }},
4403 { &hf_gtp_chrg_char_s, { "Spare", "gtp.chrg_char_s", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S, "Spare", HFILL }},
4404 { &hf_gtp_chrg_char_n, { "Normal charging", "gtp.chrg_char_n", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N, "Normal charging", HFILL }},
4405 { &hf_gtp_chrg_char_p, { "Prepaid charging", "gtp.chrg_char_p", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P, "Prepaid charging", HFILL }},
4406 { &hf_gtp_chrg_char_f, { "Flat rate charging", "gtp.chrg_char_f", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F, "Flat rate charging", HFILL }},
4407 { &hf_gtp_chrg_char_h, { "Hot billing charging", "gtp.chrg_char_h", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H, "Hot billing charging", HFILL }},
4408 { &hf_gtp_chrg_char_r, { "Reserved", "gtp.chrg_char_r", FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R, "Reserved", HFILL }},
4409 { &hf_gtp_chrg_id, { "Charging ID", "gtp.chrg_id", FT_UINT32, BASE_HEX, NULL, 0, "Charging ID", HFILL }},
4410 { &hf_gtp_chrg_ipv4, { "CG address IPv4", "gtp.chrg_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Charging Gateway address IPv4", HFILL }},
4411 { &hf_gtp_chrg_ipv6, { "CG address IPv6", "gtp.chrg_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Charging Gateway address IPv6", HFILL }},
4412 { &hf_gtp_ext_flow_label, { "Flow Label Data I", "gtp.ext_flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label data", HFILL }},
4413 { &hf_gtp_ext_id, { "Extension identifier", "gtp.ext_id", FT_UINT16, BASE_DEC, NULL, 0, "Extension Identifier", HFILL }},
4414 { &hf_gtp_ext_val, { "Extension value", "gtp.ext_val", FT_STRING, BASE_DEC, NULL, 0, "Extension Value", HFILL }},
4415 { &hf_gtp_flags, { "Flags", "gtp.flags", FT_UINT8, BASE_HEX, NULL, 0, "Ver/PT/Spare...", HFILL }},
4416 { &hf_gtp_flags_ver, { "Version", "gtp.flags.version", FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK, "GTP Version", HFILL }},
4417 { &hf_gtp_flags_pt, { "Protocol type", "gtp.flags.payload", FT_UINT8, BASE_DEC, NULL, GTP_PT_MASK, "Protocol Type", HFILL }},
4418 { &hf_gtp_flags_spare1, { "Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK, "Reserved (shall be sent as '111' )", HFILL }},
4419 { &hf_gtp_flags_snn, { "Is SNDCP N-PDU included?", "gtp.flags.snn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_SNN_MASK, "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL }},
4420 { &hf_gtp_flags_spare2, { "Reserved", "gtp.flags.reserved", FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK, "Reserved (shall be sent as '1' )", HFILL }},
4421 { &hf_gtp_flags_e, { "Is Next Extension Header present?", "gtp.flags.e", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_E_MASK, "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL }},
4422 { &hf_gtp_flags_s, { "Is Sequence Number present?", "gtp.flags.s", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_S_MASK, "Is Sequence Number present? (1 = yes, 0 = no)", HFILL }},
4423 { &hf_gtp_flags_pn, { "Is N-PDU number present?", "gtp.flags.pn", FT_BOOLEAN, 8, TFS(&yes_no_tfs), GTP_PN_MASK, "Is N-PDU number present? (1 = yes, 0 = no)", HFILL }},
4424 { &hf_gtp_flow_ii, { "Flow Label Data II ", "gtp.flow_ii", FT_UINT16, BASE_DEC, NULL, 0, "Downlink flow label data", HFILL }},
4425 { &hf_gtp_flow_label, { "Flow label", "gtp.flow_label", FT_UINT16, BASE_HEX, NULL, 0, "Flow label", HFILL }},
4426 { &hf_gtp_flow_sig, { "Flow label Signalling", "gtp.flow_sig", FT_UINT16, BASE_HEX, NULL, 0, "Flow label signalling", HFILL }},
4427 { &hf_gtp_gsn_addr_len, { "GSN Address Length", "gtp.gsn_addr_len", FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK, "GSN Address Length", HFILL }},
4428 { &hf_gtp_gsn_addr_type, { "GSN Address Type", "gtp.gsn_addr_type", FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK, "GSN Address Type", HFILL }},
4429 { &hf_gtp_gsn_ipv4, { "GSN address IPv4", "gtp.gsn_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "GSN address IPv4", HFILL }},
4430 { &hf_gtp_gsn_ipv6, { "GSN address IPv6", "gtp.gsn_ipv6", FT_IPv6, BASE_DEC, NULL, 0, "GSN address IPv6", HFILL }},
4431 { &hf_gtp_imsi, { "IMSI", "gtp.imsi", FT_STRING, BASE_DEC, NULL, 0, "International Mobile Subscriber Identity number", HFILL }},
4432 { &hf_gtp_length, { "Length", "gtp.length", FT_UINT16, BASE_DEC, NULL, 0, "Length (i.e. number of octets after TID or TEID)", HFILL }},
4433 { &hf_gtp_map_cause, { "MAP cause", "gtp.map_cause", FT_UINT8, BASE_DEC, VALS(map_cause_type), 0, "MAP cause", HFILL }},
4434 { &hf_gtp_message_type, { "Message Type", "gtp.message", FT_UINT8, BASE_HEX, VALS(message_type), 0x0, "GTP Message Type", HFILL }},
4435 { &hf_gtp_ms_reason, { "MS not reachable reason", "gtp.ms_reason", FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0, "MS Not Reachable Reason", HFILL }},
4436 { &hf_gtp_ms_valid, { "MS validated", "gtp.ms_valid", FT_BOOLEAN, BASE_NONE,NULL, 0, "MS validated", HFILL }},
4437 { &hf_gtp_msisdn, { "MSISDN", "gtp.msisdn", FT_STRING, BASE_DEC, NULL, 0, "MS international PSTN/ISDN number", HFILL }},
4438 { &hf_gtp_next, { "Next extension header type", "gtp.next", FT_UINT8, BASE_HEX, NULL, 0, "Next Extension Header Type", HFILL }},
4439 { &hf_gtp_node_ipv4, { "Node address IPv4", "gtp.node_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Recommended node address IPv4", HFILL }},
4440 { &hf_gtp_node_ipv6, { "Node address IPv6", "gtp.node_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Recommended node address IPv6", HFILL }},
4441 { &hf_gtp_npdu_number, { "N-PDU Number", "gtp.npdu_number", FT_UINT8, BASE_HEX, NULL, 0, "N-PDU Number", HFILL }},
4442 { &hf_gtp_nsapi, { "NSAPI", "gtp.nsapi", FT_UINT8, BASE_DEC, NULL, 0, "Network layer Service Access Point Identifier", HFILL }},
4443 { &hf_gtp_qos_spare1, { "Spare", "gtp.qos_spare1", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK, "Spare (shall be sent as '00' )", HFILL }},
4444 { &hf_gtp_qos_delay, { "QoS delay", "gtp.qos_delay", FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK, "Quality of Service Delay Class", HFILL }},
4445 { &hf_gtp_qos_reliability, { "QoS reliability", "gtp.qos_reliabilty", FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK, "Quality of Service Reliability Class", HFILL }},
4446 { &hf_gtp_qos_peak, { "QoS peak", "gtp.qos_peak", FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK, "Quality of Service Peak Throughput", HFILL }},
4447 { &hf_gtp_qos_spare2, { "Spare", "gtp.qos_spare2",FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK, "Spare (shall be sent as 0)", HFILL }},
4448 { &hf_gtp_qos_precedence, { "QoS precedence", "gtp.qos_precedence", FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK, "Quality of Service Precedence Class", HFILL }},
4449 { &hf_gtp_qos_spare3, { "Spare", "gtp.qos_spare3", FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK, "Spare (shall be sent as '000' )", HFILL }},
4450 { &hf_gtp_qos_mean, { "QoS mean", "gtp.qos_mean", FT_UINT8, BASE_DEC, VALS(qos_mean_type), GTP_EXT_QOS_MEAN_MASK, "Quality of Service Mean Throughput", HFILL }},
4451 { &hf_gtp_qos_al_ret_priority, { "Allocation/Retention priority ","gtp.qos_al_ret_priority", FT_UINT8, BASE_DEC, NULL, 0, "Allocation/Retention Priority", HFILL }},
4452 { &hf_gtp_qos_traf_class, { "Traffic class", "gtp.qos_traf_class", FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK, "Traffic Class", HFILL }},
4453 { &hf_gtp_qos_del_order, { "Delivery order", "gtp.qos_del_order", FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK, "Delivery Order", HFILL }},
4454 { &hf_gtp_qos_del_err_sdu, { "Delivery of erroneous SDU", "gtp.qos_del_err_sdu", FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK, "Delivery of Erroneous SDU", HFILL }},
4455 { &hf_gtp_qos_max_sdu_size, { "Maximum SDU size", "gtp.qos_max_sdu_size", FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0, "Maximum SDU size", HFILL }},
4456 { &hf_gtp_qos_max_ul, { "Maximum bit rate for uplink", "gtp.qos_max_ul", FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0, "Maximum bit rate for uplink", HFILL }},
4457 { &hf_gtp_qos_max_dl, { "Maximum bit rate for downlink", "gtp.qos_max_dl", FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0, "Maximum bit rate for downlink", HFILL }},
4458 { &hf_gtp_qos_res_ber, { "Residual BER", "gtp.qos_res_ber", FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK, "Residual Bit Error Rate", HFILL }},
4459 { &hf_gtp_qos_sdu_err_ratio, { "SDU Error ratio", "gtp.qos_sdu_err_ratio", FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK, "SDU Error Ratio", HFILL }},
4460 { &hf_gtp_qos_trans_delay, { "Transfer delay", "gtp.qos_trans_delay", FT_UINT8, BASE_DEC, VALS(qos_trans_delay), GTP_EXT_QOS_TRANS_DELAY_MASK, "Transfer Delay", HFILL }},
4461 { &hf_gtp_qos_traf_handl_prio, { "Traffic handling priority", "gtp.qos_traf_handl_prio", FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK, "Traffic Handling Priority", HFILL }},
4462 { &hf_gtp_qos_guar_ul, { "Guaranteed bit rate for uplink", "gtp.qos_guar_ul", FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0, "Guaranteed bit rate for uplink", HFILL }},
4463 { &hf_gtp_qos_guar_dl, { "Guaranteed bit rate for downlink", "gtp.qos_guar_dl", FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0, "Guaranteed bit rate for downlink", HFILL }},
4464 { &hf_gtp_pkt_flow_id, { "Packet Flow ID", "gtp.pkt_flow_id", FT_UINT8, BASE_DEC, NULL, 0, "Packet Flow ID", HFILL }},
4465 { &hf_gtp_ptmsi, { "P-TMSI", "gtp.ptmsi", FT_UINT32, BASE_HEX, NULL, 0, "Packet-Temporary Mobile Subscriber Identity", HFILL }},
4466 { &hf_gtp_ptmsi_sig, { "P-TMSI Signature", "gtp.ptmsi_sig", FT_UINT24, BASE_HEX, NULL, 0, "P-TMSI Signature", HFILL }},
4467 { &hf_gtp_rab_gtpu_dn, { "Downlink GTP-U seq number", "gtp.rab_gtp_dn", FT_UINT16, BASE_DEC, NULL, 0, "Downlink GTP-U sequence number", HFILL }},
4468 { &hf_gtp_rab_gtpu_up, { "Uplink GTP-U seq number", "gtp.rab_gtp_up", FT_UINT16, BASE_DEC, NULL, 0, "Uplink GTP-U sequence number", HFILL }},
4469 { &hf_gtp_rab_pdu_dn, { "Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn", FT_UINT8, BASE_DEC, NULL, 0, "Downlink next PDCP-PDU sequence number", HFILL }},
4470 { &hf_gtp_rab_pdu_up, { "Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up", FT_UINT8, BASE_DEC, NULL, 0, "Uplink next PDCP-PDU sequence number", HFILL }},
4471 { &hf_gtp_rai_mcc, { "MCC", "gtp.mcc", FT_UINT16, BASE_DEC, NULL, 0, "Mobile Country Code", HFILL }},
4472 { &hf_gtp_rai_mnc, { "MNC", "gtp.mnc", FT_UINT8, BASE_DEC, NULL, 0, "Mobile Network Code", HFILL }},
4473 { &hf_gtp_rai_rac, { "RAC", "gtp.rac", FT_UINT8, BASE_DEC, NULL, 0, "Routing Area Code", HFILL }},
4474 { &hf_gtp_rai_lac, { "LAC", "gtp.lac", FT_UINT16, BASE_DEC, NULL, 0, "Location Area Code", HFILL }},
4475 { &hf_gtp_ranap_cause, { "RANAP cause", "gtp.ranap_cause", FT_UINT8, BASE_DEC, VALS(ranap_cause_type), 0, "RANAP cause", HFILL }},
4476 { &hf_gtp_recovery, { "Recovery", "gtp.recovery", FT_UINT8, BASE_DEC, NULL, 0, "Restart counter", HFILL }},
4477 { &hf_gtp_reorder, { "Reordering required","gtp.reorder", FT_BOOLEAN, BASE_NONE,NULL, 0, "Reordering required", HFILL }},
4478 { &hf_gtp_rnc_ipv4, { "RNC address IPv4", "gtp.rnc_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "Radio Network Controller address IPv4", HFILL }},
4479 { &hf_gtp_rnc_ipv6, { "RNC address IPv6", "gtp.rnc_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "Radio Network Controller address IPv6", HFILL }},
4480 { &hf_gtp_rp, { "Radio Priority", "gtp.rp", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK, "Radio Priority for uplink tx", HFILL }},
4481 { &hf_gtp_rp_nsapi, { "NSAPI in Radio Priority", "gtp.rp_nsapi", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK, "Network layer Service Access Point Identifier in Radio Priority", HFILL }},
4482 { &hf_gtp_rp_sms, { "Radio Priority SMS", "gtp.rp_sms", FT_UINT8, BASE_DEC, NULL, 0, "Radio Priority for MO SMS", HFILL }},
4483 { &hf_gtp_rp_spare, { "Reserved", "gtp.rp_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK, "Spare bit", HFILL }},
4484 { &hf_gtp_sel_mode, { "Selection mode", "gtp.sel_mode", FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0, "Selection Mode", HFILL }},
4485 { &hf_gtp_seq_number, { "Sequence number", "gtp.seq_number", FT_UINT16, BASE_HEX, NULL, 0, "Sequence Number", HFILL }},
4486 { &hf_gtp_sndcp_number, { "SNDCP N-PDU LLC Number", "gtp.sndcp_number", FT_UINT8, BASE_HEX, NULL, 0, "SNDCP N-PDU LLC Number", HFILL }},
4487 { &hf_gtp_tear_ind, { "Teardown Indicator", "gtp.tear_ind", FT_BOOLEAN, BASE_NONE,NULL, 0, "Teardown Indicator", HFILL }},
4488 { &hf_gtp_teid, { "TEID", "gtp.teid", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier", HFILL }},
4489 { &hf_gtp_teid_cp, { "TEID Control Plane", "gtp.teid_cp", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Control Plane", HFILL }},
4490 { &hf_gtp_teid_data, { "TEID Data I", "gtp.teid_data", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data I", HFILL }},
4491 { &hf_gtp_teid_ii, { "TEID Data II", "gtp.teid_ii", FT_UINT32, BASE_HEX, NULL, 0, "Tunnel Endpoint Identifier Data II", HFILL }},
4492 { &hf_gtp_tft_code, { "TFT operation code", "gtp.tft_code", FT_UINT8, BASE_DEC, VALS (tft_code_type), GTPv1_TFT_CODE_MASK, "TFT operation code", HFILL }},
4493 { &hf_gtp_tft_spare, { "TFT spare bit", "gtp.tft_spare", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK, "TFT spare bit", HFILL }},
4494 { &hf_gtp_tft_number, { "Number of packet filters", "gtp.tft_number", FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK, "Number of packet filters", HFILL }},
4495 { &hf_gtp_tft_eval, { "Evaluation precedence", "gtp.tft_eval", FT_UINT8, BASE_DEC, NULL, 0, "Evaluation precedence", HFILL }},
4496 { &hf_gtp_tid, { "TID", "gtp.tid", FT_STRING, BASE_DEC, NULL, 0, "Tunnel Identifier", HFILL }},
4497 { &hf_gtp_tlli, { "TLLI", "gtp.tlli", FT_UINT32, BASE_HEX, NULL, 0, "Temporary Logical Link Identity", HFILL }},
4498 { &hf_gtp_tr_comm, { "Packet transfer command", "gtp.tr_comm", FT_UINT8, BASE_DEC, VALS (tr_comm_type), 0, "Packat transfer command", HFILL }},
4499 { &hf_gtp_trace_ref, { "Trace reference", "gtp.trace_ref", FT_UINT16, BASE_HEX, NULL, 0, "Trace reference", HFILL }},
4500 { &hf_gtp_trace_type, { "Trace type", "gtp.trace_type", FT_UINT16, BASE_HEX, NULL, 0, "Trace type", HFILL }},
4501 { &hf_gtp_unknown, { "Unknown data (length)", "gtp.unknown", FT_UINT16, BASE_DEC, NULL, 0, "Unknown data", HFILL }},
4502 { &hf_gtp_user_addr_pdp_org, { "PDP type organization", "gtp.user_addr_pdp_org", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0, "PDP type organization", HFILL }},
4503 { &hf_gtp_user_addr_pdp_type, { "PDP type number", "gtp.user_addr_pdp_type", FT_UINT8, BASE_HEX, VALS (pdp_type), 0, "PDP type", HFILL }},
4504 { &hf_gtp_user_ipv4, { "End user address IPv4", "gtp.user_ipv4", FT_IPv4, BASE_DEC, NULL, 0, "End user address IPv4", HFILL }},
4505 { &hf_gtp_user_ipv6, { "End user address IPv6", "gtp.user_ipv6", FT_IPv6, BASE_HEX, NULL, 0, "End user address IPv6", HFILL }},
4508 static gint *ett_gtp_array[] = {
4518 &ett_gtp_pkt_flow_id,
4541 module_t *gtp_module;
4543 proto_gtp = proto_register_protocol ("GPRS Tunneling Protocol", "GTP", "gtp");
4544 proto_register_field_array (proto_gtp, hf_gtp, array_length (hf_gtp));
4545 proto_register_subtree_array (ett_gtp_array, array_length (ett_gtp_array));
4547 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
4549 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 port", "GTPv0 port (default 3386)", 10, &g_gtpv0_port);
4550 prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 control plane (GTP-C) port", "GTPv1 control plane port (default 2123)", 10, &g_gtpv1c_port);
4551 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10, &g_gtpv1u_port);
4552 prefs_register_bool_preference(gtp_module, "dissect_tpdu", "Dissect T-PDU", "Dissect T-PDU", >p_tpdu);
4553 prefs_register_obsolete_preference (gtp_module, "v0_dissect_cdr_as");
4554 prefs_register_obsolete_preference (gtp_module, "v0_check_etsi");
4555 prefs_register_obsolete_preference (gtp_module, "v1_check_etsi");
4556 prefs_register_bool_preference (gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", >p_etsi_order);
4557 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
4559 register_dissector("gtp", dissect_gtp, proto_gtp);
4563 proto_reg_handoff_gtp(void)
4565 static int Initialized = FALSE;
4566 static dissector_handle_t gtp_handle;
4569 gtp_handle = find_dissector("gtp");
4570 ppp_subdissector_table = find_dissector_table("ppp.protocol");
4573 dissector_delete ("udp.port", gtpv0_port, gtp_handle);
4574 dissector_delete ("tcp.port", gtpv0_port, gtp_handle);
4575 dissector_delete ("udp.port", gtpv1c_port, gtp_handle);
4576 dissector_delete ("tcp.port", gtpv1c_port, gtp_handle);
4577 dissector_delete ("udp.port", gtpv1u_port, gtp_handle);
4578 dissector_delete ("tcp.port", gtpv1u_port, gtp_handle);
4581 gtpv0_port = g_gtpv0_port;
4582 gtpv1c_port = g_gtpv1c_port;
4583 gtpv1u_port = g_gtpv1u_port;
4585 dissector_add ("udp.port", g_gtpv0_port, gtp_handle);
4586 dissector_add ("tcp.port", g_gtpv0_port, gtp_handle);
4587 dissector_add ("udp.port", g_gtpv1c_port, gtp_handle);
4588 dissector_add ("tcp.port", g_gtpv1c_port, gtp_handle);
4589 dissector_add ("udp.port", g_gtpv1u_port, gtp_handle);
4590 dissector_add ("tcp.port", g_gtpv1u_port, gtp_handle);
4592 ip_handle = find_dissector("ip");
4593 ipv6_handle = find_dissector("ipv6");
4594 ppp_handle = find_dissector("ppp");
4595 data_handle = find_dissector("data");
4596 gtpcdr_handle = find_dissector("gtpcdr");