0cda2f16e32e5110ef055c6307a9ffde8e9922f7
[obnox/wireshark/wip.git] / epan / dissectors / packet-gtp.c
1 /* packet-gtp.c
2  *
3  * $Id$
4  *
5  * Routines for GTP dissection
6  * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
7  *                 Nicolas Balkota <balkota@mac.com>
8  *
9  * Updates and corrections:
10  * Copyright 2006 - 2009, Anders Broman <anders.broman@ericsson.com>
11  *
12  * Added Bearer control mode dissection:
13  * Copyright 2011, Grzegorz Szczytowski <grzegorz.szczytowski@gmail.com>
14  *
15  * Updates and corrections:
16  * Copyright 2011, Anders Broman <anders.broman@ericsson.com>
17  *
18  * PDCP PDU number extension header support added by Martin Isaksson <martin.isaksson@ericsson.com>
19  *
20  * Control Plane Request-Response tracking code Largely based on similar routines in
21  * packet-ldap.c by Ronnie Sahlberg
22  * Added by Kari Tiirikainen <kari.tiirikainen@nsn.com>
23  *
24  * Wireshark - Network traffic analyzer
25  * By Gerald Combs <gerald@wireshark.org>
26  * Copyright 1998 Gerald Combs
27  *
28  * This program is free software; you can redistribute it and/or
29  * modify it under the terms of the GNU General Public License
30  * as published by the Free Software Foundation; either version 2
31  * of the License, or (at your option) any later version.
32  *
33  * This program is distributed in the hope that it will be useful,
34  * but WITHOUT ANY WARRANTY; without even the implied warranty of
35  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36  * GNU General Public License for more details.
37  *
38  * You should have received a copy of the GNU General Public License
39  * along with this program; if not, write to the Free Software
40  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
41  * Ref: 3GPP TS 29.060
42  * http://www.3gpp.org/ftp/Specs/html-info/29060.htm
43  * GTP' 3GPP TS 32.295
44  */
45
46 #ifdef HAVE_CONFIG_H
47 # include "config.h"
48 #endif
49
50 #include <epan/conversation.h>
51 #include <epan/packet.h>
52 #include <epan/prefs.h>
53 #include <epan/expert.h>
54 #include <epan/sminmpec.h>
55 #include <epan/asn1.h>
56 #include <epan/tap.h>
57 #include "packet-ppp.h"
58 #include "packet-radius.h"
59 #include "packet-bssap.h"
60 #include "packet-gsm_a_common.h"
61 #include "packet-gsm_map.h"
62 #include "packet-gprscdr.h"
63 #include "packet-per.h"
64 #include "packet-ranap.h"
65 #include "packet-bssgp.h"
66 #include "packet-e212.h"
67 #include "packet-gtp.h"
68
69 static dissector_table_t ppp_subdissector_table;
70 static dissector_table_t gtp_priv_ext_dissector_table;
71 static dissector_table_t gtp_cdr_fmt_dissector_table;
72
73 #define GTPv0_PORT  3386
74 #define GTPv1C_PORT 2123    /* 3G Control PDU */
75 #define GTPv1U_PORT 2152    /* 3G T-PDU */
76
77 #define GTPv0_HDR_LENGTH     20
78 #define GTPv1_HDR_LENGTH     12
79 #define GTP_PRIME_HDR_LENGTH  6
80
81 /* to check compliance with ETSI  */
82 #define GTP_MANDATORY   1
83 #define GTP_OPTIONAL    2
84 #define GTP_CONDITIONAL 4
85
86 static gboolean g_gtp_over_tcp = TRUE;
87 static guint g_gtpv0_port  = GTPv0_PORT;
88 static guint g_gtpv1c_port = GTPv1C_PORT;
89 static guint g_gtpv1u_port = GTPv1U_PORT;
90
91 void proto_reg_handoff_gtp(void);
92
93 static int proto_gtp = -1;
94
95 /*KTi*/
96 static int hf_gtp_response_in = -1;
97 static int hf_gtp_response_to = -1;
98 static int hf_gtp_time = -1;
99 static int hf_gtp_apn = -1;
100 static int hf_gtp_cause = -1;
101 static int hf_gtp_chrg_char = -1;
102 static int hf_gtp_chrg_char_s = -1;
103 static int hf_gtp_chrg_char_n = -1;
104 static int hf_gtp_chrg_char_p = -1;
105 static int hf_gtp_chrg_char_f = -1;
106 static int hf_gtp_chrg_char_h = -1;
107 static int hf_gtp_chrg_char_r = -1;
108 static int hf_gtp_chrg_id = -1;
109 static int hf_gtp_chrg_ipv4 = -1;
110 static int hf_gtp_chrg_ipv6 = -1;
111 static int hf_gtp_ext_flow_label = -1;
112 static int hf_gtp_ext_id = -1;
113 static int hf_gtp_ext_val = -1;
114 static int hf_gtp_ext_hdr = -1;
115 static int hf_gtp_ext_hdr_next = -1;
116 static int hf_gtp_ext_hdr_length = -1;
117 static int hf_gtp_ext_hdr_pdcpsn = -1;
118 static int hf_gtp_flags = -1;
119 static int hf_gtp_flags_ver = -1;
120 static int hf_gtp_prime_flags_ver = -1;
121 static int hf_gtp_flags_pt = -1;
122 static int hf_gtp_flags_spare1 = -1;
123 static int hf_gtp_flags_hdr_length = -1;
124 static int hf_gtp_flags_snn = -1;
125 static int hf_gtp_flags_spare2 = -1;
126 static int hf_gtp_flags_e = -1;
127 static int hf_gtp_flags_s = -1;
128 static int hf_gtp_flags_pn = -1;
129 static int hf_gtp_flow_ii = -1;
130 static int hf_gtp_flow_label = -1;
131 static int hf_gtp_flow_sig = -1;
132 static int hf_gtp_gsn_addr_len = -1;
133 static int hf_gtp_gsn_addr_type = -1;
134 static int hf_gtp_gsn_ipv4 = -1;
135 static int hf_gtp_gsn_ipv6 = -1;
136 static int hf_gtp_imsi = -1;
137 static int hf_gtp_length = -1;
138 static int hf_gtp_map_cause = -1;
139 static int hf_gtp_message_type = -1;
140 static int hf_gtp_ms_reason = -1;
141 static int hf_gtp_ms_valid = -1;
142 static int hf_gtp_msisdn = -1;
143 static int hf_gtp_next = -1;
144 static int hf_gtp_npdu_number = -1;
145 static int hf_gtp_node_ipv4 = -1;
146 static int hf_gtp_node_ipv6 = -1;
147 static int hf_gtp_nsapi = -1;
148 static int hf_gtp_ptmsi = -1;
149 static int hf_gtp_ptmsi_sig = -1;
150 static int hf_gtp_qos_version = -1;
151 static int hf_gtp_qos_spare1 = -1;
152 static int hf_gtp_qos_delay = -1;
153 static int hf_gtp_qos_mean = -1;
154 static int hf_gtp_qos_peak = -1;
155 static int hf_gtp_qos_spare2 = -1;
156 static int hf_gtp_qos_precedence = -1;
157 static int hf_gtp_qos_spare3 = -1;
158 static int hf_gtp_qos_reliability = -1;
159 static int hf_gtp_qos_al_ret_priority = -1;
160 static int hf_gtp_qos_traf_class = -1;
161 static int hf_gtp_qos_del_order = -1;
162 static int hf_gtp_qos_del_err_sdu = -1;
163 static int hf_gtp_qos_max_sdu_size = -1;
164 static int hf_gtp_qos_max_ul = -1;
165 static int hf_gtp_qos_max_dl = -1;
166 static int hf_gtp_qos_res_ber = -1;
167 static int hf_gtp_qos_sdu_err_ratio = -1;
168 static int hf_gtp_qos_trans_delay = -1;
169 static int hf_gtp_qos_traf_handl_prio = -1;
170 static int hf_gtp_qos_guar_ul = -1;
171 static int hf_gtp_qos_guar_dl = -1;
172 static int hf_gtp_qos_src_stat_desc = -1;
173 static int hf_gtp_qos_sig_ind = -1;
174 static int hf_gtp_pkt_flow_id = -1;
175 static int hf_gtp_rab_gtpu_dn = -1;
176 static int hf_gtp_rab_gtpu_up = -1;
177 static int hf_gtp_rab_pdu_dn = -1;
178 static int hf_gtp_rab_pdu_up = -1;
179 static int hf_gtp_rai_rac = -1;
180 static int hf_gtp_rai_lac = -1;
181 static int hf_gtp_ranap_cause = -1;
182 static int hf_gtp_recovery = -1;
183 static int hf_gtp_reorder = -1;
184 static int hf_gtp_rnc_ipv4 = -1;
185 static int hf_gtp_rnc_ipv6 = -1;
186 static int hf_gtp_rp = -1;
187 static int hf_gtp_rp_nsapi = -1;
188 static int hf_gtp_rp_sms = -1;
189 static int hf_gtp_rp_spare = -1;
190 static int hf_gtp_sel_mode = -1;
191 static int hf_gtp_seq_number = -1;
192 static int hf_gtp_sndcp_number = -1;
193 static int hf_gtp_tear_ind = -1;
194 static int hf_gtp_teid = -1;
195 static int hf_gtp_teid_cp = -1;
196 static int hf_gtp_ulink_teid_cp = -1;
197 static int hf_gtp_teid_data = -1;
198 static int hf_gtp_ulink_teid_data = -1;
199 static int hf_gtp_teid_ii = -1;
200 static int hf_gtp_tft_code = -1;
201 static int hf_gtp_tft_spare = -1;
202 static int hf_gtp_tft_number = -1;
203 static int hf_gtp_tft_eval = -1;
204 static int hf_gtp_tid = -1;
205 static int hf_gtp_tlli = -1;
206 static int hf_gtp_tr_comm = -1;
207 static int hf_gtp_trace_ref = -1;
208 static int hf_gtp_trace_type = -1;
209 static int hf_gtp_unknown = -1;
210 static int hf_gtp_user_addr_pdp_org = -1;
211 static int hf_gtp_user_addr_pdp_type = -1;
212 static int hf_gtp_user_ipv4 = -1;
213 static int hf_gtp_user_ipv6 = -1;
214 static int hf_gtp_security_mode = -1;
215 static int hf_gtp_no_of_vectors = -1;
216 static int hf_gtp_cipher_algorithm = -1;
217 static int hf_gtp_cksn_ksi = -1;
218 static int hf_gtp_cksn = -1;
219 static int hf_gtp_ksi = -1;
220 static int hf_gtp_ext_length = -1;
221 static int hf_gtp_ext_apn_res = -1;
222 static int hf_gtp_ext_rat_type = -1;
223 static int hf_gtp_ext_geo_loc_type = -1;
224 static int hf_gtp_ext_sac = -1;
225 static int hf_gtp_ext_imeisv = -1;
226 static int hf_gtp_targetRNC_ID = -1;
227 static int hf_gtp_bssgp_cause = -1;
228 static int hf_gtp_bssgp_ra_discriminator = -1;
229 static int hf_gtp_sapi = -1;
230 static int hf_gtp_xid_par_len = -1;
231 static int hf_gtp_earp_pvi = -1;
232 static int hf_gtp_earp_pl = -1;
233 static int hf_gtp_earp_pci = -1;
234 static int hf_gtp_cdr_app = -1;
235 static int hf_gtp_cdr_rel = -1;
236 static int hf_gtp_cdr_ver = -1;
237 static int hf_gtp_spare = -1;
238 static int hf_gtp_cmn_flg_ppc = -1;
239 static int hf_gtp_cmn_flg_mbs_srv_type = -1;
240 static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy = -1;
241 static int hf_gtp_cmn_flg_mbs_cnt_inf = -1;
242 static int hf_gtp_cmn_flg_nrsn = -1;
243 static int hf_gtp_cmn_flg_no_qos_neg = -1;
244 static int hf_gtp_cmn_flg_upgrd_qos_sup = -1;
245 static int hf_gtp_tmgi = -1;
246 static int hf_gtp_mbms_ses_dur_days = -1;
247 static int hf_gtp_mbms_ses_dur_s = -1;
248 static int hf_gtp_no_of_mbms_sa_codes = -1;
249 static int hf_gtp_mbms_sa_code = -1;
250 static int hf_gtp_mbs_2g_3g_ind = -1;
251 static int hf_gtp_time_2_dta_tr = -1;
252 static int hf_gtp_ext_ei = -1;
253 static int hf_gtp_ext_gcsi = -1;
254 static int hf_gtp_ext_dti = -1;
255 static int hf_gtp_ra_prio_lcs = -1;
256 static int hf_gtp_bcm = -1;
257 static int hf_gtp_rim_routing_addr = -1;
258
259 /* Initialize the subtree pointers */
260 static gint ett_gtp = -1;
261 static gint ett_gtp_flags = -1;
262 static gint ett_gtp_ext = -1;
263 static gint ett_gtp_ext_hdr = -1;
264 static gint ett_gtp_rai = -1;
265 static gint ett_gtp_qos = -1;
266 static gint ett_gtp_auth_tri = -1;
267 static gint ett_gtp_flow_ii = -1;
268 static gint ett_gtp_rab_cntxt = -1;
269 static gint ett_gtp_rp = -1;
270 static gint ett_gtp_pkt_flow_id = -1;
271 static gint ett_gtp_chrg_char = -1;
272 static gint ett_gtp_user = -1;
273 static gint ett_gtp_mm = -1;
274 static gint ett_gtp_trip = -1;
275 static gint ett_gtp_quint = -1;
276 static gint ett_gtp_pdp = -1;
277 static gint ett_gtp_apn = -1;
278 static gint ett_gtp_proto = -1;
279 static gint ett_gtp_gsn_addr = -1;
280 static gint ett_gtp_tft = -1;
281 static gint ett_gtp_tft_pf = -1;
282 static gint ett_gtp_tft_flags = -1;
283 static gint ett_gtp_rab_setup = -1;
284 static gint ett_gtp_hdr_list = -1;
285 static gint ett_gtp_chrg_addr = -1;
286 static gint ett_gtp_node_addr = -1;
287 static gint ett_gtp_rel_pack = -1;
288 static gint ett_gtp_can_pack = -1;
289 static gint ett_gtp_data_resp = -1;
290 static gint ett_gtp_priv_ext = -1;
291 static gint ett_gtp_net_cap = -1;
292 static gint ett_gtp_ext_tree_apn_res = -1;
293 static gint ett_gtp_ext_rat_type = -1;
294 static gint ett_gtp_ext_imeisv = -1;
295 static gint ett_gtp_ext_ran_tr_cont = -1;
296 static gint ett_gtp_ext_pdp_cont_prio = -1;
297 static gint ett_gtp_ext_ssgn_no = -1;
298 static gint ett_gtp_ext_rab_setup_inf = -1;
299 static gint ett_gtp_ext_common_flgs = -1;
300 static gint ett_gtp_ext_usr_loc_inf = -1;
301 static gint ett_gtp_ext_ms_time_zone = -1;
302 static gint ett_gtp_ext_camel_chg_inf_con = -1;
303 static gint ett_GTP_EXT_MBMS_UE_CTX = -1;
304 static gint ett_gtp_ext_tmgi = -1;
305 static gint ett_gtp_tmgi = -1;
306 static gint ett_gtp_ext_rim_ra = -1;
307 static gint ett_gtp_ext_mbms_prot_conf_opt = -1;
308 static gint ett_gtp_ext_mbms_sa = -1;
309 static gint ett_gtp_ext_bms_ses_dur = -1;
310 static gint ett_gtp_ext_src_rnc_pdp_ctx_inf = -1;
311 static gint ett_gtp_ext_add_trs_inf = -1;
312 static gint ett_gtp_ext_hop_count = -1;
313 static gint ett_gtp_ext_sel_plmn_id = -1;
314 static gint ett_gtp_ext_mbms_ses_id = -1;
315 static gint ett_gtp_ext_mbms_2g_3g_ind = -1;
316 static gint ett_gtp_ext_enh_nsapi = -1;
317 static gint ett_gtp_ext_ad_mbms_trs_inf = -1;
318 static gint ett_gtp_ext_mbms_ses_id_rep_no = -1;
319 static gint ett_gtp_ext_mbms_time_to_data_tr = -1;
320 static gint ett_gtp_ext_ps_ho_req_ctx = -1;
321 static gint ett_gtp_ext_bss_cont = -1;
322 static gint ett_gtp_ext_cell_id = -1;
323 static gint ett_gtp_ext_pdu_no = -1;
324 static gint ett_gtp_ext_bssgp_cause = -1;
325 static gint ett_gtp_ext_ra_prio_lcs = -1;
326 static gint ett_gtp_ext_ps_handover_xid = -1;
327 static gint ett_gtp_target_id = -1;
328 static gint ett_gtp_utran_cont = -1;
329 static gint ett_gtp_bcm = -1;
330 static gint ett_gtp_cdr_ver = -1;
331 static gint ett_gtp_cdr_dr = -1;
332 static gint ett_gtp_uli_rai = -1;
333
334 static gboolean g_gtp_tpdu = TRUE;
335 static gboolean g_gtp_etsi_order = FALSE;
336
337 static int gtp_tap = -1;
338
339 /* Definition of flags masks */
340 #define GTP_VER_MASK 0xE0
341
342 static const true_false_string gtp_hdr_length_vals = {
343     "6-Octet Header",
344     "20-Octet Header"
345 };
346
347 static const value_string ver_types[] = {
348     {0, "GTP release 97/98 version"},
349     {1, "GTP release 99 version"},
350     {2, "GTPv2-C"},
351     {3, "None"},
352     {4, "None"},
353     {5, "None"},
354     {6, "None"},
355     {7, "None"},
356     {0, NULL}
357 };
358
359 static const value_string pt_types[] = {
360     {0, "GTP'"},
361     {1, "GTP"},
362     {0, NULL}
363 };
364
365 #define GTP_PT_MASK         0x10
366 #define GTP_SPARE1_MASK     0x0E
367 #define GTP_SPARE2_MASK     0x08
368 #define GTP_E_MASK          0x04
369 #define GTP_S_MASK          0x02
370 #define GTP_SNN_MASK        0x01
371 #define GTP_PN_MASK         0x01
372
373 #define GTP_EXT_HDR_PDCP_SN 0xC0
374
375 static const value_string next_extension_header_fieldvals[] = {
376     {   0, "No more extension headers"},
377     {   1, "MBMS support indication"},
378     {   2, "MS Info Change Reporting support indication"},
379     {GTP_EXT_HDR_PDCP_SN, "PDCP PDU number"},
380     {0xc1, "Suspend Request"},
381     {0xc2, "Suspend Response"},
382     {0, NULL}
383 };
384
385 /* Definition of 3G charging characteristics masks */
386 #define GTP_MASK_CHRG_CHAR_S    0xF000
387 #define GTP_MASK_CHRG_CHAR_N    0x0800
388 #define GTP_MASK_CHRG_CHAR_P    0x0400
389 #define GTP_MASK_CHRG_CHAR_F    0x0200
390 #define GTP_MASK_CHRG_CHAR_H    0x0100
391 #define GTP_MASK_CHRG_CHAR_R    0x00FF
392
393 /* Traffic Flow Templates  mask */
394 #define GTPv1_TFT_CODE_MASK 0xE0
395 #define GTPv1_TFT_SPARE_MASK    0x10
396 #define GTPv1_TFT_NUMBER_MASK   0x0F
397
398 /* Definition of GSN Address masks */
399 #define GTP_EXT_GSN_ADDR_TYPE_MASK      0xC0
400 #define GTP_EXT_GSN_ADDR_LEN_MASK       0x3F
401
402 /* Definition of QoS masks */
403 #define GTP_EXT_QOS_SPARE1_MASK                 0xC0
404 #define GTP_EXT_QOS_DELAY_MASK                  0x38
405 #define GTP_EXT_QOS_RELIABILITY_MASK            0x07
406 #define GTP_EXT_QOS_PEAK_MASK                   0xF0
407 #define GTP_EXT_QOS_SPARE2_MASK                 0x08
408 #define GTP_EXT_QOS_PRECEDENCE_MASK             0x07
409 #define GTP_EXT_QOS_SPARE3_MASK                 0xE0
410 #define GTP_EXT_QOS_MEAN_MASK                   0x1F
411 #define GTP_EXT_QOS_TRAF_CLASS_MASK             0xE0
412 #define GTP_EXT_QOS_DEL_ORDER_MASK              0x18
413 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK            0x07
414 #define GTP_EXT_QOS_RES_BER_MASK                0xF0
415 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK          0x0F
416 #define GTP_EXT_QOS_TRANS_DELAY_MASK            0xFC
417 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK    0x03
418 #define GTP_EXT_QOS_SRC_STAT_DESC_MASK          0x0F
419 #define GTP_EXT_QOS_SIG_IND_MASK                0x10
420
421 /* Definition of Radio Priority's masks */
422 #define GTPv1_EXT_RP_NSAPI_MASK         0xF0
423 #define GTPv1_EXT_RP_SPARE_MASK         0x08
424 #define GTPv1_EXT_RP_MASK               0x07
425
426 static const value_string gtp_message_type[] = {
427     {GTP_MSG_UNKNOWN,             "For future use"},
428     {GTP_MSG_ECHO_REQ,            "Echo request"},
429     {GTP_MSG_ECHO_RESP,           "Echo response"},
430     {GTP_MSG_VER_NOT_SUPP,        "Version not supported"},
431     {GTP_MSG_NODE_ALIVE_REQ,      "Node alive request"},
432     {GTP_MSG_NODE_ALIVE_RESP,     "Node alive response"},
433     {GTP_MSG_REDIR_REQ,           "Redirection request"},
434     {GTP_MSG_REDIR_RESP,          "Redirection response"},
435     /*
436      * 8-15 For future use. Shall not be sent. If received,
437      * shall be treated as an Unknown message.
438      */
439 #if 0
440     {   8,                        "Unknown message(For future use)"},
441     {   9,                        "Unknown message(For future use)"},
442     {  10,                        "Unknown message(For future use)"},
443     {  11,                        "Unknown message(For future use)"},
444     {  12,                        "Unknown message(For future use)"},
445     {  13,                        "Unknown message(For future use)"},
446     {  14,                        "Unknown message(For future use)"},
447     {  15,                        "Unknown message(For future use)"},
448 #endif
449     {GTP_MSG_CREATE_PDP_REQ,      "Create PDP context request"},
450     {GTP_MSG_CREATE_PDP_RESP,     "Create PDP context response"},
451     {GTP_MSG_UPDATE_PDP_REQ,      "Update PDP context request"},
452     {GTP_MSG_UPDATE_PDP_RESP,     "Update PDP context response"},
453     {GTP_MSG_DELETE_PDP_REQ,      "Delete PDP context request"},
454     {GTP_MSG_DELETE_PDP_RESP,     "Delete PDP context response"},
455     {GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ,   "Initiate PDP Context Activation Request"},
456     {GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP,  "Initiate PDP Context Activation Response"},
457 /*
458  * 24-25 For future use. Shall not be sent. If received,
459  * shall be treated as an Unknown message.
460  */
461     {GTP_MSG_DELETE_AA_PDP_REQ,   "Delete AA PDP Context Request"},
462     {GTP_MSG_DELETE_AA_PDP_RESP,  "Delete AA PDP Context Response"},
463     {GTP_MSG_ERR_IND,             "Error indication"},
464     {GTP_MSG_PDU_NOTIFY_REQ,      "PDU notification request"},
465     {GTP_MSG_PDU_NOTIFY_RESP,     "PDU notification response"},
466     {GTP_MSG_PDU_NOTIFY_REJ_REQ,  "PDU notification reject request"},
467     {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
468     {GTP_MSG_SUPP_EXT_HDR,        "Supported extension header notification"},
469     {GTP_MSG_SEND_ROUT_INFO_REQ,  "Send routing information for GPRS request"},
470     {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
471     {GTP_MSG_FAIL_REP_REQ,        "Failure report request"},
472     {GTP_MSG_FAIL_REP_RESP,       "Failure report response"},
473     {GTP_MSG_MS_PRESENT_REQ,      "Note MS GPRS present request"},
474     {GTP_MSG_MS_PRESENT_RESP,     "Note MS GPRS present response"},
475     /* 38-47 For future use. Shall not be sent. If received,
476      * shall be treated as an Unknown message.
477      */
478 #if 0
479     {  38,                        "Unknown message(For future use)"},
480     {  39,                        "Unknown message(For future use)"},
481     {  40,                        "Unknown message(For future use)"},
482     {  41,                        "Unknown message(For future use)"},
483     {  42,                        "Unknown message(For future use)"},
484     {  43,                        "Unknown message(For future use)"},
485     {  44,                        "Unknown message(For future use)"},
486     {  45,                        "Unknown message(For future use)"},
487     {  46,                        "Unknown message(For future use)"},
488     {  47,                        "Unknown message(For future use)"},
489 #endif
490     {GTP_MSG_IDENT_REQ,           "Identification request"},
491     {GTP_MSG_IDENT_RESP,          "Identification response"},
492     {GTP_MSG_SGSN_CNTXT_REQ,      "SGSN context request"},
493     {GTP_MSG_SGSN_CNTXT_RESP,     "SGSN context response"},
494     {GTP_MSG_SGSN_CNTXT_ACK,      "SGSN context acknowledgement"},
495     {GTP_MSG_FORW_RELOC_REQ,      "Forward relocation request"},
496     {GTP_MSG_FORW_RELOC_RESP,     "Forward relocation response"},
497     {GTP_MSG_FORW_RELOC_COMP,     "Forward relocation complete"},
498     {GTP_MSG_RELOC_CANCEL_REQ,    "Relocation cancel request"},
499     {GTP_MSG_RELOC_CANCEL_RESP,   "Relocation cancel response"},
500     {GTP_MSG_FORW_SRNS_CNTXT,     "Forward SRNS context"},
501     {GTP_MSG_FORW_RELOC_ACK,      "Forward relocation complete acknowledge"},
502     {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
503     /* 61-69 For future use. Shall not be sent. If received,
504      * shall be treated as an Unknown message.
505      */
506 #if 0
507     {  61,                        "Unknown message(For future use)"},
508     {  62,                        "Unknown message(For future use)"},
509     {  63,                        "Unknown message(For future use)"},
510     {  64,                        "Unknown message(For future use)"},
511     {  65,                        "Unknown message(For future use)"},
512     {  66,                        "Unknown message(For future use)"},
513     {  67,                        "Unknown message(For future use)"},
514     {  68,                        "Unknown message(For future use)"},
515     {  69,                        "Unknown message(For future use)"},
516 #endif
517     {GTP_MSG_RAN_INFO_RELAY,      "RAN Information Relay"},
518     /* 71-95 For future use. Shall not be sent. If received,
519      * shall be treated as an Unknown message.
520      */
521 #if 0
522     {  71,                        "Unknown message(For future use)"},
523     {  72,                        "Unknown message(For future use)"},
524     {  73,                        "Unknown message(For future use)"},
525     {  74,                        "Unknown message(For future use)"},
526     {  75,                        "Unknown message(For future use)"},
527     {  76,                        "Unknown message(For future use)"},
528     {  77,                        "Unknown message(For future use)"},
529     {  78,                        "Unknown message(For future use)"},
530     {  79,                        "Unknown message(For future use)"},
531     {  80,                        "Unknown message(For future use)"},
532     {  81,                        "Unknown message(For future use)"},
533     {  82,                        "Unknown message(For future use)"},
534     {  83,                        "Unknown message(For future use)"},
535     {  84,                        "Unknown message(For future use)"},
536     {  85,                        "Unknown message(For future use)"},
537     {  86,                        "Unknown message(For future use)"},
538     {  87,                        "Unknown message(For future use)"},
539     {  88,                        "Unknown message(For future use)"},
540     {  89,                        "Unknown message(For future use)"},
541     {  90,                        "Unknown message(For future use)"},
542     {  91,                        "Unknown message(For future use)"},
543     {  92,                        "Unknown message(For future use)"},
544     {  93,                        "Unknown message(For future use)"},
545     {  94,                        "Unknown message(For future use)"},
546     {  95,                        "Unknown message(For future use)"},
547 #endif
548     {GTP_MBMS_NOTIFY_REQ,         "MBMS Notification Request"},
549     {GTP_MBMS_NOTIFY_RES,         "MBMS Notification Response"},
550     {GTP_MBMS_NOTIFY_REJ_REQ,     "MBMS Notification Reject Request"},
551     {GTP_MBMS_NOTIFY_REJ_RES,     "MBMS Notification Reject Response"},
552     {GTP_CREATE_MBMS_CNTXT_REQ,   "Create MBMS Context Request"},
553     {GTP_CREATE_MBMS_CNTXT_RES,   "Create MBMS Context Response"},
554     {GTP_UPD_MBMS_CNTXT_REQ,      "Update MBMS Context Request"},
555     {GTP_UPD_MBMS_CNTXT_RES,      "Update MBMS Context Response"},
556     {GTP_DEL_MBMS_CNTXT_REQ,      "Delete MBMS Context Request"},
557     {GTP_DEL_MBMS_CNTXT_RES,      "Delete MBMS Context Response"},
558     /* 106 - 111 For future use. Shall not be sent. If received,
559      * shall be treated as an Unknown message.
560      */
561 #if 0
562     {  106,                       "Unknown message(For future use)"},
563     {  107,                       "Unknown message(For future use)"},
564     {  108,                       "Unknown message(For future use)"},
565     {  109,                       "Unknown message(For future use)"},
566     {  110,                       "Unknown message(For future use)"},
567     {  111,                       "Unknown message(For future use)"},
568 #endif
569     {GTP_MBMS_REG_REQ,            "MBMS Registration Request"},
570     {GTP_MBMS_REG_RES,            "MBMS Registration Response"},
571     {GTP_MBMS_DE_REG_REQ,         "MBMS De-Registration Request"},
572     {GTP_MBMS_DE_REG_RES,         "MBMS De-Registration Response"},
573     {GTP_MBMS_SES_START_REQ,      "MBMS Session Start Request"},
574     {GTP_MBMS_SES_START_RES,      "MBMS Session Start Response"},
575     {GTP_MBMS_SES_STOP_REQ,       "MBMS Session Stop Request"},
576     {GTP_MBMS_SES_STOP_RES,       "MBMS Session Stop Response"},
577     {GTP_MBMS_SES_UPD_REQ,        "MBMS Session Update Request"},
578     {GTP_MBMS_SES_UPD_RES,        "MBMS Session Update Response"},
579     /* 122-127 For future use. Shall not be sent.
580      * If received, shall be treated as an Unknown message.
581      */
582 #if 0
583     {  122,                       "Unknown message(For future use)"},
584     {  123,                       "Unknown message(For future use)"},
585     {  124,                       "Unknown message(For future use)"},
586     {  125,                       "Unknown message(For future use)"},
587     {  126,                       "Unknown message(For future use)"},
588     {  127,                       "Unknown message(For future use)"},
589 #endif
590         {GTP_MS_INFO_CNG_NOT_REQ,     "MS Info Change Notification Request"},
591     {GTP_MS_INFO_CNG_NOT_RES,     "MS Info Change Notification Response"},
592     /* 130-239 For future use. Shall not be sent. If received,
593      * shall be treated as an Unknown message.
594      */
595 #if 0
596     {  130,                       "Unknown message(For future use)"},
597     {  131,                       "Unknown message(For future use)"},
598     {  132,                       "Unknown message(For future use)"},
599     {  133,                       "Unknown message(For future use)"},
600     {  134,                       "Unknown message(For future use)"},
601     {  135,                       "Unknown message(For future use)"},
602     {  136,                       "Unknown message(For future use)"},
603     {  137,                       "Unknown message(For future use)"},
604     {  138,                       "Unknown message(For future use)"},
605     {  139,                       "Unknown message(For future use)"},
606     {  140,                       "Unknown message(For future use)"},
607     {  141,                       "Unknown message(For future use)"},
608     {  142,                       "Unknown message(For future use)"},
609     {  143,                       "Unknown message(For future use)"},
610     {  144,                       "Unknown message(For future use)"},
611     {  145,                       "Unknown message(For future use)"},
612     {  146,                       "Unknown message(For future use)"},
613     {  147,                       "Unknown message(For future use)"},
614     {  148,                       "Unknown message(For future use)"},
615     {  149,                       "Unknown message(For future use)"},
616     {  150,                       "Unknown message(For future use)"},
617     {  151,                       "Unknown message(For future use)"},
618     {  152,                       "Unknown message(For future use)"},
619     {  153,                       "Unknown message(For future use)"},
620     {  154,                       "Unknown message(For future use)"},
621     {  155,                       "Unknown message(For future use)"},
622     {  156,                       "Unknown message(For future use)"},
623     {  157,                       "Unknown message(For future use)"},
624     {  158,                       "Unknown message(For future use)"},
625     {  159,                       "Unknown message(For future use)"},
626 #endif
627     {GTP_MSG_DATA_TRANSF_REQ,     "Data record transfer request"},
628     {GTP_MSG_DATA_TRANSF_RESP,    "Data record transfer response"},
629     /* 242-253 For future use. Shall not be sent. If received,
630      * shall be treated as an Unknown message.
631      */
632 #if 0
633     {  242,                       "Unknown message(For future use)"},
634     {  243,                       "Unknown message(For future use)"},
635     {  244,                       "Unknown message(For future use)"},
636     {  245,                       "Unknown message(For future use)"},
637     {  246,                       "Unknown message(For future use)"},
638     {  247,                       "Unknown message(For future use)"},
639     {  248,                       "Unknown message(For future use)"},
640     {  249,                       "Unknown message(For future use)"},
641     {  250,                       "Unknown message(For future use)"},
642     {  251,                       "Unknown message(For future use)"},
643     {  252,                       "Unknown message(For future use)"},
644     {  253,                       "Unknown message(For future use)"},
645 #endif
646     {GTP_MSG_END_MARKER,          "End Marker"},
647     {GTP_MSG_TPDU,                "T-PDU"},
648     {0, NULL}
649 };
650 static value_string_ext gtp_message_type_ext = VALUE_STRING_EXT_INIT(gtp_message_type);
651
652 /* definitions of fields in extension header */
653 #define GTP_EXT_CAUSE                 0x01
654 #define GTP_EXT_IMSI                  0x02
655 #define GTP_EXT_RAI                   0x03
656 #define GTP_EXT_TLLI                  0x04
657 #define GTP_EXT_PTMSI                 0x05
658 #define GTP_EXT_QOS_GPRS              0x06
659 #define GTP_EXT_REORDER               0x08
660 #define GTP_EXT_AUTH_TRI              0x09
661 #define GTP_EXT_MAP_CAUSE             0x0B
662 #define GTP_EXT_PTMSI_SIG             0x0C
663 #define GTP_EXT_MS_VALID              0x0D
664 #define GTP_EXT_RECOVER               0x0E
665 #define GTP_EXT_SEL_MODE              0x0F
666
667 #define GTP_EXT_16                    0x10
668 #define GTP_EXT_FLOW_LABEL            0x10
669 #define GTP_EXT_TEID                  0x10    /* 0xFF10 3G */
670
671 #define GTP_EXT_17                    0x11
672 #define GTP_EXT_FLOW_SIG              0x11
673 #define GTP_EXT_TEID_CP               0x11    /* 0xFF11 3G */
674
675 #define GTP_EXT_18                    0x12
676 #define GTP_EXT_FLOW_II               0x12
677 #define GTP_EXT_TEID_II               0x12    /* 0xFF12 3G */
678
679 #define GTP_EXT_19                    0x13    /* 19 TV Teardown Ind 7.7.16 */
680 #define GTP_EXT_MS_REASON             0x13    /* same as 0x1D GTPv1_EXT_MS_REASON */
681 #define GTP_EXT_TEAR_IND              0x13    /* 0xFF13 3G */
682
683 #define GTP_EXT_NSAPI                 0x14    /* 3G */
684 #define GTP_EXT_RANAP_CAUSE           0x15    /* 3G */
685 #define GTP_EXT_RAB_CNTXT             0x16    /* 3G */
686 #define GTP_EXT_RP_SMS                0x17    /* 3G */
687 #define GTP_EXT_RP                    0x18    /* 3G */
688 #define GTP_EXT_PKT_FLOW_ID           0x19    /* 3G */
689 #define GTP_EXT_CHRG_CHAR             0x1A    /* 3G */
690 #define GTP_EXT_TRACE_REF             0x1B    /* 3G */
691 #define GTP_EXT_TRACE_TYPE            0x1C    /* 3G */
692 #define GTPv1_EXT_MS_REASON           0x1D    /* 3G 29 TV MS Not Reachable Reason 7.7.25A */
693 /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
694 #define GTP_EXT_TR_COMM               0x7E    /* charging */
695 #define GTP_EXT_CHRG_ID               0x7F    /* 127 TV Charging ID 7.7.26 */
696 #define GTP_EXT_USER_ADDR             0x80
697 #define GTP_EXT_MM_CNTXT              0x81
698 #define GTP_EXT_PDP_CNTXT             0x82
699 #define GTP_EXT_APN                   0x83
700 #define GTP_EXT_PROTO_CONF            0x84
701 #define GTP_EXT_GSN_ADDR              0x85
702 #define GTP_EXT_MSISDN                0x86
703 #define GTP_EXT_QOS_UMTS              0x87    /* 3G */
704 #define GTP_EXT_AUTH_QUI              0x88    /* 3G */
705 #define GTP_EXT_TFT                   0x89    /* 3G */
706 #define GTP_EXT_TARGET_ID             0x8A    /* 3G */
707 #define GTP_EXT_UTRAN_CONT            0x8B    /* 3G */
708 #define GTP_EXT_RAB_SETUP             0x8C    /* 3G */
709 #define GTP_EXT_HDR_LIST              0x8D    /* 3G */
710 #define GTP_EXT_TRIGGER_ID            0x8E    /* 3G   142 7.7.41 */
711 #define GTP_EXT_OMC_ID                0x8F    /* 3G   143 TLV OMC Identity 7.7.42 */
712 #define GTP_EXT_RAN_TR_CONT           0x90    /* 3G   144 TLV RAN Transparent Container 7.7.43 */
713 #define GTP_EXT_PDP_CONT_PRIO         0x91    /* 3G   145 TLV PDP Context Prioritization 7.7.45 */
714 #define GTP_EXT_ADD_RAB_SETUP_INF     0x92    /* 3G   146 TLV Additional RAB Setup Information 7.7.45A */
715 #define GTP_EXT_SSGN_NO               0x93    /* 3G   147 TLV SGSN Number 7.7.47 */
716 #define GTP_EXT_COMMON_FLGS           0x94    /* 3G   148 TLV Common Flags 7.7.48 */
717 #define GTP_EXT_APN_RES               0x95    /* 3G   149 */
718 #define GTP_EXT_RA_PRIO_LCS           0x96    /* 3G   150 TLV Radio Priority LCS 7.7.25B */
719 #define GTP_EXT_RAT_TYPE              0x97    /* 3G   151 TLV RAT Type 7.7.50 */
720 #define GTP_EXT_USR_LOC_INF           0x98    /* 3G   152 TLV User Location Information 7.7.51 */
721 #define GTP_EXT_MS_TIME_ZONE          0x99    /* 3G   153 TLV MS Time Zone 7.7.52 */
722 #define GTP_EXT_IMEISV                0x9A    /* 3G   154 TLV IMEI(SV) 7.7.53 */
723 #define GTP_EXT_CAMEL_CHG_INF_CON     0x9B    /* 3G   155 TLV CAMEL Charging Information Container 7.7.54 */
724 #define GTP_EXT_MBMS_UE_CTX           0x9C    /* 3G   156 TLV MBMS UE Context 7.7.55 */
725 #define GTP_EXT_TMGI                  0x9D    /* 3G   157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
726 #define GTP_EXT_RIM_RA                0x9E    /* 3G   158 TLV RIM Routing Address 7.7.57 */
727 #define GTP_EXT_MBMS_PROT_CONF_OPT    0x9F    /* 3G   159 TLV MBMS Protocol Configuration Options 7.7.58 */
728 #define GTP_EXT_MBMS_SA               0xA0    /* 3G   160 TLV MBMS Service Area 7.7.60 */
729 #define GTP_EXT_SRC_RNC_PDP_CTX_INF   0xA1    /* 3G   161 TLV Source RNC PDCP context info 7.7.61 */
730 #define GTP_EXT_ADD_TRS_INF           0xA2    /* 3G   162 TLV Additional Trace Info 7.7.62 */
731 #define GTP_EXT_HOP_COUNT             0xA3    /* 3G   163 TLV Hop Counter 7.7.63 */
732 #define GTP_EXT_SEL_PLMN_ID           0xA4    /* 3G   164 TLV Selected PLMN ID 7.7.64 */
733 #define GTP_EXT_MBMS_SES_ID           0xA5    /* 3G   165 TLV MBMS Session Identifier 7.7.65 */
734 #define GTP_EXT_MBMS_2G_3G_IND        0xA6    /* 3G   166 TLV MBMS 2G/3G Indicator 7.7.66 */
735 #define GTP_EXT_ENH_NSAPI             0xA7    /* 3G   167 TLV Enhanced NSAPI 7.7.67 */
736 #define GTP_EXT_MBMS_SES_DUR          0xA8    /* 3G   168 TLV MBMS Session Duration 7.7.59 */
737 #define GTP_EXT_ADD_MBMS_TRS_INF      0xA9    /* 3G   169 TLV Additional MBMS Trace Info 7.7.68 */
738 #define GTP_EXT_MBMS_SES_ID_REP_NO    0xAA    /* 3G   170 TLV MBMS Session Identity Repetition Number 7.7.69 */
739 #define GTP_EXT_MBMS_TIME_TO_DATA_TR  0xAB    /* 3G   171 TLV MBMS Time To Data Transfer 7.7.70 */
740 #define GTP_EXT_PS_HO_REQ_CTX         0xAC    /* 3G   172 TLV PS Handover Request Context 7.7.71 */
741 #define GTP_EXT_BSS_CONT              0xAD    /* 3G   173 TLV BSS Container 7.7.72 */
742 #define GTP_EXT_CELL_ID               0xAE    /* 3G   174 TLV Cell Identification 7.7.73 */
743 #define GTP_EXT_PDU_NO                0xAF    /* 3G   175 TLV PDU Numbers 7.7.74 */
744 #define GTP_EXT_BSSGP_CAUSE           0xB0    /* 3G   176 TLV BSSGP Cause 7.7.75 */
745 #define GTP_EXT_REQ_MBMS_BEARER_CAP   0xB1    /* 3G   177 TLV Required MBMS bearer capabilities       7.7.76 */
746 #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2    /* 3G   178 TLV RIM Routing Address Discriminator       7.7.77 */
747 #define GTP_EXT_LIST_OF_SETUP_PFCS    0xB3    /* 3G   179 TLV List of set-up PFCs     7.7.78 */
748 #define GTP_EXT_PS_HANDOVER_XIP_PAR   0xB4    /* 3G   180 TLV PS Handover XID Parameters      7.7.79 */
749 #define GTP_EXT_MS_INF_CHG_REP_ACT    0xB5    /* 3G   181 TLV MS Info Change Reporting Action 7.7.80 */
750 #define GTP_EXT_DIRECT_TUNNEL_FLGS    0xB6    /* 3G   182 TLV Direct Tunnel Flags     7.7.81 */
751 #define GTP_EXT_CORRELATION_ID        0xB7    /* 3G   183 TLV Correlation-ID  7.7.82 */
752 #define GTP_EXT_BEARER_CONTROL_MODE   0xB8    /* 3G   184 TLV Bearer Control Mode     7.7.83 */
753                                               /* 3G   185 TLV MBMS Flow Identifier    7.7.84 */
754                                               /* 3G   186 TLV MBMS IP Multicast Distribution    7.7.85 */
755                                               /* 3G   187 TLV MBMS Distribution Acknowledgement 7.7.86 */
756                                               /* 3G   188 TLV Reliable INTER RAT HANDOVER INFO  7.7.87 */
757                                               /* 3G   189 TLV RFSP Index        7.7.88 */
758                                               /* 3G   190 TLV Fully Qualified Domain Name (FQDN)        7.7.90 */
759 #define GTP_EXT_EVO_ALLO_RETE_P1      0xBF    /* 3G   191 TLV Evolved Allocation/Retention Priority I   7.7.91 */
760                                               /* 3G   192 TLV Evolved Allocation/Retention Priority II  7.7.92 */
761                                               /* 3G   193 TLV Extended Common Flags     7.7.93 */
762                                               /* 3G   194 TLV User CSG Information (UCI)        7.7.94 */
763                                               /* 3G   195 TLV CSG Information Reporting Action  7.7.95 */
764                                               /* 3G   196 TLV CSG ID    7.7.96 */
765                                               /* 3G   197 TLV CSG Membership Indication (CMI)   7.7.97 */
766                                               /* 3G   198 TLV Aggregate Maximum Bit Rate (AMBR) 7.7.98 */
767                                               /* 3G   199 TLV UE Network Capability     7.7.99 */
768                                               /* 3G   200 TLV UE-AMBR   7.7.100 */
769                                               /* 3G   201 TLV APN-AMBR with NSAPI       7.7.101 */
770                                               /* 3G   202 TLV GGSN Back-Off Time 7.7.102 */
771                                               /* 3G   203 TLV Signalling Priority Indication 7.7.103 */
772                                               /* 3G   204 TLV Signalling Priority Indication with NSAPI 7.7.104 */
773                                               /* 3G   205 TLV Higher bitrates than 16 Mbps flag 7.7.105 */
774                                               /* 3G   206 TLV Max MBR/APN-AMBR 7.7.106 */
775                                               /* 3G   207 TLV Additional MM context for SRVCC 7.7.107 */
776                                               /* 3G   208 TLV Additional flags for SRVCC 7.7.108  */
777                                               /* 3G   209 TLV STN-SR 7.7.109  */
778                                               /* 3G   210 TLV C-MSISDN 7.7.110  */
779                                               /* 3G   211 TLV Extended RANAP Cause 7.7.111  */
780                                               /*  212-238 TLV Spare. For future use.     */
781
782 /* 239-250  Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
783
784 #define GTP_EXT_C1                    0xC1
785 #define GTP_EXT_C2                    0xC2
786 #define GTP_EXT_REL_PACK              0xF9    /* charging */
787 #define GTP_EXT_CAN_PACK              0xFA    /* charging */
788 #define GTP_EXT_CHRG_ADDR             0xFB    /* 3G   251     TLV     Charging Gateway Address        7.7.44 */
789 /* 252-254  Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
790 #define GTP_EXT_DATA_REQ              0xFC    /* charging */
791 #define GTP_EXT_DATA_RESP             0xFD    /* charging */
792 #define GTP_EXT_NODE_ADDR             0xFE    /* charging */
793 #define GTP_EXT_PRIV_EXT              0xFF
794
795 static const value_string gtp_val[] = {
796     {GTP_EXT_CAUSE, "Cause of operation"},
797     {GTP_EXT_IMSI, "IMSI"},
798     {GTP_EXT_RAI, "Routing Area Identity"},
799     {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
800     {GTP_EXT_PTMSI, "Packet TMSI"},
801 /*   6 */  {GTP_EXT_QOS_GPRS, "Quality of Service"},
802     /* 6-7 Spare */
803 /*   8 */  {GTP_EXT_REORDER, "Reorder required"},
804 /*   9 */  {GTP_EXT_AUTH_TRI, "Authentication triplets"},
805         /* 10 Spare */
806 /*  11 */  {GTP_EXT_MAP_CAUSE, "MAP cause"},
807 /*  12 */  {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
808 /*  13 */  {GTP_EXT_MS_VALID, "MS validated"},
809 /*  14 */  {GTP_EXT_RECOVER, "Recovery"},
810 /*  15 */  {GTP_EXT_SEL_MODE, "Selection mode"},
811
812 /*  16 */  {GTP_EXT_16, "Flow label data I"},
813 /*  16 */  {GTP_EXT_FLOW_LABEL, "Flow label data I"},
814 /*  16 */  {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"},    /* 3G */
815
816     {GTP_EXT_17, "Flow label signalling"},
817     {GTP_EXT_FLOW_SIG, "Flow label signalling"},
818     {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
819
820     {GTP_EXT_18, "Flow label data II"},
821     {GTP_EXT_FLOW_II, "Flow label data II"},
822     {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"},    /* 3G */
823
824     {GTP_EXT_19, "MS not reachable reason"},
825     {GTP_EXT_MS_REASON, "MS not reachable reason"},
826     {GTP_EXT_TEAR_IND, "Teardown ID"},  /* 3G */
827
828     {GTP_EXT_NSAPI, "NSAPI"},   /* 3G */
829     {GTP_EXT_RANAP_CAUSE, "RANAP cause"},   /* 3G */
830     {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
831     {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"},  /* 3G */
832     {GTP_EXT_RP, "Radio Priority"}, /* 3G */
833     {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"},    /* 3G */
834     {GTP_EXT_CHRG_CHAR, "Charging characteristics"},    /* 3G */
835     {GTP_EXT_TRACE_REF, "Trace references"},    /* 3G */
836     {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
837 /*  29 */  {GTPv1_EXT_MS_REASON, "MS not reachable reason"},   /* 3G */
838     /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
839 /* 126 */  {GTP_EXT_TR_COMM, "Packet transfer command"},   /* charging */
840 /* 127 */  {GTP_EXT_CHRG_ID, "Charging ID"},
841     {GTP_EXT_USER_ADDR, "End user address"},
842     {GTP_EXT_MM_CNTXT, "MM context"},
843     {GTP_EXT_PDP_CNTXT, "PDP context"},
844     {GTP_EXT_APN, "Access Point Name"},
845     {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
846     {GTP_EXT_GSN_ADDR, "GSN address"},
847     {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
848     {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"},    /* 3G */
849     {GTP_EXT_AUTH_QUI, "Authentication quintuplets"},   /* 3G */
850     {GTP_EXT_TFT, "Traffic Flow Template (TFT)"},   /* 3G */
851     {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
852     {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"},    /* 3G */
853     {GTP_EXT_RAB_SETUP, "RAB setup information"},   /* 3G */
854     {GTP_EXT_HDR_LIST, "Extension Header Types List"},  /* 3G */
855     {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
856     {GTP_EXT_OMC_ID, "OMC Identity"},   /* 3G */
857
858     {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
859     {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"},  /* 7.7.45 */
860     {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"},    /* 7.7.45A */
861     {GTP_EXT_SSGN_NO, "SGSN Number"},   /* 7.7.47 */
862     {GTP_EXT_COMMON_FLGS, "Common Flags"},  /* 7.7.48 */
863     {GTP_EXT_APN_RES, "APN Restriction"},   /* 3G */
864     {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"},    /* 7.7.25B */
865     {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
866     {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
867     {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
868
869     {GTP_EXT_IMEISV, "IMEI(SV)"},   /* 3G */
870     {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"},    /* 7.7.54 */
871     {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"},   /* 7.7.55 */
872     {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"},   /* 7.7.56 */
873     {GTP_EXT_RIM_RA, "RIM Routing Address"},    /* 7.7.57 */
874     {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"},    /* 7.7.58 */
875     {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
876     {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"},  /* 7.7.61 */
877     {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
878     {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
879     {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"},  /* 7.7.64 */
880     {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"},   /* 7.7.65 */
881     {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"},   /* 7.7.66 */
882     {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"},  /* 7.7.67 */
883     {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"},    /* 7.7.59 */
884     {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"},   /* 7.7.68 */
885     {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"},    /* 7.7.69 */
886     {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"},   /* 7.7.70 */
887     {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
888     {GTP_EXT_BSS_CONT, "BSS Container"},    /* 7.7.72 */
889     {GTP_EXT_CELL_ID, "Cell Identification"},   /* 7.7.73 */
890     {GTP_EXT_PDU_NO, "PDU Numbers"},    /* 7.7.74 */
891     {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"},   /* 7.7.75 */
892     {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
893     {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"},   /* 7.7.77 */
894     {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"},    /* 7.7.78 */
895     {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"},    /* 7.7.79 */
896     {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"},    /* 7.7.80 */
897     {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"},    /* 7.7.81 */
898     {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
899     {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"},   /* 7.7.83 */
900     {185, "MBMS Flow Identifier"},   /* 7.7.84 */
901     {186, "MBMS IP Multicast Distribution"},   /* 7.7.85 */
902     {187, "MBMS Distribution Acknowledgement"},   /* 7.7.86 */
903     {188, "Reliable INTER RAT HANDOVER INFO"},   /* 7.7.87 */
904     {189, "RFSP Index"},   /* 7.7.88 */
905     {190, "Fully Qualified Domain Name (FQDN)"},   /* 7.7.90 */
906     {GTP_EXT_EVO_ALLO_RETE_P1, "Evolved Allocation/Retention Priority I"},   /* 7.7.91 */
907     {192, "Evolved Allocation/Retention Priority II"},   /* 7.7.92 */
908     {193, "Extended Common Flags"},   /* 7.7.93 */
909     {194, "User CSG Information (UCI)"},   /* 7.7.94 */
910     {195, "CSG Information Reporting Action"},   /* 7.7.95 */
911     {196, "CSG ID"},   /* 7.7.96 */
912     {197, "CSG Membership Indication (CMI)"},   /* 7.7.97 */
913     {198, "Aggregate Maximum Bit Rate (AMBR)"},   /* 7.7.98 */
914     {199, "UE Network Capability"},   /* 7.7.99 */
915     {200, "UE-AMBR"},   /* 7.7.100 */
916     {201, "APN-AMBR with NSAPI"},   /* 7.7.101 */
917     {202, "GGSN Back-Off Time"},   /* 7.7.102 */
918     {203, "Signalling Priority Indication"},   /* 7.7.103 */
919     {204, "Signalling Priority Indication with NSAPI"},   /* 7.7.104 */
920     {205, "Higher bitrates than 16 Mbps flag"},   /* 7.7.105  */
921     {206, "Max MBR/APN-AMBR"},   /* 7.7.106  */
922     {207, "Additional MM context for SRVCC"},   /* 7.7.107  */
923     {208, "Additional flags for SRVCC"},   /* 7.7.108  */
924     {209, "STN-SR"},   /* 7.7.109  */
925     {210, "C-MSISDN"},   /* 7.7.110  */
926     {211, "Extended RANAP Cause"},   /* 7.7.111  */
927         /* 212-238 TLV Spare. For future use. */
928         /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
929 /* 249 */  {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"},  /* charging */
930 /* 250 */  {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"},  /* charging */
931 /* 251 */  {GTP_EXT_CHRG_ADDR, "Charging Gateway address"}, /* 7.7.44 */
932         /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
933 /* 252 */  {GTP_EXT_DATA_REQ, "Data record packet"},   /* charging */
934 /* 253 */  {GTP_EXT_DATA_RESP, "Requests responded"},  /* charging */
935 /* 254 */  {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
936 /* 255 */  {GTP_EXT_PRIV_EXT, "Private Extension"},
937     {0, NULL}
938 };
939 static value_string_ext gtp_val_ext = VALUE_STRING_EXT_INIT(gtp_val);
940
941 /* It seems like some IE's are renamed in gtpv1 at least reading
942  * 3GPP TS 29.060 version 6.11.0 Release 6
943  */
944 static const value_string gtpv1_val[] = {
945 /*   1 */  {GTP_EXT_CAUSE, "Cause of operation"},
946 /*   2 */  {GTP_EXT_IMSI, "IMSI"},
947 /*   3 */  {GTP_EXT_RAI, "Routing Area Identity"},
948 /*   4 */  {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
949 /*   5 */  {GTP_EXT_PTMSI, "Packet TMSI"},
950 /*   6 */  {GTP_EXT_QOS_GPRS, "Quality of Service"},
951     /* 6-7 Spare */
952 /*   7 */  {7, "Spare"},
953 /*   8 */  {GTP_EXT_REORDER, "Reorder required"},
954 /*   9 */  {GTP_EXT_AUTH_TRI, "Authentication triplets"},
955         /* 10 Spare */
956 /*  10 */  {10, "Spare"},
957 /*  11 */  {GTP_EXT_MAP_CAUSE, "MAP cause"},
958 /*  12 */  {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
959 /*  13 */  {GTP_EXT_MS_VALID, "MS validated"},
960 /*  14 */  {GTP_EXT_RECOVER, "Recovery"},
961 /*  15 */  {GTP_EXT_SEL_MODE, "Selection mode"},
962 /*  16 */  {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"},    /* 3G */
963 /*  17 */  {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
964 /*  18 */  {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"},    /* 3G */
965 /*  19 */  {GTP_EXT_TEAR_IND, "Teardown ID"},  /* 3G */
966
967 /*  20 */  {GTP_EXT_NSAPI, "NSAPI"},   /* 3G */
968 /*  21 */  {GTP_EXT_RANAP_CAUSE, "RANAP cause"},   /* 3G */
969 /*  22 */  {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
970 /*  23 */  {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"},  /* 3G */
971 /*  24 */  {GTP_EXT_RP, "Radio Priority"}, /* 3G */
972 /*  25 */  {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"},    /* 3G */
973 /*  26 */  {GTP_EXT_CHRG_CHAR, "Charging characteristics"},    /* 3G */
974 /*  27 */  {GTP_EXT_TRACE_REF, "Trace references"},    /* 3G */
975 /*  28 */  {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
976 /*  29 */  {GTPv1_EXT_MS_REASON, "MS not reachable reason"},   /* 3G */
977     /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
978 /* 126 */  {GTP_EXT_TR_COMM, "Packet transfer command"},   /* charging */
979 /* 127 */  {GTP_EXT_CHRG_ID, "Charging ID"},
980
981 /* 128 */  {GTP_EXT_USER_ADDR, "End user address"},
982 /* 129 */  {GTP_EXT_MM_CNTXT, "MM context"},
983 /* 130 */  {GTP_EXT_PDP_CNTXT, "PDP context"},
984 /* 131 */  {GTP_EXT_APN, "Access Point Name"},
985 /* 132 */  {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
986 /* 133 */  {GTP_EXT_GSN_ADDR, "GSN address"},
987 /* 134 */  {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
988 /* 135 */  {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"},    /* 3G */
989 /* 136 */  {GTP_EXT_AUTH_QUI, "Authentication quintuplets"},   /* 3G */
990 /* 137 */  {GTP_EXT_TFT, "Traffic Flow Template (TFT)"},   /* 3G */
991 /* 138 */  {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
992 /* 139 */  {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"},    /* 3G */
993 /* 140 */  {GTP_EXT_RAB_SETUP, "RAB setup information"},   /* 3G */
994 /* 141 */  {GTP_EXT_HDR_LIST, "Extension Header Types List"},  /* 3G */
995 /* 142 */  {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
996 /* 143 */  {GTP_EXT_OMC_ID, "OMC Identity"},   /* 3G */
997 /* 144 */  {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
998 /* 145 */  {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"},  /* 7.7.45 */
999 /* 146 */  {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"},    /* 7.7.45A */
1000 /* 147 */  {GTP_EXT_SSGN_NO, "SGSN Number"},   /* 7.7.47 */
1001 /* 148 */  {GTP_EXT_COMMON_FLGS, "Common Flags"},  /* 7.7.48 */
1002 /* 149 */  {GTP_EXT_APN_RES, "APN Restriction"},   /* 3G */
1003 /* 150 */  {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"},    /* 7.7.25B */
1004 /* 151 */  {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
1005 /* 152 */  {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
1006 /* 153 */  {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
1007
1008 /* 154 */  {GTP_EXT_IMEISV, "IMEI(SV)"},   /* 3G */
1009 /* 155 */  {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"},    /* 7.7.54 */
1010 /* 156 */  {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"},   /* 7.7.55 */
1011 /* 157 */  {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"},   /* 7.7.56 */
1012 /* 158 */  {GTP_EXT_RIM_RA, "RIM Routing Address"},    /* 7.7.57 */
1013 /* 159 */  {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"},    /* 7.7.58 */
1014 /* 160 */  {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
1015 /* 161 */  {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"},  /* 7.7.61 */
1016 /* 162 */  {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
1017 /* 163 */  {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
1018 /* 164 */  {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"},  /* 7.7.64 */
1019 /* 165 */  {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"},   /* 7.7.65 */
1020 /* 166 */  {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"},   /* 7.7.66 */
1021 /* 167 */  {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"},  /* 7.7.67 */
1022 /* 168 */  {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"},    /* 7.7.59 */
1023 /* 169 */  {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"},   /* 7.7.68 */
1024 /* 170 */  {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"},    /* 7.7.69 */
1025 /* 171 */  {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"},   /* 7.7.70 */
1026 /* 172 */  {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
1027 /* 173 */  {GTP_EXT_BSS_CONT, "BSS Container"},    /* 7.7.72 */
1028 /* 174 */  {GTP_EXT_CELL_ID, "Cell Identification"},   /* 7.7.73 */
1029 /* 175 */  {GTP_EXT_PDU_NO, "PDU Numbers"},    /* 7.7.74 */
1030 /* 176 */  {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"},   /* 7.7.75 */
1031
1032 /* 177 */  {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
1033 /* 178 */  {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"},   /* 7.7.77 */
1034 /* 179 */  {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"},    /* 7.7.78 */
1035 /* 180 */  {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"},    /* 7.7.79 */
1036 /* 181 */  {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"},    /* 7.7.80 */
1037 /* 182 */  {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"},    /* 7.7.81 */
1038 /* 183 */  {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
1039 /* 184 */  {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"},   /* 7.7.83 */
1040     {185, "MBMS Flow Identifier"},   /* 7.7.84 */
1041     {186, "MBMS IP Multicast Distribution"},   /* 7.7.85 */
1042     {187, "MBMS Distribution Acknowledgement"},   /* 7.7.86 */
1043     {188, "Reliable INTER RAT HANDOVER INFO"},   /* 7.7.87 */
1044     {189, "RFSP Index"},   /* 7.7.88 */
1045     {190, "Fully Qualified Domain Name (FQDN)"},   /* 7.7.90 */
1046     {GTP_EXT_EVO_ALLO_RETE_P1, "Evolved Allocation/Retention Priority I"},   /* 7.7.91 */
1047     {192, "Evolved Allocation/Retention Priority II"},   /* 7.7.92 */
1048     {193, "Extended Common Flags"},   /* 7.7.93 */
1049     {194, "User CSG Information (UCI)"},   /* 7.7.94 */
1050     {195, "CSG Information Reporting Action"},   /* 7.7.95 */
1051     {196, "CSG ID"},   /* 7.7.96 */
1052     {197, "CSG Membership Indication (CMI)"},   /* 7.7.97 */
1053     {198, "Aggregate Maximum Bit Rate (AMBR)"},   /* 7.7.98 */
1054     {199, "UE Network Capability"},   /* 7.7.99 */
1055     {200, "UE-AMBR"},   /* 7.7.100 */
1056     {201, "APN-AMBR with NSAPI"},   /* 7.7.101 */
1057     {202, "GGSN Back-Off Time"},   /* 7.7.102 */
1058     {203, "Signalling Priority Indication"},   /* 7.7.103 */
1059     {204, "Signalling Priority Indication with NSAPI"},   /* 7.7.104 */
1060     {205, "Higher bitrates than 16 Mbps flag"},   /* 7.7.105  */
1061     {206, "Max MBR/APN-AMBR"},   /* 7.7.106  */
1062     {207, "Additional MM context for SRVCC"},   /* 7.7.107  */
1063     {208, "Additional flags for SRVCC"},   /* 7.7.108  */
1064     {209, "STN-SR"},   /* 7.7.109  */
1065     {210, "C-MSISDN"},   /* 7.7.110  */
1066     {211, "Extended RANAP Cause"},   /* 7.7.111  */
1067         /* 212-238 TLV Spare. For future use. */
1068         /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1069 /* 249 */  {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"},  /* charging */
1070 /* 250 */  {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"},  /* charging */
1071 /* 251 */  {GTP_EXT_CHRG_ADDR, "Charging Gateway address"}, /* 7.7.44 */
1072         /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1073 /* 252 */  {GTP_EXT_DATA_REQ, "Data record packet"},   /* charging */
1074 /* 253 */  {GTP_EXT_DATA_RESP, "Requests responded"},  /* charging */
1075 /* 254 */  {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
1076 /* 255 */  {GTP_EXT_PRIV_EXT, "Private Extension"},
1077
1078     {0, NULL}
1079 };
1080 static value_string_ext gtpv1_val_ext = VALUE_STRING_EXT_INIT(gtpv1_val);
1081
1082 /* GPRS:    9.60 v7.6.0, page 37
1083  * UMTS:    29.060 v4.0, page 45
1084  * ETSI TS 129 060 V9.4.0 (2010-10) Ch 7.7.1
1085  */
1086 static const value_string cause_type[] = {
1087     {  0, "Request IMSI"},
1088     {  1, "Request IMEI"},
1089     {  2, "Request IMSI and IMEI"},
1090     {  3, "No identity needed"},
1091     {  4, "MS refuses"},
1092     {  5, "MS is not GPRS responding"},
1093     /* For future use 6-48 */
1094     /* Cause values reserved for GPRS charging
1095      * protocol use (see GTP' in 3GPP TS 32.295 [33])
1096      * 49-63
1097      */
1098     { 59, "System failure"}, /* charging */
1099     { 60, "The transmit buffers are becoming full"}, /* charging */
1100     { 61, "The receive buffers are becoming full"},  /* charging */
1101     { 62, "Another node is about to go down"},       /* charging */
1102     { 63, "This node is about to go down"},          /* charging */
1103     /* For future use 64-127 */
1104     {128, "Request accepted"},
1105     {129, "New PDP type due to network preference"},
1106     {130, "New PDP type due to single address bearer only"},
1107     /* For future use 131-176 */
1108     /* Cause values reserved for GPRS charging
1109      * protocol use (see GTP' in 3GPP TS 32.295 [33])
1110      * 177-191
1111      */
1112     {177, "CDR decoding error"},
1113
1114     {192, "Non-existent"},
1115     {193, "Invalid message format"},
1116     {194, "IMSI not known"},
1117     {195, "MS is GPRS detached"},
1118     {196, "MS is not GPRS responding"},
1119     {197, "MS refuses"},
1120     {198, "Version not supported"},
1121     {199, "No resource available"},
1122     {200, "Service not supported"},
1123     {201, "Mandatory IE incorrect"},
1124     {202, "Mandatory IE missing"},
1125     {203, "Optional IE incorrect"},
1126     {204, "System failure"},
1127     {205, "Roaming restriction"},
1128     {206, "P-TMSI signature mismatch"},
1129     {207, "GPRS connection suspended"},
1130     {208, "Authentication failure"},
1131     {209, "User authentication failed"},
1132     {210, "Context not found"},
1133     {211, "All PDP dynamic addresses are occupied"},
1134     {212, "No memory is available"},
1135     {213, "Relocation failure"},
1136     {214, "Unknown mandatory extension header"},
1137     {215, "Semantic error in the TFT operation"},
1138     {216, "Syntactic error in the TFT operation"},
1139     {217, "Semantic errors in packet filter(s)"},
1140     {218, "Syntactic errors in packet filter(s)"},
1141     {219, "Missing or unknown APN"},
1142     {220, "Unknown PDP address or PDP type"},
1143     {221, "PDP context without TFT already activated"},
1144     {222, "APN access denied - no subscription"},
1145     {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
1146     {224, "MS MBMS Capabilities Insufficient"},
1147     {225, "Invalid Correlation-ID"},
1148     {226, "MBMS Bearer Context Superseded"},
1149     {227, "Bearer Control Mode violation"},
1150     {228, "Collision with network initiated request"},
1151     /* For future use 229-240 */
1152     /* Cause values reserved for GPRS charging
1153      * protocol use (see GTP' in 3GPP TS 32.295 [33])
1154      * 241-255
1155      */
1156     {252, "Request related to possibly duplicated packets already fulfilled"},  /* charging */
1157     {253, "Request already fulfilled"}, /* charging */
1158     {254, "Sequence numbers of released/cancelled packets IE incorrect"},   /* charging */
1159     {255, "Request not fulfilled"}, /* charging */
1160     {0, NULL}
1161 };
1162 static value_string_ext cause_type_ext = VALUE_STRING_EXT_INIT(cause_type);
1163
1164 /* GPRS:    9.02 v7.7.0
1165  * UMTS:    29.002 v4.2.1, chapter 17.5, page 268
1166  * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
1167  */
1168
1169 static const value_string gsn_addr_type[] = {
1170     {0x00, "IPv4"},
1171     {0x01, "IPv6"},
1172     {0, NULL},
1173 };
1174
1175 static const value_string pdp_type[] = {
1176     {0x00, "X.25"},
1177     {0x01, "PPP"},
1178     {0x02, "OSP:IHOSS"},
1179     {0x21, "IPv4"},
1180     {0x57, "IPv6"},
1181     {0, NULL}
1182 };
1183
1184 static const value_string pdp_org_type[] = {
1185     {0, "ETSI"},
1186     {1, "IETF"},
1187     {0, NULL}
1188 };
1189
1190 static const value_string qos_delay_type[] = {
1191     {0x00, "Subscribed delay class (in MS to network direction)"},
1192     {0x01, "Delay class 1"},
1193     {0x02, "Delay class 2"},
1194     {0x03, "Delay class 3"},
1195     {0x04, "Delay class 4 (best effort)"},
1196     {0x07, "Reserved"},
1197     {0, NULL}
1198 };
1199
1200 static const value_string qos_reliability_type[] = {
1201     {0x00, "Subscribed reliability class (in MS to network direction)"},
1202     {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
1203     {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
1204     {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
1205     {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
1206     {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
1207     {0x07, "Reserved"},
1208     {0, NULL}
1209 };
1210
1211 static const value_string qos_peak_type[] = {
1212     {0x00, "Subscribed peak throughput (in MS to network direction)"},
1213     {0x01, "Up to 1 000 oct/s"},
1214     {0x02, "Up to 2 000 oct/s"},
1215     {0x03, "Up to 4 000 oct/s"},
1216     {0x04, "Up to 8 000 oct/s"},
1217     {0x05, "Up to 16 000 oct/s"},
1218     {0x06, "Up to 32 000 oct/s"},
1219     {0x07, "Up to 64 000 oct/s"},
1220     {0x08, "Up to 128 000 oct/s"},
1221     {0x09, "Up to 256 000 oct/s"},
1222 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
1223     {0x0A, "Reserved"},
1224     {0x0B, "Reserved"},
1225     {0x0C, "Reserved"},
1226     {0x0D, "Reserved"},
1227     {0x0E, "Reserved"},
1228     {0x0F, "Reserved"},
1229     {0, NULL}
1230 };
1231
1232 static const value_string qos_precedence_type[] = {
1233     {0x00, "Subscribed precedence (in MS to network direction)"},
1234     {0x01, "High priority"},
1235     {0x02, "Normal priority"},
1236     {0x03, "Low priority"},
1237     {0x07, "Reserved"},
1238     {0, NULL}
1239 };
1240
1241 static const value_string qos_mean_type[] = {
1242     {0x00, "Subscribed mean throughput (in MS to network direction)"},
1243     {0x01, "100 oct/h"},        /* Class 2 */
1244     {0x02, "200 oct/h"},        /* Class 3 */
1245     {0x03, "500 oct/h"},        /* Class 4 */
1246     {0x04, "1 000 oct/h"},      /* Class 5 */
1247     {0x05, "2 000 oct/h"},      /* Class 6 */
1248     {0x06, "5 000 oct/h"},      /* Class 7 */
1249     {0x07, "10 000 oct/h"},     /* Class 8 */
1250     {0x08, "20 000 oct/h"},     /* Class 9 */
1251     {0x09, "50 000 oct/h"},     /* Class 10 */
1252     {0x0A, "100 000 oct/h"},    /* Class 11 */
1253     {0x0B, "200 000 oct/h"},    /* Class 12 */
1254     {0x0C, "500 000 oct/h"},    /* Class 13 */
1255     {0x0D, "1 000 000 oct/h"},  /* Class 14 */
1256     {0x0E, "2 000 000 oct/h"},  /* Class 15 */
1257     {0x0F, "5 000 000 oct/h"},  /* Class 16 */
1258     {0x10, "10 000 000 oct/h"}, /* Class 17 */
1259     {0x11, "20 000 000 oct/h"}, /* Class 18 */
1260     {0x12, "50 000 000 oct/h"}, /* Class 19 */
1261 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
1262     {0x13, "Reserved"},
1263     {0x14, "Reserved"},
1264     {0x15, "Reserved"},
1265     {0x16, "Reserved"},
1266     {0x17, "Reserved"},
1267     {0x18, "Reserved"},
1268     {0x19, "Reserved"},
1269     {0x1A, "Reserved"},
1270     {0x1B, "Reserved"},
1271     {0x1C, "Reserved"},
1272     {0x1D, "Reserved"},
1273     {0x1E, "Reserved"},
1274     {0x1F, "Best effort"},  /* Class 1 */
1275     {0, NULL}
1276 };
1277 static value_string_ext qos_mean_type_ext = VALUE_STRING_EXT_INIT(qos_mean_type);
1278
1279 static const value_string qos_del_err_sdu[] = {
1280     {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
1281     {0x01, "No detect ('-')"},
1282     {0x02, "Erroneous SDUs are delivered ('yes')"},
1283     {0x03, "Erroneous SDUs are not delivered ('no')"},
1284     {0x07, "Reserved"},  /* All other values are reserved */
1285     {0, NULL}
1286 };
1287
1288 static const value_string qos_del_order[] = {
1289     {0x00, "Subscribed delivery order (in MS to network direction)"},
1290     {0x01, "With delivery order ('yes')"},
1291     {0x02, "Without delivery order ('no')"},
1292     {0x03, "Reserved"},  /* All other values are reserved */
1293     {0, NULL}
1294 };
1295
1296 static const value_string qos_traf_class[] = {
1297     {0x00, "Subscribed traffic class (in MS to network direction)"},
1298     {0x01, "Conversational class"},
1299     {0x02, "Streaming class"},
1300     {0x03, "Interactive class"},
1301     {0x04, "Background class"},
1302     {0x07, "Reserved"},  /* All other values are reserved */
1303     {0, NULL}
1304 };
1305
1306 static const value_string qos_max_sdu_size[] = {
1307     {0x00, "Subscribed maximum SDU size (in MS to network direction"},
1308     /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
1309     {0x97, "1502 octets"},
1310     {0x98, "1510 octets"},
1311     {0x99, "1520 octets"},
1312     {0, NULL}             /* All other values are reserved */
1313 };
1314
1315 static const value_string qos_max_ul[] = {
1316     {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
1317     /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1318     /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1319     /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1320     {0xFF, "0 kbps"},
1321     {0, NULL}
1322 };
1323
1324 static const value_string qos_max_dl[] = {
1325     {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
1326     /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1327     /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1328     /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1329     {0xFF, "0 kbps"},
1330     {0, NULL}
1331 };
1332
1333 static const value_string qos_res_ber[] = {
1334     {0x00, "Subscribed residual BER (in MS to network direction)"},
1335     {0x01, "1/20 = 5x10^-2"},
1336     {0x02, "1/100 = 1x10^-2"},
1337     {0x03, "1/200 = 5x10^-3"},
1338     {0x04, "1/250 = 4x10^-3"},
1339     {0x05, "1/1 000 = 1x10^-3"},
1340     {0x06, "1/10 000 = 1x10^-4"},
1341     {0x07, "1/100 000 = 1x10^-5"},
1342     {0x08, "1/1 000 000 = 1x10^-6"},
1343     {0x09, "3/50 000 000 = 6x10^-8"},
1344     {0x0F, "Reserved"},    /* All other values are reserved */
1345     {0, NULL}
1346 };
1347
1348 static const value_string qos_sdu_err_ratio[] = {
1349     {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
1350     {0x01, "1/100 = 1x10^-2"},
1351     {0x02, "7/1000 = 7x10^-3"},
1352     {0x03, "1/1 000 = 1x10^-3"},
1353     {0x04, "1/10 000 = 1x10^-4"},
1354     {0x05, "1/100 000 = 1x10^-5"},
1355     {0x06, "1/1 000 000 = 1x10^-6"},
1356     {0x07, "1/10 = 1x10^-1"},
1357     {0x0F, "Reserved"},    /* All other values are reserved */
1358     {0, NULL}
1359 };
1360
1361 static const value_string qos_traf_handl_prio[] = {
1362     {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
1363     {0x01, "Priority level 1"},
1364     {0x02, "Priority level 2"},
1365     {0x03, "Priority level 3"},
1366     {0, NULL}
1367 };
1368
1369 static const value_string qos_trans_delay[] = {
1370     {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
1371     {0x01, "10 ms"},        /* Using a granularity of 10 ms */
1372     {0x02, "20 ms"},
1373     {0x03, "30 ms"},
1374     {0x04, "40 ms"},
1375     {0x05, "50 ms"},
1376     {0x06, "60 ms"},
1377     {0x07, "70 ms"},
1378     {0x08, "80 ms"},
1379     {0x09, "90 ms"},
1380     {0x0A, "100 ms"},
1381     {0x0B, "110 ms"},
1382     {0x0C, "120 ms"},
1383     {0x0D, "130 ms"},
1384     {0x0E, "140 ms"},
1385     {0x0F, "150 ms"},
1386     {0x10, "200 ms"},       /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
1387     {0x11, "250 ms"},
1388     {0x12, "300 ms"},
1389     {0x13, "350 ms"},
1390     {0x14, "400 ms"},
1391     {0x15, "450 ms"},
1392     {0x16, "500 ms"},
1393     {0x17, "550 ms"},
1394     {0x18, "600 ms"},
1395     {0x19, "650 ms"},
1396     {0x1A, "700 ms"},
1397     {0x1B, "750 ms"},
1398     {0x1C, "800 ms"},
1399     {0x1D, "850 ms"},
1400     {0x1E, "900 ms"},
1401     {0x1F, "950 ms"},
1402     {0x20, "1000 ms"},      /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
1403     {0x21, "1100 ms"},
1404     {0x22, "1200 ms"},
1405     {0x23, "1300 ms"},
1406     {0x24, "1400 ms"},
1407     {0x25, "1500 ms"},
1408     {0x26, "1600 ms"},
1409     {0x27, "1700 ms"},
1410     {0x28, "1800 ms"},
1411     {0x29, "1900 ms"},
1412     {0x2A, "2000 ms"},
1413     {0x2B, "2100 ms"},
1414     {0x2C, "2200 ms"},
1415     {0x2D, "2300 ms"},
1416     {0x2E, "2400 ms"},
1417     {0x2F, "2500 ms"},
1418     {0x30, "2600 ms"},
1419     {0x31, "2700 ms"},
1420     {0x32, "2800 ms"},
1421     {0x33, "2900 ms"},
1422     {0x34, "3000 ms"},
1423     {0x35, "3100 ms"},
1424     {0x36, "3200 ms"},
1425     {0x37, "3300 ms"},
1426     {0x38, "3400 ms"},
1427     {0x39, "3500 ms"},
1428     {0x3A, "3600 ms"},
1429     {0x3B, "3700 ms"},
1430     {0x3C, "3800 ms"},
1431     {0x3D, "3900 ms"},
1432     {0x3E, "4000 ms"},
1433     {0x3F, "Reserved"},
1434     {0, NULL}
1435 };
1436 static value_string_ext qos_trans_delay_ext = VALUE_STRING_EXT_INIT(qos_trans_delay);
1437
1438 static const value_string qos_guar_ul[] = {
1439     {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
1440     /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1441     /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1442     /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1443     {0xFF, "0 kbps"},
1444     {0, NULL}
1445 };
1446
1447 static const value_string src_stat_desc_vals[] = {
1448     {0x00, "unknown"},
1449     {0x01, "speech"},
1450     {0, NULL}
1451 };
1452
1453
1454 static const true_false_string gtp_sig_ind = {
1455     "Optimised for signalling traffic",
1456     "Not optimised for signalling traffic"
1457 };
1458
1459 static const value_string qos_guar_dl[] = {
1460     {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
1461     /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
1462     /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
1463     /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
1464     {0xFF, "0 kbps"},
1465     {0, NULL}
1466 };
1467
1468 static const value_string sel_mode_type[] = {
1469     {0, "MS or network provided APN, subscribed verified"},
1470     {1, "MS provided APN, subscription not verified"},
1471     {2, "Network provided APN, subscription not verified"},
1472     {3, "For future use (Network provided APN, subscription not verified"}, /* Shall not be sent. If received, shall be sent as value 2 */
1473     {0, NULL}
1474 };
1475
1476 static const value_string tr_comm_type[] = {
1477     {1, "Send data record packet"},
1478     {2, "Send possibly duplicated data record packet"},
1479     {3, "Cancel data record packet"},
1480     {4, "Release data record packet"},
1481     {0, NULL}
1482 };
1483
1484 /* TODO: CHeck if all ms_reasons are included */
1485 static const value_string ms_not_reachable_type[] = {
1486     {0, "No paging response via the MSC"},
1487     {1, "IMSI detached"},
1488     {2, "Roaming restriction"},
1489     {3, "Deregistered in the HLR for non GPRS"},
1490     {4, "MS purge for non GPRS"},
1491     {5, "No paging response via the SGSN"},
1492     {6, "GPRS detached"},
1493     {7, "Deregistered in the HLR for non GPRS"},
1494     {8, "MS purged for GPRS"},
1495     {9, "Unidentified subscriber via the MSC"},
1496     {10, "Unidentified subscriber via the SGSN"},
1497     {11, "Deregistered in the HSS/HLR for IMS"},
1498     {12, "No response via the IP-SM-GW"},
1499     {0, NULL}
1500 };
1501
1502 /* UMTS:   25.413 v3.4.0, chapter 9.2.1.4, page 80
1503  */
1504 static const value_string ranap_cause_type[] = {
1505 /* Radio Network Layer Cause (1-->64) */
1506     {1, "RAB preempted"},
1507     {2, "Trelocoverall Expiry"},
1508     {3, "Trelocprep Expiry"},
1509     {4, "Treloccomplete Expiry"},
1510     {5, "Tqueuing Expiry"},
1511     {6, "Relocation Triggered"},
1512     {7, "TRELOCalloc Expiry"},
1513     {8, "Unable to Establish During Relocation"},
1514     {9, "Unknown Target RNC"},
1515     {10, "Relocation Cancelled"},
1516     {11, "Successful Relocation"},
1517     {12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
1518     {13, "Change of Ciphering and/or Integrity Protection is not supported"},
1519     {14, "Failure in the Radio Interface Procedure"},
1520     {15, "Release due to UTRAN Generated Reason"},
1521     {16, "User Inactivity"},
1522     {17, "Time Critical Relocation"},
1523     {18, "Requested Traffic Class not Available"},
1524     {19, "Invalid RAB Parameters Value"},
1525     {20, "Requested Maximum Bit Rate not Available"},
1526     {21, "Requested Guaranteed Bit Rate not Available"},
1527     {22, "Requested Transfer Delay not Achievable"},
1528     {23, "Invalid RAB Parameters Combination"},
1529     {24, "Condition Violation for SDU Parameters"},
1530     {25, "Condition Violation for Traffic Handling Priority"},
1531     {26, "Condition Violation for Guaranteed Bit Rate"},
1532     {27, "User Plane Versions not Supported"},
1533     {28, "Iu UP Failure"},
1534     {29, "Relocation Failure in Target CN/RNC or Target System"},
1535     {30, "Invalid RAB ID"},
1536     {31, "No Remaining RAB"},
1537     {32, "Interaction with other procedure"},
1538     {33, "Requested Maximum Bit Rate for DL not Available"},
1539     {34, "Requested Maximum Bit Rate for UL not Available"},
1540     {35, "Requested Guaranteed Bit Rate for DL not Available"},
1541     {36, "Requested Guaranteed Bit Rate for UL not Available"},
1542     {37, "Repeated Integrity Checking Failure"},
1543     {38, "Requested Report Type not supported"},
1544     {39, "Request superseded"},
1545     {40, "Release due to UE generated signalling connection release"},
1546     {41, "Resource Optimisation Relocation"},
1547     {42, "Requested Information Not Available"},
1548     {43, "Relocation desirable for radio reasons"},
1549     {44, "Relocation not supported in Target RNC or Target System"},
1550     {45, "Directed Retry"},
1551     {46, "Radio Connection With UE Lost"},
1552     {47, "rNC-unable-to-establish-all-RFCs"},
1553     {48, "deciphering-keys-not-available"},
1554     {49, "dedicated-assistance-data-not-available"},
1555     {50, "relocation-target-not-allowed"},
1556     {51, "location-reporting-congestion"},
1557     {52, "reduce-load-in-serving-cell"},
1558     {53, "no-radio-resources-available-in-target-cell"},
1559     {54, "gERAN-Iumode-failure"},
1560     {55, "access-restricted-due-to-shared-networks"},
1561     {56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
1562     {57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
1563     {58, "mBMS-no-multicast-service-for-this-UE"},
1564     {59, "mBMS-unknown-UE-ID"},
1565     {60, "successful-MBMS-session-start-no-data-bearer-necessary"},
1566     {61, "mBMS-superseded-due-to-NNSF"},
1567     {62, "mBMS-UE-linking-already-done"},
1568     {63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
1569     {64, "tMGI-unknown"},
1570 /* Transport Layer Cause (65-->80) */
1571     {65, "Signalling Transport Resource Failure"},
1572     {66, "Iu Transport Connection Failed to Establish"},
1573 /* NAS Cause (81-->96) */
1574     {81, "User Restriction Start Indication"},
1575     {82, "User Restriction End Indication"},
1576     {83, "Normal Release"},
1577 /* Protocol Cause (97-->112) */
1578     {97, "Transfer Syntax Error"},
1579     {98, "Semantic Error"},
1580     {99, "Message not compatible with receiver state"},
1581     {100, "Abstract Syntax Error (Reject)"},
1582     {101, "Abstract Syntax Error (Ignore and Notify)"},
1583     {102, "Abstract Syntax Error (Falsely Constructed Message"},
1584 /* Miscellaneous Cause (113-->128) */
1585     {113, "O & M Intervention"},
1586     {114, "No Resource Available"},
1587     {115, "Unspecified Failure"},
1588     {116, "Network Optimisation"},
1589 /* Non-standard Cause (129-->255) */
1590
1591 /* ranap_CauseRadioNetworkExtension ??
1592     { 257, "iP-multicast-address-and-APN-not-valid" },
1593     { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
1594     { 259, "mBMS-request-superseded" },
1595     { 260, "mBMS-de-registration-during-session-not-allowed" },
1596     { 261, "mBMS-no-data-bearer-necessary" },
1597   */
1598
1599     {0, NULL}
1600 };
1601 static value_string_ext ranap_cause_type_ext = VALUE_STRING_EXT_INIT(ranap_cause_type);
1602
1603 static const value_string mm_sec_modep[] = {
1604     {0, "Used cipher value, UMTS keys and Quintuplets"},
1605     {1, "GSM key and triplets"},
1606     {2, "UMTS key and quintuplets"},
1607     {3, "GSM key and quintuplets"},
1608     {0, NULL}
1609 };
1610
1611 static const value_string gtp_cipher_algorithm[] = {
1612     {0, "No ciphering"},
1613     {1, "GEA/1"},
1614     {2, "GEA/2"},
1615     {3, "GEA/3"},
1616     {4, "GEA/4"},
1617     {5, "GEA/5"},
1618     {6, "GEA/6"},
1619     {7, "GEA/7"},
1620     {0, NULL}
1621 };
1622 static const value_string gtp_ext_rat_type_vals[] = {
1623       {0, "Reserved"},
1624       {1, "UTRAN"},
1625       {2, "GERAN"},
1626       {3, "WLAN"},
1627       {4, "GAN"},
1628       {5, "HSPA Evolution"},
1629       {0, NULL}
1630 };
1631
1632 #define MM_PROTO_GROUP_CALL_CONTROL     0x00
1633 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
1634 #define MM_PROTO_PDSS1                  0x02
1635 #define MM_PROTO_CALL_CONTROL           0x03
1636 #define MM_PROTO_PDSS2                  0x04
1637 #define MM_PROTO_MM_NON_GPRS            0x05
1638 #define MM_PROTO_RR_MGMT                0x06
1639 #define MM_PROTO_MM_GPRS                0x08
1640 #define MM_PROTO_SMS                    0x09
1641 #define MM_PROTO_SESSION_MGMT           0x0A
1642 #define MM_PROTO_NON_CALL_RELATED       0x0B
1643
1644 static const value_string tft_code_type[] = {
1645     {0, "Spare"},
1646     {1, "Create new TFT"},
1647     {2, "Delete existing TFT"},
1648     {3, "Add packet filters to existing TFT"},
1649     {4, "Replace packet filters in existing TFT"},
1650     {5, "Delete packet filters from existing TFT"},
1651     {6, "Reserved"},
1652     {7, "Reserved"},
1653     {0, NULL}
1654 };
1655
1656
1657 static dissector_handle_t ip_handle;
1658 static dissector_handle_t ipv6_handle;
1659 static dissector_handle_t ppp_handle;
1660 static dissector_handle_t data_handle;
1661 static dissector_handle_t gtpcdr_handle;
1662 static dissector_handle_t sndcpxid_handle;
1663 static dissector_handle_t gtpv2_handle;
1664 static dissector_handle_t bssgp_handle;
1665 static dissector_table_t bssap_pdu_type_table;
1666
1667 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype);
1668
1669 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1670 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1671 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1672 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1673 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1674 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1675 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1676 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1677 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1678 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1679 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1680 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1681 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1682 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1683 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1684 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1685 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1686 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1687 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1688 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1689 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1690 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1691 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1692 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1693 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1694 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1695 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1696 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1697 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1698 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1699 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1700 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1701 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1702 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1703 static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1704 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1705 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1706 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1707 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1708 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1709 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1710 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1711 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1712 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1713 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1714
1715 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1716 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1717 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1718 static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1719 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1720 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1721 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1722 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1723 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1724 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1725 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1726 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1727 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1728 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1729 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1730 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1731 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1732 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1733 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1734 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1735 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1736 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1737 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1738 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1739 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1740 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1741 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1742 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1743 static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1744 static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1745 static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1746 static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1747 static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1748 static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1749 static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
1750 static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1751 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1752 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1753 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1754 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1755 static int decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1756 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1757 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1758 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1759 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1760 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1761 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1762 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1763 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1764 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
1765
1766 typedef struct _gtp_opt {
1767     int optcode;
1768     int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *);
1769 } gtp_opt_t;
1770
1771 static const gtp_opt_t gtpopt[] = {
1772     {GTP_EXT_CAUSE, decode_gtp_cause},
1773     {GTP_EXT_IMSI, decode_gtp_imsi},
1774     {GTP_EXT_RAI, decode_gtp_rai},
1775     {GTP_EXT_TLLI, decode_gtp_tlli},
1776     {GTP_EXT_PTMSI, decode_gtp_ptmsi},
1777     {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
1778     {GTP_EXT_REORDER, decode_gtp_reorder},
1779     {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
1780     {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
1781     {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
1782     {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
1783     {GTP_EXT_RECOVER, decode_gtp_recovery},
1784     {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
1785     {GTP_EXT_16, decode_gtp_16},
1786     {GTP_EXT_17, decode_gtp_17},
1787     {GTP_EXT_18, decode_gtp_18},
1788     {GTP_EXT_19, decode_gtp_19},
1789     {GTP_EXT_NSAPI, decode_gtp_nsapi},
1790     {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
1791     {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
1792     {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
1793     {GTP_EXT_RP, decode_gtp_rp},
1794     {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
1795     {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
1796     {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
1797     {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
1798     {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
1799     {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
1800     {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
1801     {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
1802     {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
1803     {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
1804     {GTP_EXT_APN, decode_gtp_apn},
1805     {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
1806     {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
1807     {GTP_EXT_MSISDN, decode_gtp_msisdn},
1808     {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts},    /* 3G */
1809     {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui},    /* 3G */
1810     {GTP_EXT_TFT, decode_gtp_tft},  /* 3G */
1811     {GTP_EXT_TARGET_ID, decode_gtp_target_id},  /* 3G */
1812     {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont},    /* 3G */
1813     {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup},  /* 3G */
1814     {GTP_EXT_HDR_LIST, decode_gtp_hdr_list},    /* 3G */
1815     {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id},    /* 3G */
1816     {GTP_EXT_OMC_ID, decode_gtp_omc_id},    /* 3G */
1817     /* TS 29 060 V6.11.0 */
1818     {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont},  /* 7.7.43 */
1819     {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio},  /* 7.7.45 */
1820     {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf},  /* 7.7.45A */
1821     {GTP_EXT_SSGN_NO, decode_gtp_ssgn_no},  /* 7.7.47 */
1822     {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs},  /* 7.7.48 */
1823     {GTP_EXT_APN_RES, decode_gtp_apn_res},  /* 3G */
1824     {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs},  /* 7.7.25B */
1825     {GTP_EXT_RAT_TYPE, decode_gtp_rat_type},    /* 3G */
1826     {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf},  /* 7.7.51 */
1827     {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone},    /* 7.7.52 */
1828     {GTP_EXT_IMEISV, decode_gtp_imeisv},    /* 3G 7.7.53 */
1829     {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con},  /* 7.7.54 */
1830     {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx},  /* 7.7.55 */
1831     {GTP_EXT_TMGI, decode_gtp_tmgi},    /* 7.7.56 */
1832     {GTP_EXT_RIM_RA, decode_gtp_rim_ra},    /* 7.7.57 */
1833     {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt},    /* 7.7.58 */
1834     {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa},  /* 7.7.60 */
1835     {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf},  /* 7.7.61 */
1836     {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf},  /* 7.7.62 */
1837     {GTP_EXT_HOP_COUNT, decode_gtp_hop_count},  /* 7.7.63 */
1838     {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id},  /* 7.7.64 */
1839     {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id},  /* 7.7.65 */
1840     {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind},    /* 7.7.66 */
1841     {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi},  /* 7.7.67 */
1842     {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur},    /* 7.7.59 */
1843     {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf},    /* 7.7.68 */
1844     {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no},    /* 7.7.69 */
1845     {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr},    /* 7.7.70 */
1846     {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx},  /* 7.7.71 */
1847     {GTP_EXT_BSS_CONT, decode_gtp_bss_cont},    /* 7.7.72 */
1848     {GTP_EXT_CELL_ID, decode_gtp_cell_id},  /* 7.7.73 */
1849     {GTP_EXT_PDU_NO, decode_gtp_pdu_no},    /* 7.7.74 */
1850     {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause},  /* 7.7.75 */
1851     {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap},  /* 7.7.76 */
1852     {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc},    /* 7.7.77 */
1853     {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc},    /* 7.7.78 */
1854     {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid},  /* 7.7.79 */
1855     {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act},    /* 7.7.80 */
1856     {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg},    /* 7.7.81 */
1857     {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id},  /* 7.7.82 */
1858     {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod}, /* 7.7.83 */
1859     {GTP_EXT_EVO_ALLO_RETE_P1, decode_gtp_evolved_allc_rtn_p1}, /* 7.7.91 */
1860     {GTP_EXT_REL_PACK, decode_gtp_rel_pack},    /* charging */
1861     {GTP_EXT_CAN_PACK, decode_gtp_can_pack},    /* charging */
1862     {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
1863     {GTP_EXT_DATA_REQ, decode_gtp_data_req},    /* charging */
1864     {GTP_EXT_DATA_RESP, decode_gtp_data_resp},  /* charging */
1865     {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
1866     {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
1867     {0, decode_gtp_unknown}
1868 };
1869
1870 struct _gtp_hdr {
1871     guint8 flags;
1872     guint8 message;
1873     guint16 length;
1874 };
1875
1876 static guint8 gtp_version = 0;
1877 static const char *yesno[] = { "no", "yes" };
1878
1879 #define BCD2CHAR(d)         ((d) | 0x30)
1880
1881 static gchar *
1882 id_to_str(tvbuff_t *tvb, gint offset)
1883 {
1884     static gchar str[17] = "                ";
1885     guint8 bits8to5, bits4to1;
1886     int i, j;
1887     guint8 ad;
1888
1889     for (i = j = 0; i < 8; i++) {
1890         ad = tvb_get_guint8(tvb, offset + i);
1891         bits8to5 = hi_nibble(ad);
1892         bits4to1 = lo_nibble(ad);
1893         if (bits4to1 <= 9)
1894             str[j++] = BCD2CHAR(bits4to1);
1895         else
1896             j++;
1897         if (bits8to5 <= 9)
1898             str[j++] = BCD2CHAR(bits8to5);
1899         else
1900             j++;
1901     }
1902     str[j] = '\0';
1903     return str;
1904 }
1905
1906 static gchar *
1907 msisdn_to_str(tvbuff_t *tvb, gint offset, int len)
1908 {
1909     static gchar str[18] = "+                ";
1910     guint8 bits8to5, bits4to1;
1911     int i, j;
1912     guint ad;
1913
1914     for (i = j = 1; i < MIN(len, 9); i++) {
1915         ad = tvb_get_guint8(tvb, offset + i);
1916         bits8to5 = hi_nibble(ad);
1917         bits4to1 = lo_nibble(ad);
1918         if (bits4to1 <= 9)
1919             str[j++] = BCD2CHAR(bits4to1);
1920         else
1921             j++;
1922         if (bits8to5 <= 9)
1923             str[j++] = BCD2CHAR(bits8to5);
1924         else
1925             j++;
1926     }
1927     str[j] = '\0';
1928
1929     return str;
1930 }
1931
1932 /* Next definitions and function check_field_presence checks if given field
1933  * in GTP packet is compliant with ETSI
1934  */
1935 typedef struct _header {
1936     guint8 code;
1937     guint8 presence;
1938 } ext_header;
1939
1940 typedef struct _message {
1941     guint8 code;
1942     ext_header fields[32];
1943 } _gtp_mess_items;
1944
1945 /* ---------------------
1946  * GPRS messages
1947  * ---------------------*/
1948 static _gtp_mess_items gprs_mess_items[] = {
1949
1950     {
1951         GTP_MSG_ECHO_REQ, {
1952             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1953             {0, 0}
1954         }
1955     },
1956     {
1957         GTP_MSG_ECHO_RESP, {
1958             {GTP_EXT_RECOVER, GTP_MANDATORY},
1959             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1960             {0, 0}
1961         }
1962     },
1963     {
1964         GTP_MSG_VER_NOT_SUPP, {
1965             {0, 0}
1966         }
1967     },
1968     {
1969         GTP_MSG_NODE_ALIVE_REQ, {
1970             {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
1971             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1972             {0, 0}
1973         }
1974     },
1975     {
1976         GTP_MSG_NODE_ALIVE_RESP, {
1977             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1978             {0, 0}
1979         }
1980     },
1981     {
1982         GTP_MSG_REDIR_REQ, {
1983             {GTP_EXT_CAUSE, GTP_MANDATORY},
1984             {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
1985             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1986             {0, 0}
1987         }
1988     },
1989     {
1990         GTP_MSG_REDIR_RESP, {
1991             {GTP_EXT_CAUSE, GTP_MANDATORY},
1992             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
1993             {0, 0}
1994         }
1995     },
1996     {
1997         GTP_MSG_CREATE_PDP_REQ, {
1998             {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
1999             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2000             {GTP_EXT_SEL_MODE, GTP_MANDATORY},
2001             {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
2002             {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
2003             {GTP_EXT_MSISDN, GTP_MANDATORY},
2004             {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2005             {GTP_EXT_APN, GTP_MANDATORY},
2006             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2007             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2008             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2009             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2010             {0, 0}
2011         }
2012     },
2013     {
2014         GTP_MSG_CREATE_PDP_RESP, {
2015             {GTP_EXT_CAUSE, GTP_MANDATORY},
2016             {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
2017             {GTP_EXT_REORDER, GTP_CONDITIONAL},
2018             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2019             {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
2020             {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
2021             {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2022             {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2023             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2024             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2025             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2026             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2027             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2028             {0, 0}
2029         }
2030     },
2031     {
2032         GTP_MSG_UPDATE_PDP_REQ, {
2033             {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
2034             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2035             {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
2036             {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
2037             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2038             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2039             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2040             {0, 0},
2041         }
2042     },
2043     {
2044         GTP_MSG_UPDATE_PDP_RESP, {
2045             {GTP_EXT_CAUSE, GTP_MANDATORY},
2046             {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
2047             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2048             {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
2049             {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
2050             {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2051             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2052             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2053             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2054             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2055             {0, 0}
2056         }
2057     },
2058     {
2059         GTP_MSG_DELETE_PDP_REQ, {
2060             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2061             {0, 0}
2062         }
2063     },
2064     {
2065         GTP_MSG_DELETE_PDP_RESP, {
2066             {GTP_EXT_CAUSE, GTP_MANDATORY},
2067             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2068             {0, 0},
2069         }
2070     },
2071     {
2072         GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, {
2073             {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
2074             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2075             {GTP_EXT_SEL_MODE, GTP_MANDATORY},
2076             {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
2077             {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
2078             {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2079             {GTP_EXT_APN, GTP_MANDATORY},
2080             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2081             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2082             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2083             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2084             {0, 0}
2085         }
2086     },
2087     {
2088         GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, {
2089             {GTP_EXT_CAUSE, GTP_MANDATORY},
2090             {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
2091             {GTP_EXT_REORDER, GTP_CONDITIONAL},
2092             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2093             {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
2094             {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
2095             {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2096             {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2097             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2098             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2099             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2100             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2101             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2102             {0, 0}
2103         }
2104     },
2105     {
2106         GTP_MSG_DELETE_AA_PDP_REQ, {
2107             {GTP_EXT_CAUSE, GTP_MANDATORY},
2108             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2109             {0, 0}
2110         }
2111     },
2112     {
2113         GTP_MSG_DELETE_AA_PDP_RESP, {
2114             {GTP_EXT_CAUSE, GTP_MANDATORY},
2115             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2116             {0, 0}
2117         }
2118     },
2119     {
2120         GTP_MSG_ERR_IND, {
2121             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2122             {0, 0}
2123         }
2124     },
2125     {
2126         GTP_MSG_PDU_NOTIFY_REQ, {
2127             {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2128             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2129             {0, 0}
2130         }
2131     },
2132     {
2133         GTP_MSG_PDU_NOTIFY_RESP, {
2134             {GTP_EXT_CAUSE, GTP_MANDATORY},
2135             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2136             {0, 0}
2137         }
2138     },
2139     {
2140         GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2141             {GTP_EXT_CAUSE, GTP_MANDATORY},
2142             {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2143             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2144             {0, 0}
2145         }
2146     },
2147     {
2148         GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2149             {GTP_EXT_CAUSE, GTP_MANDATORY},
2150             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2151             {0, 0}
2152         }
2153     },
2154     {
2155         GTP_MSG_SEND_ROUT_INFO_REQ, {
2156             {GTP_EXT_IMSI, GTP_MANDATORY},
2157             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2158             {0, 0}
2159         }
2160     },
2161     {
2162         GTP_MSG_SEND_ROUT_INFO_RESP, {
2163             {GTP_EXT_CAUSE, GTP_MANDATORY},
2164             {GTP_EXT_IMSI, GTP_MANDATORY},
2165             {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2166             {GTP_EXT_MS_REASON, GTP_OPTIONAL},
2167             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
2168             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2169             {0, 0}
2170         }
2171     },
2172     {
2173         GTP_MSG_FAIL_REP_REQ, {
2174             {GTP_EXT_IMSI, GTP_MANDATORY},
2175             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2176             {0, 0}
2177         }
2178     },
2179     {
2180         GTP_MSG_FAIL_REP_RESP, {
2181             {GTP_EXT_CAUSE, GTP_MANDATORY},
2182             {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2183             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2184             {0, 0}
2185         }
2186     },
2187     {
2188         GTP_MSG_MS_PRESENT_REQ, {
2189             {GTP_EXT_IMSI, GTP_MANDATORY},
2190             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2191             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2192             {0, 0}
2193         }
2194     },
2195     {
2196         GTP_MSG_MS_PRESENT_RESP, {
2197             {GTP_EXT_CAUSE, GTP_MANDATORY},
2198             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2199             {0, 0}
2200         }
2201     },
2202     {
2203         GTP_MSG_IDENT_REQ, {
2204             {GTP_EXT_RAI, GTP_MANDATORY},
2205             {GTP_EXT_PTMSI, GTP_MANDATORY},
2206             {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2207             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2208             {0, 0}
2209         }
2210     },
2211     {
2212         GTP_MSG_IDENT_RESP, {
2213             {GTP_EXT_CAUSE, GTP_MANDATORY},
2214             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2215             {GTP_EXT_AUTH_TRI, GTP_OPTIONAL},
2216             {GTP_EXT_AUTH_QUI, GTP_OPTIONAL},
2217             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2218             {0, 0}
2219         }
2220     },
2221     {
2222         GTP_MSG_SGSN_CNTXT_REQ, {
2223             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2224             {GTP_EXT_RAI, GTP_MANDATORY},
2225             {GTP_EXT_TLLI, GTP_MANDATORY},
2226             {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
2227             {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2228             {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
2229             {0, 0}
2230         }
2231     },
2232     {
2233         GTP_MSG_SGSN_CNTXT_RESP, {
2234             {GTP_EXT_CAUSE, GTP_MANDATORY},
2235             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2236             {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
2237             {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2238             {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2239             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2240             {0, 0}
2241         }
2242     },
2243     {
2244         GTP_MSG_SGSN_CNTXT_ACK, {
2245             {GTP_EXT_CAUSE, GTP_MANDATORY},
2246             {GTP_EXT_FLOW_II, GTP_CONDITIONAL},
2247             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2248             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2249             {0, 0}
2250         }
2251     },
2252     {
2253         GTP_MSG_DATA_TRANSF_REQ, {
2254             {GTP_EXT_TR_COMM, GTP_MANDATORY},
2255             {GTP_EXT_DATA_REQ, GTP_CONDITIONAL},
2256             {GTP_EXT_REL_PACK, GTP_CONDITIONAL},
2257             {GTP_EXT_CAN_PACK, GTP_CONDITIONAL},
2258             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2259             {0, 0}
2260         }
2261     },
2262     {
2263         GTP_MSG_DATA_TRANSF_RESP, {
2264             {GTP_EXT_CAUSE, GTP_MANDATORY},
2265             {GTP_EXT_DATA_RESP, GTP_MANDATORY},
2266             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2267             {0, 0}
2268         }
2269     },
2270     {
2271         0, {
2272             {0, 0}
2273         }
2274     }
2275 };
2276
2277 /* -----------------------------
2278  * UMTS messages
2279  * -----------------------------*/
2280 static _gtp_mess_items umts_mess_items[] = {
2281     /* 7.2 Path Management Messages */
2282     {
2283         GTP_MSG_ECHO_REQ, {
2284             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2285             {0, 0}
2286         }
2287     },
2288     {
2289         GTP_MSG_ECHO_RESP, {
2290             {GTP_EXT_RECOVER, GTP_MANDATORY},
2291             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2292             {0, 0}
2293         }
2294     },
2295     {
2296         GTP_MSG_VER_NOT_SUPP, {
2297             {0, 0}
2298         }
2299     },
2300     {
2301         GTP_MSG_SUPP_EXT_HDR, {
2302             {GTP_EXT_HDR_LIST, GTP_MANDATORY},
2303             {0, 0}
2304         }
2305     },
2306     /* ??? */
2307     {
2308         GTP_MSG_NODE_ALIVE_REQ, {
2309             {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
2310             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2311             {0, 0}
2312         }
2313     },
2314     {
2315         GTP_MSG_NODE_ALIVE_RESP, {
2316             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2317             {0, 0}
2318         }
2319     },
2320     {
2321         GTP_MSG_REDIR_REQ, {
2322             {GTP_EXT_CAUSE, GTP_MANDATORY},
2323             {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
2324             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2325             {0, 0}
2326         }
2327     },
2328     {
2329         GTP_MSG_REDIR_REQ, {
2330             {0, 0}
2331         }
2332     },
2333     /* 7.3 Tunnel Management Messages */
2334     {
2335         GTP_MSG_CREATE_PDP_REQ, {
2336             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2337             /* RAI is in TS 29.060 V6.11.0 */
2338             {GTP_EXT_RAI, GTP_OPTIONAL},        /* Routeing Area Identity (RAI) Optional 7.7.3 */
2339             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2340             {GTP_EXT_SEL_MODE, GTP_CONDITIONAL},
2341             {GTP_EXT_TEID, GTP_MANDATORY},
2342             {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2343             {GTP_EXT_NSAPI, GTP_MANDATORY},
2344             {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2345             {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},
2346             {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2347             {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2348             {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2349             {GTP_EXT_APN, GTP_CONDITIONAL},
2350             {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL},
2351             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2352             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2353             {GTP_EXT_MSISDN, GTP_CONDITIONAL},
2354             {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2355             {GTP_EXT_TFT, GTP_CONDITIONAL},
2356             {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2357             {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2358             /* TS 29.060 V6.11.0 */
2359             {GTP_EXT_APN_RES, GTP_OPTIONAL},
2360             {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},
2361             {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},
2362             {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},
2363             {GTP_EXT_IMEISV, GTP_OPTIONAL},
2364             {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL},
2365             {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},
2366             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2367             {0, 0}
2368         }
2369     },
2370     {
2371         GTP_MSG_CREATE_PDP_RESP, {
2372             {GTP_EXT_CAUSE, GTP_MANDATORY},
2373             {GTP_EXT_REORDER, GTP_CONDITIONAL},
2374             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2375             {GTP_EXT_TEID, GTP_CONDITIONAL},
2376             {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2377             {GTP_EXT_NSAPI, GTP_CONDITIONAL},
2378             {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2379             {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
2380             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
2381             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2382             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2383             {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2384             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2385             /* TS 29.060 V6.11.0 */
2386             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},  /* Alternative Charging Gateway Address Optional 7.7.44 */
2387             {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL},        /* Common Flags Optional 7.7.48 */
2388             {GTP_EXT_APN_RES, GTP_OPTIONAL},    /* APN Restriction Optional 7.7.49 */
2389             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2390             {0, 0}
2391         }
2392     },
2393     {                           /* checked, SGSN -> GGSN */
2394         GTP_MSG_UPDATE_PDP_REQ, {
2395             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2396             {GTP_EXT_RAI, GTP_OPTIONAL},        /* Routeing Area Identity (RAI) Optional 7.7.3 */
2397             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2398             {GTP_EXT_TEID, GTP_MANDATORY},
2399             {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2400             {GTP_EXT_NSAPI, GTP_MANDATORY},
2401             {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
2402             {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
2403             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2404             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},  /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2405             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},  /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
2406             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},   /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2407             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},   /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2408             {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
2409             {GTP_EXT_TFT, GTP_OPTIONAL},
2410             {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
2411             {GTP_EXT_OMC_ID, GTP_OPTIONAL},
2412             {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL},                        /* Common Flags Optional 7.7.48 */
2413             {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},                           /* RAT Type Optional 7.7.50 */
2414             {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},                        /* User Location Information Optional 7.7.51 */
2415             {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},                       /* MS Time Zone Optional 7.7.52 */
2416             {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},                        /* Additonal Trace Info Optional 7.7.62 */
2417             {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL}, /* Direct Tunnel Flags     7.7.81 */
2418             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2419             {0, 0}
2420         }
2421     },
2422     {                           /* checked, GGSN -> SGSN */
2423         GTP_MSG_UPDATE_PDP_RESP, {
2424             {GTP_EXT_CAUSE, GTP_MANDATORY},
2425             {GTP_EXT_RECOVER, GTP_OPTIONAL},
2426             {GTP_EXT_TEID, GTP_CONDITIONAL},
2427             {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2428             {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
2429             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2430             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2431             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2432             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},   /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2433             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},   /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
2434             {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
2435             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
2436             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},  /* Alternative Charging Gateway Address Optional 7.7.44 */
2437             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2438             {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL},        /* Common Flags Optional 7.7.48 */
2439             {GTP_EXT_APN_RES, GTP_OPTIONAL},    /* APN Restriction Optional 7.7.49 */
2440             {0, 0}
2441         }
2442     },
2443     {
2444         GTP_MSG_DELETE_PDP_REQ, {
2445             {GTP_EXT_TEAR_IND, GTP_CONDITIONAL},
2446             {GTP_EXT_NSAPI, GTP_MANDATORY},
2447             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2448             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2449             {0, 0}
2450         }
2451     },
2452     {
2453         GTP_MSG_DELETE_PDP_RESP, {
2454             {GTP_EXT_CAUSE, GTP_MANDATORY},
2455             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2456             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2457             {0, 0}
2458         }
2459     },
2460     {
2461         GTP_MSG_ERR_IND, {
2462             {GTP_EXT_TEID, GTP_MANDATORY},
2463             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},  /* GSN Address Mandatory 7.7.32 */
2464             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2465             {0, 0}
2466         }
2467     },
2468     {
2469         GTP_MSG_PDU_NOTIFY_REQ, {
2470             {GTP_EXT_IMSI, GTP_MANDATORY},
2471             {GTP_EXT_TEID_CP, GTP_MANDATORY},
2472             {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2473             {GTP_EXT_APN, GTP_MANDATORY},
2474             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2475             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2476             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2477             {0, 0}
2478         }
2479     },
2480     {
2481         GTP_MSG_PDU_NOTIFY_RESP, {
2482             {GTP_EXT_CAUSE, GTP_MANDATORY},
2483             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2484             {0, 0}
2485         }
2486     },
2487     {
2488         GTP_MSG_PDU_NOTIFY_REJ_REQ, {
2489             {GTP_EXT_CAUSE, GTP_MANDATORY},
2490             {GTP_EXT_TEID_CP, GTP_MANDATORY},
2491             {GTP_EXT_USER_ADDR, GTP_MANDATORY},
2492             {GTP_EXT_APN, GTP_MANDATORY},
2493             {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
2494             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2495             {0, 0}
2496         }
2497     },
2498     {
2499         GTP_MSG_PDU_NOTIFY_REJ_RESP, {
2500             {GTP_EXT_CAUSE, GTP_MANDATORY},
2501             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2502             {0, 0}
2503         }
2504     },
2505     /* 7.4 Location Management Messages */
2506     {
2507         GTP_MSG_SEND_ROUT_INFO_REQ, {
2508             {GTP_EXT_IMSI, GTP_MANDATORY},
2509             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2510             {0, 0}
2511         }
2512     },
2513     {
2514         GTP_MSG_SEND_ROUT_INFO_RESP, {
2515             {GTP_EXT_CAUSE, GTP_MANDATORY},
2516             {GTP_EXT_IMSI, GTP_MANDATORY},
2517             {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2518             {GTPv1_EXT_MS_REASON, GTP_OPTIONAL},
2519             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
2520             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2521             {0, 0}
2522         }
2523     },
2524     {
2525         GTP_MSG_FAIL_REP_REQ, {
2526             {GTP_EXT_IMSI, GTP_MANDATORY},
2527             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2528             {0, 0}
2529         }
2530     },
2531     {
2532         GTP_MSG_FAIL_REP_RESP, {
2533             {GTP_EXT_CAUSE, GTP_MANDATORY},
2534             {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
2535             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2536             {0, 0}
2537         }
2538     },
2539     {
2540         GTP_MSG_MS_PRESENT_REQ, {
2541             {GTP_EXT_IMSI, GTP_MANDATORY},
2542             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2543             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2544             {0, 0}
2545         }
2546     },
2547     {
2548         GTP_MSG_MS_PRESENT_RESP, {
2549             {GTP_EXT_CAUSE, GTP_MANDATORY},
2550             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2551             {0, 0}
2552         }
2553     },
2554     /* 7.5 Mobility Management Messages */
2555     {
2556         GTP_MSG_IDENT_REQ, {
2557             {GTP_EXT_RAI, GTP_MANDATORY},
2558             {GTP_EXT_PTMSI, GTP_MANDATORY},
2559             {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2560             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},   /* SGSN Address for Control Plane Optional 7.7.32 */
2561             {GTP_EXT_HOP_COUNT, GTP_OPTIONAL},  /* Hop Counter Optional 7.7.63 */
2562             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2563             {0, 0}
2564         }
2565     },
2566     {
2567         GTP_MSG_IDENT_RESP, {
2568             {GTP_EXT_CAUSE, GTP_MANDATORY},
2569             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2570             {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL},
2571             {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL},
2572             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2573             {0, 0}
2574         }
2575     },
2576     {
2577         GTP_MSG_SGSN_CNTXT_REQ, {
2578             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2579             {GTP_EXT_RAI, GTP_MANDATORY},
2580             {GTP_EXT_TLLI, GTP_CONDITIONAL},
2581             {GTP_EXT_PTMSI, GTP_CONDITIONAL},
2582             {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
2583             {GTP_EXT_MS_VALID, GTP_OPTIONAL},
2584             {GTP_EXT_TEID_CP, GTP_MANDATORY},
2585             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2586             {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},   /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
2587             {GTP_EXT_SSGN_NO, GTP_OPTIONAL},    /* SGSN Number Optional 7.7.47 */
2588             {GTP_EXT_HOP_COUNT, GTP_OPTIONAL},  /* Hop Counter Optional 7.7.63 */
2589             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2590             {0, 0}
2591         }
2592     },
2593     {
2594         GTP_MSG_SGSN_CNTXT_RESP, {
2595             {GTP_EXT_CAUSE, GTP_MANDATORY},
2596             {GTP_EXT_IMSI, GTP_CONDITIONAL},
2597             {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2598             {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL},       /* RAB Context Conditional 7.7.19 */
2599             {GTP_EXT_RP_SMS, GTP_OPTIONAL},
2600             {GTP_EXT_RP, GTP_OPTIONAL},
2601             {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL},
2602             {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},  /* CharingCharacteristics Optional 7.7.23 */
2603             {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL},        /* Radio Priority LCS Optional 7.7.25B */
2604             {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
2605             {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2606             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2607             {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL},      /* PDP Context Prioritization Optional 7.7.45 */
2608             {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL},        /* MBMS UE Context Optional 7.7.55 */
2609             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2610             {0, 0}
2611         }
2612     },
2613     {
2614         GTP_MSG_SGSN_CNTXT_ACK, {
2615             {GTP_EXT_CAUSE, GTP_MANDATORY},
2616             {GTP_EXT_TEID_II, GTP_CONDITIONAL},
2617             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2618             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2619             {0, 0}
2620         }
2621     },
2622     {
2623         GTP_MSG_FORW_RELOC_REQ, {
2624             {GTP_EXT_IMSI, GTP_MANDATORY},
2625             {GTP_EXT_TEID_CP, GTP_MANDATORY},
2626             {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY},
2627             {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},  /* CharingCharacteristics Optional 7.7.23 */
2628             {GTP_EXT_MM_CNTXT, GTP_MANDATORY},
2629             {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
2630             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
2631             {GTP_EXT_TARGET_ID, GTP_MANDATORY},
2632             {GTP_EXT_UTRAN_CONT, GTP_MANDATORY},
2633             {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL},      /* PDP Context Prioritization Optional 7.7.45 */
2634             {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL},        /* MBMS UE Context Optional 7.7.55 */
2635             {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL},        /* Selected PLMN ID Optional 7.7.64 */
2636             {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL},      /* PS Handover Request Context Optional 7.7.71 */
2637             {GTP_EXT_BSS_CONT, GTP_OPTIONAL},   /* BSS Container Optional 7.7.72 */
2638             {GTP_EXT_CELL_ID, GTP_OPTIONAL},    /* Cell Identification Optional 7.7.73 */
2639             {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL},        /* BSSGP Cause Optional 7.7.75 */
2640             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2641             {GTP_EXT_SSGN_NO, GTP_OPTIONAL},
2642             {0, 0}
2643         }
2644     },
2645     {
2646         GTP_MSG_FORW_RELOC_RESP, {
2647             {GTP_EXT_CAUSE, GTP_MANDATORY},
2648             {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
2649             {GTP_EXT_TEID_II, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
2650             {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL},
2651             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
2652             {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL},
2653             {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL},
2654             {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL},       /* Additional RAB Setup Information Conditional 7.7.45A */
2655             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2656             {0, 0}
2657         }
2658     },
2659     {
2660         GTP_MSG_FORW_RELOC_COMP, {
2661             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2662             {0, 0}
2663         }
2664     },
2665     {
2666         GTP_MSG_RELOC_CANCEL_REQ, {
2667             {GTP_EXT_IMSI, GTP_MANDATORY},
2668             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2669             {0, 0}
2670         }
2671     },
2672     {
2673         GTP_MSG_RELOC_CANCEL_RESP, {
2674             {GTP_EXT_CAUSE, GTP_MANDATORY},
2675             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2676             {0, 0}
2677         }
2678     },
2679     {
2680         GTP_MSG_FORW_RELOC_ACK, {
2681             {GTP_EXT_CAUSE, GTP_MANDATORY},
2682             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2683             {0, 0}
2684         }
2685     },
2686     {
2687         GTP_MSG_FORW_SRNS_CNTXT_ACK, {
2688             {GTP_EXT_CAUSE, GTP_MANDATORY},
2689             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2690             {0, 0}
2691         }
2692     },
2693     {
2694         GTP_MSG_FORW_SRNS_CNTXT, {
2695             {GTP_EXT_RAB_CNTXT, GTP_MANDATORY},
2696             {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL},        /* Source RNC PDCP context info Optional 7.7.61 */
2697             {GTP_EXT_PDU_NO, GTP_OPTIONAL},     /* PDU Numbers Optional 7.7.74 */
2698             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2699             {0, 0}
2700         }
2701     },
2702
2703 /*      7.5.14 RAN Information Management Messages */
2704     {
2705         GTP_MSG_RAN_INFO_RELAY, {
2706             {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY},       /* RAN Transparent Container Mandatory 7.7.43 */
2707             {GTP_EXT_RIM_RA, GTP_OPTIONAL},             /* RIM Routing Address Optional 7.7.57 */
2708             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2709             {0, 0}
2710         }
2711     },
2712 /* 7.5A MBMS Messages
2713  * 7.5A.1 UE Specific MBMS Messages
2714  */
2715     {
2716         GTP_MBMS_NOTIFY_REQ, {
2717             {GTP_EXT_IMSI, GTP_MANDATORY},      /* IMSI Mandatory 7.7.2 */
2718             {GTP_EXT_TEID_CP, GTP_MANDATORY},   /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2719             {GTP_EXT_NSAPI, GTP_MANDATORY},     /* NSAPI Mandatory 7.7.17 */
2720             {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2721             {GTP_EXT_APN, GTP_MANDATORY},       /* Access Point Name Mandatory 7.7.30 */
2722             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},  /* GGSN Address for Control Plane Mandatory 7.7.32 */
2723             {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2724             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2725             {0, 0}
2726         }
2727     },
2728     {
2729         GTP_MBMS_NOTIFY_RES, {
2730             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2731             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2732             {0, 0}
2733         }
2734     },
2735     {
2736         GTP_MBMS_NOTIFY_REJ_REQ, {
2737             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2738             {GTP_EXT_TEID_CP, GTP_MANDATORY},   /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
2739             {GTP_EXT_NSAPI, GTP_MANDATORY},     /* NSAPI Mandatory 7.7.17 */
2740             {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2741             {GTP_EXT_APN, GTP_MANDATORY},       /* Access Point Name Mandatory 7.7.30 */
2742             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2743             {0, 0}
2744         }
2745     },
2746     {
2747         GTP_MBMS_NOTIFY_REJ_RES, {
2748             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2749             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2750             {0, 0}
2751         }
2752     },
2753     {
2754         GTP_CREATE_MBMS_CNTXT_REQ, {
2755             {GTP_EXT_IMSI, GTP_CONDITIONAL},    /* IMSI Conditional 7.7.2 */
2756             {GTP_EXT_RAI, GTP_MANDATORY},       /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2757             {GTP_EXT_RECOVER, GTP_OPTIONAL},    /* Recovery Optional 7.7.11 */
2758             {GTP_EXT_SEL_MODE, GTP_CONDITIONAL},        /* Selection mode Conditional 7.7.12 */
2759             {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2760             {GTP_EXT_TRACE_REF, GTP_OPTIONAL},  /* Trace Reference Optional 7.7.24 */
2761             {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2762             {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2763             {GTP_EXT_APN, GTP_MANDATORY},       /* Access Point Name Mandatory 7.7.30 */
2764             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},  /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
2765             {GTP_EXT_MSISDN, GTP_CONDITIONAL},  /* MSISDN Conditional 7.7.33 */
2766             {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2767             {GTP_EXT_OMC_ID, GTP_OPTIONAL},     /* OMC Identity Optional 7.7.42 */
2768             {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},   /* RAT Type Optional 7.7.50 */
2769             {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},        /* User Location Information Optional 7.7.51 */
2770             {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},       /* MS Time Zone Optional 7.7.52 */
2771             {GTP_EXT_IMEISV, GTP_OPTIONAL},     /* IMEI(SV) Optional 7.7.53 */
2772             {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2773             {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},        /* Additonal Trace Info Optional 7.7.62 */
2774             {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2775             {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL},   /* Additional MBMS Trace Info Optional 7.7.68 */
2776             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2777             {0, 0}
2778         }
2779     },
2780     {
2781         GTP_CREATE_MBMS_CNTXT_RES, {
2782             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2783             {GTP_EXT_RECOVER, GTP_OPTIONAL},    /* Recovery Optional 7.7.11 */
2784             {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2785             {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2786             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2787             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2788             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},  /* Charging Gateway Address Optional 7.7.44 */
2789             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},  /* Alternative Charging Gateway Address Optional 7.7.44 */
2790             {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2791             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2792             {0, 0}
2793         }
2794     },
2795     {
2796         GTP_UPD_MBMS_CNTXT_REQ, {
2797             {GTP_EXT_IMSI, GTP_CONDITIONAL},    /* IMSI Conditional 7.7.2 */
2798             {GTP_EXT_RAI, GTP_MANDATORY},       /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
2799             {GTP_EXT_RECOVER, GTP_OPTIONAL},    /* Recovery Optional 7.7.11 */
2800             {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2801             {GTP_EXT_TRACE_REF, GTP_OPTIONAL},  /* Trace Reference Optional 7.7.24 */
2802             {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
2803             {GTP_EXT_GSN_ADDR, GTP_MANDATORY},  /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
2804             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2805             {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
2806             {GTP_EXT_OMC_ID, GTP_OPTIONAL},     /* OMC Identity Optional 7.7.42 */
2807             {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},   /* RAT Type Optional 7.7.50 */
2808             {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},        /* User Location Information Optional 7.7.51 */
2809             {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},       /* MS Time Zone Optional 7.7.52 */
2810             {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},        /* Additional Trace Info Optional 7.7.62 */
2811             {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
2812             {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL},   /* Additional MBMS Trace Info Optional 7.7.68 */
2813             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2814             {0, 0}
2815         }
2816     },
2817     {
2818         GTP_UPD_MBMS_CNTXT_RES, {
2819             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2820             {GTP_EXT_RECOVER, GTP_OPTIONAL},    /* Recovery Optional 7.7.11 */
2821             {GTP_EXT_TEID_CP, GTP_MANDATORY},   /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2822             {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
2823             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2824             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2825             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},  /* Charging Gateway Address Optional 7.7.44 */
2826             {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},  /* Alternative Charging Gateway Address Optional 7.7.44 */
2827             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2828             {0, 0}
2829         }
2830     },
2831     {
2832         GTP_DEL_MBMS_CNTXT_REQ, {
2833             {GTP_EXT_IMSI, GTP_CONDITIONAL},    /* IMSI Conditional 7.7.2 */
2834             {GTP_EXT_TEID_CP, GTP_MANDATORY},   /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2835             {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},       /* End User Address Conditional 7.7.27 */
2836             {GTP_EXT_APN, GTP_CONDITIONAL},     /* Access Point Name Conditional 7.7.30 */
2837             {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2838             {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Conditional 7.7.67 */
2839             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2840             {0, 0}
2841         }
2842     },
2843     {
2844         GTP_DEL_MBMS_CNTXT_RES, {
2845             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2846             {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
2847             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
2848             {0, 0}
2849         }
2850     },
2851     {
2852         GTP_MBMS_REG_REQ, {
2853             {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2854             {GTP_EXT_APN, GTP_MANDATORY},       /* Access Point Name Mandatory 7.7.30 */
2855             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2856             {0, 0}
2857         }
2858     },
2859     {
2860         GTP_MBMS_REG_RES, {
2861             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2862             {GTP_EXT_TMGI, GTP_MANDATORY},      /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
2863             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2864             {0, 0}
2865         }
2866     },
2867     {
2868         GTP_MBMS_DE_REG_REQ, {
2869             {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2870             {GTP_EXT_APN, GTP_MANDATORY},       /* Access Point Name Mandatory 7.7.30 */
2871             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2872             {0, 0}
2873         }
2874     },
2875     {
2876         GTP_MBMS_DE_REG_RES, {
2877             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2878             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2879             {0, 0}
2880         }
2881     },
2882     {
2883         GTP_MBMS_SES_START_REQ, {
2884             {GTP_EXT_RECOVER, GTP_OPTIONAL},    /* Recovery Optional 7.7.11 */
2885             {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2886             {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2887             {GTP_EXT_APN, GTP_MANDATORY},       /* Access Point Name Mandatory 7.7.30 */
2888             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2889             {GTP_EXT_QOS_UMTS, GTP_MANDATORY},  /* Quality of Service Profile Mandatory 7.7.34 */
2890             {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL},        /* Common Flags Mandatory 7.7.48 */
2891             {GTP_EXT_TMGI, GTP_MANDATORY},      /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
2892             {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY},      /* MBMS Session Duration Mandatory 7.7.59 */
2893             {GTP_EXT_MBMS_SA, GTP_MANDATORY},   /* MBMS Service Area Mandatory 7.7.60 */
2894             {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL},        /* MBMS Session Identifier Optional 7.7.65 */
2895             {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY},    /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
2896             {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
2897             {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY},      /* MBMS Time To Data Transfer Mandatory 7.7.70 */
2898             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2899             {0, 0}
2900         }
2901     },
2902     {
2903         GTP_MBMS_SES_START_RES, {
2904             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2905             {GTP_EXT_RECOVER, GTP_OPTIONAL},    /* Recovery Optional 7.7.11 */
2906             {GTP_EXT_TEID, GTP_CONDITIONAL},    /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
2907             {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
2908             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
2909             {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},        /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
2910             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2911             {0, 0}
2912         }
2913     },
2914     {
2915         GTP_MBMS_SES_STOP_REQ, {
2916             {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
2917             {GTP_EXT_APN, GTP_MANDATORY},       /* Access Point Name Mandatory 7.7.30 */
2918             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2919             {0, 0}
2920         }
2921     },
2922     {
2923         GTP_MBMS_SES_STOP_RES, {
2924             {GTP_EXT_CAUSE, GTP_MANDATORY},     /* Cause Mandatory 7.7.1 */
2925             {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},   /* Private Extension Optional 7.7.46 */
2926             {0, 0}
2927         }
2928     },
2929     {
2930         0, {
2931             {0, 0}
2932         }
2933     }
2934 };
2935
2936 /* Data structure attached to a conversation,
2937         to keep track of request/response-pairs
2938  */
2939 typedef struct gtp_conv_info_t {
2940     struct gtp_conv_info_t *next;
2941     GHashTable *unmatched;
2942     GHashTable *matched;
2943 } gtp_conv_info_t;
2944
2945 static gtp_conv_info_t *gtp_info_items = NULL;
2946
2947 static guint gtp_sn_hash(gconstpointer k)
2948 {
2949     const gtp_msg_hash_t *key = (const gtp_msg_hash_t *)k;
2950
2951     return key->seq_nr;
2952 }
2953
2954 static gint gtp_sn_equal_matched(gconstpointer k1, gconstpointer k2)
2955 {
2956     const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
2957     const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
2958
2959     if ( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ) {
2960         return 0;
2961     }
2962
2963     if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ) {
2964         return 0;
2965     }
2966
2967     return key1->seq_nr == key2->seq_nr;
2968 }
2969
2970 static gint gtp_sn_equal_unmatched(gconstpointer k1, gconstpointer k2)
2971 {
2972     const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
2973     const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
2974
2975     return key1->seq_nr == key2->seq_nr;
2976 }
2977
2978 static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype)
2979 {
2980     gtp_msg_hash_t gcr, *gcrp = NULL;
2981     gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data;
2982
2983     gcr.seq_nr=seq_nr;
2984
2985     switch (msgtype) {
2986     case GTP_MSG_ECHO_REQ:
2987     case GTP_MSG_CREATE_PDP_REQ:
2988     case GTP_MSG_UPDATE_PDP_REQ:
2989     case GTP_MSG_DELETE_PDP_REQ:
2990         gcr.is_request=TRUE;
2991         gcr.req_frame=pinfo->fd->num;
2992         gcr.rep_frame=0;
2993         break;
2994     case GTP_MSG_ECHO_RESP:
2995     case GTP_MSG_CREATE_PDP_RESP:
2996     case GTP_MSG_UPDATE_PDP_RESP:
2997     case GTP_MSG_DELETE_PDP_RESP:
2998         gcr.is_request=FALSE;
2999         gcr.req_frame=0;
3000         gcr.rep_frame=pinfo->fd->num;
3001         break;
3002         default:;
3003         break;
3004     }
3005
3006     gcrp = (gtp_msg_hash_t *)g_hash_table_lookup(gtp_info->matched, &gcr);
3007
3008     if (gcrp) {
3009
3010         gcrp->is_request=gcr.is_request;
3011
3012     } else {
3013
3014         /*no match, let's try to make one*/
3015         switch (msgtype) {
3016         case GTP_MSG_ECHO_REQ:
3017         case GTP_MSG_CREATE_PDP_REQ:
3018         case GTP_MSG_UPDATE_PDP_REQ:
3019         case GTP_MSG_DELETE_PDP_REQ:
3020             gcr.seq_nr=seq_nr;
3021
3022             gcrp=(gtp_msg_hash_t *)g_hash_table_lookup(gtp_info->unmatched, &gcr);
3023             if (gcrp) {
3024                 g_hash_table_remove(gtp_info->unmatched, gcrp);
3025             }
3026             /* if we cant reuse the old one, grab a new chunk */
3027             if (!gcrp) {
3028                 gcrp = se_new(gtp_msg_hash_t);
3029             }
3030             gcrp->seq_nr=seq_nr;
3031             gcrp->req_frame = pinfo->fd->num;
3032             gcrp->req_time = pinfo->fd->abs_ts;
3033             gcrp->rep_frame = 0;
3034             gcrp->msgtype = msgtype;
3035             gcrp->is_request = TRUE;
3036             g_hash_table_insert(gtp_info->unmatched, gcrp, gcrp);
3037             return NULL;
3038             break;
3039         case GTP_MSG_ECHO_RESP:
3040         case GTP_MSG_CREATE_PDP_RESP:
3041         case GTP_MSG_UPDATE_PDP_RESP:
3042         case GTP_MSG_DELETE_PDP_RESP:
3043             gcr.seq_nr=seq_nr;
3044             gcrp=(gtp_msg_hash_t *)g_hash_table_lookup(gtp_info->unmatched, &gcr);
3045
3046             if (gcrp) {
3047                 if (!gcrp->rep_frame) {
3048                     g_hash_table_remove(gtp_info->unmatched, gcrp);
3049                     gcrp->rep_frame=pinfo->fd->num;
3050                     gcrp->is_request=FALSE;
3051                     g_hash_table_insert(gtp_info->matched, gcrp, gcrp);
3052                 }
3053             }
3054             break;
3055         default:;
3056         break;
3057         }
3058     }
3059
3060     /* we have found a match */
3061     if (gcrp) {
3062         proto_item *it;
3063
3064
3065         if (gcrp->is_request) {
3066             it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
3067             PROTO_ITEM_SET_GENERATED(it);
3068         } else {
3069             nstime_t ns;
3070
3071             it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
3072             PROTO_ITEM_SET_GENERATED(it);
3073             nstime_delta(&ns, &pinfo->fd->abs_ts, &gcrp->req_time);
3074             it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
3075             PROTO_ITEM_SET_GENERATED(it);
3076         }
3077     }
3078     return gcrp;
3079 }
3080
3081
3082 static int check_field_presence(guint8 message, guint8 field, int *position)
3083 {
3084
3085     guint i = 0;
3086     _gtp_mess_items *mess_items;
3087
3088     switch (gtp_version) {
3089     case 0:
3090         mess_items = gprs_mess_items;
3091         break;
3092     case 1:
3093         mess_items = umts_mess_items;
3094         break;
3095     default:
3096         return -2;
3097     }
3098
3099     while (mess_items[i].code) {
3100         if (mess_items[i].code == message) {
3101
3102             while (mess_items[i].fields[*position].code) {
3103                 if (mess_items[i].fields[*position].code == field) {
3104                     (*position)++;
3105                     return 0;
3106                 } else {
3107                     if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
3108                         return mess_items[i].fields[(*position)++].code;
3109                     } else {
3110                         (*position)++;
3111                     }
3112                 }
3113             }
3114             return -1;
3115         }
3116         i++;
3117     }
3118
3119     return -2;
3120 }
3121
3122 /* Decoders of fields in extension headers, each function returns no of bytes from field */
3123
3124 /* GPRS:        9.60 v7.6.0, chapter
3125  * UMTS:        29.060 v4.0, chapter
3126  * 7.7.1 Cause
3127  */
3128 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3129 {
3130
3131     guint8 cause;
3132
3133     cause = tvb_get_guint8(tvb, offset + 1);
3134
3135     proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
3136
3137     return 2;
3138 }
3139
3140 /* GPRS:        9.60 v7.6.0, chapter 7.9.2
3141  * UMTS:        29.060 v4.0, chapter 7.7.2
3142  */
3143 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3144 {
3145     const gchar *imsi_str;
3146
3147     /* Octets 2 - 9 IMSI */
3148     imsi_str =  tvb_bcd_dig_to_ep_str( tvb, offset+1, 8, NULL, FALSE);
3149
3150     proto_tree_add_string(tree, hf_gtp_imsi, tvb, offset+1, 8, imsi_str);
3151
3152     return 9;
3153 }
3154
3155 /* GPRS:        9.60 v7.6.0, chapter 7.9.3
3156  * UMTS:        29.060 v4.0, chapter 7.7.3 Routeing Area Identity (RAI)
3157  */
3158 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3159 {
3160
3161     proto_tree *ext_tree_rai;
3162     proto_item *te;
3163
3164     te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_RAI, &gtp_val_ext, "Unknown message"));
3165     ext_tree_rai = proto_item_add_subtree(te, ett_gtp_rai);
3166
3167         dissect_e212_mcc_mnc(tvb, pinfo, ext_tree_rai, offset+1, TRUE);
3168     proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_lac, tvb, offset + 4, 2, tvb_get_ntohs(tvb, offset + 4));
3169     proto_tree_add_uint(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, tvb_get_guint8(tvb, offset + 6));
3170
3171     return 7;
3172 }
3173
3174 /* GPRS:        9.60 v7.6.0, chapter 7.9.4, page 39
3175  * UMTS:        29.060 v4.0, chapter 7.7.4 Temporary Logical Link Identity (TLLI)
3176  */
3177 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3178 {
3179
3180     guint32 tlli;
3181
3182     tlli = tvb_get_ntohl(tvb, offset + 1);
3183     proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
3184
3185     return 5;
3186 }
3187
3188 /* GPRS:        9.60 v7.6.0, chapter 7.9.5, page 39
3189  * UMTS:        29.060 v4.0, chapter 7.7.5 Packet TMSI (P-TMSI)
3190  */
3191 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3192 {
3193
3194     guint32 ptmsi;
3195
3196     ptmsi = tvb_get_ntohl(tvb, offset + 1);
3197     proto_tree_add_uint(tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
3198
3199     return 5;
3200 }
3201
3202 /*
3203  * adjust - how many bytes before offset should be highlighted
3204  */
3205 static int decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 adjust)
3206 {
3207
3208     guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
3209     proto_tree *ext_tree_qos;
3210     proto_item *te;
3211
3212     spare1 = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_SPARE1_MASK;
3213     delay = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_DELAY_MASK;
3214     reliability = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_RELIABILITY_MASK;
3215     peak = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
3216     spare2 = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
3217     precedence = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
3218     spare3 = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
3219     mean = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
3220
3221     te = proto_tree_add_text(tree, tvb, offset - adjust, 3 + adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
3222                              qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
3223     ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
3224
3225     if (adjust != 0) {
3226         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
3227         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
3228         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
3229         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
3230         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
3231         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
3232         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
3233         proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
3234     }
3235
3236     return 3;
3237 }
3238
3239 /* GPRS:        9.60 v7.6.0, chapter 7.9.6, page 39
3240  *              4.08
3241  *              3.60
3242  * UMTS:        not present
3243  * TODO:        check if length is included: ETSI 4.08 vs 9.60
3244  */
3245 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3246 {
3247
3248     return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
3249
3250 }
3251
3252 /* GPRS:        9.60 v7.6.0, chapter 7.9.7, page 39
3253  * UMTS:        29.060 v4.0, chapter 7.7.6 Reordering Required
3254  */
3255 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3256 {
3257
3258     guint8 reorder;
3259
3260     reorder = tvb_get_guint8(tvb, offset + 1) & 0x01;
3261     proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
3262
3263     return 2;
3264 }
3265
3266 /* GPRS:        9.60 v7.6.0, chapter 7.9.8, page 40
3267  *              4.08 v7.1.2, chapter 10.5.3.1+
3268  * UMTS:        29.060 v4.0, chapter 7.7.7
3269  * TODO: Add blurb support by registering items in the protocol registration
3270  */
3271 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3272 {
3273
3274     proto_tree *ext_tree_auth_tri;
3275     proto_item *te;
3276
3277     te = proto_tree_add_text(tree, tvb, offset, 29, "%s", val_to_str_ext_const(GTP_EXT_AUTH_TRI, &gtp_val_ext, "Unknown message"));
3278     ext_tree_auth_tri = proto_item_add_subtree(te, ett_gtp_auth_tri);
3279
3280     proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + 1, 16));
3281     proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + 17, 4));
3282     proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + 21, 8));
3283
3284     return 1 + 16 + 4 + 8;
3285 }
3286
3287 /* GPRS:        9.60 v7.6.0, chapter 7.9.9, page 40
3288  *              9.02 v7.7.0, page 1090
3289  * UMTS:        29.060 v4.0, chapter 7.7.8, page 48
3290  *              29.002 v4.2.1, chapter 17.5, page 268
3291  */
3292 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3293 {
3294
3295     guint8 map_cause;
3296
3297     map_cause = tvb_get_guint8(tvb, offset + 1);
3298     proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
3299
3300     return 2;
3301 }
3302
3303 /* GPRS:        9.60 v7.6.0, chapter 7.9.10, page 41
3304  * UMTS:        29.060 v4.0, chapter 7.7.9, page 48
3305  */
3306 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3307 {
3308
3309     guint32 ptmsi_sig;
3310
3311     ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
3312     proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
3313
3314     return 4;
3315 }
3316
3317 /* GPRS:        9.60 v7.6.0, chapter 7.9.11, page 41
3318  * UMTS:        29.060 v4.0, chapter 7.7.10, page 49
3319  */
3320 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3321 {
3322
3323     guint8 ms_valid;
3324
3325     ms_valid = tvb_get_guint8(tvb, offset + 1) & 0x01;
3326     proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
3327
3328     return 2;
3329 }
3330
3331 /* GPRS:        9.60 v7.6.0, chapter 7.9.12, page 41
3332  * UMTS:        29.060 v4.0, chapter 7.7.11 Recovery
3333  */
3334 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3335 {
3336
3337     guint8 recovery;
3338
3339     recovery = tvb_get_guint8(tvb, offset + 1);
3340     proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
3341
3342     return 2;
3343 }
3344
3345 /* GPRS:        9.60 v7.6.0, chapter 7.9.13, page 42
3346  * UMTS:        29.060 v4.0, chapter 7.7.12 Selection Mode
3347  */
3348
3349
3350 static const gchar *dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
3351 {
3352     guint8 sel_mode;
3353
3354     /* Value in ASCII(UTF-8) */
3355     sel_mode = tvb_get_guint8(tvb, 0) - 0x30;
3356     proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
3357
3358     return val_to_str_const(sel_mode, sel_mode_type, "Unknown");
3359 }
3360
3361 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3362 {
3363
3364     proto_tree_add_item(tree, hf_gtp_sel_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
3365     return 2;
3366 }
3367
3368 /* GPRS:        9.60 v7.6.0, chapter 7.9.14, page 42
3369  * UMTS:        29.060 v4.0, chapter 7.7.13, page 50
3370  */
3371 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3372 {
3373
3374     guint16 ext_flow_label;
3375     guint32 teid_data;
3376
3377     switch (gtp_version) {
3378     case 0:
3379         ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
3380         proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
3381
3382         return 3;
3383     case 1:
3384         teid_data = tvb_get_ntohl(tvb, offset + 1);
3385         proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
3386
3387         return 5;
3388     default:
3389         proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
3390
3391         return 3;
3392     }
3393 }
3394
3395 /* GPRS:        9.60 v7.6.0, chapter 7.9.15, page 42
3396  * UMTS:        29.060 v4.0, chapter 7.7.14, page 42
3397  */
3398 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3399 {
3400
3401     guint16 flow_sig;
3402     guint32 teid_cp;
3403
3404     switch (gtp_version) {
3405     case 0:
3406         flow_sig = tvb_get_ntohs(tvb, offset + 1);
3407         proto_tree_add_uint(tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
3408         return 3;
3409     case 1:
3410         teid_cp = tvb_get_ntohl(tvb, offset + 1);
3411         proto_tree_add_uint(tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
3412         return 5;
3413     default:
3414         proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
3415         return 3;
3416     }
3417 }
3418
3419 /* GPRS:        9.60 v7.6.0, chapter 7.9.16, page 42
3420  * UMTS:        29.060 v4.0, chapter 7.7.15, page 51
3421  */
3422 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3423 {
3424
3425     guint16 flow_ii;
3426     guint32 teid_ii;
3427     proto_tree *ext_tree_flow_ii;
3428     proto_item *te;
3429
3430     switch (gtp_version) {
3431     case 0:
3432         te = proto_tree_add_text(tree, tvb, offset, 4, "%s", val_to_str_ext_const(GTP_EXT_FLOW_II, &gtp_val_ext, "Unknown message"));
3433         ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3434
3435         proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3436
3437         flow_ii = tvb_get_ntohs(tvb, offset + 2);
3438         proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
3439
3440         return 4;
3441     case 1:
3442         te = proto_tree_add_text(tree, tvb, offset, 6, "%s", val_to_str_ext_const(GTP_EXT_TEID_II, &gtpv1_val_ext, "Unknown message"));
3443         ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
3444
3445         proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, tvb_get_guint8(tvb, offset + 1) & 0x0F);
3446
3447
3448         teid_ii = tvb_get_ntohl(tvb, offset + 2);
3449         proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
3450
3451         return 6;
3452     default:
3453         proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
3454
3455         return 4;
3456     }
3457 }
3458
3459 /* GPRS:        9.60 v7.6.0, chapter 7.9.16A, page 43
3460  * UMTS:        29.060 v4.0, chapter 7.7.16, page 51
3461  * Check if all ms_reason types are included
3462  */
3463 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3464 {
3465
3466     guint8 field19;
3467
3468     field19 = tvb_get_guint8(tvb, offset + 1);
3469
3470     switch (gtp_version) {
3471     case 0:
3472         proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
3473         break;
3474     case 1:
3475         proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
3476         break;
3477     default:
3478         proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
3479         break;
3480     }
3481
3482     return 2;
3483 }
3484
3485 /* GPRS:        not present
3486  * UMTS:        29.060 v4.0, chapter 7.7.17, page 51
3487  */
3488 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3489 {
3490
3491     guint8 nsapi;
3492
3493     nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3494     proto_tree_add_uint(tree, hf_gtp_nsapi, tvb, offset, 2, nsapi);
3495
3496     return 2;
3497 }
3498
3499 /* GPRS:        not present
3500  * UMTS:        29.060 v4.0, chapter 7.7.18, page 52
3501  */
3502 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3503 {
3504
3505     guint8 ranap;
3506
3507     ranap = tvb_get_guint8(tvb, offset + 1);
3508
3509     if (ranap > 0 && ranap <= 64)
3510         proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3511                                    ranap, "%s (Radio Network Layer Cause) : %s (%u)",
3512                                    val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
3513                                    val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3514
3515     if (ranap > 64 && ranap <= 80)
3516         proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3517                                    ranap, "%s (Transport Layer Cause) : %s (%u)",
3518                                    val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
3519                                    val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3520
3521     if (ranap > 80 && ranap <= 96)
3522         proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
3523                                    ranap, "%s (NAS Cause) : %s (%u)",
3524                                    val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
3525                                    val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3526
3527     if (ranap > 96 && ranap <= 112)
3528         proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3529                                    "%s (Protocol Cause) : %s (%u)",
3530                                    val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
3531                                    val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3532
3533     if (ranap > 112 && ranap <= 128)
3534         proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3535                                    "%s (Miscellaneous Cause) : %s (%u)",
3536                                    val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
3537                                    val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3538
3539     if (ranap > 128 /* && ranap <=255 */ )
3540         proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
3541                                    "%s (Non-standard Cause) : %s (%u)",
3542                                    val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
3543                                    val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
3544
3545     return 2;
3546 }
3547
3548 /* GPRS:        not present
3549  * UMTS:        29.060 v4.0, chapter 7.7.19, page 52
3550  */
3551 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3552 {
3553
3554     guint8 nsapi;
3555     proto_tree *ext_tree_rab_cntxt;
3556     proto_item *te;
3557
3558     te = proto_tree_add_text(tree, tvb, offset, 10, "%s", val_to_str_ext_const(GTP_EXT_RAB_CNTXT, &gtp_val_ext, "Unknown message"));
3559     ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_rab_cntxt);
3560
3561     nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
3562
3563     proto_tree_add_uint(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, nsapi);
3564     proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
3565     proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
3566     proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
3567     proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, ENC_BIG_ENDIAN);
3568
3569     return 10;
3570 }
3571
3572
3573 /* GPRS:        not present
3574  * UMTS:        29.060 v4.0, chapter 7.7.20, page 53
3575  */
3576 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3577 {
3578
3579     guint8 rp_sms;
3580
3581     rp_sms = tvb_get_guint8(tvb, offset + 1) & 0x07;
3582     proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
3583
3584     return 2;
3585 }
3586
3587 /* GPRS:        not present
3588  * UMTS:        29.060 v4.0, chapter 7.7.21, page 53
3589  */
3590 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
3591 {
3592
3593     proto_tree *ext_tree_rp;
3594     proto_item *te;
3595     guint8 nsapi, rp, spare;
3596
3597     nsapi = tvb_get_guint8(tvb, offset + 1) & 0xF0;
3598     spare = tvb_get_guint8(tvb, offset + 1) & 0x08;
3599     rp = tvb_get_guint8(tvb, offset + 1) & 0x07;
3600
3601     te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
3602     ext_tree_rp = proto_item_add_subtree(te, ett_gtp_rp);
3603
3604     proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, nsapi);
3605     proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, spare);
3606     proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, rp);
3607
3608     return 2;
3609 }