epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-gtp.c
blob55eb8ca0d549cf6abb7904bf10cc1aa60899330b
1 /* packet-gtp.c
3 * Routines for GTP dissection
4 * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
5 * Nicolas Balkota <balkota@mac.com>
7 * Updates and corrections:
8 * Copyright 2006 - 2009, Anders Broman <anders.broman@ericsson.com>
10 * Added Bearer control mode dissection:
11 * Copyright 2011, Grzegorz Szczytowski <grzegorz.szczytowski@gmail.com>
13 * Updates and corrections:
14 * Copyright 2011-2013, Anders Broman <anders.broman@ericsson.com>
16 * PDCP PDU number extension header support added by Martin Isaksson <martin.isaksson@ericsson.com>
18 * Control Plane Request-Response tracking code Largely based on similar routines in
19 * packet-ldap.c by Ronnie Sahlberg
20 * Added by Kari Tiirikainen <kari.tiirikainen@nsn.com>
22 * Wireshark - Network traffic analyzer
23 * By Gerald Combs <gerald@wireshark.org>
24 * Copyright 1998 Gerald Combs
26 * SPDX-License-Identifier: GPL-2.0-or-later
28 * GTP v0: 3GPP TS 09.60
30 * http://www.3gpp.org/ftp/Specs/html-info/0960.htm
32 * GTP v1: 3GPP TS 29.060
34 * http://www.3gpp.org/ftp/Specs/html-info/29060.htm
36 * GTP': 3GPP TS 32.295
38 * http://www.3gpp.org/ftp/Specs/html-info/32295.htm
41 #include "config.h"
43 #include <math.h>
45 #include <epan/packet.h>
46 #include <epan/conversation.h>
47 #include <epan/prefs.h>
48 #include <epan/expert.h>
49 #include <epan/sminmpec.h>
50 #include <epan/addr_resolv.h>
51 #include <epan/asn1.h>
52 #include <epan/tap.h>
53 #include <epan/srt_table.h>
54 #include <epan/to_str.h>
55 #include <epan/uat.h>
56 #include <epan/proto_data.h>
57 #include <epan/etypes.h>
58 #include <epan/tfs.h>
59 #include <epan/unit_strings.h>
61 #include "packet-radius.h"
62 #include "packet-gsm_a_common.h"
63 #include "packet-gsm_map.h"
64 #include "packet-gprscdr.h"
65 #include "packet-bssgp.h"
66 #include "packet-rrc.h"
67 #include "packet-e212.h"
68 #include "packet-e164.h"
69 #include "packet-gtp.h"
70 #include "packet-ranap.h"
71 #include "packet-pdcp-nr.h"
72 #include "packet-pdcp-lte.h"
73 #include "packet-rohc.h"
75 void proto_register_gtp(void);
76 void proto_reg_handoff_gtp(void);
78 static dissector_table_t gtp_priv_ext_dissector_table;
79 static dissector_table_t gtp_cdr_fmt_dissector_table;
80 static dissector_table_t gtp_hdr_ext_dissector_table;
81 static dissector_handle_t gtp_handle, gtp_prime_handle;
82 static dissector_handle_t nrup_handle;
84 static heur_dissector_list_t heur_subdissector_list;
86 #define GTPv0_PORT 3386
87 #define GTPv1C_PORT 2123 /* 3G Control PDU */
88 #define GTPv1U_PORT 2152 /* 3G T-PDU */
90 #define GTPv0_HDR_LENGTH 20
91 #define GTPv1_HDR_LENGTH 12
92 #define GTP_PRIME_HDR_LENGTH 6
94 /* to check compliance with ETSI */
95 #define GTP_MANDATORY 1
96 #define GTP_OPTIONAL 2
97 #define GTP_CONDITIONAL 4
99 #define GTP_TPDU_AS_NONE -1
100 #define GTP_TPDU_AS_TPDU_HEUR 0
101 #define GTP_TPDU_AS_PDCP_LTE 1
102 #define GTP_TPDU_AS_PDCP_NR 2
103 #define GTP_TPDU_AS_SYNC 3
104 #define GTP_TPDU_AS_ETHERNET 4
105 #define GTP_TPDU_AS_CUSTOM 5
107 static bool g_gtp_over_tcp = true;
108 bool g_gtp_session;
110 static unsigned pref_pair_matching_max_interval_ms; /* Default: disable */
112 static unsigned g_gtpv0_port = GTPv0_PORT;
113 static unsigned g_gtpv1c_port = GTPv1C_PORT;
114 static unsigned g_gtpv1u_port = GTPv1U_PORT;
116 static int proto_gtp;
117 static int proto_gtpprime;
119 /*KTi*/
120 static int hf_gtp_ie_id;
121 static int hf_gtp_response_in;
122 static int hf_gtp_response_to;
123 static int hf_gtp_time;
124 static int hf_gtp_apn;
125 static int hf_gtp_cause;
126 static int hf_gtp_chrg_char;
127 static int hf_gtp_chrg_char_s;
128 static int hf_gtp_chrg_char_n;
129 static int hf_gtp_chrg_char_p;
130 static int hf_gtp_chrg_char_f;
131 static int hf_gtp_chrg_char_h;
132 static int hf_gtp_chrg_char_r;
133 static int hf_gtp_chrg_id;
134 static int hf_gtp_chrg_ipv4;
135 static int hf_gtp_chrg_ipv6;
136 static int hf_gtp_ext_flow_label;
137 static int hf_gtp_ext_id;
138 static int hf_gtp_ext_val;
139 static int hf_gtp_ext_hdr;
140 static int hf_gtp_ext_hdr_next;
141 static int hf_gtp_ext_hdr_length;
142 static int hf_gtp_ext_hdr_ran_cont;
143 static int hf_gtp_ext_hdr_spare_bits;
144 static int hf_gtp_ext_hdr_spare_bytes;
145 static int hf_gtp_ext_hdr_long_pdcp_sn;
146 static int hf_gtp_ext_hdr_xw_ran_cont;
147 static int hf_gtp_ext_hdr_pdcpsn;
148 static int hf_gtp_ext_hdr_udp_port;
149 static int hf_gtp_flags;
150 static int hf_gtp_flags_ver;
151 static int hf_gtp_prime_flags_ver;
152 static int hf_gtp_flags_pt;
153 static int hf_gtp_flags_spare1;
154 static int hf_gtp_flags_hdr_length;
155 static int hf_gtp_flags_snn;
156 static int hf_gtp_flags_spare2;
157 static int hf_gtp_flags_e;
158 static int hf_gtp_flags_s;
159 static int hf_gtp_flags_pn;
160 static int hf_gtp_flow_ii;
161 static int hf_gtp_flow_label;
162 static int hf_gtp_flow_sig;
163 static int hf_gtp_gsn_addr_len;
164 static int hf_gtp_gsn_addr_type;
165 static int hf_gtp_gsn_ipv4;
166 static int hf_gtp_gsn_ipv6;
167 static int hf_gtp_length;
168 static int hf_gtp_map_cause;
169 static int hf_gtp_message_type;
170 static int hf_gtp_ms_reason;
171 static int hf_gtp_ms_valid;
172 static int hf_gtp_npdu_number;
173 static int hf_gtp_node_ipv4;
174 static int hf_gtp_node_ipv6;
175 static int hf_gtp_node_name;
176 static int hf_gtp_node_realm;
177 static int hf_gtp_nsapi;
178 static int hf_gtp_ptmsi;
179 static int hf_gtp_ptmsi_sig;
180 static int hf_gtp_qos_version;
181 static int hf_gtp_qos_spare1;
182 static int hf_gtp_qos_delay;
183 static int hf_gtp_qos_mean;
184 static int hf_gtp_qos_peak;
185 static int hf_gtp_qos_spare2;
186 static int hf_gtp_qos_precedence;
187 static int hf_gtp_qos_spare3;
188 static int hf_gtp_qos_reliability;
189 static int hf_gtp_qos_al_ret_priority;
190 static int hf_gtp_qos_traf_class;
191 static int hf_gtp_qos_del_order;
192 static int hf_gtp_qos_del_err_sdu;
193 static int hf_gtp_qos_max_sdu_size;
194 static int hf_gtp_qos_max_ul;
195 static int hf_gtp_qos_max_dl;
196 static int hf_gtp_qos_res_ber;
197 static int hf_gtp_qos_sdu_err_ratio;
198 static int hf_gtp_qos_trans_delay;
199 static int hf_gtp_qos_traf_handl_prio;
200 static int hf_gtp_qos_guar_ul;
201 static int hf_gtp_qos_guar_dl;
202 static int hf_gtp_qos_spare4;
203 static int hf_gtp_qos_sig_ind;
204 static int hf_gtp_qos_src_stat_desc;
205 static int hf_gtp_qos_arp;
206 static int hf_gtp_qos_arp_pvi;
207 static int hf_gtp_qos_arp_pl;
208 static int hf_gtp_qos_arp_pci;
209 static int hf_gtp_qos_qci;
210 static int hf_gtp_qos_ul_mbr;
211 static int hf_gtp_qos_dl_mbr;
212 static int hf_gtp_qos_ul_gbr;
213 static int hf_gtp_qos_dl_gbr;
214 static int hf_gtp_qos_ul_apn_ambr;
215 static int hf_gtp_qos_dl_apn_ambr;
216 static int hf_gtp_pkt_flow_id;
217 static int hf_gtp_rab_gtpu_dn;
218 static int hf_gtp_rab_gtpu_up;
219 static int hf_gtp_rab_pdu_dn;
220 static int hf_gtp_rab_pdu_up;
221 static int hf_gtp_uli_geo_loc_type;
222 static int hf_gtp_cgi_ci;
223 static int hf_gtp_sai_sac;
224 static int hf_gtp_rai_rac;
225 static int hf_gtp_lac;
226 static int hf_gtp_tac;
227 static int hf_gtp_ranap_cause;
228 static int hf_gtp_recovery;
229 static int hf_gtp_reorder;
230 static int hf_gtp_rnc_ipv4;
231 static int hf_gtp_rnc_ipv6;
232 static int hf_gtp_rp;
233 static int hf_gtp_rp_nsapi;
234 static int hf_gtp_rp_sms;
235 static int hf_gtp_rp_spare;
236 static int hf_gtp_sel_mode;
237 static int hf_gtp_seq_number;
238 static int hf_gtp_session;
239 static int hf_gtp_sndcp_number;
240 static int hf_gtp_tear_ind;
241 static int hf_gtp_teid;
242 static int hf_gtp_teid_cp;
243 static int hf_gtp_uplink_teid_cp;
244 static int hf_gtp_teid_data;
245 static int hf_gtp_uplink_teid_data;
246 static int hf_gtp_teid_ii;
247 static int hf_gtp_tid;
248 static int hf_gtp_tlli;
249 static int hf_gtp_tr_comm;
250 static int hf_gtp_trace_ref;
251 static int hf_gtp_trace_type;
252 static int hf_gtp_user_addr_pdp_org;
253 static int hf_gtp_user_addr_pdp_type;
254 static int hf_gtp_user_ipv4;
255 static int hf_gtp_user_ipv6;
256 static int hf_gtp_security_mode;
257 static int hf_gtp_no_of_vectors;
258 static int hf_gtp_cipher_algorithm;
259 static int hf_gtp_cksn_ksi;
260 static int hf_gtp_cksn;
261 static int hf_gtp_ksi;
262 static int hf_gtp_ext_length;
263 static int hf_gtp_utran_field;
264 static int hf_gtp_ext_apn_res;
265 static int hf_gtp_ext_rat_type;
266 static int hf_gtp_ext_imeisv;
267 static int hf_gtp_target_rnc_id;
268 static int hf_gtp_target_ext_rnc_id;
269 static int hf_gtp_bssgp_cause;
270 static int hf_gtp_bssgp_ra_discriminator;
271 static int hf_gtp_sapi;
272 static int hf_gtp_xid_par_len;
273 static int hf_gtp_rep_act_type;
274 static int hf_gtp_correlation_id;
275 static int hf_gtp_earp_pci;
276 static int hf_gtp_earp_pl;
277 static int hf_gtp_earp_pvi;
278 static int hf_gtp_ext_comm_flags_uasi;
279 static int hf_gtp_ext_comm_flags_bdwi;
280 static int hf_gtp_ext_comm_flags_pcri;
281 static int hf_gtp_ext_comm_flags_vb;
282 static int hf_gtp_ext_comm_flags_retloc;
283 static int hf_gtp_ext_comm_flags_cpsr;
284 static int hf_gtp_ext_comm_flags_ccrsi;
285 static int hf_gtp_ext_comm_flags_unauthenticated_imsi;
286 static int hf_gtp_csg_id;
287 static int hf_gtp_access_mode;
288 static int hf_gtp_cmi;
289 static int hf_gtp_csg_inf_rep_act_ucicsg;
290 static int hf_gtp_csg_inf_rep_act_ucishc;
291 static int hf_gtp_csg_inf_rep_act_uciuhc;
292 static int hf_gtp_ext_comm_flags_II_pnsi;
293 static int hf_gtp_ext_comm_flags_II_dtci;
294 static int hf_gtp_ext_comm_flags_II_pmtsmi;
295 static int hf_gtp_ext_comm_flags_II_spare;
296 static int hf_gtp_ciot_opt_sup_ind_sgni_pdn;
297 static int hf_gtp_ciot_opt_sup_ind_scni_pdn;
298 static int hf_gtp_ciot_opt_sup_ind_spare;
299 static int hf_gtp_up_fun_sel_ind_flags_dcnr;
300 static int hf_gtp_up_fun_sel_ind_flags_spare;
301 static int hf_gtp_cdr_app;
302 static int hf_gtp_cdr_rel;
303 static int hf_gtp_cdr_ver;
304 static int hf_gtp_cdr_rel_ext;
305 static int hf_gtp_cdr_length;
306 static int hf_gtp_cdr_context;
307 static int hf_gtp_cmn_flg_ppc;
308 static int hf_gtp_cmn_flg_mbs_srv_type;
309 static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy;
310 static int hf_gtp_cmn_flg_mbs_cnt_inf;
311 static int hf_gtp_cmn_flg_nrsn;
312 static int hf_gtp_cmn_flg_no_qos_neg;
313 static int hf_gtp_cmn_flg_upgrd_qos_sup;
314 static int hf_gtp_cmn_flg_dual_addr_bearer_flg;
315 static int hf_gtp_linked_nsapi;
316 static int hf_gtp_enh_nsapi;
317 static int hf_gtp_tmgi;
318 static int hf_gtp_mbms_ses_dur_days;
319 static int hf_gtp_mbms_ses_dur_s;
320 static int hf_gtp_no_of_mbms_sa_codes;
321 static int hf_gtp_mbms_sa_code;
322 static int hf_gtp_trace_ref2;
323 static int hf_gtp_trace_rec_session_ref;
324 static int hf_gtp_trace_triggers_ggsn_pdp;
325 static int hf_gtp_trace_triggers_ggsn_mbms;
326 static int hf_gtp_trace_triggers_ggsn;
327 static int hf_gtp_trace_depth;
328 static int hf_gtp_trace_loi_ggsn_gmb;
329 static int hf_gtp_trace_loi_ggsn_gi;
330 static int hf_gtp_trace_loi_ggsn_gn;
331 static int hf_gtp_trace_loi_ggsn;
332 static int hf_gtp_trace_activity_control;
333 static int hf_gtp_hop_count;
334 static int hf_gtp_mbs_2g_3g_ind;
335 static int hf_gtp_trace_triggers_bm_sc_mbms;
336 static int hf_gtp_trace_triggers_bm_sc;
337 static int hf_gtp_trace_loi_bm_sc_gmb;
338 static int hf_gtp_trace_loi_bm_sc;
339 static int hf_gtp_time_2_dta_tr;
340 static int hf_gtp_target_lac;
341 static int hf_gtp_target_rac;
342 static int hf_gtp_target_ci;
343 static int hf_gtp_source_type;
344 static int hf_gtp_source_lac;
345 static int hf_gtp_source_rac;
346 static int hf_gtp_source_ci;
347 static int hf_gtp_source_rnc_id;
348 static int hf_gtp_ext_ei;
349 static int hf_gtp_ext_gcsi;
350 static int hf_gtp_ext_dti;
351 static int hf_gtp_ra_prio_lcs;
352 static int hf_gtp_bcm;
353 static int hf_gtp_fqdn;
354 static int hf_gtp_rim_routing_addr;
355 static int hf_gtp_mbms_flow_id;
356 static int hf_gtp_mbms_dist_indic;
357 static int hf_gtp_ext_apn_ambr_ul;
358 static int hf_gtp_ext_apn_ambr_dl;
359 static int hf_gtp_ext_sub_ue_ambr_ul;
360 static int hf_gtp_ext_sub_ue_ambr_dl;
361 static int hf_gtp_ext_auth_ue_ambr_ul;
362 static int hf_gtp_ext_auth_ue_ambr_dl;
363 static int hf_gtp_ext_auth_apn_ambr_ul;
364 static int hf_gtp_ext_auth_apn_ambr_dl;
365 static int hf_gtp_ext_ggsn_back_off_time_units;
366 static int hf_gtp_ext_ggsn_back_off_timer;
367 static int hf_gtp_lapi;
368 static int hf_gtp_higher_br_16mb_flg;
369 static int hf_gtp_max_mbr_apn_ambr_ul;
370 static int hf_gtp_max_mbr_apn_ambr_dl;
371 static int hf_gtp_ext_enb_type;
372 static int hf_gtp_macro_enodeb_id;
373 static int hf_gtp_home_enodeb_id;
374 static int hf_gtp_dummy_octets;
376 static int hf_pdcp_cont;
378 static int hf_gtp_ext_hdr_pdu_ses_cont_pdu_type;
379 static int hf_gtp_ext_hdr_pdu_ses_cont_qmp;
380 static int hf_gtp_ext_hdr_pdu_ses_cont_snp_dl;
381 static int hf_gtp_ext_hdr_pdu_ses_cont_msnp;
382 static int hf_gtp_ext_hdr_pdu_ses_cont_ppp;
383 static int hf_gtp_ext_hdr_pdu_ses_cont_rqi;
384 static int hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id;
385 static int hf_gtp_ext_hdr_pdu_ses_cont_ppi;
386 static int hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp;
387 static int hf_gtp_ext_hdr_pdu_ses_cont_dl_qfi_sn;
388 static int hf_gtp_ext_hdr_pdu_ses_cont_dl_mbs_qfi_sn;
389 static int hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind;
390 static int hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind;
391 static int hf_gtp_ext_hdr_pdu_ses_cont_snp_ul;
392 static int hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind;
393 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag;
394 static int hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp_repeat;
395 static int hf_gtp_ext_hdr_pdu_ses_cont_dl_recv_time_stamp;
396 static int hf_gtp_ext_hdr_pdu_ses_cont_ul_send_time_stamp;
397 static int hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_result;
398 static int hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_result;
399 static int hf_gtp_ext_hdr_pdu_ses_cont_ul_qfi_sn;
400 static int hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_result;
401 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7;
402 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6;
403 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5;
404 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4;
405 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3;
406 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2;
407 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1;
408 static int hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0;
409 static int hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind;
411 static int hf_gtp_spare_b0;
412 static int hf_gtp_spare_b4b0;
413 static int hf_gtp_spare_b7b1;
414 static int hf_gtp_rnc_ip_addr_v4;
415 static int hf_gtp_rnc_ip_addr_v6;
416 static int hf_gtp_ms_cm_2_len;
417 static int hf_gtp_ms_cm_3_len;
418 static int hf_gtp_sup_codec_lst_len;
419 static int hf_gtp_add_flg_for_srvcc_ics;
420 static int hf_gtp_sel_mode_val;
421 static int hf_gtp_uli_timestamp;
422 static int hf_gtp_lhn_id;
423 static int hf_gtp_sel_entity;
424 static int hf_gtp_ue_usage_type_value;
425 static int hf_gtp_scef_id_length;
426 static int hf_gtp_scef_id;
427 static int hf_gtp_iov_updates_counter;
428 static int hf_gtp_mapped_ue_usage_type;
430 /* Generated from convert_proto_tree_add_text.pl */
431 static int hf_gtp_rfsp_index;
432 static int hf_gtp_quintuplet_ciphering_key;
433 static int hf_gtp_kc;
434 static int hf_gtp_rand;
435 static int hf_gtp_pdp_context_identifier;
436 static int hf_gtp_receive_n_pdu_number;
437 static int hf_gtp_container_length;
438 static int hf_gtp_quintuplets_length;
439 static int hf_gtp_auth;
440 static int hf_gtp_tft_length;
441 static int hf_gtp_ggsn_address_for_control_plane_ipv4;
442 static int hf_gtp_ggsn_address_for_control_plane_ipv6;
443 static int hf_gtp_ggsn_address_for_user_traffic_ipv4;
444 static int hf_gtp_ggsn_address_for_user_traffic_ipv6;
445 static int hf_gtp_integrity_key_ik;
446 static int hf_gtp_gsn_address_information_element_length;
447 static int hf_gtp_reordering_required;
448 static int hf_gtp_sres;
449 static int hf_gtp_data_record_format;
450 static int hf_gtp_timezone;
451 static int hf_gtp_timezone_dst;
452 static int hf_gtp_authentication_length;
453 static int hf_gtp_send_n_pdu_number;
454 static int hf_gtp_sequence_number_up;
455 static int hf_gtp_pdp_address_length;
456 static int hf_gtp_transaction_identifier;
457 static int hf_gtp_xres_length;
458 static int hf_gtp_ggsn_address_length;
459 static int hf_gtp_apn_length;
460 static int hf_gtp_sequence_number_down;
461 static int hf_gtp_pdp_address_ipv4;
462 static int hf_gtp_activity_status_indicator;
463 static int hf_gtp_pdp_type;
464 static int hf_gtp_quintuplet_integrity_key;
465 static int hf_gtp_pdp_address_ipv6;
466 static int hf_gtp_rab_setup_length;
467 static int hf_gtp_number_of_data_records;
468 static int hf_gtp_ciphering_key_kc;
469 static int hf_gtp_pdp_cntxt_sapi;
470 static int hf_gtp_xres;
471 static int hf_gtp_pdp_organization;
472 static int hf_gtp_node_address_length;
473 static int hf_gtp_gsn_address_length;
474 static int hf_gtp_vplmn_address_allowed;
475 static int hf_gtp_uplink_flow_label_signalling;
476 static int hf_gtp_extended_end_user_address;
477 static int hf_gtp_ciphering_key_ck;
478 static int hf_gtp_fqdn_length;
479 static int hf_gtp_seq_num_released;
480 static int hf_gtp_seq_num_canceled;
481 static int hf_gtp_requests_responded;
482 static int hf_gtp_hyphen_separator;
483 static int hf_gtp_ms_network_cap_content_len;
484 static int hf_gtp_iei;
485 static int hf_gtp_iei_mobile_id_len;
486 static int hf_gtp_qos_umts_length;
487 static int hf_gtp_num_ext_hdr_types;
488 static int hf_gtp_ext_hdr_type;
489 static int hf_gtp_tpdu_data;
491 static int hf_gtp_sgsn_address_for_control_plane_ipv4;
492 static int hf_gtp_sgsn_address_for_control_plane_ipv6;
493 static int hf_gtp_sgsn_address_for_user_traffic_ipv4;
494 static int hf_gtp_sgsn_address_for_user_traffic_ipv6;
496 /* Initialize the subtree pointers */
497 static int ett_gtp;
498 static int ett_gtp_flags;
499 static int ett_gtp_ext;
500 static int ett_gtp_ext_hdr;
501 static int ett_gtp_qos;
502 static int ett_gtp_qos_arp;
503 static int ett_gtp_flow_ii;
504 static int ett_gtp_rp;
505 static int ett_gtp_pkt_flow_id;
506 static int ett_gtp_trip;
507 static int ett_gtp_quint;
508 static int ett_gtp_proto;
509 static int ett_gtp_gsn_addr;
510 static int ett_gtp_tft;
511 static int ett_gtp_rab_setup;
512 static int ett_gtp_hdr_list;
513 static int ett_gtp_node_addr;
514 static int ett_gtp_rel_pack;
515 static int ett_gtp_can_pack;
516 static int ett_gtp_data_resp;
517 static int ett_gtp_drx;
518 static int ett_gtp_net_cap;
519 static int ett_gtp_tmgi;
520 static int ett_gtp_cdr_ver;
521 static int ett_gtp_cdr_dr;
522 static int ett_gtp_mm_cntxt;
523 static int ett_gtp_utran_cont;
524 static int ett_gtp_nr_ran_cont;
525 static int ett_gtp_pdcp_no_conf;
526 static int ett_pdu_session_cont;
527 static int ett_gtp_trace_triggers_ggsn;
528 static int ett_gtp_trace_loi_ggsn;
529 static int ett_gtp_trace_triggers_bm_sc;
530 static int ett_gtp_trace_loi_bm_sc;
531 static int ett_gtp_bss_cont;
532 static int ett_gtp_lst_set_up_pfc;
533 static int ett_gtp_rrc_cont;
534 static int ett_gtp_rim_routing_adr;
536 static expert_field ei_gtp_ext_hdr_pdcpsn;
537 static expert_field ei_gtp_ext_length_mal;
538 static expert_field ei_gtp_ext_length_warn;
539 static expert_field ei_gtp_undecoded;
540 static expert_field ei_gtp_message_not_found;
541 static expert_field ei_gtp_field_not_present;
542 static expert_field ei_gtp_wrong_next_field;
543 static expert_field ei_gtp_field_not_support_in_version;
544 static expert_field ei_gtp_guaranteed_bit_rate_value;
545 static expert_field ei_gtp_max_bit_rate_value;
546 static expert_field ei_gtp_ext_geo_loc_type;
547 static expert_field ei_gtp_iei;
548 static expert_field ei_gtp_unknown_extension_header;
549 static expert_field ei_gtp_unknown_pdu_type;
550 static expert_field ei_gtp_source_type_unknown;
551 static expert_field ei_gtp_cdr_rel_ext_invalid;
553 static const range_string assistance_info_type[] = {
554 { 0, 0, "UNKNOWN" },
555 { 1, 1, "Average CQL" },
556 { 2, 2, "Average HARQ Failure" },
557 { 3, 3, "Average HARQ Retransmissions" },
558 { 4, 4, "DL Radio Quality Index" },
559 { 5, 5, "UL Radio Quality Index" },
560 { 6, 6, "Power Headroom Report" },
561 { 7, 228, "reserved for future value extensions" },
562 { 229, 255, "reserved for test purposes" },
563 { 0, 0, NULL}
567 /* NRUP - TS 38.425 */
568 /* NR-U RAN Container */
569 static int proto_nrup;
570 static int hf_nrup_pdu_type;
571 static int hf_nrup_spr_bit_extnd_flag;
572 static int hf_nrup_dl_discrd_blks;
573 static int hf_nrup_dl_flush;
574 static int hf_nrup_rpt_poll;
575 static int hf_nrup_retransmission_flag;
576 static int hf_nrup_ass_inf_rep_poll_flag;
577 static int hf_nrup_spare;
578 static int hf_nrup_request_out_of_seq_report;
579 static int hf_nrup_report_delivered;
580 static int hf_nrup_user_data_existence_flag;
581 static int hf_nrup_nr_u_seq_num;
582 static int hf_nrup_dl_disc_nr_pdcp_pdu_sn;
583 static int hf_nrup_dl_disc_num_blks;
584 static int hf_nrup_dl_disc_nr_pdcp_pdu_sn_start;
585 static int hf_nrup_dl_disc_blk_sz;
586 static int hf_nrup_dl_report_nr_pdcp_pdu_sn;
587 static int hf_nrup_high_tx_nr_pdcp_sn_ind;
588 static int hf_nrup_high_delivered_nr_pdcp_sn_ind;
589 static int hf_nrup_final_frame_ind;
590 static int hf_nrup_lost_pkt_rpt;
591 static int hf_nrup_high_retx_nr_pdcp_sn_ind;
592 static int hf_nrup_high_delivered_retx_nr_pdcp_sn_ind;
593 static int hf_nrup_cause_rpt;
594 static int hf_nrup_delivered_nr_pdcp_sn_range_ind;
595 static int hf_nrup_data_rate_ind;
596 static int hf_nrup_desrd_buff_sz_data_radio_bearer;
597 static int hf_nrup_desrd_data_rate;
598 static int hf_nrup_num_lost_nru_seq_num;
599 static int hf_nrup_start_lost_nru_seq_num;
600 static int hf_nrup_end_lost_nru_seq_num;
601 static int hf_nrup_high_success_delivered_nr_pdcp_sn;
602 static int hf_nrup_high_tx_nr_pdcp_sn;
603 static int hf_nrup_cause_val;
604 static int hf_nrup_high_success_delivered_retx_nr_pdcp_sn;
605 static int hf_nrup_high_retx_nr_pdcp_sn;
606 static int hf_nrup_pdcp_duplication_ind;
607 static int hf_nrup_assistance_information_ind;
608 static int hf_nrup_ul_delay_ind;
609 static int hf_nrup_dl_delay_ind;
610 static int hf_nrup_spare_2;
611 static int hf_nrup_pdcp_duplication_activation_suggestion;
612 static int hf_nrup_num_assistance_info_fields;
613 static int hf_nrup_assistance_information_type;
614 static int hf_nrup_num_octets_radio_qa_info;
615 static int hf_nrup_radio_qa_info;
616 static int hf_nrup_ul_delay_du_result;
617 static int hf_nrup_dl_delay_du_result;
619 static int ett_nrup;
621 typedef struct {
622 int8_t rim_routing_addr_disc;
623 } gtp_private_data_t;
626 static gtp_private_data_t*
627 gtp_get_private_data(packet_info *pinfo)
629 gtp_private_data_t *gtp_data = (gtp_private_data_t*)p_get_proto_data(wmem_file_scope(), pinfo, proto_gtp, 0);
631 if (!gtp_data) {
632 gtp_data = wmem_new(wmem_file_scope(), gtp_private_data_t);
633 gtp_data->rim_routing_addr_disc = -1;
634 p_add_proto_data(wmem_file_scope(), pinfo, proto_gtp, 0, gtp_data);
636 return gtp_data;
639 /* --- PDCP DECODE ADDITIONS --- */
640 static bool
641 pdcp_uat_fld_ip_chk_cb(void* r _U_, const char* ipaddr, unsigned len _U_, const void* u1 _U_, const void* u2 _U_, char** err)
643 ws_in4_addr ip4_addr;
644 ws_in6_addr ip6_addr;
646 /* Check for a valid IPv4 or IPv6 address */
647 if (ipaddr &&
648 (ws_inet_pton6(ipaddr, &ip6_addr) ||
649 ws_inet_pton4(ipaddr, &ip4_addr))) {
650 *err = NULL;
651 return true;
654 *err = ws_strdup_printf("No valid IP address given");
655 return false;
658 #define PDCP_TEID_WILDCARD "*"
660 static bool
661 pdcp_uat_fld_teid_chk_cb(void* r _U_, const char* teid, unsigned len _U_, const void* u1 _U_, const void* u2 _U_, char** err)
663 if (teid) {
664 uint32_t val;
666 /* Check if it is a wildcard TEID */
667 if (!strcmp(teid, PDCP_TEID_WILDCARD)) {
668 *err = NULL;
669 return true;
671 /* Check if it is a valid 32bits unsigned integer */
672 if (ws_basestrtou32(teid, NULL, &val, 0)) {
673 *err = NULL;
674 return true;
678 *err = ws_strdup_printf("No valid TEID given");
679 return false;
682 typedef struct {
683 char *ip_addr_str;
684 address ip_address;
685 char *teid_str;
686 bool teid_wildcard;
687 uint32_t teid;
688 unsigned direction;
689 unsigned header_present;
690 enum pdcp_plane plane;
691 unsigned lte_sn_length;
692 unsigned rohc_compression;
693 //unsigned rohc_mode;
694 unsigned rohc_profile;
695 /* One approach would be to just use the TEID, but it is 32 bits and would need to be
696 * truncated to (ultimately) 16 bits to be used as a UEId for PDCP */
697 uint32_t ue_id;
698 unsigned rb_id;
699 } uat_pdcp_lte_keys_record_t;
701 /* N.B. this is an array/table of the struct above, where IP address + TEID is the key */
702 static uat_pdcp_lte_keys_record_t *uat_pdcp_lte_keys_records;
704 static bool pdcp_lte_update_cb(void *r, char **err)
706 uat_pdcp_lte_keys_record_t* rec = (uat_pdcp_lte_keys_record_t *)r;
707 ws_in4_addr ip4_addr;
708 ws_in6_addr ip6_addr;
710 if (!strcmp(rec->teid_str, PDCP_TEID_WILDCARD)) {
711 rec->teid_wildcard = true;
712 rec->teid = 0;
713 } else if (ws_basestrtou32(rec->teid_str, NULL, &rec->teid, 0)) {
714 rec->teid_wildcard = false;
715 } else {
716 if (err)
717 *err = ws_strdup_printf("No valid TEID given");
718 return false;
721 free_address_wmem(wmem_epan_scope(), &rec->ip_address);
722 if (ws_inet_pton6(rec->ip_addr_str, &ip6_addr)) {
723 alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv6, sizeof(ws_in6_addr), &ip6_addr);
724 } else if (ws_inet_pton4(rec->ip_addr_str, &ip4_addr)) {
725 alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv4, sizeof(ws_in4_addr), &ip4_addr);
726 } else {
727 if (err)
728 *err = ws_strdup_printf("No valid IP address given");
729 return false;
732 /* Range-check rb */
733 if ((rec->rb_id < 1) || (rec->rb_id > 10)) {
734 if (err)
735 *err = ws_strdup_printf("RB Id must be in range [1,10]");
736 return false;
739 /* Range-check ueid */
740 if ((rec->ue_id < 1) || (rec->ue_id > 65535)) {
741 if (err)
742 *err = ws_strdup_printf("UEId must be in range [1,65535]");
743 return false;
747 return true;
750 static void *pdcp_lte_copy_cb(void *n, const void *o, size_t len _U_)
752 uat_pdcp_lte_keys_record_t* new_rec = (uat_pdcp_lte_keys_record_t *)n;
753 const uat_pdcp_lte_keys_record_t* old_rec = (const uat_pdcp_lte_keys_record_t *)o;
755 /* Copy UAT fields */
756 new_rec->ip_addr_str = g_strdup(old_rec->ip_addr_str);
757 clear_address(&new_rec->ip_address);
758 new_rec->teid_str = g_strdup(old_rec->teid_str);
759 new_rec->direction = old_rec->direction;
760 new_rec->header_present = old_rec->header_present;
761 new_rec->plane = old_rec->plane;
762 new_rec->lte_sn_length = old_rec->lte_sn_length;
763 new_rec->rohc_compression = old_rec->rohc_compression;
764 //new_rec->rohc_mode = old_rec->rohc_mode;
765 new_rec->rohc_profile = old_rec->rohc_profile;
766 new_rec->ue_id = old_rec->ue_id;
767 new_rec->rb_id = old_rec->rb_id;
769 pdcp_lte_update_cb(new_rec, NULL);
771 return new_rec;
774 static void pdcp_lte_free_cb(void *r)
776 uat_pdcp_lte_keys_record_t* rec = (uat_pdcp_lte_keys_record_t *)r;
778 g_free(rec->ip_addr_str);
779 g_free(rec->teid_str);
780 free_address_wmem(wmem_epan_scope(), &rec->ip_address);
783 #define PDCP_SN_LENGTH_12_BITS_STR "12 bits"
784 static const value_string vs_pdcp_lte_sn_length[] = {
785 {PDCP_SN_LENGTH_5_BITS, "5 bits"},
786 {PDCP_SN_LENGTH_7_BITS, "7 bits"},
787 {PDCP_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR},
788 {PDCP_SN_LENGTH_15_BITS, "15 bits"},
789 {PDCP_SN_LENGTH_18_BITS, "18 bits"},
790 {0, NULL}
793 /* Struct for saving PDCP-NR information about specific TEID */
794 typedef struct {
795 char *ip_addr_str;
796 address ip_address;
797 char *teid_str;
798 bool teid_wildcard;
799 uint32_t teid;
800 unsigned direction;
801 /* PDCP_NR_(U|D)L_sdap_hdr_PRESENT bitmask */
802 unsigned sdap_header_present;
803 unsigned mac_i_present;
804 enum pdcp_nr_plane plane;
805 unsigned pdcp_nr_sn_length;
806 unsigned rohc_compression;
807 //unsigned rohc_mode;
808 unsigned rohc_profile;
809 /* One approach would be to just use the TEID, but it is 32 bits and would need to be
810 * truncated to (ultimately) 16 bits to be used as a UEId for PDCP */
811 uint32_t ue_id;
812 unsigned rb_id;
813 } uat_pdcp_nr_keys_record_t;
815 /* N.B. this is an array/table of the struct above, where IP address + TEID is the key */
816 static uat_pdcp_nr_keys_record_t *uat_pdcp_nr_keys_records;
818 static bool pdcp_nr_update_cb(void *r, char **err) {
819 uat_pdcp_nr_keys_record_t* rec = (uat_pdcp_nr_keys_record_t *)r;
820 ws_in4_addr ip4_addr;
821 ws_in6_addr ip6_addr;
823 if (!strcmp(rec->teid_str, PDCP_TEID_WILDCARD)) {
824 rec->teid_wildcard = true;
825 rec->teid = 0;
826 } else if (ws_basestrtou32(rec->teid_str, NULL, &rec->teid, 0)) {
827 rec->teid_wildcard = false;
828 } else {
829 if (err)
830 *err = ws_strdup_printf("No valid TEID given");
831 return false;
834 free_address_wmem(wmem_epan_scope(), &rec->ip_address);
835 if (ws_inet_pton6(rec->ip_addr_str, &ip6_addr)) {
836 alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv6, sizeof(ws_in6_addr), &ip6_addr);
837 } else if (ws_inet_pton4(rec->ip_addr_str, &ip4_addr)) {
838 alloc_address_wmem(wmem_epan_scope(), &rec->ip_address, AT_IPv4, sizeof(ws_in4_addr), &ip4_addr);
839 } else {
840 if (err)
841 *err = ws_strdup_printf("No valid IP address given");
842 return false;
845 /* Range-check rb */
846 if ((rec->rb_id < 1) || (rec->rb_id > 32)) {
847 if (err)
848 *err = ws_strdup_printf("RB Id must be in range [1,32]");
849 return false;
852 /* Range-check ueid */
853 if ((rec->ue_id < 1) || (rec->ue_id > 65535)) {
854 if (err)
855 *err = ws_strdup_printf("UEId must be in range [1,65535]");
856 return false;
859 return true;
862 static void *pdcp_nr_copy_cb(void *n, const void *o, size_t len _U_) {
863 uat_pdcp_nr_keys_record_t* new_rec = (uat_pdcp_nr_keys_record_t *)n;
864 const uat_pdcp_nr_keys_record_t* old_rec = (const uat_pdcp_nr_keys_record_t *)o;
866 /* Copy UAT fields */
867 new_rec->ip_addr_str = g_strdup(old_rec->ip_addr_str);
868 clear_address(&new_rec->ip_address); /* not copying address.. */
869 new_rec->teid_str = g_strdup(old_rec->teid_str);
870 new_rec->direction = old_rec->direction;
871 new_rec->sdap_header_present = old_rec->sdap_header_present;
872 new_rec->mac_i_present = old_rec->mac_i_present;
873 new_rec->plane = old_rec->plane;
874 new_rec->pdcp_nr_sn_length = old_rec->pdcp_nr_sn_length;
875 new_rec->rohc_compression = old_rec->rohc_compression;
876 //new_rec->rohc_mode = old_rec->rohc_mode;
877 new_rec->rohc_profile = old_rec->rohc_profile;
878 new_rec->ue_id = old_rec->ue_id;
879 new_rec->rb_id = old_rec->rb_id;
881 pdcp_nr_update_cb(new_rec, NULL);
883 return new_rec;
886 static void pdcp_nr_free_cb(void *r)
888 uat_pdcp_nr_keys_record_t* rec = (uat_pdcp_nr_keys_record_t *)r;
890 g_free(rec->ip_addr_str);
891 g_free(rec->teid_str);
892 free_address_wmem(wmem_epan_scope(), &rec->ip_address);
895 #define PDCP_DIRECTION_UPLINK_STR "UL"
896 #define PDCP_DIRECTION_DOWNLINK_STR "DL"
897 static const value_string vs_direction[] = {
898 { PDCP_NR_DIRECTION_UPLINK, PDCP_DIRECTION_UPLINK_STR },
899 { PDCP_NR_DIRECTION_DOWNLINK, PDCP_DIRECTION_DOWNLINK_STR },
900 { 0, NULL }
903 /* Value sets for each drop-down list in the GUI */
904 #define PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR "SDAP header NOT present"
905 #define PDCP_NR_SDAP_HEADER_NOT_PRESENT 0
906 #define PDCP_NR_SDAP_HEADER_PRESENT 1
907 static const value_string vs_sdap_header_present[] = {
908 { 0, PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR },
909 { 1, "SDAP header present" },
910 { 0, NULL }
913 #define PDCP_LTE_HEADER_NOT_PRESENT_STR "Header NOT present"
914 #define PDCP_LTE_HEADER_PRESENT_STR "Header present"
915 #define PDCP_LTE_HEADER_NOT_PRESENT 0
916 #define PDCP_LTE_HEADER_PRESENT 1
918 static const value_string vs_header_present[] = {
919 { 0, PDCP_LTE_HEADER_NOT_PRESENT_STR },
920 { 1, PDCP_LTE_HEADER_PRESENT_STR },
921 { 0, NULL }
925 #define MAC_I_PRESENT_FALSE_STR "MAC-I NOT present"
926 #define MAC_I_PRESENT_TRUE_STR "MAC-I present"
927 static const value_string vs_mac_i_present[] = {
928 { false, MAC_I_PRESENT_FALSE_STR },
929 { true, MAC_I_PRESENT_TRUE_STR },
930 { 0, NULL }
933 #define SIGNALING_PLANE_STR "Signaling plane"
934 #define USER_PLANE_STR "User plane"
935 static const value_string vs_pdcp_plane[] = {
936 { NR_SIGNALING_PLANE, SIGNALING_PLANE_STR },
937 { NR_USER_PLANE, USER_PLANE_STR },
938 { 0, NULL }
941 static const value_string vs_pdcp_nr_sn_length[] = {
942 { PDCP_NR_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR },
943 { PDCP_NR_SN_LENGTH_18_BITS, "18 bits" },
944 { 0, NULL }
947 #define ROHC_COMPRESSION_FALSE_STR "RoHC NOT compressed"
948 static const value_string vs_rohc_compression[] = {
949 { false, ROHC_COMPRESSION_FALSE_STR },
950 { true, "RoHC compressed" },
951 { 0, NULL }
954 //#define ROHC_MODE_NOT_SET_STR "Mode not set"
955 //static const value_string vs_rohc_mode[] = {
956 // { MODE_NOT_SET, ROHC_MODE_NOT_SET_STR },
957 // { UNIDIRECTIONAL, "Unidirectional" },
958 // { OPTIMISTIC_BIDIRECTIONAL, "Optimistic bidirectional" },
959 // { RELIABLE_BIDIRECTIONAL, "Reliable bidirectional" },
960 // { 0, NULL }
961 //};
963 #define ROHC_PROFILE_RTP_STR "RTP (1)"
964 #define ROHC_PROFILE_UNCOMPRESSED_STR "Uncompressed (0)"
965 static const value_string vs_rohc_profile[] = {
966 { ROHC_PROFILE_UNCOMPRESSED, ROHC_PROFILE_UNCOMPRESSED_STR },
967 { ROHC_PROFILE_RTP, ROHC_PROFILE_RTP_STR },
968 { ROHC_PROFILE_UDP, "UDP (2)" },
969 { ROHC_PROFILE_IP, "IP (4)" },
970 { ROHC_PROFILE_UNKNOWN, "Unknown" },
971 { 0, NULL }
974 /* Entries added by UAT */
975 static uat_t * pdcp_nr_keys_uat;
976 static unsigned num_pdcp_nr_keys_uat;
978 /* Default values for a TEID entry */
979 UAT_CSTRING_CB_DEF(pdcp_nr_users, ip_addr_str, uat_pdcp_nr_keys_record_t)
980 UAT_CSTRING_CB_DEF(pdcp_nr_users, teid_str, uat_pdcp_nr_keys_record_t)
981 UAT_VS_DEF(pdcp_nr_users, direction, uat_pdcp_nr_keys_record_t, unsigned, PDCP_NR_DIRECTION_UPLINK, PDCP_DIRECTION_UPLINK_STR)
982 UAT_VS_DEF(pdcp_nr_users, sdap_header_present, uat_pdcp_nr_keys_record_t, unsigned, PDCP_NR_SDAP_HEADER_NOT_PRESENT, PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR)
983 UAT_VS_DEF(pdcp_nr_users, mac_i_present, uat_pdcp_nr_keys_record_t, unsigned, false, MAC_I_PRESENT_FALSE_STR)
984 UAT_VS_DEF(pdcp_nr_users, plane, uat_pdcp_nr_keys_record_t, enum pdcp_nr_plane, NR_USER_PLANE, USER_PLANE_STR)
985 UAT_VS_DEF(pdcp_nr_users, pdcp_nr_sn_length, uat_pdcp_nr_keys_record_t, unsigned, PDCP_NR_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR)
986 UAT_VS_DEF(pdcp_nr_users, rohc_compression, uat_pdcp_nr_keys_record_t, unsigned, false, ROHC_COMPRESSION_FALSE_STR)
987 //UAT_VS_DEF(pdcp_nr_users, rohc_mode, uat_pdcp_nr_keys_record_t, unsigned, MODE_NOT_SET, ROHC_MODE_NOT_SET_STR)
988 UAT_VS_DEF(pdcp_nr_users, rohc_profile, uat_pdcp_nr_keys_record_t, unsigned, ROHC_PROFILE_UNCOMPRESSED, ROHC_PROFILE_UNCOMPRESSED_STR)
989 UAT_DEC_CB_DEF(pdcp_nr_users, ue_id, uat_pdcp_nr_keys_record_t)
990 UAT_DEC_CB_DEF(pdcp_nr_users, rb_id, uat_pdcp_nr_keys_record_t)
992 static uat_pdcp_nr_keys_record_t* look_up_pdcp_nr_keys_record(packet_info *pinfo, uint32_t teidn)
994 unsigned int record_id;
996 /* Look up UAT entries. N.B. linear search... */
997 for (record_id = 0; record_id < num_pdcp_nr_keys_uat; record_id++) {
998 if (addresses_equal(&uat_pdcp_nr_keys_records[record_id].ip_address, &pinfo->dst) &&
999 (uat_pdcp_nr_keys_records[record_id].teid_wildcard ||
1000 uat_pdcp_nr_keys_records[record_id].teid == teidn)) {
1001 return &uat_pdcp_nr_keys_records[record_id];
1005 /* No match at all - return NULL */
1006 return NULL;
1009 /* Entries added by UAT */
1010 static uat_t * pdcp_lte_keys_uat;
1011 static unsigned num_pdcp_lte_keys_uat;
1013 /* Default values for a TEID entry */
1014 UAT_CSTRING_CB_DEF(pdcp_lte_users, ip_addr_str, uat_pdcp_lte_keys_record_t)
1015 UAT_CSTRING_CB_DEF(pdcp_lte_users, teid_str, uat_pdcp_lte_keys_record_t)
1016 UAT_VS_DEF(pdcp_lte_users, direction, uat_pdcp_lte_keys_record_t, unsigned, PDCP_NR_DIRECTION_UPLINK, PDCP_DIRECTION_UPLINK_STR)
1017 UAT_VS_DEF(pdcp_lte_users, header_present, uat_pdcp_lte_keys_record_t, unsigned, PDCP_LTE_HEADER_PRESENT, PDCP_LTE_HEADER_PRESENT_STR)
1018 UAT_VS_DEF(pdcp_lte_users, plane, uat_pdcp_lte_keys_record_t, enum pdcp_plane, USER_PLANE, USER_PLANE_STR)
1019 UAT_VS_DEF(pdcp_lte_users, lte_sn_length, uat_pdcp_lte_keys_record_t, unsigned, PDCP_NR_SN_LENGTH_12_BITS, PDCP_SN_LENGTH_12_BITS_STR)
1020 UAT_VS_DEF(pdcp_lte_users, rohc_compression, uat_pdcp_lte_keys_record_t, unsigned, false, ROHC_COMPRESSION_FALSE_STR)
1021 //UAT_VS_DEF(pdcp_lte_users, rohc_mode, uat_pdcp_lte_keys_record_t, unsigned, MODE_NOT_SET, ROHC_MODE_NOT_SET_STR)
1022 UAT_VS_DEF(pdcp_lte_users, rohc_profile, uat_pdcp_lte_keys_record_t, unsigned, ROHC_PROFILE_UNCOMPRESSED, ROHC_PROFILE_UNCOMPRESSED_STR)
1023 UAT_DEC_CB_DEF(pdcp_lte_users, ue_id, uat_pdcp_lte_keys_record_t)
1024 UAT_DEC_CB_DEF(pdcp_lte_users, rb_id, uat_pdcp_lte_keys_record_t)
1026 static uat_pdcp_lte_keys_record_t* look_up_pdcp_lte_keys_record(packet_info *pinfo, uint32_t teidn)
1028 unsigned int record_id;
1030 /* Look up UAT entries. N.B. linear search... */
1031 for (record_id = 0; record_id < num_pdcp_lte_keys_uat; record_id++) {
1032 if (addresses_equal(&uat_pdcp_lte_keys_records[record_id].ip_address, &pinfo->dst) &&
1033 (uat_pdcp_lte_keys_records[record_id].teid_wildcard ||
1034 uat_pdcp_lte_keys_records[record_id].teid == teidn)) {
1035 return &uat_pdcp_lte_keys_records[record_id];
1039 /* No match at all - return NULL */
1040 return NULL;
1043 /* --- END PDCP NR DECODE ADDITIONS --- */
1045 static bool g_gtp_etsi_order;
1047 static int dissect_tpdu_as = GTP_TPDU_AS_TPDU_HEUR;
1048 static const enum_val_t gtp_decode_tpdu_as[] = {
1049 {"none", "None", GTP_TPDU_AS_NONE},
1050 {"heuristic", "TPDU Heuristic", GTP_TPDU_AS_TPDU_HEUR},
1051 {"pdcp-lte", "PDCP-LTE", GTP_TPDU_AS_PDCP_LTE },
1052 {"pdcp-nr", "PDCP-NR", GTP_TPDU_AS_PDCP_NR },
1053 {"sync", "SYNC", GTP_TPDU_AS_SYNC},
1054 {"eth", "ETHERNET", GTP_TPDU_AS_ETHERNET},
1055 {"custom", "Custom", GTP_TPDU_AS_CUSTOM},
1056 {NULL, NULL, 0}
1060 static int gtp_tap;
1061 static int gtpv1_tap;
1063 /* Definition of flags masks */
1064 #define GTP_VER_MASK 0xE0
1066 static const true_false_string gtp_hdr_length_vals = {
1067 "6-Octet Header",
1068 "20-Octet Header"
1071 static const value_string ver_types[] = {
1072 {0, "GTP release 97/98 version"},
1073 {1, "GTP release 99 version"},
1074 {2, "GTPv2-C"},
1075 {3, "None"},
1076 {4, "None"},
1077 {5, "None"},
1078 {6, "None"},
1079 {7, "None"},
1080 {0, NULL}
1083 static const value_string pt_types[] = {
1084 {0, "GTP'"},
1085 {1, "GTP"},
1086 {0, NULL}
1089 #define GTP_PT_MASK 0x10
1090 #define GTP_SPARE1_MASK 0x0E
1091 #define GTP_SPARE2_MASK 0x08
1092 #define GTP_E_MASK 0x04
1093 #define GTP_S_MASK 0x02
1094 #define GTP_SNN_MASK 0x01
1095 #define GTP_PN_MASK 0x01
1097 #define GTP_EXT_HDR_NO_MORE_EXT_HDRS 0x00
1098 #define GTP_EXT_HDR_MBMS_SUPPORT_IND 0x01
1099 #define GTP_EXT_HDR_MS_INFO_CHG_REP_SUPP_IND 0x02
1100 #define GTP_EXT_HDR_LONG_PDCP_PDU_NUMBER 0x03 /* TS 29.281 (GTPv1-U)*/
1101 #define GTP_EXT_HDR_SERVICE_CLASS_INDICATOR 0x20 /* TS 29.281 (GTPv1-U)*/
1102 #define GTP_EXT_HDR_UDP_PORT 0x40
1103 #define GTP_EXT_HDR_RAN_CONT 0x81
1104 #define GTP_EXT_HDR_LONG_PDCP_PDU 0x82
1105 #define GTP_EXT_HDR_XW_RAN_CONT 0x83
1106 #define GTP_EXT_HDR_NR_RAN_CONT 0x84
1107 #define GTP_EXT_HDR_PDU_SESSION_CONT 0x85
1108 #define GTP_EXT_HDR_PDCP_SN 0xC0
1109 #define GTP_EXT_HDR_SUSPEND_REQ 0xC1
1110 #define GTP_EXT_HDR_SUSPEND_RESP 0xC2
1112 static const value_string next_extension_header_fieldvals[] = {
1113 {GTP_EXT_HDR_NO_MORE_EXT_HDRS, "No more extension headers"},
1114 {GTP_EXT_HDR_MBMS_SUPPORT_IND, "MBMS support indication"},
1115 {GTP_EXT_HDR_MS_INFO_CHG_REP_SUPP_IND, "MS Info Change Reporting support indication"},
1116 {GTP_EXT_HDR_LONG_PDCP_PDU_NUMBER, "Long PDCP PDU Number"},
1117 {GTP_EXT_HDR_SERVICE_CLASS_INDICATOR, "Service Class Indicator"},
1118 {GTP_EXT_HDR_UDP_PORT, "UDP Port number"},
1119 {GTP_EXT_HDR_RAN_CONT,"RAN container"},
1120 {GTP_EXT_HDR_LONG_PDCP_PDU,"Long PDCP PDU number"},
1121 {GTP_EXT_HDR_XW_RAN_CONT,"Xw RAN container"},
1122 {GTP_EXT_HDR_NR_RAN_CONT,"NR RAN container"},
1123 {GTP_EXT_HDR_PDU_SESSION_CONT,"PDU Session container"},
1124 {GTP_EXT_HDR_PDCP_SN, "PDCP PDU number"},
1125 {GTP_EXT_HDR_SUSPEND_REQ, "Suspend Request"},
1126 {GTP_EXT_HDR_SUSPEND_RESP, "Suspend Response"},
1127 {0, NULL}
1130 /* Definition of 3G charging characteristics masks */
1131 #define GTP_MASK_CHRG_CHAR_S 0xF000
1132 #define GTP_MASK_CHRG_CHAR_N 0x0800
1133 #define GTP_MASK_CHRG_CHAR_P 0x0400
1134 #define GTP_MASK_CHRG_CHAR_F 0x0200
1135 #define GTP_MASK_CHRG_CHAR_H 0x0100
1136 #define GTP_MASK_CHRG_CHAR_R 0x00FF
1138 /* Definition of GSN Address masks */
1139 #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
1140 #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
1142 /* Definition of QoS masks */
1143 #define GTP_EXT_QOS_SPARE1_MASK 0xC0
1144 #define GTP_EXT_QOS_DELAY_MASK 0x38
1145 #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
1146 #define GTP_EXT_QOS_PEAK_MASK 0xF0
1147 #define GTP_EXT_QOS_SPARE2_MASK 0x08
1148 #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
1149 #define GTP_EXT_QOS_SPARE3_MASK 0xE0
1150 #define GTP_EXT_QOS_MEAN_MASK 0x1F
1151 #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
1152 #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
1153 #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
1154 #define GTP_EXT_QOS_RES_BER_MASK 0xF0
1155 #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
1156 #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
1157 #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
1158 #define GTP_EXT_QOS_SPARE4_MASK 0xE0
1159 #define GTP_EXT_QOS_SIG_IND_MASK 0x10
1160 #define GTP_EXT_QOS_SRC_STAT_DESC_MASK 0x0F
1162 /* Definition of Radio Priority's masks */
1163 #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
1164 #define GTPv1_EXT_RP_SPARE_MASK 0x08
1165 #define GTPv1_EXT_RP_MASK 0x07
1167 #define NR_UP_DL_USER_DATA 0
1168 #define NR_UP_DL_DATA_DELIVERY_STATUS 1
1169 #define NR_UP_ASSISTANCE_INFORMATION_DATA 2
1171 static const value_string nr_pdu_type_cnst[] = {
1172 {NR_UP_DL_USER_DATA, "DL User Data"},
1173 {NR_UP_DL_DATA_DELIVERY_STATUS, "DL Data Delivery Status"},
1174 {NR_UP_ASSISTANCE_INFORMATION_DATA, "Assistance Information Data"},
1175 {0, NULL}
1178 static const range_string nr_up_cause_vals[] = {
1179 {0, 0, "Unknown"},
1180 {1, 1, "Radio Link Outage"},
1181 {2, 2, "Radio Link Resume"},
1182 {3, 3, "UL Radio Link Outage"},
1183 {4, 4, "DL Radio Link Outage"},
1184 {5, 5, "UL Radio Link Resume"},
1185 {6, 6, "DL Radio Link Resume"},
1186 {7, 228, "Reserved for future value extensions"},
1187 {228, 255, "Reserved for test purposes"},
1188 {0, 0, NULL}
1192 static const true_false_string tfs_final_frame_indication = {
1193 "Frame is final",
1194 "Frame is not final"
1198 static const value_string gtp_message_type[] = {
1199 {GTP_MSG_UNKNOWN, "For future use"},
1200 {GTP_MSG_ECHO_REQ, "Echo request"},
1201 {GTP_MSG_ECHO_RESP, "Echo response"},
1202 {GTP_MSG_VER_NOT_SUPP, "Version not supported"},
1203 {GTP_MSG_NODE_ALIVE_REQ, "Node alive request"},
1204 {GTP_MSG_NODE_ALIVE_RESP, "Node alive response"},
1205 {GTP_MSG_REDIR_REQ, "Redirection request"},
1206 {GTP_MSG_REDIR_RESP, "Redirection response"},
1208 * 8-15 For future use. Shall not be sent. If received,
1209 * shall be treated as an Unknown message.
1211 #if 0
1212 { 8, "Unknown message(For future use)"},
1213 { 9, "Unknown message(For future use)"},
1214 { 10, "Unknown message(For future use)"},
1215 { 11, "Unknown message(For future use)"},
1216 { 12, "Unknown message(For future use)"},
1217 { 13, "Unknown message(For future use)"},
1218 { 14, "Unknown message(For future use)"},
1219 { 15, "Unknown message(For future use)"},
1220 #endif
1221 {GTP_MSG_CREATE_PDP_REQ, "Create PDP context request"},
1222 {GTP_MSG_CREATE_PDP_RESP, "Create PDP context response"},
1223 {GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request"},
1224 {GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response"},
1225 {GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request"},
1226 {GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response"},
1227 {GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, "Initiate PDP Context Activation Request"},
1228 {GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, "Initiate PDP Context Activation Response"},
1230 * 24-25 For future use. Shall not be sent. If received,
1231 * shall be treated as an Unknown message.
1233 {GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request"},
1234 {GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response"},
1235 {GTP_MSG_ERR_IND, "Error indication"},
1236 {GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request"},
1237 {GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response"},
1238 {GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request"},
1239 {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
1240 {GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification"},
1241 {GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request"},
1242 {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
1243 {GTP_MSG_FAIL_REP_REQ, "Failure report request"},
1244 {GTP_MSG_FAIL_REP_RESP, "Failure report response"},
1245 {GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request"},
1246 {GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response"},
1247 /* 38-47 For future use. Shall not be sent. If received,
1248 * shall be treated as an Unknown message.
1250 #if 0
1251 { 38, "Unknown message(For future use)"},
1252 { 39, "Unknown message(For future use)"},
1253 { 40, "Unknown message(For future use)"},
1254 { 41, "Unknown message(For future use)"},
1255 { 42, "Unknown message(For future use)"},
1256 { 43, "Unknown message(For future use)"},
1257 { 44, "Unknown message(For future use)"},
1258 { 45, "Unknown message(For future use)"},
1259 { 46, "Unknown message(For future use)"},
1260 { 47, "Unknown message(For future use)"},
1261 #endif
1262 {GTP_MSG_IDENT_REQ, "Identification request"},
1263 {GTP_MSG_IDENT_RESP, "Identification response"},
1264 {GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request"},
1265 {GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response"},
1266 {GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement"},
1267 {GTP_MSG_FORW_RELOC_REQ, "Forward relocation request"},
1268 {GTP_MSG_FORW_RELOC_RESP, "Forward relocation response"},
1269 {GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete"},
1270 {GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request"},
1271 {GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response"},
1272 {GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context"},
1273 {GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge"},
1274 {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
1275 {GTP_MSG_UE_REG_QUERY_REQ, "UE Registration Query Request"},
1276 {GTP_MSG_UE_REG_QUERY_RESP, "UE Registration Query Response"},
1277 /* 63-69 For future use. Shall not be sent. If received,
1278 * shall be treated as an Unknown message.
1280 #if 0
1281 { 63, "Unknown message(For future use)"},
1282 { 64, "Unknown message(For future use)"},
1283 { 65, "Unknown message(For future use)"},
1284 { 66, "Unknown message(For future use)"},
1285 { 67, "Unknown message(For future use)"},
1286 { 68, "Unknown message(For future use)"},
1287 { 69, "Unknown message(For future use)"},
1288 #endif
1289 {GTP_MSG_RAN_INFO_RELAY, "RAN Information Relay"},
1290 /* 71-95 For future use. Shall not be sent. If received,
1291 * shall be treated as an Unknown message.
1293 #if 0
1294 { 71, "Unknown message(For future use)"},
1295 { 72, "Unknown message(For future use)"},
1296 { 73, "Unknown message(For future use)"},
1297 { 74, "Unknown message(For future use)"},
1298 { 75, "Unknown message(For future use)"},
1299 { 76, "Unknown message(For future use)"},
1300 { 77, "Unknown message(For future use)"},
1301 { 78, "Unknown message(For future use)"},
1302 { 79, "Unknown message(For future use)"},
1303 { 80, "Unknown message(For future use)"},
1304 { 81, "Unknown message(For future use)"},
1305 { 82, "Unknown message(For future use)"},
1306 { 83, "Unknown message(For future use)"},
1307 { 84, "Unknown message(For future use)"},
1308 { 85, "Unknown message(For future use)"},
1309 { 86, "Unknown message(For future use)"},
1310 { 87, "Unknown message(For future use)"},
1311 { 88, "Unknown message(For future use)"},
1312 { 89, "Unknown message(For future use)"},
1313 { 90, "Unknown message(For future use)"},
1314 { 91, "Unknown message(For future use)"},
1315 { 92, "Unknown message(For future use)"},
1316 { 93, "Unknown message(For future use)"},
1317 { 94, "Unknown message(For future use)"},
1318 { 95, "Unknown message(For future use)"},
1319 #endif
1320 {GTP_MBMS_NOTIFY_REQ, "MBMS Notification Request"},
1321 {GTP_MBMS_NOTIFY_RES, "MBMS Notification Response"},
1322 {GTP_MBMS_NOTIFY_REJ_REQ, "MBMS Notification Reject Request"},
1323 {GTP_MBMS_NOTIFY_REJ_RES, "MBMS Notification Reject Response"},
1324 {GTP_CREATE_MBMS_CNTXT_REQ, "Create MBMS Context Request"},
1325 {GTP_CREATE_MBMS_CNTXT_RES, "Create MBMS Context Response"},
1326 {GTP_UPD_MBMS_CNTXT_REQ, "Update MBMS Context Request"},
1327 {GTP_UPD_MBMS_CNTXT_RES, "Update MBMS Context Response"},
1328 {GTP_DEL_MBMS_CNTXT_REQ, "Delete MBMS Context Request"},
1329 {GTP_DEL_MBMS_CNTXT_RES, "Delete MBMS Context Response"},
1330 /* 106 - 111 For future use. Shall not be sent. If received,
1331 * shall be treated as an Unknown message.
1333 #if 0
1334 { 106, "Unknown message(For future use)"},
1335 { 107, "Unknown message(For future use)"},
1336 { 108, "Unknown message(For future use)"},
1337 { 109, "Unknown message(For future use)"},
1338 { 110, "Unknown message(For future use)"},
1339 { 111, "Unknown message(For future use)"},
1340 #endif
1341 {GTP_MBMS_REG_REQ, "MBMS Registration Request"},
1342 {GTP_MBMS_REG_RES, "MBMS Registration Response"},
1343 {GTP_MBMS_DE_REG_REQ, "MBMS De-Registration Request"},
1344 {GTP_MBMS_DE_REG_RES, "MBMS De-Registration Response"},
1345 {GTP_MBMS_SES_START_REQ, "MBMS Session Start Request"},
1346 {GTP_MBMS_SES_START_RES, "MBMS Session Start Response"},
1347 {GTP_MBMS_SES_STOP_REQ, "MBMS Session Stop Request"},
1348 {GTP_MBMS_SES_STOP_RES, "MBMS Session Stop Response"},
1349 {GTP_MBMS_SES_UPD_REQ, "MBMS Session Update Request"},
1350 {GTP_MBMS_SES_UPD_RES, "MBMS Session Update Response"},
1351 /* 122-127 For future use. Shall not be sent.
1352 * If received, shall be treated as an Unknown message.
1354 #if 0
1355 { 122, "Unknown message(For future use)"},
1356 { 123, "Unknown message(For future use)"},
1357 { 124, "Unknown message(For future use)"},
1358 { 125, "Unknown message(For future use)"},
1359 { 126, "Unknown message(For future use)"},
1360 { 127, "Unknown message(For future use)"},
1361 #endif
1362 {GTP_MS_INFO_CNG_NOT_REQ, "MS Info Change Notification Request"},
1363 {GTP_MS_INFO_CNG_NOT_RES, "MS Info Change Notification Response"},
1364 /* 130-239 For future use. Shall not be sent. If received,
1365 * shall be treated as an Unknown message.
1367 #if 0
1368 { 130, "Unknown message(For future use)"},
1369 { 131, "Unknown message(For future use)"},
1370 { 132, "Unknown message(For future use)"},
1371 { 133, "Unknown message(For future use)"},
1372 { 134, "Unknown message(For future use)"},
1373 { 135, "Unknown message(For future use)"},
1374 { 136, "Unknown message(For future use)"},
1375 { 137, "Unknown message(For future use)"},
1376 { 138, "Unknown message(For future use)"},
1377 { 139, "Unknown message(For future use)"},
1378 { 140, "Unknown message(For future use)"},
1379 { 141, "Unknown message(For future use)"},
1380 { 142, "Unknown message(For future use)"},
1381 { 143, "Unknown message(For future use)"},
1382 { 144, "Unknown message(For future use)"},
1383 { 145, "Unknown message(For future use)"},
1384 { 146, "Unknown message(For future use)"},
1385 { 147, "Unknown message(For future use)"},
1386 { 148, "Unknown message(For future use)"},
1387 { 149, "Unknown message(For future use)"},
1388 { 150, "Unknown message(For future use)"},
1389 { 151, "Unknown message(For future use)"},
1390 { 152, "Unknown message(For future use)"},
1391 { 153, "Unknown message(For future use)"},
1392 { 154, "Unknown message(For future use)"},
1393 { 155, "Unknown message(For future use)"},
1394 { 156, "Unknown message(For future use)"},
1395 { 157, "Unknown message(For future use)"},
1396 { 158, "Unknown message(For future use)"},
1397 { 159, "Unknown message(For future use)"},
1398 #endif
1399 {GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request"},
1400 {GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response"},
1401 /* 242-253 For future use. Shall not be sent. If received,
1402 * shall be treated as an Unknown message.
1404 #if 0
1405 { 242, "Unknown message(For future use)"},
1406 { 243, "Unknown message(For future use)"},
1407 { 244, "Unknown message(For future use)"},
1408 { 245, "Unknown message(For future use)"},
1409 { 246, "Unknown message(For future use)"},
1410 { 247, "Unknown message(For future use)"},
1411 { 248, "Unknown message(For future use)"},
1412 { 249, "Unknown message(For future use)"},
1413 { 250, "Unknown message(For future use)"},
1414 { 251, "Unknown message(For future use)"},
1415 { 252, "Unknown message(For future use)"},
1416 { 253, "Unknown message(For future use)"},
1417 #endif
1418 {GTP_MSG_END_MARKER, "End Marker"},
1419 {GTP_MSG_TPDU, "T-PDU"},
1420 {0, NULL}
1422 static value_string_ext gtp_message_type_ext = VALUE_STRING_EXT_INIT(gtp_message_type);
1424 /* definitions of fields in extension header */
1425 #define GTP_EXT_CAUSE 0x01
1426 #define GTP_EXT_IMSI 0x02
1427 #define GTP_EXT_RAI 0x03
1428 #define GTP_EXT_TLLI 0x04
1429 #define GTP_EXT_PTMSI 0x05
1430 #define GTP_EXT_QOS_GPRS 0x06
1431 #define GTP_EXT_REORDER 0x08
1432 #define GTP_EXT_AUTH_TRI 0x09
1433 #define GTP_EXT_MAP_CAUSE 0x0B
1434 #define GTP_EXT_PTMSI_SIG 0x0C
1435 #define GTP_EXT_MS_VALID 0x0D
1436 #define GTP_EXT_RECOVER 0x0E
1437 #define GTP_EXT_SEL_MODE 0x0F
1439 #define GTP_EXT_16 0x10
1440 #define GTP_EXT_FLOW_LABEL 0x10
1441 #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
1443 #define GTP_EXT_17 0x11
1444 #define GTP_EXT_FLOW_SIG 0x11
1445 #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
1447 #define GTP_EXT_18 0x12
1448 #define GTP_EXT_FLOW_II 0x12
1449 #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G */
1451 #define GTP_EXT_19 0x13 /* 19 TV Teardown Ind 7.7.16 */
1452 #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
1453 #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G */
1455 #define GTP_EXT_NSAPI 0x14 /* 3G */
1456 #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
1457 #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
1458 #define GTP_EXT_RP_SMS 0x17 /* 3G */
1459 #define GTP_EXT_RP 0x18 /* 3G */
1460 #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
1461 #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
1462 #define GTP_EXT_TRACE_REF 0x1B /* 3G */
1463 #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
1464 #define GTPv1_EXT_MS_REASON 0x1D /* 3G 29 TV MS Not Reachable Reason 7.7.25A */
1465 /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1466 #define GTP_EXT_TR_COMM 0x7E /* charging */
1467 #define GTP_EXT_CHRG_ID 0x7F /* 127 TV Charging ID 7.7.26 */
1468 #define GTP_EXT_USER_ADDR 0x80
1469 #define GTP_EXT_MM_CNTXT 0x81
1470 #define GTP_EXT_PDP_CNTXT 0x82
1471 #define GTP_EXT_APN 0x83
1472 #define GTP_EXT_PROTO_CONF 0x84
1473 #define GTP_EXT_GSN_ADDR 0x85
1474 #define GTP_EXT_MSISDN 0x86
1475 #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
1476 #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
1477 #define GTP_EXT_TFT 0x89 /* 3G */
1478 #define GTP_EXT_TARGET_ID 0x8A /* 3G */
1479 #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
1480 #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
1481 #define GTP_EXT_HDR_LIST 0x8D /* 3G */
1482 #define GTP_EXT_TRIGGER_ID 0x8E /* 3G 142 7.7.41 */
1483 #define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */
1484 #define GTP_EXT_RAN_TR_CONT 0x90 /* 3G 144 TLV RAN Transparent Container 7.7.43 */
1485 #define GTP_EXT_PDP_CONT_PRIO 0x91 /* 3G 145 TLV PDP Context Prioritization 7.7.45 */
1486 #define GTP_EXT_ADD_RAB_SETUP_INF 0x92 /* 3G 146 TLV Additional RAB Setup Information 7.7.45A */
1487 #define GTP_EXT_SGSN_NO 0x93 /* 3G 147 TLV SGSN Number 7.7.47 */
1488 #define GTP_EXT_COMMON_FLGS 0x94 /* 3G 148 TLV Common Flags 7.7.48 */
1489 #define GTP_EXT_APN_RES 0x95 /* 3G 149 */
1490 #define GTP_EXT_RA_PRIO_LCS 0x96 /* 3G 150 TLV Radio Priority LCS 7.7.25B */
1491 #define GTP_EXT_RAT_TYPE 0x97 /* 3G 151 TLV RAT Type 7.7.50 */
1492 #define GTP_EXT_USR_LOC_INF 0x98 /* 3G 152 TLV User Location Information 7.7.51 */
1493 #define GTP_EXT_MS_TIME_ZONE 0x99 /* 3G 153 TLV MS Time Zone 7.7.52 */
1494 #define GTP_EXT_IMEISV 0x9A /* 3G 154 TLV IMEI(SV) 7.7.53 */
1495 #define GTP_EXT_CAMEL_CHG_INF_CON 0x9B /* 3G 155 TLV CAMEL Charging Information Container 7.7.54 */
1496 #define GTP_EXT_MBMS_UE_CTX 0x9C /* 3G 156 TLV MBMS UE Context 7.7.55 */
1497 #define GTP_EXT_TMGI 0x9D /* 3G 157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
1498 #define GTP_EXT_RIM_RA 0x9E /* 3G 158 TLV RIM Routing Address 7.7.57 */
1499 #define GTP_EXT_MBMS_PROT_CONF_OPT 0x9F /* 3G 159 TLV MBMS Protocol Configuration Options 7.7.58 */
1500 #define GTP_EXT_MBMS_SA 0xA0 /* 3G 160 TLV MBMS Service Area 7.7.60 */
1501 #define GTP_EXT_SRC_RNC_PDP_CTX_INF 0xA1 /* 3G 161 TLV Source RNC PDCP context info 7.7.61 */
1502 #define GTP_EXT_ADD_TRS_INF 0xA2 /* 3G 162 TLV Additional Trace Info 7.7.62 */
1503 #define GTP_EXT_HOP_COUNT 0xA3 /* 3G 163 TLV Hop Counter 7.7.63 */
1504 #define GTP_EXT_SEL_PLMN_ID 0xA4 /* 3G 164 TLV Selected PLMN ID 7.7.64 */
1505 #define GTP_EXT_MBMS_SES_ID 0xA5 /* 3G 165 TLV MBMS Session Identifier 7.7.65 */
1506 #define GTP_EXT_MBMS_2G_3G_IND 0xA6 /* 3G 166 TLV MBMS 2G/3G Indicator 7.7.66 */
1507 #define GTP_EXT_ENH_NSAPI 0xA7 /* 3G 167 TLV Enhanced NSAPI 7.7.67 */
1508 #define GTP_EXT_MBMS_SES_DUR 0xA8 /* 3G 168 TLV MBMS Session Duration 7.7.59 */
1509 #define GTP_EXT_ADD_MBMS_TRS_INF 0xA9 /* 3G 169 TLV Additional MBMS Trace Info 7.7.68 */
1510 #define GTP_EXT_MBMS_SES_ID_REP_NO 0xAA /* 3G 170 TLV MBMS Session Identity Repetition Number 7.7.69 */
1511 #define GTP_EXT_MBMS_TIME_TO_DATA_TR 0xAB /* 3G 171 TLV MBMS Time To Data Transfer 7.7.70 */
1512 #define GTP_EXT_PS_HO_REQ_CTX 0xAC /* 3G 172 TLV PS Handover Request Context 7.7.71 */
1513 #define GTP_EXT_BSS_CONT 0xAD /* 3G 173 TLV BSS Container 7.7.72 */
1514 #define GTP_EXT_CELL_ID 0xAE /* 3G 174 TLV Cell Identification 7.7.73 */
1515 #define GTP_EXT_PDU_NO 0xAF /* 3G 175 TLV PDU Numbers 7.7.74 */
1516 #define GTP_EXT_BSSGP_CAUSE 0xB0 /* 3G 176 TLV BSSGP Cause 7.7.75 */
1517 #define GTP_EXT_REQ_MBMS_BEARER_CAP 0xB1 /* 3G 177 TLV Required MBMS bearer capabilities 7.7.76 */
1518 #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2 /* 3G 178 TLV RIM Routing Address Discriminator 7.7.77 */
1519 #define GTP_EXT_LIST_OF_SETUP_PFCS 0xB3 /* 3G 179 TLV List of set-up PFCs 7.7.78 */
1520 #define GTP_EXT_PS_HANDOVER_XIP_PAR 0xB4 /* 3G 180 TLV PS Handover XID Parameters 7.7.79 */
1521 #define GTP_EXT_MS_INF_CHG_REP_ACT 0xB5 /* 3G 181 TLV MS Info Change Reporting Action 7.7.80 */
1522 #define GTP_EXT_DIRECT_TUNNEL_FLGS 0xB6 /* 3G 182 TLV Direct Tunnel Flags 7.7.81 */
1523 #define GTP_EXT_CORRELATION_ID 0xB7 /* 3G 183 TLV Correlation-ID 7.7.82 */
1524 #define GTP_EXT_BEARER_CONTROL_MODE 0xB8 /* 3G 184 TLV Bearer Control Mode 7.7.83 */
1525 #define GTP_EXT_MBMS_FLOW_ID 0xB9 /* 3G 185 TLV MBMS Flow Identifier 7.7.84 */
1526 #define GTP_EXT_MBMS_IP_MCAST_DIST 0xBA /* 3G 186 TLV MBMS IP Multicast Distribution 7.7.85 */
1527 #define GTP_EXT_MBMS_DIST_ACK 0xBB /* 3G 187 TLV MBMS Distribution Acknowledgement 7.7.86 */
1528 #define GTP_EXT_RELIABLE_IRAT_HO_INF 0xBC /* 3G 188 TLV Reliable INTER RAT HANDOVER INFO 7.7.87 */
1529 #define GTP_EXT_RFSP_INDEX 0xBD /* 3G 189 TLV RFSP Index 7.7.88 */
1530 #define GTP_EXT_FQDN 0xBE /* 3G 190 TLV Fully Qualified Domain Name (FQDN) 7.7.90 */
1531 #define GTP_EXT_EVO_ALLO_RETE_P1 0xBF /* 3G 191 TLV Evolved Allocation/Retention Priority I 7.7.91 */
1532 #define GTP_EXT_EVO_ALLO_RETE_P2 0xC0 /* 3G 192 TLV Evolved Allocation/Retention Priority II 7.7.92 */
1533 #define GTP_EXT_EXTENDED_COMMON_FLGS 0xC1 /* 3G 193 TLV Extended Common Flags 7.7.93 */
1534 #define GTP_EXT_UCI 0xC2 /* 3G 194 TLV User CSG Information (UCI) 7.7.94 */
1535 #define GTP_EXT_CSG_INF_REP_ACT 0xC3 /* 3G 195 TLV CSG Information Reporting Action 7.7.95 */
1536 #define GTP_EXT_CSG_ID 0xC4 /* 3G 196 TLV CSG ID 7.7.96 */
1537 #define GTP_EXT_CMI 0xC5 /* 3G 197 TLV CSG Membership Indication (CMI) 7.7.97 */
1538 #define GTP_EXT_AMBR 0xC6 /* 3G 198 TLV Aggregate Maximum Bit Rate (AMBR) 7.7.98 */
1539 #define GTP_EXT_UE_NETWORK_CAP 0xC7 /* 3G 199 TLV UE Network Capability 7.7.99 */
1540 #define GTP_EXT_UE_AMBR 0xC8 /* 3G 200 TLV UE-AMBR 7.7.100 */
1541 #define GTP_EXT_APN_AMBR_WITH_NSAPI 0xC9 /* 3G 201 TLV APN-AMBR with NSAPI 7.7.101 */
1542 #define GTP_EXT_GGSN_BACK_OFF_TIME 0xCA /* 3G 202 TLV GGSN Back-Off Time 7.7.102 */
1543 #define GTP_EXT_SIG_PRI_IND 0xCB /* 3G 203 TLV Signalling Priority Indication 7.7.103 */
1544 #define GTP_EXT_SIG_PRI_IND_W_NSAPI 0xCC /* 3G 204 TLV Signalling Priority Indication with NSAPI 7.7.104 */
1545 #define GTP_EXT_HIGHER_BR_16MB_FLG 0xCD /* 3G 205 TLV Higher bitrates than 16 Mbps flag 7.7.105 */
1546 #define GTP_EXT_MAX_MBR_APN_AMBR 0xCE /* 3G 206 TLV Max MBR/APN-AMBR 7.7.106 */
1547 #define GTP_EXT_ADD_MM_CTX_SRVCC 0xCF /* 3G 207 TLV Additional MM context for SRVCC 7.7.107 */
1548 #define GTP_EXT_ADD_FLGS_SRVCC 0xD0 /* 3G 208 TLV Additional flags for SRVCC 7.7.108 */
1549 #define GTP_EXT_STN_SR 0xD1 /* 3G 209 TLV STN-SR 7.7.109 */
1550 #define GTP_EXT_C_MSISDN 0xD2 /* 3G 210 TLV C-MSISDN 7.7.110 */
1551 #define GTP_EXT_EXT_RANAP_CAUSE 0xD3 /* 3G 211 TLV Extended RANAP Cause 7.7.111 */
1552 #define GTP_EXT_ENODEB_ID 0xD4 /* 3G 212 TLV eNodeB ID 7.7.112 */
1553 #define GTP_EXT_SEL_MODE_W_NSAPI 0xD5 /* 3G 213 TLV Selection Mode with NSAPI 7.7.113 */
1554 #define GTP_EXT_ULI_TIMESTAMP 0xD6 /* 3G 214 TLV ULI Timestamp 7.7.114 */
1555 #define GTP_EXT_LHN_ID_W_SAPI 0xD7 /* 3G 215 TLV Local Home Network ID (LHN-ID) with NSAPI 7.7.115 */
1556 #define GTP_EXT_CN_OP_SEL_ENTITY 0xD8 /* 3G 216 TLV CN Operator Selection Entity 7.7.116 */
1557 #define GTP_EXT_UE_USAGE_TYPE 0xD9 /* 3G 217 TLV UE Usage Type 7.7.117 */
1558 #define GTP_EXT_EXT_COMMON_FLGS_II 0xDA /* 3G 218 TLV Extended Common Flags II 7.7.118 */
1559 #define GTP_EXT_NODE_IDENTIFIER 0xDB /* 3G 219 TLV Node Identifier 7.7.119 */
1560 #define GTP_EXT_CIOT_OPT_SUP_IND 0xDC /* 3G 220 TLV CIoT Optimizations Support Indication 7.7.120 */
1561 #define GTP_EXT_SCEF_PDN_CONNECTION 0xDD /* 3G 221 TLV SCEF PDN Connection 7.7.121 */
1562 #define GTP_EXT_IOV_UPDATES_COUNTER 0xDE /* 3G 222 TLV IOV_updates counter 7.7.122 */
1563 #define GTP_EXT_MAPPED_UE_USAGE_TYPE 0xDF /* 3G 223 TLV Mapped UE Usage Type 7.7.123 */
1564 #define GTP_EXT_UP_FUN_SEL_IND_FLAGS 0xE0 /* 3G 224 TLV UP Function Selection Indication Flags 7.7.124 */
1567 /* 225-238 TLV Spare. For future use. */
1569 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
1571 #define GTP_EXT_C1 0xC1
1572 #define GTP_EXT_C2 0xC2
1573 #define GTP_EXT_REL_PACK 0xF9 /* charging */
1574 #define GTP_EXT_CAN_PACK 0xFA /* charging */
1575 #define GTP_EXT_CHRG_ADDR 0xFB /* 3G 251 TLV Charging Gateway Address 7.7.44 */
1576 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
1577 #define GTP_EXT_DATA_REQ 0xFC /* charging */
1578 #define GTP_EXT_DATA_RESP 0xFD /* charging */
1579 #define GTP_EXT_NODE_ADDR 0xFE /* charging */
1580 #define GTP_EXT_PRIV_EXT 0xFF
1582 static const value_string gtp_val[] = {
1583 {GTP_EXT_CAUSE, "Cause of operation"},
1584 {GTP_EXT_IMSI, "IMSI"},
1585 {GTP_EXT_RAI, "Routing Area Identity"},
1586 {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
1587 {GTP_EXT_PTMSI, "Packet TMSI"},
1588 /* 6 */ {GTP_EXT_QOS_GPRS, "Quality of Service"},
1589 /* 6-7 Spare */
1590 /* 8 */ {GTP_EXT_REORDER, "Reorder required"},
1591 /* 9 */ {GTP_EXT_AUTH_TRI, "Authentication triplets"},
1592 /* 10 Spare */
1593 /* 11 */ {GTP_EXT_MAP_CAUSE, "MAP cause"},
1594 /* 12 */ {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
1595 /* 13 */ {GTP_EXT_MS_VALID, "MS validated"},
1596 /* 14 */ {GTP_EXT_RECOVER, "Recovery"},
1597 /* 15 */ {GTP_EXT_SEL_MODE, "Selection mode"},
1599 /* 16 */ {GTP_EXT_16, "Flow label data I"},
1600 /* 16 */ /* ??? {GTP_EXT_FLOW_LABEL, "Flow label data I"}, */
1601 /* 16 */ /* ??? {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, */ /* 3G */
1603 {GTP_EXT_17, "Flow label signalling"},
1604 /* ??? {GTP_EXT_FLOW_SIG, "Flow label signalling"}, */
1605 /* ??? {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, */ /* 3G */
1607 {GTP_EXT_18, "Flow label data II"},
1608 /* ??? {GTP_EXT_FLOW_II, "Flow label data II"}, */
1609 /* ??? {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, */ /* 3G */
1611 {GTP_EXT_19, "MS not reachable reason"},
1612 /* ??? {GTP_EXT_MS_REASON, "MS not reachable reason"}, */
1613 /* ??? {GTP_EXT_TEAR_IND, "Teardown ID"}, */ /* 3G */
1615 {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
1616 {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
1617 {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
1618 {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
1619 {GTP_EXT_RP, "Radio Priority"}, /* 3G */
1620 {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
1621 {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
1622 {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
1623 {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
1624 /* 29 */ {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
1625 /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1626 /* 126 */ {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
1627 /* 127 */ {GTP_EXT_CHRG_ID, "Charging ID"},
1628 {GTP_EXT_USER_ADDR, "End user address"},
1629 {GTP_EXT_MM_CNTXT, "MM context"},
1630 {GTP_EXT_PDP_CNTXT, "PDP context"},
1631 {GTP_EXT_APN, "Access Point Name"},
1632 {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
1633 {GTP_EXT_GSN_ADDR, "GSN address"},
1634 {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
1635 {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
1636 {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
1637 {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
1638 {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
1639 {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
1640 {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
1641 {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
1642 {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
1643 {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
1645 {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
1646 {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
1647 {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
1648 {GTP_EXT_SGSN_NO, "SGSN Number"}, /* 7.7.47 */
1649 {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
1650 {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
1651 {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
1652 {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
1653 {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
1654 {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
1656 {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
1657 {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
1658 {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
1659 {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
1660 {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
1661 {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
1662 {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
1663 {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
1664 {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
1665 {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
1666 {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
1667 {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
1668 {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
1669 {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
1670 {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
1671 {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
1672 {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
1673 {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
1674 {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
1675 {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
1676 {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
1677 {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
1678 {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
1679 {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
1680 {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
1681 {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
1682 /* 180 */ {GTP_EXT_PS_HANDOVER_XIP_PAR, " PS Handover XID Parameters"}, /* 7.7.79 */
1683 /* 181 */ {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
1684 /* 182 */ {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
1685 /* 183 */ {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
1686 /* 184 */ {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
1687 /* 185 */ {GTP_EXT_MBMS_FLOW_ID, "MBMS Flow Identifier"}, /* 7.7.84 */
1688 /* 186 */ {GTP_EXT_MBMS_IP_MCAST_DIST, "MBMS IP Multicast Distribution"}, /* 7.7.85 */
1689 /* 187 */ {GTP_EXT_MBMS_DIST_ACK, "MBMS Distribution Acknowledgement"}, /* 7.7.86 */
1690 /* 188 */ {GTP_EXT_RELIABLE_IRAT_HO_INF, "Reliable INTER RAT HANDOVER INFO"}, /* 7.7.87 */
1691 /* 189 */ {GTP_EXT_RFSP_INDEX, "RFSP Index"}, /* 7.7.88 */
1692 /* 190 */ {GTP_EXT_FQDN, "Fully Qualified Domain Name (FQDN)"}, /* 7.7.90 */
1693 /* 191 */ {GTP_EXT_EVO_ALLO_RETE_P1, "Evolved Allocation/Retention Priority I"}, /* 7.7.91 */
1694 /* 192 */ {GTP_EXT_EVO_ALLO_RETE_P2, "Evolved Allocation/Retention Priority II"}, /* 7.7.92 */
1695 /* 193 */ {GTP_EXT_EXTENDED_COMMON_FLGS, "Extended Common Flags"}, /* 7.7.93 */
1696 /* 194 */ {GTP_EXT_UCI, "User CSG Information (UCI)"}, /* 7.7.94 */
1697 /* 195 */ {GTP_EXT_CSG_INF_REP_ACT, "CSG Information Reporting Action"}, /* 7.7.95 */
1698 /* 196 */ {GTP_EXT_CSG_ID, "CSG ID"}, /* 7.7.96 */
1699 /* 197 */ {GTP_EXT_CMI, "CSG Membership Indication (CMI)"}, /* 7.7.97 */
1700 /* 198 */ {GTP_EXT_AMBR, "Aggregate Maximum Bit Rate (AMBR)"}, /* 7.7.98 */
1701 /* 199 */ {GTP_EXT_UE_NETWORK_CAP, "UE Network Capability"}, /* 7.7.99 */
1702 /* 200 */ {GTP_EXT_UE_AMBR, "UE-AMBR"}, /* 7.7.100 */
1703 /* 201 */ {GTP_EXT_APN_AMBR_WITH_NSAPI, "APN-AMBR with NSAPI"}, /* 7.7.101 */
1704 /* 202 */ {GTP_EXT_GGSN_BACK_OFF_TIME, "GGSN Back-Off Time"}, /* 7.7.102 */
1705 /* 203 */ {GTP_EXT_SIG_PRI_IND, "Signalling Priority Indication"}, /* 7.7.103 */
1706 /* 204 */ {GTP_EXT_SIG_PRI_IND_W_NSAPI, "Signalling Priority Indication with NSAPI"}, /* 7.7.104 */
1707 /* 205 */ {GTP_EXT_HIGHER_BR_16MB_FLG, "Higher bitrates than 16 Mbps flag"}, /* 7.7.105 */
1708 /* 206 */ {GTP_EXT_MAX_MBR_APN_AMBR, "Max MBR/APN-AMBR"}, /* 7.7.106 */
1709 /* 207 */ {GTP_EXT_ADD_MM_CTX_SRVCC, "Additional MM context for SRVCC"}, /* 7.7.107 */
1710 /* 208 */ {GTP_EXT_ADD_FLGS_SRVCC, "Additional flags for SRVCC"}, /* 7.7.108 */
1711 /* 209 */ {GTP_EXT_STN_SR, "STN-SR"}, /* 7.7.109 */
1712 /* 210 */ {GTP_EXT_C_MSISDN, "C-MSISDN"}, /* 7.7.110 */
1713 /* 211 */ {GTP_EXT_EXT_RANAP_CAUSE, "Extended RANAP Cause"}, /* 7.7.111 */
1714 /* 212 */ {GTP_EXT_ENODEB_ID, "eNodeB ID" }, /* 7.7.112 */
1715 /* 213 */ {GTP_EXT_SEL_MODE_W_NSAPI, "Selection Mode with NSAPI" }, /* 7.7.113 */
1716 /* 214 */ {GTP_EXT_ULI_TIMESTAMP, "ULI Timestamp" }, /* 7.7.114 */
1717 /* 215 */ {GTP_EXT_LHN_ID_W_SAPI, "Local Home Network ID (LHN-ID) with NSAPI" }, /* 7.7.115 */
1718 /* 216 */ {GTP_EXT_CN_OP_SEL_ENTITY, "Operator Selection Entity" }, /* 7.7.116 */
1719 /* 217 */ {GTP_EXT_UE_USAGE_TYPE, "UE Usage Type" }, /* 7.7.117 */
1720 /* 218 */ {GTP_EXT_EXT_COMMON_FLGS_II, "Extended Common Flags II"}, /* 7.7.118 */
1721 /* 219 */ {GTP_EXT_NODE_IDENTIFIER, "Node Identifier" }, /* 7.7.119 */
1722 /* 220 */ {GTP_EXT_CIOT_OPT_SUP_IND, "CIoT Optimizations Support Indication" }, /* 7.7.120 */
1723 /* 221 */ {GTP_EXT_SCEF_PDN_CONNECTION, "SCEF PDN Connection" }, /* 7.7.121 */
1724 /* 222 */ {GTP_EXT_IOV_UPDATES_COUNTER, "IOV_updates counter" }, /* 7.7.122 */
1725 /* 223 */ {GTP_EXT_MAPPED_UE_USAGE_TYPE, "Mapped UE Usage Type" }, /* 7.7.123 */
1726 /* 224 */ {GTP_EXT_UP_FUN_SEL_IND_FLAGS, "UP Function Selection Indication Flags" }, /* 7.7.124 */
1729 /* 225-238 TLV Spare. For future use. */
1730 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1731 /* 249 */ {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
1732 /* 250 */ {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
1733 /* 251 */ {GTP_EXT_CHRG_ADDR, "Charging Gateway address"}, /* 7.7.44 */
1734 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1735 /* 252 */ {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
1736 /* 253 */ {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
1737 /* 254 */ {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
1738 /* 255 */ {GTP_EXT_PRIV_EXT, "Private Extension"},
1739 {0, NULL}
1741 static value_string_ext gtp_val_ext = VALUE_STRING_EXT_INIT(gtp_val);
1743 /* It seems like some IE's are renamed in gtpv1 at least reading
1744 * 3GPP TS 29.060 version 6.11.0 Release 6
1746 static const value_string gtpv1_val[] = {
1747 /* 1 */ {GTP_EXT_CAUSE, "Cause of operation"},
1748 /* 2 */ {GTP_EXT_IMSI, "IMSI"},
1749 /* 3 */ {GTP_EXT_RAI, "Routing Area Identity"},
1750 /* 4 */ {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
1751 /* 5 */ {GTP_EXT_PTMSI, "Packet TMSI"},
1752 /* 6 */ {GTP_EXT_QOS_GPRS, "Quality of Service"},
1753 /* 6-7 Spare */
1754 /* 7 */ {7, "Spare"},
1755 /* 8 */ {GTP_EXT_REORDER, "Reorder required"},
1756 /* 9 */ {GTP_EXT_AUTH_TRI, "Authentication triplets"},
1757 /* 10 Spare */
1758 /* 10 */ {10, "Spare"},
1759 /* 11 */ {GTP_EXT_MAP_CAUSE, "MAP cause"},
1760 /* 12 */ {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
1761 /* 13 */ {GTP_EXT_MS_VALID, "MS validated"},
1762 /* 14 */ {GTP_EXT_RECOVER, "Recovery"},
1763 /* 15 */ {GTP_EXT_SEL_MODE, "Selection mode"},
1764 /* 16 */ {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
1765 /* 17 */ {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
1766 /* 18 */ {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
1767 /* 19 */ {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
1769 /* 20 */ {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
1770 /* 21 */ {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
1771 /* 22 */ {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
1772 /* 23 */ {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
1773 /* 24 */ {GTP_EXT_RP, "Radio Priority"}, /* 3G */
1774 /* 25 */ {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
1775 /* 26 */ {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
1776 /* 27 */ {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
1777 /* 28 */ {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
1778 /* 29 */ {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
1779 /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1780 /* 126 */ {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
1781 /* 127 */ {GTP_EXT_CHRG_ID, "Charging ID"},
1783 /* 128 */ {GTP_EXT_USER_ADDR, "End user address"},
1784 /* 129 */ {GTP_EXT_MM_CNTXT, "MM context"},
1785 /* 130 */ {GTP_EXT_PDP_CNTXT, "PDP context"},
1786 /* 131 */ {GTP_EXT_APN, "Access Point Name"},
1787 /* 132 */ {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
1788 /* 133 */ {GTP_EXT_GSN_ADDR, "GSN address"},
1789 /* 134 */ {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
1790 /* 135 */ {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
1791 /* 136 */ {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
1792 /* 137 */ {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
1793 /* 138 */ {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
1794 /* 139 */ {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
1795 /* 140 */ {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
1796 /* 141 */ {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
1797 /* 142 */ {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
1798 /* 143 */ {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
1799 /* 144 */ {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
1800 /* 145 */ {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
1801 /* 146 */ {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
1802 /* 147 */ {GTP_EXT_SGSN_NO, "SGSN Number"}, /* 7.7.47 */
1803 /* 148 */ {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
1804 /* 149 */ {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
1805 /* 150 */ {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
1806 /* 151 */ {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
1807 /* 152 */ {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
1808 /* 153 */ {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
1810 /* 154 */ {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
1811 /* 155 */ {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
1812 /* 156 */ {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
1813 /* 157 */ {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
1814 /* 158 */ {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
1815 /* 159 */ {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
1816 /* 160 */ {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
1817 /* 161 */ {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
1818 /* 162 */ {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
1819 /* 163 */ {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
1820 /* 164 */ {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
1821 /* 165 */ {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
1822 /* 166 */ {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
1823 /* 167 */ {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
1824 /* 168 */ {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
1825 /* 169 */ {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
1826 /* 170 */ {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
1827 /* 171 */ {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
1828 /* 172 */ {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
1829 /* 173 */ {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
1830 /* 174 */ {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
1831 /* 175 */ {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
1832 /* 176 */ {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
1834 /* 177 */ {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
1835 /* 178 */ {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
1836 /* 179 */ {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
1837 /* 180 */ {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"}, /* 7.7.79 */
1838 /* 181 */ {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
1839 /* 182 */ {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
1840 /* 183 */ {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
1841 /* 184 */ {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
1842 /* 185 */ {GTP_EXT_MBMS_FLOW_ID, "MBMS Flow Identifier"}, /* 7.7.84 */
1843 /* 186 */ {GTP_EXT_MBMS_IP_MCAST_DIST, "MBMS IP Multicast Distribution"}, /* 7.7.85 */
1844 /* 187 */ {GTP_EXT_MBMS_DIST_ACK, "MBMS Distribution Acknowledgement"}, /* 7.7.86 */
1845 /* 188 */ {GTP_EXT_RELIABLE_IRAT_HO_INF, "Reliable INTER RAT HANDOVER INFO"}, /* 7.7.87 */
1846 /* 190 */ {GTP_EXT_RFSP_INDEX, "RFSP Index"}, /* 7.7.88 */
1847 /* 190 */ {GTP_EXT_FQDN, "Fully Qualified Domain Name (FQDN)"}, /* 7.7.90 */
1848 /* 191 */ {GTP_EXT_EVO_ALLO_RETE_P1, "Evolved Allocation/Retention Priority I"}, /* 7.7.91 */
1849 /* 192 */ {GTP_EXT_EVO_ALLO_RETE_P2, "Evolved Allocation/Retention Priority II"}, /* 7.7.92 */
1850 /* 193 */ {GTP_EXT_EXTENDED_COMMON_FLGS, "Extended Common Flags"}, /* 7.7.93 */
1851 /* 194 */ {GTP_EXT_UCI, "User CSG Information (UCI)"}, /* 7.7.94 */
1852 /* 195 */ {GTP_EXT_CSG_INF_REP_ACT, "CSG Information Reporting Action"}, /* 7.7.95 */
1853 /* 196 */ {GTP_EXT_CSG_ID, "CSG ID"}, /* 7.7.96 */
1854 /* 197 */ {GTP_EXT_CMI, "CSG Membership Indication (CMI)"}, /* 7.7.97 */
1855 /* 198 */ {198, "Aggregate Maximum Bit Rate (AMBR)"}, /* 7.7.98 */
1856 /* 199 */ {199, "UE Network Capability"}, /* 7.7.99 */
1857 /* 200 */ {200, "UE-AMBR"}, /* 7.7.100 */
1858 /* 201 */ {201, "APN-AMBR with NSAPI"}, /* 7.7.101 */
1859 /* 202 */ {202, "GGSN Back-Off Time"}, /* 7.7.102 */
1860 /* 203 */ {203, "Signalling Priority Indication"}, /* 7.7.103 */
1861 /* 204 */ {204, "Signalling Priority Indication with NSAPI"}, /* 7.7.104 */
1862 /* 205 */ {205, "Higher bitrates than 16 Mbps flag"}, /* 7.7.105 */
1863 /* 206 */ {206, "Max MBR/APN-AMBR"}, /* 7.7.106 */
1864 /* 207 */ {207, "Additional MM context for SRVCC"}, /* 7.7.107 */
1865 /* 208 */ {208, "Additional flags for SRVCC"}, /* 7.7.108 */
1866 /* 209 */ {209, "STN-SR"}, /* 7.7.109 */
1867 /* 210 */ {210, "C-MSISDN"}, /* 7.7.110 */
1868 /* 211 */ {211, "Extended RANAP Cause"}, /* 7.7.111 */
1869 /* 212 */ {GTP_EXT_ENODEB_ID, "eNodeB ID" }, /* 7.7.112 */
1870 /* 213 */ {GTP_EXT_SEL_MODE_W_NSAPI, "Selection Mode with NSAPI" }, /* 7.7.113 */
1871 /* 214 */ {GTP_EXT_ULI_TIMESTAMP, "ULI Timestamp" }, /* 7.7.114 */
1872 /* 215 */ {GTP_EXT_LHN_ID_W_SAPI, "Local Home Network ID (LHN-ID) with NSAPI" }, /* 7.7.115 */
1873 /* 216 */ {GTP_EXT_CN_OP_SEL_ENTITY, "Operator Selection Entity" }, /* 7.7.116 */
1874 /* 217 */ {GTP_EXT_UE_USAGE_TYPE, "UE Usage Type" }, /* 7.7.117 */
1875 /* 218 */ {GTP_EXT_EXT_COMMON_FLGS_II, "Extended Common Flags II"}, /* 7.7.118 */
1876 /* 219 */ {GTP_EXT_NODE_IDENTIFIER, "Node Identifier" }, /* 7.7.119 */
1877 /* 220 */ {GTP_EXT_CIOT_OPT_SUP_IND, "CIoT Optimizations Support Indication" }, /* 7.7.120 */
1878 /* 221 */ {GTP_EXT_SCEF_PDN_CONNECTION, "SCEF PDN Connection" }, /* 7.7.121 */
1879 /* 222 */ {GTP_EXT_IOV_UPDATES_COUNTER, "IOV_updates counter" }, /* 7.7.122 */
1880 /* 223 */ {GTP_EXT_MAPPED_UE_USAGE_TYPE, "Mapped UE Usage Type" }, /* 7.7.123 */
1881 /* 224 */ {GTP_EXT_UP_FUN_SEL_IND_FLAGS, "UP Function Selection Indication Flags" }, /* 7.7.124 */
1883 /* 225-238 TLV Spare. For future use. */
1884 /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1885 /* 249 */ {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
1886 /* 250 */ {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
1887 /* 251 */ {GTP_EXT_CHRG_ADDR, "Charging Gateway address"}, /* 7.7.44 */
1888 /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
1889 /* 252 */ {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
1890 /* 253 */ {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
1891 /* 254 */ {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
1892 /* 255 */ {GTP_EXT_PRIV_EXT, "Private Extension"},
1894 {0, NULL}
1896 static value_string_ext gtpv1_val_ext = VALUE_STRING_EXT_INIT(gtpv1_val);
1898 /* GPRS: 9.60 v7.6.0, page 37
1899 * UMTS: 29.060 v4.0, page 45
1900 * ETSI TS 129 060 V9.4.0 (2010-10) Ch 7.7.1
1902 static const value_string cause_type[] = {
1903 { 0, "Request IMSI"},
1904 { 1, "Request IMEI"},
1905 { 2, "Request IMSI and IMEI"},
1906 { 3, "No identity needed"},
1907 { 4, "MS refuses"},
1908 { 5, "MS is not GPRS responding"},
1909 { 6, "Reactivation Requested"},
1910 { 7, "PDP address inactivity timer expires"},
1911 /* For future use 8-48 */
1912 /* Cause values reserved for GPRS charging
1913 * protocol use (see GTP' in 3GPP TS 32.295 [33])
1914 * 49-63
1916 { 59, "System failure"}, /* charging */
1917 { 60, "The transmit buffers are becoming full"}, /* charging */
1918 { 61, "The receive buffers are becoming full"}, /* charging */
1919 { 62, "Another node is about to go down"}, /* charging */
1920 { 63, "This node is about to go down"}, /* charging */
1921 /* For future use 64-127 */
1922 {128, "Request accepted"},
1923 {129, "New PDP type due to network preference"},
1924 {130, "New PDP type due to single address bearer only"},
1925 /* For future use 131-176 */
1926 /* Cause values reserved for GPRS charging
1927 * protocol use (see GTP' in 3GPP TS 32.295 [33])
1928 * 177-191
1930 {177, "CDR decoding error"},
1932 {192, "Non-existent"},
1933 {193, "Invalid message format"},
1934 {194, "IMSI not known"},
1935 {195, "MS is GPRS detached"},
1936 {196, "MS is not GPRS responding"},
1937 {197, "MS refuses"},
1938 {198, "Version not supported"},
1939 {199, "No resource available"},
1940 {200, "Service not supported"},
1941 {201, "Mandatory IE incorrect"},
1942 {202, "Mandatory IE missing"},
1943 {203, "Optional IE incorrect"},
1944 {204, "System failure"},
1945 {205, "Roaming restriction"},
1946 {206, "P-TMSI signature mismatch"},
1947 {207, "GPRS connection suspended"},
1948 {208, "Authentication failure"},
1949 {209, "User authentication failed"},
1950 {210, "Context not found"},
1951 {211, "All PDP dynamic addresses are occupied"},
1952 {212, "No memory is available"},
1953 {213, "Relocation failure"},
1954 {214, "Unknown mandatory extension header"},
1955 {215, "Semantic error in the TFT operation"},
1956 {216, "Syntactic error in the TFT operation"},
1957 {217, "Semantic errors in packet filter(s)"},
1958 {218, "Syntactic errors in packet filter(s)"},
1959 {219, "Missing or unknown APN"},
1960 {220, "Unknown PDP address or PDP type"},
1961 {221, "PDP context without TFT already activated"},
1962 {222, "APN access denied - no subscription"},
1963 {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
1964 {224, "MS MBMS Capabilities Insufficient"},
1965 {225, "Invalid Correlation-ID"},
1966 {226, "MBMS Bearer Context Superseded"},
1967 {227, "Bearer Control Mode violation"},
1968 {228, "Collision with network initiated request"},
1969 {229, "APN Congestion"},
1970 {230, "Bearer handling not supported"},
1971 {231, "Target access restricted for the subscriber" },
1972 {232, "UE is temporarily not reachable due to power saving" },
1973 {233, "Relocation failure due to NAS message redirection"},
1974 /* For future use -240 */
1975 /* Cause values reserved for GPRS charging
1976 * protocol use (see GTP' in 3GPP TS 32.295 [33])
1977 * 241-255
1979 {252, "Request related to possibly duplicated packets already fulfilled"}, /* charging */
1980 {253, "Request already fulfilled"}, /* charging */
1981 {254, "Sequence numbers of released/cancelled packets IE incorrect"}, /* charging */
1982 {255, "Request not fulfilled"}, /* charging */
1983 {0, NULL}
1985 value_string_ext cause_type_ext = VALUE_STRING_EXT_INIT(cause_type);
1987 /* GPRS: 9.02 v7.7.0
1988 * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
1989 * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
1992 static const value_string gsn_addr_type[] = {
1993 {0x00, "IPv4"},
1994 {0x01, "IPv6"},
1995 {0, NULL}
1998 static const value_string pdp_type[] = {
1999 {0x00, "X.25"},
2000 {0x01, "PPP"},
2001 {0x02, "OSP:IHOSS"},
2002 {0x21, "IPv4"},
2003 {0x57, "IPv6"},
2004 {0x8d, "IPv4v6"},
2005 {0, NULL}
2008 static const value_string pdp_org_type[] = {
2009 {0, "ETSI"},
2010 {1, "IETF"},
2011 {0, NULL}
2014 static const value_string qos_delay_type[] = {
2015 {0x00, "Subscribed delay class (in MS to network direction)"},
2016 {0x01, "Delay class 1"},
2017 {0x02, "Delay class 2"},
2018 {0x03, "Delay class 3"},
2019 {0x04, "Delay class 4 (best effort)"},
2020 {0x07, "Reserved"},
2021 {0, NULL}
2024 static const value_string qos_reliability_type[] = {
2025 {0x00, "Subscribed reliability class (in MS to network direction)"},
2026 {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
2027 {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
2028 {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
2029 {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
2030 {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
2031 {0x07, "Reserved"},
2032 {0, NULL}
2035 static const value_string qos_peak_type[] = {
2036 {0x00, "Subscribed peak throughput (in MS to network direction)"},
2037 {0x01, "Up to 1 000 oct/s"},
2038 {0x02, "Up to 2 000 oct/s"},
2039 {0x03, "Up to 4 000 oct/s"},
2040 {0x04, "Up to 8 000 oct/s"},
2041 {0x05, "Up to 16 000 oct/s"},
2042 {0x06, "Up to 32 000 oct/s"},
2043 {0x07, "Up to 64 000 oct/s"},
2044 {0x08, "Up to 128 000 oct/s"},
2045 {0x09, "Up to 256 000 oct/s"},
2046 /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
2047 {0x0A, "Reserved"},
2048 {0x0B, "Reserved"},
2049 {0x0C, "Reserved"},
2050 {0x0D, "Reserved"},
2051 {0x0E, "Reserved"},
2052 {0x0F, "Reserved"},
2053 {0, NULL}
2056 static const value_string qos_precedence_type[] = {
2057 {0x00, "Subscribed precedence (in MS to network direction)"},
2058 {0x01, "High priority"},
2059 {0x02, "Normal priority"},
2060 {0x03, "Low priority"},
2061 {0x07, "Reserved"},
2062 {0, NULL}
2065 static const value_string qos_mean_type[] = {
2066 {0x00, "Subscribed mean throughput (in MS to network direction)"},
2067 {0x01, "100 oct/h"}, /* Class 2 */
2068 {0x02, "200 oct/h"}, /* Class 3 */
2069 {0x03, "500 oct/h"}, /* Class 4 */
2070 {0x04, "1 000 oct/h"}, /* Class 5 */
2071 {0x05, "2 000 oct/h"}, /* Class 6 */
2072 {0x06, "5 000 oct/h"}, /* Class 7 */
2073 {0x07, "10 000 oct/h"}, /* Class 8 */
2074 {0x08, "20 000 oct/h"}, /* Class 9 */
2075 {0x09, "50 000 oct/h"}, /* Class 10 */
2076 {0x0A, "100 000 oct/h"}, /* Class 11 */
2077 {0x0B, "200 000 oct/h"}, /* Class 12 */
2078 {0x0C, "500 000 oct/h"}, /* Class 13 */
2079 {0x0D, "1 000 000 oct/h"}, /* Class 14 */
2080 {0x0E, "2 000 000 oct/h"}, /* Class 15 */
2081 {0x0F, "5 000 000 oct/h"}, /* Class 16 */
2082 {0x10, "10 000 000 oct/h"}, /* Class 17 */
2083 {0x11, "20 000 000 oct/h"}, /* Class 18 */
2084 {0x12, "50 000 000 oct/h"}, /* Class 19 */
2085 /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
2086 {0x13, "Reserved"},
2087 {0x14, "Reserved"},
2088 {0x15, "Reserved"},
2089 {0x16, "Reserved"},
2090 {0x17, "Reserved"},
2091 {0x18, "Reserved"},
2092 {0x19, "Reserved"},
2093 {0x1A, "Reserved"},
2094 {0x1B, "Reserved"},
2095 {0x1C, "Reserved"},
2096 {0x1D, "Reserved"},
2097 {0x1E, "Reserved"},
2098 {0x1F, "Best effort"}, /* Class 1 */
2099 {0, NULL}
2101 static value_string_ext qos_mean_type_ext = VALUE_STRING_EXT_INIT(qos_mean_type);
2103 static const value_string qos_del_err_sdu[] = {
2104 {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
2105 {0x01, "No detect ('-')"},
2106 {0x02, "Erroneous SDUs are delivered ('yes')"},
2107 {0x03, "Erroneous SDUs are not delivered ('no')"},
2108 {0x07, "Reserved"}, /* All other values are reserved */
2109 {0, NULL}
2112 static const value_string qos_del_order[] = {
2113 {0x00, "Subscribed delivery order (in MS to network direction)"},
2114 {0x01, "With delivery order ('yes')"},
2115 {0x02, "Without delivery order ('no')"},
2116 {0x03, "Reserved"}, /* All other values are reserved */
2117 {0, NULL}
2120 static const value_string qos_traf_class[] = {
2121 {0x00, "Subscribed traffic class (in MS to network direction)"},
2122 {0x01, "Conversational class"},
2123 {0x02, "Streaming class"},
2124 {0x03, "Interactive class"},
2125 {0x04, "Background class"},
2126 {0x07, "Reserved"}, /* All other values are reserved */
2127 {0, NULL}
2130 static const value_string qos_max_sdu_size[] = {
2131 {0x00, "Subscribed maximum SDU size (in MS to network direction"},
2132 /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
2133 {0x97, "1502 octets"},
2134 {0x98, "1510 octets"},
2135 {0x99, "1520 octets"},
2136 {0, NULL} /* All other values are reserved */
2139 static const value_string qos_max_ul[] = {
2140 {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
2141 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2142 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2143 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2144 {0xFF, "0 kbps"},
2145 {0, NULL}
2148 static const value_string qos_max_dl[] = {
2149 {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
2150 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2151 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2152 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2153 {0xFF, "0 kbps"},
2154 {0, NULL}
2157 static const value_string qos_res_ber[] = {
2158 {0x00, "Subscribed residual BER (in MS to network direction)"},
2159 {0x01, "1/20 = 5x10^-2"},
2160 {0x02, "1/100 = 1x10^-2"},
2161 {0x03, "1/200 = 5x10^-3"},
2162 {0x04, "1/250 = 4x10^-3"},
2163 {0x05, "1/1 000 = 1x10^-3"},
2164 {0x06, "1/10 000 = 1x10^-4"},
2165 {0x07, "1/100 000 = 1x10^-5"},
2166 {0x08, "1/1 000 000 = 1x10^-6"},
2167 {0x09, "3/50 000 000 = 6x10^-8"},
2168 {0x0F, "Reserved"}, /* All other values are reserved */
2169 {0, NULL}
2172 static const value_string qos_sdu_err_ratio[] = {
2173 {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
2174 {0x01, "1/100 = 1x10^-2"},
2175 {0x02, "7/1000 = 7x10^-3"},
2176 {0x03, "1/1 000 = 1x10^-3"},
2177 {0x04, "1/10 000 = 1x10^-4"},
2178 {0x05, "1/100 000 = 1x10^-5"},
2179 {0x06, "1/1 000 000 = 1x10^-6"},
2180 {0x07, "1/10 = 1x10^-1"},
2181 {0x0F, "Reserved"}, /* All other values are reserved */
2182 {0, NULL}
2185 static const value_string qos_traf_handl_prio[] = {
2186 {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
2187 {0x01, "Priority level 1"},
2188 {0x02, "Priority level 2"},
2189 {0x03, "Priority level 3"},
2190 {0, NULL}
2193 static const value_string qos_trans_delay[] = {
2194 {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
2195 {0x01, "10 ms"}, /* Using a granularity of 10 ms */
2196 {0x02, "20 ms"},
2197 {0x03, "30 ms"},
2198 {0x04, "40 ms"},
2199 {0x05, "50 ms"},
2200 {0x06, "60 ms"},
2201 {0x07, "70 ms"},
2202 {0x08, "80 ms"},
2203 {0x09, "90 ms"},
2204 {0x0A, "100 ms"},
2205 {0x0B, "110 ms"},
2206 {0x0C, "120 ms"},
2207 {0x0D, "130 ms"},
2208 {0x0E, "140 ms"},
2209 {0x0F, "150 ms"},
2210 {0x10, "200 ms"}, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
2211 {0x11, "250 ms"},
2212 {0x12, "300 ms"},
2213 {0x13, "350 ms"},
2214 {0x14, "400 ms"},
2215 {0x15, "450 ms"},
2216 {0x16, "500 ms"},
2217 {0x17, "550 ms"},
2218 {0x18, "600 ms"},
2219 {0x19, "650 ms"},
2220 {0x1A, "700 ms"},
2221 {0x1B, "750 ms"},
2222 {0x1C, "800 ms"},
2223 {0x1D, "850 ms"},
2224 {0x1E, "900 ms"},
2225 {0x1F, "950 ms"},
2226 {0x20, "1000 ms"}, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
2227 {0x21, "1100 ms"},
2228 {0x22, "1200 ms"},
2229 {0x23, "1300 ms"},
2230 {0x24, "1400 ms"},
2231 {0x25, "1500 ms"},
2232 {0x26, "1600 ms"},
2233 {0x27, "1700 ms"},
2234 {0x28, "1800 ms"},
2235 {0x29, "1900 ms"},
2236 {0x2A, "2000 ms"},
2237 {0x2B, "2100 ms"},
2238 {0x2C, "2200 ms"},
2239 {0x2D, "2300 ms"},
2240 {0x2E, "2400 ms"},
2241 {0x2F, "2500 ms"},
2242 {0x30, "2600 ms"},
2243 {0x31, "2700 ms"},
2244 {0x32, "2800 ms"},
2245 {0x33, "2900 ms"},
2246 {0x34, "3000 ms"},
2247 {0x35, "3100 ms"},
2248 {0x36, "3200 ms"},
2249 {0x37, "3300 ms"},
2250 {0x38, "3400 ms"},
2251 {0x39, "3500 ms"},
2252 {0x3A, "3600 ms"},
2253 {0x3B, "3700 ms"},
2254 {0x3C, "3800 ms"},
2255 {0x3D, "3900 ms"},
2256 {0x3E, "4000 ms"},
2257 {0x3F, "Reserved"},
2258 {0, NULL}
2260 static value_string_ext qos_trans_delay_ext = VALUE_STRING_EXT_INIT(qos_trans_delay);
2262 static const value_string qos_guar_ul[] = {
2263 {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
2264 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2265 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2266 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2267 {0xFF, "0 kbps"},
2268 {0, NULL}
2271 static const value_string src_stat_desc_vals[] = {
2272 {0x00, "unknown"},
2273 {0x01, "speech"},
2274 {0, NULL}
2278 static const true_false_string gtp_sig_ind = {
2279 "Optimised for signalling traffic",
2280 "Not optimised for signalling traffic"
2283 static const value_string qos_guar_dl[] = {
2284 {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
2285 /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
2286 /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
2287 /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
2288 {0xFF, "0 kbps"},
2289 {0, NULL}
2292 static const value_string sel_mode_type[] = {
2293 {0, "MS or network provided APN, subscribed verified"},
2294 {1, "MS provided APN, subscription not verified"},
2295 {2, "Network provided APN, subscription not verified"},
2296 {3, "For future use (Network provided APN, subscription not verified"}, /* Shall not be sent. If received, shall be sent as value 2 */
2297 {0, NULL}
2300 static const value_string tr_comm_type[] = {
2301 {1, "Send data record packet"},
2302 {2, "Send possibly duplicated data record packet"},
2303 {3, "Cancel data record packet"},
2304 {4, "Release data record packet"},
2305 {0, NULL}
2309 * UMTS: 23.040 v14.0.0, chapter 3.3.2
2311 static const value_string ms_not_reachable_type[] = {
2312 { 0, "No paging response via the MSC"},
2313 { 1, "IMSI detached"},
2314 { 2, "Roaming restriction"},
2315 { 3, "Deregistered in the HLR for non GPRS"},
2316 { 4, "MS purge for non GPRS"},
2317 { 5, "No paging response via the SGSN"},
2318 { 6, "GPRS detached"},
2319 { 7, "Deregistered in the HLR for non GPRS"},
2320 { 8, "MS purged for GPRS"},
2321 { 9, "Unidentified subscriber via the MSC"},
2322 {10, "Unidentified subscriber via the SGSN"},
2323 {11, "Deregistered in the HSS/HLR for IMS"},
2324 {12, "No response via the IP-SM-GW"},
2325 {13, "The MS is temporarily unavailable"},
2326 {0, NULL} /* All other values are reserved */
2329 /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
2331 static const value_string ranap_cause_type[] = {
2332 /* Radio Network Layer Cause (1-->64) */
2333 { 1, "RAB preempted"},
2334 { 2, "Trelocoverall Expiry"},
2335 { 3, "Trelocprep Expiry"},
2336 { 4, "Treloccomplete Expiry"},
2337 { 5, "Tqueuing Expiry"},
2338 { 6, "Relocation Triggered"},
2339 { 7, "TRELOCalloc Expiry"},
2340 { 8, "Unable to Establish During Relocation"},
2341 { 9, "Unknown Target RNC"},
2342 { 10, "Relocation Cancelled"},
2343 { 11, "Successful Relocation"},
2344 { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
2345 { 13, "Change of Ciphering and/or Integrity Protection is not supported"},
2346 { 14, "Failure in the Radio Interface Procedure"},
2347 { 15, "Release due to UTRAN Generated Reason"},
2348 { 16, "User Inactivity"},
2349 { 17, "Time Critical Relocation"},
2350 { 18, "Requested Traffic Class not Available"},
2351 { 19, "Invalid RAB Parameters Value"},
2352 { 20, "Requested Maximum Bit Rate not Available"},
2353 { 21, "Requested Guaranteed Bit Rate not Available"},
2354 { 22, "Requested Transfer Delay not Achievable"},
2355 { 23, "Invalid RAB Parameters Combination"},
2356 { 24, "Condition Violation for SDU Parameters"},
2357 { 25, "Condition Violation for Traffic Handling Priority"},
2358 { 26, "Condition Violation for Guaranteed Bit Rate"},
2359 { 27, "User Plane Versions not Supported"},
2360 { 28, "Iu UP Failure"},
2361 { 29, "Relocation Failure in Target CN/RNC or Target System"},
2362 { 30, "Invalid RAB ID"},
2363 { 31, "No Remaining RAB"},
2364 { 32, "Interaction with other procedure"},
2365 { 33, "Requested Maximum Bit Rate for DL not Available"},
2366 { 34, "Requested Maximum Bit Rate for UL not Available"},
2367 { 35, "Requested Guaranteed Bit Rate for DL not Available"},
2368 { 36, "Requested Guaranteed Bit Rate for UL not Available"},
2369 { 37, "Repeated Integrity Checking Failure"},
2370 { 38, "Requested Report Type not supported"},
2371 { 39, "Request superseded"},
2372 { 40, "Release due to UE generated signalling connection release"},
2373 { 41, "Resource Optimisation Relocation"},
2374 { 42, "Requested Information Not Available"},
2375 { 43, "Relocation desirable for radio reasons"},
2376 { 44, "Relocation not supported in Target RNC or Target System"},
2377 { 45, "Directed Retry"},
2378 { 46, "Radio Connection With UE Lost"},
2379 { 47, "rNC-unable-to-establish-all-RFCs"},
2380 { 48, "deciphering-keys-not-available"},
2381 { 49, "dedicated-assistance-data-not-available"},
2382 { 50, "relocation-target-not-allowed"},
2383 { 51, "location-reporting-congestion"},
2384 { 52, "reduce-load-in-serving-cell"},
2385 { 53, "no-radio-resources-available-in-target-cell"},
2386 { 54, "gERAN-Iumode-failure"},
2387 { 55, "access-restricted-due-to-shared-networks"},
2388 { 56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
2389 { 57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
2390 { 58, "mBMS-no-multicast-service-for-this-UE"},
2391 { 59, "mBMS-unknown-UE-ID"},
2392 { 60, "successful-MBMS-session-start-no-data-bearer-necessary"},
2393 { 61, "mBMS-superseded-due-to-NNSF"},
2394 { 62, "mBMS-UE-linking-already-done"},
2395 { 63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
2396 { 64, "tMGI-unknown"},
2397 /* Transport Layer Cause (65-->80) */
2398 { 65, "Signalling Transport Resource Failure"},
2399 { 66, "Iu Transport Connection Failed to Establish"},
2400 /* NAS Cause (81-->96) */
2401 { 81, "User Restriction Start Indication"},
2402 { 82, "User Restriction End Indication"},
2403 { 83, "Normal Release"},
2404 /* Protocol Cause (97-->112) */
2405 { 97, "Transfer Syntax Error"},
2406 { 98, "Semantic Error"},
2407 { 99, "Message not compatible with receiver state"},
2408 { 100, "Abstract Syntax Error (Reject)"},
2409 { 101, "Abstract Syntax Error (Ignore and Notify)"},
2410 { 102, "Abstract Syntax Error (Falsely Constructed Message"},
2411 /* Miscellaneous Cause (113-->128) */
2412 { 113, "O & M Intervention"},
2413 { 114, "No Resource Available"},
2414 { 115, "Unspecified Failure"},
2415 { 116, "Network Optimisation"},
2416 /* Non-standard Cause (129-->255) */
2418 /* ranap_CauseRadioNetworkExtension ??
2419 { 257, "iP-multicast-address-and-APN-not-valid" },
2420 { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
2421 { 259, "mBMS-request-superseded" },
2422 { 260, "mBMS-de-registration-during-session-not-allowed" },
2423 { 261, "mBMS-no-data-bearer-necessary" },
2426 {0, NULL}
2428 static value_string_ext ranap_cause_type_ext = VALUE_STRING_EXT_INIT(ranap_cause_type);
2430 static const value_string mm_sec_modep[] = {
2431 {0, "Used cipher value, UMTS keys and Quintuplets"},
2432 {1, "GSM key and triplets"},
2433 {2, "UMTS key and quintuplets"},
2434 {3, "GSM key and quintuplets"},
2435 {0, NULL}
2438 static const value_string gtp_cipher_algorithm[] = {
2439 {0, "No ciphering"},
2440 {1, "GEA/1"},
2441 {2, "GEA/2"},
2442 {3, "GEA/3"},
2443 {4, "GEA/4"},
2444 {5, "GEA/5"},
2445 {6, "GEA/6"},
2446 {7, "GEA/7"},
2447 {0, NULL}
2449 static const value_string gtp_ext_rat_type_vals[] = {
2450 {0, "Reserved"},
2451 {1, "UTRAN"},
2452 {2, "GERAN"},
2453 {3, "WLAN"},
2454 {4, "GAN"},
2455 {5, "HSPA Evolution"},
2456 {6, "EUTRAN (WB-E-UTRAN)"},
2457 {7, "Virtual"},
2458 {8, "EUTRAN-NB-IoT"},
2459 {0, NULL}
2461 static const value_string chg_rep_act_type_vals[] = {
2462 {0, "Stop Reporting"},
2463 {1, "Start Reporting CGI/SAI"},
2464 {2, "Start Reporting RAI"},
2465 {0, NULL}
2469 static const value_string geographic_location_type[] = {
2470 {0, "Cell Global Identification (CGI)"},
2471 {1, "Service Area Identity (SAI)"},
2472 {2, "Routing Area Identification (RAI)"},
2473 /* reserved for future used (3-->127) */
2474 /* values below used by Radius */
2475 {128, "TAI"},
2476 {129, "ECGI"},
2477 {130, "TAI & ECGI"},
2478 {131, "eNodeB ID"},
2479 {132, "TAI and eNodeB ID"},
2480 {133, "extended eNodeB ID"},
2481 {134, "TAI and extended eNodeB ID"},
2482 {135, "NCGI"},
2483 {136, "5GS TAI"},
2484 {137, "5GS TAI and NCGI"},
2485 {138, "NG-RAN Node ID"},
2486 {139, "5GS TAI and NG-RAN Node ID"},
2487 /* reserved for future used (140-->255) */
2488 {0, NULL}
2491 static const value_string gtp_ext_hdr_pdu_ses_cont_pdu_type_vals[] = {
2492 {0, "DL PDU SESSION INFORMATION"},
2493 {1, "UL PDU SESSION INFORMATION"},
2494 {0, NULL}
2498 #define MM_PROTO_GROUP_CALL_CONTROL 0x00
2499 #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
2500 #define MM_PROTO_PDSS1 0x02
2501 #define MM_PROTO_CALL_CONTROL 0x03
2502 #define MM_PROTO_PDSS2 0x04
2503 #define MM_PROTO_MM_NON_GPRS 0x05
2504 #define MM_PROTO_RR_MGMT 0x06
2505 #define MM_PROTO_MM_GPRS 0x08
2506 #define MM_PROTO_SMS 0x09
2507 #define MM_PROTO_SESSION_MGMT 0x0A
2508 #define MM_PROTO_NON_CALL_RELATED 0x0B
2510 static GHashTable *gtpstat_msg_idx_hash;
2512 static void
2513 gtpstat_init(struct register_srt* srt _U_, GArray* srt_array)
2515 if (gtpstat_msg_idx_hash != NULL) {
2516 g_hash_table_destroy(gtpstat_msg_idx_hash);
2518 gtpstat_msg_idx_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
2520 init_srt_table("GTP Requests", NULL, srt_array, 0, NULL, NULL, NULL);
2523 static tap_packet_status
2524 gtpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv, tap_flags_t flags _U_)
2526 unsigned i = 0;
2527 srt_stat_table *gtp_srt_table;
2528 srt_data_t *data = (srt_data_t *)pss;
2529 const gtp_msg_hash_t *gtp=(const gtp_msg_hash_t *)prv;
2530 int idx = 0;
2532 /* we are only interested in reply packets */
2533 if(gtp->is_request){
2534 return TAP_PACKET_DONT_REDRAW;
2536 /* if we have not seen the request, just ignore it */
2537 if(!gtp->req_frame){
2538 return TAP_PACKET_DONT_REDRAW;
2541 /* Redoing the message indexing is bit redundant (and keeps us from
2542 * passing in the filter "gtp.message" in init_srt_table above),
2543 * but using message type as such would yield a long gtp_srt_table.
2546 gtp_srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
2548 idx = GPOINTER_TO_UINT(g_hash_table_lookup(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype)));
2550 /* Store the value incremented by 1 to avoid confusing index 0 with NULL */
2551 if (idx == 0) {
2552 idx = g_hash_table_size(gtpstat_msg_idx_hash);
2553 g_hash_table_insert(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype), GUINT_TO_POINTER(idx + 1));
2554 init_srt_table_row(gtp_srt_table, idx, val_to_str_ext_const(gtp->msgtype, &gtp_message_type_ext, "Unknown"));
2555 } else {
2556 idx -= 1;
2559 add_srt_table_data(gtp_srt_table, idx, &gtp->req_time, pinfo);
2561 return TAP_PACKET_REDRAW;
2565 static dissector_handle_t eth_handle;
2566 static dissector_handle_t ip_handle;
2567 static dissector_handle_t ipv6_handle;
2568 static dissector_handle_t ppp_handle;
2569 static dissector_handle_t sync_handle;
2570 static dissector_handle_t gtpcdr_handle;
2571 static dissector_handle_t sndcpxid_handle;
2572 static dissector_handle_t gtpv2_handle;
2573 static dissector_handle_t bssgp_handle;
2574 static dissector_handle_t pdcp_nr_handle;
2575 static dissector_handle_t pdcp_lte_handle;
2576 static dissector_handle_t gtp_tpdu_custom_handle;
2577 static dissector_table_t bssap_pdu_type_table;
2579 static int proto_pdcp_lte;
2581 uint32_t gtp_session_count;
2583 /* Relation between frame -> session */
2584 wmem_map_t* session_table;
2585 /* Relation between <teid,ip> -> frame */
2586 wmem_map_t* frame_map;
2588 typedef struct {
2589 uint32_t teid;
2590 address addr;
2591 } gtp_info_t;
2593 static unsigned
2594 gtp_info_hash(const void *key)
2596 const gtp_info_t *k = (const gtp_info_t *)key;
2598 /* The TEID is likely unique, so just use it. */
2599 return g_int_hash(&k->teid);
2602 static gboolean
2603 gtp_info_equal(const void *key1, const void *key2)
2605 const gtp_info_t *a = (const gtp_info_t *)key1;
2606 const gtp_info_t *b = (const gtp_info_t *)key2;
2608 return (a->teid == b->teid && (cmp_address(&a->addr, &b->addr) == 0));
2611 /* GTP Session funcs*/
2612 uint32_t
2613 get_frame(address ip, uint32_t teid, uint32_t *frame) {
2614 gtp_info_t info;
2615 uint32_t *value;
2617 info.teid = teid;
2618 copy_address_shallow(&info.addr, &ip);
2619 value = wmem_map_lookup(frame_map, &info);
2620 if (value != NULL) {
2621 *frame = GPOINTER_TO_UINT(value);
2622 return 1;
2624 return 0;
2627 static gboolean
2628 frame_equal(void *key _U_, void *value, void *data){
2629 uint32_t frame = GPOINTER_TO_UINT(data);
2631 return (GPOINTER_TO_UINT(value) == frame);
2634 void
2635 remove_frame_info(uint32_t f) {
2636 /* XXX: This iterates through the entire map and it is slow if done
2637 * often. For large files with lots of removals, there are better
2638 * alternatives, e.g. marking sessions as expired and then periodically
2639 * removing all expired sessions from the map, or using a bijective
2640 * map to coordinate removals.
2642 wmem_map_foreach_remove(frame_map, frame_equal, GUINT_TO_POINTER(f));
2645 void
2646 add_gtp_session(uint32_t frame, uint32_t session) {
2648 wmem_map_insert(session_table, GUINT_TO_POINTER(frame), GUINT_TO_POINTER(session));
2651 bool
2652 teid_exists(uint32_t teid, wmem_list_t *teid_list) {
2653 wmem_list_frame_t *elem;
2654 uint32_t *info;
2655 bool found;
2656 found = false;
2657 elem = wmem_list_head(teid_list);
2658 while (!found && elem) {
2659 info = (uint32_t*)wmem_list_frame_data(elem);
2660 found = *info == teid;
2661 elem = wmem_list_frame_next(elem);
2663 return found;
2666 bool
2667 ip_exists(address ip, wmem_list_t *ip_list) {
2668 wmem_list_frame_t *elem;
2669 address *info;
2670 bool found;
2671 found = false;
2672 elem = wmem_list_head(ip_list);
2673 while (!found && elem) {
2674 info = (address*)wmem_list_frame_data(elem);
2675 found = addresses_equal(info, &ip);
2676 elem = wmem_list_frame_next(elem);
2678 return found;
2682 /* wmem_map_foreach() callback used in fill_map() */
2683 static void
2684 remove_session_from_table(void *key, void *val, void *userdata) {
2685 unsigned fr = GPOINTER_TO_UINT(key);
2686 unsigned session = GPOINTER_TO_UINT(val);
2687 unsigned remove_session = GPOINTER_TO_UINT(userdata);
2689 /* If it's the session we are looking for, we remove all the frame information */
2690 if (session == remove_session) {
2691 remove_frame_info(fr);
2695 void
2696 fill_map(wmem_list_t *teid_list, wmem_list_t *ip_list, uint32_t frame) {
2697 wmem_list_frame_t *elem_ip, *elem_teid;
2698 gtp_info_t *gtp_info;
2699 uint32_t teid, session;
2700 address *ip;
2702 /* XXX: This adds all combinations of addresses and TEIDs. It
2703 * should only add matching pairs for a F-TEID, though this is
2704 * difficult to determine for GTPv1 (especially if the check_etsi
2705 * preference is off) unlike with GTPv2.
2706 * It also should not add anything that uses the reserved TEID
2707 * (0), such as happens in GTPv2 on S11/S4 interfaces for the
2708 * PGW S5/S8 TEID on initial attach, etc.
2710 elem_ip = wmem_list_head(ip_list);
2711 while (elem_ip) {
2712 ip = (address*)wmem_list_frame_data(elem_ip);
2713 /* We loop over the teid list */
2714 elem_teid = wmem_list_head(teid_list);
2715 while (elem_teid) {
2716 teid = *(uint32_t*)wmem_list_frame_data(elem_teid);
2717 gtp_info = wmem_new0(wmem_file_scope(), gtp_info_t);
2718 gtp_info->teid = teid;
2719 copy_address_wmem(wmem_file_scope(), &gtp_info->addr, ip);
2720 if (wmem_map_lookup(frame_map, gtp_info)) {
2721 /* If the teid and ip already maps to a session, that means
2722 * that we need to remove old info about that session */
2723 /* We look for its session ID */
2724 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame)));
2725 if (session) {
2726 /* If the msg has the same session ID and it's not the upd req we have to remove its info */
2727 wmem_map_foreach(session_table, remove_session_from_table, GUINT_TO_POINTER(session));
2730 wmem_map_insert(frame_map, gtp_info, GUINT_TO_POINTER(frame));
2731 elem_teid = wmem_list_frame_next(elem_teid);
2733 elem_ip = wmem_list_frame_next(elem_ip);
2737 bool
2738 is_cause_accepted(uint8_t cause, uint32_t version) {
2739 if (version == 1) {
2740 return cause == 128 || cause == 129 || cause == 130;
2742 else if (version == 2) {
2743 return cause == 16 || cause == 17 || cause == 18 || cause == 19;
2745 return false;
2748 static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2749 static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2750 static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2751 static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2752 static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2753 static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2754 static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2755 static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2756 static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2757 static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2758 static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2759 static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2760 static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2761 static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2762 static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2763 static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2764 static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2765 static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2766 static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2767 static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2768 static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2769 static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2770 static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2771 static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2772 static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2773 static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2774 static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2775 static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2776 static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2777 static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2778 static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2779 static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2780 static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2781 static int decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args, const char * tree_name, int hf_ipv4, int hf_ipv6);
2782 static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2783 static int decode_gtp_sgsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2784 static int decode_gtp_sgsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2785 static int decode_gtp_ggsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2786 static int decode_gtp_ggsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args);
2787 static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2788 static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2789 static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2790 static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2791 static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2792 static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2793 static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2794 static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2795 static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2796 static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2797 static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2799 static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2800 static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2801 static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2802 static int decode_gtp_sgsn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2803 static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2804 static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2805 static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2806 static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2807 static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2808 static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2809 static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2810 static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2811 static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2812 static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2813 static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2814 static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2815 static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2816 static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2817 static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2818 static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2819 static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2820 static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2821 static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2822 static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2823 static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2824 static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2825 static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2826 static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2827 static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2828 static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2829 static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2830 static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2831 static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2832 static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2833 static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2834 static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2835 static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2836 static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2837 static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2838 static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2839 static int decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2840 static int decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2841 static int decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2842 static int decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2843 static int decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2844 static int decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2845 static int decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2846 static int decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2847 static int decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2848 static int decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2849 static int decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2850 static int decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2851 static int decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2852 static int decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2853 static int decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2854 static int decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2855 static int decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2856 static int decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2857 static int decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2858 static int decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2859 static int decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2860 static int decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2861 static int decode_gtp_ext_enodeb_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2862 static int decode_gtp_ext_sel_mode_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2863 static int decode_gtp_ext_uli_timestamp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2864 static int decode_gtp_ext_lhn_id_w_sapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2865 static int decode_gtp_ext_cn_op_sel_entity(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2866 static int decode_gtp_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2867 static int decode_gtp_extended_common_flgs_II(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2868 static int decode_gtp_ext_node_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2869 static int decode_gtp_ciot_opt_sup_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2870 static int decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2871 static int decode_gtp_iov_updates_counter(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2872 static int decode_gtp_mapped_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2873 static int decode_gtp_up_fun_sel_ind_flags(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2875 static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2876 static int decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2877 static int decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2878 static int decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2879 static int decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2880 static int decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_);
2882 static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2883 static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2884 static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2885 static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2886 static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2887 static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2888 static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2889 static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_);
2891 typedef struct {
2892 int optcode;
2893 int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *, session_args_t *);
2894 } gtp_opt_t;
2896 static const gtp_opt_t gtpopt[] = {
2897 /* 0x01 */ {GTP_EXT_CAUSE, decode_gtp_cause},
2898 /* 0x02 */ {GTP_EXT_IMSI, decode_gtp_imsi},
2899 /* 0x03 */ {GTP_EXT_RAI, decode_gtp_rai},
2900 /* 0x04 */ {GTP_EXT_TLLI, decode_gtp_tlli},
2901 /* 0x05 */ {GTP_EXT_PTMSI, decode_gtp_ptmsi},
2902 /* 0x06 */ {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
2903 /* 0x07 */
2904 /* 0x08 */ {GTP_EXT_REORDER, decode_gtp_reorder},
2905 /* 0x09 */ {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
2906 /* 0x0a */
2907 /* 0x0b */ {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
2908 /* 0x0c */ {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
2909 /* 0x0d */ {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
2910 /* 0x0e */ {GTP_EXT_RECOVER, decode_gtp_recovery},
2911 /* 0x0f */ {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
2912 /* 0x10 */ {GTP_EXT_16, decode_gtp_16},
2913 /* 0x11 */ {GTP_EXT_17, decode_gtp_17},
2914 /* 0x12 */ {GTP_EXT_18, decode_gtp_18},
2915 /* 0x13 */ {GTP_EXT_19, decode_gtp_19},
2916 /* 0x14 */ {GTP_EXT_NSAPI, decode_gtp_nsapi},
2917 /* 0x15 */ {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
2918 /* 0x16 */ {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
2919 /* 0x17 */ {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
2920 /* 0x18 */ {GTP_EXT_RP, decode_gtp_rp},
2921 /* 0x19 */ {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
2922 /* 0x1a */ {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
2923 /* 0x1b */ {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
2924 /* 0x1c */ {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
2925 /* 0x1d */ {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
2927 /* 0x7e */ {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
2928 /* 0x7f */ {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
2929 /* 0x80 */ {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
2930 /* 0x81 */ {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
2931 /* 0x82 */ {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
2932 /* 0x83 */ {GTP_EXT_APN, decode_gtp_apn},
2933 /* 0x84 */ {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
2934 /* 0x85 */ {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
2935 /* 0x86 */ {GTP_EXT_MSISDN, decode_gtp_msisdn},
2936 /* 0x87 */ {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts}, /* 3G */
2937 /* 0x88 */ {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui}, /* 3G */
2938 /* 0x89 */ {GTP_EXT_TFT, decode_gtp_tft}, /* 3G */
2939 /* 0x8a */ {GTP_EXT_TARGET_ID, decode_gtp_target_id}, /* 3G */
2940 /* 0x8b */ {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont}, /* 3G */
2941 /* 0x8c */ {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup}, /* 3G */
2942 /* 0x8d */ {GTP_EXT_HDR_LIST, decode_gtp_hdr_list}, /* 3G */
2943 /* 0x8e */ {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id}, /* 3G */
2944 /* 0x8f */ {GTP_EXT_OMC_ID, decode_gtp_omc_id}, /* 3G */
2945 /* TS 29 060 V6.11.0 */
2946 /* 0x90 */ {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont}, /* 7.7.43 */
2947 /* 0x91 */ {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio}, /* 7.7.45 */
2948 /* 0x92 */ {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf}, /* 7.7.45A */
2949 /* 0x93 */ {GTP_EXT_SGSN_NO, decode_gtp_sgsn_no}, /* 7.7.47 */
2950 /* 0x94 */ {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs}, /* 7.7.48 */
2951 /* 0x95 */ {GTP_EXT_APN_RES, decode_gtp_apn_res}, /* 3G */
2952 /* 0x96 */ {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs}, /* 7.7.25B */
2953 /* 0x97 */ {GTP_EXT_RAT_TYPE, decode_gtp_rat_type}, /* 3G */
2954 /* 0x98 */ {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf}, /* 7.7.51 */
2955 /* 0x99 */ {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone}, /* 7.7.52 */
2956 /* 0x9a */ {GTP_EXT_IMEISV, decode_gtp_imeisv}, /* 3G 7.7.53 */
2957 /* 0x9b */ {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con}, /* 7.7.54 */
2958 /* 0x9c */ {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx}, /* 7.7.55 */
2959 /* 0x9d */ {GTP_EXT_TMGI, decode_gtp_tmgi}, /* 7.7.56 */
2960 /* 0x9e */ {GTP_EXT_RIM_RA, decode_gtp_rim_ra}, /* 7.7.57 */
2961 /* 0x9f */ {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt}, /* 7.7.58 */
2962 /* 0xa0 */ {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa}, /* 7.7.60 */
2963 /* 0xa1 */ {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf}, /* 7.7.61 */
2964 /* 0xa2 */ {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf}, /* 7.7.62 */
2965 /* 0xa3 */ {GTP_EXT_HOP_COUNT, decode_gtp_hop_count}, /* 7.7.63 */
2966 /* 0xa4 */ {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id}, /* 7.7.64 */
2967 /* 0xa5 */ {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id}, /* 7.7.65 */
2968 /* 0xa6 */ {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind}, /* 7.7.66 */
2969 /* 0xa7 */ {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi}, /* 7.7.67 */
2970 /* 0xa8 */ {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur}, /* 7.7.59 */
2971 /* 0xa9 */ {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf}, /* 7.7.68 */
2972 /* 0xaa */ {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no}, /* 7.7.69 */
2973 /* 0xab */ {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr}, /* 7.7.70 */
2974 /* 0xac */ {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx}, /* 7.7.71 */
2975 /* 0xad */ {GTP_EXT_BSS_CONT, decode_gtp_bss_cont}, /* 7.7.72 */
2976 /* 0xae */ {GTP_EXT_CELL_ID, decode_gtp_cell_id}, /* 7.7.73 */
2977 /* 0xaf */ {GTP_EXT_PDU_NO, decode_gtp_pdu_no}, /* 7.7.74 */
2978 /* 0xb0 */ {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause}, /* 7.7.75 */
2979 /* 0xb1 */ {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap}, /* 7.7.76 */
2980 /* 0xb2 */ {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc}, /* 7.7.77 */
2981 /* 0xb3 */ {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc}, /* 7.7.78 */
2982 /* 0xb4 */ {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid}, /* 7.7.79 */
2983 /* 0xb5 */ {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act}, /* 7.7.80 */
2984 /* 0xb6 */ {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg}, /* 7.7.81 */
2985 /* 0xb7 */ {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id}, /* 7.7.82 */
2986 /* 0xb8 */ {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod}, /* 7.7.83 */
2987 /* 0xb9 */ {GTP_EXT_MBMS_FLOW_ID, decode_gtp_mbms_flow_id}, /* 7.7.84 */
2988 /* 0xba */ {GTP_EXT_MBMS_IP_MCAST_DIST, decode_gtp_mbms_ip_mcast_dist}, /* 7.7.85 */
2989 /* 0xba */ {GTP_EXT_MBMS_DIST_ACK, decode_gtp_mbms_dist_ack}, /* 7.7.86 */
2990 /* 0xbc */ {GTP_EXT_RELIABLE_IRAT_HO_INF, decode_gtp_reliable_irat_ho_inf}, /* 7.7.87 */
2991 /* 0xbd */ {GTP_EXT_RFSP_INDEX, decode_gtp_rfsp_index}, /* 7.7.88 */
2993 /* 0xbe */ {GTP_EXT_FQDN, decode_gtp_fqdn}, /* 7.7.90 */
2994 /* 0xbf */ {GTP_EXT_EVO_ALLO_RETE_P1, decode_gtp_evolved_allc_rtn_p1}, /* 7.7.91 */
2995 /* 0xc0 */ {GTP_EXT_EVO_ALLO_RETE_P2, decode_gtp_evolved_allc_rtn_p2}, /* 7.7.92 */
2996 /* 0xc1 */ {GTP_EXT_EXTENDED_COMMON_FLGS, decode_gtp_extended_common_flgs}, /* 7.7.93 */
2997 /* 0xc2 */ {GTP_EXT_UCI, decode_gtp_uci}, /* 7.7.94 */
2998 /* 0xc3 */ {GTP_EXT_CSG_INF_REP_ACT, decode_gtp_csg_inf_rep_act}, /* 7.7.95 */
2999 /* 0xc4 */ {GTP_EXT_CSG_ID, decode_gtp_csg_id}, /* 7.7.96 */
3000 /* 0xc5 */ {GTP_EXT_CMI, decode_gtp_cmi}, /* 7.7.97 */
3001 /* 0xc6 */ {GTP_EXT_AMBR, decode_gtp_apn_ambr}, /* 7.7.98 */
3002 /* 0xc7 */ {GTP_EXT_UE_NETWORK_CAP, decode_gtp_ue_network_cap}, /* 7.7.99 */
3003 /* 0xc8 */ {GTP_EXT_UE_AMBR, decode_gtp_ue_ambr}, /* 7.7.100 */
3004 /* 0xc9 */ {GTP_EXT_APN_AMBR_WITH_NSAPI, decode_gtp_apn_ambr_with_nsapi}, /* 7.7.101 */
3005 /* 0xCA */ {GTP_EXT_GGSN_BACK_OFF_TIME, decode_gtp_ggsn_back_off_time}, /* 7.7.102 */
3006 /* 0xCB */ {GTP_EXT_SIG_PRI_IND, decode_gtp_sig_pri_ind}, /* 7.7.103 */
3007 /* 0xCC */ {GTP_EXT_SIG_PRI_IND_W_NSAPI, decode_gtp_sig_pri_ind_w_nsapi}, /* 7.7.104 */
3008 /* 0xCD */ {GTP_EXT_HIGHER_BR_16MB_FLG, decode_gtp_higher_br_16mb_flg}, /* 7.7.105 */
3009 /* 0xCE */ {GTP_EXT_MAX_MBR_APN_AMBR, decode_gtp_max_mbr_apn_ambr}, /* 7.7.106 */
3010 /* 0xCF */ {GTP_EXT_ADD_MM_CTX_SRVCC, decode_gtp_add_mm_ctx_srvcc}, /* 7.7.107 */
3011 /* 0xD0 */ {GTP_EXT_ADD_FLGS_SRVCC, decode_gtp_add_flgs_srvcc}, /* 7.7.108 */
3012 /* 0xD1 */ {GTP_EXT_STN_SR, decode_gtp_stn_sr}, /* 7.7.109 */
3013 /* 0xD2 */ {GTP_EXT_C_MSISDN, decode_gtp_c_msisdn}, /* 7.7.110 */
3014 /* 0xD3 */ {GTP_EXT_EXT_RANAP_CAUSE, decode_gtp_ext_ranap_cause}, /* 7.7.111 */
3015 /* 0xD4 */ {GTP_EXT_ENODEB_ID, decode_gtp_ext_enodeb_id }, /* 7.7.112 */
3016 /* 0xD5 */ {GTP_EXT_SEL_MODE_W_NSAPI, decode_gtp_ext_sel_mode_w_nsapi }, /* 7.7.113 */
3017 /* 0xD6 */ {GTP_EXT_ULI_TIMESTAMP, decode_gtp_ext_uli_timestamp }, /* 7.7.114 */
3018 /* 0xD7 */ {GTP_EXT_LHN_ID_W_SAPI, decode_gtp_ext_lhn_id_w_sapi }, /* 7.7.115 */
3019 /* 0xD8 */ {GTP_EXT_CN_OP_SEL_ENTITY, decode_gtp_ext_cn_op_sel_entity }, /* 7.7.116 */
3020 /* 0xD9 */ {GTP_EXT_UE_USAGE_TYPE, decode_gtp_ue_usage_type }, /* 7.7.117 */
3021 /* 0xDA */ {GTP_EXT_EXT_COMMON_FLGS_II, decode_gtp_extended_common_flgs_II }, /* 7.7.118 */
3022 /* 0xDB */ {GTP_EXT_NODE_IDENTIFIER, decode_gtp_ext_node_id }, /* 7.7.119 */
3023 /* 0xDC */ {GTP_EXT_CIOT_OPT_SUP_IND, decode_gtp_ciot_opt_sup_ind }, /* 7.7.120 */
3024 /* 0xDD */ {GTP_EXT_SCEF_PDN_CONNECTION, decode_gtp_scef_pdn_conn }, /* 7.7.121 */
3025 /* 0xDE */ {GTP_EXT_IOV_UPDATES_COUNTER, decode_gtp_iov_updates_counter }, /* 7.7.122 */
3026 /* 0xDF */ {GTP_EXT_MAPPED_UE_USAGE_TYPE, decode_gtp_mapped_ue_usage_type }, /* 7.7.123 */
3027 /* 0xE0 */ {GTP_EXT_UP_FUN_SEL_IND_FLAGS, decode_gtp_up_fun_sel_ind_flags }, /* 7.7.124 */
3029 /* 0xf9 */ {GTP_EXT_REL_PACK, decode_gtp_rel_pack }, /* charging */
3030 /* 0xfa */ {GTP_EXT_CAN_PACK, decode_gtp_can_pack}, /* charging */
3031 /* 0xfb */ {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
3033 /* 0xfc */ {GTP_EXT_DATA_REQ, decode_gtp_data_req}, /* charging */
3034 /* 0xfd */ {GTP_EXT_DATA_RESP, decode_gtp_data_resp}, /* charging */
3035 /* 0xfe */ {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
3036 /* 0xff */ {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
3037 {0, decode_gtp_unknown}
3040 #define NUM_GTP_IES 255
3041 static int ett_gtp_ies[NUM_GTP_IES];
3043 static uint8_t gtp_version;
3045 #define BCD2CHAR(d) ((d) | 0x30)
3047 static char *
3048 id_to_str(tvbuff_t *tvb, int offset)
3050 static char str[17] = " ";
3051 uint8_t bits8to5, bits4to1;
3052 int i, j;
3053 uint8_t ad;
3055 for (i = j = 0; i < 8; i++) {
3056 ad = tvb_get_uint8(tvb, offset + i);
3057 bits8to5 = hi_nibble(ad);
3058 bits4to1 = lo_nibble(ad);
3059 if (bits4to1 <= 9)
3060 str[j++] = BCD2CHAR(bits4to1);
3061 else
3062 str[j++] = ' ';
3063 if (bits8to5 <= 9)
3064 str[j++] = BCD2CHAR(bits8to5);
3065 else
3066 str[j++] = ' ';
3068 str[j] = '\0';
3069 return str;
3073 /* Next definitions and function check_field_presence_and_decoder checks if given field
3074 * in GTP packet is compliant with ETSI
3076 typedef int (ie_decoder) (tvbuff_t *, int, packet_info *, proto_tree *, session_args_t *);
3078 typedef struct {
3079 uint8_t code;
3080 uint8_t presence;
3081 ie_decoder *alt_decoder;
3082 } ext_header;
3084 typedef struct {
3085 uint8_t code;
3086 ext_header fields[46];
3087 } _gtp_mess_items;
3089 /* ---------------------
3090 * GPRS messages
3091 * ---------------------*/
3092 static const _gtp_mess_items gprs_mess_items[] = {
3095 GTP_MSG_ECHO_REQ, {
3096 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3097 {0, 0, NULL}
3101 GTP_MSG_ECHO_RESP, {
3102 {GTP_EXT_RECOVER, GTP_MANDATORY, NULL},
3103 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3104 {0, 0, NULL}
3108 GTP_MSG_VER_NOT_SUPP, {
3109 {0, 0, NULL}
3113 GTP_MSG_NODE_ALIVE_REQ, {
3114 {GTP_EXT_NODE_ADDR, GTP_MANDATORY, NULL},
3115 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3116 {0, 0, NULL}
3120 GTP_MSG_NODE_ALIVE_RESP, {
3121 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3122 {0, 0, NULL}
3126 GTP_MSG_REDIR_REQ, {
3127 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3128 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL, NULL},
3129 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3130 {0, 0, NULL}
3134 GTP_MSG_REDIR_RESP, {
3135 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3136 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3137 {0, 0, NULL}
3141 GTP_MSG_CREATE_PDP_REQ, {
3142 {GTP_EXT_QOS_GPRS, GTP_MANDATORY, NULL},
3143 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3144 {GTP_EXT_SEL_MODE, GTP_MANDATORY, NULL},
3145 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY, NULL},
3146 {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3147 {GTP_EXT_MSISDN, GTP_MANDATORY, NULL},
3148 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3149 {GTP_EXT_APN, GTP_MANDATORY, NULL},
3150 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3151 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3152 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3153 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3154 {0, 0, NULL}
3158 GTP_MSG_CREATE_PDP_RESP, {
3159 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3160 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL, NULL},
3161 {GTP_EXT_REORDER, GTP_CONDITIONAL, NULL},
3162 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3163 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL, NULL},
3164 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3165 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3166 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3167 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3168 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3169 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3170 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3171 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3172 {0, 0, NULL}
3176 GTP_MSG_UPDATE_PDP_REQ, {
3177 {GTP_EXT_QOS_GPRS, GTP_MANDATORY, NULL},
3178 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3179 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY, NULL},
3180 {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3181 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3182 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3183 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3184 {0, 0, NULL},
3188 GTP_MSG_UPDATE_PDP_RESP, {
3189 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3190 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL, NULL},
3191 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3192 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL, NULL},
3193 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3194 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3195 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3196 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3197 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3198 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3199 {0, 0, NULL}
3203 GTP_MSG_DELETE_PDP_REQ, {
3204 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3205 {0, 0, NULL}
3209 GTP_MSG_DELETE_PDP_RESP, {
3210 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3211 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3212 {0, 0, NULL},
3216 GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, {
3217 {GTP_EXT_QOS_GPRS, GTP_MANDATORY, NULL},
3218 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3219 {GTP_EXT_SEL_MODE, GTP_MANDATORY, NULL},
3220 {GTP_EXT_FLOW_LABEL, GTP_MANDATORY, NULL},
3221 {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3222 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3223 {GTP_EXT_APN, GTP_MANDATORY, NULL},
3224 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3225 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3226 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3227 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3228 {0, 0, NULL}
3232 GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, {
3233 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3234 {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL, NULL},
3235 {GTP_EXT_REORDER, GTP_CONDITIONAL, NULL},
3236 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3237 {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL, NULL},
3238 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3239 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3240 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3241 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3242 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3243 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3244 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3245 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3246 {0, 0, NULL}
3250 GTP_MSG_DELETE_AA_PDP_REQ, {
3251 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3252 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3253 {0, 0, NULL}
3257 GTP_MSG_DELETE_AA_PDP_RESP, {
3258 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3259 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3260 {0, 0, NULL}
3264 GTP_MSG_ERR_IND, {
3265 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3266 {0, 0, NULL}
3270 GTP_MSG_PDU_NOTIFY_REQ, {
3271 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3272 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3273 {0, 0, NULL}
3277 GTP_MSG_PDU_NOTIFY_RESP, {
3278 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3279 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3280 {0, 0, NULL}
3284 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
3285 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3286 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3287 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3288 {0, 0, NULL}
3292 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
3293 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3294 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3295 {0, 0, NULL}
3299 GTP_MSG_SEND_ROUT_INFO_REQ, {
3300 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3301 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3302 {0, 0, NULL}
3306 GTP_MSG_SEND_ROUT_INFO_RESP, {
3307 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3308 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3309 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3310 {GTP_EXT_MS_REASON, GTP_OPTIONAL, NULL},
3311 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},
3312 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3313 {0, 0, NULL}
3317 GTP_MSG_FAIL_REP_REQ, {
3318 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3319 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3320 {0, 0, NULL}
3324 GTP_MSG_FAIL_REP_RESP, {
3325 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3326 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3327 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3328 {0, 0, NULL}
3332 GTP_MSG_MS_PRESENT_REQ, {
3333 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3334 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3335 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3336 {0, 0, NULL}
3340 GTP_MSG_MS_PRESENT_RESP, {
3341 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3342 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3343 {0, 0, NULL}
3347 GTP_MSG_IDENT_REQ, {
3348 {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3349 {GTP_EXT_PTMSI, GTP_MANDATORY, NULL},
3350 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL, NULL},
3351 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3352 {0, 0, NULL}
3356 GTP_MSG_IDENT_RESP, {
3357 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3358 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3359 {GTP_EXT_AUTH_TRI, GTP_OPTIONAL, NULL},
3360 {GTP_EXT_AUTH_QUI, GTP_OPTIONAL, NULL},
3361 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3362 {0, 0, NULL}
3366 GTP_MSG_SGSN_CNTXT_REQ, {
3367 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3368 {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3369 {GTP_EXT_TLLI, GTP_MANDATORY, NULL},
3370 {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL, NULL},
3371 {GTP_EXT_MS_VALID, GTP_OPTIONAL, NULL},
3372 {GTP_EXT_FLOW_SIG, GTP_MANDATORY, NULL},
3373 {0, 0, NULL}
3377 GTP_MSG_SGSN_CNTXT_RESP, {
3378 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3379 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3380 {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL, NULL},
3381 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL, NULL},
3382 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL, NULL},
3383 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3384 {0, 0, NULL}
3388 GTP_MSG_SGSN_CNTXT_ACK, {
3389 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3390 {GTP_EXT_FLOW_II, GTP_CONDITIONAL, NULL},
3391 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL},
3392 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3393 {0, 0, NULL}
3397 GTP_MSG_DATA_TRANSF_REQ, {
3398 {GTP_EXT_TR_COMM, GTP_MANDATORY, NULL},
3399 {GTP_EXT_DATA_REQ, GTP_CONDITIONAL, NULL},
3400 {GTP_EXT_REL_PACK, GTP_CONDITIONAL, NULL},
3401 {GTP_EXT_CAN_PACK, GTP_CONDITIONAL, NULL},
3402 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3403 {0, 0, NULL}
3407 GTP_MSG_DATA_TRANSF_RESP, {
3408 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3409 {GTP_EXT_DATA_RESP, GTP_MANDATORY, NULL},
3410 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3411 {0, 0, NULL}
3415 0, {
3416 {0, 0, NULL}
3421 /* -----------------------------
3422 * UMTS messages
3423 * -----------------------------*/
3424 static const _gtp_mess_items umts_mess_items[] = {
3425 /* 7.2 Path Management Messages */
3427 GTP_MSG_ECHO_REQ, {
3428 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3429 {0, 0, NULL}
3433 GTP_MSG_ECHO_RESP, {
3434 {GTP_EXT_RECOVER, GTP_MANDATORY, NULL},
3435 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3436 {0, 0, NULL}
3440 GTP_MSG_VER_NOT_SUPP, {
3441 {0, 0, NULL}
3445 GTP_MSG_SUPP_EXT_HDR, {
3446 {GTP_EXT_HDR_LIST, GTP_MANDATORY, NULL},
3447 {0, 0, NULL}
3450 /* ??? */
3452 GTP_MSG_NODE_ALIVE_REQ, {
3453 {GTP_EXT_NODE_ADDR, GTP_MANDATORY, NULL},
3454 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3455 {0, 0, NULL}
3459 GTP_MSG_NODE_ALIVE_RESP, {
3460 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3461 {0, 0, NULL}
3465 GTP_MSG_REDIR_REQ, {
3466 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3467 {GTP_EXT_NODE_ADDR, GTP_OPTIONAL, NULL},
3468 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3469 {0, 0, NULL}
3473 GTP_MSG_REDIR_REQ, {
3474 {0, 0, NULL}
3477 /* 7.3 Tunnel Management Messages */
3479 GTP_MSG_CREATE_PDP_REQ, {
3480 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3481 /* RAI is in TS 29.060 V6.11.0 */
3482 {GTP_EXT_RAI, GTP_OPTIONAL, NULL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
3483 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3484 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL, NULL},
3485 {GTP_EXT_TEID, GTP_MANDATORY, NULL},
3486 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3487 {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},
3488 {GTP_EXT_NSAPI, GTP_CONDITIONAL, NULL}, /* Linked NSAPI Conditional */
3489 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL, NULL},
3490 {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL},
3491 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL},
3492 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3493 {GTP_EXT_APN, GTP_CONDITIONAL, NULL},
3494 {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL, NULL},
3495 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},
3496 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_user_plane},
3497 {GTP_EXT_MSISDN, GTP_CONDITIONAL, NULL},
3498 {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL},
3499 {GTP_EXT_TFT, GTP_CONDITIONAL, NULL},
3500 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL},
3501 {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL},
3502 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Optional 7.7.48 */
3503 {GTP_EXT_APN_RES, GTP_OPTIONAL, NULL},
3504 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL},
3505 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL},
3506 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL},
3507 {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL},
3508 {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL, NULL},
3509 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL},
3510 /* Updated to TS 29.060 V16.0.0 */
3511 {GTP_EXT_CORRELATION_ID, GTP_OPTIONAL, NULL}, /* 7.7.82 */
3512 {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3513 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3514 {GTP_EXT_UCI, GTP_OPTIONAL, NULL}, /* 7.7.94 */
3515 {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3516 {GTP_EXT_SIG_PRI_IND, GTP_OPTIONAL, NULL}, /* 7.7.103 */
3517 {GTP_EXT_CN_OP_SEL_ENTITY, GTP_OPTIONAL, NULL}, /* 7.7.116 */
3518 {GTP_EXT_MAPPED_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.123 */
3519 {GTP_EXT_UP_FUN_SEL_IND_FLAGS, GTP_OPTIONAL, NULL}, /* 7.7.124 */
3520 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3521 {0, 0, NULL}
3525 GTP_MSG_CREATE_PDP_RESP, {
3526 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3527 {GTP_EXT_REORDER, GTP_CONDITIONAL, NULL},
3528 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3529 {GTP_EXT_TEID, GTP_CONDITIONAL, NULL},
3530 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3531 {GTP_EXT_NSAPI, GTP_CONDITIONAL, NULL},
3532 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3533 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL},
3534 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL},
3535 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_control_plane},
3536 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_user_plane},
3537 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Addresses for Control Plane 7.7.32 */
3538 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Address for user traffic 7.7.32 */
3539 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL, NULL},
3540 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3541 /* TS 29.060 V6.11.0 */
3542 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
3543 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Optional 7.7.48 */
3544 {GTP_EXT_APN_RES, GTP_OPTIONAL, NULL}, /* APN Restriction Optional 7.7.49 */
3545 {GTP_EXT_MS_INF_CHG_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.80 */
3546 {GTP_EXT_BEARER_CONTROL_MODE, GTP_OPTIONAL, NULL}, /* 7.7.83 */
3547 {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3548 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3549 {GTP_EXT_CSG_INF_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.95 */
3550 {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3551 {GTP_EXT_GGSN_BACK_OFF_TIME, GTP_OPTIONAL, NULL}, /* 7.7.102 */
3552 {GTP_EXT_EXT_COMMON_FLGS_II, GTP_OPTIONAL, NULL}, /* 7.7.118 */
3553 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3554 {0, 0, NULL}
3557 { /* checked, SGSN -> GGSN */
3558 GTP_MSG_UPDATE_PDP_REQ, {
3559 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3560 {GTP_EXT_RAI, GTP_OPTIONAL, NULL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
3561 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3562 {GTP_EXT_TEID, GTP_MANDATORY, NULL},
3563 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3564 {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},
3565 {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL},
3566 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL},
3567 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3568 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
3569 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_user_plane}, /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
3570 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
3571 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
3572 {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL},
3573 {GTP_EXT_TFT, GTP_OPTIONAL, NULL},
3574 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL},
3575 {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL},
3576 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Optional 7.7.48 */
3577 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL}, /* RAT Type Optional 7.7.50 */
3578 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL}, /* User Location Information Optional 7.7.51 */
3579 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL}, /* MS Time Zone Optional 7.7.52 */
3580 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL}, /* Additional Trace Info Optional 7.7.62 */
3581 {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL, NULL}, /* Direct Tunnel Flags 7.7.81 */
3582 {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3583 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3584 {GTP_EXT_UCI, GTP_OPTIONAL, NULL}, /* 7.7.94 */
3585 {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3586 {GTP_EXT_SIG_PRI_IND, GTP_OPTIONAL, NULL}, /* 7.7.103 */
3587 {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3588 {GTP_EXT_IMEISV, GTP_OPTIONAL, NULL}, /* 7.7.53 */
3589 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3590 {0, 0, NULL}
3593 { /* checked, GGSN -> SGSN */
3594 GTP_MSG_UPDATE_PDP_RESP, {
3595 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3596 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL},
3597 {GTP_EXT_TEID, GTP_CONDITIONAL, NULL},
3598 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3599 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL},
3600 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3601 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_control_plane},
3602 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_ggsn_addr_for_user_plane},
3603 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
3604 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Address for User Traffic Conditional GSN Address 7.7.32 */
3605 {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL, NULL},
3606 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL},
3607 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
3608 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Optional 7.7.48 */
3609 {GTP_EXT_APN_RES, GTP_OPTIONAL, NULL}, /* APN Restriction Optional 7.7.49 */
3610 {GTP_EXT_BEARER_CONTROL_MODE, GTP_OPTIONAL, NULL}, /* 7.7.83 */
3611 {GTP_EXT_MS_INF_CHG_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.80 */
3612 {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3613 {GTP_EXT_CSG_INF_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.95 */
3614 {GTP_EXT_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.98 */
3615 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3616 {0, 0, NULL}
3620 GTP_MSG_DELETE_PDP_REQ, {
3621 {GTP_EXT_CAUSE, GTP_OPTIONAL, NULL},
3622 {GTP_EXT_TEAR_IND, GTP_CONDITIONAL, NULL},
3623 {GTP_EXT_NSAPI, GTP_MANDATORY, NULL},
3624 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3625 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL}, /* User Location Information Optional 7.7.51 */
3626 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL}, /* MS Time Zone Optional 7.7.52 */
3627 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3628 {GTP_EXT_ULI_TIMESTAMP, GTP_OPTIONAL, NULL}, /* 7.7.114 */
3629 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3630 {0, 0, NULL}
3634 GTP_MSG_DELETE_PDP_RESP, {
3635 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3636 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3637 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL}, /* User Location Information Optional 7.7.51 */
3638 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL}, /* MS Time Zone Optional 7.7.52 */
3639 {GTP_EXT_ULI_TIMESTAMP, GTP_OPTIONAL, NULL}, /* 7.7.114 */
3640 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3641 {0, 0, NULL}
3645 GTP_MSG_ERR_IND, {
3646 {GTP_EXT_TEID, GTP_MANDATORY, NULL},
3647 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_ggsn_addr_for_control_plane}, /* GSN Address Mandatory 7.7.32 */
3648 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3649 {0, 0, NULL}
3653 GTP_MSG_PDU_NOTIFY_REQ, {
3654 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3655 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3656 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3657 {GTP_EXT_APN, GTP_MANDATORY, NULL},
3658 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3659 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_ggsn_addr_for_control_plane},
3660 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3661 {0, 0, NULL}
3665 GTP_MSG_PDU_NOTIFY_RESP, {
3666 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3667 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3668 {0, 0, NULL}
3672 GTP_MSG_PDU_NOTIFY_REJ_REQ, {
3673 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3674 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3675 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL},
3676 {GTP_EXT_APN, GTP_MANDATORY, NULL},
3677 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3678 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3679 {0, 0, NULL}
3683 GTP_MSG_PDU_NOTIFY_REJ_RESP, {
3684 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3685 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3686 {0, 0, NULL}
3690 GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, {
3691 {GTP_EXT_NSAPI, GTP_MANDATORY, NULL}, /* NSAPI Mandatory 7.7.17 */
3692 {GTP_EXT_PROTO_CONF, GTP_OPTIONAL, NULL}, /* Protocol Configuration Options Optional 7.7.31 */
3693 {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL}, /* Quality of Service Profile Mandatory 7.7.34 */
3694 {GTP_EXT_TFT, GTP_CONDITIONAL, NULL}, /* TFT Conditional 7.7.36 */
3695 {GTP_EXT_CORRELATION_ID, GTP_MANDATORY, NULL}, /* 7.7.82 */
3696 {GTP_EXT_EVO_ALLO_RETE_P1, GTP_OPTIONAL, NULL}, /* 7.7.91 */
3697 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3701 GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, {
3702 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3703 {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL, NULL}, /* Protocol Configuration Options Conditional 7.7.31 */
3704 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3707 /* 7.4 Location Management Messages */
3709 GTP_MSG_SEND_ROUT_INFO_REQ, {
3710 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3711 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3712 {0, 0, NULL}
3716 GTP_MSG_SEND_ROUT_INFO_RESP, {
3717 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3718 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3719 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3720 {GTPv1_EXT_MS_REASON, GTP_OPTIONAL, NULL},
3721 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL},
3722 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3723 {0, 0, NULL}
3727 GTP_MSG_FAIL_REP_REQ, {
3728 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3729 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3730 {0, 0, NULL}
3734 GTP_MSG_FAIL_REP_RESP, {
3735 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3736 {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL, NULL},
3737 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3738 {0, 0, NULL}
3742 GTP_MSG_MS_PRESENT_REQ, {
3743 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3744 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, NULL},
3745 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3746 {0, 0, NULL}
3750 GTP_MSG_MS_PRESENT_RESP, {
3751 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3752 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3753 {0, 0, NULL}
3756 /* 7.5 Mobility Management Messages */
3758 GTP_MSG_IDENT_REQ, {
3759 {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3760 {GTP_EXT_PTMSI, GTP_MANDATORY, NULL},
3761 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL, NULL},
3762 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, decode_gtp_sgsn_addr_for_control_plane}, /* SGSN Address for Control Plane Optional 7.7.32 */
3763 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL, NULL}, /* Hop Counter Optional 7.7.63 */
3764 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3765 {0, 0, NULL}
3769 GTP_MSG_IDENT_RESP, {
3770 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3771 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3772 {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL, NULL},
3773 {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL, NULL},
3774 {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3775 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3776 {0, 0, NULL}
3780 GTP_MSG_SGSN_CNTXT_REQ, {
3781 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3782 {GTP_EXT_RAI, GTP_MANDATORY, NULL},
3783 {GTP_EXT_TLLI, GTP_CONDITIONAL, NULL},
3784 {GTP_EXT_PTMSI, GTP_CONDITIONAL, NULL},
3785 {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL, NULL},
3786 {GTP_EXT_MS_VALID, GTP_OPTIONAL, NULL},
3787 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3788 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},
3789 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, decode_gtp_sgsn_addr_for_control_plane}, /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
3790 {GTP_EXT_SGSN_NO, GTP_OPTIONAL, NULL}, /* SGSN Number Optional 7.7.47 */
3791 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL}, /* RAT Type Optional 7.7.50 */
3792 {GTP_EXT_HOP_COUNT, GTP_OPTIONAL, NULL}, /* Hop Counter Optional 7.7.63 */
3793 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3794 {0, 0, NULL}
3798 GTP_MSG_SGSN_CNTXT_RESP, {
3799 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3800 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL},
3801 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3802 {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL, NULL}, /* RAB Context Conditional 7.7.19 */
3803 {GTP_EXT_RP_SMS, GTP_OPTIONAL, NULL},
3804 {GTP_EXT_RP, GTP_OPTIONAL, NULL},
3805 {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL, NULL},
3806 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL, NULL}, /* CharingCharacteristics Optional 7.7.23 */
3807 {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL, NULL}, /* Radio Priority LCS Optional 7.7.25B */
3808 {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL, NULL},
3809 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL, NULL},
3810 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_sgsn_addr_for_control_plane},
3811 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL, NULL}, /* PDP Context Prioritization Optional 7.7.45 */
3812 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL, NULL}, /* MBMS UE Context Optional 7.7.55 */
3813 {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* Subscribed RFSP Index 7.7.88 */
3814 {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* RFSP Index in use 7.7.88 */
3815 {GTP_EXT_FQDN, GTP_OPTIONAL, NULL}, /* Co-located GGSN-PGW FQDN 7.7.90 */
3816 {GTP_EXT_EVO_ALLO_RETE_P2, GTP_OPTIONAL, NULL}, /* 7.7.92 */
3817 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3818 {GTP_EXT_UE_NETWORK_CAP, GTP_OPTIONAL, NULL}, /* 7.7.99 */
3819 {GTP_EXT_UE_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.100 */
3820 {GTP_EXT_APN_AMBR_WITH_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.101 */
3821 {GTP_EXT_SIG_PRI_IND_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.104 */
3822 {GTP_EXT_HIGHER_BR_16MB_FLG, GTP_OPTIONAL, NULL}, /* 7.7.105 */
3823 {GTP_EXT_SEL_MODE_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.113 */
3824 {GTP_EXT_LHN_ID_W_SAPI, GTP_OPTIONAL, NULL }, /* 7.7.115 */
3825 {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3826 {GTP_EXT_EXT_COMMON_FLGS_II, GTP_OPTIONAL, NULL}, /* 7.7.118 */
3827 {GTP_EXT_SCEF_PDN_CONNECTION, GTP_OPTIONAL, NULL }, /* 7.7.121 */
3828 {GTP_EXT_IOV_UPDATES_COUNTER, GTP_OPTIONAL, NULL }, /* 7.7.122 */
3829 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative GGSN Address for Control Plane 7.7.32 */
3830 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative GGSN Address for User Traffic 7.7.32 */
3831 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3832 {0, 0, NULL}
3836 GTP_MSG_SGSN_CNTXT_ACK, {
3837 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3838 {GTP_EXT_TEID_II, GTP_CONDITIONAL, NULL},
3839 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_sgsn_addr_for_user_plane},
3840 {GTP_EXT_SGSN_NO, GTP_OPTIONAL, NULL}, /* SGSN Number Optional 7.7.47 */
3841 {GTP_EXT_NODE_IDENTIFIER, GTP_OPTIONAL, NULL}, /* 7.7.119 */
3842 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3843 {0, 0, NULL}
3847 GTP_MSG_FORW_RELOC_REQ, {
3848 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* The IMSI shall not be included in the message if the MS is emergency attached and the MS is UICCless */
3849 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL},
3850 {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY, NULL},
3851 {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL, NULL},
3852 {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL, NULL}, /* CharingCharacteristics Optional 7.7.23 */
3853 {GTP_EXT_MM_CNTXT, GTP_MANDATORY, NULL},
3854 {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL, NULL},
3855 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane},
3856 {GTP_EXT_TARGET_ID, GTP_MANDATORY, NULL},
3857 {GTP_EXT_UTRAN_CONT, GTP_MANDATORY, NULL},
3858 {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL, NULL}, /* PDP Context Prioritization Optional 7.7.45 */
3859 {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL, NULL}, /* MBMS UE Context Optional 7.7.55 */
3860 {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL, NULL}, /* Selected PLMN ID Optional 7.7.64 */
3861 {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL, NULL}, /* PS Handover Request Context Optional 7.7.71 */
3862 {GTP_EXT_BSS_CONT, GTP_OPTIONAL, NULL}, /* BSS Container Optional 7.7.72 */
3863 {GTP_EXT_CELL_ID, GTP_OPTIONAL, NULL}, /* Cell Identification Optional 7.7.73 */
3864 {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL, NULL}, /* BSSGP Cause Optional 7.7.75 */
3865 {GTP_EXT_PS_HANDOVER_XIP_PAR, GTP_OPTIONAL, NULL}, /* 7.7.79 */
3866 {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL, NULL}, /* Direct Tunnel Flags 7.7.81 */
3867 {GTP_EXT_RELIABLE_IRAT_HO_INF, GTP_OPTIONAL, NULL}, /* 7.7.87 */
3868 {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* Subscribed RFSP Index 7.7.88 */
3869 {GTP_EXT_RFSP_INDEX, GTP_OPTIONAL, NULL}, /* RFSP Index in use 7.7.88 */
3870 {GTP_EXT_FQDN, GTP_OPTIONAL, NULL}, /* Co-located GGSN-PGW FQDN 7.7.90 */
3871 {GTP_EXT_EVO_ALLO_RETE_P2, GTP_OPTIONAL, NULL}, /* 7.7.92 */
3872 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3873 {GTP_EXT_CSG_ID, GTP_OPTIONAL, NULL}, /* 7.7.96 */
3874 {GTP_EXT_CMI, GTP_OPTIONAL, NULL}, /* 7.7.97 */
3875 {GTP_EXT_UE_NETWORK_CAP, GTP_OPTIONAL, NULL}, /* 7.7.99 */
3876 {GTP_EXT_UE_AMBR, GTP_OPTIONAL, NULL}, /* 7.7.100 */
3877 {GTP_EXT_APN_AMBR_WITH_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.101 */
3878 {GTP_EXT_SIG_PRI_IND_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.104 */
3879 {GTP_EXT_HIGHER_BR_16MB_FLG, GTP_OPTIONAL, NULL}, /* 7.7.105 */
3880 {GTP_EXT_ADD_MM_CTX_SRVCC, GTP_OPTIONAL, NULL}, /* 7.7.107 */
3881 {GTP_EXT_ADD_FLGS_SRVCC, GTP_OPTIONAL, NULL}, /* 7.7.108 */
3882 {GTP_EXT_STN_SR, GTP_OPTIONAL, NULL}, /* 7.7.109 */
3883 {GTP_EXT_C_MSISDN, GTP_OPTIONAL, NULL}, /* 7.7.110 */
3884 {GTP_EXT_EXT_RANAP_CAUSE, GTP_OPTIONAL, NULL}, /* 7.7.111 */
3885 {GTP_EXT_ENODEB_ID, GTP_OPTIONAL, NULL}, /* 7.7.112 */
3886 {GTP_EXT_SEL_MODE_W_NSAPI, GTP_OPTIONAL, NULL}, /* 7.7.113 */
3887 {GTP_EXT_UE_USAGE_TYPE, GTP_OPTIONAL, NULL}, /* 7.7.117 */
3888 {GTP_EXT_EXT_COMMON_FLGS_II, GTP_OPTIONAL, NULL}, /* 7.7.118 */
3889 {GTP_EXT_SCEF_PDN_CONNECTION, GTP_OPTIONAL, NULL }, /* 7.7.121 */
3890 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative GGSN Address for Control Plane 7.7.32 */
3891 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative GGSN Address for User Traffic 7.7.32 */
3892 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3893 {0, 0, NULL}
3897 GTP_MSG_FORW_RELOC_RESP, {
3898 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3899 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL},
3900 {GTP_EXT_TEID_II, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
3901 {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL, NULL},
3902 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* SGSN Address for Control plane */
3903 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* SGSN Address for User Traffic - cannot appear without above Address for Control plane */
3904 {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL, NULL},
3905 {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL, NULL},
3906 {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL, NULL}, /* Additional RAB Setup Information Conditional 7.7.45A */
3907 {GTP_EXT_SGSN_NO, GTP_OPTIONAL, NULL}, /* SGSN Number Optional 7.7.47 */
3908 {GTP_EXT_BSS_CONT, GTP_OPTIONAL, NULL}, /* BSS Container Optional 7.7.72 */
3909 {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL, NULL}, /* BSSGP Cause Optional 7.7.75 */
3910 {GTP_EXT_LIST_OF_SETUP_PFCS, GTP_OPTIONAL, NULL}, /* 7.7.78 */
3911 {GTP_EXT_EXT_RANAP_CAUSE, GTP_OPTIONAL, NULL}, /* 7.7.111 */
3912 {GTP_EXT_NODE_IDENTIFIER, GTP_OPTIONAL, NULL}, /* 7.7.119 */
3913 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3914 {0, 0, NULL}
3918 GTP_MSG_FORW_RELOC_COMP, {
3919 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3920 {0, 0, NULL}
3924 GTP_MSG_RELOC_CANCEL_REQ, {
3925 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* If MS is emergency attached and the MS is UICCless, the IMSI cannot be included. */
3926 {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL}, /* 7.7.53 */
3927 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
3928 {GTP_EXT_EXT_RANAP_CAUSE, GTP_OPTIONAL, NULL}, /* 7.7.111 */
3929 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3930 {0, 0, NULL}
3934 GTP_MSG_RELOC_CANCEL_RESP, {
3935 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3936 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3937 {0, 0, NULL}
3941 GTP_MSG_FORW_RELOC_ACK, {
3942 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3943 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3944 {0, 0, NULL}
3948 GTP_MSG_FORW_SRNS_CNTXT_ACK, {
3949 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3950 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3951 {0, 0, NULL}
3955 GTP_MSG_FORW_SRNS_CNTXT, {
3956 {GTP_EXT_RAB_CNTXT, GTP_MANDATORY, NULL},
3957 {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL, NULL}, /* Source RNC PDCP context info Optional 7.7.61 */
3958 {GTP_EXT_PDU_NO, GTP_OPTIONAL, NULL}, /* PDU Numbers Optional 7.7.74 */
3959 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3960 {0, 0, NULL}
3964 /* 7.5.14 RAN Information Management Messages */
3966 GTP_MSG_RAN_INFO_RELAY, {
3967 {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY, NULL}, /* RAN Transparent Container Mandatory 7.7.43 */
3968 {GTP_EXT_RIM_RA, GTP_OPTIONAL, NULL}, /* RIM Routing Address Optional 7.7.57 */
3969 {GTP_EXT_RIM_ROUTING_ADDR_DISC, GTP_OPTIONAL, NULL}, /* 7.7.77 */
3970 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3971 {0, 0, NULL}
3974 /* 7.5.15 UE Registration Query Request */
3976 GTP_MSG_UE_REG_QUERY_REQ, {
3977 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3978 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3979 {0, 0, NULL}
3982 /* 7.5.16 UE Registration Query Response */
3984 GTP_MSG_UE_REG_QUERY_RESP, {
3985 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL},
3986 {GTP_EXT_IMSI, GTP_MANDATORY, NULL},
3987 {GTP_EXT_SEL_PLMN_ID, GTP_CONDITIONAL, NULL}, /* Selected PLMN ID 7.7.64 */
3988 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
3989 {0, 0, NULL}
3992 /* 7.5A MBMS Messages
3993 * 7.5A.1 UE Specific MBMS Messages
3996 GTP_MBMS_NOTIFY_REQ, {
3997 {GTP_EXT_IMSI, GTP_MANDATORY, NULL}, /* IMSI Mandatory 7.7.2 */
3998 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
3999 {GTP_EXT_NSAPI, GTP_MANDATORY, NULL}, /* NSAPI Mandatory 7.7.17 */
4000 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4001 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4002 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_ggsn_addr_for_control_plane}, /* GGSN Address for Control Plane Mandatory 7.7.32 */
4003 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4004 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4005 {0, 0, NULL}
4009 GTP_MBMS_NOTIFY_RES, {
4010 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4011 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4012 {0, 0, NULL}
4016 GTP_MBMS_NOTIFY_REJ_REQ, {
4017 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4018 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
4019 {GTP_EXT_NSAPI, GTP_MANDATORY, NULL}, /* NSAPI Mandatory 7.7.17 */
4020 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4021 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4022 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, decode_gtp_sgsn_addr_for_control_plane}, /* SGSN Address for Control Plane Optional 7.7.32 */
4023 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4024 {0, 0, NULL}
4028 GTP_MBMS_NOTIFY_REJ_RES, {
4029 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4030 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4031 {0, 0, NULL}
4035 GTP_CREATE_MBMS_CNTXT_REQ, {
4036 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* IMSI Conditional 7.7.2 */
4037 {GTP_EXT_RAI, GTP_MANDATORY, NULL}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
4038 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL}, /* Recovery Optional 7.7.11 */
4039 {GTP_EXT_SEL_MODE, GTP_CONDITIONAL, NULL}, /* Selection mode Conditional 7.7.12 */
4040 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4041 {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL}, /* Trace Reference Optional 7.7.24 */
4042 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL}, /* Trace Type Optional 7.7.25 */
4043 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4044 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4045 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane}, /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
4046 {GTP_EXT_MSISDN, GTP_CONDITIONAL, NULL}, /* MSISDN Conditional 7.7.33 */
4047 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL}, /* Trigger Id Optional 7.7.41 */
4048 {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL}, /* OMC Identity Optional 7.7.42 */
4049 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL}, /* RAT Type Optional 7.7.50 */
4050 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL}, /* User Location Information Optional 7.7.51 */
4051 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL}, /* MS Time Zone Optional 7.7.52 */
4052 {GTP_EXT_IMEISV, GTP_OPTIONAL, NULL}, /* IMEI(SV) Optional 7.7.53 */
4053 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4054 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL}, /* Additional Trace Info Optional 7.7.62 */
4055 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY, NULL}, /* Enhanced NSAPI Mandatory 7.7.67 */
4056 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL, NULL}, /* Additional MBMS Trace Info Optional 7.7.68 */
4057 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4058 {0, 0, NULL}
4062 GTP_CREATE_MBMS_CNTXT_RES, {
4063 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4064 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL}, /* Recovery Optional 7.7.11 */
4065 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4066 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL}, /* Charging ID Conditional 7.7.26 */
4067 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4068 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4069 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL}, /* Charging Gateway Address Optional 7.7.44 */
4070 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
4071 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4072 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4073 {0, 0, NULL}
4077 GTP_UPD_MBMS_CNTXT_REQ, {
4078 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* IMSI Conditional 7.7.2 */
4079 {GTP_EXT_RAI, GTP_MANDATORY, NULL}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
4080 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL}, /* Recovery Optional 7.7.11 */
4081 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4082 {GTP_EXT_TRACE_REF, GTP_OPTIONAL, NULL}, /* Trace Reference Optional 7.7.24 */
4083 {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL, NULL}, /* Trace Type Optional 7.7.25 */
4084 {GTP_EXT_GSN_ADDR, GTP_MANDATORY, decode_gtp_sgsn_addr_for_control_plane}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
4085 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4086 {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL, NULL}, /* Trigger Id Optional 7.7.41 */
4087 {GTP_EXT_OMC_ID, GTP_OPTIONAL, NULL}, /* OMC Identity Optional 7.7.42 */
4088 {GTP_EXT_RAT_TYPE, GTP_OPTIONAL, NULL}, /* RAT Type Optional 7.7.50 */
4089 {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL, NULL}, /* User Location Information Optional 7.7.51 */
4090 {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL, NULL}, /* MS Time Zone Optional 7.7.52 */
4091 {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL, NULL}, /* Additional Trace Info Optional 7.7.62 */
4092 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY, NULL}, /* Enhanced NSAPI Mandatory 7.7.67 */
4093 {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL, NULL}, /* Additional MBMS Trace Info Optional 7.7.68 */
4094 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4095 {0, 0, NULL}
4099 GTP_UPD_MBMS_CNTXT_RES, {
4100 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4101 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL}, /* Recovery Optional 7.7.11 */
4102 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4103 {GTP_EXT_CHRG_ID, GTP_CONDITIONAL, NULL}, /* Charging ID Conditional 7.7.26 */
4104 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4105 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4106 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL}, /* Charging Gateway Address Optional 7.7.44 */
4107 {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL, NULL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
4108 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4109 {0, 0, NULL}
4113 GTP_DEL_MBMS_CNTXT_REQ, {
4114 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* IMSI Conditional 7.7.2 */
4115 {GTP_EXT_TEID_CP, GTP_MANDATORY, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4116 {GTP_EXT_USER_ADDR, GTP_CONDITIONAL, NULL}, /* End User Address Conditional 7.7.27 */
4117 {GTP_EXT_APN, GTP_CONDITIONAL, NULL}, /* Access Point Name Conditional 7.7.30 */
4118 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4119 {GTP_EXT_ENH_NSAPI, GTP_MANDATORY, NULL}, /* Enhanced NSAPI Conditional 7.7.67 */
4120 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4121 {0, 0, NULL}
4125 GTP_DEL_MBMS_CNTXT_RES, {
4126 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4127 {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL, NULL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
4128 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL},
4129 {0, 0, NULL}
4133 GTP_MBMS_REG_REQ, {
4134 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4135 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4136 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4137 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, decode_gtp_sgsn_addr_for_control_plane}, /* SGSN Address for Control Plane GSN Address 7.7.32 */
4138 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative SGSN Address for Control Plane GSN Address 7.7.32 */
4139 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4140 {0, 0, NULL}
4144 GTP_MBMS_REG_RES, {
4145 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4146 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4147 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4148 {GTP_EXT_TMGI, GTP_CONDITIONAL, NULL}, /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
4149 {GTP_EXT_REQ_MBMS_BEARER_CAP, GTP_CONDITIONAL, NULL}, /* 7.7.76 */
4150 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4151 {0, 0, NULL}
4155 GTP_MBMS_DE_REG_REQ, {
4156 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4157 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4158 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4159 {0, 0, NULL}
4163 GTP_MBMS_DE_REG_RES, {
4164 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4165 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4166 {0, 0, NULL}
4170 GTP_MBMS_SES_START_REQ, {
4171 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL}, /* Recovery Optional 7.7.11 */
4172 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4173 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4174 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4175 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4176 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative GGSN Address for Control Plane GSN Address 7.7.32 */
4177 {GTP_EXT_QOS_UMTS, GTP_MANDATORY, NULL}, /* Quality of Service Profile Mandatory 7.7.34 */
4178 {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* Common Flags Mandatory 7.7.48 */
4179 {GTP_EXT_TMGI, GTP_MANDATORY, NULL}, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
4180 {GTP_EXT_MBMS_SA, GTP_MANDATORY, NULL}, /* MBMS Service Area Mandatory 7.7.60 */
4181 {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL, NULL}, /* MBMS Session Identifier Optional 7.7.65 */
4182 {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY, NULL}, /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
4183 {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY, NULL}, /* MBMS Session Duration Mandatory 7.7.59 */ /* V16.0.0 has it here. */
4184 {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL, NULL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
4185 {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY, NULL}, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
4186 {GTP_EXT_MBMS_FLOW_ID, GTP_OPTIONAL, NULL}, /* 7.7.84 */
4187 {GTP_EXT_MBMS_IP_MCAST_DIST, GTP_OPTIONAL, NULL}, /* 7.7.85 */
4188 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4189 {0, 0, NULL}
4193 GTP_MBMS_SES_START_RES, {
4194 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4195 {GTP_EXT_RECOVER, GTP_OPTIONAL, NULL}, /* Recovery Optional 7.7.11 */
4196 {GTP_EXT_TEID, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
4197 {GTP_EXT_TEID_CP, GTP_CONDITIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
4198 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
4199 {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL, NULL}, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
4200 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* Alternative SGSN Address for user traffic GSN Address 7.7.32 */
4201 {GTP_EXT_MBMS_DIST_ACK, GTP_OPTIONAL, NULL}, /* 7.7.86 */
4202 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4203 {0, 0, NULL}
4207 GTP_MBMS_SES_STOP_REQ, {
4208 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4209 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4210 {GTP_EXT_MBMS_FLOW_ID, GTP_OPTIONAL, NULL}, /* 7.7.84 */
4211 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4212 {0, 0, NULL}
4216 GTP_MBMS_SES_STOP_RES, {
4217 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4218 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4219 {0, 0, NULL}
4223 GTP_MBMS_SES_UPD_REQ, {
4224 {GTP_EXT_TEID_CP, GTP_OPTIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane 7.7.14 */
4225 {GTP_EXT_USER_ADDR, GTP_MANDATORY, NULL}, /* End User Address Mandatory 7.7.27 */
4226 {GTP_EXT_APN, GTP_MANDATORY, NULL}, /* Access Point Name Mandatory 7.7.30 */
4227 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* GGSN Address for Control Plane GSN Address 7.7.32 */
4228 {GTP_EXT_TMGI, GTP_MANDATORY, NULL}, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
4229 {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY, NULL}, /* MBMS Session Duration Mandatory 7.7.59 */ /* V16.0.0 has it here. */
4230 {GTP_EXT_MBMS_SA, GTP_MANDATORY, NULL}, /* MBMS Service Area Mandatory 7.7.60 */
4231 {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL, NULL}, /* MBMS Session Identifier Optional 7.7.65 */
4232 {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL, NULL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
4233 {GTP_EXT_MBMS_FLOW_ID, GTP_OPTIONAL, NULL}, /* 7.7.84 */
4234 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4235 {0, 0, NULL}
4239 GTP_MBMS_SES_UPD_RES, {
4240 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4241 {GTP_EXT_TEID, GTP_OPTIONAL, NULL}, /* Tunnel Endpoint Identifier Data I 7.7.13 */
4242 {GTP_EXT_TEID_CP, GTP_OPTIONAL, NULL}, /* Tunnel Endpoint Identifier Control Plane 7.7.14 */
4243 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* SGSN Address for Data I GSN Address 7.7.32 */
4244 {GTP_EXT_GSN_ADDR, GTP_OPTIONAL, NULL}, /* SGSN Address for Control Plane GSN Address 7.7.32 */
4245 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4246 {0, 0, NULL}
4250 GTP_MS_INFO_CNG_NOT_REQ, {
4251 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* IMSI Conditional 7.7.2 */
4252 {GTP_EXT_NSAPI, GTP_OPTIONAL, NULL}, /* Linked NSAPI Optional 7.7.17 */
4253 {GTP_EXT_RAT_TYPE, GTP_MANDATORY, NULL}, /* RAT Type 7.7.50 */
4254 {GTP_EXT_USR_LOC_INF, GTP_CONDITIONAL, NULL},/* User Location Information 7.7.51 */
4255 {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL}, /* IMEI(SV) 7.7.53 */
4256 {GTP_EXT_EXTENDED_COMMON_FLGS, GTP_OPTIONAL, NULL}, /* 7.7.93 */
4257 {GTP_EXT_UCI, GTP_OPTIONAL, NULL}, /* 7.7.94 */
4258 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4259 {0, 0, NULL}
4263 GTP_MS_INFO_CNG_NOT_RES, {
4264 {GTP_EXT_CAUSE, GTP_MANDATORY, NULL}, /* Cause Mandatory 7.7.1 */
4265 {GTP_EXT_IMSI, GTP_CONDITIONAL, NULL}, /* IMSI Conditional 7.7.2 */
4266 {GTP_EXT_NSAPI, GTP_OPTIONAL, NULL}, /* Linked NSAPI Optional 7.7.17 */
4267 {GTP_EXT_IMEISV, GTP_CONDITIONAL, NULL}, /* IMEI(SV) 7.7.53 */
4268 {GTP_EXT_MS_INF_CHG_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.80 */
4269 {GTP_EXT_CSG_INF_REP_ACT, GTP_OPTIONAL, NULL}, /* 7.7.95 */
4270 {GTP_EXT_PRIV_EXT, GTP_OPTIONAL, NULL}, /* Private Extension Optional 7.7.46 */
4271 {0, 0, NULL}
4275 0, {
4276 {0, 0, NULL}
4281 /* Data structure attached to a conversation,
4282 to keep track of request/response-pairs
4284 typedef struct gtp_conv_info_t {
4285 wmem_map_t *unmatched;
4286 wmem_map_t *matched;
4287 } gtp_conv_info_t;
4289 static unsigned
4290 gtp_sn_hash(const void *k)
4292 const gtp_msg_hash_t *key = (const gtp_msg_hash_t *)k;
4294 return key->seq_nr;
4297 static int
4298 gtp_sn_equal_matched(const void *k1, const void *k2)
4300 const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
4301 const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
4302 double diff;
4303 nstime_t delta;
4305 if ( key1->req_frame && key2->req_frame && (key1->req_frame != key2->req_frame) ) {
4306 return 0;
4309 if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame != key2->rep_frame) ) {
4310 return 0;
4313 if (pref_pair_matching_max_interval_ms) {
4314 nstime_delta(&delta, &key1->req_time, &key2->req_time);
4315 diff = fabs(nstime_to_msec(&delta));
4317 return key1->seq_nr == key2->seq_nr && diff < pref_pair_matching_max_interval_ms;
4320 return key1->seq_nr == key2->seq_nr;
4323 static int
4324 gtp_sn_equal_unmatched(const void *k1, const void *k2)
4326 const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
4327 const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
4328 double diff;
4329 nstime_t delta;
4331 if (pref_pair_matching_max_interval_ms) {
4332 nstime_delta(&delta, &key1->req_time, &key2->req_time);
4333 diff = fabs(nstime_to_msec(&delta));
4335 return key1->seq_nr == key2->seq_nr && diff < pref_pair_matching_max_interval_ms;
4338 return key1->seq_nr == key2->seq_nr;
4341 static gtp_msg_hash_t *
4342 gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int seq_nr, unsigned msgtype, gtp_conv_info_t *gtp_info, uint8_t last_cause)
4344 gtp_msg_hash_t gcr, *gcrp = NULL;
4345 uint32_t session;
4347 gcr.seq_nr=seq_nr;
4348 gcr.req_time = pinfo->abs_ts;
4350 switch (msgtype) {
4351 case GTP_MSG_ECHO_REQ:
4352 case GTP_MSG_CREATE_PDP_REQ:
4353 case GTP_MSG_UPDATE_PDP_REQ:
4354 case GTP_MSG_DELETE_PDP_REQ:
4355 case GTP_MSG_FORW_RELOC_REQ:
4356 case GTP_MSG_DATA_TRANSF_REQ:
4357 case GTP_MSG_SGSN_CNTXT_REQ:
4358 case GTP_MS_INFO_CNG_NOT_REQ:
4359 case GTP_MSG_IDENT_REQ:
4360 gcr.is_request=true;
4361 gcr.req_frame=pinfo->num;
4362 gcr.rep_frame=0;
4363 break;
4364 case GTP_MSG_ECHO_RESP:
4365 case GTP_MSG_CREATE_PDP_RESP:
4366 case GTP_MSG_UPDATE_PDP_RESP:
4367 case GTP_MSG_DELETE_PDP_RESP:
4368 case GTP_MSG_FORW_RELOC_RESP:
4369 case GTP_MSG_DATA_TRANSF_RESP:
4370 case GTP_MSG_SGSN_CNTXT_RESP:
4371 case GTP_MS_INFO_CNG_NOT_RES:
4372 case GTP_MSG_IDENT_RESP:
4373 gcr.is_request=false;
4374 gcr.req_frame=0;
4375 gcr.rep_frame=pinfo->num;
4376 break;
4377 default:
4378 gcr.is_request=false;
4379 gcr.req_frame=0;
4380 gcr.rep_frame=0;
4381 break;
4384 gcrp = (gtp_msg_hash_t *)wmem_map_lookup(gtp_info->matched, &gcr);
4386 if (gcrp) {
4388 gcrp->is_request=gcr.is_request;
4390 } else {
4392 /*no match, let's try to make one*/
4393 switch (msgtype) {
4394 case GTP_MSG_ECHO_REQ:
4395 case GTP_MSG_CREATE_PDP_REQ:
4396 case GTP_MSG_UPDATE_PDP_REQ:
4397 case GTP_MSG_DELETE_PDP_REQ:
4398 case GTP_MSG_FORW_RELOC_REQ:
4399 case GTP_MSG_DATA_TRANSF_REQ:
4400 case GTP_MSG_SGSN_CNTXT_REQ:
4401 case GTP_MS_INFO_CNG_NOT_REQ:
4402 case GTP_MSG_IDENT_REQ:
4403 gcr.seq_nr=seq_nr;
4405 gcrp=(gtp_msg_hash_t *)wmem_map_lookup(gtp_info->unmatched, &gcr);
4406 if (gcrp) {
4407 wmem_map_remove(gtp_info->unmatched, gcrp);
4409 /* if we can't reuse the old one, grab a new chunk */
4410 if (!gcrp) {
4411 gcrp = wmem_new(wmem_file_scope(), gtp_msg_hash_t);
4413 gcrp->seq_nr=seq_nr;
4414 gcrp->req_frame = pinfo->num;
4415 gcrp->req_time = pinfo->abs_ts;
4416 gcrp->rep_frame = 0;
4417 gcrp->msgtype = msgtype;
4418 gcrp->is_request = true;
4419 wmem_map_insert(gtp_info->unmatched, gcrp, gcrp);
4420 return NULL;
4421 case GTP_MSG_ECHO_RESP:
4422 case GTP_MSG_CREATE_PDP_RESP:
4423 case GTP_MSG_UPDATE_PDP_RESP:
4424 case GTP_MSG_DELETE_PDP_RESP:
4425 case GTP_MSG_FORW_RELOC_RESP:
4426 case GTP_MSG_DATA_TRANSF_RESP:
4427 case GTP_MSG_SGSN_CNTXT_RESP:
4428 case GTP_MS_INFO_CNG_NOT_RES:
4429 case GTP_MSG_IDENT_RESP:
4430 gcr.seq_nr=seq_nr;
4431 gcrp=(gtp_msg_hash_t *)wmem_map_lookup(gtp_info->unmatched, &gcr);
4433 if (gcrp) {
4434 if (!gcrp->rep_frame) {
4435 wmem_map_remove(gtp_info->unmatched, gcrp);
4436 gcrp->rep_frame=pinfo->num;
4437 gcrp->is_request=false;
4438 wmem_map_insert(gtp_info->matched, gcrp, gcrp);
4441 break;
4442 default:
4443 break;
4447 /* we have found a match */
4448 if (gcrp) {
4449 proto_item *it;
4452 if (gcrp->is_request) {
4453 it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
4454 proto_item_set_generated(it);
4455 } else {
4456 nstime_t ns;
4458 it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
4459 proto_item_set_generated(it);
4460 nstime_delta(&ns, &pinfo->abs_ts, &gcrp->req_time);
4461 it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
4462 proto_item_set_generated(it);
4463 if (g_gtp_session) {
4464 if (!PINFO_FD_VISITED(pinfo) && gtp_version == 1) {
4465 /* GTP session */
4466 /* If it does not have any session assigned yet */
4467 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
4468 if (!session) {
4469 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(gcrp->req_frame)));
4470 if (session) {
4471 add_gtp_session(pinfo->num, session);
4475 if (!is_cause_accepted(last_cause, gtp_version)){
4476 /* If the cause is not accepted then we have to remove all the session information about its corresponding request */
4477 remove_frame_info(gcrp->req_frame);
4483 return gcrp;
4487 static int
4488 check_field_presence_and_decoder(uint8_t message, uint8_t field, int *position, ie_decoder **alt_decoder)
4491 unsigned i = 0;
4492 const _gtp_mess_items *mess_items;
4494 switch (gtp_version) {
4495 case 0:
4496 mess_items = gprs_mess_items;
4497 break;
4498 case 1:
4499 mess_items = umts_mess_items;
4500 break;
4501 default:
4502 return -2;
4505 while (mess_items[i].code) {
4506 if (mess_items[i].code == message) {
4508 while (mess_items[i].fields[*position].code) {
4509 if (mess_items[i].fields[*position].code == field) {
4510 *alt_decoder = mess_items[i].fields[*position].alt_decoder;
4511 (*position)++;
4512 return 0;
4513 } else {
4514 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
4515 return mess_items[i].fields[(*position)++].code;
4516 } else {
4517 (*position)++;
4521 return -1;
4523 i++;
4526 return -2;
4529 /* Decoders of fields in extension headers, each function returns no of bytes from field */
4531 /* GPRS: 9.60 v7.6.0, chapter
4532 * UMTS: 29.060 v4.0, chapter
4533 * 7.7.1 Cause
4535 static int
4536 decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args)
4538 uint8_t cause;
4540 cause = tvb_get_uint8(tvb, offset + 1);
4541 if (g_gtp_session) {
4542 args->last_cause = cause;
4544 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
4546 return 2;
4549 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
4550 * UMTS: 29.060 v4.0, chapter 7.7.2
4552 static int
4553 decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4555 /* const char *imsi_str; */
4557 /* Octets 2 - 9 IMSI */
4558 /* imsi_str = */ dissect_e212_imsi(tvb, pinfo, tree, offset+1, 8, false);
4560 return 9;
4563 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
4564 * UMTS: 29.060 v4.0, chapter 7.7.3 Routeing Area Identity (RAI)
4566 static int
4567 decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4570 proto_tree *ext_tree_rai;
4572 ext_tree_rai = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ies[GTP_EXT_RAI], NULL,
4573 val_to_str_ext_const(GTP_EXT_RAI, &gtp_val_ext, "Unknown message"));
4575 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree_rai, offset+1, E212_RAI, true);
4576 proto_tree_add_item(ext_tree_rai, hf_gtp_lac, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
4577 proto_tree_add_item(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
4579 return 7;
4582 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
4583 * UMTS: 29.060 v4.0, chapter 7.7.4 Temporary Logical Link Identity (TLLI)
4585 static int
4586 decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4589 uint32_t tlli;
4591 tlli = tvb_get_ntohl(tvb, offset + 1);
4592 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
4594 return 5;
4597 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
4598 * UMTS: 29.060 v4.0, chapter 7.7.5 Packet TMSI (P-TMSI)
4600 static int
4601 decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4603 proto_item* ti;
4605 proto_tree_add_item(tree, hf_gtp_ptmsi, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
4606 ti = proto_tree_add_item(tree, hf_3gpp_tmsi, tvb, offset+1, 4, ENC_BIG_ENDIAN);
4607 proto_item_set_hidden(ti);
4609 return 5;
4613 * adjust - how many bytes before offset should be highlighted
4615 static int
4616 decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const char * qos_str, uint8_t adjust)
4619 uint8_t spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
4620 proto_tree *ext_tree_qos;
4622 spare1 = tvb_get_uint8(tvb, offset) & GTP_EXT_QOS_SPARE1_MASK;
4623 delay = tvb_get_uint8(tvb, offset) & GTP_EXT_QOS_DELAY_MASK;
4624 reliability = tvb_get_uint8(tvb, offset) & GTP_EXT_QOS_RELIABILITY_MASK;
4625 peak = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
4626 spare2 = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
4627 precedence = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
4628 spare3 = tvb_get_uint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
4629 mean = tvb_get_uint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
4631 ext_tree_qos = proto_tree_add_subtree_format(tree, tvb, offset - adjust, 3 + adjust, ett_gtp_qos, NULL,
4632 "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
4633 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
4635 if (adjust != 0) {
4636 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
4637 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
4638 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
4639 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
4640 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
4641 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
4642 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
4643 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
4646 return 3;
4649 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
4650 * 4.08
4651 * 3.60
4652 * UMTS: not present
4653 * TODO: check if length is included: ETSI 4.08 vs 9.60
4655 static int
4656 decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4659 return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
4663 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
4664 * UMTS: 29.060 v4.0, chapter 7.7.6 Reordering Required
4666 static int
4667 decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4670 uint8_t reorder;
4672 reorder = tvb_get_uint8(tvb, offset + 1) & 0x01;
4673 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
4675 return 2;
4678 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
4679 * 4.08 v7.1.2, chapter 10.5.3.1+
4680 * UMTS: 29.060 v4.0, chapter 7.7.7
4681 * TODO: Add blurb support by registering items in the protocol registration
4683 static int
4684 decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4687 proto_tree *ext_tree_auth_tri;
4689 ext_tree_auth_tri = proto_tree_add_subtree(tree, tvb, offset, 29, ett_gtp_ies[GTP_EXT_AUTH_TRI], NULL,
4690 val_to_str_ext_const(GTP_EXT_AUTH_TRI, &gtp_val_ext, "Unknown message"));
4692 proto_tree_add_item(ext_tree_auth_tri, hf_gtp_rand, tvb, offset + 1, 16, ENC_NA);
4693 proto_tree_add_item(ext_tree_auth_tri, hf_gtp_sres, tvb, offset + 17, 4, ENC_NA);
4694 proto_tree_add_item(ext_tree_auth_tri, hf_gtp_kc, tvb, offset + 21, 8, ENC_NA);
4696 return 1 + 16 + 4 + 8;
4699 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
4700 * 9.02 v7.7.0, page 1090
4701 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
4702 * 29.002 v4.2.1, chapter 17.5, page 268
4704 static int
4705 decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4708 uint8_t map_cause;
4710 map_cause = tvb_get_uint8(tvb, offset + 1);
4711 proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
4713 return 2;
4716 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
4717 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
4719 static int
4720 decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4723 uint32_t ptmsi_sig;
4725 ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
4726 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
4728 return 4;
4731 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
4732 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
4734 static int
4735 decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4738 uint8_t ms_valid;
4740 ms_valid = tvb_get_uint8(tvb, offset + 1) & 0x01;
4741 proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
4743 return 2;
4746 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
4747 * UMTS: 29.060 v4.0, chapter 7.7.11 Recovery
4749 static int
4750 decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4753 uint8_t recovery;
4755 recovery = tvb_get_uint8(tvb, offset + 1);
4756 proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
4758 return 2;
4761 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
4762 * UMTS: 29.060 v4.0, chapter 7.7.12 Selection Mode
4766 static const char *
4767 dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
4769 uint8_t sel_mode;
4771 /* Value in ASCII(UTF-8) */
4772 sel_mode = tvb_get_uint8(tvb, 0) - 0x30;
4773 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
4775 return val_to_str_const(sel_mode, sel_mode_type, "Unknown");
4778 static int
4779 decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4781 proto_tree *ext_tree;
4782 proto_item *te;
4783 uint8_t sel_mode;
4785 sel_mode = tvb_get_uint8(tvb, offset + 1) & 0x03;
4787 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_gtp_ies[GTP_EXT_SEL_MODE], &te,
4788 val_to_str_ext_const(GTP_EXT_SEL_MODE, &gtp_val_ext, "Unknown message"));
4789 proto_item_append_text(te, ": %s", val_to_str_const(sel_mode, sel_mode_type, "Unknown"));
4790 proto_tree_add_item(ext_tree, hf_gtp_sel_mode, tvb, offset+1, 1, ENC_BIG_ENDIAN);
4792 return 2;
4795 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
4796 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
4798 static int
4799 decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
4802 uint16_t ext_flow_label;
4803 uint32_t teid_data, *teid;
4805 switch (gtp_version) {
4806 case 0:
4807 ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
4808 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
4810 return 3;
4811 case 1:
4812 teid_data = tvb_get_ntohl(tvb, offset + 1);
4813 /* We save the teid_data so that we could assignate its corresponding session ID later */
4814 if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) {
4815 args->last_teid = teid_data; /* We save it to track the error indication */
4816 if (!teid_exists(teid_data, args->teid_list)) {
4817 teid = wmem_new(pinfo->pool, uint32_t);
4818 *teid = teid_data;
4819 wmem_list_prepend(args->teid_list, teid);
4822 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset+1, 4, teid_data);
4824 return 5;
4825 default:
4826 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4827 tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
4829 return 3;
4833 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
4834 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
4836 static int
4837 decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
4840 uint32_t teid_cp;
4841 uint32_t *teid;
4843 switch (gtp_version) {
4844 case 0:
4845 proto_tree_add_item(tree, hf_gtp_flow_sig, tvb, offset+1, 2, ENC_BIG_ENDIAN);
4846 return 3;
4847 case 1:
4848 proto_tree_add_item_ret_uint(tree, hf_gtp_teid_cp, tvb, offset+1 , 4, ENC_BIG_ENDIAN, &teid_cp);
4849 /* We save the teid_cp so that we could assignate its corresponding session ID later */
4850 if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) {
4851 if (!teid_exists(teid_cp, args->teid_list)) {
4852 teid = wmem_new(pinfo->pool, uint32_t);
4853 *teid = teid_cp;
4854 wmem_list_prepend(args->teid_list, teid);
4857 return 5;
4858 default:
4859 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4860 tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
4861 return 3;
4865 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
4866 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
4868 static int
4869 decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4872 uint16_t flow_ii;
4873 uint32_t teid_ii;
4874 proto_tree *ext_tree_flow_ii;
4876 switch (gtp_version) {
4877 case 0:
4878 ext_tree_flow_ii = proto_tree_add_subtree(tree, tvb, offset, 4, ett_gtp_ies[GTP_EXT_FLOW_II], NULL,
4879 val_to_str_ext_const(GTP_EXT_FLOW_II, &gtp_val_ext, "Unknown message"));
4881 proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4883 flow_ii = tvb_get_ntohs(tvb, offset + 2);
4884 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
4886 return 4;
4887 case 1:
4888 ext_tree_flow_ii = proto_tree_add_subtree(tree, tvb, offset, 6, ett_gtp_flow_ii, NULL,
4889 val_to_str_ext_const(GTP_EXT_TEID_II, &gtpv1_val_ext, "Unknown message"));
4891 proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4893 teid_ii = tvb_get_ntohl(tvb, offset + 2);
4894 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
4896 return 6;
4897 default:
4898 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4899 tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
4901 return 4;
4905 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
4906 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
4907 * Check if all ms_reason types are included
4909 static int
4910 decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4913 uint8_t field19;
4915 field19 = tvb_get_uint8(tvb, offset + 1);
4917 switch (gtp_version) {
4918 case 0:
4919 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
4920 break;
4921 case 1:
4922 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
4923 break;
4924 default:
4925 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4926 tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
4927 break;
4930 return 2;
4933 /* GPRS: not present
4934 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
4936 static int
4937 decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4939 uint8_t nsapi;
4940 proto_tree *ext_tree;
4941 proto_item *te;
4943 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_gtp_ies[GTP_EXT_NSAPI], &te,
4944 val_to_str_ext_const(GTP_EXT_NSAPI, &gtp_val_ext, "Unknown message"));
4946 nsapi = tvb_get_uint8(tvb, offset + 1) & 0x0F;
4947 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4948 proto_item_append_text(te, ": %u",nsapi);
4950 return 2;
4953 /* GPRS: not present
4954 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
4956 static int
4957 decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4960 uint8_t ranap;
4962 ranap = tvb_get_uint8(tvb, offset + 1);
4964 if ((ranap > 0) && (ranap <= 64))
4965 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
4966 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
4967 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
4968 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
4970 if ((ranap > 64) && (ranap <= 80))
4971 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
4972 ranap, "%s (Transport Layer Cause) : %s (%u)",
4973 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
4974 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
4976 if ((ranap > 80) && (ranap <= 96))
4977 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
4978 ranap, "%s (NAS Cause) : %s (%u)",
4979 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
4980 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
4982 if ((ranap > 96) && (ranap <= 112))
4983 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
4984 "%s (Protocol Cause) : %s (%u)",
4985 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
4986 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
4988 if ((ranap > 112) && (ranap <= 128))
4989 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
4990 "%s (Miscellaneous Cause) : %s (%u)",
4991 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
4992 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
4994 if ((ranap > 128) /* && (ranap <= 255) */ )
4995 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
4996 "%s (Non-standard Cause) : %s (%u)",
4997 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
4998 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5000 return 2;
5003 /* GPRS: not present
5004 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
5006 static int
5007 decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5009 proto_tree *ext_tree_rab_cntxt;
5011 ext_tree_rab_cntxt = proto_tree_add_subtree(tree, tvb, offset, 10, ett_gtp_ies[GTP_EXT_RAB_CNTXT], NULL,
5012 val_to_str_ext_const(GTP_EXT_RAB_CNTXT, &gtp_val_ext, "Unknown message"));
5014 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5015 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5016 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
5017 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
5018 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, ENC_BIG_ENDIAN);
5020 return 10;
5024 /* GPRS: not present
5025 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
5027 static int
5028 decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5031 uint8_t rp_sms;
5033 rp_sms = tvb_get_uint8(tvb, offset + 1) & 0x07;
5034 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
5036 return 2;
5039 /* GPRS: not present
5040 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
5042 static int
5043 decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5046 proto_tree *ext_tree_rp;
5047 proto_item *te;
5048 uint8_t nsapi, rp;
5050 nsapi = (tvb_get_uint8(tvb, offset + 1) & 0xF0) >> 4;
5051 rp = tvb_get_uint8(tvb, offset + 1) & 0x07;
5053 /* TODO: shouldn't really use int item as tree root.. */
5054 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
5055 ext_tree_rp = proto_item_add_subtree(te, ett_gtp_rp);
5057 proto_tree_add_item(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, ENC_NA);
5058 proto_tree_add_item(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, ENC_NA);
5059 proto_tree_add_item(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, ENC_NA);
5061 return 2;
5064 /* GPRS: not present
5065 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
5067 static int
5068 decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5071 proto_tree *ext_tree_pkt_flow_id;
5072 proto_item *te;
5073 uint8_t nsapi, pkt_flow_id;
5075 nsapi = tvb_get_uint8(tvb, offset + 1) & 0x0F;
5076 pkt_flow_id = tvb_get_uint8(tvb, offset + 2);
5078 te = proto_tree_add_uint_format(tree, hf_gtp_pkt_flow_id, tvb, offset, 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi, pkt_flow_id);
5079 ext_tree_pkt_flow_id = proto_item_add_subtree(te, ett_gtp_pkt_flow_id);
5081 proto_tree_add_item(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5082 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
5083 offset + 2, 1, pkt_flow_id, "%s : %u", val_to_str_ext_const(GTP_EXT_PKT_FLOW_ID, &gtp_val_ext, "Unknown message"), pkt_flow_id);
5085 return 3;
5088 /* GPRS: not present
5089 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
5090 * TODO: Differenciate these uints?
5092 static int
5093 decode_gtp_chrg_char(tvbuff_t* tvb, int offset, packet_info* pinfo _U_, proto_tree* tree, session_args_t* args _U_)
5096 static int* const gtp_charg_flags[] = {
5097 &hf_gtp_chrg_char_s,
5098 &hf_gtp_chrg_char_n,
5099 &hf_gtp_chrg_char_p,
5100 &hf_gtp_chrg_char_f,
5101 &hf_gtp_chrg_char_h,
5102 &hf_gtp_chrg_char_r,
5103 NULL
5106 proto_tree_add_bitmask(tree, tvb, offset + 1, hf_gtp_chrg_char, ett_gtp_ies[GTP_EXT_CHRG_CHAR], gtp_charg_flags, ENC_BIG_ENDIAN);
5108 return 3;
5111 /* GPRS: not present
5112 * UMTS: 29.060 v4.0, chapter 7.7.24, page
5114 static int
5115 decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5118 uint16_t trace_ref;
5120 trace_ref = tvb_get_ntohs(tvb, offset + 1);
5122 proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
5124 return 3;
5127 /* GPRS: not present
5128 * UMTS: 29.060 v4.0, chapter 7.7.25, page
5130 static int
5131 decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5134 uint16_t trace_type;
5136 trace_type = tvb_get_ntohs(tvb, offset + 1);
5138 proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
5140 return 3;
5143 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
5144 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
5146 static int
5147 decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5150 uint8_t reason;
5152 reason = tvb_get_uint8(tvb, offset + 1);
5154 /* Reason for Absence is defined in 3GPP TS 23.040 */
5155 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
5157 return 2;
5160 /* GPRS: ?
5161 * UMTS: 29.060 v6.11.0, chapter 7.7.25B
5162 * Radio Priority LCS
5164 static int
5165 decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5168 uint16_t length;
5169 proto_tree *ext_tree;
5171 length = tvb_get_ntohs(tvb, offset + 1);
5172 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RA_PRIO_LCS], NULL,
5173 "%s : ", val_to_str_ext_const(GTP_EXT_RA_PRIO_LCS, &gtp_val_ext, "Unknown"));
5175 offset++;
5176 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
5177 offset = offset + 2;
5179 proto_tree_add_item(ext_tree, hf_gtp_ra_prio_lcs, tvb, offset, 1, ENC_BIG_ENDIAN);
5181 return 3 + length;
5185 /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
5186 * UMTS: 33.015
5188 static int
5189 decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5192 uint8_t tr_command;
5194 tr_command = tvb_get_uint8(tvb, offset + 1);
5196 proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
5198 return 2;
5201 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
5202 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
5204 static int
5205 decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5208 uint32_t chrg_id;
5210 chrg_id = tvb_get_ntohl(tvb, offset + 1);
5211 proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
5213 return 5;
5216 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
5217 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
5219 static int
5220 decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5223 uint16_t length;
5224 uint8_t pdp_typ, pdp_org;
5225 proto_tree *ext_tree_user;
5226 proto_item *te;
5229 length = tvb_get_ntohs(tvb, offset + 1);
5230 pdp_org = tvb_get_uint8(tvb, offset + 3) & 0x0F;
5231 pdp_typ = tvb_get_uint8(tvb, offset + 4);
5233 ext_tree_user = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length,
5234 ett_gtp_ies[GTP_EXT_USER_ADDR], &te, "%s (%s/%s)",
5235 val_to_str_ext_const(GTP_EXT_USER_ADDR, &gtp_val_ext, "Unknown message"),
5236 val_to_str_const(pdp_org, pdp_org_type, "Unknown PDP Organization"),
5237 val_to_str_const(pdp_typ, pdp_type, "Unknown PDP Type"));
5239 proto_tree_add_item(ext_tree_user, hf_gtp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
5240 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset + 3, 1, pdp_org);
5241 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
5243 if (length == 2) {
5244 if ((pdp_org == 0) && (pdp_typ == 1))
5245 proto_item_append_text(te, " (Point to Point Protocol)");
5246 else if (pdp_typ == 2)
5247 proto_item_append_text(te, " (Octet Stream Protocol)");
5248 } else if (length > 2) {
5249 switch (pdp_typ) {
5250 case 0x21:
5251 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5252 proto_item_append_text(te, " : %s", tvb_ip_to_str(pinfo->pool, tvb, offset + 5));
5253 break;
5254 case 0x57:
5255 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, ENC_NA);
5256 proto_item_append_text(te, " : %s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 5));
5257 break;
5258 case 0x8d:
5259 if (length == 6) {
5260 ws_in6_addr ipv6;
5261 memset(&ipv6, 0, sizeof(ws_in6_addr));
5262 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5263 proto_tree_add_ipv6_format_value(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 0, &ipv6, "dynamic");
5264 proto_item_append_text(te, " : %s / dynamic", tvb_ip_to_str(pinfo->pool, tvb, offset + 5));
5265 } else if (length == 18) {
5266 proto_tree_add_ipv4_format_value(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 0, 0, "dynamic");
5267 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, ENC_NA);
5268 proto_item_append_text(te, " : dynamic / %s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 5));
5269 } else if (length == 22) {
5270 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5271 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 16, ENC_NA);
5272 proto_item_append_text(te, " : %s / %s", tvb_ip_to_str(pinfo->pool, tvb, offset + 5),
5273 tvb_ip6_to_str(pinfo->pool, tvb, offset + 9));
5274 } else {
5275 proto_tree_add_expert_format(ext_tree_user, pinfo, &ei_gtp_ext_length_mal, tvb, offset + 3, length, "Wrong length indicated. Expected 6, 18 or 22, got %u", length);
5277 break;
5279 } else
5280 proto_item_append_text(te, " : empty PDP Address");
5282 return 3 + length;
5285 static int
5286 decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, uint16_t count)
5289 proto_tree *ext_tree_trip;
5290 uint16_t i;
5292 for (i = 0; i < count; i++) {
5293 ext_tree_trip = proto_tree_add_subtree_format(tree, tvb, offset + i * 28, 28, ett_gtp_trip, NULL, "Triplet no%x", i);
5295 proto_tree_add_item(ext_tree_trip, hf_gtp_rand, tvb, offset + i * 28, 16, ENC_NA);
5296 proto_tree_add_item(ext_tree_trip, hf_gtp_sres, tvb, offset + i * 28 + 16, 4, ENC_NA);
5297 proto_tree_add_item(ext_tree_trip, hf_gtp_kc, tvb, offset + i * 28 + 20, 8, ENC_NA);
5300 return count * 28;
5303 /* adjust - how many bytes before quintuplet should be highlighted
5305 static int
5306 decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, uint16_t count)
5309 proto_tree *ext_tree_quint;
5310 proto_item *te_quint;
5311 uint16_t q_offset, i;
5312 uint8_t xres_len, auth_len;
5314 q_offset = 0;
5316 for (i = 0; i < count; i++) {
5318 ext_tree_quint = proto_tree_add_subtree_format(tree, tvb, offset, -1,
5319 ett_gtp_quint, &te_quint, "Quintuplet #%x", i + 1);
5321 proto_tree_add_item(ext_tree_quint, hf_gtp_rand, tvb, offset + q_offset, 16, ENC_NA);
5322 q_offset = q_offset + 16;
5323 xres_len = tvb_get_uint8(tvb, offset + q_offset);
5324 proto_tree_add_item(ext_tree_quint, hf_gtp_xres_length, tvb, offset + q_offset, 1, ENC_BIG_ENDIAN);
5325 q_offset++;
5326 proto_tree_add_item(ext_tree_quint, hf_gtp_xres, tvb, offset + q_offset, xres_len, ENC_NA);
5327 q_offset = q_offset + xres_len;
5328 proto_tree_add_item(ext_tree_quint, hf_gtp_quintuplet_ciphering_key, tvb, offset + q_offset, 16, ENC_NA);
5329 q_offset = q_offset + 16;
5330 proto_tree_add_item(ext_tree_quint, hf_gtp_quintuplet_integrity_key, tvb, offset + q_offset, 16, ENC_NA);
5331 q_offset = q_offset + 16;
5332 auth_len = tvb_get_uint8(tvb, offset + q_offset);
5333 proto_tree_add_item(ext_tree_quint, hf_gtp_authentication_length, tvb, offset + q_offset, 1, ENC_BIG_ENDIAN);
5334 q_offset++;
5335 proto_tree_add_item(ext_tree_quint, hf_gtp_auth, tvb, offset + q_offset, auth_len, ENC_NA);
5337 q_offset = q_offset + auth_len;
5338 proto_item_set_end(te_quint, tvb, offset + q_offset);
5342 return q_offset;
5345 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
5346 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
5347 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
5348 * - finish displaying last 3 parameters
5350 static int
5351 decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
5354 uint16_t length, con_len;
5355 uint8_t count, sec_mode, len, iei;
5356 proto_tree *ext_tree_mm;
5357 proto_tree *tf_tree = NULL, *con_tree;
5359 ext_tree_mm = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ies[GTP_EXT_MM_CNTXT], NULL,
5360 val_to_str_ext_const(GTP_EXT_MM_CNTXT, &gtp_val_ext, "Unknown message"));
5362 /* Octet 2 - 3 */
5363 length = tvb_get_ntohs(tvb, offset + 1);
5364 if (length < 1)
5365 return 3;
5367 /* Octet 4 (cksn)*/
5369 /* Octet 5 */
5370 sec_mode = (tvb_get_uint8(tvb, offset + 4) >> 6) & 0x03;
5371 count = (tvb_get_uint8(tvb, offset + 4) >> 3) & 0x07;
5373 proto_tree_add_item(ext_tree_mm, hf_gtp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
5374 if (gtp_version == 0)
5375 sec_mode = 1;
5378 switch (sec_mode) {
5379 case 0: /* Used cipher value, UMTS keys and Quintuplets */
5380 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5381 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5382 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5383 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5384 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_ck, tvb, offset + 5, 16, ENC_NA);
5385 proto_tree_add_item(ext_tree_mm, hf_gtp_integrity_key_ik, tvb, offset + 21, 16, ENC_NA);
5386 proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 37, 2, ENC_BIG_ENDIAN);
5388 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
5391 break;
5392 case 1: /* GSM key and triplets */
5393 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5394 if (gtp_version != 0)
5395 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5397 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5398 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5399 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_kc, tvb, offset + 5, 8, ENC_NA);
5401 offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
5403 break;
5404 case 2: /* UMTS key and quintuplets */
5405 proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5406 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5407 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5408 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_ck, tvb, offset + 5, 16, ENC_NA);
5409 proto_tree_add_item(ext_tree_mm, hf_gtp_integrity_key_ik, tvb, offset + 21, 16, ENC_NA);
5410 proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 37, 2, ENC_BIG_ENDIAN);
5412 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
5414 break;
5415 case 3: /* GSM key and quintuplets */
5416 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5417 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5418 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5419 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5420 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_kc, tvb, offset + 5, 8, ENC_NA);
5421 proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 13, 2, ENC_BIG_ENDIAN);
5423 offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
5425 break;
5426 default:
5427 break;
5431 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
5433 tf_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, 2, ett_gtp_drx, NULL, "DRX Parameter");
5434 de_gmm_drx_param(tvb, tf_tree, pinfo, offset, 2, NULL, 0);
5435 offset = offset + 2;
5437 len = tvb_get_uint8(tvb, offset);
5438 tf_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, len + 1, ett_gtp_net_cap, NULL, "MS Network Capability");
5440 proto_tree_add_uint(tf_tree, hf_gtp_ms_network_cap_content_len, tvb, offset, 1, len);
5442 offset++;
5444 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
5446 if (len > 0) {
5447 de_gmm_ms_net_cap(tvb, tf_tree, pinfo, offset, len, NULL, 0);
5448 offset = offset + len;
5451 /* 3GPP TS 29.060 version 9.4.0 Release 9
5452 * The two octets Container Length holds the length of the Container, excluding the Container Length octets.
5453 * Container contains one or several optional information elements as described in the clause "Overview", from the clause
5454 * "General message format and information elements coding" in 3GPP TS 24.008 [5]. For the definition of the IEI see
5455 * table 47a, "IEIs for information elements used in the container". The IMEISV shall, if available, be included in the
5456 * Container. The IMEISV is included in the Mobile identity IE. If Container is not included, its Length field value shall
5457 * be set to 0. If the MS is emergency attached and the MS is UICCless or the IMSI is unauthenticated, the International
5458 * Mobile Equipment Identity (IMEI) shall be used as the MS identity.
5460 * Table 47A: IEIs for information elements used in the container
5461 * IEI Information element
5462 * 0x23 Mobile identity
5464 * NOTE: In 3GPP TS 24.008 [5] the IEI definition is
5465 * message dependent. The table is added to
5466 * have a unique definition in the present
5467 * document for the used IEI in the MMcontext.
5470 con_len = tvb_get_ntohs(tvb, offset);
5471 proto_tree_add_item(ext_tree_mm, hf_gtp_container_length, tvb, offset, 2, ENC_BIG_ENDIAN);
5472 offset = offset + 2;
5474 if (con_len > 0) {
5475 proto_item* ti;
5477 con_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, con_len, ett_gtp_mm_cntxt, NULL, "Container");
5479 iei = tvb_get_uint8(tvb,offset);
5480 ti = proto_tree_add_uint(con_tree, hf_gtp_iei, tvb, offset, 1, iei);
5481 if (iei == 0x23) {
5482 proto_item_append_text(ti, " (Mobile identity)");
5483 offset++;
5484 len = tvb_get_uint8(tvb,offset);
5485 proto_tree_add_uint(con_tree, hf_gtp_iei_mobile_id_len, tvb, offset, 1, len);
5486 offset++;
5487 de_mid(tvb, con_tree, pinfo, offset, len, NULL, 0);
5488 } else {
5489 expert_add_info(pinfo, ti, &ei_gtp_iei);
5493 return 3 + length;
5496 /* Function to extract the value of an hexadecimal octet. Only the lower
5497 * nybble will be non-zero in the output.
5498 * */
5499 static uint8_t
5500 hex2dec(uint8_t x)
5502 /* XXX, ws_xton() */
5503 if ((x >= 'a') && (x <= 'f'))
5504 x = x - 'a' + 10;
5505 else if ((x >= 'A') && (x <= 'F'))
5506 x = x - 'A' + 10;
5507 else if ((x >= '0') && (x <= '9'))
5508 x = x - '0';
5509 else
5510 x = 0;
5511 return x;
5514 /* Wrapper function to add UTF-8 decoding for QoS attributes in
5515 * RADIUS messages.
5516 * */
5517 static uint8_t
5518 wrapped_tvb_get_uint8(tvbuff_t * tvb, int offset, int type)
5520 if (type == 2)
5521 return (hex2dec(tvb_get_uint8(tvb, offset)) << 4 | hex2dec(tvb_get_uint8(tvb, offset + 1)));
5522 else
5523 return tvb_get_uint8(tvb, offset);
5526 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
5527 * so type means length of length :-)
5529 * WARNING :) type does not mean length of length any more... see below for
5530 * type = 3!
5533 decode_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, const char * qos_str, uint8_t type)
5536 unsigned length;
5537 uint8_t al_ret_priority;
5538 uint8_t delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
5539 uint8_t traf_class, del_order, del_err_sdu;
5540 uint8_t max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext, max_ul_ext2 = 0, max_dl_ext2 = 0;
5541 uint8_t res_ber, sdu_err_ratio;
5542 uint8_t trans_delay, traf_handl_prio;
5543 uint8_t guar_ul, guar_dl, guar_ul_ext, guar_dl_ext, guar_ul_ext2 = 0, guar_dl_ext2 = 0;
5544 uint8_t src_stat_desc, sig_ind, spare4;
5545 proto_tree *ext_tree_qos;
5546 int mss, mu, md, gu, gd;
5547 uint8_t arp, qci;
5548 uint32_t apn_ambr;
5549 uint64_t br;
5551 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
5552 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
5553 * to one byte to be dissected).
5554 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
5555 * corresponds to one byte to be dissected)
5556 * */
5557 uint8_t utf8_type = 1;
5559 /* Will keep the release indicator as indicated in the RADIUS message */
5560 uint8_t rel_ind = 0;
5562 /* In RADIUS messages the QoS has a version field of two octets prepended.
5563 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
5564 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
5565 * inconsistent and unuseful, I will check hyphen presence here and
5566 * will signal its presence.
5567 * */
5568 uint8_t hyphen;
5570 /* Will keep the value that will be returned
5571 * */
5572 int retval = 0;
5574 switch (type) {
5575 case 0:
5576 /* For QoS inside GPRS-CDR messages from GGSN/P-GW */
5577 length = tvb_reported_length(tvb);
5578 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length, ett_gtp_qos, NULL, qos_str);
5579 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset, 1, length);
5580 /* QoS inside GPRS-CDR has no length octet, so no extra offset needed */
5581 retval = length;
5582 break;
5583 case 1:
5584 length = tvb_get_uint8(tvb, offset);
5585 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length + 1, ett_gtp_qos, NULL, qos_str);
5586 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset, 1, length);
5587 offset++;
5588 retval = length + 1;
5589 break;
5590 case 2:
5591 length = tvb_get_ntohs(tvb, offset + 1);
5592 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_qos, NULL, qos_str);
5593 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset + 1, 2, length);
5594 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
5595 retval = length + 3;
5596 break;
5597 case 3:
5598 /* For QoS inside RADIUS Client messages from GGSN/P-GW */
5599 utf8_type = 2;
5601 /* The field in the RADIUS message is the length of the tvb we were given */
5602 length = tvb_reported_length(tvb);
5603 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length, ett_gtp_qos, NULL, qos_str);
5605 rel_ind = wrapped_tvb_get_uint8(tvb, offset, 2);
5606 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, rel_ind);
5608 /* Hyphen handling */
5609 hyphen = tvb_get_uint8(tvb, offset + 2);
5610 if (hyphen == ((uint8_t) '-')) {
5611 /* Hyphen is present, put in protocol tree */
5612 proto_tree_add_item(ext_tree_qos, hf_gtp_hyphen_separator, tvb, offset + 2, 1, ENC_NA);
5613 offset++; /* "Get rid" of hyphen */
5616 /* Now, we modify offset here and in order to use type later
5617 * effectively.*/
5618 offset++;
5620 length -= offset;
5621 length /= 2; /* Binary length of encoded data. */
5623 /* Fake the length of the IE including the IE id and length octets
5624 * we are actually using it to determine presence of Octet n as counted
5625 * in TS 24.008
5628 retval = length + 2; /* Actually, will be ignored. */
5629 break;
5630 default:
5631 /* XXX - what should we do with the length here? */
5632 length = 0;
5633 retval = 0;
5634 ext_tree_qos = NULL;
5635 break;
5638 if ((type == 3) && (rel_ind >= 8) && (rel_ind < 98)) {
5639 /* Release 8 or higher P-GW QoS profile */
5640 static int * const arp_flags[] = {
5641 &hf_gtp_qos_arp_pci,
5642 &hf_gtp_qos_arp_pl,
5643 &hf_gtp_qos_arp_pvi,
5644 NULL
5647 offset++;
5648 arp = wrapped_tvb_get_uint8(tvb, offset, 2);
5649 proto_tree_add_bitmask_value_with_flags(ext_tree_qos, tvb, offset, hf_gtp_qos_arp,
5650 ett_gtp_qos_arp, arp_flags, arp, BMT_NO_APPEND);
5651 offset += 2;
5653 qci = wrapped_tvb_get_uint8(tvb, offset, 2);
5654 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_qci, tvb, offset, 2, qci);
5655 offset += 2;
5656 if (qci <= 4) {
5657 /* GBR QCI */
5658 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5659 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5660 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5661 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5662 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5663 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_mbr, tvb, offset, 10, br);
5664 offset += 10;
5665 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5666 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5667 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5668 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5669 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5670 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_mbr, tvb, offset, 10, br);
5671 offset += 10;
5672 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5673 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5674 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5675 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5676 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5677 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_gbr, tvb, offset, 10, br);
5678 offset += 10;
5679 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5680 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5681 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5682 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5683 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5684 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_gbr, tvb, offset, 10, br);
5685 } else {
5686 /* non GBR QCI */
5687 apn_ambr = (wrapped_tvb_get_uint8(tvb, offset , 2) << 24) |
5688 (wrapped_tvb_get_uint8(tvb, offset+2, 2) << 16) |
5689 (wrapped_tvb_get_uint8(tvb, offset+4, 2) << 8) |
5690 wrapped_tvb_get_uint8(tvb, offset+6, 2);
5691 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_ul_apn_ambr, tvb, offset, 8, apn_ambr);
5692 offset += 8;
5693 apn_ambr = (wrapped_tvb_get_uint8(tvb, offset , 2) << 24) |
5694 (wrapped_tvb_get_uint8(tvb, offset+2, 2) << 16) |
5695 (wrapped_tvb_get_uint8(tvb, offset+4, 2) << 8) |
5696 wrapped_tvb_get_uint8(tvb, offset+6, 2);
5697 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_dl_apn_ambr, tvb, offset, 8, apn_ambr);
5699 return retval;
5702 /* In RADIUS messages there is no allocation-retention priority
5703 * so I don't need to wrap the following call to tvb_get_uint8
5704 * */
5705 al_ret_priority = tvb_get_uint8(tvb, offset);
5707 /* All calls are wrapped to take into account the possibility that the
5708 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
5709 * of the offset will be the same as in the previous version of this
5710 * dissector, and the wrapped function will serve as a dumb wrapper;
5711 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
5712 * two bytes for needed shift, and the wrapped function will unencode
5713 * two values from the input.
5714 * */
5715 spare1 = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE1_MASK;
5716 delay = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DELAY_MASK;
5717 reliability = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RELIABILITY_MASK;
5718 peak = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PEAK_MASK;
5719 spare2 = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE2_MASK;
5720 precedence = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PRECEDENCE_MASK;
5721 spare3 = wrapped_tvb_get_uint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE3_MASK;
5722 mean = wrapped_tvb_get_uint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_MEAN_MASK;
5724 /* In RADIUS messages there is no allocation-retention priority */
5725 if (type != 3) {
5726 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
5727 } else {
5728 /* Add an octet to the binary data length to account for the
5729 * missing ARP so that the length tests below are correct.
5731 length += 1;
5734 /* All additions must take care of the fact that QoS fields in RADIUS
5735 * messages are UTF-8 encoded, so we have to use the same trick as above.
5736 * */
5737 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
5738 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
5739 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
5740 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
5741 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
5742 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
5743 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
5744 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
5746 /* TS 24.008 V 7.8.0 10.5.6.5 Quality of service
5747 * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
5748 * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
5749 * attributes specified in octets 6-14.
5750 * In the MS to network direction and in the network to MS direction the following applies:
5751 * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
5752 * be included.
5753 * - If octet 17 is included, then octet 18 shall also be included.
5754 * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
5755 * be accepted by the receiving entity.
5758 if (length > 4) {
5760 /* See above for the need of wrapping
5763 /* Octet 6 */
5764 traf_class = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_CLASS_MASK;
5765 del_order = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ORDER_MASK;
5766 del_err_sdu = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ERR_SDU_MASK;
5767 max_sdu_size = wrapped_tvb_get_uint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
5768 max_ul = wrapped_tvb_get_uint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
5769 max_dl = wrapped_tvb_get_uint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
5770 res_ber = wrapped_tvb_get_uint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RES_BER_MASK;
5771 sdu_err_ratio = wrapped_tvb_get_uint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SDU_ERR_RATIO_MASK;
5772 trans_delay = wrapped_tvb_get_uint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRANS_DELAY_MASK;
5773 traf_handl_prio = wrapped_tvb_get_uint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK;
5774 guar_ul = wrapped_tvb_get_uint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
5775 /* Octet 13 */
5776 guar_dl = wrapped_tvb_get_uint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
5778 spare4 = 0;
5779 sig_ind = 0;
5780 src_stat_desc = 0;
5781 max_dl_ext = 0;
5782 guar_dl_ext = 0;
5783 max_ul_ext = 0;
5784 guar_ul_ext = 0;
5786 if (length > 13 ||((type == 2) && (length == 13))) {
5787 spare4 = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE4_MASK;
5788 sig_ind = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SIG_IND_MASK;
5789 src_stat_desc = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SRC_STAT_DESC_MASK;
5791 if (length > 14) {
5792 max_dl_ext = wrapped_tvb_get_uint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
5793 guar_dl_ext = wrapped_tvb_get_uint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
5795 if (length > 16) {
5796 max_ul_ext = wrapped_tvb_get_uint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
5797 guar_ul_ext = wrapped_tvb_get_uint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
5799 if (length > 18) {
5800 max_dl_ext2 = wrapped_tvb_get_uint8(tvb, offset + (17 - 1) * utf8_type + 1, utf8_type);
5801 guar_dl_ext2 = wrapped_tvb_get_uint8(tvb, offset + (18 - 1) * utf8_type + 1, utf8_type);
5803 if (length > 20) {
5804 max_ul_ext2 = wrapped_tvb_get_uint8(tvb, offset + (19 - 1) * utf8_type + 1, utf8_type);
5805 guar_ul_ext2 = wrapped_tvb_get_uint8(tvb, offset + (20 - 1) * utf8_type + 1, utf8_type);
5809 * See above comments for the changes
5811 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
5812 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
5813 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_err_sdu, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_err_sdu);
5814 if (max_sdu_size == 0 || max_sdu_size > 150)
5815 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, max_sdu_size);
5816 if ((max_sdu_size > 0) && (max_sdu_size <= 150)) {
5817 mss = max_sdu_size * 10;
5818 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss,
5819 "%u octets", mss);
5822 if (max_ul == 0 || max_ul == 255)
5823 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
5824 if ((max_ul > 0) && (max_ul <= 63))
5825 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul,
5826 "%u kbps", max_ul);
5827 if ((max_ul > 63) && (max_ul <= 127)) {
5828 mu = 64 + (max_ul - 64) * 8;
5829 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
5830 "%u kbps", mu);
5833 if ((max_ul > 127) && (max_ul <= 254)) {
5834 mu = 576 + (max_ul - 128) * 64;
5835 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
5836 "%u kbps", mu);
5839 if (max_dl == 0 || max_dl == 255)
5840 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
5841 if ((max_dl > 0) && (max_dl <= 63))
5842 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl,
5843 "%u kbps", max_dl);
5844 if ((max_dl > 63) && (max_dl <= 127)) {
5845 md = 64 + (max_dl - 64) * 8;
5846 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
5847 "%u kbps", md);
5849 if ((max_dl > 127) && (max_dl <= 254)) {
5850 md = 576 + (max_dl - 128) * 64;
5851 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
5852 "%u kbps", md);
5855 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
5856 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_sdu_err_ratio, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, sdu_err_ratio);
5857 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
5858 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_handl_prio, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, traf_handl_prio);
5860 if (guar_ul == 0 || guar_ul == 255)
5861 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
5862 if ((guar_ul > 0) && (guar_ul <= 63))
5863 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul,
5864 "%u kbps", guar_ul);
5865 if ((guar_ul > 63) && (guar_ul <= 127)) {
5866 gu = 64 + (guar_ul - 64) * 8;
5867 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
5868 "%u kbps", gu);
5870 if ((guar_ul > 127) && (guar_ul <= 254)) {
5871 gu = 576 + (guar_ul - 128) * 64;
5872 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
5873 "%u kbps", gu);
5876 /* Octet 13 */
5877 if (guar_dl == 0 || guar_dl == 255)
5878 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
5879 if ((guar_dl > 0) && (guar_dl <= 63))
5880 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl,
5881 "%u kbps", guar_dl);
5882 if ((guar_dl > 63) && (guar_dl <= 127)) {
5883 gd = 64 + (guar_dl - 64) * 8;
5884 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
5885 "%u kbps", gd);
5887 if ((guar_dl > 127) && (guar_dl <= 254)) {
5888 gd = 576 + (guar_dl - 128) * 64;
5889 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
5890 "%u kbps", gd);
5893 if(length > 13 ||((type == 2) && (length == 13))) {
5894 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare4, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, spare4);
5895 proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
5896 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_src_stat_desc, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, src_stat_desc);
5900 if(length > 14) {
5901 /* Octet 15 */
5902 if(max_dl_ext == 0)
5903 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type,
5904 "Ext Maximum bit rate for downlink: Use the value in octet 9");
5905 if ((max_dl_ext > 0) && (max_dl_ext <= 0x4a)) {
5906 md = 8600 + max_dl_ext * 100;
5907 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5908 "Ext Maximum bit rate for downlink: %u kbps", md);
5910 if ((max_dl_ext > 0x4a) && (max_dl_ext <= 0xba)) {
5911 md = 16 + (max_dl_ext-0x4a);
5912 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5913 "Ext Maximum bit rate for downlink: %u Mbps", md);
5915 if ((max_dl_ext > 0xba) && (max_dl_ext <= 0xfa)) {
5916 md = 128 + (max_dl_ext-0xba)*2;
5917 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5918 "Ext Maximum bit rate for downlink: %u Mbps", md);
5920 /* Octet 16 */
5921 if(guar_dl_ext == 0)
5922 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_guaranteed_bit_rate_value, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type,
5923 "Ext Guaranteed bit rate for downlink: Use the value in octet 13");
5924 if ((guar_dl_ext > 0) && (guar_dl_ext <= 0x4a)) {
5925 gd = 8600 + guar_dl_ext * 100;
5926 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5927 "Ext Guaranteed bit rate for downlink: %u kbps", gd);
5929 if ((guar_dl_ext > 0x4a) && (guar_dl_ext <= 0xba)) {
5930 gd = 16 + (guar_dl_ext-0x4a);
5931 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5932 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
5934 if ((guar_dl_ext > 0xba) && (guar_dl_ext <= 0xfa)) {
5935 gd = 128 + (guar_dl_ext-0xba)*2;
5936 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5937 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
5941 if(length > 16) {
5942 /* Octet 17
5943 * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
5944 * rate for downlink (extended).
5946 if (max_ul_ext == 0)
5947 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type,
5948 "Ext Maximum bit rate for uplink: Use the value indicated in octet 8");
5949 if ((max_ul_ext > 0) && (max_ul_ext <= 0x4a)) {
5950 md = 8600 + max_ul_ext * 100;
5951 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5952 "Ext Maximum bit rate for uplink: %u kbps", md);
5954 if ((max_ul_ext > 0x4a) && (max_ul_ext <= 0xba)) {
5955 md = 16 + (max_ul_ext-0x4a);
5956 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5957 "Ext Maximum bit rate for uplink: %u Mbps", md);
5959 if ((max_ul_ext > 0xba) && (max_ul_ext <= 0xfa)) {
5960 md = 128 + (max_ul_ext-0xba)*2;
5961 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5962 "Ext Maximum bit rate for uplink: %u Mbps", md);
5964 /* Octet 18 */
5965 if (guar_ul_ext == 0)
5966 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_guaranteed_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
5967 "Ext Guaranteed bit rate for uplink: Use the value indicated in octet 12");
5968 if ((guar_ul_ext > 0) && (guar_ul_ext <= 0x4a)) {
5969 gd = 8600 + guar_ul_ext * 100;
5970 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
5971 "Ext Guaranteed bit rate for uplink: %u kbps", gd);
5973 if ((guar_ul_ext > 0x4a) && (guar_ul_ext <= 0xba)) {
5974 gd = 16 + (guar_ul_ext-0x4a);
5975 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
5976 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
5978 if ((guar_ul_ext > 0xba) && (guar_ul_ext <= 0xfa)) {
5979 gd = 128 + (guar_ul_ext-0xba)*2;
5980 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
5981 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
5985 if(length > 18) {
5986 /* Octet 19 Maximum bit rate for downlink (extended-2)
5987 * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
5988 * rate for downlink (extended).
5990 if (max_dl_ext2 == 0)
5991 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (17 - 1) * utf8_type + 1, utf8_type,
5992 "Ext2 Maximum bit rate for downlink: Use the value in octet 9 and octet 15.");
5994 if ((max_dl_ext2 > 0) && (max_dl_ext2 <= 0x3d)) {
5995 md = 256 + max_dl_ext2 * 4;
5996 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5997 "Ext2 Maximum bit rate for downlink: %u Mbps", md);
5999 if ((max_dl_ext2 > 0x3d) && (max_dl_ext2 <= 0xa1)) {
6000 md = 500 + (max_dl_ext2-0x3d) * 10;
6001 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6002 "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6004 if ((max_dl_ext2 > 0xa1) && (max_dl_ext2 <= 0xf6)) {
6005 md = 1500 + (max_dl_ext2-0xa1)*10;
6006 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6007 "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6009 /* Octet 20 Guaranteed bit rate for downlink (extended-2) */
6010 if (guar_dl_ext2 == 0)
6011 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
6012 "Ext2 Guaranteed bit rate for downlink: Use the value in octet 13 and octet 16.");
6013 if ((guar_dl_ext2 > 0) && (guar_dl_ext2 <= 0x3d)) {
6014 gd = 256 + guar_dl_ext2 * 4;
6015 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6016 "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6018 if ((guar_dl_ext2 > 0x3d) && (guar_dl_ext2 <= 0xa1)) {
6019 gd = 500 + (guar_dl_ext2-0x3d) * 10;
6020 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6021 "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6023 if ((guar_dl_ext2 > 0xba) && (guar_dl_ext2 <= 0xfa)) {
6024 gd = 1500 + (guar_dl_ext2-0xa1) * 10;
6025 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6026 "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6030 if(length > 20) {
6031 /* Maximum bit rate for uplink (extended-2), octet 21
6032 * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
6033 * rate for downlink (extended).
6035 if (max_ul_ext2 == 0)
6036 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (17 - 1) * utf8_type + 1, utf8_type,
6037 "Ext2 Maximum bit rate for uplink: Use the value in octet 8 and octet 17.");
6039 if ((max_ul_ext2 > 0) && (max_ul_ext2 <= 0x3d)) {
6040 md = 256 + max_ul_ext2 * 4;
6041 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6042 "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6044 if ((max_ul_ext2 > 0x3d) && (max_ul_ext2 <= 0xa1)) {
6045 md = 500 + (max_ul_ext2-0x3d) * 10;
6046 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6047 "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6049 if ((max_ul_ext2 > 0xa1) && (max_ul_ext2 <= 0xf6)) {
6050 md = 1500 + (max_ul_ext2-0xa1)*10;
6051 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6052 "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6054 /* Guaranteed bit rate for uplink (extended-2), octet 22 */
6055 if (guar_ul_ext2 == 0)
6056 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
6057 "Ext2 Guaranteed bit rate for uplink: Use the value in octet 13 and octet 16.");
6058 if ((guar_ul_ext2 > 0) && (guar_ul_ext2 <= 0x3d)) {
6059 gd = 256 + guar_ul_ext2 * 4;
6060 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6061 "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6063 if ((guar_ul_ext2 > 0x3d) && (guar_ul_ext2 <= 0xa1)) {
6064 gd = 500 + (guar_ul_ext2-0x3d) * 10;
6065 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6066 "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6068 if ((guar_ul_ext2 > 0xba) && (guar_ul_ext2 <= 0xfa)) {
6069 gd = 1500 + (guar_ul_ext2-0xa1) * 10;
6070 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6071 "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6076 return retval;
6079 /* Diameter 3GPP AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
6080 static int
6081 dissect_diameter_3gpp_qosprofile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
6083 decode_qos_umts(tvb, 0, pinfo, tree, "UMTS GTP QoS Profile", 3);
6084 return tvb_reported_length(tvb);
6087 static const char *
6088 dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo)
6090 decode_qos_umts(tvb, 0, pinfo, tree, "UMTS GTP QoS Profile", 3);
6091 return tvb_get_string_enc(pinfo->pool, tvb, 0, tvb_reported_length(tvb), ENC_UTF_8|ENC_NA);
6094 static void
6095 decode_apn(packet_info *pinfo, tvbuff_t * tvb, int offset, uint16_t length, proto_tree * tree, proto_item *item)
6097 const uint8_t *apn = NULL;
6100 * This is "a domain name represented as a sequence of labels, where
6101 * each label consists of a length octet followed by that number of
6102 * octets.", DNS-style.
6104 * XXX - does it involve compression?
6107 /* Highlight bytes including the first length byte */
6108 proto_tree_add_item_ret_string(tree, hf_gtp_apn, tvb, offset, length, ENC_APN_STR, pinfo->pool, &apn);
6109 if(item){
6110 proto_item_append_text(item, ": %s", apn);
6115 static void
6116 decode_fqdn(tvbuff_t * tvb, int offset, uint16_t length, proto_tree * tree, session_args_t * args _U_)
6118 int name_len;
6120 /* "The FQDN field encoding shall be identical to the encoding of a FQDN
6121 * within a DNS message of clause 3.1 of IETF RFC 1035 [45] but excluding
6122 * the trailing zero byte"
6124 * XXX: is compression possible?
6126 if (length > 0) {
6127 name_len = tvb_get_uint8(tvb, offset);
6129 /* "NOTE 1: The FQDN field in the IE is not encoded as a dotted string"
6130 * but if the first byte is large (in the letter range or higher),
6131 * assume that it is so encoded incorrectly.
6133 if (name_len < 0x40) {
6134 proto_tree_add_item(tree, hf_gtp_fqdn, tvb, offset, length, ENC_APN_STR);
6135 } else
6136 proto_tree_add_item(tree, hf_gtp_fqdn, tvb, offset, length, ENC_ASCII);
6141 * GPRS: 9.60 v7.6.0, chapter 7.9.20
6142 * UMTS: 29.060 v4.0, chapter 7.7.29 PDP Context
6143 * TODO: unify addr functions
6145 static int
6146 decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6149 uint8_t ggsn_addr_len, apn_len, trans_id, ea;
6150 uint8_t pdp_type_num, pdp_addr_len;
6151 uint16_t length;
6152 proto_tree *ext_tree_pdp;
6154 length = tvb_get_ntohs(tvb, offset + 1);
6156 ext_tree_pdp = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_PDP_CNTXT], NULL,
6157 val_to_str_ext_const(GTP_EXT_PDP_CNTXT, &gtp_val_ext, "Unknown message"));
6159 ea = (tvb_get_uint8(tvb, offset + 3) >> 7) & 0x01;
6161 proto_tree_add_item(ext_tree_pdp, hf_gtp_extended_end_user_address, tvb, offset + 3, 1, ENC_NA);
6162 proto_tree_add_item(ext_tree_pdp, hf_gtp_vplmn_address_allowed, tvb, offset + 3, 1, ENC_NA);
6163 proto_tree_add_item(ext_tree_pdp, hf_gtp_activity_status_indicator, tvb, offset + 3, 1, ENC_NA);
6164 proto_tree_add_item(ext_tree_pdp, hf_gtp_reordering_required, tvb, offset + 3, 1, ENC_NA);
6165 proto_tree_add_item(ext_tree_pdp, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6166 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_cntxt_sapi, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6168 switch (gtp_version) {
6169 case 0:
6170 decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
6171 decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
6172 decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
6173 offset = offset + 14;
6174 break;
6175 case 1:
6176 offset = offset + 5;
6177 offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS subscribed", 1);
6178 offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS requested", 1);
6179 offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS negotiated", 1);
6180 break;
6181 default:
6182 break;
6185 proto_tree_add_item(ext_tree_pdp, hf_gtp_sequence_number_down, tvb, offset, 2, ENC_BIG_ENDIAN);
6186 proto_tree_add_item(ext_tree_pdp, hf_gtp_sequence_number_up, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6187 proto_tree_add_item(ext_tree_pdp, hf_gtp_send_n_pdu_number, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6188 proto_tree_add_item(ext_tree_pdp, hf_gtp_receive_n_pdu_number, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6190 switch (gtp_version) {
6191 case 0:
6192 proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_flow_label_signalling, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6193 offset = offset + 8;
6194 break;
6195 case 1:
6196 proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_teid_cp, tvb, offset + 6, 4, ENC_BIG_ENDIAN);
6197 proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_teid_data, tvb, offset + 10, 4, ENC_BIG_ENDIAN);
6198 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_context_identifier, tvb, offset + 14, 1, ENC_BIG_ENDIAN);
6199 offset = offset + 15;
6200 break;
6201 default:
6202 break;
6205 pdp_type_num = tvb_get_uint8(tvb, offset + 1);
6206 pdp_addr_len = tvb_get_uint8(tvb, offset + 2);
6208 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_organization, tvb, offset, 1, ENC_BIG_ENDIAN);
6209 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
6210 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_length, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6212 if (pdp_addr_len > 0) {
6213 switch (pdp_type_num) {
6214 case 0x21:
6215 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6216 break;
6217 case 0x57:
6218 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv6, tvb, offset + 3, 16, ENC_NA);
6219 break;
6220 default:
6221 break;
6225 offset = offset + 3 + pdp_addr_len;
6227 ggsn_addr_len = tvb_get_uint8(tvb, offset);
6228 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6230 switch (ggsn_addr_len) {
6231 case 4:
6232 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_control_plane_ipv4, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
6233 break;
6234 case 16:
6235 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_control_plane_ipv6, tvb, offset + 1, 16, ENC_NA);
6236 break;
6237 default:
6238 break;
6241 offset = offset + 1 + ggsn_addr_len;
6243 if (gtp_version == 1) {
6245 ggsn_addr_len = tvb_get_uint8(tvb, offset);
6246 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6248 switch (ggsn_addr_len) {
6249 case 4:
6250 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_user_traffic_ipv4, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
6251 break;
6252 case 16:
6253 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_user_traffic_ipv6, tvb, offset + 1, 16, ENC_NA);
6254 break;
6255 default:
6256 break;
6258 offset = offset + 1 + ggsn_addr_len;
6262 apn_len = tvb_get_uint8(tvb, offset);
6263 proto_tree_add_item(ext_tree_pdp, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6264 decode_apn(pinfo, tvb, offset + 1, apn_len, ext_tree_pdp, NULL);
6266 offset = offset + 1 + apn_len;
6268 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
6269 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
6270 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
6271 * MS is stored in the PDP context IE.
6272 * NOTE: Bit 5-8 of the first octet in the encoding defined in 3GPP TS 24.007 [3] is mapped into bit 1-4 of the first
6273 * octet in this field.
6275 trans_id = tvb_get_uint8(tvb, offset);
6276 proto_tree_add_uint(ext_tree_pdp, hf_gtp_transaction_identifier, tvb, offset, 2, trans_id);
6277 offset += 2;
6279 if (ea) {
6280 pdp_type_num = tvb_get_uint8(tvb, offset);
6281 pdp_addr_len = tvb_get_uint8(tvb, offset + 1);
6283 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_type, tvb, offset, 1, ENC_BIG_ENDIAN);
6284 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_length, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
6286 if (pdp_addr_len > 0) {
6287 switch (pdp_type_num) {
6288 case 0x21:
6289 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv4, tvb, offset + 2, 4, ENC_NA);
6290 break;
6291 case 0x57:
6292 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv6, tvb, offset + 2, 16, ENC_NA);
6293 break;
6294 default:
6295 break;
6300 return 3 + length;
6303 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
6304 * UMTS: 29.060, v4.0, chapter 7.7.30
6306 static int
6307 decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6310 uint16_t length;
6311 proto_tree *ext_tree_apn;
6312 proto_item *te;
6314 length = tvb_get_ntohs(tvb, offset + 1);
6316 ext_tree_apn = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_APN], &te,
6317 val_to_str_ext_const(GTP_EXT_APN, &gtp_val_ext, "Unknown field"));
6319 proto_tree_add_item(ext_tree_apn, hf_gtp_apn_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6320 decode_apn(pinfo, tvb, offset + 3, length, ext_tree_apn, te);
6322 return 3 + length;
6325 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
6326 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
6327 * UMTS: 29.060 v4.0, chapter 7.7.31 Protocol Configuration Options
6328 * 24.008, v4.2, chapter 10.5.6.3
6331 decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6334 uint16_t length;
6335 tvbuff_t *next_tvb;
6336 proto_tree *ext_tree_proto;
6338 length = tvb_get_ntohs(tvb, offset + 1);
6340 ext_tree_proto = proto_tree_add_subtree(tree, tvb, offset, length + 3,
6341 ett_gtp_proto, NULL, val_to_str_ext_const(GTP_EXT_PROTO_CONF, &gtp_val_ext, "Unknown message"));
6343 proto_tree_add_uint(ext_tree_proto, hf_gtp_length, tvb, offset + 1, 2, length);
6345 if (length < 1)
6346 return 3;
6348 /* The Protocol Configuration Options contains external network protocol options that may be necessary to transfer
6349 * between the GGSN and the MS. The content and the coding of the Protocol Configuration are defined in octet 3-z of the
6350 * Protocol Configuration Options in3GPP TS 24.008 [5].
6352 next_tvb = tvb_new_subset_length(tvb, offset + 3, length);
6353 de_sm_pco(next_tvb, ext_tree_proto, pinfo, 0, length, NULL, 0);
6355 return 3 + length;
6358 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
6359 * UMTS: 29.060 v4.0, chapter 7.7.32
6361 static int
6362 decode_gtp_gsn_addr_common(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args, const char * tree_name, int hf_ipv4, int hf_ipv6)
6365 uint8_t addr_type, addr_len;
6366 uint16_t length;
6367 proto_tree *ext_tree_gsn_addr;
6368 proto_item *te;
6369 address *gsn_address;
6371 length = tvb_get_ntohs(tvb, offset + 1);
6373 ext_tree_gsn_addr = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_gsn_addr, &te, "%s : ", tree_name);
6374 gsn_address = wmem_new0(pinfo->pool, address);
6375 switch (length) {
6376 case 4:
6377 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6378 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6379 if (hf_ipv4 != hf_gtp_gsn_ipv4)
6380 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN));
6381 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
6382 set_address_tvb(gsn_address, AT_IPv4, 4, tvb, offset + 3);
6383 break;
6384 case 5:
6385 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_information_element_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6386 addr_type = tvb_get_uint8(tvb, offset + 3) & 0xC0;
6387 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
6388 addr_len = tvb_get_uint8(tvb, offset + 3) & 0x3F;
6389 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
6390 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv4, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6391 if (hf_ipv4 != hf_gtp_gsn_ipv4)
6392 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, ENC_BIG_ENDIAN));
6393 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 4));
6394 set_address_tvb(gsn_address, AT_IPv6, 16, tvb, offset + 4);
6395 break;
6396 case 16:
6397 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6398 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv6, tvb, offset + 3, 16, ENC_NA);
6399 if (hf_ipv6 != hf_gtp_gsn_ipv6)
6400 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, ENC_NA));
6401 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
6402 set_address_tvb(gsn_address, AT_IPv4, 4, tvb, offset + 3);
6403 break;
6404 case 17:
6405 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_information_element_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6406 addr_type = tvb_get_uint8(tvb, offset + 3) & 0xC0;
6407 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
6408 addr_len = tvb_get_uint8(tvb, offset + 3) & 0x3F;
6409 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
6410 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 4));
6411 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv6, tvb, offset + 4, 16, ENC_NA);
6412 if (hf_ipv6 != hf_gtp_gsn_ipv6)
6413 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, ENC_NA));
6414 set_address_tvb(gsn_address, AT_IPv6, 16, tvb, offset + 4);
6415 break;
6416 default:
6417 proto_item_append_text(te, "unknown type or wrong length");
6418 break;
6421 if (g_gtp_session && gtp_version == 1 && !PINFO_FD_VISITED(pinfo)) {
6422 if (!ip_exists(*gsn_address, args->ip_list)) {
6423 copy_address_wmem(pinfo->pool, &args->last_ip, gsn_address);
6424 wmem_list_prepend(args->ip_list, gsn_address);
6427 return 3 + length;
6430 static int
6431 decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args) {
6432 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args, "GSN address", hf_gtp_gsn_ipv4, hf_gtp_gsn_ipv6);
6435 static int
6436 decode_gtp_sgsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6438 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6439 "SGSN Address for control plane", hf_gtp_sgsn_address_for_control_plane_ipv4, hf_gtp_sgsn_address_for_control_plane_ipv6);
6442 static int
6443 decode_gtp_sgsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6445 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6446 "SGSN Address for user traffic", hf_gtp_sgsn_address_for_user_traffic_ipv4, hf_gtp_sgsn_address_for_user_traffic_ipv6);
6449 static int
6450 decode_gtp_ggsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6452 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6453 "GGSN Address for control plane", hf_gtp_ggsn_address_for_control_plane_ipv4, hf_gtp_ggsn_address_for_control_plane_ipv6);
6456 static int
6457 decode_gtp_ggsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6459 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6460 "GGSN Address for user traffic", hf_gtp_ggsn_address_for_user_traffic_ipv4, hf_gtp_ggsn_address_for_user_traffic_ipv6);
6463 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
6464 * UMTS: 29.060 v4.0, chapter 7.7.33
6466 static int
6467 decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6469 uint16_t length;
6470 tvbuff_t *next_tvb;
6471 proto_tree *ext_tree_proto;
6473 length = tvb_get_ntohs(tvb, offset + 1);
6475 ext_tree_proto = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_proto, NULL,
6476 val_to_str_ext_const(GTP_EXT_MSISDN, &gtp_val_ext, "Unknown message"));
6478 proto_tree_add_uint(ext_tree_proto, hf_gtp_length, tvb, offset + 1, 2, length);
6480 length = tvb_get_ntohs(tvb, offset + 1);
6482 if (length < 1)
6483 return 3;
6485 next_tvb = tvb_new_subset_length(tvb, offset+3, length);
6486 dissect_gsm_map_msisdn(next_tvb, pinfo, ext_tree_proto);
6488 return 3 + length;
6491 /* GPRS: not present
6492 * UMTS: 29.060 v4.0, chapter 7.7.34
6493 * 24.008 v4.2, chapter 10.5.6.5
6495 static int
6496 decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6499 return decode_qos_umts(tvb, offset, pinfo, tree, "Quality of Service", 2);
6502 /* GPRS: not present
6503 * UMTS: 29.060 v4.0, chapter 7.7.35
6505 static int
6506 decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6509 proto_tree *ext_tree;
6510 uint16_t length;
6511 uint8_t xres_len, auth_len;
6514 length = tvb_get_ntohs(tvb, offset + 1);
6516 ext_tree = proto_tree_add_subtree(tree, tvb, offset, length + 1, ett_gtp_quint, NULL, "Quintuplet");
6517 offset++;
6519 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6520 offset = offset + 2;
6522 proto_tree_add_item(ext_tree, hf_gtp_rand, tvb, offset, 16, ENC_NA);
6523 offset = offset + 16;
6524 xres_len = tvb_get_uint8(tvb, offset);
6525 proto_tree_add_item(ext_tree, hf_gtp_xres_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6526 offset++;
6527 proto_tree_add_item(ext_tree, hf_gtp_xres, tvb, offset, xres_len, ENC_NA);
6528 offset = offset + xres_len;
6529 proto_tree_add_item(ext_tree, hf_gtp_quintuplet_ciphering_key, tvb, offset, 16, ENC_NA);
6530 offset = offset + 16;
6531 proto_tree_add_item(ext_tree, hf_gtp_quintuplet_integrity_key, tvb, offset, 16, ENC_NA);
6532 offset = offset + 16;
6533 auth_len = tvb_get_uint8(tvb, offset);
6534 proto_tree_add_item(ext_tree, hf_gtp_authentication_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6535 offset++;
6536 proto_tree_add_item(ext_tree, hf_gtp_auth, tvb, offset, auth_len, ENC_NA);
6538 return (3 + length);
6542 /* GPRS: not present
6543 * UMTS: 29.060 v4.0, chapter 7.7.36
6544 * 24.008 v4.2, chapter 10.5.6.12
6546 static int
6547 decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6549 proto_tree *ext_tree_tft;
6550 unsigned length;
6552 length = tvb_get_ntohs(tvb, offset + 1);
6554 ext_tree_tft = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_tft, NULL, "Traffic flow template");
6555 proto_tree_add_item(ext_tree_tft, hf_gtp_tft_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6557 /* The detailed coding of Traffic Flow Template
6558 * Description is specified in 3GPP TS 24.008 [5] ,
6559 * clause 10.5.6.12, beginning with octet 3..
6560 * Use the decoding in packet-gsm_a_gm.c
6562 de_sm_tflow_temp(tvb, ext_tree_tft, pinfo, offset + 3, length, NULL, 0);
6564 return 3 + length;
6567 /* GPRS: not present
6568 * UMTS: 3GPP TS 29.060 version 10.4.0 Release 10, chapter 7.7.37
6569 * Type = 138 (Decimal)
6570 * 25.413(RANAP) TargetID
6571 * There are several CRs to this IE make sure to check with a recent spec if dissection is questioned.
6573 static int
6574 decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6577 uint16_t length;
6578 proto_tree *ext_tree;
6581 length = tvb_get_ntohs(tvb, offset + 1);
6583 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_TARGET_ID], NULL, "Target Identification");
6584 offset = offset + 1;
6585 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6586 offset = offset + 2;
6587 if (length == 0){
6588 return 3 + length;
6591 /* Quote from specification:
6592 * The Target Identification information element contains the identification of a target RNC. Octets 4-n shall contain a
6593 * non-transparent copy of the corresponding IEs (see subclause 7.7.2) and be encoded as specified in Figure 51 below.
6594 * The "Target RNC-ID" part of the "Target ID" parameter is specified in 3GPP TS 25.413 [7].
6595 * NOTE 1: The ASN.1 parameter "Target ID" is forwarded non-transparently in order to maintain backward compatibility.
6596 * NOTE 2: The preamble of the "Target RNC-ID" (numerical value of e.g. 0x20) however shall not be included in
6597 * octets 4-n. Also the optional "iE-Extensions" parameter shall not be included into the GTP IE.
6599 /* Octet 4-6 MCC + MNC */
6600 if (length == 9) {
6601 /* Patch for systems still not following NOTE 2 */
6602 proto_tree_add_expert_format(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, 1, "Not Compliant with 3GPP TS 29.060 7.7.37: The preamble of the \"Target RNC-ID\" (numerical value of e.g. 0x20) however shall not be included in octets 4-n.");
6603 offset+=1;
6604 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, false);
6605 } else {
6606 /* Following Standards */
6607 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
6609 offset+=3;
6611 /* Octet 7-8 LAC */
6612 proto_tree_add_item(ext_tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
6613 offset+=2;
6614 /* Octet 9 RAC */
6615 proto_tree_add_item(ext_tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
6616 offset++;
6617 /* Octet 10-11 RNC-ID*/
6618 proto_tree_add_item(ext_tree, hf_gtp_target_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
6619 offset+=2;
6620 /* If the optional Extended RNC-ID is not included, then the length variable 'n' = 8 and the overall length of the IE is 11
6621 * octets. Otherwise, 'n' = 10 and the overall length of the IE is 13 octets
6623 if(length == 10){
6624 proto_tree_add_item(ext_tree, hf_gtp_target_ext_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
6627 return 3 + length;
6631 /* GPRS: not present
6632 * UMTS: 29.060 v4.0, chapter 7.7.38
6634 static int
6635 decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6638 uint16_t length;
6639 proto_tree *ext_tree;
6640 tvbuff_t *new_tvb;
6641 proto_tree *sub_tree;
6643 length = tvb_get_ntohs(tvb, offset + 1);
6645 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UTRAN_CONT], NULL, "UTRAN transparent Container");
6647 offset = offset + 1;
6648 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6649 offset = offset + 2;
6650 proto_tree_add_item(ext_tree, hf_gtp_utran_field, tvb, offset, length, ENC_NA);
6651 if (length == 0) {
6652 return 3;
6655 switch (pinfo->link_dir) {
6656 case P2P_DIR_UL:
6657 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_utran_cont, NULL, "Source RNC to Target RNC Transparent Container");
6658 new_tvb = tvb_new_subset_length(tvb, offset, length);
6659 dissect_ranap_SourceRNC_ToTargetRNC_TransparentContainer_PDU(new_tvb, pinfo, sub_tree, NULL);
6660 break;
6661 case P2P_DIR_DL:
6662 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_utran_cont, NULL, "Target RNC to Source RNC Transparent Container");
6663 new_tvb = tvb_new_subset_length(tvb, offset, length);
6664 dissect_ranap_TargetRNC_ToSourceRNC_TransparentContainer_PDU(new_tvb, pinfo, sub_tree, NULL);
6665 break;
6666 default:
6667 break;
6670 return 3 + length;
6675 /* GPRS: not present
6676 * UMTS: 29.060 v4.0, chapter 7.7.39
6678 static int
6679 decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6682 uint32_t teid;
6683 uint16_t length;
6684 proto_tree *ext_tree_rab_setup;
6686 length = tvb_get_ntohs(tvb, offset + 1);
6688 ext_tree_rab_setup = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_rab_setup, NULL, "Radio Access Bearer Setup Information");
6690 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rab_setup_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6691 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6693 if (length > 1) {
6695 teid = tvb_get_ntohl(tvb, offset + 4);
6697 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
6699 switch (length) {
6700 case 9:
6701 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6702 break;
6703 case 21:
6704 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, ENC_NA);
6705 break;
6706 default:
6707 break;
6711 return 3 + length;
6715 /* GPRS: not present
6716 * UMTS: 29.060 v4.0, chapter 7.7.40
6718 static int
6719 decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6722 int i;
6723 uint8_t length, hdr;
6724 proto_tree *ext_tree_hdr_list;
6726 length = tvb_get_uint8(tvb, offset + 1);
6728 ext_tree_hdr_list = proto_tree_add_subtree(tree, tvb, offset, 2 + length, ett_gtp_hdr_list, NULL,
6729 val_to_str_ext_const(GTP_EXT_HDR_LIST, &gtp_val_ext, "Unknown"));
6731 proto_tree_add_item(ext_tree_hdr_list, hf_gtp_num_ext_hdr_types, tvb, offset + 1, 1, ENC_NA);
6733 for (i = 0; i < length; i++) {
6734 hdr = tvb_get_uint8(tvb, offset + 2 + i);
6736 proto_tree_add_uint_format(ext_tree_hdr_list, hf_gtp_ext_hdr_type, tvb, offset + 2 + i, 1, hdr, "No. %u --> Extension Header Type value : %s (0x%02x)", i + 1,
6737 val_to_str_const(hdr, next_extension_header_fieldvals, "Unknown Extension Header Type"), hdr);
6740 return 2 + length;
6743 /* GPRS: not present
6744 * UMTS: 29.060 v4.0, chapter 7.7.41
6745 * TODO: find TriggerID description
6747 static int
6748 decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6750 uint16_t length;
6751 proto_item* ti;
6753 length = tvb_get_ntohs(tvb, offset + 1);
6755 ti = proto_tree_add_uint_format(tree, hf_gtp_ext_length, tvb, offset, 2, length, "%s length : %u",
6756 val_to_str_ext_const(GTP_EXT_TRIGGER_ID, &gtp_val_ext, "Unknown"), length);
6757 proto_item_set_len(ti, 3 + length);
6759 return 3 + length;
6763 /* GPRS: not present
6764 * UMTS: 29.060 v4.0, chapter 7.7.42
6765 * TODO: find OMC-ID description
6767 static int
6768 decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6770 uint16_t length;
6771 proto_item* ti;
6773 length = tvb_get_ntohs(tvb, offset + 1);
6775 ti = proto_tree_add_uint_format(tree, hf_gtp_ext_length, tvb, offset, 2, length, "%s length : %u",
6776 val_to_str_ext_const(GTP_EXT_OMC_ID, &gtp_val_ext, "Unknown"), length);
6777 proto_item_set_len(ti, 3 + length);
6779 return 3 + length;
6783 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
6784 * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
6786 static int
6787 decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6790 uint16_t length;
6791 proto_tree *ext_tree_chrg_addr;
6792 proto_item *te;
6794 length = tvb_get_ntohs(tvb, offset + 1);
6796 ext_tree_chrg_addr = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CHRG_ADDR], &te,
6797 "%s : ", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"));
6799 proto_tree_add_uint_format(ext_tree_chrg_addr, hf_gtp_ext_length, tvb, offset + 1, 2, length,
6800 "%s length : %u", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"), length);
6802 switch (length) {
6803 case 4:
6804 proto_tree_add_item(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6805 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
6806 break;
6807 case 16:
6808 proto_tree_add_item(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, ENC_NA);
6809 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
6810 break;
6811 default:
6812 proto_item_append_text(te, "unknown type or wrong length");
6813 break;
6816 return 3 + length;
6819 /* GPRS: ?
6820 * UMTS: 29.060 V9.4.0, chapter 7.7.43 RAN Transparent Container
6821 * The information in the value part of the RAN Transparent Container IE contains all information elements (starting with
6822 * and including the BSSGP "PDU Type") in either of the RAN INFORMATION, RAN INFORMATION REQUEST,
6823 * RAN INFORMATION ACK or RAN INFORMATION ERROR messages respectively as specified in 3GPP TS 48.018
6825 static int
6826 decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6829 uint16_t length;
6830 proto_tree *ext_tree;
6831 tvbuff_t *next_tvb;
6833 length = tvb_get_ntohs(tvb, offset + 1);
6834 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RAN_TR_CONT], NULL,
6835 "%s : ", val_to_str_ext_const(GTP_EXT_RAN_TR_CONT, &gtp_val_ext, "Unknown"));
6837 offset++;
6838 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6839 offset = offset + 2;
6841 next_tvb = tvb_new_subset_length(tvb, offset, length);
6842 if (bssgp_handle) {
6843 #if 0
6844 col_set_fence(pinfo->cinfo, COL_INFO);
6845 #endif
6846 call_dissector(bssgp_handle, next_tvb, pinfo, ext_tree);
6849 return 3 + length;
6853 /* GPRS: ?
6854 * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
6856 static int
6857 decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6860 uint16_t length;
6861 proto_tree *ext_tree;
6863 length = tvb_get_ntohs(tvb, offset + 1);
6864 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PDP_CONT_PRIO], NULL,
6865 "%s : ", val_to_str_ext_const(GTP_EXT_PDP_CONT_PRIO, &gtp_val_ext, "Unknown"));
6867 if (length == 0) {
6868 return 3;
6871 offset++;
6872 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6873 offset = offset + 2;
6874 /* TODO add decoding of data */
6875 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
6877 return 3 + length;
6881 /* GPRS: ?
6882 * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
6884 static int
6885 decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6888 uint16_t length;
6889 proto_tree *ext_tree;
6891 length = tvb_get_ntohs(tvb, offset + 1);
6892 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_RAB_SETUP_INF], NULL,
6893 "%s : ", val_to_str_ext_const(GTP_EXT_ADD_RAB_SETUP_INF, &gtp_val_ext, "Unknown"));
6895 offset++;
6896 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6897 offset = offset + 2;
6899 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
6900 if (length == 1)
6901 return 3 + length;
6903 offset++;
6904 proto_tree_add_item(ext_tree, hf_gtp_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
6905 offset += 4;
6907 if (length == 9) {
6908 /* RNC IP address IPv4*/
6909 proto_tree_add_item(ext_tree, hf_gtp_rnc_ip_addr_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
6910 } else {
6911 /* RNC IP address IPv6*/
6912 proto_tree_add_item(ext_tree, hf_gtp_rnc_ip_addr_v6, tvb, offset, 16, ENC_NA);
6916 return 3 + length;
6921 /* GPRS: ?
6922 * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
6924 static int
6925 decode_gtp_sgsn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6928 uint16_t length;
6929 proto_tree *ext_tree;
6930 tvbuff_t *new_tvb;
6932 length = tvb_get_ntohs(tvb, offset + 1);
6933 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SGSN_NO], NULL,
6934 "%s", val_to_str_ext_const(GTP_EXT_SGSN_NO, &gtp_val_ext, "Unknown"));
6935 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
6937 offset++;
6938 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6939 offset = offset + 2;
6941 new_tvb = tvb_new_subset_length(tvb, offset, length);
6942 dissect_gsm_map_msisdn(new_tvb, pinfo, ext_tree);
6944 return 3 + length;
6948 /* GPRS: ?
6949 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
6951 static int
6952 decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6955 uint16_t length;
6956 proto_tree *ext_tree;
6958 length = tvb_get_ntohs(tvb, offset + 1);
6959 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_COMMON_FLGS], NULL,
6960 "%s : ", val_to_str_ext_const(GTP_EXT_COMMON_FLGS, &gtp_val_ext, "Unknown"));
6962 offset++;
6963 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6964 offset = offset + 2;
6965 /* Dual Address Bearer Flag */
6966 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_dual_addr_bearer_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
6967 /* Upgrade QoS Supported */
6968 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, ENC_BIG_ENDIAN);
6969 /* NRSN bit field */
6970 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, ENC_BIG_ENDIAN);
6971 /* No QoS negotiation */
6972 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, ENC_BIG_ENDIAN);
6973 /* MBMS Counting Information bi */
6974 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, ENC_BIG_ENDIAN);
6975 /* RAN Procedures Ready */
6976 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, ENC_BIG_ENDIAN);
6977 /* MBMS Service Type */
6978 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, ENC_BIG_ENDIAN);
6979 /* Prohibit Payload Compression */
6980 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, ENC_BIG_ENDIAN);
6982 return 3 + length;
6986 /* GPRS: ?
6987 * UMTS: 29.060 v6.11.0, chapter 7.7.49
6989 static int
6990 decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6993 uint16_t length;
6994 proto_tree *ext_tree_apn_res;
6996 length = tvb_get_ntohs(tvb, offset + 1);
6997 ext_tree_apn_res = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_APN_RES], NULL,
6998 "%s : ", val_to_str_ext_const(GTP_EXT_APN_RES, &gtp_val_ext, "Unknown"));
7000 offset++;
7001 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7002 offset = offset + 2;
7004 /* Restriction Type value */
7005 if (length != 1) {
7006 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_ext_length_mal, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
7007 return 3 + length;
7010 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, ENC_BIG_ENDIAN);
7011 return 3 + length;
7014 /* GPRS: ?
7015 * UMTS: 29.060 v6.11.0, chapter 7.7.50 RAT Type
7016 * RAT Type
7017 * Type = 151 (Decimal)
7020 static int
7021 decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7024 uint16_t length;
7025 proto_tree *ext_tree_rat_type;
7026 proto_item *te;
7028 length = tvb_get_ntohs(tvb, offset + 1);
7029 ext_tree_rat_type = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RAT_TYPE], &te,
7030 val_to_str_ext_const(GTP_EXT_RAT_TYPE, &gtp_val_ext, "Unknown"));
7032 offset++;
7033 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7034 offset = offset + 2;
7036 /* RAT Type value */
7037 if (length != 1) {
7038 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_ext_length_mal, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
7039 return 3 + length;
7042 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, ENC_BIG_ENDIAN);
7043 proto_item_append_text(te, ": %s", val_to_str_const(tvb_get_uint8(tvb,offset), gtp_ext_rat_type_vals, "Unknown"));
7045 return 3 + length;
7049 * 7.7.51 User Location Information
7052 void
7053 dissect_gtp_uli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7055 uint8_t geo_loc_type;
7056 proto_item* ti;
7058 /* Geographic Location Type */
7059 geo_loc_type = tvb_get_uint8(tvb, offset);
7060 ti = proto_tree_add_uint(tree, hf_gtp_uli_geo_loc_type, tvb, offset, 1, geo_loc_type);
7062 offset++;
7064 switch(geo_loc_type) {
7065 case 0:
7066 /* Geographic Location field included and it holds the Cell Global
7067 * Identification (CGI) of where the user currently is registered.
7068 * CGI is defined in sub-clause 4.3.1 of 3GPP TS 23.003 [2].
7070 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_CGI, true);
7071 offset+=3;
7072 proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7073 offset+=2;
7074 /* The CI is of fixed length with 2 octets and it can be coded using a full hexadecimal representation */
7075 proto_tree_add_item(tree, hf_gtp_cgi_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
7076 break;
7077 case 1:
7078 /* Geographic Location field included and it holds the Service
7079 * Area Identity (SAI) of where the user currently is registered.
7080 * SAI is defined in sub-clause 9.2.3.9 of 3GPP TS 25.413 [7].
7082 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_SAI, true);
7083 offset+=3;
7084 proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7085 offset+=2;
7086 proto_tree_add_item(tree, hf_gtp_sai_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
7087 break;
7088 case 2:
7089 /* Geographic Location field included and it holds the Routing
7090 * Area Identification (RAI) of where the user currently is
7091 * registered. RAI is defined in sub-clause 4.2 of 3GPP TS 23.003
7092 * [2].
7094 * The routing area code consists of 2 octets and is found in octet
7095 * 10 and octet 11. Only the first octet (10) contains the RAC and
7096 * the second octet (11) is coded as "11111111".
7098 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_RAI, true);
7099 offset+=3;
7100 proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7101 offset+=2;
7102 proto_tree_add_item(tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
7103 break;
7104 default:
7105 expert_add_info(pinfo, ti, &ei_gtp_ext_geo_loc_type);
7106 break;
7110 static int
7111 decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7114 uint16_t length;
7115 proto_tree *ext_tree;
7117 length = tvb_get_ntohs(tvb, offset + 1);
7118 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_USR_LOC_INF], NULL,
7119 val_to_str_ext_const(GTP_EXT_USR_LOC_INF, &gtp_val_ext, "Unknown"));
7121 offset++;
7122 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7123 offset = offset + 2;
7125 dissect_gtp_uli(tvb, offset, pinfo, ext_tree, args);
7127 return 3 + length;
7130 static const value_string daylight_saving_time_vals[] = {
7131 {0, "No adjustment"},
7132 {1, "+1 hour adjustment for Daylight Saving Time"},
7133 {2, "+2 hours adjustment for Daylight Saving Time"},
7134 {3, "Reserved"},
7135 {0, NULL}
7138 /* GPRS: ?
7139 * UMTS: 29.060 v6.11.0, chapter 7.7.52
7140 * MS Time Zone
7141 * Type = 153 (Decimal)
7142 * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
7143 * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
7144 * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
7145 * its value shall be set as defined in 3GPP TS 22.042
7147 static int
7148 decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7151 uint16_t length;
7152 proto_tree *ext_tree;
7153 proto_item *te;
7154 uint8_t data;
7155 char sign;
7157 length = tvb_get_ntohs(tvb, offset + 1);
7158 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MS_TIME_ZONE], &te,
7159 "%s: ", val_to_str_ext_const(GTP_EXT_MS_TIME_ZONE, &gtp_val_ext, "Unknown"));
7161 offset++;
7162 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7163 offset = offset + 2;
7165 /* 3GPP TS 23.040 version 6.6.0 Release 6
7166 * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
7168 * The Time Zone indicates the difference, expressed in quarters of an hour,
7169 * between the local time and GMT. In the first of the two semi-octets,
7170 * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
7171 * represents the algebraic sign of this difference (0: positive, 1: negative).
7174 data = tvb_get_uint8(tvb, offset);
7175 sign = (data & 0x08) ? '-' : '+';
7176 data = (data >> 4) + (data & 0x07) * 10;
7178 proto_tree_add_uint_format_value(ext_tree, hf_gtp_timezone, tvb, offset, 1, data, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
7179 proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
7180 offset++;
7182 proto_tree_add_item(ext_tree, hf_gtp_timezone_dst, tvb, offset, 1, ENC_NA);
7184 return 3 + length;
7188 /* GPRS: ?
7189 * UMTS: 29.060 v6.11.0, chapter 7.7.53
7190 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
7191 * Type = 154 (Decimal)
7193 static int
7194 decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7197 uint16_t length;
7198 proto_tree *ext_imeisv;
7199 proto_item *te;
7200 tvbuff_t *next_tvb;
7201 char *digit_str;
7203 length = tvb_get_ntohs(tvb, offset + 1);
7204 ext_imeisv = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_IMEISV], &te,
7205 val_to_str_ext_const(GTP_EXT_IMEISV, &gtp_val_ext, "Unknown"));
7207 offset++;
7208 proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7209 offset = offset + 2;
7211 /* IMEI(SV)
7212 * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
7213 * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
7214 * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
7215 * set to '1111'. Both IMEI and IMEISV are BCD encoded.
7217 next_tvb = tvb_new_subset_length(tvb, offset, length);
7218 proto_tree_add_item_ret_display_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, ENC_BCD_DIGITS_0_9|ENC_LITTLE_ENDIAN, pinfo->pool, &digit_str);
7219 proto_item_append_text(te, ": %s", digit_str);
7221 return 3 + length;
7224 /* GPRS: ?
7225 * UMTS: 29.060 v6.11.0, chapter 7.7.54
7226 * CAMEL Charging Information Container
7227 * Type = 155 (Decimal)
7229 static int
7230 decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7233 uint16_t length;
7234 proto_tree *ext_tree;
7236 length = tvb_get_ntohs(tvb, offset + 1);
7237 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CAMEL_CHG_INF_CON], NULL,
7238 val_to_str_ext_const(GTP_EXT_CAMEL_CHG_INF_CON, &gtp_val_ext, "Unknown"));
7240 offset++;
7241 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7242 offset = offset + 2;
7243 dissect_gprscdr_CAMELInformationPDP_PDU(tvb_new_subset_length(tvb, offset, length), pinfo, ext_tree, NULL);
7245 return 3 + length;
7249 /* GPRS: ?
7250 * UMTS: 29.060 v6.11.0, chapter 7.7.55
7251 * MBMS UE Context
7253 static int
7254 decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7257 uint16_t length;
7258 proto_tree *ext_tree;
7259 uint8_t enh_nsapi, trans_id;
7260 uint32_t pdp_type_num, pdp_addr_len, ggsn_addr_len, apn_len;
7262 length = tvb_get_ntohs(tvb, offset + 1);
7263 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_UE_CTX], NULL,
7264 val_to_str_ext_const(GTP_EXT_MBMS_UE_CTX, &gtp_val_ext, "Unknown"));
7266 offset++;
7267 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7268 offset = offset + 2;
7269 proto_tree_add_item(ext_tree, hf_gtp_linked_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7270 offset++;
7271 proto_tree_add_item(ext_tree, hf_gtp_uplink_teid_cp, tvb, offset, 4, ENC_BIG_ENDIAN);
7272 offset += 4;
7273 enh_nsapi = tvb_get_uint8(tvb, offset);
7274 if (enh_nsapi < 128) {
7275 proto_tree_add_uint_format_value(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, enh_nsapi, "Reserved");
7276 } else {
7277 proto_tree_add_item(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7279 offset++;
7280 proto_tree_add_item(ext_tree, hf_gtp_pdp_organization, tvb, offset, 1, ENC_BIG_ENDIAN);
7281 offset++;
7282 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_pdp_type, tvb, offset, 1, ENC_BIG_ENDIAN, &pdp_type_num);
7283 offset++;
7284 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_pdp_address_length, tvb, offset, 1, ENC_BIG_ENDIAN, &pdp_addr_len);
7285 offset++;
7286 if (pdp_addr_len > 0) {
7287 switch (pdp_type_num) {
7288 case 0x21:
7289 proto_tree_add_item(ext_tree, hf_gtp_pdp_address_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
7290 break;
7291 case 0x57:
7292 proto_tree_add_item(ext_tree, hf_gtp_pdp_address_ipv6, tvb, offset, 16, ENC_NA);
7293 break;
7294 default:
7295 break;
7297 offset += pdp_addr_len;
7299 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN, &ggsn_addr_len);
7300 offset++;
7302 switch (ggsn_addr_len) {
7303 case 4:
7304 proto_tree_add_item(ext_tree, hf_gtp_ggsn_address_for_control_plane_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
7305 break;
7306 case 16:
7307 proto_tree_add_item(ext_tree, hf_gtp_ggsn_address_for_control_plane_ipv6, tvb, offset, 16, ENC_NA);
7308 break;
7309 default:
7310 /* XXX: Expert info? */
7311 break;
7313 offset += ggsn_addr_len;
7315 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN, &apn_len);
7316 offset++;
7317 decode_apn(pinfo, tvb, offset, apn_len, ext_tree, NULL);
7318 offset += apn_len;
7320 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
7321 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
7322 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
7323 * MS is stored in the MBMS context IE.
7324 * NOTE: Bit 5-8 of the first octet in the encoding defined in 3GPP TS 24.007 [3] is mapped into bit 1-4 of the first
7325 * octet in this field.
7327 trans_id = tvb_get_uint8(tvb, offset);
7328 proto_tree_add_uint(ext_tree, hf_gtp_transaction_identifier, tvb, offset, 2, trans_id);
7330 return 3 + length;
7334 /* GPRS: ?
7335 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
7336 * Temporary Mobile Group Identity (TMGI)
7337 * The Temporary Mobile Group Identity (TMGI) information element contains
7338 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
7339 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
7342 static int
7343 decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7346 uint16_t length;
7347 proto_tree *ext_tree, *tmgi_tree;
7348 proto_item *ti;
7349 tvbuff_t *next_tvb;
7351 length = tvb_get_ntohs(tvb, offset + 1);
7352 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_TMGI], NULL,
7353 val_to_str_ext_const(GTP_EXT_TMGI, &gtp_val_ext, "Unknown"));
7355 offset++;
7356 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7357 offset = offset + 2;
7359 ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, ENC_NA);
7361 tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
7362 next_tvb = tvb_new_subset_length(tvb, offset, length);
7363 de_mid(next_tvb, tmgi_tree, pinfo, 0, length, NULL, 0);
7364 return 3 + length;
7368 /* GPRS: ?
7369 * UMTS: 29.060 v6.11.0, chapter 7.7.57
7370 * RIM Routing Address
7372 static int
7373 decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7376 uint16_t length;
7377 proto_tree *ext_tree;
7378 proto_item *pi;
7380 length = tvb_get_ntohs(tvb, offset + 1);
7381 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RIM_RA], NULL,
7382 val_to_str_ext_const(GTP_EXT_RIM_RA, &gtp_val_ext, "Unknown"));
7384 offset++;
7385 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7386 offset = offset + 2;
7387 /* To dissect the Address the Routing Address discriminator must be known */
7389 * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
7391 pi = proto_tree_add_item(ext_tree, hf_gtp_rim_routing_addr, tvb, offset, length, ENC_NA);
7392 if (PINFO_FD_VISITED(pinfo)) {
7393 gtp_private_data_t *gtp_data = gtp_get_private_data(pinfo);
7394 proto_tree *addr_tree = proto_item_add_subtree(pi, ett_gtp_rim_routing_adr);
7396 switch (gtp_data->rim_routing_addr_disc) {
7397 case 0:
7398 de_bssgp_cell_id(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7399 break;
7400 case -1:
7401 case 1:
7402 de_bssgp_rnc_identifier(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7403 break;
7404 case 2:
7405 de_bssgp_enb_id(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7406 break;
7407 default:
7408 break;
7412 return 3 + length;
7416 /* GPRS: ?
7417 * UMTS: 29.060 v6.11.0, chapter 7.7.58
7418 * MBMS Protocol Configuration Options
7420 static int
7421 decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7424 uint16_t length;
7425 proto_tree *ext_tree;
7426 tvbuff_t *next_tvb;
7428 length = tvb_get_ntohs(tvb, offset + 1);
7429 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_PROT_CONF_OPT], NULL,
7430 val_to_str_ext_const(GTP_EXT_MBMS_PROT_CONF_OPT, &gtp_val_ext, "Unknown"));
7432 offset++;
7433 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7434 offset = offset + 2;
7435 /* The MBMS Protocol Configuration Options contains protocol options
7436 * associated with an MBMS context, that may be necessary to transfer
7437 * between the GGSN and the MS. The content and the coding of the MBMS
7438 * Protocol Configuration Options are defined in octets 3-z of the MBMS
7439 * Protocol Configuration Options in 3GPP TS 24.008 [5].
7441 next_tvb = tvb_new_subset_length(tvb, offset, length);
7442 de_sm_mbms_prot_conf_opt(next_tvb, ext_tree, pinfo, 0, length, NULL, 0);
7444 return 3 + length;
7448 /* GPRS: ?
7449 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
7450 * MBMS Session Duration
7452 /* Used for Diameter */
7453 static int
7454 dissect_gtp_mbms_ses_dur(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
7457 int offset = 0;
7459 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
7460 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, ENC_BIG_ENDIAN);
7462 return 3;
7466 static int
7467 decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7470 uint16_t length;
7471 proto_tree *ext_tree;
7473 length = tvb_get_ntohs(tvb, offset + 1);
7474 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_DUR], NULL,
7475 val_to_str_ext_const(GTP_EXT_MBMS_SES_DUR, &gtp_val_ext, "Unknown"));
7477 offset++;
7478 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7479 offset = offset + 2;
7480 /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
7481 * The MBMS Session Duration information element indicates the estimated
7482 * session duration of the MBMS service data transmission if available.
7483 * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
7484 * in 3GPP TS 29.061 [27], excluding the AVP Header fields
7485 * (as defined in IETF RFC 3588 [36], section 4.1).
7487 /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
7488 * with a length of three octets and indicates the estimated session duration
7489 * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
7490 * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
7491 * for which the maximum allowed value is 18 days. For the whole session duration the seconds
7492 * and days are added together and the maximum session duration is 19 days.
7494 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
7495 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, ENC_BIG_ENDIAN);
7497 return 3 + length;
7501 /* GPRS: ?
7502 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
7503 * MBMS Service Area
7505 static int
7506 dissect_gtp_3gpp_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) {
7508 int offset = 0;
7509 uint8_t no_of_mbms_sa_codes;
7510 int i;
7512 /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
7513 * The MBMS Service Area information element indicates the area over
7514 * which the Multimedia Broadcast/Multicast Service is to be distributed.
7515 * The payload shall be encoded as per the MBMS-Service-Area AVP defined
7516 * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
7517 * IETF RFC 3588 [36], section 4.1).
7519 /* Number N of MBMS service area codes coded as:
7520 * 1 binary value is '00000000'
7521 * ... ...
7522 * 256 binary value is '11111111'
7524 no_of_mbms_sa_codes = tvb_get_uint8(tvb, offset) + 1;
7525 proto_tree_add_uint(tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
7526 offset++;
7527 /* A consecutive list of N MBMS service area codes
7528 * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
7529 * The length of an MBMS service area code is 2 octets.
7531 for (i = 0; i < no_of_mbms_sa_codes; i++) {
7532 proto_tree_add_item(tree, hf_gtp_mbms_sa_code, tvb, offset, 2, ENC_BIG_ENDIAN);
7533 offset = offset + 2;
7536 return offset;
7539 static int
7540 decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7543 tvbuff_t *next_tvb;
7544 uint16_t length;
7545 proto_tree *ext_tree;
7547 length = tvb_get_ntohs(tvb, offset + 1);
7548 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SA], NULL,
7549 val_to_str_ext_const(GTP_EXT_MBMS_SA, &gtp_val_ext, "Unknown"));
7551 offset++;
7552 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7553 offset = offset + 2;
7554 next_tvb = tvb_new_subset_length(tvb, offset, length-3);
7555 dissect_gtp_3gpp_mbms_service_area(next_tvb, pinfo, ext_tree, NULL);
7557 return 3 + length;
7561 /* GPRS: ?
7562 * UMTS: 29.060 v6.11.0, chapter 7.7.61
7563 * Source RNC PDCP context info
7565 static int
7566 decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7569 uint16_t length;
7570 proto_tree *ext_tree, *sub_tree;
7572 length = tvb_get_ntohs(tvb, offset + 1);
7573 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SRC_RNC_PDP_CTX_INF], NULL,
7574 val_to_str_ext_const(GTP_EXT_SRC_RNC_PDP_CTX_INF, &gtp_val_ext, "Unknown"));
7576 offset++;
7577 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7578 offset = offset + 2;
7580 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_rrc_cont, NULL, "Source RNC to Target RNC Transparent Container");
7581 dissect_rrc_ToTargetRNC_Container_PDU(tvb, pinfo, sub_tree, NULL);
7583 return 3 + length;
7586 /* GPRS: ?
7587 * UMTS: 29.060 v6.11.0, chapter 7.7.62
7588 * Additional Trace Info
7591 static const value_string gtp_trace_depth_vals[] = {
7592 { 0, "minimum" },
7593 { 1, "medium" },
7594 { 2, "maximum" },
7595 { 3, "minimumWithoutVendorSpecificExtension" },
7596 { 4, "mediumWithoutVendorSpecificExtension" },
7597 { 5, "maximumWithoutVendorSpecificExtension" },
7598 { 0, NULL }
7601 static const value_string gtp_trace_activity_control_vals[] = {
7602 { 0, "Trace Deactivation"},
7603 { 1, "Trace Activation"},
7604 { 0, NULL}
7607 static int
7608 decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7611 uint16_t length;
7612 proto_tree *ext_tree;
7614 static int * const trigger_flags[] = {
7615 &hf_gtp_trace_triggers_ggsn_mbms,
7616 &hf_gtp_trace_triggers_ggsn_pdp,
7617 NULL
7620 static int * const loi_flags[] = {
7621 &hf_gtp_trace_loi_ggsn_gmb,
7622 &hf_gtp_trace_loi_ggsn_gi,
7623 &hf_gtp_trace_loi_ggsn_gn,
7624 NULL
7627 length = tvb_get_ntohs(tvb, offset + 1);
7628 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_TRS_INF], NULL,
7629 val_to_str_ext_const(GTP_EXT_ADD_TRS_INF, &gtp_val_ext, "Unknown"));
7631 offset++;
7632 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7633 offset = offset + 2;
7634 proto_tree_add_item(ext_tree, hf_gtp_trace_ref2, tvb, offset, 3, ENC_BIG_ENDIAN);
7635 offset += 3;
7636 proto_tree_add_item(ext_tree, hf_gtp_trace_rec_session_ref, tvb, offset, 2, ENC_BIG_ENDIAN);
7637 offset += 2;
7638 proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_triggers_ggsn, ett_gtp_trace_triggers_ggsn, trigger_flags, ENC_BIG_ENDIAN);
7639 offset++;
7640 proto_tree_add_item(ext_tree, hf_gtp_trace_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
7641 offset++;
7642 proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_loi_ggsn, ett_gtp_trace_loi_ggsn, loi_flags, ENC_BIG_ENDIAN);
7643 offset++;
7644 proto_tree_add_item(ext_tree, hf_gtp_trace_activity_control, tvb, offset, 1, ENC_BIG_ENDIAN);
7646 return 3 + length;
7650 /* GPRS: ?
7651 * UMTS: 29.060 v6.11.0, chapter 7.7.63
7652 * Hop Counter
7654 static int
7655 decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7658 uint16_t length;
7659 proto_tree *ext_tree;
7661 length = tvb_get_ntohs(tvb, offset + 1);
7662 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_HOP_COUNT], NULL,
7663 val_to_str_ext_const(GTP_EXT_HOP_COUNT, &gtp_val_ext, "Unknown"));
7665 offset++;
7666 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7667 offset = offset + 2;
7668 proto_tree_add_item(ext_tree, hf_gtp_hop_count, tvb, offset, 1, ENC_NA);
7670 return 3 + length;
7674 /* GPRS: ?
7675 * UMTS: 29.060 v6.11.0, chapter 7.7.64
7676 * Selected PLMN ID
7678 static int
7679 decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7682 uint16_t length;
7683 proto_tree *ext_tree;
7685 length = tvb_get_ntohs(tvb, offset + 1);
7686 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID], NULL,
7687 val_to_str_ext_const(GTP_EXT_SEL_PLMN_ID, &gtp_val_ext, "Unknown"));
7689 offset++;
7690 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7691 offset = offset + 2;
7693 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, false);
7694 return 3 + length;
7698 /* GPRS: ?
7699 * UMTS: 29.060 v6.11.0, chapter 7.7.65
7700 * MBMS Session Identifier
7702 static int
7703 decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7706 uint16_t length;
7707 proto_tree *ext_tree;
7709 length = tvb_get_ntohs(tvb, offset + 1);
7710 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID], NULL, val_to_str_ext_const(GTP_EXT_MBMS_SES_ID, &gtp_val_ext, "Unknown"));
7712 offset++;
7713 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7714 offset = offset + 2;
7715 /* TODO add decoding of data */
7716 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7718 return 3 + length;
7722 /* GPRS: ?
7723 * UMTS: 29.060 v6.11.0, chapter 7.7.66
7724 * MBMS 2G/3G Indicator
7726 static const value_string gtp_mbs_2g_3g_ind_vals[] = {
7727 {0, "2G only"},
7728 {1, "3G only"},
7729 {2, "Both 2G and 3G"},
7730 {0, NULL}
7733 static int
7734 decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7737 uint16_t length;
7738 proto_tree *ext_tree;
7740 length = tvb_get_ntohs(tvb, offset + 1);
7741 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_2G_3G_IND], NULL,
7742 val_to_str_ext_const(GTP_EXT_MBMS_2G_3G_IND, &gtp_val_ext, "Unknown"));
7744 offset++;
7745 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7746 offset = offset + 2;
7747 /* MBMS 2G/3G Indicator */
7748 proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
7750 return 3 + length;
7754 /* GPRS: ?
7755 * UMTS: 29.060 v6.11.0, chapter 7.7.67
7756 * Enhanced NSAPI
7758 static int
7759 decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7762 uint16_t length;
7763 proto_tree *ext_tree;
7764 uint8_t enh_nsapi;
7766 length = tvb_get_ntohs(tvb, offset + 1);
7767 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ENH_NSAPI], NULL, val_to_str_ext_const(GTP_EXT_ENH_NSAPI, &gtpv1_val_ext, "Unknown"));
7769 offset++;
7770 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7771 offset = offset + 2;
7772 enh_nsapi = tvb_get_uint8(tvb, offset);
7773 if (enh_nsapi < 128) {
7774 proto_tree_add_uint_format_value(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, enh_nsapi, "Reserved");
7775 } else {
7776 proto_tree_add_item(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7779 return 3 + length;
7783 /* GPRS: ?
7784 * UMTS: 29.060 v6.11.0, chapter 7.7.68
7785 * Additional MBMS Trace Info
7787 static int
7788 decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7791 uint16_t length;
7792 proto_tree *ext_tree;
7794 static int * const trigger_flags[] = {
7795 &hf_gtp_trace_triggers_bm_sc_mbms,
7796 NULL
7799 static int * const loi_flags[] = {
7800 &hf_gtp_trace_loi_bm_sc_gmb,
7801 NULL
7804 length = tvb_get_ntohs(tvb, offset + 1);
7805 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_MBMS_TRS_INF], NULL,
7806 val_to_str_ext_const(GTP_EXT_ADD_MBMS_TRS_INF, &gtpv1_val_ext, "Unknown"));
7808 offset++;
7809 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7810 offset = offset + 2;
7811 /* XXX: There is clearly an error in TS 29.060 V17.1.0 and earlier.
7812 * In Figure 7.7.68.1 the octet column has a gap and is not aligned,
7813 * octets 7-8 should be for the Trace Recording Session Reference, other
7814 * values should be moved up a row, and there should be a value for
7815 * the Trace Activity Control as octet 12, making the IE length 9,
7816 * as with 7.7.62 Additional Trace Info.
7817 * Unfortunately the mistake is carried over into the the length field
7818 * elsewhere in the spec, such as in Table 37.
7820 proto_tree_add_item(ext_tree, hf_gtp_trace_ref2, tvb, offset, 3, ENC_BIG_ENDIAN);
7821 offset += 3;
7822 proto_tree_add_item(ext_tree, hf_gtp_trace_rec_session_ref, tvb, offset, 2, ENC_BIG_ENDIAN);
7823 offset += 2;
7824 proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_triggers_bm_sc, ett_gtp_trace_triggers_bm_sc, trigger_flags, ENC_BIG_ENDIAN);
7825 offset++;
7826 proto_tree_add_item(ext_tree, hf_gtp_trace_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
7827 offset++;
7828 proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_loi_bm_sc, ett_gtp_trace_loi_bm_sc, loi_flags, ENC_BIG_ENDIAN);
7829 if(length > 8){
7830 offset++;
7831 proto_tree_add_item(ext_tree, hf_gtp_trace_activity_control, tvb, offset, 1, ENC_BIG_ENDIAN);
7834 return 3 + length;
7838 /* GPRS: ?
7839 * UMTS: 29.060 v6.11.0, chapter 7.7.69
7840 * MBMS Session Identity Repetition Number
7842 static int
7843 decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7846 uint16_t length;
7847 proto_tree *ext_tree;
7849 length = tvb_get_ntohs(tvb, offset + 1);
7850 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID_REP_NO], NULL,
7851 val_to_str_ext_const(GTP_EXT_MBMS_SES_ID_REP_NO, &gtpv1_val_ext, "Unknown"));
7853 offset++;
7854 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7855 offset = offset + 2;
7856 /* TODO add decoding of data */
7857 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7859 return 3 + length;
7863 /* GPRS: ?
7864 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
7865 * MBMS Time To Data Transfer
7867 /* Used for Diameter */
7868 static int
7869 dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
7872 int offset = 0;
7873 uint8_t time_2_dta_tr;
7875 time_2_dta_tr = tvb_get_uint8(tvb, offset) + 1;
7876 proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
7878 return 3;
7882 static int
7883 decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7886 uint16_t length;
7887 proto_tree *ext_tree;
7888 uint8_t time_2_dta_tr;
7890 length = tvb_get_ntohs(tvb, offset + 1);
7891 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_TIME_TO_DATA_TR], NULL,
7892 val_to_str_ext_const(GTP_EXT_MBMS_TIME_TO_DATA_TR, &gtpv1_val_ext, "Unknown"));
7894 offset++;
7895 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7896 offset = offset + 2;
7897 /* TODO add decoding of data
7898 * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
7899 * The MBMS Time To Data Transfer information element contains a
7900 * MBMS Time To Data Transfer allocated by the BM-SC.
7901 * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
7902 * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
7903 * (as defined in IETF RFC 3588 [36], section 4.1).
7905 /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
7906 * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
7907 * Bits
7908 * 8 7 6 5 4 3 2 1
7909 * 0 0 0 0 0 0 0 0 1s
7910 * 0 0 0 0 0 0 0 1 2s
7911 * 0 0 0 0 0 0 1 0 3s
7913 * 1 1 1 1 1 1 1 1 256s
7915 time_2_dta_tr = tvb_get_uint8(tvb, offset) + 1;
7916 proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
7918 return 3 + length;
7922 /* GPRS: ?
7923 * UMTS: 29.060 v6.11.0, chapter 7.7.71
7924 * PS Handover Request Context
7926 static int
7927 decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7930 uint16_t length;
7931 proto_tree *ext_tree;
7933 length = tvb_get_ntohs(tvb, offset + 1);
7934 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PS_HO_REQ_CTX], NULL,
7935 val_to_str_ext_const(GTP_EXT_PS_HO_REQ_CTX, &gtpv1_val_ext, "Unknown"));
7937 offset++;
7938 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7939 offset = offset + 2;
7940 /* TODO add decoding of data */
7941 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7943 return 3 + length;
7947 /* GPRS: ?
7948 * UMTS: 29.060 v6.11.0, chapter 7.7.72
7949 * BSS Container
7951 static int
7952 decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7955 uint16_t length;
7956 proto_tree *ext_tree, *sub_tree;
7958 length = tvb_get_ntohs(tvb, offset + 1);
7959 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BSS_CONT], NULL,
7960 val_to_str_ext_const(GTP_EXT_BSS_CONT, &gtpv1_val_ext, "Unknown"));
7962 offset++;
7963 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7964 offset = offset + 2;
7966 switch (pinfo->link_dir) {
7967 case P2P_DIR_UL:
7968 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_bss_cont, NULL, "Source BSS to Target BSS Transparent Container");
7969 de_bssgp_source_BSS_to_target_BSS_transp_cont(tvb, sub_tree, pinfo, offset, length, NULL, 0);
7970 break;
7971 case P2P_DIR_DL:
7972 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_bss_cont, NULL, "Target BSS to Source BSS Transparent Container");
7973 de_bssgp_target_BSS_to_source_BSS_transp_cont(tvb, sub_tree, pinfo, offset, length, NULL, 0);
7974 break;
7975 default:
7976 break;
7979 * The content of this container is defined in 3GPP TS 48.018
7982 return 3 + length;
7986 /* GPRS: ?
7987 * UMTS: 29.060 v6.11.0, chapter 7.7.73
7988 * Cell Identification
7990 static const value_string gtp_source_type_vals[] = {
7991 { 0, "Source Cell ID"},
7992 { 1, "Source RNC-ID" },
7993 { 0, NULL }
7996 static int
7997 decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8000 uint16_t length;
8001 uint32_t source_type;
8002 proto_tree *ext_tree;
8004 length = tvb_get_ntohs(tvb, offset + 1);
8005 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CELL_ID], NULL,
8006 val_to_str_ext_const(GTP_EXT_CELL_ID, &gtpv1_val_ext, "Unknown"));
8008 offset++;
8009 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8010 offset = offset + 2;
8013 * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
8014 * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
8016 * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
8017 * source RNC (RNC-ID) as defined in 3GPP TS 48.018
8019 * for PS handover from S1 mode, the identification of a target cell (Target Cell ID) as defined in 3GPP TS 48.018.
8020 * Octet 12 shall be set to "Source Cell ID" and octets 13-20 shall be encoded as all zero.
8022 * 3GPP TS 48.018 defines Target and Source Cell ID to use the Cell
8023 * Identifier IE, encoded as 6 octets of the value part of the RAI IE
8024 * followed by 2 octets of the value of the Cell Identity IE, both defined
8025 * in 3GPP TS 24.008. The 3GPP TS 48.018 RNC-ID IE is similar, with the 6
8026 * octet RAI as in 3GPP TS 24.008 followed by two octets of the RNC-ID.
8027 * (Or Extended RNC-ID, but the RNC-ID is presented in network byte order
8028 * with the most significant bits of octet 9 set to "0000", so there is
8029 * no need to distinguish be RNC-ID and Extended RNC-ID.)
8031 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8032 offset += 3;
8033 proto_tree_add_item(ext_tree, hf_gtp_target_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8034 offset += 2;
8035 proto_tree_add_item(ext_tree, hf_gtp_target_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8036 offset += 1;
8037 proto_tree_add_item(ext_tree, hf_gtp_target_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
8038 offset += 2;
8039 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_source_type, tvb, offset, 1, ENC_NA, &source_type);
8040 offset++;
8041 switch (source_type) {
8042 case 0:
8043 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8044 offset += 3;
8045 proto_tree_add_item(ext_tree, hf_gtp_source_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8046 offset += 2;
8047 proto_tree_add_item(ext_tree, hf_gtp_source_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8048 offset += 1;
8049 proto_tree_add_item(ext_tree, hf_gtp_source_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
8050 break;
8051 case 1:
8052 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8053 offset += 3;
8054 proto_tree_add_item(ext_tree, hf_gtp_source_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8055 offset += 2;
8056 proto_tree_add_item(ext_tree, hf_gtp_source_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8057 offset += 1;
8058 proto_tree_add_item(ext_tree, hf_gtp_source_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
8059 break;
8060 default:
8061 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_source_type_unknown, tvb, offset-1, 1);
8062 break;
8065 return 3 + length;
8069 /* GPRS: ?
8070 * UMTS: 29.060 v6.11.0, chapter 7.7.74
8071 * PDU Numbers
8073 static int
8074 decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8077 uint16_t length;
8078 proto_tree *ext_tree;
8080 length = tvb_get_ntohs(tvb, offset + 1);
8081 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PDU_NO], NULL,
8082 val_to_str_ext_const(GTP_EXT_PDU_NO, &gtpv1_val_ext, "Unknown"));
8084 offset++;
8085 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8086 offset = offset + 2;
8088 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8089 offset++;
8091 proto_tree_add_item(ext_tree, hf_gtp_sequence_number_down, tvb, offset, 2, ENC_BIG_ENDIAN);
8092 offset += 2;
8093 proto_tree_add_item(ext_tree, hf_gtp_sequence_number_up, tvb, offset, 2, ENC_BIG_ENDIAN);
8094 offset += 2;
8095 /* The Send N-PDU Number is used only when acknowledged peer-to-peer LLC
8096 * operation is used for the PDP context. Send N-PDU Number is the N-PDU
8097 * number to be assigned by SNDCP to the next down link N-PDU received from
8098 * the GGSN.
8100 * The Receive N-PDU Number is used only when acknowledged peer-to-peer LLC
8101 * operation is used for the PDP context. The Receive N-PDU Number is the
8102 * N-PDU number expected by SNDCP from the next up link N-PDU to be
8103 * received from the MS.
8105 * XXX: For some reason, 2 octets are reserved for each the Send and
8106 * Receive N-PDU numbers, even though an N-PDU number in acknowledged
8107 * mode only has values 0-255 (see 3GPP TS 44.065) and is in a one
8108 * octet field in the PDP Context IE (7.7.29). Assume, in the lack
8109 * of other guidance, that the first octet will be zero and the value
8110 * will be in the second octet.
8111 * Cf. 7.7.51 ULI, where there is an explicit note in TS 29.060 that only
8112 * the first octet contains the RAC and the second octet is filler.
8114 proto_tree_add_item(ext_tree, hf_gtp_send_n_pdu_number, tvb, offset, 2, ENC_BIG_ENDIAN);
8115 offset += 2;
8116 proto_tree_add_item(ext_tree, hf_gtp_receive_n_pdu_number, tvb, offset, 2, ENC_BIG_ENDIAN);
8118 return 3 + length;
8122 /* GPRS: ?
8123 * UMTS: 29.060 v6.11.0, chapter 7.7.75
8124 * BSSGP Cause
8126 static int
8127 decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8130 uint16_t length;
8131 proto_tree *ext_tree;
8133 length = tvb_get_ntohs(tvb, offset + 1);
8134 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BSSGP_CAUSE], NULL,
8135 val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, &gtpv1_val_ext, "Unknown"));
8137 offset++;
8138 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8139 offset = offset + 2;
8142 * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
8144 proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
8146 return 3 + length;
8151 * Required MBMS bearer capabilities 7.7.76
8153 static int
8154 decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8156 uint16_t length;
8157 proto_tree *ext_tree;
8159 length = tvb_get_ntohs(tvb, offset + 1);
8160 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_REQ_MBMS_BEARER_CAP], NULL,
8161 val_to_str_ext_const(GTP_EXT_REQ_MBMS_BEARER_CAP, &gtpv1_val_ext, "Unknown"));
8163 offset++;
8164 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8165 #if 0 /* Fix Dead Store Warning */
8166 offset = offset + 2;
8167 #endif
8168 /* The payload shall be encoded as per the
8169 * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
8170 * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
8172 /* TODO Add decoding (call Diameter dissector???) */
8173 return 3 + length;
8177 * RIM Routing Address Discriminator 7.7.77
8180 static const value_string gtp_bssgp_ra_discriminator_vals[] = {
8181 { 0, "A Cell Identifier is used to identify a GERAN cell" },
8182 { 1, "A Global RNC-ID is used to identify a UTRAN RNC" },
8183 { 2, "An eNB identifier is used to identify an E-UTRAN eNodeB or HeNB" },
8184 { 0, NULL }
8187 static int
8188 decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8191 uint16_t length;
8192 proto_tree *ext_tree;
8193 uint32_t val;
8194 gtp_private_data_t *gtp_data = gtp_get_private_data(pinfo);
8196 length = tvb_get_ntohs(tvb, offset + 1);
8197 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RIM_ROUTING_ADDR_DISC], NULL,
8198 val_to_str_ext_const(GTP_EXT_RIM_ROUTING_ADDR_DISC, &gtpv1_val_ext, "Unknown"));
8200 offset++;
8201 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8202 offset = offset + 2;
8203 /* Octet 4 bits 4 - 1 is coded according to 3GPP TS 48.018 [20]
8204 * RIM Routing Information IE octet 3 bits 4 - 1.
8205 * Bits 8 - 5 are coded "0000".
8207 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_bssgp_ra_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN, &val);
8208 gtp_data->rim_routing_addr_disc = (int8_t)val;
8210 return 3 + length;
8214 * List of set-up PFCs 7.7.78
8216 static int
8217 decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8220 uint16_t length;
8221 proto_tree *ext_tree, *sub_tree;
8223 length = tvb_get_ntohs(tvb, offset + 1);
8224 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_LIST_OF_SETUP_PFCS], NULL,
8225 val_to_str_ext_const(GTP_EXT_LIST_OF_SETUP_PFCS, &gtpv1_val_ext, "Unknown"));
8227 offset++;
8228 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8229 offset = offset + 2;
8231 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_lst_set_up_pfc, NULL, "List of set-up PFCs");
8232 de_bssgp_list_of_setup_pfcs(tvb, sub_tree, pinfo, offset, length, NULL, 0);
8234 return 3 + length;
8238 * PS Handover XID Parameters 7.7.79
8240 static int
8241 decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8244 uint16_t length;
8245 proto_tree *ext_tree;
8246 tvbuff_t *next_tvb;
8247 uint8_t sapi;
8248 uint8_t xid_par_len;
8250 length = tvb_get_ntohs(tvb, offset + 1);
8251 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PS_HANDOVER_XIP_PAR], NULL,
8252 val_to_str_ext_const(GTP_EXT_PS_HANDOVER_XIP_PAR, &gtpv1_val_ext, "Unknown"));
8254 offset++;
8255 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8256 offset = offset + 2;
8258 sapi = tvb_get_uint8(tvb, offset) & 0x0F;
8259 proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
8260 offset++;
8262 xid_par_len = tvb_get_uint8(tvb, offset);
8263 proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
8264 offset++;
8266 next_tvb = tvb_new_subset_remaining(tvb, offset);
8267 if (sndcpxid_handle)
8268 call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
8269 else
8270 call_data_dissector(next_tvb, pinfo, tree);
8272 return 4 + length;
8277 * MS Info Change Reporting Action 7.7.80
8279 static int
8280 decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8283 uint16_t length;
8284 proto_tree *ext_tree;
8286 length = tvb_get_ntohs(tvb, offset + 1);
8287 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MS_INF_CHG_REP_ACT], NULL,
8288 val_to_str_ext_const(GTP_EXT_MS_INF_CHG_REP_ACT, &gtpv1_val_ext, "Unknown"));
8290 offset++;
8291 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8292 offset = offset + 2;
8294 proto_tree_add_item(ext_tree, hf_gtp_rep_act_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8296 return 3 + length;
8300 * Direct Tunnel Flags 7.7.81
8302 static int
8303 decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8306 uint16_t length;
8307 proto_tree *ext_tree;
8309 length = tvb_get_ntohs(tvb, offset + 1);
8310 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_DIRECT_TUNNEL_FLGS], NULL,
8311 val_to_str_ext_const(GTP_EXT_DIRECT_TUNNEL_FLGS, &gtpv1_val_ext, "Unknown"));
8313 offset++;
8314 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8315 offset += 2;
8317 proto_tree_add_item(ext_tree, hf_gtp_ext_ei, tvb, offset, 1, ENC_BIG_ENDIAN);
8318 proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8319 proto_tree_add_item(ext_tree, hf_gtp_ext_dti, tvb, offset, 1, ENC_BIG_ENDIAN);
8320 offset++;
8322 if (length == 1) {
8323 return 3 + length;
8325 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8327 return 3 + length;
8331 * Correlation-ID 7.7.82
8333 static int
8334 decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8337 uint16_t length;
8338 proto_tree *ext_tree;
8340 length = tvb_get_ntohs(tvb, offset + 1);
8341 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CORRELATION_ID], NULL,
8342 val_to_str_ext_const(GTP_EXT_CORRELATION_ID, &gtpv1_val_ext, "Unknown"));
8344 offset++;
8345 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8346 offset = offset + 2;
8348 proto_tree_add_item(ext_tree, hf_gtp_correlation_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8350 return 3 + length;
8354 * Bearer Control Mode 7.7.83
8355 * version 10.0.0
8357 static const value_string gtp_pdp_bcm_type_vals[] = {
8358 {0, "MS_only"},
8359 {1, "MS/NW"},
8360 {0, NULL}
8363 static int
8364 decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8367 uint16_t length;
8368 proto_tree *ext_tree;
8370 length = tvb_get_ntohs(tvb, offset + 1);
8371 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BEARER_CONTROL_MODE], NULL,
8372 val_to_str_ext_const(GTP_EXT_BEARER_CONTROL_MODE, &gtpv1_val_ext, "Unknown"));
8374 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8376 offset++;
8377 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8378 offset = offset + 2;
8380 proto_tree_add_item(ext_tree, hf_gtp_bcm, tvb, offset, 1, ENC_BIG_ENDIAN);
8382 return 3 + length;
8387 * 7.7.84 MBMS Flow Identifier
8389 static int
8390 decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8392 uint16_t length;
8393 proto_tree *ext_tree;
8395 length = tvb_get_ntohs(tvb, offset + 1);
8396 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_FLOW_ID], NULL,
8397 val_to_str_ext_const(GTP_EXT_MBMS_FLOW_ID, &gtpv1_val_ext, "Unknown"));
8398 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8400 offset++;
8401 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8402 offset = offset + 2;
8404 /* 4-n MBMS Flow Identifier */
8405 proto_tree_add_item(ext_tree, hf_gtp_mbms_flow_id, tvb, offset, length, ENC_NA);
8408 return 3 + length;
8412 * 7.7.85 MBMS IP Multicast Distribution
8415 static int
8416 decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8418 uint16_t length;
8419 proto_tree *ext_tree;
8421 length = tvb_get_ntohs(tvb, offset + 1);
8422 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_IP_MCAST_DIST], NULL,
8423 val_to_str_ext_const(GTP_EXT_MBMS_IP_MCAST_DIST, &gtpv1_val_ext, "Unknown"));
8424 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8426 offset++;
8427 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8428 offset = offset + 2;
8430 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8432 return 3 + length;
8436 * 7.7.86 MBMS Distribution Acknowledgement
8438 /* Table 7.7.86.1: Distribution Indication values */
8439 static const value_string gtp_mbms_dist_indic_vals[] = {
8440 {0, "No RNCs have accepted IP multicast distribution"},
8441 {1, "All RNCs have accepted IP multicast distribution"},
8442 {2, "Some RNCs have accepted IP multicast distribution"},
8443 {3, "Spare. For future use."},
8444 {0, NULL}
8446 static int
8447 decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8449 uint16_t length;
8450 proto_tree *ext_tree;
8452 length = tvb_get_ntohs(tvb, offset + 1);
8453 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_DIST_ACK], NULL,
8454 val_to_str_ext_const(GTP_EXT_MBMS_DIST_ACK, &gtpv1_val_ext, "Unknown"));
8455 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8457 offset++;
8458 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8459 offset = offset + 2;
8461 /* Distribution Indication values */
8462 proto_tree_add_item(ext_tree, hf_gtp_mbms_dist_indic, tvb, offset, 1, ENC_BIG_ENDIAN);
8464 return 3 + length;
8468 * 7.7.87 Reliable INTER RAT HANDOVER INFO
8470 static int
8471 decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8473 uint16_t length;
8474 proto_tree *ext_tree;
8476 length = tvb_get_ntohs(tvb, offset + 1);
8477 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF], NULL,
8478 val_to_str_ext_const(GTP_EXT_RELIABLE_IRAT_HO_INF, &gtpv1_val_ext, "Unknown"));
8479 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8481 offset++;
8482 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8483 offset = offset + 2;
8485 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8487 return 3 + length;
8491 * 7.7.88 RFSP Index
8493 static int
8494 decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8496 uint16_t length;
8497 proto_tree *ext_tree;
8499 length = tvb_get_ntohs(tvb, offset + 1);
8500 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RFSP_INDEX], NULL,
8501 val_to_str_ext_const(GTP_EXT_RFSP_INDEX, &gtpv1_val_ext, "Unknown"));
8502 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8504 offset++;
8505 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8506 offset = offset + 2;
8508 proto_tree_add_item(ext_tree, hf_gtp_rfsp_index, tvb, offset, 2, ENC_BIG_ENDIAN);
8510 return 3 + length;
8513 * 7.7.89 PDP Type
8516 * 7.7.90 Fully Qualified Domain Name (FQDN)
8518 static int
8519 decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8522 uint16_t length;
8523 proto_tree *ext_tree;
8525 length = tvb_get_ntohs(tvb, offset + 1);
8527 ext_tree = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_FQDN], NULL,
8528 val_to_str_ext_const(GTP_EXT_FQDN, &gtp_val_ext, "Unknown field"));
8529 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8531 proto_tree_add_item(ext_tree, hf_gtp_fqdn_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
8532 decode_fqdn(tvb, offset + 3, length, ext_tree, NULL);
8534 return 3 + length;
8538 * 7.7.91 Evolved Allocation/Retention Priority I
8540 static int
8541 decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8544 uint16_t length;
8545 proto_tree *ext_tree;
8547 length = tvb_get_ntohs(tvb, offset + 1);
8548 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P1], NULL,
8549 val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P1, &gtpv1_val_ext, "Unknown"));
8550 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8552 offset++;
8553 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8554 offset += 2;
8556 proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
8557 proto_tree_add_item(ext_tree, hf_gtp_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
8558 proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
8560 return 3 + length;
8566 * 7.7.92 Evolved Allocation/Retention Priority II
8568 static int
8569 decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8572 uint16_t length;
8573 proto_tree *ext_tree;
8575 length = tvb_get_ntohs(tvb, offset + 1);
8576 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P2], NULL,
8577 val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P2, &gtpv1_val_ext, "Unknown"));
8578 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8580 offset++;
8581 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8582 offset = offset + 2;
8584 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8585 offset++;
8587 proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
8588 proto_tree_add_item(ext_tree, hf_gtp_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
8589 proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
8591 return 3 + length;
8597 * 7.7.93 Extended Common Flags
8599 static int
8600 decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8602 uint16_t length;
8603 proto_tree *ext_tree;
8605 length = tvb_get_ntohs(tvb, offset + 1);
8606 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXTENDED_COMMON_FLGS], NULL,
8607 val_to_str_ext_const(GTP_EXT_EXTENDED_COMMON_FLGS, &gtpv1_val_ext, "Unknown"));
8608 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8610 offset++;
8611 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8612 offset = offset + 2;
8614 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_uasi, tvb, offset, 1, ENC_BIG_ENDIAN);
8615 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_bdwi, tvb, offset, 1, ENC_BIG_ENDIAN);
8616 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_pcri, tvb, offset, 1, ENC_BIG_ENDIAN);
8617 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_vb, tvb, offset, 1, ENC_BIG_ENDIAN);
8618 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_retloc, tvb, offset, 1, ENC_BIG_ENDIAN);
8619 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_cpsr, tvb, offset, 1, ENC_BIG_ENDIAN);
8620 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_ccrsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8621 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_unauthenticated_imsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8622 offset++;
8624 if(length > 1){
8625 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length-1);
8628 return 3 + length;
8632 * 7.7.94 User CSG Information (UCI)
8635 static const value_string gtp_access_mode_vals[] = {
8636 { 0, "Closed Mode" },
8637 { 1, "Hybrid Mode" },
8638 { 2, "Reserved" },
8639 { 3, "Reserved" },
8640 { 0, NULL }
8643 static int
8644 decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8646 uint16_t length;
8647 proto_tree *ext_tree;
8649 length = tvb_get_ntohs(tvb, offset + 1);
8650 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UCI], NULL,
8651 val_to_str_ext_const(GTP_EXT_UCI, &gtpv1_val_ext, "Unknown"));
8652 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8654 offset++;
8655 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8656 offset = offset + 2;
8658 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8659 offset += 3;
8660 proto_tree_add_item(ext_tree, hf_gtp_csg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8661 offset += 4;
8663 proto_tree_add_item(ext_tree, hf_gtp_access_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
8664 /* Due to a specification oversight, the CMI values ... are reversed from
8665 * the values of the CSG-Membership-Indication AVP in 3GPP TS 32.299 [56].
8666 * Therefore, when CMI values are sent over the charging interface, the
8667 * values are encoded as specified in 3GPP TS 32.299 [56]. Furthermore,
8668 * the encoding is different between GTPv1 and GTPv2.
8670 proto_tree_add_item(ext_tree, hf_gtp_cmi, tvb, offset, 1, ENC_BIG_ENDIAN);
8672 return 3 + length;
8676 * 7.7.95 CSG Information Reporting Action
8679 static int
8680 decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8682 uint16_t length;
8683 proto_tree *ext_tree;
8685 static int * const flags[] = {
8686 &hf_gtp_csg_inf_rep_act_uciuhc,
8687 &hf_gtp_csg_inf_rep_act_ucishc,
8688 &hf_gtp_csg_inf_rep_act_ucicsg,
8689 NULL
8692 length = tvb_get_ntohs(tvb, offset + 1);
8693 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CSG_INF_REP_ACT], NULL,
8694 val_to_str_ext_const(GTP_EXT_CSG_INF_REP_ACT, &gtpv1_val_ext, "Unknown"));
8695 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8697 offset++;
8698 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8699 offset = offset + 2;
8701 proto_tree_add_bitmask_list(ext_tree, tvb, offset, 1, flags, ENC_BIG_ENDIAN);
8703 return 3 + length;
8706 * 7.7.96 CSG ID
8709 static int
8710 decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8712 uint16_t length;
8713 proto_tree *ext_tree;
8715 length = tvb_get_ntohs(tvb, offset + 1);
8716 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CSG_ID], NULL,
8717 val_to_str_ext_const(GTP_EXT_CSG_ID, &gtpv1_val_ext, "Unknown"));
8718 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8720 offset++;
8721 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8722 offset = offset + 2;
8724 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8726 return 3 + length;
8729 * 7.7.97 CSG Membership Indication (CMI)
8731 static int
8732 decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8734 uint16_t length;
8735 proto_tree *ext_tree;
8737 length = tvb_get_ntohs(tvb, offset + 1);
8738 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CMI], NULL,
8739 val_to_str_ext_const(GTP_EXT_CMI, &gtpv1_val_ext, "Unknown"));
8740 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8742 offset++;
8743 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8744 offset = offset + 2;
8746 /* Due to a specification oversight, the CMI values ... are reversed from
8747 * the values of the CSG-Membership-Indication AVP in 3GPP TS 32.299 [56].
8748 * Therefore, when CMI values are sent over the charging interface, the
8749 * values are encoded as specified in 3GPP TS 32.299 [56].
8751 proto_tree_add_item(ext_tree, hf_gtp_cmi, tvb, offset, 1, ENC_BIG_ENDIAN);
8753 return 3 + length;
8756 * 7.7.98 APN Aggregate Maximum Bit Rate (APN-AMBR)
8758 static int
8759 decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8761 uint16_t length;
8762 proto_tree *ext_tree;
8764 length = tvb_get_ntohs(tvb, offset + 1);
8765 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF], NULL,
8766 val_to_str_ext_const(GTP_EXT_AMBR, &gtpv1_val_ext, "Unknown"));
8767 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8769 offset++;
8770 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8771 offset = offset + 2;
8773 /* APN Aggregate Maximum Bit Rate (APN-AMBR) is defined in clause 9.9.4.2 of 3GPP TS 24.301 [42], but shall be
8774 * formatted as shown in Figure 7.7.98-1 as Unsigned32 binary integer values in kbps (1000 bits per second).
8776 /* 4 to 7 APN-AMBR for Uplink */
8777 proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8778 offset+=4;
8779 /* 8 to 11 APN-AMBR for Downlink */
8780 proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8782 return 3 + length;
8785 * 7.7.99 UE Network Capability
8787 static int
8788 decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8790 uint16_t length;
8791 proto_tree *ext_tree;
8793 length = tvb_get_ntohs(tvb, offset + 1);
8794 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_NETWORK_CAP], NULL,
8795 val_to_str_ext_const(GTP_EXT_UE_NETWORK_CAP, &gtpv1_val_ext, "Unknown"));
8797 offset++;
8798 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8799 offset = offset + 2;
8801 de_emm_ue_net_cap(tvb, ext_tree, pinfo, offset, length, NULL, 0);
8803 return 3 + length;
8806 * 7.7.100 UE-AMBR
8809 static int
8810 decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8812 uint16_t length;
8813 proto_tree *ext_tree;
8815 length = tvb_get_ntohs(tvb, offset + 1);
8816 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_AMBR], NULL,
8817 val_to_str_ext_const(GTP_EXT_UE_AMBR, &gtpv1_val_ext, "Unknown"));
8818 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8820 offset++;
8821 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8822 offset = offset + 2;
8824 /* 4 to 7 Subscribed UE-AMBR for Uplink */
8825 proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8826 offset+=4;
8827 /* 8 to 11 Subscribed UE-AMBR for Downlink */
8828 proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8829 offset+=4;
8831 /* Authorized UE-AMBR for Uplink and Downlink fields are present in the IE only if the sender has their valid values
8832 * available. Otherwise, the fields from m to (n+3) shall not be present.
8834 if (length > 8) {
8835 /* m to (m+3) Authorized UE-AMBR for Uplink */
8836 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8837 offset += 4;
8839 /* (m+4) to (n+3) Authorized UE-AMBR for Downlink */
8840 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8841 offset += 4;
8844 if (length > 16) {
8845 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 16);
8848 return 3 + length;
8852 * 7.7.101 APN-AMBR with NSAPI
8854 static int
8855 decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8857 uint16_t length;
8858 proto_tree *ext_tree;
8860 length = tvb_get_ntohs(tvb, offset + 1);
8861 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_APN_AMBR_WITH_NSAPI], NULL,
8862 val_to_str_ext_const(GTP_EXT_APN_AMBR_WITH_NSAPI, &gtpv1_val_ext, "Unknown"));
8863 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8865 offset++;
8866 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8867 offset = offset + 2;
8869 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
8870 offset++;
8872 /* 5 to 8 Authorized APN-AMBR for Uplink */
8873 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8874 offset+=4;
8876 /* 9 to12 Authorized APN-AMBR for Downlink */
8877 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8879 return 3 + length;
8882 * 7.7.102 GGSN Back-Off Time
8884 /* Table 7.7.102.1: GGSN Back-Off Time information element */
8885 static const value_string gtp_ggsn_back_off_time_units_vals[] = {
8886 {0, "value is incremented in multiples of 2 seconds"},
8887 {1, "value is incremented in multiples of 1 minute"},
8888 {2, "value is incremented in multiples of 10 minutes"},
8889 {3, "value is incremented in multiples of 1 hour"},
8890 {4, "value is incremented in multiples of 10 hours"},
8891 {5, "value indicates that the timer is infinite"},
8892 {0, NULL}
8894 static int
8895 decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8897 uint16_t length;
8898 proto_tree *ext_tree;
8900 length = tvb_get_ntohs(tvb, offset + 1);
8901 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_GGSN_BACK_OFF_TIME], NULL,
8902 val_to_str_ext_const(GTP_EXT_GGSN_BACK_OFF_TIME, &gtpv1_val_ext, "Unknown"));
8903 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8905 offset++;
8906 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8907 offset += 2;
8909 /* 4 Timer unit Timer value */
8910 proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_time_units, tvb, offset, 1, ENC_BIG_ENDIAN);
8911 proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_timer, tvb, offset, 1, ENC_BIG_ENDIAN);
8913 return 3 + length;
8917 * 7.7.103 Signalling Priority Indication
8919 static const true_false_string gtp_lapi_tfs = {
8920 "MS is configured for NAS signalling low priority",
8921 "MS is not configured for NAS signalling low priority"
8924 static int
8925 decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8927 uint16_t length;
8928 proto_tree *ext_tree;
8930 length = tvb_get_ntohs(tvb, offset + 1);
8931 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SIG_PRI_IND], NULL,
8932 val_to_str_ext_const(GTP_EXT_SIG_PRI_IND, &gtpv1_val_ext, "Unknown"));
8933 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8935 offset++;
8936 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8937 offset += 2;
8939 proto_tree_add_item(ext_tree, hf_gtp_lapi, tvb, offset, 1, ENC_NA);
8941 return 3 + length;
8944 * 7.7.104 Signalling Priority Indication with NSAPI
8947 static int
8948 decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8950 uint16_t length;
8951 proto_tree *ext_tree;
8953 length = tvb_get_ntohs(tvb, offset + 1);
8954 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SIG_PRI_IND_W_NSAPI], NULL,
8955 val_to_str_ext_const(GTP_EXT_SIG_PRI_IND_W_NSAPI, &gtpv1_val_ext, "Unknown"));
8956 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8958 offset++;
8959 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8960 offset += 2;
8962 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8963 offset++;
8965 proto_tree_add_item(ext_tree, hf_gtp_lapi, tvb, offset, 1, ENC_NA);
8967 return 3 + length;
8970 * 7.7.105 Higher bitrates than 16 Mbps flag
8972 static const value_string gtp_higher_br_16mb_flg_vals[] = {
8973 {0, "Not allowed"},
8974 {1, "Allowed"},
8975 {0, NULL}
8978 static int
8979 decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8981 uint16_t length;
8982 proto_tree *ext_tree;
8984 length = tvb_get_ntohs(tvb, offset + 1);
8985 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_HIGHER_BR_16MB_FLG], NULL,
8986 val_to_str_ext_const(GTP_EXT_HIGHER_BR_16MB_FLG, &gtpv1_val_ext, "Unknown"));
8987 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8989 offset++;
8990 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8991 offset += 2;
8993 /* Higher bitrates than 16 Mbps flag */
8994 proto_tree_add_item(ext_tree, hf_gtp_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
8996 return 3 + length;
8999 * 7.7.106 Max MBR/APN-AMBR
9002 static int
9003 decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9005 uint16_t length;
9006 proto_tree *ext_tree;
9007 uint32_t max_ul;
9008 uint32_t max_dl;
9010 length = tvb_get_ntohs(tvb, offset + 1);
9011 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MAX_MBR_APN_AMBR], NULL,
9012 val_to_str_ext_const(GTP_EXT_MAX_MBR_APN_AMBR, &gtpv1_val_ext, "Unknown"));
9013 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9015 offset++;
9016 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9017 offset = offset + 2;
9019 /* Max MBR/APN-AMBR for uplink */
9020 max_ul = tvb_get_ntohl(tvb, offset);
9021 proto_tree_add_uint_format_value(ext_tree, hf_gtp_max_mbr_apn_ambr_ul, tvb, offset, 4, max_ul, "%u %s",
9022 (max_ul) > 1000 ? max_ul/1000 : max_ul,
9023 (max_ul) > 1000 ? "Mbps" : "kbps");
9025 offset += 4;
9027 /* Max MBR/APN-AMBR for downlink */
9028 max_dl = tvb_get_ntohl(tvb, offset);
9029 proto_tree_add_uint_format_value(ext_tree, hf_gtp_max_mbr_apn_ambr_dl, tvb, offset, 4, max_dl, "%u %s",
9030 (max_dl) > 1000 ? max_dl/1000 : max_dl,
9031 (max_dl) > 1000 ? "Mbps" : "kbps");
9033 return 3 + length;
9036 * 7.7.107 Additional MM context for SRVCC
9039 static int
9040 decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9042 uint16_t length;
9043 proto_tree *ext_tree;
9044 uint32_t inf_len;
9046 length = tvb_get_ntohs(tvb, offset + 1);
9047 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_MM_CTX_SRVCC], NULL,
9048 val_to_str_ext_const(GTP_EXT_ADD_MM_CTX_SRVCC, &gtpv1_val_ext, "Unknown"));
9049 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9051 offset++;
9052 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9053 offset += 2;
9055 /* Length of the Mobile Station Classmark 2 */
9056 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ms_cm_2_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9057 offset++;
9058 if (inf_len > 0) {
9059 offset += de_ms_cm_2(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9062 /* Length of the Mobile Station Classmark 3 */
9063 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ms_cm_3_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9064 offset++;
9065 if (inf_len > 0) {
9066 offset += de_ms_cm_3(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9069 /* Length of the Supported Codec List */
9070 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_sup_codec_lst_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9071 offset++;
9072 if (inf_len > 0) {
9073 de_sup_codec_list(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9076 return 3 + length;
9080 * 7.7.108 Additional flags for SRVCC
9083 static int
9084 decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9086 uint16_t length;
9087 proto_tree *ext_tree;
9089 length = tvb_get_ntohs(tvb, offset + 1);
9090 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_FLGS_SRVCC], NULL,
9091 val_to_str_ext_const(GTP_EXT_ADD_FLGS_SRVCC, &gtpv1_val_ext, "Unknown"));
9092 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9094 offset++;
9095 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9096 offset += 2;
9098 /* 4 Spare ICS */
9099 proto_tree_add_item(ext_tree, hf_gtp_add_flg_for_srvcc_ics, tvb, offset, 1, ENC_BIG_ENDIAN);
9101 return 3 + length;
9104 * 7.7.109 STN-SR
9106 static int
9107 decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9109 uint16_t length;
9110 proto_tree *ext_tree;
9112 length = tvb_get_ntohs(tvb, offset + 1);
9113 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_STN_SR], NULL,
9114 val_to_str_ext_const(GTP_EXT_STN_SR, &gtpv1_val_ext, "Unknown"));
9115 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9117 offset++;
9118 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9119 offset += 2;
9121 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
9123 return 3 + length;
9127 * 7.7.110 C-MSISDN
9130 static int
9131 decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9133 uint16_t length;
9134 proto_tree *ext_tree;
9136 length = tvb_get_ntohs(tvb, offset + 1);
9137 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_C_MSISDN], NULL,
9138 val_to_str_ext_const(GTP_EXT_C_MSISDN, &gtpv1_val_ext, "Unknown"));
9139 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9141 offset++;
9142 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9143 offset += 2;
9145 dissect_e164_msisdn(tvb, ext_tree, offset, length, E164_ENC_BCD);
9147 return 3 + length;
9150 * 7.7.111 Extended RANAP Cause
9152 static int
9153 decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9155 uint16_t length;
9156 proto_tree *ext_tree;
9157 tvbuff_t *new_tvb;
9159 length = tvb_get_ntohs(tvb, offset + 1);
9160 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXT_RANAP_CAUSE], NULL,
9161 val_to_str_ext_const(GTP_EXT_EXT_RANAP_CAUSE, &gtpv1_val_ext, "Unknown"));
9162 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9164 offset++;
9165 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9166 offset += 2;
9168 new_tvb = tvb_new_subset_remaining(tvb, offset);
9170 dissect_ranap_Cause_PDU(new_tvb, pinfo, ext_tree, NULL);
9172 return 3 + length;
9176 * 7.7.112 eNodeB ID
9179 static const value_string gtp_enb_type_vals[] = {
9180 { 0, "Macro eNodeB ID" },
9181 { 1, "Home eNodeB ID" },
9182 { 0, NULL }
9185 static int
9186 decode_gtp_ext_enodeb_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9188 uint16_t length;
9189 proto_tree *ext_tree;
9190 uint32_t enb_type;
9192 length = tvb_get_ntohs(tvb, offset + 1);
9193 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ENODEB_ID], NULL,
9194 val_to_str_ext_const(GTP_EXT_ENODEB_ID, &gtpv1_val_ext, "Unknown"));
9195 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9197 offset++;
9198 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9199 offset += 2;
9201 /* eNodeB Type */
9202 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_enb_type, tvb, offset, 1, ENC_BIG_ENDIAN, &enb_type);
9203 offset++;
9205 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
9206 offset += 3;
9208 switch (enb_type){
9209 case 0:
9210 /* Macro eNodeB ID */
9211 proto_tree_add_item(ext_tree, hf_gtp_macro_enodeb_id, tvb, offset, 3, ENC_BIG_ENDIAN);
9212 offset += 3;
9213 proto_tree_add_item(ext_tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
9214 break;
9215 case 1:
9216 /* Home eNodeB ID */
9217 proto_tree_add_item(ext_tree, hf_gtp_home_enodeb_id, tvb, offset, 4, ENC_BIG_ENDIAN);
9218 offset += 4;
9219 proto_tree_add_item(ext_tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
9220 break;
9221 default:
9222 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 4);
9223 break;
9226 return 3 + length;
9230 * 7.7.113 Selection Mode with NSAPI
9233 static const value_string gtp_sel_mode_vals[] = {
9234 { 0, "MS or network provided APN, subscription verified" },
9235 { 1, "MS provided APN, subscription not verified" },
9236 { 2, "Network provided APN, subscription not verified" },
9237 { 3, "For future use. Shall not be sent. If received, shall be interpreted as the value 2" },
9238 { 0, NULL }
9241 static int
9242 decode_gtp_ext_sel_mode_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9244 uint16_t length;
9245 proto_tree *ext_tree;
9247 length = tvb_get_ntohs(tvb, offset + 1);
9248 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SEL_MODE_W_NSAPI], NULL,
9249 val_to_str_ext_const(GTP_EXT_SEL_MODE_W_NSAPI, &gtpv1_val_ext, "Unknown"));
9250 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9252 offset++;
9253 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9254 offset += 2;
9256 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
9257 offset++;
9259 proto_tree_add_item(ext_tree, hf_gtp_sel_mode_val, tvb, offset, 1, ENC_BIG_ENDIAN);
9262 return 3 + length;
9265 * 7.7.114 ULI Timestamp
9267 static int
9268 decode_gtp_ext_uli_timestamp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9270 uint16_t length;
9271 proto_tree *ext_tree;
9273 length = tvb_get_ntohs(tvb, offset + 1);
9274 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ULI_TIMESTAMP], NULL,
9275 val_to_str_ext_const(GTP_EXT_ULI_TIMESTAMP, &gtpv1_val_ext, "Unknown"));
9276 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9278 offset++;
9279 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9280 offset += 2;
9282 proto_tree_add_item(ext_tree, hf_gtp_uli_timestamp, tvb, offset, 4, ENC_TIME_SECS_NTP|ENC_BIG_ENDIAN);
9284 return 3 + length;
9288 * 7.7.115 Local Home Network ID (LHN-ID) with NSAPI
9290 static int
9291 decode_gtp_ext_lhn_id_w_sapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9293 uint16_t length;
9294 proto_tree *ext_tree;
9296 length = tvb_get_ntohs(tvb, offset + 1);
9297 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_LHN_ID_W_SAPI], NULL,
9298 val_to_str_ext_const(GTP_EXT_LHN_ID_W_SAPI, &gtpv1_val_ext, "Unknown"));
9299 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9301 offset++;
9302 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9303 offset += 2;
9304 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
9305 offset += 1;
9307 proto_tree_add_item(ext_tree, hf_gtp_lhn_id, tvb, offset, length, ENC_APN_STR|ENC_NA);
9309 return 3 + length;
9312 * 7.7.116 CN Operator Selection Entity
9314 static const value_string gtp_sel_entity_vals[] = {
9315 { 0, "The Serving Network has been selected by the UE"},
9316 { 1, "The Serving Network has been selected by the network"},
9317 { 2, "For future use"},
9318 { 3, "For future use"},
9319 { 0, NULL},
9322 static int
9323 decode_gtp_ext_cn_op_sel_entity(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9325 uint16_t length;
9326 proto_tree *ext_tree;
9328 length = tvb_get_ntohs(tvb, offset + 1);
9329 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CN_OP_SEL_ENTITY], NULL,
9330 val_to_str_ext_const(GTP_EXT_CN_OP_SEL_ENTITY, &gtpv1_val_ext, "Unknown"));
9331 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9333 offset++;
9334 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9335 offset += 2;
9337 proto_tree_add_item(ext_tree, hf_gtp_sel_entity, tvb, offset, 1, ENC_BIG_ENDIAN);
9338 offset++;
9340 if (length > 1) {
9341 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9343 return 3 + length;
9347 * 7.7.117 UE Usage Type
9349 static int
9350 decode_gtp_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9352 uint16_t length;
9353 proto_tree *ext_tree;
9355 length = tvb_get_ntohs(tvb, offset + 1);
9356 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_USAGE_TYPE], NULL,
9357 val_to_str_ext_const(GTP_EXT_UE_USAGE_TYPE, &gtpv1_val_ext, "Unknown"));
9358 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9360 offset++;
9361 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9362 offset += 2;
9364 proto_tree_add_item(ext_tree, hf_gtp_ue_usage_type_value, tvb, offset, 4, ENC_BIG_ENDIAN);
9365 offset += 4;
9367 if (length > 4) {
9368 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 4);
9371 return 3 + length;
9375 * 7.7.118 Extended Common Flags II
9377 static int
9378 decode_gtp_extended_common_flgs_II(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9380 uint16_t length;
9381 proto_tree *ext_tree;
9383 length = tvb_get_ntohs(tvb, offset + 1);
9384 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXT_COMMON_FLGS_II], NULL,
9385 val_to_str_ext_const(GTP_EXT_EXT_COMMON_FLGS_II, &gtpv1_val_ext, "Unknown"));
9386 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9388 offset++;
9389 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9390 offset = offset + 2;
9392 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_pnsi, tvb, offset, 1, ENC_BIG_ENDIAN);
9393 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_dtci, tvb, offset, 1, ENC_BIG_ENDIAN);
9394 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_pmtsmi, tvb, offset, 1, ENC_BIG_ENDIAN);
9395 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
9397 offset++;
9399 if(length > 1){
9400 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length-1);
9403 return 3 + length;
9407 * 7.7.119 Node Identifier
9409 static int
9410 decode_gtp_ext_node_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9412 uint16_t length;
9413 uint32_t item_len;
9414 proto_tree *ext_tree;
9416 length = tvb_get_ntohs(tvb, offset + 1);
9417 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_NODE_IDENTIFIER], NULL,
9418 val_to_str_ext_const(GTP_EXT_NODE_IDENTIFIER, &gtpv1_val_ext, "Unknown"));
9419 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9421 offset++;
9422 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9423 offset += 2;
9425 /* The Node Name and Node Realm are Diameter Identities, which are
9426 * specified by RFC 6733 to be in ASCII for compatibility with DNS.
9428 proto_tree_add_item_ret_length(ext_tree, hf_gtp_node_name, tvb, offset, 1, ENC_ASCII | ENC_NA, &item_len);
9429 offset += item_len;
9430 proto_tree_add_item_ret_length(ext_tree, hf_gtp_node_realm, tvb, offset, 1, ENC_ASCII | ENC_NA, &item_len);
9432 return 3 + length;
9436 * 7.7.120 CIoT Optimizations Support Indication
9438 static int
9439 decode_gtp_ciot_opt_sup_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9441 uint16_t length;
9442 proto_tree *ext_tree;
9444 length = tvb_get_ntohs(tvb, offset + 1);
9445 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CIOT_OPT_SUP_IND], NULL,
9446 val_to_str_ext_const(GTP_EXT_CIOT_OPT_SUP_IND, &gtpv1_val_ext, "Unknown"));
9447 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9449 offset++;
9450 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9451 offset += 2;
9453 proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_sgni_pdn, tvb, offset, 1, ENC_NA);
9454 proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_scni_pdn, tvb, offset, 1, ENC_NA);
9455 proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_spare, tvb, offset, 1, ENC_NA);
9456 offset++;
9458 if (length > 1) {
9459 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9462 return 3 + length;
9466 * 7.7.121 SCEF PDN Connection
9468 static int
9469 decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9471 uint16_t length;
9472 proto_tree *ext_tree;
9473 uint32_t apn_length, scef_id_length;
9475 length = tvb_get_ntohs(tvb, offset + 1);
9476 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SCEF_PDN_CONNECTION], NULL,
9477 val_to_str_ext_const(GTP_EXT_SCEF_PDN_CONNECTION, &gtpv1_val_ext, "Unknown"));
9478 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9480 offset++;
9481 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9482 offset += 2;
9484 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_NA, &apn_length);
9485 decode_apn(pinfo, tvb, offset + 1, (uint16_t)apn_length, ext_tree, NULL);
9487 offset += 1 + apn_length;
9489 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_NA);
9490 offset++;
9492 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_scef_id_length, tvb, offset, 2, ENC_BIG_ENDIAN, &scef_id_length);
9493 offset += 2;
9495 proto_tree_add_item(ext_tree, hf_gtp_scef_id, tvb, offset, scef_id_length, ENC_ASCII);
9496 offset += scef_id_length;
9498 if (length > 4 + apn_length + scef_id_length) {
9499 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - (4 + apn_length + scef_id_length));
9502 return 3 + length;
9505 * 7.7.122 IOV_updates counter
9507 static int
9508 decode_gtp_iov_updates_counter(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9510 uint16_t length;
9511 proto_tree *ext_tree;
9513 length = tvb_get_ntohs(tvb, offset + 1);
9514 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_IOV_UPDATES_COUNTER], NULL,
9515 val_to_str_ext_const(GTP_EXT_IOV_UPDATES_COUNTER, &gtpv1_val_ext, "Unknown"));
9516 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9518 offset++;
9519 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9520 offset += 2;
9522 proto_tree_add_item(ext_tree, hf_gtp_iov_updates_counter, tvb, offset, 1, ENC_BIG_ENDIAN);
9523 offset++;
9525 if (length > 1) {
9526 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9529 return 3 + length;
9532 * 7.7.123 Mapped UE Usage Type
9534 static int
9535 decode_gtp_mapped_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9537 uint16_t length;
9538 proto_tree *ext_tree;
9540 length = tvb_get_ntohs(tvb, offset + 1);
9541 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MAPPED_UE_USAGE_TYPE], NULL,
9542 val_to_str_ext_const(GTP_EXT_MAPPED_UE_USAGE_TYPE, &gtpv1_val_ext, "Unknown"));
9543 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9545 offset++;
9546 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9547 offset += 2;
9549 proto_tree_add_item(ext_tree, hf_gtp_mapped_ue_usage_type, tvb, offset, 2, ENC_BIG_ENDIAN);
9550 offset += 2;
9552 if (length > 2) {
9553 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 2);
9556 return 3 + length;
9559 * 7.7.124 UP Function Selection Indication Flags
9561 static int
9562 decode_gtp_up_fun_sel_ind_flags(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9564 uint16_t length;
9565 proto_tree *ext_tree;
9567 length = tvb_get_ntohs(tvb, offset + 1);
9568 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UP_FUN_SEL_IND_FLAGS], NULL,
9569 val_to_str_ext_const(GTP_EXT_UP_FUN_SEL_IND_FLAGS, &gtpv1_val_ext, "Unknown"));
9570 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9572 offset++;
9573 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9574 offset += 2;
9576 proto_tree_add_item(ext_tree, hf_gtp_up_fun_sel_ind_flags_dcnr, tvb, offset, 1, ENC_BIG_ENDIAN);
9577 proto_tree_add_item(ext_tree, hf_gtp_up_fun_sel_ind_flags_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
9578 offset++;
9580 if (length > 1) {
9581 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9584 return 3 + length;
9587 static int
9588 decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9591 uint16_t length, n, number;
9592 proto_tree *ext_tree_rel_pack;
9594 length = tvb_get_ntohs(tvb, offset + 1);
9596 ext_tree_rel_pack = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_rel_pack, NULL,
9597 "Sequence numbers of released packets IE");
9599 n = 0;
9601 while (n < length) {
9603 number = tvb_get_ntohs(tvb, offset + 3 + n);
9604 proto_tree_add_uint_format(ext_tree_rel_pack, hf_gtp_seq_num_released, tvb, offset + 3 + n, 2, number, "%u", number);
9605 n = n + 2;
9609 return 3 + length;
9612 /* GPRS: 12.15
9613 * UMTS: 33.015
9615 static int
9616 decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9619 uint16_t length, n, number;
9620 proto_tree *ext_tree_can_pack;
9622 length = tvb_get_ntohs(tvb, offset + 1);
9624 ext_tree_can_pack = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_can_pack, NULL,
9625 "Sequence numbers of cancelled packets IE");
9627 n = 0;
9629 while (n < length) {
9631 number = tvb_get_ntohs(tvb, offset + 3 + n);
9632 proto_tree_add_uint_format(ext_tree_can_pack, hf_gtp_seq_num_canceled, tvb, offset + 3 + n, 2, number, "%u", number);
9633 n += 2;
9636 return 3 + length;
9639 /* CDRs dissector
9640 * 3GPP TS 32.295 version 9.0.0 Release 9
9644 static const value_string gtp_cdr_fmt_vals[] = {
9645 {1, "Basic Encoding Rules (BER)"},
9646 {2, "Unaligned basic Packed Encoding Rules (PER)"},
9647 {3, "Aligned basic Packed Encoding Rules (PER)"},
9648 {0, NULL}
9650 static int
9651 decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9654 uint16_t length, cdr_length;
9655 uint8_t no, format, app_id, rel_id, ver_id, i;
9656 bool rel_id_zero = false;
9657 proto_tree *ext_tree, *ver_tree, *cdr_dr_tree;
9658 proto_item *fmt_item;
9659 tvbuff_t *next_tvb;
9661 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ext, NULL,
9662 val_to_str_ext_const(GTP_EXT_DATA_REQ, &gtp_val_ext, "Unknown message"));
9663 offset++;
9665 length = tvb_get_ntohs(tvb, offset);
9666 proto_tree_add_uint(ext_tree, hf_gtp_length, tvb, offset, 2, length);
9667 offset+=2;
9669 if (length == 0) {
9670 return 3;
9673 /* Octet 4 Number of Data Records */
9674 no = tvb_get_uint8(tvb, offset);
9675 proto_tree_add_item(ext_tree, hf_gtp_number_of_data_records, tvb, offset, 1, ENC_BIG_ENDIAN);
9676 offset++;
9678 /* Octet 5 Data Record Format */
9679 format = tvb_get_uint8(tvb, offset);
9680 fmt_item = proto_tree_add_item(ext_tree, hf_gtp_data_record_format, tvb, offset, 1, ENC_BIG_ENDIAN);
9681 offset++;
9682 /* The value range is 1-255 in decimal. The value '0' should not be used.
9683 * Only the values 1-10 and 51-255 can be used for standards purposes.
9684 * Values in the range of 11-50 are to be configured only by operators, and are not subject to standardization.
9686 if(format < 4) {
9687 proto_item_append_text(fmt_item, " %s", val_to_str_const(format, gtp_cdr_fmt_vals, "Unknown"));
9688 /* Octet 6 -7 Data Record Format Version
9689 * 8 7 6 5 4 3 2 1
9690 * 6 Application Identifier Release Identifier
9691 * 7 Version Identifier
9693 * New with Release 15 and higher:
9694 * 8 Release Identifier Extension
9695 * The Release Identifier indicates the TS release up to and including
9696 * 15. The Release Identifier Extension indicates TS releases above 15,
9697 * in this case the Release Identifier has a value of '0' (decimal)
9699 app_id = tvb_get_uint8(tvb,offset);
9700 rel_id = app_id & 0x0f;
9701 app_id = app_id >>4;
9702 ver_id = tvb_get_uint8(tvb,offset+1);
9703 if (rel_id == 0) {
9704 rel_id_zero = true;
9705 rel_id = tvb_get_uint8(tvb,offset+2);
9707 /* The second octet (#7 in Data Record Packet IE) identifies the version of the TS used to encode the CDR,
9708 * i.e. its value corresponds to the second digit of the version number of the document [51]
9709 * (as shown on the cover sheet), plus '1'.
9710 * E.g. for version 3.4.0, the Version Identifier would be "5".
9711 * In circumstances where the second digit is an alphabetical character, (e.g. 3.b.0), the corresponding ASCII value shall
9712 * be taken, e.g. the Version Identifier would be "66" (ASCII(b)).
9714 if(ver_id < 0x65)
9715 ver_id = ver_id -1;
9716 /* XXX We don't handle ASCCI version */
9718 ver_tree = proto_tree_add_subtree_format(ext_tree, tvb, offset, (rel_id_zero || rel_id == 15) ? 3 : 2, ett_gtp_cdr_ver, NULL,
9719 "Data record format version: AppId %u Rel %u.%u.0", app_id,rel_id,ver_id);
9720 proto_tree_add_item(ver_tree, hf_gtp_cdr_app, tvb, offset, 1, ENC_BIG_ENDIAN);
9721 proto_tree_add_item(ver_tree, hf_gtp_cdr_rel, tvb, offset, 1, ENC_BIG_ENDIAN);
9722 offset++;
9723 proto_tree_add_item(ver_tree, hf_gtp_cdr_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
9724 offset++;
9725 if(rel_id_zero) {
9726 /* The Release Identifier indicates the TS release up to and including 15.
9727 * The Release Identifier Extension indicates TS releases above 15,
9728 * in this case the Release Identifier has a value of '0' (decimal).
9730 fmt_item = proto_tree_add_item(ver_tree, hf_gtp_cdr_rel_ext, tvb, offset, 1, ENC_NA);
9731 offset++;
9732 if(rel_id < 16) {
9733 expert_add_info(pinfo, fmt_item, &ei_gtp_cdr_rel_ext_invalid);
9736 for(i = 0; i < no; ++i) {
9737 cdr_length = tvb_get_ntohs(tvb, offset);
9738 cdr_dr_tree = proto_tree_add_subtree_format(ext_tree, tvb, offset, cdr_length+2,
9739 ett_gtp_cdr_dr, NULL, "Data record %d", i + 1);
9740 proto_tree_add_uint(cdr_dr_tree, hf_gtp_cdr_length, tvb, offset, 2, cdr_length);
9741 offset+=2;
9742 proto_tree_add_item(cdr_dr_tree, hf_gtp_cdr_context, tvb, offset, cdr_length, ENC_NA);
9743 next_tvb = tvb_new_subset_remaining(tvb, offset);
9745 /* XXX this is for release 6, may not work for higher releases */
9746 if(format==1) {
9747 if(rel_id <= 6){
9748 dissect_gprscdr_GPRSCallEventRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
9749 }else{
9750 dissect_gprscdr_GPRSRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
9752 } else {
9753 /* Do we have a dissector registering for this data format? */
9754 dissector_try_uint(gtp_cdr_fmt_dissector_table, format, next_tvb, pinfo, cdr_dr_tree);
9757 offset = offset + cdr_length;
9760 } else {
9761 /* Proprietary CDR format */
9762 proto_item_append_text(fmt_item, " Proprietary or un documented format");
9765 if (gtpcdr_handle) {
9766 next_tvb = tvb_new_subset_remaining(tvb, offset);
9767 call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
9770 return 3 + length;
9773 /* GPRS: 12.15
9774 * UMTS: 33.015
9776 static int
9777 decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9780 uint16_t length, n, number;
9781 proto_tree *ext_tree_data_resp;
9783 length = tvb_get_ntohs(tvb, offset + 1);
9785 ext_tree_data_resp = proto_tree_add_subtree(tree, tvb, offset, 3 + length,
9786 ett_gtp_data_resp, NULL, "Requests responded");
9788 n = 0;
9790 while (n < length) {
9792 number = tvb_get_ntohs(tvb, offset + 3 + n);
9793 proto_tree_add_uint_format(ext_tree_data_resp, hf_gtp_requests_responded, tvb, offset + 3 + n, 2, number, "%u", number);
9794 n = n + 2;
9798 return 3 + length;
9802 /* GPRS: 12.15
9803 * UMTS: 33.015
9805 static int
9806 decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9809 uint16_t length;
9810 proto_tree *ext_tree_node_addr;
9811 proto_item *te;
9813 length = tvb_get_ntohs(tvb, offset + 1);
9815 ext_tree_node_addr = proto_tree_add_subtree(tree, tvb, offset, 3 + length,
9816 ett_gtp_node_addr, &te, "Node address: ");
9818 proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
9820 switch (length) {
9821 case 4:
9822 proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
9823 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
9824 break;
9825 case 16:
9826 proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, ENC_NA);
9827 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
9828 break;
9829 default:
9830 proto_item_append_text(te, "unknown type or wrong length");
9831 break;
9834 return 3 + length;
9838 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
9839 * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
9843 static int
9844 decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9847 uint16_t length, ext_id;
9848 proto_tree *ext_tree_priv_ext;
9849 proto_item *te;
9850 tvbuff_t *next_tvb;
9852 ext_tree_priv_ext = proto_tree_add_subtree_format(tree, tvb, offset, 1, ett_gtp_ext, &te,
9853 "%s : ", val_to_str_ext_const(GTP_EXT_PRIV_EXT, &gtp_val_ext, "Unknown message"));
9855 offset++;
9856 length = tvb_get_ntohs(tvb, offset);
9857 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9858 offset += 2;
9859 if (length >= 2) {
9860 ext_id = tvb_get_ntohs(tvb, offset);
9861 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
9862 proto_item_append_text(te, "%s (%u)", enterprises_lookup(ext_id, "Unknown"), ext_id);
9863 offset = offset + 2;
9865 if (length > 2) {
9866 next_tvb = tvb_new_subset_length(tvb, offset, length-2);
9867 if(!dissector_try_uint(gtp_priv_ext_dissector_table, ext_id, next_tvb, pinfo, ext_tree_priv_ext)){
9868 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, ENC_NA);
9873 return 3 + length;
9876 static int
9877 decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9880 proto_tree_add_expert(tree, pinfo, &ei_gtp_unknown_extension_header, tvb, offset, 1);
9882 return tvb_reported_length_remaining(tvb, offset);
9885 static void
9886 track_gtp_session(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t * gtp_hdr, wmem_list_t *teid_list, wmem_list_t *ip_list, uint32_t last_teid, address last_ip)
9888 uint32_t session, frame_teid_cp;
9889 proto_item *it;
9891 /* GTP session */
9892 if (tree) {
9893 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
9894 if (session) {
9895 it = proto_tree_add_uint(tree, hf_gtp_session, tvb, 0, 0, session);
9896 proto_item_set_generated(it);
9901 if (!PINFO_FD_VISITED(pinfo) && gtp_version == 1) {
9902 /* If the message does not have any session ID */
9903 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
9904 if (!session) {
9905 /* If the message is not a CPDPCRES, CPDPCREQ, UPDPREQ, UPDPRES
9906 * then we remove its information from teid and ip lists
9907 * XXX: Wouldn't it be better not to insert this information
9908 * in the first place for other message types, instead of
9909 * inserting it and then immediately removing it?
9910 * At the very least, it would be faster to iterate through the
9911 * teid_list and ip_list and remove via keys rather than doing
9912 * removal through a reverse lookup.
9914 if ((gtp_hdr->message != GTP_MSG_CREATE_PDP_RESP && gtp_hdr->message != GTP_MSG_CREATE_PDP_REQ && gtp_hdr->message != GTP_MSG_UPDATE_PDP_RESP
9915 && gtp_hdr->message != GTP_MSG_UPDATE_PDP_REQ)) {
9916 /* If the lists are not empty*/
9917 if (wmem_list_count(teid_list) && wmem_list_count(ip_list)) {
9918 remove_frame_info(pinfo->num);
9922 if (gtp_hdr->message == GTP_MSG_CREATE_PDP_REQ) {
9923 /* If CPDPCREQ and not already in the list then we create a new session*/
9924 add_gtp_session(pinfo->num, gtp_session_count++);
9925 } else if (gtp_hdr->message != GTP_MSG_CREATE_PDP_RESP) {
9926 /* If this is an error indication then we have to check the session id that belongs to the message with the same data teid and ip */
9927 if (gtp_hdr->message == GTP_MSG_ERR_IND) {
9928 if (get_frame(last_ip, last_teid, &frame_teid_cp) == 1) {
9929 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame_teid_cp)));
9930 if (session) {
9931 /* We add the corresponding session to the session list*/
9932 add_gtp_session(pinfo->num, session);
9936 else {
9937 /* We have to check if its teid == teid_cp and ip.dst == gsn_ipv4 from the lists, if that is the case then we have to assign
9938 the corresponding session ID */
9939 if ((get_frame(pinfo->dst, (uint32_t)gtp_hdr->teid, &frame_teid_cp) == 1)) {
9940 /* Then we have to set its session ID */
9941 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame_teid_cp)));
9942 if (session) {
9943 /* We add the corresponding session to the list so that when a response came we can associate its session ID*/
9944 add_gtp_session(pinfo->num, session);
9953 static int
9954 dissect_nrup(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree,
9955 void *private_data _U_)
9957 uint32_t pdu_type;
9958 bool dl_disc_blk;
9959 bool dl_flush;
9960 uint32_t dl_disc_num_blks;
9961 int offset = 0;
9963 /* NRUP */
9964 proto_item *nrup_ti;
9965 proto_tree *nrup_tree;
9967 /* Protocol subtree */
9968 nrup_ti = proto_tree_add_item(tree, proto_nrup, tvb, offset, -1, ENC_NA);
9969 nrup_tree = proto_item_add_subtree(nrup_ti, ett_nrup);
9972 proto_tree_add_item_ret_uint(nrup_ti, hf_nrup_pdu_type,tvb, offset, 1, ENC_BIG_ENDIAN, &pdu_type);
9974 switch (pdu_type) {
9975 case NR_UP_DL_USER_DATA:
9977 /* 5.5.2.1 */
9978 bool report_delivered;
9980 /* PDU Type (=0) Spare DL Discard Blocks DL Flush Report polling Octet 1*/
9981 proto_tree_add_item(nrup_tree, hf_nrup_spr_bit_extnd_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
9982 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_discrd_blks, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_disc_blk);
9983 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_flush, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_flush);
9984 proto_tree_add_item(nrup_tree, hf_nrup_rpt_poll, tvb, offset, 1, ENC_BIG_ENDIAN);
9985 offset++;
9987 /* Spare Assistance Info. Report Polling Flag Retransmission flag*/
9988 proto_tree_add_item(nrup_tree, hf_nrup_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
9989 proto_tree_add_item(nrup_tree, hf_nrup_request_out_of_seq_report, tvb, offset, 1, ENC_BIG_ENDIAN);
9990 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_report_delivered, tvb, offset, 1, ENC_BIG_ENDIAN, &report_delivered);
9991 proto_tree_add_item(nrup_tree, hf_nrup_user_data_existence_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
9992 proto_tree_add_item(nrup_tree, hf_nrup_ass_inf_rep_poll_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
9993 proto_tree_add_item(nrup_tree, hf_nrup_retransmission_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
9994 offset++;
9996 /* NR-U Sequence NUmber */
9997 proto_tree_add_item(nrup_tree, hf_nrup_nr_u_seq_num, tvb, offset, 3, ENC_BIG_ENDIAN);
9998 offset += 3;
10000 if (dl_flush) {
10001 /* DL discard NR PDCP PDU SN */
10002 proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_nr_pdcp_pdu_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10003 offset += 3;
10005 /* Discarded blocks */
10006 if (dl_disc_blk) {
10007 /* DL discard Number of blocks */
10008 proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_dl_disc_num_blks, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_disc_num_blks);
10009 offset++;
10010 while (dl_disc_num_blks) {
10011 /* DL discard NR PDCP PDU SN start */
10012 proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_nr_pdcp_pdu_sn_start, tvb, offset, 3, ENC_BIG_ENDIAN);
10013 offset += 3;
10015 /* Discarded Block size */
10016 proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_blk_sz, tvb, offset, 1, ENC_BIG_ENDIAN);
10017 offset++;
10018 dl_disc_num_blks--;
10022 if (report_delivered) {
10023 /* DL report NR PDCP PDU SN */
10024 proto_tree_add_item(nrup_tree, hf_nrup_dl_report_nr_pdcp_pdu_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10025 offset += 3;
10027 break;
10030 case NR_UP_DL_DATA_DELIVERY_STATUS:
10032 /* 5.5.2.2 */
10033 bool high_tx_nr_pdcp_sn_ind;
10034 bool high_del_nr_pdcp_sn_ind;
10035 bool lost_packet_report;
10036 bool high_retx_nr_pdcp_sn_ind;
10037 bool high_del_retx_nr_pdcp_sn_ind;
10038 bool cause_rpt;
10039 bool data_rate_ind;
10040 uint32_t lost_NR_U_SN_range;
10042 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_tx_nr_pdcp_sn_ind ,tvb, offset,1, ENC_BIG_ENDIAN, &high_tx_nr_pdcp_sn_ind );
10043 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_delivered_nr_pdcp_sn_ind ,tvb, offset,1, ENC_BIG_ENDIAN, &high_del_nr_pdcp_sn_ind );
10044 proto_tree_add_item(nrup_tree, hf_nrup_final_frame_ind,tvb, offset, 1, ENC_BIG_ENDIAN);
10045 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_lost_pkt_rpt,tvb, offset, 1, ENC_BIG_ENDIAN, &lost_packet_report);
10046 offset++;
10048 proto_tree_add_item(nrup_tree, hf_nrup_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
10049 proto_tree_add_item(nrup_tree, hf_nrup_delivered_nr_pdcp_sn_range_ind ,tvb, offset,1, ENC_BIG_ENDIAN);
10050 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_data_rate_ind,tvb, offset,1, ENC_BIG_ENDIAN, &data_rate_ind);
10051 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_retx_nr_pdcp_sn_ind,tvb, offset,1, ENC_BIG_ENDIAN, &high_retx_nr_pdcp_sn_ind);
10052 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_high_delivered_retx_nr_pdcp_sn_ind,tvb, offset,1, ENC_BIG_ENDIAN, &high_del_retx_nr_pdcp_sn_ind);
10053 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_cause_rpt,tvb, offset,1, ENC_BIG_ENDIAN, &cause_rpt);
10054 offset++;
10056 proto_tree_add_item(nrup_tree, hf_nrup_desrd_buff_sz_data_radio_bearer,tvb, offset, 4, ENC_BIG_ENDIAN);
10057 offset += 4;
10059 if (data_rate_ind){
10060 proto_tree_add_item(nrup_tree, hf_nrup_desrd_data_rate,tvb, offset, 4, ENC_BIG_ENDIAN);
10061 offset += 4;
10064 if (lost_packet_report) {
10065 proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_lost_nru_seq_num,tvb, offset, 1, ENC_BIG_ENDIAN, &lost_NR_U_SN_range);
10066 offset+=1;
10068 while (lost_NR_U_SN_range) {
10069 proto_tree_add_item(nrup_tree, hf_nrup_start_lost_nru_seq_num,tvb, offset, 3, ENC_BIG_ENDIAN);
10070 offset += 3;
10072 proto_tree_add_item(nrup_tree, hf_nrup_end_lost_nru_seq_num,tvb, offset, 3, ENC_BIG_ENDIAN);
10073 offset += 3;
10074 lost_NR_U_SN_range--;
10078 if (high_del_nr_pdcp_sn_ind) {
10079 proto_tree_add_item(nrup_tree, hf_nrup_high_success_delivered_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10080 offset += 3;
10083 if (high_tx_nr_pdcp_sn_ind) {
10084 proto_tree_add_item(nrup_tree, hf_nrup_high_tx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10085 offset += 3;
10088 if (cause_rpt) {
10089 proto_tree_add_item(nrup_tree, hf_nrup_cause_val,tvb, offset, 1, ENC_BIG_ENDIAN);
10090 offset ++;
10093 if (high_del_retx_nr_pdcp_sn_ind) {
10094 proto_tree_add_item(nrup_tree, hf_nrup_high_success_delivered_retx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10095 offset += 3;
10098 if (high_retx_nr_pdcp_sn_ind) {
10099 proto_tree_add_item(nrup_tree, hf_nrup_high_retx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10102 break;
10105 case NR_UP_ASSISTANCE_INFORMATION_DATA:
10107 /* 5.5.2.3 */
10108 bool pdcp_duplication_indication;
10109 bool assistance_information_ind;
10110 bool ul_delay_ind;
10111 bool dl_delay_ind;
10112 bool pdcp_duplication_suggestion;
10114 /* Flags */
10115 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_pdcp_duplication_ind, tvb, offset,1, ENC_BIG_ENDIAN, &pdcp_duplication_indication);
10116 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_assistance_information_ind, tvb, offset,1, ENC_BIG_ENDIAN, &assistance_information_ind);
10117 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_ul_delay_ind, tvb, offset,1, ENC_BIG_ENDIAN, &ul_delay_ind);
10118 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_delay_ind, tvb, offset,1, ENC_BIG_ENDIAN, &dl_delay_ind);
10119 offset++;
10120 proto_tree_add_item(nrup_tree, hf_nrup_spare_2, tvb, offset,1, ENC_BIG_ENDIAN);
10121 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_pdcp_duplication_activation_suggestion,
10122 tvb, offset,1, ENC_BIG_ENDIAN, &pdcp_duplication_suggestion);
10123 offset++;
10125 /* Number of Assistance Information Fields */
10126 if (assistance_information_ind) {
10127 uint32_t number_of_assistance_information_fields = 0;
10128 uint32_t num_octets_radio_qa_info;
10130 /* Number of assistance info fields */
10131 proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_assistance_info_fields,
10132 tvb, offset,1, ENC_BIG_ENDIAN, &number_of_assistance_information_fields);
10133 offset++;
10135 for (unsigned n=0; n < number_of_assistance_information_fields; n++) {
10136 /* Assistance Information Type */
10137 proto_tree_add_item(nrup_tree, hf_nrup_assistance_information_type,
10138 tvb, offset,1, ENC_BIG_ENDIAN);
10139 offset++;
10140 /* Num octets in assistance info */
10141 proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_octets_radio_qa_info,
10142 tvb, offset, 1, ENC_BIG_ENDIAN, &num_octets_radio_qa_info);
10143 offset++;
10144 /* Radio Quality Assistance info */
10145 proto_tree_add_item(nrup_tree, hf_nrup_radio_qa_info, tvb, offset,
10146 num_octets_radio_qa_info, ENC_NA);
10147 offset += num_octets_radio_qa_info;
10151 /* UL Delay DU Result */
10152 if (ul_delay_ind) {
10153 proto_tree_add_item(nrup_tree, hf_nrup_ul_delay_du_result, tvb, offset, 4, ENC_BIG_ENDIAN);
10154 offset += 4;
10156 /* DL Delay DU Result */
10157 if (dl_delay_ind) {
10158 proto_tree_add_item(nrup_tree, hf_nrup_dl_delay_du_result, tvb, offset, 4, ENC_BIG_ENDIAN);
10159 offset += 4;
10161 break;
10163 default:
10164 /* TODO: expert info error for unexpected PDU type? */
10165 break;
10168 return offset;
10171 /* TS 38.425 */
10172 static void
10173 addRANContParameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
10175 tvbuff_t *next_tvb = tvb_new_subset_length(tvb, offset, length);
10176 call_dissector(nrup_handle, next_tvb, pinfo, tree);
10179 static void
10180 dissect_gtp_tpdu_by_handle(dissector_handle_t handle, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset)
10182 tvbuff_t *next_tvb;
10183 next_tvb = tvb_new_subset_remaining(tvb, offset);
10184 call_dissector(handle, next_tvb, pinfo, tree);
10185 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP/");
10188 static void
10189 dissect_gtp_tpdu_as_pdcp_lte_info(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t *gtp_hdr, int offset)
10191 /* Check if we have info to call the PDCP dissector */
10192 struct pdcp_lte_info *p_pdcp_info;
10193 uat_pdcp_lte_keys_record_t * found_record;
10194 tvbuff_t *pdcp_lte_tvb;
10196 if ((found_record = look_up_pdcp_lte_keys_record(pinfo, (uint32_t)gtp_hdr->teid))) {
10197 /* Look for attached packet info! */
10198 p_pdcp_info = (struct pdcp_lte_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0);
10199 /* If we don't have the data, add it */
10200 if (p_pdcp_info == NULL) {
10201 p_pdcp_info = wmem_new0(wmem_file_scope(), pdcp_lte_info);
10202 /* Channel info is needed for RRC parsing */
10203 p_pdcp_info->direction = found_record->direction;
10204 p_pdcp_info->ueid = found_record->ue_id;
10205 p_pdcp_info->channelType = Channel_DCCH;
10206 p_pdcp_info->channelId = found_record->rb_id;
10207 /*p_pdcp_info->BCCHTransport;*/
10209 /* Details of PDCP header */
10210 if (found_record->header_present == PDCP_LTE_HEADER_PRESENT) {
10211 p_pdcp_info->no_header_pdu = false;
10212 } else {
10213 p_pdcp_info->no_header_pdu = true;
10215 p_pdcp_info->plane = found_record->plane;
10216 p_pdcp_info->seqnum_length = found_record->lte_sn_length;
10218 /* RoHC settings */
10219 p_pdcp_info->rohc.rohc_compression = found_record->rohc_compression;
10220 p_pdcp_info->rohc.rohc_ip_version = 4; /* For now set it explicitly */
10221 p_pdcp_info->rohc.cid_inclusion_info = false;
10222 p_pdcp_info->rohc.large_cid_present = false;
10223 p_pdcp_info->rohc.mode = MODE_NOT_SET;
10224 p_pdcp_info->rohc.rnd = false;
10225 p_pdcp_info->rohc.udp_checksum_present = false;
10226 p_pdcp_info->rohc.profile = found_record->rohc_profile;
10228 /* p_pdcp_info->is_retx;*/
10230 /* Used by heuristic dissector only */
10231 /*p_pdcp_info->pdu_length;*/
10232 p_add_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0, p_pdcp_info);
10234 pdcp_lte_tvb = tvb_new_subset_remaining(tvb, offset);
10235 call_dissector(pdcp_lte_handle, pdcp_lte_tvb, pinfo, tree);
10237 } else {
10238 proto_tree_add_subtree(tree, tvb, offset, -1, ett_gtp_pdcp_no_conf, NULL, "[No PDCP-LTE Configuration data found]");
10239 proto_tree_add_item(tree, hf_pdcp_cont, tvb, offset, -1, ENC_NA);
10243 static void
10244 dissect_gtp_tpsu_as_pdcp_nr_info(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t *gtp_hdr, int offset)
10246 /*NR-U DUD or DDDS PDU
10247 * This is NR-U DUD/DDDS PDU. It contains PDCP
10248 * payload as per 3GPP TS 38.323
10250 /* Check if we have info to call the PDCP dissector */
10251 uat_pdcp_nr_keys_record_t* found_record;
10253 if ((found_record = look_up_pdcp_nr_keys_record(pinfo, (uint32_t)gtp_hdr->teid))) {
10254 tvbuff_t *pdcp_tvb;
10255 struct pdcp_nr_info temp_data;
10257 pdcp_tvb = tvb_new_subset_remaining(tvb, offset);
10259 /* Fill in pdcp_nr_info */
10260 temp_data.direction = found_record->direction;
10261 temp_data.bearerType = Bearer_DCCH; /* always */
10262 /* Want to use same ueid as other PDCP config.. */
10263 temp_data.ueid = found_record->ue_id;
10264 /* Get this from table, may also be available from F1AP signalling... */
10265 temp_data.bearerId = found_record->rb_id;
10267 /* Details of PDCP header */
10268 temp_data.plane = found_record->plane;
10269 temp_data.seqnum_length = found_record->pdcp_nr_sn_length;
10270 /* PDCP_NR_(U|D)L_sdap_hdr_PRESENT bitmask */
10271 if (found_record->sdap_header_present == PDCP_NR_SDAP_HEADER_PRESENT) {
10272 if (temp_data.direction == PDCP_NR_DIRECTION_UPLINK) {
10273 temp_data.sdap_header = PDCP_NR_UL_SDAP_HEADER_PRESENT;
10274 } else {
10275 temp_data.sdap_header = PDCP_NR_DL_SDAP_HEADER_PRESENT;
10277 } else {
10278 temp_data.sdap_header = 0;
10280 /* Integrity MAC present? */
10281 temp_data.maci_present = found_record->mac_i_present;
10283 /* RoHC settings */
10284 temp_data.rohc.rohc_compression = found_record->rohc_compression;
10285 temp_data.rohc.rohc_ip_version = 4; /* For now set it explicitly */
10286 temp_data.rohc.cid_inclusion_info = false;
10287 temp_data.rohc.large_cid_present = false;
10288 temp_data.rohc.mode = MODE_NOT_SET;
10289 temp_data.rohc.rnd = false;
10290 temp_data.rohc.udp_checksum_present = false;
10291 temp_data.rohc.profile = found_record->rohc_profile;
10293 temp_data.is_retx = 0;
10295 /* Used by heuristic dissector only */
10296 temp_data.pdu_length = 0;
10298 call_dissector_with_data(pdcp_nr_handle, pdcp_tvb, pinfo, tree, &temp_data);
10299 } else {
10300 proto_tree_add_subtree(tree, tvb, offset, -1, ett_gtp_pdcp_no_conf, NULL, "[No PDCP-NR Configuration data found]");
10301 proto_tree_add_item(tree, hf_pdcp_cont, tvb, offset, -1, ENC_NA);
10305 static int
10306 dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
10308 uint8_t octet;
10309 gtp_hdr_t *gtp_hdr = NULL;
10310 proto_tree *gtp_tree = NULL, *ext_tree;
10311 proto_tree *ran_cont_tree = NULL;
10312 proto_item *ti = NULL, *tf, *ext_hdr_len_item, *message_item;
10313 int i, offset = 0, checked_field, mandatory;
10314 bool gtp_prime, has_SN;
10315 unsigned seq_no = 0;
10316 unsigned flow_label = 0;
10317 unsigned pdu_no, next_hdr = 0;
10318 uint8_t ext_hdr_val;
10319 unsigned ext_hdr_length;
10320 uint32_t ext_hdr_pdcpsn, value;
10321 char *tid_str;
10322 uint8_t acfield_len = 0;
10323 gtp_msg_hash_t *gcrp = NULL;
10324 conversation_t *conversation;
10325 gtp_conv_info_t *gtp_info;
10326 session_args_t *args = NULL;
10327 ie_decoder *decoder = NULL;
10329 /* Do we have enough bytes for the version and message type? */
10330 if (!tvb_bytes_exist(tvb, 0, 2)) {
10331 /* No - reject the packet. */
10332 return 0;
10334 octet = tvb_get_uint8(tvb, 0);
10335 if (((octet >> 5) & 0x07) > 2) {
10336 /* Version > 2; reject the packet */
10337 return 0;
10339 octet = tvb_get_uint8(tvb, 1);
10340 if (octet == GTP_MSG_UNKNOWN || try_val_to_str(octet, gtp_message_type) == NULL) {
10341 /* Unknown message type; reject the packet */
10342 return 0;
10345 /* Setting everything to 0, so that the TEID is 0 for GTP version 0
10346 * The magic number should perhaps be replaced.
10348 gtp_hdr = wmem_new0(pinfo->pool, gtp_hdr_t);
10350 /* Setting the TEID to -1 to say that the TEID is not valid for this packet */
10351 gtp_hdr->teid = -1;
10353 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
10354 col_clear(pinfo->cinfo, COL_INFO);
10356 if (g_gtp_session) {
10357 args = wmem_new0(pinfo->pool, session_args_t);
10358 args->last_cause = 128; /* It stores the last cause decoded. Cause accepted by default */
10359 /* We create the auxiliary lists */
10360 args->teid_list = wmem_list_new(pinfo->pool);
10361 args->ip_list = wmem_list_new(pinfo->pool);
10365 * Do we have a conversation for this connection?
10367 conversation = find_or_create_conversation(pinfo);
10370 * Do we already know this conversation?
10372 gtp_info = (gtp_conv_info_t *)conversation_get_proto_data(conversation, proto_gtp);
10373 if (gtp_info == NULL) {
10374 /* No. Attach that information to the conversation, and add
10375 * it to the list of information structures.
10377 gtp_info = wmem_new(wmem_file_scope(), gtp_conv_info_t);
10378 /*Request/response matching tables*/
10379 gtp_info->matched = wmem_map_new(wmem_file_scope(), gtp_sn_hash, gtp_sn_equal_matched);
10380 gtp_info->unmatched = wmem_map_new(wmem_file_scope(), gtp_sn_hash, gtp_sn_equal_unmatched);
10382 conversation_add_proto_data(conversation, proto_gtp, gtp_info);
10385 gtp_hdr->flags = tvb_get_uint8(tvb, offset);
10387 if (!(gtp_hdr->flags & 0x10)){
10388 gtp_prime = true;
10389 }else{
10390 gtp_prime = false;
10393 switch ((gtp_hdr->flags >> 5) & 0x07) {
10394 case 0:
10395 gtp_version = 0;
10396 break;
10397 case 1:
10398 gtp_version = 1;
10399 break;
10400 default:
10401 gtp_version = 1;
10402 break;
10404 if (tree) {
10405 if (gtp_prime) {
10406 static int * const gtp_prime_flags[] = {
10407 &hf_gtp_prime_flags_ver,
10408 &hf_gtp_flags_pt,
10409 &hf_gtp_flags_spare1,
10410 NULL
10412 static int * const gtp_prime_v0_flags[] = {
10413 &hf_gtp_prime_flags_ver,
10414 &hf_gtp_flags_pt,
10415 &hf_gtp_flags_spare1,
10416 &hf_gtp_flags_hdr_length,
10417 NULL
10420 ti = proto_tree_add_item(tree, proto_gtpprime, tvb, 0, -1, ENC_NA);
10421 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
10423 /* Octet 8 7 6 5 4 3 2 1
10424 * 1 Version | PT| Spare '1 1 1 '| ' 0/1 '
10427 /* Bit 1 of octet 1 is not used in GTP' (except in v0), and it is marked '0'
10428 * in the GTP' header. It is in use in GTP' v0 and distinguishes the used header-length.
10429 * In the case of GTP' v0, this bit being marked one (1) indicates the usage of the 6
10430 * octets header. If the bit is set to '0' (usually the case) the 20-octet header is used.
10431 * For all other versions of GTP', this bit is not used and is set to '0'. However,
10432 * this does not suggest the use of the 20-octet header, rather a shorter 6-octet header.
10434 if (gtp_version == 0) {
10435 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10436 ett_gtp_flags, gtp_prime_v0_flags, gtp_hdr->flags, BMT_NO_APPEND);
10437 } else {
10438 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10439 ett_gtp_flags, gtp_prime_flags, gtp_hdr->flags, BMT_NO_APPEND);
10441 } else {
10442 static int * const gtp_flags[] = {
10443 &hf_gtp_flags_ver,
10444 &hf_gtp_flags_pt,
10445 &hf_gtp_flags_spare2,
10446 &hf_gtp_flags_e,
10447 &hf_gtp_flags_s,
10448 &hf_gtp_flags_pn,
10449 NULL
10451 static int * const gtp_v0_flags[] = {
10452 &hf_gtp_flags_ver,
10453 &hf_gtp_flags_pt,
10454 &hf_gtp_flags_spare1,
10455 &hf_gtp_flags_snn,
10456 NULL
10458 ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, ENC_NA);
10459 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
10461 if (gtp_version == 0) {
10462 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10463 ett_gtp_flags, gtp_v0_flags, gtp_hdr->flags, BMT_NO_APPEND);
10464 } else {
10465 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10466 ett_gtp_flags, gtp_flags, gtp_hdr->flags, BMT_NO_APPEND);
10470 offset++;
10472 gtp_hdr->message = tvb_get_uint8(tvb, offset);
10473 /* Link direction is needed to properly dissect PCO */
10474 switch(gtp_hdr->message){
10475 case GTP_MSG_DELETE_PDP_REQ:
10476 case GTP_MSG_UPDATE_PDP_REQ:
10477 case GTP_MSG_CREATE_PDP_REQ:
10478 case GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ:
10479 case GTP_MSG_PDU_NOTIFY_REQ:
10480 case GTP_MSG_PDU_NOTIFY_REJ_REQ:
10481 case GTP_MSG_FORW_RELOC_REQ: /* direction added for UTRAN Container & BSS Container decode */
10482 pinfo->link_dir = P2P_DIR_UL;
10483 break;
10484 case GTP_MSG_DELETE_PDP_RESP:
10485 case GTP_MSG_UPDATE_PDP_RESP:
10486 case GTP_MSG_CREATE_PDP_RESP:
10487 case GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP:
10488 case GTP_MSG_FORW_RELOC_RESP: /* direction added for UTRAN Container & BSS Container decode */
10489 pinfo->link_dir = P2P_DIR_DL;
10490 break;
10491 default:
10492 break;
10494 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(gtp_hdr->message, &gtp_message_type_ext, "Unknown"));
10495 message_item = proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, offset, 1, gtp_hdr->message);
10496 offset++;
10498 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, ENC_BIG_ENDIAN, &gtp_hdr->length);
10499 offset += 2;
10501 /* We initialize the sequence number*/
10502 has_SN = false;
10503 if (gtp_prime) {
10504 has_SN = true;
10505 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10506 offset += 2;
10507 /* If GTP' version is 0 and bit 1 is 0 20 bytes header is used, dissect it */
10508 if( (gtp_version == 0) && ((gtp_hdr->flags & 0x01) == 0) ) {
10509 proto_tree_add_item(gtp_tree, hf_gtp_dummy_octets, tvb, offset, 14, ENC_NA);
10510 offset += 14;
10513 set_actual_length(tvb, offset + gtp_hdr->length);
10514 } else {
10515 switch (gtp_version) {
10516 case 0:
10517 has_SN = true;
10518 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10519 offset += 2;
10521 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, ENC_BIG_ENDIAN, &flow_label);
10522 offset += 2;
10524 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, ENC_NA, &pdu_no);
10525 offset += 4;
10527 tid_str = id_to_str(tvb, offset);
10528 proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
10529 offset += 8;
10531 set_actual_length(tvb, offset + gtp_hdr->length);
10533 break;
10534 case 1:
10535 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_teid, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
10536 gtp_hdr->teid = value;
10537 offset += 4;
10539 set_actual_length(tvb, offset + gtp_hdr->length);
10541 /* Are sequence number/N-PDU Number/extension header present?
10542 See NOTE 5 of Figure 2 of 3GPP TS 29.060 version 4.3.0
10543 Release 4 - the Sequence Number, N-PDU Number, and
10544 Next Extension Header fields are present if any of
10545 GTP_E_MASK, GTP_S_MASK, or GTP_PN_MASK are set. */
10546 if (gtp_hdr->flags & (GTP_E_MASK|GTP_S_MASK|GTP_PN_MASK)) {
10547 /* Those fields are only *interpreted* if the
10548 particular flag for the field is set. */
10549 if (gtp_hdr->flags & GTP_S_MASK) {
10550 has_SN = true;
10551 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10553 offset += 2;
10555 if (gtp_hdr->flags & GTP_PN_MASK) {
10556 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, ENC_NA, &pdu_no);
10558 offset++;
10560 if (gtp_hdr->flags & GTP_E_MASK) {
10561 proto_item* hdr_ext_item;
10562 hdr_ext_item = proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, ENC_NA, &next_hdr);
10563 offset++;
10564 /* Add each extension header found. */
10565 while (next_hdr != 0) {
10566 tf = proto_tree_add_item(gtp_tree, hf_gtp_ext_hdr, tvb, offset, 0, ENC_NA);
10567 ext_tree = proto_item_add_subtree(tf, ett_gtp_ext_hdr);
10568 ext_hdr_len_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_length, tvb, offset, 1, ENC_NA, &ext_hdr_length);
10569 proto_item_set_len(tf, ext_hdr_length * 4);
10570 if (ext_hdr_length == 0) {
10571 expert_add_info_format(pinfo, ext_hdr_len_item, &ei_gtp_ext_length_mal,
10572 "Extension header length is zero");
10573 return tvb_reported_length(tvb);
10575 offset++;
10576 proto_item_append_text(tf, " (%s)", val_to_str_const(next_hdr, next_extension_header_fieldvals, "Unknown"));
10578 switch (next_hdr) {
10580 case GTP_EXT_HDR_UDP_PORT:
10581 /* UDP Port
10582 * 3GPP 29.281 v9.0.0, 5.2.2.1 UDP Port
10583 * "This extension header may be transmitted in
10584 * Error Indication messages to provide the UDP
10585 * Source Port of the G-PDU that triggered the
10586 * Error Indication. It is 4 octets long, and
10587 * therefore the Length field has value 1"
10589 if (ext_hdr_length == 1) {
10590 /* UDP Port of source */
10591 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_udp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
10592 } else {
10593 /* Bad length */
10594 expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the UDP Port Extension header should be 1.");
10596 break;
10598 case GTP_EXT_HDR_RAN_CONT:
10599 /* RAN Container
10600 * 3GPP 29.281 v15.2.0, 5.2.2.4 RAN Container
10601 * This extension header may be transmitted in
10602 * a G-PDU over the X2 user plane interface
10603 * between the eNBs. The RAN Container has a
10604 * variable length and its content is specified
10605 * in 3GPP TS 36.425 [25]. A G-PDU message with
10606 * this extension header may be sent without a T-PDU.
10608 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_ran_cont, tvb, offset, (4*ext_hdr_length)-1, ENC_NA);
10609 break;
10611 case GTP_EXT_HDR_LONG_PDCP_PDU:
10612 /* Long PDCP PDU Number
10613 * 3GPP 29.281 v15.2.0, 5.2.2.2A Long PDCP PDU Number
10614 * This extension header is used for direct X2 or
10615 * indirect S1 DL data forwarding during a Handover
10616 * procedure between two eNBs. The Long PDCP PDU number
10617 * extension header is 8 octets long, and therefore
10618 * the Length field has value 2.
10619 * The PDCP PDU number field of the Long PDCP PDU number
10620 * extension header has a maximum value which requires 18
10621 * bits (see 3GPP TS 36.323 [24]). Bit 2 of octet 2 is
10622 * the most significant bit and bit 1 of octet 4 is the
10623 * least significant bit, see Figure 5.2.2.2A-1. Bits 8 to
10624 * 3 of octet 2, and Bits 8 to 1 of octets 5 to 7 shall be
10625 * set to 0.
10626 * NOTE: A G-PDU which includes a PDCP PDU Number contains
10627 * either the extension header PDCP PDU Number or Long PDCP
10628 * PDU Number.
10630 if (ext_hdr_length == 2) {
10631 proto_tree_add_bits_item(ext_tree, hf_gtp_ext_hdr_spare_bits, tvb, offset<<3, 6, ENC_BIG_ENDIAN);
10632 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_long_pdcp_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10633 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_spare_bytes, tvb, offset+3, 3, ENC_NA);
10634 } else {
10635 expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the Long PDCP SN Extension header should be 2.");
10637 break;
10639 case GTP_EXT_HDR_XW_RAN_CONT:
10640 /* Xw RAN Container
10641 * 3GPP 29.281 v15.2.0, 5.2.2.5 Xw RAN Container
10642 * This extension header may be transmitted in a
10643 * G-PDU over the Xw user plane interface between
10644 * the eNB and the WLAN Termination (WT). The Xw
10645 * RAN Container has a variable length and its
10646 * content is specified in 3GPP TS 36.464 [27].
10647 * A G-PDU message with this extension header may
10648 * be sent without a T-PDU.
10650 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_xw_ran_cont, tvb, offset, (4*ext_hdr_length)-1, ENC_NA);
10651 break;
10653 case GTP_EXT_HDR_NR_RAN_CONT:
10654 /* NR RAN Container
10655 * 3GPP 29.281 v15.2.0, 5.2.2.6 NR RAN Container
10656 * This extension header may be transmitted in a
10657 * G-PDU over the X2-U, Xn-U and F1-U user plane
10658 * interfaces, within NG-RAN and, for EN-DC, within
10659 * E-UTRAN. The NR RAN Container has a variable
10660 * length and its content is specified in 3GPP TS
10661 * 38.425 [30]. A G-PDU message with this extension
10662 * header may be sent without a T-PDU.
10664 ran_cont_tree = proto_tree_add_subtree(ext_tree, tvb, offset, (ext_hdr_length * 4) - 1, ett_gtp_nr_ran_cont, NULL, "NR RAN Container");
10665 addRANContParameter(tvb, pinfo, ran_cont_tree, offset, (ext_hdr_length * 4) - 1);
10666 break;
10668 case GTP_EXT_HDR_PDU_SESSION_CONT:
10670 /* PDU Session Container
10671 * 3GPP 29.281 v15.2.0, 5.2.2.7 PDU Session Container
10672 * This extension header may be transmitted in a G-PDU
10673 * over the N3 and N9 user plane interfaces, between
10674 * NG-RAN and UPF, or between two UPFs. The PDU Session
10675 * Container has a variable length and its content is
10676 * specified in 3GPP TS 38.415 [31].
10678 static int * const flags1_dl[] = {
10679 &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
10680 &hf_gtp_ext_hdr_pdu_ses_cont_snp_dl,
10681 &hf_gtp_ext_hdr_pdu_ses_cont_msnp,
10682 &hf_gtp_spare_b0,
10683 NULL
10685 static int * const flags1_ul[] = {
10686 &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
10687 &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind,
10688 &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind,
10689 &hf_gtp_ext_hdr_pdu_ses_cont_snp_ul,
10690 NULL
10692 static int * const flags2[] = {
10693 &hf_gtp_ext_hdr_pdu_ses_cont_ppp,
10694 &hf_gtp_ext_hdr_pdu_ses_cont_rqi,
10695 &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
10696 NULL
10698 static int * const flags3[] = {
10699 &hf_gtp_ext_hdr_pdu_ses_cont_ppi,
10700 &hf_gtp_spare_b4b0,
10701 NULL
10703 static int * const flags4[] = {
10704 &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind,
10705 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag,
10706 &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
10707 NULL
10709 static int * const flags5[] = {
10710 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7,
10711 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6,
10712 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5,
10713 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4,
10714 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3,
10715 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2,
10716 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1,
10717 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0,
10718 NULL
10720 static int * const flags6[] = {
10721 &hf_gtp_spare_b7b1,
10722 &hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind,
10723 NULL
10726 proto_tree *pdu_ses_cont_tree;
10727 uint32_t pdu_type;
10728 uint64_t flags1_val, flags2_val, flags4_val, flags5_val;
10729 int curr_offset = offset;
10731 pdu_ses_cont_tree = proto_tree_add_subtree(ext_tree, tvb, curr_offset, (ext_hdr_length * 4) - 1, ett_pdu_session_cont, NULL, "PDU Session Container");
10732 proto_tree_add_item_ret_uint(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_pdu_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &pdu_type);
10733 switch (pdu_type) {
10734 case 0:
10735 /* PDU Type: DL PDU SESSION INFORMATION (0) */
10736 /* PDU Type QMP SNP MSNP Spare */
10737 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags1_dl, ENC_BIG_ENDIAN, &flags1_val);
10738 curr_offset++;
10739 /* PPP RQI QoS Flow Identifier */
10740 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags2, ENC_BIG_ENDIAN, &flags2_val);
10741 curr_offset++;
10742 if (flags2_val & 0x80) {
10743 /* PPI Spare */
10744 proto_tree_add_bitmask_list(pdu_ses_cont_tree, tvb, curr_offset, 1, flags3, ENC_BIG_ENDIAN);
10745 curr_offset++;
10747 if (flags1_val & 0x08) {
10748 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10749 curr_offset += 8;
10751 if (flags1_val & 0x04) {
10752 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_qfi_sn, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
10753 curr_offset += 3;
10755 if (flags1_val & 0x02) {
10756 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_mbs_qfi_sn, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10757 //curr_offset += 4;
10759 break;
10760 case 1:
10761 /* PDU Type: UL PDU SESSION INFORMATION (1)*/
10762 /* PDU Type QMP DL Delay Ind UL Delay Ind SNP */
10763 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags1_ul, ENC_BIG_ENDIAN, &flags1_val);
10764 curr_offset++;
10765 /* N3/N9 Delay ind New IE Flag QoS Flow Identifier */
10766 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags4, ENC_BIG_ENDIAN, &flags4_val);
10767 curr_offset++;
10768 if (flags1_val & 0x08) {
10769 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp_repeat, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10770 curr_offset += 8;
10771 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_recv_time_stamp, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10772 curr_offset += 8;
10773 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_ul_send_time_stamp, tvb, curr_offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
10774 curr_offset += 8;
10776 if (flags1_val & 0x04) {
10777 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_result, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10778 curr_offset += 4;
10780 if (flags1_val & 0x02) {
10781 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_result, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10782 curr_offset += 4;
10784 if (flags1_val & 0x01) {
10785 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_ul_qfi_sn, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
10786 curr_offset += 3;
10788 if (flags4_val & 0x80) {
10789 proto_tree_add_item(pdu_ses_cont_tree, hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_result, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
10790 curr_offset += 4;
10792 if (flags4_val & 0x40) {
10793 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags5, ENC_BIG_ENDIAN, &flags5_val);
10794 curr_offset++;
10795 if (flags5_val & 0x01) {
10796 proto_tree_add_bitmask_list(pdu_ses_cont_tree, tvb, curr_offset, 1, flags6, ENC_BIG_ENDIAN);
10797 //curr_offset++;
10800 break;
10801 default:
10802 proto_tree_add_expert(pdu_ses_cont_tree, pinfo, &ei_gtp_unknown_pdu_type, tvb, offset, (ext_hdr_length * 4) - 1);
10803 break;
10806 break;
10808 case GTP_EXT_HDR_PDCP_SN:
10809 /* PDCP PDU
10810 * 3GPP 29.281 v9.0.0, 5.2.2.2 PDCP PDU Number
10812 * "This extension header is transmitted, for
10813 * example in UTRAN, at SRNS relocation time,
10814 * to provide the PDCP sequence number of not
10815 * yet acknowledged N-PDUs. It is 4 octets long,
10816 * and therefore the Length field has value 1.
10818 * When used during a handover procedure between
10819 * two eNBs at the X2 interface (direct DL data
10820 * forwarding) or via the S1 interface (indirect
10821 * DL data forwarding) in E-UTRAN, bit 8 of octet
10822 * 2 is spare and shall be set to zero.
10824 * Wireshark Note: TS 29.060 does not define bit
10825 * 5-6 as spare, so no check is possible unless
10826 * a preference is used.
10828 /* First byte is length (should be 1) */
10829 if (ext_hdr_length == 1) {
10830 proto_item* ext_item;
10832 ext_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_pdcpsn, tvb, offset, 2, ENC_BIG_ENDIAN, &ext_hdr_pdcpsn);
10833 if (ext_hdr_pdcpsn & 0x8000) {
10834 expert_add_info(pinfo, ext_item, &ei_gtp_ext_hdr_pdcpsn);
10836 } else {
10837 expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the PDCP SN Extension header should be 1.");
10839 break;
10841 case GTP_EXT_HDR_SUSPEND_REQ:
10842 /* Suspend Request */
10843 break;
10845 case GTP_EXT_HDR_SUSPEND_RESP:
10846 /* Suspend Response */
10847 break;
10849 default:
10851 tvbuff_t * ext_hdr_tvb;
10852 gtp_hdr_ext_info_t gtp_hdr_ext_info;
10854 gtp_hdr_ext_info.hdr_ext_item = hdr_ext_item;
10855 /* NOTE Type and length included in the call */
10856 ext_hdr_tvb = tvb_new_subset_remaining(tvb, offset - 2);
10857 dissector_try_uint_new(gtp_hdr_ext_dissector_table, next_hdr, ext_hdr_tvb, pinfo, ext_tree, false, &gtp_hdr_ext_info);
10858 break;
10861 offset += ext_hdr_length*4 - 2;
10862 hdr_ext_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, ENC_NA, &next_hdr);
10863 offset++;
10865 } else
10866 offset++;
10868 break;
10869 default:
10870 break;
10874 if (gtp_hdr->message != GTP_MSG_TPDU) {
10875 /* Dissect IEs */
10876 mandatory = 0; /* check order of GTP fields against ETSI */
10877 while (tvb_reported_length_remaining(tvb, offset) > 0) {
10878 decoder = NULL;
10879 ext_hdr_val = tvb_get_uint8(tvb, offset);
10880 if (g_gtp_etsi_order) {
10881 checked_field = check_field_presence_and_decoder(gtp_hdr->message, ext_hdr_val, &mandatory, &decoder);
10882 switch (checked_field) {
10883 case -2:
10884 expert_add_info(pinfo, message_item, &ei_gtp_message_not_found);
10885 break;
10886 case -1:
10887 expert_add_info(pinfo, message_item, &ei_gtp_field_not_present);
10888 break;
10889 case 0:
10890 break;
10891 default:
10892 expert_add_info_format(pinfo, message_item, &ei_gtp_wrong_next_field, "[WARNING] wrong next field, should be: %s",
10893 val_to_str_ext_const(checked_field, &gtp_val_ext, "Unknown extension field"));
10894 break;
10898 if (decoder == NULL) {
10899 i = -1;
10900 while (gtpopt[++i].optcode)
10901 if (gtpopt[i].optcode == ext_hdr_val)
10902 break;
10903 decoder = gtpopt[i].decode;
10906 offset = offset + (*decoder) (tvb, offset, pinfo, gtp_tree, args);
10909 if (args && !PINFO_FD_VISITED(pinfo)) {
10910 /* We insert the lists inside the table*/
10911 fill_map(args->teid_list, args->ip_list, pinfo->num);
10913 /*Use sequence number to track Req/Resp pairs*/
10914 if (has_SN) {
10915 uint8_t cause_aux = 128; /* Cause accepted by default. Only used when args is NULL */
10916 if (args) {
10917 cause_aux = args->last_cause;
10919 gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr->message, gtp_info, cause_aux);
10920 /*pass packet to tap for response time reporting*/
10921 if (gcrp) {
10922 tap_queue_packet(gtp_tap,pinfo,gcrp);
10926 if (args) {
10927 track_gtp_session(tvb, pinfo, gtp_tree, gtp_hdr, args->teid_list, args->ip_list, args->last_teid, args->last_ip);
10929 proto_item_set_end(ti, tvb, offset);
10931 if ((gtp_hdr->message == GTP_MSG_TPDU) && (tvb_reported_length_remaining(tvb, offset) > 0)) {
10932 switch (dissect_tpdu_as) {
10933 case GTP_TPDU_AS_TPDU_HEUR: {
10934 heur_dtbl_entry_t *hdtbl_entry;
10935 tvbuff_t *next_tvb = tvb_new_subset_remaining(tvb, offset);
10936 if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) {
10937 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP/");
10938 } else {
10939 proto_tree_add_item(tree, hf_gtp_tpdu_data, next_tvb, 0, -1, ENC_NA);
10941 break;
10943 case GTP_TPDU_AS_PDCP_LTE:
10944 dissect_gtp_tpdu_as_pdcp_lte_info(tvb, pinfo, tree, gtp_hdr, offset);
10945 break;
10946 case GTP_TPDU_AS_PDCP_NR:
10947 dissect_gtp_tpsu_as_pdcp_nr_info(tvb, pinfo, tree, gtp_hdr, offset);
10948 break;
10949 case GTP_TPDU_AS_SYNC:
10950 dissect_gtp_tpdu_by_handle(sync_handle, tvb, pinfo, tree, offset + acfield_len);
10951 break;
10952 case GTP_TPDU_AS_ETHERNET:
10953 dissect_gtp_tpdu_by_handle(eth_handle, tvb, pinfo, tree, offset);
10954 break;
10955 case GTP_TPDU_AS_CUSTOM:
10956 /* Call a custom dissector if available */
10957 if (gtp_tpdu_custom_handle ||
10958 (gtp_tpdu_custom_handle = find_dissector("gtp_tpdu_custom"))) {
10959 dissect_gtp_tpdu_by_handle(gtp_tpdu_custom_handle, tvb, pinfo, tree, offset);
10960 } else {
10961 proto_tree_add_item(tree, hf_gtp_tpdu_data, tvb, offset, -1, ENC_NA);
10963 break;
10964 default:
10965 proto_tree_add_item(tree, hf_gtp_tpdu_data, tvb, offset, -1, ENC_NA);
10966 break;
10970 tap_queue_packet(gtpv1_tap,pinfo, gtp_hdr);
10972 return tvb_reported_length(tvb);
10975 static int
10976 dissect_gtpprime(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
10977 void *private_data _U_)
10979 return dissect_gtp_common(tvb, pinfo, tree);
10982 static int
10983 dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
10984 void *private_data _U_)
10986 uint8_t version;
10989 * Do we have enough data to check the first byte?
10991 if (!tvb_bytes_exist(tvb, 0, 1)) {
10992 /* No. */
10993 return 0;
10997 * If this is GTPv2-C call the gtpv2 dissector if present
10998 * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
11000 version = tvb_get_uint8(tvb,0)>>5;
11001 if (version > 2) {
11002 /* Unknown version - reject the packet */
11003 return 0;
11005 if (version == 2) {
11006 /* GTPv2-C 3GPP TS 29.274 */
11007 if (gtpv2_handle) {
11008 call_dissector(gtpv2_handle, tvb, pinfo, tree);
11009 return tvb_reported_length(tvb);
11013 return dissect_gtp_common(tvb, pinfo, tree);
11016 // Very minimal heuristic dissector for ethernet that recognizes ethernet with a limited
11017 // set of protocols, optionally with a set of vlan tags.
11018 // This dissector is not implemented in the packet-eth.c file as it is too simplistic
11019 // for general purpose.
11020 static bool
11021 dissect_eth_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
11023 int offset;
11024 uint16_t ethertype;
11026 if (tvb_reported_length(tvb) < 14) {
11027 return false;
11030 // skip both mac-addresses, no information to be gained from them
11031 offset = 12;
11033 ethertype = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
11034 offset += 2;
11036 if (ethertype == ETHERTYPE_QINQ_OLD || ethertype == ETHERTYPE_IEEE_802_1AD)
11038 if (tvb_reported_length_remaining(tvb, offset) < 4) {
11039 return false;
11041 ethertype = tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN);
11042 if (ethertype != ETHERTYPE_VLAN) {
11043 return false;
11045 offset += 4;
11047 while (ethertype == ETHERTYPE_VLAN)
11049 if (tvb_reported_length_remaining(tvb, offset) < 4) {
11050 return false;
11052 ethertype = tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN);
11053 offset += 4;
11056 switch (ethertype) {
11057 case ETHERTYPE_IP:
11058 case ETHERTYPE_IPv6:
11059 case ETHERTYPE_ARP:
11060 case ETHERTYPE_PPPOED:
11061 case ETHERTYPE_PPPOES:
11062 call_dissector(eth_handle, tvb, pinfo, tree);
11063 return true;
11066 return false;
11069 static void
11070 gtp_init(void)
11072 gtp_session_count = 1;
11075 void
11076 proto_register_gtp(void)
11078 module_t *gtp_module;
11079 expert_module_t* expert_gtp;
11080 unsigned i;
11081 unsigned last_offset;
11083 static hf_register_info hf_gtp[] = {
11085 {&hf_gtp_ie_id,
11086 { "IE Id", "gtp.ie_id",
11087 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtp_val_ext, 0x0,
11088 NULL, HFILL}
11090 {&hf_gtp_response_in,
11091 { "Response In", "gtp.response_in",
11092 FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
11093 "The response to this GTP request is in this frame", HFILL}
11095 {&hf_gtp_response_to,
11096 { "Response To", "gtp.response_to",
11097 FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
11098 "This is a response to the GTP request in this frame", HFILL}
11100 {&hf_gtp_time,
11101 { "Time", "gtp.time",
11102 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
11103 "The time between the Request and the Response", HFILL}
11105 {&hf_gtp_apn,
11106 { "APN", "gtp.apn",
11107 FT_STRING, BASE_NONE, NULL, 0,
11108 "Access Point Name", HFILL}
11110 {&hf_gtp_cause,
11111 { "Cause", "gtp.cause",
11112 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0,
11113 "Cause of operation", HFILL}
11115 {&hf_gtp_chrg_char,
11116 { "Charging characteristics", "gtp.chrg_char",
11117 FT_UINT16, BASE_DEC, NULL, 0,
11118 NULL, HFILL}
11120 {&hf_gtp_chrg_char_s,
11121 { "Spare", "gtp.chrg_char_s",
11122 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S,
11123 NULL, HFILL}
11125 {&hf_gtp_chrg_char_n,
11126 { "Normal charging", "gtp.chrg_char_n",
11127 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N,
11128 NULL, HFILL}
11130 {&hf_gtp_chrg_char_p,
11131 { "Prepaid charging", "gtp.chrg_char_p",
11132 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P,
11133 NULL, HFILL}
11135 {&hf_gtp_chrg_char_f,
11136 { "Flat rate charging", "gtp.chrg_char_f",
11137 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F,
11138 NULL, HFILL}
11140 {&hf_gtp_chrg_char_h,
11141 { "Hot billing charging", "gtp.chrg_char_h",
11142 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H,
11143 NULL, HFILL}
11145 {&hf_gtp_chrg_char_r,
11146 { "Reserved", "gtp.chrg_char_r",
11147 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R,
11148 NULL, HFILL}
11150 {&hf_gtp_chrg_id,
11151 { "Charging ID", "gtp.chrg_id",
11152 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11153 NULL, HFILL}
11155 {&hf_gtp_chrg_ipv4,
11156 { "CG address IPv4", "gtp.chrg_ipv4",
11157 FT_IPv4, BASE_NONE, NULL, 0,
11158 "Charging Gateway address IPv4", HFILL}
11160 {&hf_gtp_chrg_ipv6,
11161 { "CG address IPv6", "gtp.chrg_ipv6",
11162 FT_IPv6, BASE_NONE, NULL, 0,
11163 "Charging Gateway address IPv6", HFILL}
11165 {&hf_gtp_ext_flow_label,
11166 { "Flow Label Data I", "gtp.ext_flow_label",
11167 FT_UINT16, BASE_HEX, NULL, 0,
11168 NULL, HFILL}
11170 {&hf_gtp_ext_id,
11171 { "Extension identifier", "gtp.ext_id",
11172 FT_UINT16, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0,
11173 "Private Enterprise number", HFILL}
11175 {&hf_gtp_ext_val,
11176 { "Extension value", "gtp.ext_val",
11177 FT_BYTES, BASE_NONE, NULL, 0,
11178 NULL, HFILL}
11180 {&hf_gtp_flags,
11181 { "Flags", "gtp.flags",
11182 FT_UINT8, BASE_HEX, NULL, 0,
11183 "Ver/PT/Spare...", HFILL}
11185 {&hf_gtp_ext_hdr,
11186 { "Extension header", "gtp.ext_hdr",
11187 FT_NONE, BASE_NONE, NULL, 0,
11188 NULL, HFILL}
11190 {&hf_gtp_ext_hdr_next,
11191 { "Next extension header type", "gtp.ext_hdr.next",
11192 FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0,
11193 NULL, HFILL}
11195 {&hf_gtp_ext_hdr_ran_cont,
11196 { "RAN Container", "gtp.ext_hdr.ran_cont",
11197 FT_BYTES, BASE_NONE, NULL, 0,
11198 NULL, HFILL}
11200 {&hf_gtp_ext_hdr_spare_bits,
11201 { "Spare", "gtp.ext_hdr.spare_bits",
11202 FT_UINT8, BASE_HEX, NULL, 0,
11203 NULL, HFILL}
11205 {&hf_gtp_ext_hdr_spare_bytes,
11206 { "Spare", "gtp.ext_hdr.spare_bytes",
11207 FT_BYTES, BASE_NONE, NULL, 0,
11208 NULL, HFILL}
11210 {&hf_gtp_ext_hdr_long_pdcp_sn,
11211 { "Long PDCP Sequence Number", "gtp.ext_hdr.long_pdcp_sn",
11212 FT_UINT24, BASE_DEC, NULL, 0,
11213 NULL, HFILL}
11215 {&hf_gtp_ext_hdr_xw_ran_cont,
11216 { "Xw RAN Container", "gtp.ext_hdr.xw_ran_cont",
11217 FT_BYTES, BASE_NONE, NULL, 0,
11218 NULL, HFILL}
11221 { &hf_gtp_ext_hdr_pdu_ses_cont_pdu_type,
11222 { "PDU Type", "gtp.ext_hdr.pdu_ses_con.pdu_type",
11223 FT_UINT8, BASE_DEC, VALS(gtp_ext_hdr_pdu_ses_cont_pdu_type_vals), 0xf0,
11224 NULL, HFILL}
11226 { &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
11227 { "QoS Monitoring Packet", "gtp.ext_hdr.pdu_ses_con.qmp",
11228 FT_BOOLEAN, 8, TFS(&tfs_used_notused), 0x08,
11229 NULL, HFILL}
11231 { &hf_gtp_ext_hdr_pdu_ses_cont_snp_dl,
11232 { "Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.snp",
11233 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11234 NULL, HFILL}
11236 { &hf_gtp_ext_hdr_pdu_ses_cont_msnp,
11237 { "MBS Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.msnp",
11238 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11239 NULL, HFILL}
11241 { &hf_gtp_ext_hdr_pdu_ses_cont_ppp,
11242 { "Paging Policy Presence (PPP)", "gtp.ext_hdr.pdu_ses_cont.ppp",
11243 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11244 NULL, HFILL}
11246 { &hf_gtp_ext_hdr_pdu_ses_cont_rqi,
11247 { "Reflective QoS Indicator (RQI)", "gtp.ext_hdr.pdu_ses_cont.rqi",
11248 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11249 NULL, HFILL}
11251 { &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
11252 { "QoS Flow Identifier (QFI)", "gtp.ext_hdr.pdu_ses_con.qos_flow_id",
11253 FT_UINT8, BASE_DEC, NULL, 0x3f,
11254 NULL, HFILL}
11256 { &hf_gtp_ext_hdr_pdu_ses_cont_ppi,
11257 { "Paging Policy Indicator (PPI)", "gtp.ext_hdr.pdu_ses_cont.ppi",
11258 FT_UINT8, BASE_DEC, NULL, 0xe0,
11259 NULL, HFILL}
11261 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp,
11262 { "DL Sending Time Stamp", "gtp.ext_hdr.pdu_ses_cont.dl_send_time_stamp",
11263 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11264 NULL, HFILL}
11266 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_qfi_sn,
11267 { "DL QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.dl_qfi_sn",
11268 FT_UINT24, BASE_DEC, NULL, 0,
11269 NULL, HFILL}
11271 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_mbs_qfi_sn,
11272 { "DL MBS QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.dl_mbs_qfi_sn",
11273 FT_UINT32, BASE_DEC, NULL, 0,
11274 NULL, HFILL}
11276 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind,
11277 { "DL Delay Ind", "gtp.ext_hdr.pdu_ses_con.dl_delay_ind",
11278 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11279 NULL, HFILL}
11281 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind,
11282 { "UL Delay Ind", "gtp.ext_hdr.pdu_ses_con.ul_delay_ind",
11283 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11284 NULL, HFILL}
11286 { &hf_gtp_ext_hdr_pdu_ses_cont_snp_ul,
11287 { "Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.snp",
11288 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
11289 NULL, HFILL}
11291 { &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind,
11292 { "N3/N9 Delay Ind", "gtp.ext_hdr.pdu_ses_con.n3_n9_delay_ind",
11293 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11294 NULL, HFILL}
11296 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag,
11297 { "New IE Flag", "gtp.ext_hdr.pdu_ses_con.new_ie_flag",
11298 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11299 NULL, HFILL}
11301 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp_repeat,
11302 { "DL Sending Time Stamp Repeated", "gtp.ext_hdr.pdu_ses_cont.dl_send_time_stamp_repeat",
11303 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11304 NULL, HFILL}
11306 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_recv_time_stamp,
11307 { "DL Received Time Stamp", "gtp.ext_hdr.pdu_ses_cont.dl_recv_time_stamp",
11308 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11309 NULL, HFILL}
11311 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_send_time_stamp,
11312 { "UL Sending Time Stamp", "gtp.ext_hdr.pdu_ses_cont.ul_send_time_stamp",
11313 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11314 NULL, HFILL}
11316 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_result,
11317 { "DL Delay Result", "gtp.ext_hdr.pdu_ses_cont.dl_delay_result",
11318 FT_UINT32, BASE_DEC, NULL, 0,
11319 NULL, HFILL}
11321 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_result,
11322 { "UL Delay Result", "gtp.ext_hdr.pdu_ses_cont.ul_delay_result",
11323 FT_UINT32, BASE_DEC, NULL, 0,
11324 NULL, HFILL}
11326 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_qfi_sn,
11327 { "UL QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.ul_qfi_sn",
11328 FT_UINT24, BASE_DEC, NULL, 0,
11329 NULL, HFILL}
11331 { &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_result,
11332 { "N3/N9 Delay Result", "gtp.ext_hdr.pdu_ses_cont.n3_n9_delay_result",
11333 FT_UINT32, BASE_DEC, NULL, 0,
11334 NULL, HFILL}
11336 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7,
11337 { "New IE Flag 7", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_7",
11338 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11339 NULL, HFILL}
11341 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6,
11342 { "New IE Flag 6", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_6",
11343 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11344 NULL, HFILL}
11346 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5,
11347 { "New IE Flag 5", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_5",
11348 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
11349 NULL, HFILL}
11351 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4,
11352 { "New IE Flag 4", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_4",
11353 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
11354 NULL, HFILL}
11356 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3,
11357 { "New IE Flag 3", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_3",
11358 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
11359 NULL, HFILL}
11361 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2,
11362 { "New IE Flag 2", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_2",
11363 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11364 NULL, HFILL}
11366 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1,
11367 { "New IE Flag 1", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_1",
11368 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11369 NULL, HFILL}
11371 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0,
11372 { "New IE Flag 0", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_0",
11373 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
11374 NULL, HFILL}
11376 { &hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind,
11377 { "D1 UL PDCP Delay Result Ind", "gtp.ext_hdr.pdu_ses_cont.d1_ul_pdcp_delay_result_ind",
11378 FT_BOOLEAN, 8, TFS(&tfs_included_not_included), 0x01,
11379 NULL, HFILL}
11382 {&hf_pdcp_cont,
11383 { "PDCP Protocol", "gtp.pdcp",
11384 FT_BYTES, BASE_NONE, NULL, 0,
11385 NULL, HFILL}
11387 {&hf_gtp_ext_hdr_pdcpsn,
11388 { "PDCP Sequence Number", "gtp.ext_hdr.pdcp_sn",
11389 FT_UINT16, BASE_DEC, NULL, 0,
11390 NULL, HFILL}
11392 {&hf_gtp_ext_hdr_udp_port,
11393 { "UDP Port", "gtp.ext_hdr.udp_port",
11394 FT_UINT16, BASE_DEC, NULL, 0,
11395 NULL, HFILL}
11397 {&hf_gtp_ext_hdr_length,
11398 { "Extension Header Length", "gtp.ext_hdr.length",
11399 FT_UINT8, BASE_DEC, NULL, 0,
11400 NULL, HFILL}
11402 {&hf_gtp_flags_ver,
11403 { "Version", "gtp.flags.version",
11404 FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
11405 "GTP Version", HFILL}
11407 {&hf_gtp_prime_flags_ver,
11408 { "Version", "gtp.prim.flags.version",
11409 FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK,
11410 "GTP' Version", HFILL}
11412 {&hf_gtp_flags_pt,
11413 { "Protocol type", "gtp.flags.payload",
11414 FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
11415 NULL, HFILL}
11417 {&hf_gtp_flags_spare1,
11418 { "Reserved", "gtp.flags.reserved",
11419 FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
11420 "Reserved (shall be sent as '111' )", HFILL}
11422 {&hf_gtp_flags_hdr_length,
11423 { "Header length", "gtp.flags.hdr_length",
11424 FT_BOOLEAN, 8, TFS(&gtp_hdr_length_vals), 0x01,
11425 NULL, HFILL}
11427 {&hf_gtp_flags_snn,
11428 { "Is SNDCP N-PDU included?", "gtp.flags.snn",
11429 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_SNN_MASK,
11430 "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}
11432 {&hf_gtp_flags_spare2,
11433 { "Reserved", "gtp.flags.reserved",
11434 FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK,
11435 "Reserved (shall be sent as '1' )", HFILL}
11437 {&hf_gtp_flags_e,
11438 { "Is Next Extension Header present?", "gtp.flags.e",
11439 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_E_MASK,
11440 "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}
11442 {&hf_gtp_flags_s,
11443 { "Is Sequence Number present?", "gtp.flags.s",
11444 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_S_MASK,
11445 "Is Sequence Number present? (1 = yes, 0 = no)", HFILL}
11447 {&hf_gtp_flags_pn,
11448 { "Is N-PDU number present?", "gtp.flags.pn",
11449 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_PN_MASK,
11450 "Is N-PDU number present? (1 = yes, 0 = no)", HFILL}
11452 {&hf_gtp_flow_ii,
11453 { "Flow Label Data II", "gtp.flow_ii",
11454 FT_UINT16, BASE_DEC, NULL, 0,
11455 "Downlink flow label data", HFILL}
11457 {&hf_gtp_flow_label,
11458 { "Flow label", "gtp.flow_label",
11459 FT_UINT16, BASE_HEX, NULL, 0,
11460 NULL, HFILL}
11462 {&hf_gtp_flow_sig,
11463 { "Flow label Signalling", "gtp.flow_sig",
11464 FT_UINT16, BASE_HEX, NULL, 0,
11465 NULL, HFILL}
11467 {&hf_gtp_gsn_addr_len,
11468 { "GSN Address Length", "gtp.gsn_addr_len",
11469 FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK,
11470 NULL, HFILL}
11472 {&hf_gtp_gsn_addr_type,
11473 { "GSN Address Type", "gtp.gsn_addr_type",
11474 FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK,
11475 NULL, HFILL}
11477 {&hf_gtp_gsn_ipv4,
11478 { "GSN address IPv4", "gtp.gsn_ipv4",
11479 FT_IPv4, BASE_NONE, NULL, 0,
11480 NULL, HFILL}
11482 {&hf_gtp_gsn_ipv6,
11483 { "GSN address IPv6", "gtp.gsn_ipv6",
11484 FT_IPv6, BASE_NONE, NULL, 0,
11485 NULL, HFILL}
11487 {&hf_gtp_length,
11488 { "Length", "gtp.length",
11489 FT_UINT16, BASE_DEC, NULL, 0,
11490 "Length (i.e. number of octets after TID or TEID)", HFILL}
11492 {&hf_gtp_map_cause,
11493 { "MAP cause", "gtp.map_cause",
11494 FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0,
11495 NULL, HFILL}
11497 {&hf_gtp_message_type,
11498 { "Message Type", "gtp.message",
11499 FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gtp_message_type_ext, 0x0,
11500 "GTP Message Type", HFILL}
11502 {&hf_gtp_ms_reason,
11503 { "MS not reachable reason", "gtp.ms_reason",
11504 FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0,
11505 NULL, HFILL}
11507 {&hf_gtp_ms_valid,
11508 { "MS validated", "gtp.ms_valid",
11509 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11510 NULL, HFILL}
11512 {&hf_gtp_node_ipv4,
11513 { "Node address IPv4", "gtp.node_ipv4",
11514 FT_IPv4, BASE_NONE, NULL, 0,
11515 "Recommended node address IPv4", HFILL}
11517 {&hf_gtp_node_ipv6,
11518 { "Node address IPv6", "gtp.node_ipv6",
11519 FT_IPv6, BASE_NONE, NULL, 0,
11520 "Recommended node address IPv6", HFILL}
11522 {&hf_gtp_node_name,
11523 { "Node name", "gtp.node_name",
11524 FT_UINT_STRING, BASE_NONE, NULL, 0,
11525 "Diameter Identity of the node", HFILL}
11527 {&hf_gtp_node_realm,
11528 { "Node realm", "gtp.node_realm",
11529 FT_UINT_STRING, BASE_NONE, NULL, 0,
11530 "Diameter Realm Identity of the node", HFILL}
11532 {&hf_gtp_npdu_number,
11533 { "N-PDU Number", "gtp.npdu_number",
11534 FT_UINT8, BASE_HEX, NULL, 0,
11535 NULL, HFILL}
11537 {&hf_gtp_nsapi,
11538 { "NSAPI", "gtp.nsapi",
11539 FT_UINT8, BASE_DEC, NULL, 0x0f,
11540 "Network layer Service Access Point Identifier", HFILL}
11542 {&hf_gtp_qos_version,
11543 { "Version", "gtp.qos_version",
11544 FT_UINT8, BASE_HEX, NULL, 0,
11545 "Version of the QoS Profile", HFILL}
11547 {&hf_gtp_qos_spare1,
11548 { "Spare", "gtp.qos_spare1",
11549 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK,
11550 "Spare (shall be sent as '00' )", HFILL}
11552 {&hf_gtp_qos_delay,
11553 { "QoS delay", "gtp.qos_delay",
11554 FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK,
11555 "Quality of Service Delay Class", HFILL}
11557 {&hf_gtp_qos_reliability,
11558 { "QoS reliability", "gtp.qos_reliability",
11559 FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
11560 "Quality of Service Reliability Class", HFILL}
11562 {&hf_gtp_qos_peak,
11563 { "QoS peak", "gtp.qos_peak",
11564 FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK,
11565 "Quality of Service Peak Throughput", HFILL}
11567 {&hf_gtp_qos_spare2,
11568 { "Spare", "gtp.qos_spare2",
11569 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK,
11570 "Spare (shall be sent as 0)", HFILL}
11572 {&hf_gtp_qos_precedence,
11573 { "QoS precedence", "gtp.qos_precedence",
11574 FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
11575 "Quality of Service Precedence Class", HFILL}
11577 {&hf_gtp_qos_spare3,
11578 { "Spare", "gtp.qos_spare3",
11579 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK,
11580 "Spare (shall be sent as '000' )", HFILL}
11582 {&hf_gtp_qos_mean,
11583 { "QoS mean", "gtp.qos_mean",
11584 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_mean_type_ext, GTP_EXT_QOS_MEAN_MASK,
11585 "Quality of Service Mean Throughput", HFILL}
11587 {&hf_gtp_qos_al_ret_priority,
11588 { "Allocation/Retention priority", "gtp.qos_al_ret_priority",
11589 FT_UINT8, BASE_DEC, NULL, 0,
11590 NULL, HFILL}
11592 {&hf_gtp_qos_traf_class,
11593 { "Traffic class", "gtp.qos_traf_class",
11594 FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK,
11595 NULL, HFILL}
11597 {&hf_gtp_qos_del_order,
11598 { "Delivery order", "gtp.qos_del_order",
11599 FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK,
11600 NULL, HFILL}
11602 {&hf_gtp_qos_del_err_sdu,
11603 { "Delivery of erroneous SDU", "gtp.qos_del_err_sdu",
11604 FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK,
11605 NULL, HFILL}
11607 /* The SDU size and UL/DL bandwidth items take up one octet in the
11608 * frame, but are multiplied by various factors before being added
11609 * to the tree with proto_item_add_uint[_format_value].
11611 {&hf_gtp_qos_max_sdu_size,
11612 { "Maximum SDU size", "gtp.qos_max_sdu_size",
11613 FT_UINT16, BASE_DEC, VALS(qos_max_sdu_size), 0,
11614 NULL, HFILL}
11616 {&hf_gtp_qos_max_ul,
11617 { "Maximum bit rate for uplink", "gtp.qos_max_ul",
11618 FT_UINT16, BASE_DEC, VALS(qos_max_ul), 0,
11619 NULL, HFILL}
11621 {&hf_gtp_qos_max_dl,
11622 { "Maximum bit rate for downlink", "gtp.qos_max_dl",
11623 FT_UINT16, BASE_DEC, VALS(qos_max_dl), 0,
11624 NULL, HFILL}
11626 {&hf_gtp_qos_res_ber,
11627 { "Residual BER", "gtp.qos_res_ber",
11628 FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK,
11629 "Residual Bit Error Rate", HFILL}
11631 {&hf_gtp_qos_sdu_err_ratio,
11632 { "SDU Error ratio", "gtp.qos_sdu_err_ratio",
11633 FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK,
11634 NULL,
11635 HFILL}
11637 {&hf_gtp_qos_trans_delay,
11638 { "Transfer delay", "gtp.qos_trans_delay",
11639 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_trans_delay_ext, GTP_EXT_QOS_TRANS_DELAY_MASK,
11640 NULL, HFILL}
11642 {&hf_gtp_qos_traf_handl_prio,
11643 { "Traffic handling priority", "gtp.qos_traf_handl_prio",
11644 FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
11645 NULL, HFILL}
11647 {&hf_gtp_qos_guar_ul,
11648 { "Guaranteed bit rate for uplink", "gtp.qos_guar_ul",
11649 FT_UINT16, BASE_DEC, VALS(qos_guar_ul), 0,
11650 NULL, HFILL}
11652 {&hf_gtp_qos_guar_dl,
11653 { "Guaranteed bit rate for downlink", "gtp.qos_guar_dl",
11654 FT_UINT16, BASE_DEC, VALS(qos_guar_dl), 0,
11655 NULL, HFILL}
11657 {&hf_gtp_qos_spare4,
11658 { "Spare", "gtp.qos_spare4",
11659 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE4_MASK,
11660 "Spare (shall be sent as '000' )", HFILL}
11662 {&hf_gtp_qos_sig_ind,
11663 { "Signalling Indication", "gtp.sig_ind",
11664 FT_BOOLEAN, 8, TFS(&gtp_sig_ind), GTP_EXT_QOS_SIG_IND_MASK,
11665 NULL, HFILL}
11667 {&hf_gtp_qos_src_stat_desc,
11668 { "Source Statistics Descriptor", "gtp.src_stat_desc",
11669 FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), GTP_EXT_QOS_SRC_STAT_DESC_MASK,
11670 NULL, HFILL}
11672 { &hf_gtp_qos_arp,
11673 {"Allocation/Retention Priority", "gtp.qos_arp",
11674 FT_UINT16, BASE_HEX, NULL, 0x0,
11675 NULL, HFILL}
11677 { &hf_gtp_qos_arp_pci,
11678 {"Pre-emption Capability (PCI)", "gtp.qos_arp_pci",
11679 FT_BOOLEAN, 16, TFS(&tfs_disabled_enabled), 0x0040,
11680 NULL, HFILL}
11682 { &hf_gtp_qos_arp_pl,
11683 {"Priority Level", "gtp.qos_arp_pl",
11684 FT_UINT16, BASE_DEC, NULL, 0x003c,
11685 NULL, HFILL}
11687 { &hf_gtp_qos_arp_pvi,
11688 {"Pre-emption Vulnerability (PVI)", "gtp.qos_arp_pvi",
11689 FT_BOOLEAN, 16, TFS(&tfs_disabled_enabled), 0x0001,
11690 NULL, HFILL}
11692 {&hf_gtp_qos_qci,
11693 {"QCI", "gtp.qos_qci",
11694 FT_UINT8, BASE_DEC, NULL, 0x0,
11695 NULL, HFILL}
11697 {&hf_gtp_qos_ul_mbr,
11698 {"Uplink Maximum Bit Rate", "gtp.qos_ul_mbr",
11699 FT_UINT64, BASE_DEC, NULL, 0x0,
11700 NULL, HFILL}
11702 {&hf_gtp_qos_dl_mbr,
11703 {"Downlink Maximum Bit Rate", "gtp.qos_dl_mbr",
11704 FT_UINT64, BASE_DEC, NULL, 0x0,
11705 NULL, HFILL}
11707 {&hf_gtp_qos_ul_gbr,
11708 {"Uplink Guaranteed Bit Rate", "gtp.qos_ul_gbr",
11709 FT_UINT64, BASE_DEC, NULL, 0x0,
11710 NULL, HFILL}
11712 {&hf_gtp_qos_dl_gbr,
11713 {"Downlink Guaranteed Bit Rate", "gtp.qos_dl_gbr",
11714 FT_UINT64, BASE_DEC, NULL, 0x0,
11715 NULL, HFILL}
11717 {&hf_gtp_qos_ul_apn_ambr,
11718 {"Uplink APN Aggregate Maximum Bit Rate", "gtp.qos_ul_apn_ambr",
11719 FT_UINT32, BASE_DEC, NULL, 0x0,
11720 NULL, HFILL}
11722 {&hf_gtp_qos_dl_apn_ambr,
11723 {"Downlink APN Aggregate Maximum Bit Rate", "gtp.qos_dl_apn_ambr",
11724 FT_UINT32, BASE_DEC, NULL, 0x0,
11725 NULL, HFILL}
11727 {&hf_gtp_pkt_flow_id,
11728 { "Packet Flow ID", "gtp.pkt_flow_id",
11729 FT_UINT8, BASE_DEC, NULL, 0,
11730 NULL, HFILL}
11732 {&hf_gtp_ptmsi,
11733 { "P-TMSI", "gtp.ptmsi",
11734 FT_UINT32, BASE_DEC_HEX, NULL, 0,
11735 "Packet-Temporary Mobile Subscriber Identity", HFILL}
11737 {&hf_gtp_ptmsi_sig,
11738 { "P-TMSI Signature", "gtp.ptmsi_sig",
11739 FT_UINT24, BASE_HEX, NULL, 0,
11740 NULL, HFILL}
11742 {&hf_gtp_rab_gtpu_dn,
11743 { "Downlink GTP-U seq number", "gtp.rab_gtp_dn",
11744 FT_UINT16, BASE_DEC, NULL, 0,
11745 "Downlink GTP-U sequence number", HFILL}
11747 {&hf_gtp_rab_gtpu_up,
11748 { "Uplink GTP-U seq number", "gtp.rab_gtp_up",
11749 FT_UINT16, BASE_DEC, NULL, 0,
11750 "Uplink GTP-U sequence number", HFILL}
11752 {&hf_gtp_rab_pdu_dn,
11753 { "Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn",
11754 FT_UINT16, BASE_DEC, NULL, 0,
11755 "Downlink next PDCP-PDU sequence number", HFILL}
11757 {&hf_gtp_rab_pdu_up,
11758 { "Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up",
11759 FT_UINT16, BASE_DEC, NULL, 0,
11760 "Uplink next PDCP-PDU sequence number", HFILL}
11762 {&hf_gtp_uli_geo_loc_type,
11763 { "Geographic Location Type", "gtp.geo_loc_type",
11764 FT_UINT8, BASE_DEC, VALS(geographic_location_type), 0,
11765 NULL, HFILL}
11767 {&hf_gtp_cgi_ci,
11768 { "Cell ID (CI)", "gtp.cgi_ci",
11769 FT_UINT16, BASE_DEC, NULL, 0,
11770 NULL, HFILL}
11772 {&hf_gtp_sai_sac,
11773 { "Service Area Code (SAC)", "gtp.sai_sac",
11774 FT_UINT16, BASE_DEC, NULL, 0,
11775 NULL, HFILL}
11777 {&hf_gtp_rai_rac,
11778 { "Routing Area Code (RAC)", "gtp.rai_rac",
11779 FT_UINT8, BASE_DEC, NULL, 0,
11780 NULL, HFILL}
11782 {&hf_gtp_lac,
11783 { "Location Area Code (LAC)", "gtp.lac",
11784 FT_UINT16, BASE_DEC, NULL, 0,
11785 NULL, HFILL}
11787 { &hf_gtp_tac,
11788 {"TAC", "gtp.tac",
11789 FT_UINT16, BASE_DEC, NULL, 0,
11790 NULL, HFILL}
11792 {&hf_gtp_ranap_cause,
11793 { "RANAP cause", "gtp.ranap_cause",
11794 FT_UINT16, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0,
11795 NULL, HFILL}
11797 {&hf_gtp_recovery,
11798 { "Recovery", "gtp.recovery",
11799 FT_UINT8, BASE_DEC, NULL, 0,
11800 "Restart counter", HFILL}
11802 {&hf_gtp_reorder,
11803 { "Reordering required", "gtp.reorder",
11804 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11805 NULL, HFILL}
11807 {&hf_gtp_rnc_ipv4,
11808 { "RNC address IPv4", "gtp.rnc_ipv4",
11809 FT_IPv4, BASE_NONE, NULL, 0,
11810 "Radio Network Controller address IPv4", HFILL}
11812 {&hf_gtp_rnc_ipv6,
11813 { "RNC address IPv6", "gtp.rnc_ipv6",
11814 FT_IPv6, BASE_NONE, NULL, 0,
11815 "Radio Network Controller address IPv6", HFILL}
11817 {&hf_gtp_rp,
11818 { "Radio Priority", "gtp.rp",
11819 FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK,
11820 "Radio Priority for uplink tx", HFILL}
11822 {&hf_gtp_rp_nsapi,
11823 { "NSAPI in Radio Priority", "gtp.rp_nsapi",
11824 FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
11825 "Network layer Service Access Point Identifier in Radio Priority", HFILL}
11827 {&hf_gtp_rp_sms,
11828 { "Radio Priority SMS", "gtp.rp_sms",
11829 FT_UINT8, BASE_DEC, NULL, 0,
11830 "Radio Priority for MO SMS", HFILL}
11832 {&hf_gtp_rp_spare,
11833 { "Reserved", "gtp.rp_spare",
11834 FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK,
11835 "Spare bit", HFILL}
11837 {&hf_gtp_sel_mode,
11838 { "Selection mode", "gtp.sel_mode",
11839 FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03,
11840 NULL, HFILL}
11842 {&hf_gtp_seq_number,
11843 { "Sequence number", "gtp.seq_number",
11844 FT_UINT16, BASE_HEX_DEC, NULL, 0,
11845 NULL, HFILL}
11847 {&hf_gtp_session,
11848 { "Session", "gtp.session",
11849 FT_UINT32, BASE_DEC, NULL, 0,
11850 NULL, HFILL }
11852 {&hf_gtp_sndcp_number,
11853 { "SNDCP N-PDU LLC Number", "gtp.sndcp_number",
11854 FT_UINT8, BASE_HEX, NULL, 0,
11855 NULL, HFILL}
11857 {&hf_gtp_tear_ind,
11858 { "Teardown Indicator", "gtp.tear_ind",
11859 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11860 NULL, HFILL}
11862 {&hf_gtp_teid,
11863 { "TEID", "gtp.teid",
11864 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11865 "Tunnel Endpoint Identifier", HFILL}
11867 {&hf_gtp_teid_cp,
11868 { "TEID Control Plane", "gtp.teid_cp",
11869 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11870 "Tunnel Endpoint Identifier Control Plane", HFILL}
11872 {&hf_gtp_uplink_teid_cp,
11873 { "Uplink TEID Control Plane", "gtp.uplink_teid_cp",
11874 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11875 "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}
11877 {&hf_gtp_teid_data,
11878 { "TEID Data I", "gtp.teid_data",
11879 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11880 "Tunnel Endpoint Identifier Data I", HFILL}
11882 {&hf_gtp_uplink_teid_data,
11883 { "Uplink TEID Data I", "gtp.uplink_teid_data",
11884 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11885 "UplinkTunnel Endpoint Identifier Data I", HFILL}
11887 {&hf_gtp_teid_ii,
11888 { "TEID Data II", "gtp.teid_ii",
11889 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11890 "Tunnel Endpoint Identifier Data II", HFILL}
11892 {&hf_gtp_tid,
11893 { "TID", "gtp.tid",
11894 FT_STRING, BASE_NONE, NULL, 0,
11895 "Tunnel Identifier", HFILL}
11897 {&hf_gtp_tlli,
11898 { "TLLI", "gtp.tlli",
11899 FT_UINT32, BASE_HEX, NULL, 0,
11900 "Temporary Logical Link Identity", HFILL}
11902 {&hf_gtp_tr_comm,
11903 { "Packet transfer command", "gtp.tr_comm",
11904 FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0,
11905 NULL, HFILL}
11907 {&hf_gtp_trace_ref,
11908 { "Trace reference", "gtp.trace_ref",
11909 FT_UINT16, BASE_HEX, NULL, 0,
11910 NULL, HFILL}
11912 {&hf_gtp_trace_type,
11913 { "Trace type", "gtp.trace_type",
11914 FT_UINT16, BASE_HEX, NULL, 0,
11915 NULL, HFILL}
11917 {&hf_gtp_user_addr_pdp_org,
11918 { "PDP type organization", "gtp.user_addr_pdp_org",
11919 FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0,
11920 NULL, HFILL}
11922 {&hf_gtp_user_addr_pdp_type,
11923 { "PDP type number", "gtp.user_addr_pdp_type",
11924 FT_UINT8, BASE_HEX, VALS(pdp_type), 0,
11925 NULL, HFILL}
11927 {&hf_gtp_user_ipv4,
11928 { "End user address IPv4", "gtp.user_ipv4",
11929 FT_IPv4, BASE_NONE, NULL, 0,
11930 NULL, HFILL}
11932 {&hf_gtp_user_ipv6,
11933 { "End user address IPv6", "gtp.user_ipv6",
11934 FT_IPv6, BASE_NONE, NULL, 0,
11935 NULL, HFILL}
11937 {&hf_gtp_security_mode,
11938 { "Security Mode", "gtp.security_mode",
11939 FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
11940 NULL, HFILL}
11942 {&hf_gtp_no_of_vectors,
11943 { "No of Vectors", "gtp.no_of_vectors",
11944 FT_UINT8, BASE_DEC, NULL, 0x38,
11945 NULL, HFILL}
11947 {&hf_gtp_cipher_algorithm,
11948 { "Cipher Algorithm", "gtp.cipher_algorithm",
11949 FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
11950 NULL, HFILL}
11952 {&hf_gtp_cksn_ksi,
11953 { "Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
11954 FT_UINT8, BASE_DEC, NULL, 0x07,
11955 "CKSN/KSI", HFILL}
11957 {&hf_gtp_cksn,
11958 { "Ciphering Key Sequence Number (CKSN)", "gtp.cksn",
11959 FT_UINT8, BASE_DEC, NULL, 0x07,
11960 "CKSN", HFILL}
11962 {&hf_gtp_ksi,
11963 { "Key Set Identifier (KSI)", "gtp.ksi",
11964 FT_UINT8, BASE_DEC, NULL, 0x07,
11965 "KSI", HFILL}
11967 {&hf_gtp_ext_length,
11968 { "Length", "gtp.ext_length",
11969 FT_UINT16, BASE_DEC, NULL, 0x0,
11970 "IE Length", HFILL}
11972 {&hf_gtp_utran_field,
11973 { "UTRAN Transparent Field", "gtp.utran_field",
11974 FT_BYTES, BASE_NONE, NULL, 0x0,
11975 NULL, HFILL}
11977 {&hf_gtp_ext_apn_res,
11978 { "Restriction Type", "gtp.ext_apn_res",
11979 FT_UINT8, BASE_DEC, NULL, 0x0,
11980 NULL, HFILL}
11982 {&hf_gtp_ext_rat_type,
11983 { "RAT Type", "gtp.ext_rat_type",
11984 FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
11985 NULL, HFILL}
11987 {&hf_gtp_ext_imeisv,
11988 { "IMEI(SV)", "gtp.ext_imeisv",
11989 FT_STRING, BASE_NONE, NULL, 0x0,
11990 NULL, HFILL}
11992 { &hf_gtp_target_rnc_id,
11993 { "targetRNC-ID", "gtp.targetRNC_ID",
11994 FT_UINT16, BASE_HEX, NULL, 0x0fff,
11995 NULL, HFILL }
11997 { &hf_gtp_target_ext_rnc_id,
11998 { "Extended RNC-ID", "gtp.target_ext_RNC_ID",
11999 FT_UINT16, BASE_HEX, NULL, 0,
12000 NULL, HFILL }
12002 {&hf_gtp_bssgp_cause,
12003 { "BSSGP Cause", "gtp.bssgp_cause",
12004 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_cause_vals_ext, 0,
12005 NULL, HFILL}
12007 { &hf_gtp_bssgp_ra_discriminator,
12008 { "Routing Address Discriminator", "gtp.bssgp.rad",
12009 FT_UINT8, BASE_DEC, VALS(gtp_bssgp_ra_discriminator_vals), 0x0f,
12010 NULL, HFILL }
12012 {&hf_gtp_sapi,
12013 { "PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
12014 FT_UINT8, BASE_DEC, NULL, 0x0F,
12015 NULL, HFILL}
12017 {&hf_gtp_xid_par_len,
12018 { "PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
12019 FT_UINT8, BASE_DEC, NULL, 0x0,
12020 NULL, HFILL}
12022 {&hf_gtp_rep_act_type,
12023 { "Action", "gtp.ms_inf_chg_rep_act",
12024 FT_UINT8, BASE_DEC, VALS(chg_rep_act_type_vals), 0x0,
12025 NULL, HFILL}
12027 {&hf_gtp_correlation_id,
12028 { "Correlation-ID", "gtp.correlation_id",
12029 FT_UINT8, BASE_DEC, NULL, 0,
12030 NULL, HFILL}
12032 {&hf_gtp_earp_pci,
12033 { "PCI Pre-emption Capability", "gtp.EARP_pre_emption_Capability",
12034 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
12035 NULL, HFILL}
12037 {&hf_gtp_earp_pl,
12038 { "PL Priority Level", "gtp.EARP_priority_level",
12039 FT_UINT8, BASE_DEC, NULL, 0x3C,
12040 NULL, HFILL}
12042 {&hf_gtp_earp_pvi,
12043 { "PVI Pre-emption Vulnerability", "gtp.EARP_pre_emption_par_vulnerability",
12044 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
12045 NULL, HFILL}
12047 {&hf_gtp_ext_comm_flags_uasi,
12048 { "UASI", "gtp.ext_comm_flags.uasi",
12049 FT_BOOLEAN, 8, NULL, 0x80,
12050 NULL, HFILL}
12052 {&hf_gtp_ext_comm_flags_bdwi,
12053 { "BDWI", "gtp.ext_comm_flags.bdwi",
12054 FT_BOOLEAN, 8, NULL, 0x40,
12055 NULL, HFILL}
12057 {&hf_gtp_ext_comm_flags_pcri,
12058 { "PCRI", "gtp.ext_comm_flags.pcri",
12059 FT_BOOLEAN, 8, NULL, 0x20,
12060 NULL, HFILL}
12062 {&hf_gtp_ext_comm_flags_vb,
12063 { "VB", "gtp.ext_comm_flags.vb",
12064 FT_BOOLEAN, 8, NULL, 0x10,
12065 NULL, HFILL}
12067 {&hf_gtp_ext_comm_flags_retloc,
12068 { "RetLoc", "gtp.ext_comm_flags.retloc",
12069 FT_BOOLEAN, 8, NULL, 0x08,
12070 NULL, HFILL}
12072 {&hf_gtp_ext_comm_flags_cpsr,
12073 { "CPSR", "gtp.ext_comm_flags.cpsr",
12074 FT_BOOLEAN, 8, NULL, 0x04,
12075 NULL, HFILL}
12077 {&hf_gtp_ext_comm_flags_ccrsi,
12078 { "CCRSI", "gtp.ext_comm_flags.ccrsi",
12079 FT_BOOLEAN, 8, NULL, 0x02,
12080 NULL, HFILL}
12082 {&hf_gtp_ext_comm_flags_unauthenticated_imsi,
12083 { "Unauthenticated IMSI", "gtp.ext_comm_flags.unauthenticated_imsi",
12084 FT_BOOLEAN, 8, NULL, 0x01,
12085 NULL, HFILL}
12087 {&hf_gtp_csg_id,
12088 { "CSG ID", "gtp.csg_id",
12089 FT_UINT32, BASE_DEC, NULL, 0x07FFFFFF,
12090 NULL, HFILL}
12092 {&hf_gtp_access_mode,
12093 { "Access Mode", "gtp.access_mode",
12094 FT_UINT8, BASE_DEC, VALS(gtp_access_mode_vals), 0xC0,
12095 NULL, HFILL }
12097 {&hf_gtp_cmi,
12098 { "CSG Membership Indication (CMI)", "gtp.cmi",
12099 FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x01,
12100 NULL, HFILL}
12102 {&hf_gtp_csg_inf_rep_act_ucicsg,
12103 { "UCICSG", "gtp.csg_info_rep_act.ucicsg",
12104 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
12105 "Report UCI when the UE enters/leaves/accesses CSG Cell",
12106 HFILL}
12108 {&hf_gtp_csg_inf_rep_act_ucishc,
12109 { "UCISHC", "gtp.csg_info_rep_act.ucishc",
12110 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
12111 "Report UCI when the UE enters/leaves/accesses Subscribed Hybrid Cell",
12112 HFILL}
12114 {&hf_gtp_csg_inf_rep_act_uciuhc,
12115 { "UCIUHC", "gtp.csg_info_rep_act.uciuhc",
12116 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
12117 "Report UCI when the UE enters/leaves/accesses Unsubscribed Hybrid Cell",
12118 HFILL}
12120 {&hf_gtp_ext_comm_flags_II_pnsi,
12121 { "PNSI", "gtp.ext_comm_flags_II_pnsi",
12122 FT_UINT8, BASE_DEC, NULL, 0x01,
12123 NULL, HFILL}
12125 {&hf_gtp_ext_comm_flags_II_dtci,
12126 { "DTCI", "gtp.ext_comm_flags_II_dtci",
12127 FT_BOOLEAN, 8, NULL, 0x02,
12128 NULL, HFILL}
12130 {&hf_gtp_ext_comm_flags_II_pmtsmi,
12131 { "PMTSMI", "gtp.ext_comm_flags_II_pmtsmi",
12132 FT_UINT8, BASE_DEC, NULL, 0x04,
12133 NULL, HFILL}
12135 {&hf_gtp_ext_comm_flags_II_spare,
12136 { "SPARE", "gtp.ext_comm_flags_II_spare",
12137 FT_UINT8, BASE_HEX, NULL, 0xF8,
12138 NULL, HFILL}
12140 {&hf_gtp_ciot_opt_sup_ind_sgni_pdn,
12141 { "SGNI PDN", "gtp.ciot_opt_sup_ind_sgni_pdn",
12142 FT_BOOLEAN, 8, NULL, 0x01,
12143 NULL, HFILL}
12145 {&hf_gtp_ciot_opt_sup_ind_scni_pdn,
12146 { "SCNI PDN", "gtp.ciot_opt_sup_ind_scni_pdn",
12147 FT_BOOLEAN, 8, NULL, 0x02,
12148 NULL, HFILL}
12150 {&hf_gtp_ciot_opt_sup_ind_spare,
12151 { "SPARE", "gtp.ciot_opt_sup_ind_spare",
12152 FT_UINT8, BASE_HEX, NULL, 0xfc,
12153 NULL, HFILL}
12155 { &hf_gtp_up_fun_sel_ind_flags_dcnr,
12156 { "DCNR", "gtp.up_fun_sel_ind_flags_dcnr",
12157 FT_BOOLEAN, 8, NULL, 0x01,
12158 NULL, HFILL}
12160 { &hf_gtp_up_fun_sel_ind_flags_spare,
12161 { "SPARE", "gtp.up_fun_sel_ind_flags_spare",
12162 FT_UINT8, BASE_HEX, NULL, 0xfe,
12163 NULL, HFILL}
12165 {&hf_gtp_cdr_app,
12166 { "Application Identifier", "gtp.cdr_app",
12167 FT_UINT8, BASE_DEC, NULL, 0xf0,
12168 NULL, HFILL}
12170 { &hf_gtp_cdr_rel,
12171 { "Release Identifier", "gtp.cdr_rel",
12172 FT_UINT8, BASE_DEC, NULL, 0x0f,
12173 NULL, HFILL}
12175 { &hf_gtp_cdr_ver,
12176 { "Version Identifier", "gtp.cdr_ver",
12177 FT_UINT8, BASE_DEC, NULL, 0x0,
12178 NULL, HFILL}
12180 { &hf_gtp_cdr_rel_ext,
12181 { "Release Identifier Extension", "gtp.cdr_rel_ext",
12182 FT_UINT8, BASE_DEC, NULL, 0x0,
12183 NULL, HFILL}
12185 { &hf_gtp_cdr_length,
12186 { "Length", "gtp.cdr_length",
12187 FT_UINT16, BASE_DEC, NULL, 0x0,
12188 NULL, HFILL}
12190 { &hf_gtp_cdr_context,
12191 { "Context", "gtp.cdr_context",
12192 FT_BYTES, BASE_NONE, NULL, 0x0,
12193 NULL, HFILL}
12195 {&hf_gtp_cmn_flg_ppc,
12196 { "Prohibit Payload Compression", "gtp.cmn_flg.ppc",
12197 FT_BOOLEAN, 8, NULL, 0x01,
12198 NULL, HFILL}
12200 {&hf_gtp_cmn_flg_mbs_srv_type,
12201 { "MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
12202 FT_BOOLEAN, 8, NULL, 0x02,
12203 NULL, HFILL}
12205 {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
12206 { "RAN Procedures Ready", "gtp.cmn_flg.mbs_ran_pcd_rdy",
12207 FT_BOOLEAN, 8, NULL, 0x04,
12208 NULL, HFILL}
12210 {&hf_gtp_cmn_flg_mbs_cnt_inf,
12211 { "MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
12212 FT_BOOLEAN, 8, NULL, 0x08,
12213 NULL, HFILL}
12215 {&hf_gtp_cmn_flg_no_qos_neg,
12216 { "No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
12217 FT_BOOLEAN, 8, NULL, 0x10,
12218 NULL, HFILL}
12220 {&hf_gtp_cmn_flg_nrsn,
12221 { "NRSN bit field", "gtp.cmn_flg.nrsn",
12222 FT_BOOLEAN, 8, NULL, 0x20,
12223 NULL, HFILL}
12225 {&hf_gtp_cmn_flg_upgrd_qos_sup,
12226 { "Upgrade QoS Supported", "gtp.cmn_flg.upgrd_qos_sup",
12227 FT_BOOLEAN, 8, NULL, 0x40,
12228 NULL, HFILL}
12230 {&hf_gtp_cmn_flg_dual_addr_bearer_flg,
12231 { "Dual Address Bearer Flag", "gtp.cmn_flg.dual_addr_bearer_flg",
12232 FT_BOOLEAN, 8, NULL, 0x80,
12233 NULL, HFILL}
12235 {&hf_gtp_linked_nsapi,
12236 { "Linked NSAPI", "gtp.linked_nsapi",
12237 FT_UINT8, BASE_DEC, NULL, 0xf0,
12238 NULL, HFILL}
12240 {&hf_gtp_enh_nsapi,
12241 { "Enhanced NSAPI", "gtp.enhanced_nsapi",
12242 FT_UINT8, BASE_DEC, NULL, 0x0,
12243 NULL, HFILL}
12245 {&hf_gtp_tmgi,
12246 { "Temporary Mobile Group Identity (TMGI)", "gtp.tmgi",
12247 FT_BYTES, BASE_NONE, NULL, 0x0,
12248 NULL, HFILL}
12250 {&hf_gtp_no_of_mbms_sa_codes,
12251 { "Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
12252 FT_UINT8, BASE_DEC, NULL, 0x0,
12253 "Number N of MBMS service area codes", HFILL}
12256 {&hf_gtp_mbms_ses_dur_days,
12257 { "Estimated session duration days", "gtp.mbms_ses_dur_days",
12258 FT_UINT24, BASE_DEC, NULL, 0x00007F,
12259 NULL, HFILL}
12261 {&hf_gtp_mbms_ses_dur_s,
12262 { "Estimated session duration seconds", "gtp.mbms_ses_dur_s",
12263 FT_UINT24, BASE_DEC, NULL, 0xFFFF80,
12264 NULL, HFILL}
12266 {&hf_gtp_mbms_sa_code,
12267 { "MBMS service area code", "gtp.mbms_sa_code",
12268 FT_UINT16, BASE_DEC, NULL, 0x0,
12269 NULL, HFILL}
12271 {&hf_gtp_trace_ref2,
12272 { "Trace Reference2", "gtp.trace_ref2",
12273 FT_UINT24, BASE_HEX, NULL, 0,
12274 NULL, HFILL}
12276 {&hf_gtp_trace_rec_session_ref,
12277 { "Trace Recording Session Reference", "gtp.trace_rec_session_ref",
12278 FT_UINT16, BASE_HEX, NULL, 0,
12279 NULL, HFILL}
12281 {&hf_gtp_trace_triggers_ggsn_mbms,
12282 { "MBMS Context", "gtp.trace_triggers.ggsn.mbms",
12283 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x2,
12284 NULL, HFILL}
12286 {&hf_gtp_trace_triggers_ggsn_pdp,
12287 { "PDP Context", "gtp.trace_triggers.ggsn.pdp",
12288 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12289 NULL, HFILL}
12291 {&hf_gtp_trace_triggers_ggsn,
12292 { "Triggering events in GGSN", "gtp.trace_triggers.ggsn",
12293 FT_UINT8, BASE_HEX, NULL, 0,
12294 NULL, HFILL}
12296 {&hf_gtp_trace_depth,
12297 { "Trace Depth", "gtp.trace_depth",
12298 FT_UINT8, BASE_DEC, VALS(gtp_trace_depth_vals), 0,
12299 NULL, HFILL}
12301 {&hf_gtp_trace_loi_ggsn_gmb,
12302 { "Gmb", "gtp.trace_loi.ggsn.gmb",
12303 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x4,
12304 NULL, HFILL}
12306 {&hf_gtp_trace_loi_ggsn_gi,
12307 { "Gi", "gtp.trace_loi.ggsn.gi",
12308 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x2,
12309 NULL, HFILL}
12311 {&hf_gtp_trace_loi_ggsn_gn,
12312 { "Gn", "gtp.trace_loi.ggsn.gn",
12313 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12314 NULL, HFILL}
12316 {&hf_gtp_trace_loi_ggsn,
12317 { "List of interfaces in GGSN", "gtp.trace_loi.ggsn",
12318 FT_UINT8, BASE_HEX, NULL, 0,
12319 NULL, HFILL}
12321 {&hf_gtp_trace_activity_control,
12322 { "Trace Activity Control", "gtp.trace_activity_control",
12323 FT_UINT8, BASE_DEC, VALS(gtp_trace_activity_control_vals), 0,
12324 NULL, HFILL}
12326 {&hf_gtp_hop_count,
12327 { "Hop Counter", "gtp.hop_count",
12328 FT_UINT8, BASE_DEC, NULL, 0x0,
12329 NULL, HFILL}
12331 {&hf_gtp_mbs_2g_3g_ind,
12332 { "MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
12333 FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
12334 NULL, HFILL}
12336 {&hf_gtp_trace_triggers_bm_sc_mbms,
12337 { "MBMS Multicast service activation", "gtp.trace_triggers.bm_sc.mbms",
12338 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12339 NULL, HFILL}
12341 {&hf_gtp_trace_triggers_bm_sc,
12342 { "Triggering events in BM-SC", "gtp.trace_triggers.bm_sc",
12343 FT_UINT8, BASE_HEX, NULL, 0,
12344 NULL, HFILL}
12346 {&hf_gtp_trace_loi_bm_sc_gmb,
12347 { "Gmb", "gtp.trace_loi.bm_sc.gmb",
12348 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12349 NULL, HFILL}
12351 {&hf_gtp_trace_loi_bm_sc,
12352 { "List of interfaces in BM-SC", "gtp.trace_loi.bm_sc",
12353 FT_UINT8, BASE_HEX, NULL, 0,
12354 NULL, HFILL}
12356 {&hf_gtp_time_2_dta_tr,
12357 { "Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
12358 FT_UINT8, BASE_DEC, NULL, 0x0,
12359 NULL, HFILL}
12361 {&hf_gtp_target_lac,
12362 { "Target Location Area Code (LAC)", "gtp.target_lac",
12363 FT_UINT16, BASE_DEC, NULL, 0,
12364 NULL, HFILL}
12366 {&hf_gtp_target_rac,
12367 { "Target Routing Area Code (RAC)", "gtp.target_rac",
12368 FT_UINT8, BASE_DEC, NULL, 0,
12369 NULL, HFILL}
12371 {&hf_gtp_target_ci,
12372 { "Target Cell ID (CI)", "gtp.target_ci",
12373 FT_UINT16, BASE_DEC, NULL, 0,
12374 NULL, HFILL}
12376 { &hf_gtp_source_type,
12377 { "Source Type", "gtp.source_type",
12378 FT_UINT8, BASE_DEC, VALS(gtp_source_type_vals), 0x0,
12379 NULL, HFILL}
12381 {&hf_gtp_source_lac,
12382 { "Source Location Area Code (LAC)", "gtp.source_lac",
12383 FT_UINT16, BASE_DEC, NULL, 0,
12384 NULL, HFILL}
12386 {&hf_gtp_source_rac,
12387 { "Source Routing Area Code (RAC)", "gtp.source_rac",
12388 FT_UINT8, BASE_DEC, NULL, 0,
12389 NULL, HFILL}
12391 {&hf_gtp_source_ci,
12392 { "Source Cell ID (CI)", "gtp.source_ci",
12393 FT_UINT16, BASE_DEC, NULL, 0,
12394 NULL, HFILL}
12396 { &hf_gtp_source_rnc_id,
12397 { "Source RNC-ID", "gtp.source.rnc_id",
12398 FT_UINT16, BASE_DEC, NULL, 0x0fff,
12399 NULL, HFILL }
12401 { &hf_gtp_ext_ei,
12402 { "Error Indication (EI)", "gtp.ei",
12403 FT_UINT8, BASE_DEC, NULL, 0x04,
12404 NULL, HFILL}
12406 {&hf_gtp_ext_gcsi,
12407 { "GPRS-CSI (GCSI)", "gtp.gcsi",
12408 FT_UINT8, BASE_DEC, NULL, 0x02,
12409 NULL, HFILL}
12411 { &hf_gtp_ext_dti,
12412 { "Direct Tunnel Indicator (DTI)", "gtp.dti",
12413 FT_UINT8, BASE_DEC, NULL, 0x01,
12414 NULL, HFILL}
12416 { &hf_gtp_ra_prio_lcs,
12417 { "Radio Priority LCS", "gtp.raplcs",
12418 FT_UINT8, BASE_DEC, NULL, 0x07,
12419 NULL, HFILL}
12421 { &hf_gtp_bcm,
12422 { "Bearer Control Mode", "gtp.bcm",
12423 FT_UINT8, BASE_DEC, VALS(gtp_pdp_bcm_type_vals), 0,
12424 NULL, HFILL}
12426 { &hf_gtp_fqdn,
12427 { "FQDN", "gtp.fqdn",
12428 FT_STRING, BASE_NONE, NULL, 0,
12429 "Fully Qualified Domain Name", HFILL}
12431 { &hf_gtp_rim_routing_addr,
12432 { "RIM Routing Address value", "gtp.rim_routing_addr_val",
12433 FT_BYTES, BASE_NONE, NULL, 0,
12434 NULL, HFILL}
12436 { &hf_gtp_mbms_flow_id,
12437 { "MBMS Flow Identifier", "gtp.mbms_flow_id",
12438 FT_BYTES, BASE_NONE, NULL, 0,
12439 NULL, HFILL}
12441 { &hf_gtp_mbms_dist_indic,
12442 { "Distribution Indication", "gtp.mbms_dist_indic",
12443 FT_UINT8, BASE_DEC, VALS(gtp_mbms_dist_indic_vals), 0x03,
12444 NULL, HFILL}
12446 { &hf_gtp_ext_apn_ambr_ul,
12447 { "APN-AMBR for Uplink", "gtp.apn_ambr_ul",
12448 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12449 NULL, HFILL}
12451 { &hf_gtp_ext_apn_ambr_dl,
12452 { "APN-AMBR for Downlink", "gtp.apn_ambr_dl",
12453 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12454 NULL, HFILL}
12456 { &hf_gtp_ext_sub_ue_ambr_ul,
12457 { "Subscribed UE-AMBR for Uplink", "gtp.sub_ue_ambr_ul",
12458 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12459 NULL, HFILL}
12461 { &hf_gtp_ext_sub_ue_ambr_dl,
12462 { "Subscribed UE-AMBR for Downlink", "gtp.sub_ue_ambr_dl",
12463 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12464 NULL, HFILL}
12466 { &hf_gtp_ext_auth_ue_ambr_ul,
12467 { "Authorized UE-AMBR for Uplink", "gtp.auth_ue_ambr_ul",
12468 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12469 NULL, HFILL}
12471 { &hf_gtp_ext_auth_ue_ambr_dl,
12472 { "Authorized UE-AMBR for Downlink", "gtp.auth_ue_ambr_dl",
12473 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12474 NULL, HFILL}
12476 { &hf_gtp_ext_auth_apn_ambr_ul,
12477 { "Authorized APN-AMBR for Uplink", "gtp.auth_apn_ambr_ul",
12478 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12479 NULL, HFILL}
12481 { &hf_gtp_ext_auth_apn_ambr_dl,
12482 { "Authorized APN-AMBR for Downlink", "gtp.auth_apn_ambr_dl",
12483 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12484 NULL, HFILL}
12486 { &hf_gtp_ext_ggsn_back_off_time_units,
12487 { "Timer unit", "gtp.ggsn_back_off_time_units",
12488 FT_UINT8, BASE_DEC, VALS(gtp_ggsn_back_off_time_units_vals), 0xe0,
12489 NULL, HFILL}
12491 { &hf_gtp_ext_ggsn_back_off_timer,
12492 { "Timer value", "gtp.ggsn_back_off_timer",
12493 FT_UINT8, BASE_DEC, NULL, 0x1f,
12494 NULL, HFILL}
12496 { &hf_gtp_lapi,
12497 { "LAPI", "gtp.lapi",
12498 FT_BOOLEAN, 8, TFS(&gtp_lapi_tfs), 0x01,
12499 "Low Access Priority Indication", HFILL}
12501 { &hf_gtp_higher_br_16mb_flg,
12502 { "Higher bitrates than 16 Mbps flag", "gtp.higher_br_16mb_flg",
12503 FT_UINT8, BASE_DEC, VALS(gtp_higher_br_16mb_flg_vals), 0x0,
12504 NULL, HFILL}
12506 { &hf_gtp_max_mbr_apn_ambr_ul,
12507 { "Max MBR/APN-AMBR for uplink", "gtp.max_mbr_apn_ambr_ul",
12508 FT_UINT32, BASE_DEC, NULL, 0x0,
12509 NULL, HFILL}
12511 { &hf_gtp_max_mbr_apn_ambr_dl,
12512 { "Max MBR/APN-AMBR for downlink", "gtp.max_mbr_apn_ambr_dl",
12513 FT_UINT32, BASE_DEC, NULL, 0x0,
12514 NULL, HFILL}
12516 { &hf_gtp_uli_timestamp,
12517 { "ULI Timestamp", "gtp.uli_timestamp",
12518 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
12519 NULL, HFILL }
12521 { &hf_gtp_lhn_id,
12522 { "Local Home Network ID", "gtp.lhn_id",
12523 FT_STRING, BASE_NONE, NULL, 0,
12524 NULL, HFILL}
12526 { &hf_gtp_sel_entity,
12527 { "Selection Entity", "gtp.selection_entity",
12528 FT_UINT8, BASE_DEC, VALS(gtp_sel_entity_vals), 0x3,
12529 NULL, HFILL}
12531 { &hf_gtp_ue_usage_type_value,
12532 { "UE Usage Type value", "gtp.ue_usage_type_value",
12533 FT_UINT32, BASE_DEC, NULL, 0x0,
12534 NULL, HFILL}
12536 { &hf_gtp_scef_id_length,
12537 { "SCEF-ID length", "gtp.scef_id_length",
12538 FT_UINT16, BASE_DEC, NULL, 0x0,
12539 NULL, HFILL}
12541 { &hf_gtp_scef_id,
12542 { "SCEF-ID", "gtp.scef_id",
12543 FT_STRING, BASE_NONE, NULL, 0x0,
12544 NULL, HFILL}
12546 { &hf_gtp_iov_updates_counter,
12547 { "IOV_updates counter", "gtp.iov_updates_counter",
12548 FT_UINT8, BASE_DEC, NULL, 0x0,
12549 NULL, HFILL}
12551 { &hf_gtp_mapped_ue_usage_type,
12552 { "Mapped UE Usage Type", "gtp.mapped_ue_usage_type",
12553 FT_UINT16, BASE_DEC, NULL, 0x0,
12554 NULL, HFILL}
12557 { &hf_gtp_rand, { "RAND", "gtp.rand", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12558 { &hf_gtp_sres, { "SRES", "gtp.sres", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12559 { &hf_gtp_kc, { "Kc", "gtp.kc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12560 { &hf_gtp_xres_length, { "XRES length", "gtp.xres_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12561 { &hf_gtp_xres, { "XRES", "gtp.xres", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12562 { &hf_gtp_quintuplet_ciphering_key, { "Quintuplet Ciphering Key", "gtp.quintuplet_ciphering_key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12563 { &hf_gtp_quintuplet_integrity_key, { "Quintuplet Integrity Key", "gtp.quintuplet_integrity_key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12564 { &hf_gtp_authentication_length, { "Authentication length", "gtp.authentication_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12565 { &hf_gtp_auth, { "AUTH", "gtp.auth", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12566 { &hf_gtp_ciphering_key_ck, { "Ciphering key CK", "gtp.ciphering_key_ck", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12567 { &hf_gtp_integrity_key_ik, { "Integrity key IK", "gtp.integrity_key_ik", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12568 { &hf_gtp_quintuplets_length, { "Quintuplets length", "gtp.quintuplets_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
12569 { &hf_gtp_ciphering_key_kc, { "Ciphering key Kc", "gtp.ciphering_key_kc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12570 { &hf_gtp_container_length, { "Container length", "gtp.container_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12571 { &hf_gtp_extended_end_user_address, { "Extended End User Address", "gtp.extended_end_user_address", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL }},
12572 { &hf_gtp_vplmn_address_allowed, { "VPLMN address allowed", "gtp.vplmn_address_allowed", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
12573 { &hf_gtp_activity_status_indicator, { "Activity Status Indicator", "gtp.activity_status_indicator", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
12574 { &hf_gtp_reordering_required, { "Reordering required", "gtp.reordering_required", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
12575 { &hf_gtp_pdp_cntxt_sapi, { "SAPI", "gtp.pdp_cntxt.sapi", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
12576 { &hf_gtp_sequence_number_down, { "Sequence number down", "gtp.sequence_number_down", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12577 { &hf_gtp_sequence_number_up, { "Sequence number up", "gtp.sequence_number_up", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12578 { &hf_gtp_send_n_pdu_number, { "Send N-PDU number", "gtp.send_n_pdu_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12579 { &hf_gtp_receive_n_pdu_number, { "Receive N-PDU number", "gtp.receive_n_pdu_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12580 { &hf_gtp_uplink_flow_label_signalling, { "Uplink flow label signalling", "gtp.uplink_flow_label_signalling", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12581 { &hf_gtp_pdp_context_identifier, { "PDP context identifier", "gtp.pdp_context_identifier", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12582 { &hf_gtp_pdp_organization, { "PDP organization", "gtp.pdp_organization", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0x0F, NULL, HFILL }},
12583 { &hf_gtp_pdp_type, { "PDP type", "gtp.pdp_type", FT_UINT8, BASE_DEC, VALS(pdp_type), 0x0, NULL, HFILL }},
12584 { &hf_gtp_pdp_address_length, { "PDP address length", "gtp.pdp_address_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12585 { &hf_gtp_pdp_address_ipv4, { "PDP address", "gtp.pdp_address.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12586 { &hf_gtp_pdp_address_ipv6, { "PDP address", "gtp.pdp_address.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12587 { &hf_gtp_sgsn_address_for_control_plane_ipv4, { "SGSN Address for control plane", "gtp.sgsn_address_for_control_plane.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12588 { &hf_gtp_sgsn_address_for_control_plane_ipv6, { "SGSN Address for control plane", "gtp.sgsn_address_for_control_plane.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12589 { &hf_gtp_sgsn_address_for_user_traffic_ipv4, { "SGSN Address for User Traffic", "gtp.sgsn_address_for_user_traffic.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12590 { &hf_gtp_sgsn_address_for_user_traffic_ipv6, { "SGSN Address for User Traffic", "gtp.sgsn_address_for_user_traffic.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12591 { &hf_gtp_ggsn_address_length, { "GGSN address length", "gtp.ggsn_address_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12592 { &hf_gtp_ggsn_address_for_control_plane_ipv4, { "GGSN Address for control plane", "gtp.ggsn_address_for_control_plane.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12593 { &hf_gtp_ggsn_address_for_control_plane_ipv6, { "GGSN Address for control plane", "gtp.ggsn_address_for_control_plane.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12594 { &hf_gtp_ggsn_address_for_user_traffic_ipv4, { "GGSN Address for User Traffic", "gtp.ggsn_address_for_user_traffic.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12595 { &hf_gtp_ggsn_address_for_user_traffic_ipv6, { "GGSN Address for User Traffic", "gtp.ggsn_address_for_user_traffic.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12596 { &hf_gtp_apn_length, { "APN length", "gtp.apn_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12597 { &hf_gtp_transaction_identifier, { "Transaction identifier", "gtp.transaction_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12598 { &hf_gtp_gsn_address_length, { "GSN address length", "gtp.gsn_address_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12599 { &hf_gtp_gsn_address_information_element_length, { "GSN address Information Element length", "gtp.gsn_address_information_element_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12600 { &hf_gtp_tft_length, { "TFT length", "gtp.tft_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12601 { &hf_gtp_rab_setup_length, { "RAB setup length", "gtp.rab_setup_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12602 { &hf_gtp_timezone, { "Timezone", "gtp.timezone", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12603 { &hf_gtp_timezone_dst, { "DST", "gtp.timezone_dst", FT_UINT8, BASE_DEC, VALS(daylight_saving_time_vals), 0x03, NULL, HFILL }},
12604 { &hf_gtp_rfsp_index, { "RFSP Index", "gtp.rfsp_index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12605 { &hf_gtp_fqdn_length, { "FQDN length", "gtp.fqdn_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12606 { &hf_gtp_number_of_data_records, { "Number of data records", "gtp.number_of_data_records", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12607 { &hf_gtp_data_record_format, { "Data record format", "gtp.data_record_format", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12608 { &hf_gtp_node_address_length, { "Node address length", "gtp.node_address_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12609 { &hf_gtp_seq_num_released, { "Sequence number released", "gtp.seq_num_released", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12610 { &hf_gtp_seq_num_canceled, { "Sequence number cancelled", "gtp.seq_num_canceled", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12611 { &hf_gtp_requests_responded, { "Requests responded", "gtp.requests_responded", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12612 { &hf_gtp_hyphen_separator, { "Hyphen separator: -", "gtp.hyphen_separator", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12613 { &hf_gtp_ms_network_cap_content_len, { "Length of MS network capability contents", "gtp.ms_network_cap_content_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12614 { &hf_gtp_iei, { "IEI", "gtp.iei", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12615 { &hf_gtp_iei_mobile_id_len, { "Length", "gtp.iei.mobile_id_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12616 { &hf_gtp_qos_umts_length, { "Length", "gtp.qos_umts_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12617 { &hf_gtp_num_ext_hdr_types, { "Number of Extension Header Types in list (i.e., length)", "gtp.num_ext_hdr_types", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12618 { &hf_gtp_ext_hdr_type, { "Extension Header Type", "gtp.ext_hdr_type", FT_UINT8, BASE_DEC, VALS(next_extension_header_fieldvals), 0x0, NULL, HFILL }},
12619 { &hf_gtp_tpdu_data, { "T-PDU Data", "gtp.tpdu_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
12620 { &hf_gtp_ext_enb_type, { "enb_type", "gtp.enb_type", FT_UINT8, BASE_DEC, VALS(gtp_enb_type_vals), 0x0, NULL, HFILL } },
12621 { &hf_gtp_macro_enodeb_id,
12622 { "Macro eNodeB ID", "gtp.macro_enodeb_id",
12623 FT_UINT24, BASE_HEX, NULL, 0x0fffff,
12624 NULL, HFILL }
12626 { &hf_gtp_home_enodeb_id,
12627 { "Home eNodeB ID", "gtp.home_enodeb_id",
12628 FT_UINT32, BASE_HEX, NULL, 0x0fffffff,
12629 NULL, HFILL }
12631 { &hf_gtp_dummy_octets,
12632 { "Dummy octets", "gtp.dummy_octets",
12633 FT_BYTES, BASE_NONE, NULL, 0x0,
12634 NULL, HFILL }
12636 { &hf_gtp_spare_b0,
12637 { "Spare", "gtp.spare",
12638 FT_UINT8, BASE_HEX, NULL, 0x01,
12639 NULL, HFILL }
12641 { &hf_gtp_spare_b4b0,
12642 { "Spare", "gtp.spare",
12643 FT_UINT8, BASE_HEX, NULL, 0x1f,
12644 NULL, HFILL }
12646 { &hf_gtp_spare_b7b1,
12647 { "Spare", "gtp.spare",
12648 FT_UINT8, BASE_HEX, NULL, 0xfe,
12649 NULL, HFILL }
12651 { &hf_gtp_rnc_ip_addr_v4,
12652 { "RNC IP address", "gtp.rnc_ip_addr_v4",
12653 FT_IPv4, BASE_NONE, NULL, 0x0,
12654 NULL, HFILL }
12656 { &hf_gtp_rnc_ip_addr_v6,
12657 { "RNC IP address", "gtp.rnc_ip_addr_v6",
12658 FT_IPv6, BASE_NONE, NULL, 0x0,
12659 NULL, HFILL }
12661 { &hf_gtp_ms_cm_2_len,
12662 { "Length of the Mobile Station Classmark 2", "gtp.ms_cm_2_len",
12663 FT_UINT8, BASE_DEC, NULL, 0x0,
12664 NULL, HFILL }
12666 { &hf_gtp_ms_cm_3_len,
12667 { "Length of the Mobile Station Classmark 3", "gtp.ms_cm_3_len",
12668 FT_UINT8, BASE_DEC, NULL, 0x0,
12669 NULL, HFILL }
12671 { &hf_gtp_sup_codec_lst_len,
12672 { "Length of the Supported Codec List", "gtp.sup_codec_lst_len",
12673 FT_UINT8, BASE_DEC, NULL, 0x0,
12674 NULL, HFILL }
12676 { &hf_gtp_add_flg_for_srvcc_ics,
12677 { "ICS (IMS Centralized Service)", "gtp.add_flg_for_srvcc_ics",
12678 FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
12679 NULL, HFILL }
12681 { &hf_gtp_sel_mode_val,
12682 { "Selection Mode Value", "gtp.sel_mode_val",
12683 FT_UINT8, BASE_DEC, VALS(gtp_sel_mode_vals), 0x03,
12684 NULL, HFILL }
12689 static hf_register_info hf_nrup[] =
12691 {&hf_nrup_pdu_type,
12692 { "PDU Type", "nrup.pdu_type",
12693 FT_UINT8, BASE_DEC, VALS(nr_pdu_type_cnst), 0xf0,
12694 NULL, HFILL}
12696 {&hf_nrup_spr_bit_extnd_flag,
12697 { "Spare", "nrup.spr_bit",
12698 FT_BOOLEAN, 8, NULL, 0x08,
12699 NULL, HFILL}
12701 {&hf_nrup_dl_discrd_blks,
12702 { "DL Discard Blocks", "nrup.dl_disc_blks",
12703 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
12704 "Presence of DL discard Number of blocks, discard NR PDCP PDU SN start and Discarded Block size", HFILL}
12706 {&hf_nrup_dl_flush,
12707 { "DL Flush", "nrup.dl_flush",
12708 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
12709 "Presence of DL discard NR PDCP PDU SN", HFILL}
12711 {&hf_nrup_rpt_poll,
12712 { "Report Polling", "nrup.report_polling",
12713 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
12714 "Indicates that the node hosting the NR PDCP entity requests providing the downlink delivery status report", HFILL}
12716 {&hf_nrup_retransmission_flag,
12717 { "Retransmission Flag", "nrup.retransmission_flag",
12718 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12719 "Indicates whether the NR PDCP PDU is a retransmission NR-U packet sent by the node hosting the NR PDCP entity to the corresponding node", HFILL}
12721 { &hf_nrup_ass_inf_rep_poll_flag,
12722 { "Assistance Info. Report Polling Flag", "nrup.ass_inf_rep_poll_flag",
12723 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12724 NULL, HFILL }
12726 { &hf_nrup_spare,
12727 { "Spare", "nrup.spare",
12728 FT_UINT8, BASE_DEC, NULL, 0xe0,
12729 NULL, HFILL }
12731 { &hf_nrup_request_out_of_seq_report,
12732 { "Request Out Of Seq Report", "nrup.request_out_of_seq_report",
12733 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12734 NULL, HFILL}
12737 {&hf_nrup_report_delivered,
12738 { "Report Delivered", "nrup.report_delivered",
12739 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12740 "Presence of DL report NR PDCP PDU SN", HFILL}
12742 {&hf_nrup_user_data_existence_flag,
12743 { "User Data Existence Flag", "nrup.user_data_existence_flag",
12744 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12745 "Whether the node hosting the NR PDCP entity has some user data for the concerned data radio bearer", HFILL}
12747 {&hf_nrup_nr_u_seq_num,
12748 { "NR-U Sequence Number", "nrup.seq_num",
12749 FT_UINT24, BASE_DEC, NULL, 0,
12750 "NR-U sequence number as assigned by the node hosting the NR PDCP entity", HFILL}
12752 {&hf_nrup_dl_disc_nr_pdcp_pdu_sn,
12753 { "DL discard NR PDCP PDU SN", "nrup.dl_disc_nr_pdcp_pdu_sn",
12754 FT_UINT24, BASE_DEC, NULL, 0,
12755 NULL, HFILL}
12757 {&hf_nrup_dl_disc_num_blks,
12758 { "DL discard Number of blocks", "nrup.dl_disc_num_blks",
12759 FT_UINT8, BASE_DEC, NULL, 0x0,
12760 NULL, HFILL}
12762 {&hf_nrup_dl_disc_nr_pdcp_pdu_sn_start,
12763 { "DL discard NR PDCP PDU SN Start", "nrup.dl_disc_nr_pdcp_pdu_sn_start",
12764 FT_UINT24, BASE_DEC, NULL, 0,
12765 NULL, HFILL}
12767 {&hf_nrup_dl_disc_blk_sz,
12768 { "Discarded block size", "nrup.disc_blk_sz",
12769 FT_UINT8, BASE_DEC, NULL, 0,
12770 "The number of NR PDCP PDUs counted from the starting SN to be discarded", HFILL}
12772 {&hf_nrup_dl_report_nr_pdcp_pdu_sn,
12773 { "DL report NR PDCP PDU SN", "nrup.dl_report_nr_pdcp_pdu_sn",
12774 FT_UINT24, BASE_DEC, NULL, 0,
12775 "DL delivery status report wanted when this SN has been delivered", HFILL}
12778 {&hf_nrup_high_tx_nr_pdcp_sn_ind,
12779 { "Highest Transmitted NR PDCP SN Ind", "nrup.high_tx_nr_pdcp_sn_ind",
12780 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12781 NULL, HFILL}
12783 {&hf_nrup_high_delivered_nr_pdcp_sn_ind,
12784 { "Highest Delivered NR PDCP SN Ind", "nrup.high_delivered_nr_pdcp_sn_ind",
12785 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12786 NULL, HFILL}
12788 {&hf_nrup_final_frame_ind,
12789 { "Final Frame Indication", "nrup.final_frame_ind",
12790 FT_BOOLEAN, 8, TFS(&tfs_final_frame_indication), 0x02,
12791 "Whether the frame is the last DL status report", HFILL}
12793 {&hf_nrup_lost_pkt_rpt,
12794 { "Lost Packet Report", "nrup.lost_pkt_rpt",
12795 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12796 "Indicates the presence of Number of lost NR-U Sequence Number ranges reported" , HFILL}
12798 {&hf_nrup_high_retx_nr_pdcp_sn_ind,
12799 { "Highest Retransmitted NR PDCP SN Ind", "nrup.high_retx_nr_pdcp_sn_ind",
12800 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12801 NULL, HFILL}
12803 {&hf_nrup_cause_rpt,
12804 { "Cause Report", "nrup.cause_rpt",
12805 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12806 "Presence of Cause Value", HFILL}
12808 {&hf_nrup_delivered_nr_pdcp_sn_range_ind,
12809 { "Delivered NR PDCP SN Range Ind", "nrup.delivered_nr_pdcp_sn_range_ind",
12810 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12811 NULL, HFILL}
12813 {&hf_nrup_data_rate_ind,
12814 { "Data Rate Ind", "nrup.data_rate_ind",
12815 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12816 NULL, HFILL}
12818 {&hf_nrup_desrd_buff_sz_data_radio_bearer,
12819 { "Desired buffer size for the data radio bearer", "nrup.desrd_buff_sz_data_radio_bearer",
12820 FT_UINT32, BASE_DEC, NULL, 0,
12821 NULL, HFILL}
12823 {&hf_nrup_high_delivered_retx_nr_pdcp_sn_ind,
12824 { "Highest Delivered Retransmitted NR PDCP SN Ind", "nrup.high_delivered_retx_nr_pdcp_sn_ind",
12825 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12826 NULL, HFILL}
12828 {&hf_nrup_desrd_data_rate,
12829 { "Desired data rate", "nrup.desrd_data_rate",
12830 FT_UINT32, BASE_DEC, NULL, 0,
12831 NULL, HFILL}
12833 {&hf_nrup_num_lost_nru_seq_num,
12834 { "Number of lost NR-U Sequence Number ranges reported", "nrup.num_lost_nru_seq_num",
12835 FT_UINT8, BASE_DEC, NULL, 0,
12836 NULL, HFILL}
12838 {&hf_nrup_start_lost_nru_seq_num,
12839 { "Start of lost NR-U Sequence Number range", "nrup.start_num_lost_nru_seq_num",
12840 FT_UINT24, BASE_DEC, NULL, 0,
12841 NULL, HFILL}
12843 {&hf_nrup_end_lost_nru_seq_num,
12844 { "End of lost NR-U Sequence Number range", "nrup.end_num_lost_nru_seq_num",
12845 FT_UINT24, BASE_DEC, NULL, 0,
12846 NULL, HFILL}
12848 {&hf_nrup_high_success_delivered_nr_pdcp_sn,
12849 { "Highest Successfully Delivered NR PDCP SN", "nrup.high_success_delivered_nr_pdcp_sn",
12850 FT_UINT24, BASE_DEC, NULL, 0,
12851 NULL, HFILL}
12853 {&hf_nrup_high_tx_nr_pdcp_sn,
12854 { "Highest transmitted NR PDCP SN", "nrup.high_tx_nr_pdcp_sn",
12855 FT_UINT24, BASE_DEC, NULL, 0,
12856 NULL, HFILL}
12858 {&hf_nrup_cause_val ,
12859 { "Cause Value", "nrup.cause_val",
12860 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(nr_up_cause_vals), 0,
12861 "Indicates specific events reported by the corresponding node", HFILL}
12863 {&hf_nrup_high_success_delivered_retx_nr_pdcp_sn,
12864 { "Highest Successfully Delivered Retransmitted NR PDCP SN", "nrup.high_success_delivered_retx_nr_pdcp_sn",
12865 FT_UINT24, BASE_DEC, NULL, 0,
12866 NULL, HFILL}
12868 {&hf_nrup_high_retx_nr_pdcp_sn,
12869 { "Highest Retransmitted NR PDCP SN Ind", "nrup.high_retx_nr_pdcp_sn",
12870 FT_UINT24, BASE_DEC, NULL, 0,
12871 NULL, HFILL}
12874 {&hf_nrup_pdcp_duplication_ind,
12875 { "PDCP Duplication Indication", "nrup.pdcp_duplication_ind",
12876 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
12877 NULL, HFILL}
12879 {&hf_nrup_assistance_information_ind,
12880 { "Assistance Information Indication", "nrup.assistance_information_ind",
12881 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
12882 NULL, HFILL}
12884 {&hf_nrup_ul_delay_ind,
12885 { "UL Delay Indicator", "nrup.ul_delay_ind",
12886 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
12887 NULL, HFILL}
12889 {&hf_nrup_dl_delay_ind,
12890 { "DL Delay Indicator", "nrup.dl_delay_ind",
12891 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
12892 NULL, HFILL}
12894 {&hf_nrup_spare_2,
12895 { "Spare", "nrup.spare",
12896 FT_UINT8, BASE_HEX, NULL, 0xfe,
12897 NULL, HFILL}
12899 {&hf_nrup_pdcp_duplication_activation_suggestion,
12900 { "PDCP Duplication Activation Suggestion", "nrup.pdcp_duplication_activation_suggestion",
12901 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
12902 NULL, HFILL}
12904 {&hf_nrup_num_assistance_info_fields,
12905 { "Number of Assistance Information Fields", "nrup.num_assistance_info_fields",
12906 FT_UINT8, BASE_DEC, NULL, 0x0,
12907 NULL, HFILL}
12909 {&hf_nrup_assistance_information_type,
12910 { "Assistance Information Type", "nrup.assistance_info_type",
12911 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(assistance_info_type), 0x0,
12912 NULL, HFILL}
12914 {&hf_nrup_num_octets_radio_qa_info,
12915 { "Number of octets for Radio Quality Assistance Information Fields", "nrup.num_octets_radio_qa_info",
12916 FT_UINT8, BASE_DEC, NULL, 0x0,
12917 NULL, HFILL}
12919 {&hf_nrup_radio_qa_info,
12920 { "Radio Quality Assistance Information", "nrup.radio_qa_info",
12921 FT_BYTES, BASE_NONE, NULL, 0x0,
12922 NULL, HFILL}
12924 {&hf_nrup_ul_delay_du_result,
12925 { "UL Delay DU Result", "nrup.ul_delay_du_result",
12926 FT_UINT32, BASE_DEC, NULL, 0x0,
12927 NULL, HFILL}
12929 {&hf_nrup_dl_delay_du_result,
12930 { "DL Delay DU Result", "nrup.dl_delay_du_result",
12931 FT_UINT32, BASE_DEC, NULL, 0x0,
12932 NULL, HFILL}
12937 static ei_register_info ei[] = {
12938 { &ei_gtp_ext_length_mal, { "gtp.ext_length.invalid", PI_MALFORMED, PI_ERROR, "Malformed length", EXPFILL }},
12939 { &ei_gtp_ext_hdr_pdcpsn, { "gtp.ext_hdr.pdcp_sn.non_zero", PI_PROTOCOL, PI_NOTE, "3GPP TS 29.281 v9.0.0: When used between two eNBs at the X2 interface in E-UTRAN, bit 8 of octet 2 is spare. The meaning of the spare bits shall be set to zero.", EXPFILL }},
12940 { &ei_gtp_ext_length_warn, { "gtp.ext_length.invalid", PI_PROTOCOL, PI_WARN, "Length warning", EXPFILL }},
12941 { &ei_gtp_undecoded, { "gtp.undecoded", PI_UNDECODED, PI_WARN, "Data not decoded yet", EXPFILL }},
12942 { &ei_gtp_message_not_found, { "gtp.message_not_found", PI_PROTOCOL, PI_WARN, "Message not found", EXPFILL }},
12943 { &ei_gtp_field_not_present, { "gtp.field_not_present", PI_PROTOCOL, PI_WARN, "Field not present", EXPFILL }},
12944 { &ei_gtp_wrong_next_field, { "gtp.wrong_next_field", PI_PROTOCOL, PI_WARN, "Wrong next field", EXPFILL }},
12945 { &ei_gtp_field_not_support_in_version, { "gtp.field_not_support_in_version", PI_PROTOCOL, PI_WARN, "GTP version not supported for field", EXPFILL }},
12946 { &ei_gtp_guaranteed_bit_rate_value, { "gtp.guaranteed_bit_rate_value", PI_PROTOCOL, PI_NOTE, "Use the value indicated by the Guaranteed bit rate", EXPFILL }},
12947 { &ei_gtp_max_bit_rate_value, { "gtp.max_bit_rate_value", PI_PROTOCOL, PI_NOTE, "Use the value indicated by the Maximum bit rate", EXPFILL }},
12948 { &ei_gtp_ext_geo_loc_type, { "gtp.ext_geo_loc_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown Location type data", EXPFILL }},
12949 { &ei_gtp_iei, { "gtp.iei.unknown", PI_PROTOCOL, PI_WARN, "Unknown IEI - Later spec than TS 29.060 9.4.0 used?", EXPFILL }},
12950 { &ei_gtp_unknown_extension_header, { "gtp.unknown_extension_header", PI_PROTOCOL, PI_WARN, "Unknown extension header", EXPFILL }},
12951 { &ei_gtp_unknown_pdu_type, { "gtp.unknown_pdu_type", PI_PROTOCOL, PI_WARN, "Unknown PDU type", EXPFILL }},
12952 { &ei_gtp_source_type_unknown, { "gtp.source_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown source type", EXPFILL }},
12953 { &ei_gtp_cdr_rel_ext_invalid, { "gtp.cdr_rel_ext.invalid", PI_PROTOCOL, PI_WARN, "If Release Identifier is 0, Release Identifier Extension must be >= 16", EXPFILL}},
12956 /* Setup protocol subtree array */
12957 #define GTP_NUM_INDIVIDUAL_ELEMS 39
12958 static int *ett_gtp_array[GTP_NUM_INDIVIDUAL_ELEMS + NUM_GTP_IES];
12960 ett_gtp_array[0] = &ett_gtp;
12961 ett_gtp_array[1] = &ett_gtp_flags;
12962 ett_gtp_array[2] = &ett_gtp_ext;
12963 ett_gtp_array[3] = &ett_gtp_cdr_dr;
12964 ett_gtp_array[4] = &ett_gtp_qos;
12965 ett_gtp_array[5] = &ett_gtp_qos_arp;
12966 ett_gtp_array[6] = &ett_gtp_flow_ii;
12967 ett_gtp_array[7] = &ett_gtp_ext_hdr;
12968 ett_gtp_array[8] = &ett_gtp_rp;
12969 ett_gtp_array[9] = &ett_gtp_pkt_flow_id;
12970 ett_gtp_array[10] = &ett_gtp_data_resp;
12971 ett_gtp_array[11] = &ett_gtp_cdr_ver;
12972 ett_gtp_array[12] = &ett_gtp_tmgi;
12973 ett_gtp_array[13] = &ett_gtp_trip;
12974 ett_gtp_array[14] = &ett_gtp_quint;
12975 ett_gtp_array[15] = &ett_gtp_drx;
12976 ett_gtp_array[16] = &ett_gtp_net_cap;
12977 ett_gtp_array[17] = &ett_gtp_can_pack;
12978 ett_gtp_array[18] = &ett_gtp_proto;
12979 ett_gtp_array[19] = &ett_gtp_gsn_addr;
12980 ett_gtp_array[20] = &ett_gtp_tft;
12981 ett_gtp_array[21] = &ett_gtp_rab_setup;
12982 ett_gtp_array[22] = &ett_gtp_hdr_list;
12983 ett_gtp_array[23] = &ett_gtp_rel_pack;
12984 ett_gtp_array[24] = &ett_gtp_node_addr;
12985 ett_gtp_array[25] = &ett_gtp_mm_cntxt;
12986 ett_gtp_array[26] = &ett_gtp_utran_cont;
12987 ett_gtp_array[27] = &ett_gtp_nr_ran_cont;
12988 ett_gtp_array[28] = &ett_gtp_pdcp_no_conf;
12989 ett_gtp_array[29] = &ett_pdu_session_cont;
12990 ett_gtp_array[30] = &ett_gtp_trace_triggers_ggsn;
12991 ett_gtp_array[31] = &ett_gtp_trace_loi_ggsn;
12992 ett_gtp_array[32] = &ett_gtp_trace_triggers_bm_sc;
12993 ett_gtp_array[33] = &ett_gtp_trace_loi_bm_sc;
12994 ett_gtp_array[34] = &ett_gtp_bss_cont;
12995 ett_gtp_array[35] = &ett_gtp_lst_set_up_pfc;
12996 ett_gtp_array[36] = &ett_gtp_rrc_cont;
12997 ett_gtp_array[37] = &ett_gtp_rim_routing_adr;
12998 ett_gtp_array[38] = &ett_nrup;
13000 last_offset = GTP_NUM_INDIVIDUAL_ELEMS;
13002 for (i=0; i < NUM_GTP_IES; i++, last_offset++)
13004 ett_gtp_array[last_offset] = &ett_gtp_ies[i];
13008 proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
13009 proto_gtpprime = proto_register_protocol("GPRS Tunneling Protocol Prime", "GTP (Prime)", "gtpprime");
13011 proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
13012 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
13013 expert_gtp = expert_register_protocol(proto_gtp);
13014 expert_register_field_array(expert_gtp, ei, array_length(ei));
13016 proto_nrup = proto_register_protocol("NRUP", "NRUP", "nrup");
13017 proto_register_field_array(proto_nrup, hf_nrup, array_length(hf_nrup));
13020 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
13021 /* For reading older preference files with "gtpv0." or "gtpv1." preferences */
13022 prefs_register_module_alias("gtpv0", gtp_module);
13023 prefs_register_module_alias("gtpv1", gtp_module);
13025 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 and GTP' port", "GTPv0 and GTP' port (default 3386)", 10, &g_gtpv0_port);
13026 prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 or GTPv2 control plane (GTP-C, GTPv2-C) port", "GTPv1 and GTPv2 control plane port (default 2123)", 10,
13027 &g_gtpv1c_port);
13028 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
13029 &g_gtpv1u_port);
13030 prefs_register_enum_preference(gtp_module, "dissect_tpdu_as",
13031 "Dissect T-PDU as",
13032 "Dissect T-PDU as",
13033 &dissect_tpdu_as,
13034 gtp_decode_tpdu_as,
13035 false);
13036 prefs_register_uint_preference(gtp_module, "pair_max_interval", "Max interval allowed in pair matching", "Request/reply pair matches only if their timestamps are closer than that value, in ms (default 0, i.e. don't use timestamps)", 10, &pref_pair_matching_max_interval_ms);
13038 prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
13039 prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
13040 prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
13041 prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
13042 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
13043 prefs_register_obsolete_preference(gtp_module, "dissect_tpdu");
13045 /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
13046 * The preference is set to true by default forbackward compatibility
13048 prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
13049 prefs_register_bool_preference(gtp_module, "track_gtp_session", "Track GTP session", "Track GTP session", &g_gtp_session);
13051 /* --- PDCP DECODE ADDITIONS --- */
13053 static uat_field_t pdcp_lte_keys_uat_flds[] = {
13054 UAT_FLD_CSTRING_OTHER(pdcp_lte_users, ip_addr_str, "Dst IP address", pdcp_uat_fld_ip_chk_cb, "IPv4 or IPv6 address"),
13055 UAT_FLD_CSTRING_OTHER(pdcp_lte_users, teid_str, "TEID value or \"" PDCP_TEID_WILDCARD "\"", pdcp_uat_fld_teid_chk_cb, "Tunnel Endpoint Identifier"),
13056 UAT_FLD_VS(pdcp_lte_users, direction, "Direction", vs_direction, "Direction of frames"),
13057 UAT_FLD_VS(pdcp_lte_users, header_present, "Header present", vs_header_present, "Header present flag"),
13058 UAT_FLD_VS(pdcp_lte_users, plane, "Plane", vs_pdcp_plane, "Signaling or user plane"),
13059 UAT_FLD_VS(pdcp_lte_users, lte_sn_length, "PDCP SN length", vs_pdcp_lte_sn_length, "Length of PDCP sequence number"),
13060 UAT_FLD_VS(pdcp_lte_users, rohc_compression, "ROHC compression", vs_rohc_compression, "Header compression"),
13061 //UAT_FLD_VS(pdcp_lte_users, rohc_mode, "ROHC mode", vs_rohc_mode, "ROHC mode"),
13062 UAT_FLD_VS(pdcp_lte_users, rohc_profile, "ROHC profile", vs_rohc_profile, "ROHC profile"),
13063 UAT_FLD_DEC(pdcp_lte_users, ue_id, "UE Id", "UE Identifier to match other PDCP config"),
13064 UAT_FLD_DEC(pdcp_lte_users, rb_id, "RB Id", "Radio Bearer Identifier"),
13065 UAT_END_FIELDS
13068 pdcp_lte_keys_uat = uat_new("PDCP-LTE Keys",
13069 sizeof(uat_pdcp_lte_keys_record_t), /* record size */
13070 "gtp_pdcp_lte_keys2", /* filename */
13071 true, /* from_profile */
13072 &uat_pdcp_lte_keys_records, /* data_ptr */
13073 &num_pdcp_lte_keys_uat, /* numitems_ptr */
13074 UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
13075 NULL, /* help */
13076 pdcp_lte_copy_cb, /* copy callback */
13077 pdcp_lte_update_cb, /* update callback */
13078 pdcp_lte_free_cb, /* free callback */
13079 NULL, /* post update callback */
13080 NULL, /* reset callback */
13081 pdcp_lte_keys_uat_flds); /* UAT field definitions */
13084 prefs_register_uat_preference(gtp_module,
13085 "pdcp_lte_table",
13086 "GTP PDCP-LTE Keys",
13087 "Preconfigured PDCP-LTE Keys",
13088 pdcp_lte_keys_uat);
13090 static uat_field_t pdcp_nr_keys_uat_flds[] = {
13091 UAT_FLD_CSTRING_OTHER(pdcp_nr_users, ip_addr_str, "Dst IP address", pdcp_uat_fld_ip_chk_cb, "IPv4 or IPv6 address"),
13092 UAT_FLD_CSTRING_OTHER(pdcp_nr_users, teid_str, "TEID value or \"" PDCP_TEID_WILDCARD "\"", pdcp_uat_fld_teid_chk_cb, "Tunnel Endpoint Identifier"),
13093 UAT_FLD_VS(pdcp_nr_users, direction, "Direction", vs_direction, "Direction of frames"),
13094 UAT_FLD_VS(pdcp_nr_users, sdap_header_present, "SDAP header present flag", vs_sdap_header_present, "SDAP header present flag"),
13095 UAT_FLD_VS(pdcp_nr_users, mac_i_present, "MAC-I present flag", vs_mac_i_present, "MAC-I present flag"),
13096 UAT_FLD_VS(pdcp_nr_users, plane, "Plane", vs_pdcp_plane, "Signaling or user plane"),
13097 UAT_FLD_VS(pdcp_nr_users, pdcp_nr_sn_length, "PDCP SN length", vs_pdcp_nr_sn_length, "Length of PDCP sequence number"),
13098 UAT_FLD_VS(pdcp_nr_users, rohc_compression, "ROHC compression", vs_rohc_compression, "Header compression"),
13099 //UAT_FLD_VS(pdcp_nr_users, rohc_mode, "ROHC mode", vs_rohc_mode, "ROHC mode"),
13100 UAT_FLD_VS(pdcp_nr_users, rohc_profile, "ROHC profile", vs_rohc_profile, "ROHC profile"),
13101 UAT_FLD_DEC(pdcp_nr_users, ue_id, "UE Id", "UE Identifier to match other PDCP config"),
13102 UAT_FLD_DEC(pdcp_nr_users, rb_id, "RB Id", "Radio Bearer Identifier"),
13103 UAT_END_FIELDS
13106 pdcp_nr_keys_uat = uat_new("PDCP-NR Keys",
13107 sizeof(uat_pdcp_nr_keys_record_t), /* record size */
13108 "gtp_pdcp_nr_keys2", /* filename */
13109 true, /* from_profile */
13110 &uat_pdcp_nr_keys_records, /* data_ptr */
13111 &num_pdcp_nr_keys_uat, /* numitems_ptr */
13112 UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
13113 NULL, /* help */
13114 pdcp_nr_copy_cb, /* copy callback */
13115 pdcp_nr_update_cb, /* update callback */
13116 pdcp_nr_free_cb, /* free callback */
13117 NULL, /* post update callback */
13118 NULL, /* reset callback */
13119 pdcp_nr_keys_uat_flds); /* UAT field definitions */
13121 /* Set default values for new entries to this table. Choosing SRB-1 (DL) */
13122 /* N.B. currently doesn't seem to work.. */
13123 static const char *nr_keys_uat_defaults_[] = {
13124 NULL, /*dst-address*/
13125 "*", /*teid*/
13126 PDCP_DIRECTION_DOWNLINK_STR, PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR, MAC_I_PRESENT_TRUE_STR,
13127 SIGNALING_PLANE_STR, PDCP_SN_LENGTH_12_BITS_STR, ROHC_COMPRESSION_FALSE_STR, ROHC_PROFILE_UNCOMPRESSED_STR,
13128 "1", /*ueid*/ "1" /*rb*/
13130 uat_set_default_values(pdcp_nr_keys_uat, nr_keys_uat_defaults_);
13133 prefs_register_uat_preference(gtp_module,
13134 "pdcp_nr_table",
13135 "GTP PDCP-NR Keys",
13136 "Preconfigured PDCP-NR Keys",
13137 pdcp_nr_keys_uat);
13139 /* --- END PDCP NR DECODE ADDITIONS ---*/
13141 gtp_handle = register_dissector("gtp", dissect_gtp, proto_gtp);
13142 gtp_prime_handle = register_dissector("gtpprime", dissect_gtpprime, proto_gtpprime);
13143 nrup_handle = register_dissector("nrup", dissect_nrup, proto_nrup);
13145 gtp_priv_ext_dissector_table = register_dissector_table("gtp.priv_ext", "GTP Private Extension", proto_gtp, FT_UINT16, BASE_DEC);
13146 gtp_cdr_fmt_dissector_table = register_dissector_table("gtp.cdr_fmt", "GTP Data Record Type", proto_gtp, FT_UINT16, BASE_DEC);
13147 gtp_hdr_ext_dissector_table = register_dissector_table("gtp.hdr_ext", "GTP Header Extension", proto_gtp, FT_UINT16, BASE_DEC);
13149 session_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
13150 frame_map = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), gtp_info_hash, gtp_info_equal);
13151 register_init_routine(gtp_init);
13152 gtp_tap = register_tap("gtp");
13153 gtpv1_tap = register_tap("gtpv1");
13155 register_srt_table(proto_gtp, NULL, 1, gtpstat_packet, gtpstat_init, NULL);
13157 heur_subdissector_list = register_heur_dissector_list("gtp.tpdu", proto_gtp);
13159 /* TS 132 295 V9.0.0 (2010-02)
13160 * 5.1.3 Port usage
13161 * - The UDP Destination Port may be the server port number 3386 which has been reserved for GTP'.
13162 * Alternatively another port can be used, which has been configured by O&M, except Port Number 2123
13163 * which is used by GTPv2-C.
13165 * The TCP Destination Port may be the server port number 3386, which has been reserved for G-PDUs. Alternatively,
13166 * another port may be used as configured by O&M. Extra implementation-specific destination ports are possible but
13167 * all CGFs shall support the server port number.
13170 void
13171 proto_reg_handoff_gtp(void)
13173 static bool Initialized = false;
13174 static bool gtp_over_tcp;
13175 static unsigned gtpv0_port;
13176 static unsigned gtpv1c_port;
13177 static unsigned gtpv1u_port;
13179 if (!Initialized) {
13181 radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
13182 radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
13184 eth_handle = find_dissector_add_dependency("eth_withoutfcs", proto_gtp);
13185 ip_handle = find_dissector_add_dependency("ip", proto_gtp);
13186 ipv6_handle = find_dissector_add_dependency("ipv6", proto_gtp);
13187 ppp_handle = find_dissector_add_dependency("ppp", proto_gtp);
13188 sync_handle = find_dissector_add_dependency("sync", proto_gtp);
13189 gtpcdr_handle = find_dissector_add_dependency("gtpcdr", proto_gtp);
13190 sndcpxid_handle = find_dissector_add_dependency("sndcpxid", proto_gtp);
13191 gtpv2_handle = find_dissector_add_dependency("gtpv2", proto_gtp);
13192 bssgp_handle = find_dissector_add_dependency("bssgp", proto_gtp);
13193 pdcp_nr_handle = find_dissector_add_dependency("pdcp-nr", proto_gtp);
13194 pdcp_lte_handle = find_dissector_add_dependency("pdcp-lte", proto_gtp);
13195 proto_pdcp_lte = dissector_handle_get_protocol_index(pdcp_lte_handle);
13197 bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
13198 /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
13199 dissector_add_uint("diameter.3gpp", 5, create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
13200 /* AVP Code: 903 MBMS-Service-Area */
13201 dissector_add_uint("diameter.3gpp", 903, create_dissector_handle(dissect_gtp_3gpp_mbms_service_area, proto_gtp));
13202 /* AVP Code: 904 MBMS-Session-Duration */
13203 dissector_add_uint("diameter.3gpp", 904, create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
13204 /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
13205 dissector_add_uint("diameter.3gpp", 911, create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
13207 // TPDU payload detection
13208 int eth_proto_id = dissector_handle_get_protocol_index(eth_handle);
13209 heur_dissector_add("gtp.tpdu", dissect_eth_heur, "Ethernet over GTP", "eth_gtp.tpdu", eth_proto_id, HEURISTIC_ENABLE);
13211 Initialized = true;
13212 } else {
13213 dissector_delete_uint("udp.port", gtpv0_port, gtp_prime_handle);
13214 dissector_delete_uint("udp.port", gtpv1c_port, gtp_handle);
13215 dissector_delete_uint("udp.port", gtpv1u_port, gtp_handle);
13217 if (gtp_over_tcp) {
13218 dissector_delete_uint("tcp.port", gtpv0_port, gtp_prime_handle);
13219 dissector_delete_uint("tcp.port", gtpv1c_port, gtp_handle);
13220 dissector_delete_uint("tcp.port", gtpv1u_port, gtp_handle);
13224 gtp_over_tcp = g_gtp_over_tcp;
13225 gtpv0_port = g_gtpv0_port;
13226 gtpv1c_port = g_gtpv1c_port;
13227 gtpv1u_port = g_gtpv1u_port;
13229 /* This doesn't use the "auto preference" API because the port
13230 description is too specific */
13231 dissector_add_uint("udp.port", g_gtpv0_port, gtp_prime_handle);
13232 dissector_add_uint("udp.port", g_gtpv1c_port, gtp_handle);
13233 dissector_add_uint("udp.port", g_gtpv1u_port, gtp_handle);
13235 if (g_gtp_over_tcp) {
13236 /* This doesn't use the "auto preference" API because the port
13237 description is too specific */
13238 dissector_add_uint("tcp.port", g_gtpv0_port, gtp_prime_handle);
13239 dissector_add_uint("tcp.port", g_gtpv1c_port, gtp_handle);
13240 dissector_add_uint("tcp.port", g_gtpv1u_port, gtp_handle);
13245 * Editor modelines - https://www.wireshark.org/tools/modelines.html
13247 * Local variables:
13248 * c-basic-offset: 4
13249 * tab-width: 8
13250 * indent-tabs-mode: nil
13251 * End:
13253 * vi: set shiftwidth=4 tabstop=8 expandtab:
13254 * :indentSize=4:tabSize=8:noTabs=true: