Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-gtp.c
blob1af655dc1ff6ad3ea472bca4e7acb79436b8e6c5
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}, /* ChargingCharacteristics 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_conv_info_t *
4342 find_or_create_gtp_conv_info(packet_info *pinfo, conversation_t *conversation)
4344 gtp_conv_info_t *gtp_info;
4346 if (conversation == NULL) {
4347 /* XXX - Note 3GPP TS 29.060 10.1 UDP/IP that the destination address
4348 * of the request and the source address of the response do NOT have
4349 * to match (unlike the source of request and destination of response,
4350 * and both sets of ports). So ideally this should be a conversation
4351 * that matches on three parameters but not all four. We might have to
4352 * use the msg_type to know whether it's a request or response, though,
4353 * which might mean doing this inside gtp_match_response.
4355 conversation = find_or_create_conversation(pinfo);
4359 * Do we already know this conversation?
4361 gtp_info = (gtp_conv_info_t *)conversation_get_proto_data(conversation, proto_gtp);
4362 if (gtp_info == NULL) {
4363 /* No. Attach that information to the conversation, and add
4364 * it to the list of information structures.
4366 gtp_info = wmem_new(wmem_file_scope(), gtp_conv_info_t);
4367 /*Request/response matching tables*/
4368 gtp_info->matched = wmem_map_new(wmem_file_scope(), gtp_sn_hash, gtp_sn_equal_matched);
4369 gtp_info->unmatched = wmem_map_new(wmem_file_scope(), gtp_sn_hash, gtp_sn_equal_unmatched);
4371 conversation_add_proto_data(conversation, proto_gtp, gtp_info);
4374 return gtp_info;
4377 static gtp_msg_hash_t *
4378 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)
4380 gtp_msg_hash_t gcr, *gcrp = NULL;
4381 uint32_t session;
4383 gcr.seq_nr=seq_nr;
4384 gcr.req_time = pinfo->abs_ts;
4386 switch (msgtype) {
4387 case GTP_MSG_ECHO_REQ:
4388 case GTP_MSG_CREATE_PDP_REQ:
4389 case GTP_MSG_UPDATE_PDP_REQ:
4390 case GTP_MSG_DELETE_PDP_REQ:
4391 case GTP_MSG_FORW_RELOC_REQ:
4392 case GTP_MSG_DATA_TRANSF_REQ:
4393 case GTP_MSG_SGSN_CNTXT_REQ:
4394 case GTP_MS_INFO_CNG_NOT_REQ:
4395 case GTP_MSG_IDENT_REQ:
4396 gcr.is_request=true;
4397 gcr.req_frame=pinfo->num;
4398 gcr.rep_frame=0;
4399 break;
4400 case GTP_MSG_ECHO_RESP:
4401 case GTP_MSG_CREATE_PDP_RESP:
4402 case GTP_MSG_UPDATE_PDP_RESP:
4403 case GTP_MSG_DELETE_PDP_RESP:
4404 case GTP_MSG_FORW_RELOC_RESP:
4405 case GTP_MSG_DATA_TRANSF_RESP:
4406 case GTP_MSG_SGSN_CNTXT_RESP:
4407 case GTP_MS_INFO_CNG_NOT_RES:
4408 case GTP_MSG_IDENT_RESP:
4409 gcr.is_request=false;
4410 gcr.req_frame=0;
4411 gcr.rep_frame=pinfo->num;
4412 break;
4413 default:
4414 gcr.is_request=false;
4415 gcr.req_frame=0;
4416 gcr.rep_frame=0;
4417 break;
4420 gcrp = (gtp_msg_hash_t *)wmem_map_lookup(gtp_info->matched, &gcr);
4422 if (gcrp) {
4424 gcrp->is_request=gcr.is_request;
4426 } else {
4428 /*no match, let's try to make one*/
4429 switch (msgtype) {
4430 case GTP_MSG_ECHO_REQ:
4431 case GTP_MSG_CREATE_PDP_REQ:
4432 case GTP_MSG_UPDATE_PDP_REQ:
4433 case GTP_MSG_DELETE_PDP_REQ:
4434 case GTP_MSG_FORW_RELOC_REQ:
4435 case GTP_MSG_DATA_TRANSF_REQ:
4436 case GTP_MSG_SGSN_CNTXT_REQ:
4437 case GTP_MS_INFO_CNG_NOT_REQ:
4438 case GTP_MSG_IDENT_REQ:
4439 gcr.seq_nr=seq_nr;
4441 gcrp=(gtp_msg_hash_t *)wmem_map_lookup(gtp_info->unmatched, &gcr);
4442 if (gcrp) {
4443 wmem_map_remove(gtp_info->unmatched, gcrp);
4445 /* if we can't reuse the old one, grab a new chunk */
4446 if (!gcrp) {
4447 gcrp = wmem_new(wmem_file_scope(), gtp_msg_hash_t);
4449 gcrp->seq_nr=seq_nr;
4450 gcrp->req_frame = pinfo->num;
4451 gcrp->req_time = pinfo->abs_ts;
4452 gcrp->rep_frame = 0;
4453 gcrp->msgtype = msgtype;
4454 gcrp->is_request = true;
4455 wmem_map_insert(gtp_info->unmatched, gcrp, gcrp);
4456 return NULL;
4457 case GTP_MSG_ECHO_RESP:
4458 case GTP_MSG_CREATE_PDP_RESP:
4459 case GTP_MSG_UPDATE_PDP_RESP:
4460 case GTP_MSG_DELETE_PDP_RESP:
4461 case GTP_MSG_FORW_RELOC_RESP:
4462 case GTP_MSG_DATA_TRANSF_RESP:
4463 case GTP_MSG_SGSN_CNTXT_RESP:
4464 case GTP_MS_INFO_CNG_NOT_RES:
4465 case GTP_MSG_IDENT_RESP:
4466 gcr.seq_nr=seq_nr;
4467 gcrp=(gtp_msg_hash_t *)wmem_map_lookup(gtp_info->unmatched, &gcr);
4469 if (gcrp) {
4470 if (!gcrp->rep_frame) {
4471 wmem_map_remove(gtp_info->unmatched, gcrp);
4472 gcrp->rep_frame=pinfo->num;
4473 gcrp->is_request=false;
4474 wmem_map_insert(gtp_info->matched, gcrp, gcrp);
4477 break;
4478 default:
4479 break;
4483 /* we have found a match */
4484 if (gcrp) {
4485 proto_item *it;
4488 if (gcrp->is_request) {
4489 it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
4490 proto_item_set_generated(it);
4491 } else {
4492 nstime_t ns;
4494 it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
4495 proto_item_set_generated(it);
4496 nstime_delta(&ns, &pinfo->abs_ts, &gcrp->req_time);
4497 it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
4498 proto_item_set_generated(it);
4499 if (g_gtp_session) {
4500 if (!PINFO_FD_VISITED(pinfo) && gtp_version == 1) {
4501 /* GTP session */
4502 /* If it does not have any session assigned yet */
4503 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
4504 if (!session) {
4505 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(gcrp->req_frame)));
4506 if (session) {
4507 add_gtp_session(pinfo->num, session);
4511 if (!is_cause_accepted(last_cause, gtp_version)){
4512 /* If the cause is not accepted then we have to remove all the session information about its corresponding request */
4513 remove_frame_info(gcrp->req_frame);
4519 return gcrp;
4523 static int
4524 check_field_presence_and_decoder(uint8_t version, uint8_t message, uint8_t field, int *position, ie_decoder **alt_decoder)
4527 unsigned i = 0;
4528 const _gtp_mess_items *mess_items;
4530 switch (version) {
4531 case 0:
4532 mess_items = gprs_mess_items;
4533 break;
4534 case 1:
4535 mess_items = umts_mess_items;
4536 break;
4537 default:
4538 return -2;
4541 while (mess_items[i].code) {
4542 if (mess_items[i].code == message) {
4544 while (mess_items[i].fields[*position].code) {
4545 if (mess_items[i].fields[*position].code == field) {
4546 *alt_decoder = mess_items[i].fields[*position].alt_decoder;
4547 (*position)++;
4548 return 0;
4549 } else {
4550 if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
4551 return mess_items[i].fields[(*position)++].code;
4552 } else {
4553 (*position)++;
4557 return -1;
4559 i++;
4562 return -2;
4565 /* Decoders of fields in extension headers, each function returns no of bytes from field */
4567 /* GPRS: 9.60 v7.6.0, chapter
4568 * UMTS: 29.060 v4.0, chapter
4569 * 7.7.1 Cause
4571 static int
4572 decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args)
4574 uint8_t cause;
4576 cause = tvb_get_uint8(tvb, offset + 1);
4577 if (g_gtp_session) {
4578 args->last_cause = cause;
4580 proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
4582 return 2;
4585 /* GPRS: 9.60 v7.6.0, chapter 7.9.2
4586 * UMTS: 29.060 v4.0, chapter 7.7.2
4588 static int
4589 decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4591 /* const char *imsi_str; */
4593 /* Octets 2 - 9 IMSI */
4594 /* imsi_str = */ dissect_e212_imsi(tvb, pinfo, tree, offset+1, 8, false);
4596 return 9;
4599 /* GPRS: 9.60 v7.6.0, chapter 7.9.3
4600 * UMTS: 29.060 v4.0, chapter 7.7.3 Routeing Area Identity (RAI)
4602 static int
4603 decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4606 proto_tree *ext_tree_rai;
4608 ext_tree_rai = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ies[GTP_EXT_RAI], NULL,
4609 val_to_str_ext_const(GTP_EXT_RAI, &gtp_val_ext, "Unknown message"));
4611 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree_rai, offset+1, E212_RAI, true);
4612 proto_tree_add_item(ext_tree_rai, hf_gtp_lac, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
4613 proto_tree_add_item(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
4615 return 7;
4618 /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
4619 * UMTS: 29.060 v4.0, chapter 7.7.4 Temporary Logical Link Identity (TLLI)
4621 static int
4622 decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4625 uint32_t tlli;
4627 tlli = tvb_get_ntohl(tvb, offset + 1);
4628 proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
4630 return 5;
4633 /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
4634 * UMTS: 29.060 v4.0, chapter 7.7.5 Packet TMSI (P-TMSI)
4636 static int
4637 decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4639 proto_item* ti;
4641 proto_tree_add_item(tree, hf_gtp_ptmsi, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
4642 ti = proto_tree_add_item(tree, hf_3gpp_tmsi, tvb, offset+1, 4, ENC_BIG_ENDIAN);
4643 proto_item_set_hidden(ti);
4645 return 5;
4649 * adjust - how many bytes before offset should be highlighted
4651 static int
4652 decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const char * qos_str, uint8_t adjust)
4655 uint8_t spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
4656 proto_tree *ext_tree_qos;
4658 spare1 = tvb_get_uint8(tvb, offset) & GTP_EXT_QOS_SPARE1_MASK;
4659 delay = tvb_get_uint8(tvb, offset) & GTP_EXT_QOS_DELAY_MASK;
4660 reliability = tvb_get_uint8(tvb, offset) & GTP_EXT_QOS_RELIABILITY_MASK;
4661 peak = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
4662 spare2 = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
4663 precedence = tvb_get_uint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
4664 spare3 = tvb_get_uint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
4665 mean = tvb_get_uint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
4667 ext_tree_qos = proto_tree_add_subtree_format(tree, tvb, offset - adjust, 3 + adjust, ett_gtp_qos, NULL,
4668 "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
4669 qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
4671 if (adjust != 0) {
4672 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
4673 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
4674 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
4675 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
4676 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
4677 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
4678 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
4679 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
4682 return 3;
4685 /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
4686 * 4.08
4687 * 3.60
4688 * UMTS: not present
4689 * TODO: check if length is included: ETSI 4.08 vs 9.60
4691 static int
4692 decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4695 return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
4699 /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
4700 * UMTS: 29.060 v4.0, chapter 7.7.6 Reordering Required
4702 static int
4703 decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4706 uint8_t reorder;
4708 reorder = tvb_get_uint8(tvb, offset + 1) & 0x01;
4709 proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
4711 return 2;
4714 /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
4715 * 4.08 v7.1.2, chapter 10.5.3.1+
4716 * UMTS: 29.060 v4.0, chapter 7.7.7
4717 * TODO: Add blurb support by registering items in the protocol registration
4719 static int
4720 decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4723 proto_tree *ext_tree_auth_tri;
4725 ext_tree_auth_tri = proto_tree_add_subtree(tree, tvb, offset, 29, ett_gtp_ies[GTP_EXT_AUTH_TRI], NULL,
4726 val_to_str_ext_const(GTP_EXT_AUTH_TRI, &gtp_val_ext, "Unknown message"));
4728 proto_tree_add_item(ext_tree_auth_tri, hf_gtp_rand, tvb, offset + 1, 16, ENC_NA);
4729 proto_tree_add_item(ext_tree_auth_tri, hf_gtp_sres, tvb, offset + 17, 4, ENC_NA);
4730 proto_tree_add_item(ext_tree_auth_tri, hf_gtp_kc, tvb, offset + 21, 8, ENC_NA);
4732 return 1 + 16 + 4 + 8;
4735 /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
4736 * 9.02 v7.7.0, page 1090
4737 * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
4738 * 29.002 v4.2.1, chapter 17.5, page 268
4740 static int
4741 decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4744 uint8_t map_cause;
4746 map_cause = tvb_get_uint8(tvb, offset + 1);
4747 proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
4749 return 2;
4752 /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
4753 * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
4755 static int
4756 decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4759 uint32_t ptmsi_sig;
4761 ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
4762 proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
4764 return 4;
4767 /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
4768 * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
4770 static int
4771 decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4774 uint8_t ms_valid;
4776 ms_valid = tvb_get_uint8(tvb, offset + 1) & 0x01;
4777 proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
4779 return 2;
4782 /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
4783 * UMTS: 29.060 v4.0, chapter 7.7.11 Recovery
4785 static int
4786 decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4789 uint8_t recovery;
4791 recovery = tvb_get_uint8(tvb, offset + 1);
4792 proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
4794 return 2;
4797 /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
4798 * UMTS: 29.060 v4.0, chapter 7.7.12 Selection Mode
4802 static const char *
4803 dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
4805 uint8_t sel_mode;
4807 /* Value in ASCII(UTF-8) */
4808 sel_mode = tvb_get_uint8(tvb, 0) - 0x30;
4809 proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
4811 return val_to_str_const(sel_mode, sel_mode_type, "Unknown");
4814 static int
4815 decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4817 proto_tree *ext_tree;
4818 proto_item *te;
4819 uint8_t sel_mode;
4821 sel_mode = tvb_get_uint8(tvb, offset + 1) & 0x03;
4823 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_gtp_ies[GTP_EXT_SEL_MODE], &te,
4824 val_to_str_ext_const(GTP_EXT_SEL_MODE, &gtp_val_ext, "Unknown message"));
4825 proto_item_append_text(te, ": %s", val_to_str_const(sel_mode, sel_mode_type, "Unknown"));
4826 proto_tree_add_item(ext_tree, hf_gtp_sel_mode, tvb, offset+1, 1, ENC_BIG_ENDIAN);
4828 return 2;
4831 /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
4832 * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
4834 static int
4835 decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
4838 uint16_t ext_flow_label;
4839 uint32_t teid_data, *teid;
4841 switch (gtp_version) {
4842 case 0:
4843 ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
4844 proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
4846 return 3;
4847 case 1:
4848 teid_data = tvb_get_ntohl(tvb, offset + 1);
4849 /* We save the teid_data so that we could assignate its corresponding session ID later */
4850 if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) {
4851 args->last_teid = teid_data; /* We save it to track the error indication */
4852 if (!teid_exists(teid_data, args->teid_list)) {
4853 teid = wmem_new(pinfo->pool, uint32_t);
4854 *teid = teid_data;
4855 wmem_list_prepend(args->teid_list, teid);
4858 proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset+1, 4, teid_data);
4860 return 5;
4861 default:
4862 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4863 tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
4865 return 3;
4869 /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
4870 * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
4872 static int
4873 decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
4876 uint32_t teid_cp;
4877 uint32_t *teid;
4879 switch (gtp_version) {
4880 case 0:
4881 proto_tree_add_item(tree, hf_gtp_flow_sig, tvb, offset+1, 2, ENC_BIG_ENDIAN);
4882 return 3;
4883 case 1:
4884 proto_tree_add_item_ret_uint(tree, hf_gtp_teid_cp, tvb, offset+1 , 4, ENC_BIG_ENDIAN, &teid_cp);
4885 /* We save the teid_cp so that we could assignate its corresponding session ID later */
4886 if (g_gtp_session && !PINFO_FD_VISITED(pinfo)) {
4887 if (!teid_exists(teid_cp, args->teid_list)) {
4888 teid = wmem_new(pinfo->pool, uint32_t);
4889 *teid = teid_cp;
4890 wmem_list_prepend(args->teid_list, teid);
4893 return 5;
4894 default:
4895 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4896 tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
4897 return 3;
4901 /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
4902 * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
4904 static int
4905 decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4908 uint16_t flow_ii;
4909 uint32_t teid_ii;
4910 proto_tree *ext_tree_flow_ii;
4912 switch (gtp_version) {
4913 case 0:
4914 ext_tree_flow_ii = proto_tree_add_subtree(tree, tvb, offset, 4, ett_gtp_ies[GTP_EXT_FLOW_II], NULL,
4915 val_to_str_ext_const(GTP_EXT_FLOW_II, &gtp_val_ext, "Unknown message"));
4917 proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4919 flow_ii = tvb_get_ntohs(tvb, offset + 2);
4920 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
4922 return 4;
4923 case 1:
4924 ext_tree_flow_ii = proto_tree_add_subtree(tree, tvb, offset, 6, ett_gtp_flow_ii, NULL,
4925 val_to_str_ext_const(GTP_EXT_TEID_II, &gtpv1_val_ext, "Unknown message"));
4927 proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4929 teid_ii = tvb_get_ntohl(tvb, offset + 2);
4930 proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
4932 return 6;
4933 default:
4934 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4935 tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
4937 return 4;
4941 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
4942 * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
4943 * Check if all ms_reason types are included
4945 static int
4946 decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
4949 uint8_t field19;
4951 field19 = tvb_get_uint8(tvb, offset + 1);
4953 switch (gtp_version) {
4954 case 0:
4955 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
4956 break;
4957 case 1:
4958 proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
4959 break;
4960 default:
4961 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_field_not_support_in_version,
4962 tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
4963 break;
4966 return 2;
4969 /* GPRS: not present
4970 * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
4972 static int
4973 decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4975 uint8_t nsapi;
4976 proto_tree *ext_tree;
4977 proto_item *te;
4979 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_gtp_ies[GTP_EXT_NSAPI], &te,
4980 val_to_str_ext_const(GTP_EXT_NSAPI, &gtp_val_ext, "Unknown message"));
4982 nsapi = tvb_get_uint8(tvb, offset + 1) & 0x0F;
4983 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4984 proto_item_append_text(te, ": %u",nsapi);
4986 return 2;
4989 /* GPRS: not present
4990 * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
4992 static int
4993 decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
4996 uint8_t ranap;
4998 ranap = tvb_get_uint8(tvb, offset + 1);
5000 if ((ranap > 0) && (ranap <= 64))
5001 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
5002 ranap, "%s (Radio Network Layer Cause) : %s (%u)",
5003 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5004 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5006 if ((ranap > 64) && (ranap <= 80))
5007 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
5008 ranap, "%s (Transport Layer Cause) : %s (%u)",
5009 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5010 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5012 if ((ranap > 80) && (ranap <= 96))
5013 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
5014 ranap, "%s (NAS Cause) : %s (%u)",
5015 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5016 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5018 if ((ranap > 96) && (ranap <= 112))
5019 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
5020 "%s (Protocol Cause) : %s (%u)",
5021 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5022 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5024 if ((ranap > 112) && (ranap <= 128))
5025 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
5026 "%s (Miscellaneous Cause) : %s (%u)",
5027 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5028 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5030 if ((ranap > 128) /* && (ranap <= 255) */ )
5031 proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
5032 "%s (Non-standard Cause) : %s (%u)",
5033 val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
5034 val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
5036 return 2;
5039 /* GPRS: not present
5040 * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
5042 static int
5043 decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5045 proto_tree *ext_tree_rab_cntxt;
5047 ext_tree_rab_cntxt = proto_tree_add_subtree(tree, tvb, offset, 10, ett_gtp_ies[GTP_EXT_RAB_CNTXT], NULL,
5048 val_to_str_ext_const(GTP_EXT_RAB_CNTXT, &gtp_val_ext, "Unknown message"));
5050 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5051 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
5052 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
5053 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
5054 proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, ENC_BIG_ENDIAN);
5056 return 10;
5060 /* GPRS: not present
5061 * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
5063 static int
5064 decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5067 uint8_t rp_sms;
5069 rp_sms = tvb_get_uint8(tvb, offset + 1) & 0x07;
5070 proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
5072 return 2;
5075 /* GPRS: not present
5076 * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
5078 static int
5079 decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5082 proto_tree *ext_tree_rp;
5083 proto_item *te;
5084 uint8_t nsapi, rp;
5086 nsapi = (tvb_get_uint8(tvb, offset + 1) & 0xF0) >> 4;
5087 rp = tvb_get_uint8(tvb, offset + 1) & 0x07;
5089 /* TODO: shouldn't really use int item as tree root.. */
5090 te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
5091 ext_tree_rp = proto_item_add_subtree(te, ett_gtp_rp);
5093 proto_tree_add_item(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, ENC_NA);
5094 proto_tree_add_item(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, ENC_NA);
5095 proto_tree_add_item(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, ENC_NA);
5097 return 2;
5100 /* GPRS: not present
5101 * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
5103 static int
5104 decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5107 proto_tree *ext_tree_pkt_flow_id;
5108 proto_item *te;
5109 uint8_t nsapi, pkt_flow_id;
5111 nsapi = tvb_get_uint8(tvb, offset + 1) & 0x0F;
5112 pkt_flow_id = tvb_get_uint8(tvb, offset + 2);
5114 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);
5115 ext_tree_pkt_flow_id = proto_item_add_subtree(te, ett_gtp_pkt_flow_id);
5117 proto_tree_add_item(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5118 proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
5119 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);
5121 return 3;
5124 /* GPRS: not present
5125 * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
5126 * TODO: Differenciate these uints?
5128 static int
5129 decode_gtp_chrg_char(tvbuff_t* tvb, int offset, packet_info* pinfo _U_, proto_tree* tree, session_args_t* args _U_)
5132 static int* const gtp_charg_flags[] = {
5133 &hf_gtp_chrg_char_s,
5134 &hf_gtp_chrg_char_n,
5135 &hf_gtp_chrg_char_p,
5136 &hf_gtp_chrg_char_f,
5137 &hf_gtp_chrg_char_h,
5138 &hf_gtp_chrg_char_r,
5139 NULL
5142 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);
5144 return 3;
5147 /* GPRS: not present
5148 * UMTS: 29.060 v4.0, chapter 7.7.24, page
5150 static int
5151 decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5154 uint16_t trace_ref;
5156 trace_ref = tvb_get_ntohs(tvb, offset + 1);
5158 proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
5160 return 3;
5163 /* GPRS: not present
5164 * UMTS: 29.060 v4.0, chapter 7.7.25, page
5166 static int
5167 decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5170 uint16_t trace_type;
5172 trace_type = tvb_get_ntohs(tvb, offset + 1);
5174 proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
5176 return 3;
5179 /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
5180 * UMTS: 29.060 v4.0, chapter 7.7.25A, page
5182 static int
5183 decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5186 uint8_t reason;
5188 reason = tvb_get_uint8(tvb, offset + 1);
5190 /* Reason for Absence is defined in 3GPP TS 23.040 */
5191 proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
5193 return 2;
5196 /* GPRS: ?
5197 * UMTS: 29.060 v6.11.0, chapter 7.7.25B
5198 * Radio Priority LCS
5200 static int
5201 decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5204 uint16_t length;
5205 proto_tree *ext_tree;
5207 length = tvb_get_ntohs(tvb, offset + 1);
5208 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RA_PRIO_LCS], NULL,
5209 "%s : ", val_to_str_ext_const(GTP_EXT_RA_PRIO_LCS, &gtp_val_ext, "Unknown"));
5211 offset++;
5212 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
5213 offset = offset + 2;
5215 proto_tree_add_item(ext_tree, hf_gtp_ra_prio_lcs, tvb, offset, 1, ENC_BIG_ENDIAN);
5217 return 3 + length;
5221 /* TS 32.295, chapter 6.2.4.5.2, page 29 */
5222 static int
5223 decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5226 uint8_t tr_command;
5228 tr_command = tvb_get_uint8(tvb, offset + 1);
5230 proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
5232 return 2;
5235 /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
5236 * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
5238 static int
5239 decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5242 uint32_t chrg_id;
5244 chrg_id = tvb_get_ntohl(tvb, offset + 1);
5245 proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
5247 return 5;
5250 /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
5251 * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
5253 static int
5254 decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
5257 uint16_t length;
5258 uint8_t pdp_typ, pdp_org;
5259 proto_tree *ext_tree_user;
5260 proto_item *te;
5263 length = tvb_get_ntohs(tvb, offset + 1);
5264 pdp_org = tvb_get_uint8(tvb, offset + 3) & 0x0F;
5265 pdp_typ = tvb_get_uint8(tvb, offset + 4);
5267 ext_tree_user = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length,
5268 ett_gtp_ies[GTP_EXT_USER_ADDR], &te, "%s (%s/%s)",
5269 val_to_str_ext_const(GTP_EXT_USER_ADDR, &gtp_val_ext, "Unknown message"),
5270 val_to_str_const(pdp_org, pdp_org_type, "Unknown PDP Organization"),
5271 val_to_str_const(pdp_typ, pdp_type, "Unknown PDP Type"));
5273 proto_tree_add_item(ext_tree_user, hf_gtp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
5274 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset + 3, 1, pdp_org);
5275 proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
5277 if (length == 2) {
5278 if ((pdp_org == 0) && (pdp_typ == 1))
5279 proto_item_append_text(te, " (Point to Point Protocol)");
5280 else if (pdp_typ == 2)
5281 proto_item_append_text(te, " (Octet Stream Protocol)");
5282 } else if (length > 2) {
5283 switch (pdp_typ) {
5284 case 0x21:
5285 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5286 proto_item_append_text(te, " : %s", tvb_ip_to_str(pinfo->pool, tvb, offset + 5));
5287 break;
5288 case 0x57:
5289 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, ENC_NA);
5290 proto_item_append_text(te, " : %s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 5));
5291 break;
5292 case 0x8d:
5293 if (length == 6) {
5294 ws_in6_addr ipv6;
5295 memset(&ipv6, 0, sizeof(ws_in6_addr));
5296 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5297 proto_tree_add_ipv6_format_value(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 0, &ipv6, "dynamic");
5298 proto_item_append_text(te, " : %s / dynamic", tvb_ip_to_str(pinfo->pool, tvb, offset + 5));
5299 } else if (length == 18) {
5300 proto_tree_add_ipv4_format_value(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 0, 0, "dynamic");
5301 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, ENC_NA);
5302 proto_item_append_text(te, " : dynamic / %s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 5));
5303 } else if (length == 22) {
5304 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, ENC_BIG_ENDIAN);
5305 proto_tree_add_item(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 16, ENC_NA);
5306 proto_item_append_text(te, " : %s / %s", tvb_ip_to_str(pinfo->pool, tvb, offset + 5),
5307 tvb_ip6_to_str(pinfo->pool, tvb, offset + 9));
5308 } else {
5309 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);
5311 break;
5313 } else
5314 proto_item_append_text(te, " : empty PDP Address");
5316 return 3 + length;
5319 static int
5320 decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, uint16_t count)
5323 proto_tree *ext_tree_trip;
5324 uint16_t i;
5326 for (i = 0; i < count; i++) {
5327 ext_tree_trip = proto_tree_add_subtree_format(tree, tvb, offset + i * 28, 28, ett_gtp_trip, NULL, "Triplet no%x", i);
5329 proto_tree_add_item(ext_tree_trip, hf_gtp_rand, tvb, offset + (i * 28), 16, ENC_NA);
5330 proto_tree_add_item(ext_tree_trip, hf_gtp_sres, tvb, offset + (i * 28) + 16, 4, ENC_NA);
5331 proto_tree_add_item(ext_tree_trip, hf_gtp_kc, tvb, offset + (i * 28) + 20, 8, ENC_NA);
5334 return count * 28;
5337 /* adjust - how many bytes before quintuplet should be highlighted
5339 static int
5340 decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, uint16_t count)
5343 proto_tree *ext_tree_quint;
5344 proto_item *te_quint;
5345 uint16_t q_offset, i;
5346 uint8_t xres_len, auth_len;
5348 q_offset = 0;
5350 for (i = 0; i < count; i++) {
5352 ext_tree_quint = proto_tree_add_subtree_format(tree, tvb, offset, -1,
5353 ett_gtp_quint, &te_quint, "Quintuplet #%x", i + 1);
5355 proto_tree_add_item(ext_tree_quint, hf_gtp_rand, tvb, offset + q_offset, 16, ENC_NA);
5356 q_offset = q_offset + 16;
5357 xres_len = tvb_get_uint8(tvb, offset + q_offset);
5358 proto_tree_add_item(ext_tree_quint, hf_gtp_xres_length, tvb, offset + q_offset, 1, ENC_BIG_ENDIAN);
5359 q_offset++;
5360 proto_tree_add_item(ext_tree_quint, hf_gtp_xres, tvb, offset + q_offset, xres_len, ENC_NA);
5361 q_offset = q_offset + xres_len;
5362 proto_tree_add_item(ext_tree_quint, hf_gtp_quintuplet_ciphering_key, tvb, offset + q_offset, 16, ENC_NA);
5363 q_offset = q_offset + 16;
5364 proto_tree_add_item(ext_tree_quint, hf_gtp_quintuplet_integrity_key, tvb, offset + q_offset, 16, ENC_NA);
5365 q_offset = q_offset + 16;
5366 auth_len = tvb_get_uint8(tvb, offset + q_offset);
5367 proto_tree_add_item(ext_tree_quint, hf_gtp_authentication_length, tvb, offset + q_offset, 1, ENC_BIG_ENDIAN);
5368 q_offset++;
5369 proto_tree_add_item(ext_tree_quint, hf_gtp_auth, tvb, offset + q_offset, auth_len, ENC_NA);
5371 q_offset = q_offset + auth_len;
5372 proto_item_set_end(te_quint, tvb, offset + q_offset);
5376 return q_offset;
5379 /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
5380 * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
5381 * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
5382 * - finish displaying last 3 parameters
5384 static int
5385 decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
5388 uint16_t length, con_len;
5389 uint8_t count, sec_mode, len, iei;
5390 proto_tree *ext_tree_mm;
5391 proto_tree *tf_tree = NULL, *con_tree;
5393 ext_tree_mm = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ies[GTP_EXT_MM_CNTXT], NULL,
5394 val_to_str_ext_const(GTP_EXT_MM_CNTXT, &gtp_val_ext, "Unknown message"));
5396 /* Octet 2 - 3 */
5397 length = tvb_get_ntohs(tvb, offset + 1);
5398 if (length < 1)
5399 return 3;
5401 /* Octet 4 (cksn)*/
5403 /* Octet 5 */
5404 sec_mode = (tvb_get_uint8(tvb, offset + 4) >> 6) & 0x03;
5405 count = (tvb_get_uint8(tvb, offset + 4) >> 3) & 0x07;
5407 proto_tree_add_item(ext_tree_mm, hf_gtp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
5408 if (gtp_version == 0)
5409 sec_mode = 1;
5412 switch (sec_mode) {
5413 case 0: /* Used cipher value, UMTS keys and Quintuplets */
5414 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5415 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5416 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5417 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5418 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_ck, tvb, offset + 5, 16, ENC_NA);
5419 proto_tree_add_item(ext_tree_mm, hf_gtp_integrity_key_ik, tvb, offset + 21, 16, ENC_NA);
5420 proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 37, 2, ENC_BIG_ENDIAN);
5422 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
5425 break;
5426 case 1: /* GSM key and triplets */
5427 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5428 if (gtp_version != 0)
5429 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5431 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5432 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5433 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_kc, tvb, offset + 5, 8, ENC_NA);
5435 offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
5437 break;
5438 case 2: /* UMTS key and quintuplets */
5439 proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5440 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5441 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5442 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_ck, tvb, offset + 5, 16, ENC_NA);
5443 proto_tree_add_item(ext_tree_mm, hf_gtp_integrity_key_ik, tvb, offset + 21, 16, ENC_NA);
5444 proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 37, 2, ENC_BIG_ENDIAN);
5446 offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
5448 break;
5449 case 3: /* GSM key and quintuplets */
5450 proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
5451 proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5452 proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5453 proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
5454 proto_tree_add_item(ext_tree_mm, hf_gtp_ciphering_key_kc, tvb, offset + 5, 8, ENC_NA);
5455 proto_tree_add_item(ext_tree_mm, hf_gtp_quintuplets_length, tvb, offset + 13, 2, ENC_BIG_ENDIAN);
5457 offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
5459 break;
5460 default:
5461 break;
5465 * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
5467 tf_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, 2, ett_gtp_drx, NULL, "DRX Parameter");
5468 de_gmm_drx_param(tvb, tf_tree, pinfo, offset, 2, NULL, 0);
5469 offset = offset + 2;
5471 len = tvb_get_uint8(tvb, offset);
5472 tf_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, len + 1, ett_gtp_net_cap, NULL, "MS Network Capability");
5474 proto_tree_add_uint(tf_tree, hf_gtp_ms_network_cap_content_len, tvb, offset, 1, len);
5476 offset++;
5478 * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
5480 if (len > 0) {
5481 de_gmm_ms_net_cap(tvb, tf_tree, pinfo, offset, len, NULL, 0);
5482 offset = offset + len;
5485 /* 3GPP TS 29.060 version 9.4.0 Release 9
5486 * The two octets Container Length holds the length of the Container, excluding the Container Length octets.
5487 * Container contains one or several optional information elements as described in the clause "Overview", from the clause
5488 * "General message format and information elements coding" in 3GPP TS 24.008 [5]. For the definition of the IEI see
5489 * table 47a, "IEIs for information elements used in the container". The IMEISV shall, if available, be included in the
5490 * Container. The IMEISV is included in the Mobile identity IE. If Container is not included, its Length field value shall
5491 * be set to 0. If the MS is emergency attached and the MS is UICCless or the IMSI is unauthenticated, the International
5492 * Mobile Equipment Identity (IMEI) shall be used as the MS identity.
5494 * Table 47A: IEIs for information elements used in the container
5495 * IEI Information element
5496 * 0x23 Mobile identity
5498 * NOTE: In 3GPP TS 24.008 [5] the IEI definition is
5499 * message dependent. The table is added to
5500 * have a unique definition in the present
5501 * document for the used IEI in the MMcontext.
5504 con_len = tvb_get_ntohs(tvb, offset);
5505 proto_tree_add_item(ext_tree_mm, hf_gtp_container_length, tvb, offset, 2, ENC_BIG_ENDIAN);
5506 offset = offset + 2;
5508 if (con_len > 0) {
5509 proto_item* ti;
5511 con_tree = proto_tree_add_subtree(ext_tree_mm, tvb, offset, con_len, ett_gtp_mm_cntxt, NULL, "Container");
5513 iei = tvb_get_uint8(tvb,offset);
5514 ti = proto_tree_add_uint(con_tree, hf_gtp_iei, tvb, offset, 1, iei);
5515 if (iei == 0x23) {
5516 proto_item_append_text(ti, " (Mobile identity)");
5517 offset++;
5518 len = tvb_get_uint8(tvb,offset);
5519 proto_tree_add_uint(con_tree, hf_gtp_iei_mobile_id_len, tvb, offset, 1, len);
5520 offset++;
5521 de_mid(tvb, con_tree, pinfo, offset, len, NULL, 0);
5522 } else {
5523 expert_add_info(pinfo, ti, &ei_gtp_iei);
5527 return 3 + length;
5530 /* Function to extract the value of an hexadecimal octet. Only the lower
5531 * nybble will be non-zero in the output.
5532 * */
5533 static uint8_t
5534 hex2dec(uint8_t x)
5536 /* XXX, ws_xton() */
5537 if ((x >= 'a') && (x <= 'f'))
5538 x = x - 'a' + 10;
5539 else if ((x >= 'A') && (x <= 'F'))
5540 x = x - 'A' + 10;
5541 else if ((x >= '0') && (x <= '9'))
5542 x = x - '0';
5543 else
5544 x = 0;
5545 return x;
5548 /* Wrapper function to add UTF-8 decoding for QoS attributes in
5549 * RADIUS messages.
5550 * */
5551 static uint8_t
5552 wrapped_tvb_get_uint8(tvbuff_t * tvb, int offset, int type)
5554 if (type == 2)
5555 return (hex2dec(tvb_get_uint8(tvb, offset)) << 4 | hex2dec(tvb_get_uint8(tvb, offset + 1)));
5556 else
5557 return tvb_get_uint8(tvb, offset);
5560 /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
5561 * so type means length of length :-)
5563 * WARNING :) type does not mean length of length any more... see below for
5564 * type = 3!
5567 decode_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, const char * qos_str, uint8_t type)
5570 unsigned length;
5571 uint8_t al_ret_priority;
5572 uint8_t delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
5573 uint8_t traf_class, del_order, del_err_sdu;
5574 uint8_t max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext, max_ul_ext2 = 0, max_dl_ext2 = 0;
5575 uint8_t res_ber, sdu_err_ratio;
5576 uint8_t trans_delay, traf_handl_prio;
5577 uint8_t guar_ul, guar_dl, guar_ul_ext, guar_dl_ext, guar_ul_ext2 = 0, guar_dl_ext2 = 0;
5578 uint8_t src_stat_desc, sig_ind, spare4;
5579 proto_tree *ext_tree_qos;
5580 int mss, mu, md, gu, gd;
5581 uint8_t arp, qci;
5582 uint32_t apn_ambr;
5583 uint64_t br;
5585 /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
5586 * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
5587 * to one byte to be dissected).
5588 * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
5589 * corresponds to one byte to be dissected)
5590 * */
5591 uint8_t utf8_type = 1;
5593 /* Will keep the release indicator as indicated in the RADIUS message */
5594 uint8_t rel_ind = 0;
5596 /* In RADIUS messages the QoS has a version field of two octets prepended.
5597 * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
5598 * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
5599 * inconsistent and unuseful, I will check hyphen presence here and
5600 * will signal its presence.
5601 * */
5602 uint8_t hyphen;
5604 /* Will keep the value that will be returned
5605 * */
5606 int retval = 0;
5608 switch (type) {
5609 case 0:
5610 /* For QoS inside GPRS-CDR messages from GGSN/P-GW */
5611 length = tvb_reported_length(tvb);
5612 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length, ett_gtp_qos, NULL, qos_str);
5613 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset, 1, length);
5614 /* QoS inside GPRS-CDR has no length octet, so no extra offset needed */
5615 retval = length;
5616 break;
5617 case 1:
5618 length = tvb_get_uint8(tvb, offset);
5619 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length + 1, ett_gtp_qos, NULL, qos_str);
5620 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset, 1, length);
5621 offset++;
5622 retval = length + 1;
5623 break;
5624 case 2:
5625 length = tvb_get_ntohs(tvb, offset + 1);
5626 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_qos, NULL, qos_str);
5627 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_umts_length, tvb, offset + 1, 2, length);
5628 offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
5629 retval = length + 3;
5630 break;
5631 case 3:
5632 /* For QoS inside RADIUS Client messages from GGSN/P-GW */
5633 utf8_type = 2;
5635 /* The field in the RADIUS message is the length of the tvb we were given */
5636 length = tvb_reported_length(tvb);
5637 ext_tree_qos = proto_tree_add_subtree(tree, tvb, offset, length, ett_gtp_qos, NULL, qos_str);
5639 rel_ind = wrapped_tvb_get_uint8(tvb, offset, 2);
5640 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, rel_ind);
5642 /* Hyphen handling */
5643 hyphen = tvb_get_uint8(tvb, offset + 2);
5644 if (hyphen == ((uint8_t) '-')) {
5645 /* Hyphen is present, put in protocol tree */
5646 proto_tree_add_item(ext_tree_qos, hf_gtp_hyphen_separator, tvb, offset + 2, 1, ENC_NA);
5647 offset++; /* "Get rid" of hyphen */
5650 /* Now, we modify offset here and in order to use type later
5651 * effectively.*/
5652 offset++;
5654 length -= offset;
5655 length /= 2; /* Binary length of encoded data. */
5657 /* Fake the length of the IE including the IE id and length octets
5658 * we are actually using it to determine presence of Octet n as counted
5659 * in TS 24.008
5662 retval = length + 2; /* Actually, will be ignored. */
5663 break;
5664 default:
5665 /* XXX - what should we do with the length here? */
5666 length = 0;
5667 retval = 0;
5668 ext_tree_qos = NULL;
5669 break;
5672 if ((type == 3) && (rel_ind >= 8) && (rel_ind < 98)) {
5673 /* Release 8 or higher P-GW QoS profile */
5674 static int * const arp_flags[] = {
5675 &hf_gtp_qos_arp_pci,
5676 &hf_gtp_qos_arp_pl,
5677 &hf_gtp_qos_arp_pvi,
5678 NULL
5681 offset++;
5682 arp = wrapped_tvb_get_uint8(tvb, offset, 2);
5683 proto_tree_add_bitmask_value_with_flags(ext_tree_qos, tvb, offset, hf_gtp_qos_arp,
5684 ett_gtp_qos_arp, arp_flags, arp, BMT_NO_APPEND);
5685 offset += 2;
5687 qci = wrapped_tvb_get_uint8(tvb, offset, 2);
5688 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_qci, tvb, offset, 2, qci);
5689 offset += 2;
5690 if (qci <= 4) {
5691 /* GBR QCI */
5692 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5693 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5694 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5695 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5696 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5697 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_mbr, tvb, offset, 10, br);
5698 offset += 10;
5699 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5700 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5701 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5702 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5703 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5704 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_mbr, tvb, offset, 10, br);
5705 offset += 10;
5706 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5707 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5708 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5709 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5710 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5711 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_gbr, tvb, offset, 10, br);
5712 offset += 10;
5713 br = ((uint64_t)wrapped_tvb_get_uint8(tvb, offset , 2) << 32) |
5714 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+2, 2) << 24) |
5715 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+4, 2) << 16) |
5716 ((uint64_t)wrapped_tvb_get_uint8(tvb, offset+6, 2) << 8) |
5717 (uint64_t)wrapped_tvb_get_uint8(tvb, offset+8, 2);
5718 proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_gbr, tvb, offset, 10, br);
5719 } else {
5720 /* non GBR QCI */
5721 apn_ambr = (wrapped_tvb_get_uint8(tvb, offset , 2) << 24) |
5722 (wrapped_tvb_get_uint8(tvb, offset+2, 2) << 16) |
5723 (wrapped_tvb_get_uint8(tvb, offset+4, 2) << 8) |
5724 wrapped_tvb_get_uint8(tvb, offset+6, 2);
5725 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_ul_apn_ambr, tvb, offset, 8, apn_ambr);
5726 offset += 8;
5727 apn_ambr = (wrapped_tvb_get_uint8(tvb, offset , 2) << 24) |
5728 (wrapped_tvb_get_uint8(tvb, offset+2, 2) << 16) |
5729 (wrapped_tvb_get_uint8(tvb, offset+4, 2) << 8) |
5730 wrapped_tvb_get_uint8(tvb, offset+6, 2);
5731 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_dl_apn_ambr, tvb, offset, 8, apn_ambr);
5733 return retval;
5736 /* In RADIUS messages there is no allocation-retention priority
5737 * so I don't need to wrap the following call to tvb_get_uint8
5738 * */
5739 al_ret_priority = tvb_get_uint8(tvb, offset);
5741 /* All calls are wrapped to take into account the possibility that the
5742 * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
5743 * of the offset will be the same as in the previous version of this
5744 * dissector, and the wrapped function will serve as a dumb wrapper;
5745 * otherwise, if utf_8_type is 2, the offset is correctly shifted by
5746 * two bytes for needed shift, and the wrapped function will unencode
5747 * two values from the input.
5748 * */
5749 spare1 = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE1_MASK;
5750 delay = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DELAY_MASK;
5751 reliability = wrapped_tvb_get_uint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RELIABILITY_MASK;
5752 peak = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PEAK_MASK;
5753 spare2 = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE2_MASK;
5754 precedence = wrapped_tvb_get_uint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PRECEDENCE_MASK;
5755 spare3 = wrapped_tvb_get_uint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE3_MASK;
5756 mean = wrapped_tvb_get_uint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_MEAN_MASK;
5758 /* In RADIUS messages there is no allocation-retention priority */
5759 if (type != 3) {
5760 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
5761 } else {
5762 /* Add an octet to the binary data length to account for the
5763 * missing ARP so that the length tests below are correct.
5765 length += 1;
5768 /* All additions must take care of the fact that QoS fields in RADIUS
5769 * messages are UTF-8 encoded, so we have to use the same trick as above.
5770 * */
5771 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
5772 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
5773 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
5774 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
5775 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
5776 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
5777 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
5778 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
5780 /* TS 24.008 V 7.8.0 10.5.6.5 Quality of service
5781 * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
5782 * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
5783 * attributes specified in octets 6-14.
5784 * In the MS to network direction and in the network to MS direction the following applies:
5785 * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
5786 * be included.
5787 * - If octet 17 is included, then octet 18 shall also be included.
5788 * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
5789 * be accepted by the receiving entity.
5792 if (length > 4) {
5794 /* See above for the need of wrapping
5797 /* Octet 6 */
5798 traf_class = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_CLASS_MASK;
5799 del_order = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ORDER_MASK;
5800 del_err_sdu = wrapped_tvb_get_uint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ERR_SDU_MASK;
5801 max_sdu_size = wrapped_tvb_get_uint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
5802 max_ul = wrapped_tvb_get_uint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
5803 max_dl = wrapped_tvb_get_uint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
5804 res_ber = wrapped_tvb_get_uint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RES_BER_MASK;
5805 sdu_err_ratio = wrapped_tvb_get_uint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SDU_ERR_RATIO_MASK;
5806 trans_delay = wrapped_tvb_get_uint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRANS_DELAY_MASK;
5807 traf_handl_prio = wrapped_tvb_get_uint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK;
5808 guar_ul = wrapped_tvb_get_uint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
5809 /* Octet 13 */
5810 guar_dl = wrapped_tvb_get_uint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
5812 spare4 = 0;
5813 sig_ind = 0;
5814 src_stat_desc = 0;
5815 max_dl_ext = 0;
5816 guar_dl_ext = 0;
5817 max_ul_ext = 0;
5818 guar_ul_ext = 0;
5820 if (length > 13 ||((type == 2) && (length == 13))) {
5821 spare4 = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE4_MASK;
5822 sig_ind = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SIG_IND_MASK;
5823 src_stat_desc = wrapped_tvb_get_uint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SRC_STAT_DESC_MASK;
5825 if (length > 14) {
5826 max_dl_ext = wrapped_tvb_get_uint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
5827 guar_dl_ext = wrapped_tvb_get_uint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
5829 if (length > 16) {
5830 max_ul_ext = wrapped_tvb_get_uint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
5831 guar_ul_ext = wrapped_tvb_get_uint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
5833 if (length > 18) {
5834 max_dl_ext2 = wrapped_tvb_get_uint8(tvb, offset + (17 - 1) * utf8_type + 1, utf8_type);
5835 guar_dl_ext2 = wrapped_tvb_get_uint8(tvb, offset + (18 - 1) * utf8_type + 1, utf8_type);
5837 if (length > 20) {
5838 max_ul_ext2 = wrapped_tvb_get_uint8(tvb, offset + (19 - 1) * utf8_type + 1, utf8_type);
5839 guar_ul_ext2 = wrapped_tvb_get_uint8(tvb, offset + (20 - 1) * utf8_type + 1, utf8_type);
5843 * See above comments for the changes
5845 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
5846 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
5847 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);
5848 if (max_sdu_size == 0 || max_sdu_size > 150)
5849 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);
5850 if ((max_sdu_size > 0) && (max_sdu_size <= 150)) {
5851 mss = max_sdu_size * 10;
5852 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,
5853 "%u octets", mss);
5856 if (max_ul == 0 || max_ul == 255)
5857 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
5858 if ((max_ul > 0) && (max_ul <= 63))
5859 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,
5860 "%u kbps", max_ul);
5861 if ((max_ul > 63) && (max_ul <= 127)) {
5862 mu = 64 + (max_ul - 64) * 8;
5863 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
5864 "%u kbps", mu);
5867 if ((max_ul > 127) && (max_ul <= 254)) {
5868 mu = 576 + (max_ul - 128) * 64;
5869 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
5870 "%u kbps", mu);
5873 if (max_dl == 0 || max_dl == 255)
5874 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
5875 if ((max_dl > 0) && (max_dl <= 63))
5876 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,
5877 "%u kbps", max_dl);
5878 if ((max_dl > 63) && (max_dl <= 127)) {
5879 md = 64 + (max_dl - 64) * 8;
5880 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
5881 "%u kbps", md);
5883 if ((max_dl > 127) && (max_dl <= 254)) {
5884 md = 576 + (max_dl - 128) * 64;
5885 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
5886 "%u kbps", md);
5889 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
5890 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);
5891 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
5892 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);
5894 if (guar_ul == 0 || guar_ul == 255)
5895 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
5896 if ((guar_ul > 0) && (guar_ul <= 63))
5897 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,
5898 "%u kbps", guar_ul);
5899 if ((guar_ul > 63) && (guar_ul <= 127)) {
5900 gu = 64 + (guar_ul - 64) * 8;
5901 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
5902 "%u kbps", gu);
5904 if ((guar_ul > 127) && (guar_ul <= 254)) {
5905 gu = 576 + (guar_ul - 128) * 64;
5906 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
5907 "%u kbps", gu);
5910 /* Octet 13 */
5911 if (guar_dl == 0 || guar_dl == 255)
5912 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
5913 if ((guar_dl > 0) && (guar_dl <= 63))
5914 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,
5915 "%u kbps", guar_dl);
5916 if ((guar_dl > 63) && (guar_dl <= 127)) {
5917 gd = 64 + (guar_dl - 64) * 8;
5918 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
5919 "%u kbps", gd);
5921 if ((guar_dl > 127) && (guar_dl <= 254)) {
5922 gd = 576 + (guar_dl - 128) * 64;
5923 proto_tree_add_uint_format_value(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
5924 "%u kbps", gd);
5927 if(length > 13 ||((type == 2) && (length == 13))) {
5928 proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare4, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, spare4);
5929 proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
5930 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);
5934 if(length > 14) {
5935 /* Octet 15 */
5936 if(max_dl_ext == 0)
5937 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type,
5938 "Ext Maximum bit rate for downlink: Use the value in octet 9");
5939 if ((max_dl_ext > 0) && (max_dl_ext <= 0x4a)) {
5940 md = 8600 + max_dl_ext * 100;
5941 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5942 "Ext Maximum bit rate for downlink: %u kbps", md);
5944 if ((max_dl_ext > 0x4a) && (max_dl_ext <= 0xba)) {
5945 md = 16 + (max_dl_ext-0x4a);
5946 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5947 "Ext Maximum bit rate for downlink: %u Mbps", md);
5949 if ((max_dl_ext > 0xba) && (max_dl_ext <= 0xfa)) {
5950 md = 128 + (max_dl_ext-0xba)*2;
5951 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
5952 "Ext Maximum bit rate for downlink: %u Mbps", md);
5954 /* Octet 16 */
5955 if(guar_dl_ext == 0)
5956 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_guaranteed_bit_rate_value, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type,
5957 "Ext Guaranteed bit rate for downlink: Use the value in octet 13");
5958 if ((guar_dl_ext > 0) && (guar_dl_ext <= 0x4a)) {
5959 gd = 8600 + guar_dl_ext * 100;
5960 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5961 "Ext Guaranteed bit rate for downlink: %u kbps", gd);
5963 if ((guar_dl_ext > 0x4a) && (guar_dl_ext <= 0xba)) {
5964 gd = 16 + (guar_dl_ext-0x4a);
5965 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5966 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
5968 if ((guar_dl_ext > 0xba) && (guar_dl_ext <= 0xfa)) {
5969 gd = 128 + (guar_dl_ext-0xba)*2;
5970 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
5971 "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
5975 if(length > 16) {
5976 /* Octet 17
5977 * 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
5978 * rate for downlink (extended).
5980 if (max_ul_ext == 0)
5981 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type,
5982 "Ext Maximum bit rate for uplink: Use the value indicated in octet 8");
5983 if ((max_ul_ext > 0) && (max_ul_ext <= 0x4a)) {
5984 md = 8600 + max_ul_ext * 100;
5985 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5986 "Ext Maximum bit rate for uplink: %u kbps", md);
5988 if ((max_ul_ext > 0x4a) && (max_ul_ext <= 0xba)) {
5989 md = 16 + (max_ul_ext-0x4a);
5990 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5991 "Ext Maximum bit rate for uplink: %u Mbps", md);
5993 if ((max_ul_ext > 0xba) && (max_ul_ext <= 0xfa)) {
5994 md = 128 + (max_ul_ext-0xba)*2;
5995 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
5996 "Ext Maximum bit rate for uplink: %u Mbps", md);
5998 /* Octet 18 */
5999 if (guar_ul_ext == 0)
6000 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_guaranteed_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
6001 "Ext Guaranteed bit rate for uplink: Use the value indicated in octet 12");
6002 if ((guar_ul_ext > 0) && (guar_ul_ext <= 0x4a)) {
6003 gd = 8600 + guar_ul_ext * 100;
6004 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6005 "Ext Guaranteed bit rate for uplink: %u kbps", gd);
6007 if ((guar_ul_ext > 0x4a) && (guar_ul_ext <= 0xba)) {
6008 gd = 16 + (guar_ul_ext-0x4a);
6009 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6010 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
6012 if ((guar_ul_ext > 0xba) && (guar_ul_ext <= 0xfa)) {
6013 gd = 128 + (guar_ul_ext-0xba)*2;
6014 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6015 "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
6019 if(length > 18) {
6020 /* Octet 19 Maximum bit rate for downlink (extended-2)
6021 * 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
6022 * rate for downlink (extended).
6024 if (max_dl_ext2 == 0)
6025 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (17 - 1) * utf8_type + 1, utf8_type,
6026 "Ext2 Maximum bit rate for downlink: Use the value in octet 9 and octet 15.");
6028 if ((max_dl_ext2 > 0) && (max_dl_ext2 <= 0x3d)) {
6029 md = 256 + max_dl_ext2 * 4;
6030 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6031 "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6033 if ((max_dl_ext2 > 0x3d) && (max_dl_ext2 <= 0xa1)) {
6034 md = 500 + (max_dl_ext2-0x3d) * 10;
6035 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6036 "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6038 if ((max_dl_ext2 > 0xa1) && (max_dl_ext2 <= 0xf6)) {
6039 md = 1500 + (max_dl_ext2-0xa1)*10;
6040 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6041 "Ext2 Maximum bit rate for downlink: %u Mbps", md);
6043 /* Octet 20 Guaranteed bit rate for downlink (extended-2) */
6044 if (guar_dl_ext2 == 0)
6045 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
6046 "Ext2 Guaranteed bit rate for downlink: Use the value in octet 13 and octet 16.");
6047 if ((guar_dl_ext2 > 0) && (guar_dl_ext2 <= 0x3d)) {
6048 gd = 256 + guar_dl_ext2 * 4;
6049 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6050 "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6052 if ((guar_dl_ext2 > 0x3d) && (guar_dl_ext2 <= 0xa1)) {
6053 gd = 500 + (guar_dl_ext2-0x3d) * 10;
6054 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6055 "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6057 if ((guar_dl_ext2 > 0xba) && (guar_dl_ext2 <= 0xfa)) {
6058 gd = 1500 + (guar_dl_ext2-0xa1) * 10;
6059 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6060 "Ext2 Guaranteed bit rate for downlink: %u Mbps", gd);
6064 if(length > 20) {
6065 /* Maximum bit rate for uplink (extended-2), octet 21
6066 * 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
6067 * rate for downlink (extended).
6069 if (max_ul_ext2 == 0)
6070 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (17 - 1) * utf8_type + 1, utf8_type,
6071 "Ext2 Maximum bit rate for uplink: Use the value in octet 8 and octet 17.");
6073 if ((max_ul_ext2 > 0) && (max_ul_ext2 <= 0x3d)) {
6074 md = 256 + max_ul_ext2 * 4;
6075 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6076 "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6078 if ((max_ul_ext2 > 0x3d) && (max_ul_ext2 <= 0xa1)) {
6079 md = 500 + (max_ul_ext2-0x3d) * 10;
6080 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6081 "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6083 if ((max_ul_ext2 > 0xa1) && (max_ul_ext2 <= 0xf6)) {
6084 md = 1500 + (max_ul_ext2-0xa1)*10;
6085 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
6086 "Ext2 Maximum bit rate for uplink: %u Mbps", md);
6088 /* Guaranteed bit rate for uplink (extended-2), octet 22 */
6089 if (guar_ul_ext2 == 0)
6090 proto_tree_add_expert_format(ext_tree_qos, pinfo, &ei_gtp_max_bit_rate_value, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type,
6091 "Ext2 Guaranteed bit rate for uplink: Use the value in octet 13 and octet 16.");
6092 if ((guar_ul_ext2 > 0) && (guar_ul_ext2 <= 0x3d)) {
6093 gd = 256 + guar_ul_ext2 * 4;
6094 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6095 "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6097 if ((guar_ul_ext2 > 0x3d) && (guar_ul_ext2 <= 0xa1)) {
6098 gd = 500 + (guar_ul_ext2-0x3d) * 10;
6099 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6100 "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6102 if ((guar_ul_ext2 > 0xba) && (guar_ul_ext2 <= 0xfa)) {
6103 gd = 1500 + (guar_ul_ext2-0xa1) * 10;
6104 proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
6105 "Ext2 Guaranteed bit rate for uplink: %u Mbps", gd);
6110 return retval;
6113 /* Diameter 3GPP AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
6114 static int
6115 dissect_diameter_3gpp_qosprofile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
6117 decode_qos_umts(tvb, 0, pinfo, tree, "UMTS GTP QoS Profile", 3);
6118 return tvb_reported_length(tvb);
6121 static const char *
6122 dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo)
6124 decode_qos_umts(tvb, 0, pinfo, tree, "UMTS GTP QoS Profile", 3);
6125 return tvb_get_string_enc(pinfo->pool, tvb, 0, tvb_reported_length(tvb), ENC_UTF_8|ENC_NA);
6128 static void
6129 decode_apn(packet_info *pinfo, tvbuff_t * tvb, int offset, uint16_t length, proto_tree * tree, proto_item *item)
6131 const uint8_t *apn = NULL;
6134 * This is "a domain name represented as a sequence of labels, where
6135 * each label consists of a length octet followed by that number of
6136 * octets.", DNS-style.
6138 * XXX - does it involve compression?
6141 /* Highlight bytes including the first length byte */
6142 proto_tree_add_item_ret_string(tree, hf_gtp_apn, tvb, offset, length, ENC_APN_STR, pinfo->pool, &apn);
6143 if(item){
6144 proto_item_append_text(item, ": %s", apn);
6149 static void
6150 decode_fqdn(tvbuff_t * tvb, int offset, uint16_t length, proto_tree * tree, session_args_t * args _U_)
6152 int name_len;
6154 /* "The FQDN field encoding shall be identical to the encoding of a FQDN
6155 * within a DNS message of clause 3.1 of IETF RFC 1035 [45] but excluding
6156 * the trailing zero byte"
6158 * XXX: is compression possible?
6160 if (length > 0) {
6161 name_len = tvb_get_uint8(tvb, offset);
6163 /* "NOTE 1: The FQDN field in the IE is not encoded as a dotted string"
6164 * but if the first byte is large (in the letter range or higher),
6165 * assume that it is so encoded incorrectly.
6167 if (name_len < 0x40) {
6168 proto_tree_add_item(tree, hf_gtp_fqdn, tvb, offset, length, ENC_APN_STR);
6169 } else
6170 proto_tree_add_item(tree, hf_gtp_fqdn, tvb, offset, length, ENC_ASCII);
6175 * GPRS: 9.60 v7.6.0, chapter 7.9.20
6176 * UMTS: 29.060 v4.0, chapter 7.7.29 PDP Context
6177 * TODO: unify addr functions
6179 static int
6180 decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6183 uint8_t ggsn_addr_len, apn_len, trans_id, ea;
6184 uint8_t pdp_type_num, pdp_addr_len;
6185 uint16_t length;
6186 proto_tree *ext_tree_pdp;
6188 length = tvb_get_ntohs(tvb, offset + 1);
6190 ext_tree_pdp = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_PDP_CNTXT], NULL,
6191 val_to_str_ext_const(GTP_EXT_PDP_CNTXT, &gtp_val_ext, "Unknown message"));
6193 ea = (tvb_get_uint8(tvb, offset + 3) >> 7) & 0x01;
6195 proto_tree_add_item(ext_tree_pdp, hf_gtp_extended_end_user_address, tvb, offset + 3, 1, ENC_NA);
6196 proto_tree_add_item(ext_tree_pdp, hf_gtp_vplmn_address_allowed, tvb, offset + 3, 1, ENC_NA);
6197 proto_tree_add_item(ext_tree_pdp, hf_gtp_activity_status_indicator, tvb, offset + 3, 1, ENC_NA);
6198 proto_tree_add_item(ext_tree_pdp, hf_gtp_reordering_required, tvb, offset + 3, 1, ENC_NA);
6199 proto_tree_add_item(ext_tree_pdp, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6200 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_cntxt_sapi, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6202 switch (gtp_version) {
6203 case 0:
6204 decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
6205 decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
6206 decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
6207 offset = offset + 14;
6208 break;
6209 case 1:
6210 offset = offset + 5;
6211 offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS subscribed", 1);
6212 offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS requested", 1);
6213 offset = offset + decode_qos_umts(tvb, offset, pinfo, ext_tree_pdp, "QoS negotiated", 1);
6214 break;
6215 default:
6216 break;
6219 proto_tree_add_item(ext_tree_pdp, hf_gtp_sequence_number_down, tvb, offset, 2, ENC_BIG_ENDIAN);
6220 proto_tree_add_item(ext_tree_pdp, hf_gtp_sequence_number_up, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
6221 proto_tree_add_item(ext_tree_pdp, hf_gtp_send_n_pdu_number, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
6222 proto_tree_add_item(ext_tree_pdp, hf_gtp_receive_n_pdu_number, tvb, offset + 5, 1, ENC_BIG_ENDIAN);
6224 switch (gtp_version) {
6225 case 0:
6226 proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_flow_label_signalling, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
6227 offset = offset + 8;
6228 break;
6229 case 1:
6230 proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_teid_cp, tvb, offset + 6, 4, ENC_BIG_ENDIAN);
6231 proto_tree_add_item(ext_tree_pdp, hf_gtp_uplink_teid_data, tvb, offset + 10, 4, ENC_BIG_ENDIAN);
6232 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_context_identifier, tvb, offset + 14, 1, ENC_BIG_ENDIAN);
6233 offset = offset + 15;
6234 break;
6235 default:
6236 break;
6239 pdp_type_num = tvb_get_uint8(tvb, offset + 1);
6240 pdp_addr_len = tvb_get_uint8(tvb, offset + 2);
6242 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_organization, tvb, offset, 1, ENC_BIG_ENDIAN);
6243 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_type, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
6244 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_length, tvb, offset + 2, 1, ENC_BIG_ENDIAN);
6246 if (pdp_addr_len > 0) {
6247 switch (pdp_type_num) {
6248 case 0x21:
6249 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6250 break;
6251 case 0x57:
6252 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv6, tvb, offset + 3, 16, ENC_NA);
6253 break;
6254 default:
6255 break;
6259 offset = offset + 3 + pdp_addr_len;
6261 ggsn_addr_len = tvb_get_uint8(tvb, offset);
6262 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6264 switch (ggsn_addr_len) {
6265 case 4:
6266 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_control_plane_ipv4, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
6267 break;
6268 case 16:
6269 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_control_plane_ipv6, tvb, offset + 1, 16, ENC_NA);
6270 break;
6271 default:
6272 break;
6275 offset = offset + 1 + ggsn_addr_len;
6277 if (gtp_version == 1) {
6279 ggsn_addr_len = tvb_get_uint8(tvb, offset);
6280 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6282 switch (ggsn_addr_len) {
6283 case 4:
6284 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_user_traffic_ipv4, tvb, offset + 1, 4, ENC_BIG_ENDIAN);
6285 break;
6286 case 16:
6287 proto_tree_add_item(ext_tree_pdp, hf_gtp_ggsn_address_for_user_traffic_ipv6, tvb, offset + 1, 16, ENC_NA);
6288 break;
6289 default:
6290 break;
6292 offset = offset + 1 + ggsn_addr_len;
6296 apn_len = tvb_get_uint8(tvb, offset);
6297 proto_tree_add_item(ext_tree_pdp, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6298 decode_apn(pinfo, tvb, offset + 1, apn_len, ext_tree_pdp, NULL);
6300 offset = offset + 1 + apn_len;
6302 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
6303 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
6304 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
6305 * MS is stored in the PDP context IE.
6306 * 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
6307 * octet in this field.
6309 trans_id = tvb_get_uint8(tvb, offset);
6310 proto_tree_add_uint(ext_tree_pdp, hf_gtp_transaction_identifier, tvb, offset, 2, trans_id);
6311 offset += 2;
6313 if (ea) {
6314 pdp_type_num = tvb_get_uint8(tvb, offset);
6315 pdp_addr_len = tvb_get_uint8(tvb, offset + 1);
6317 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_type, tvb, offset, 1, ENC_BIG_ENDIAN);
6318 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_length, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
6320 if (pdp_addr_len > 0) {
6321 switch (pdp_type_num) {
6322 case 0x21:
6323 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv4, tvb, offset + 2, 4, ENC_NA);
6324 break;
6325 case 0x57:
6326 proto_tree_add_item(ext_tree_pdp, hf_gtp_pdp_address_ipv6, tvb, offset + 2, 16, ENC_NA);
6327 break;
6328 default:
6329 break;
6334 return 3 + length;
6337 /* GPRS: 9.60, v7.6.0, chapter 7.9.21
6338 * UMTS: 29.060, v4.0, chapter 7.7.30
6340 static int
6341 decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6344 uint16_t length;
6345 proto_tree *ext_tree_apn;
6346 proto_item *te;
6348 length = tvb_get_ntohs(tvb, offset + 1);
6350 ext_tree_apn = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_APN], &te,
6351 val_to_str_ext_const(GTP_EXT_APN, &gtp_val_ext, "Unknown field"));
6353 proto_tree_add_item(ext_tree_apn, hf_gtp_apn_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6354 decode_apn(pinfo, tvb, offset + 3, length, ext_tree_apn, te);
6356 return 3 + length;
6359 /* GPRS: 9.60 v7.6.0, chapter 7.9.22
6360 * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
6361 * UMTS: 29.060 v4.0, chapter 7.7.31 Protocol Configuration Options
6362 * 24.008, v4.2, chapter 10.5.6.3
6365 decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6368 uint16_t length;
6369 tvbuff_t *next_tvb;
6370 proto_tree *ext_tree_proto;
6372 length = tvb_get_ntohs(tvb, offset + 1);
6374 ext_tree_proto = proto_tree_add_subtree(tree, tvb, offset, length + 3,
6375 ett_gtp_proto, NULL, val_to_str_ext_const(GTP_EXT_PROTO_CONF, &gtp_val_ext, "Unknown message"));
6377 proto_tree_add_uint(ext_tree_proto, hf_gtp_length, tvb, offset + 1, 2, length);
6379 if (length < 1)
6380 return 3;
6382 /* The Protocol Configuration Options contains external network protocol options that may be necessary to transfer
6383 * between the GGSN and the MS. The content and the coding of the Protocol Configuration are defined in octet 3-z of the
6384 * Protocol Configuration Options in3GPP TS 24.008 [5].
6386 next_tvb = tvb_new_subset_length(tvb, offset + 3, length);
6387 de_sm_pco(next_tvb, ext_tree_proto, pinfo, 0, length, NULL, 0);
6389 return 3 + length;
6392 /* GPRS: 9.60 v7.6.0, chapter 7.9.23
6393 * UMTS: 29.060 v4.0, chapter 7.7.32
6395 static int
6396 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)
6399 uint8_t addr_type, addr_len;
6400 uint16_t length;
6401 proto_tree *ext_tree_gsn_addr;
6402 proto_item *te;
6403 address *gsn_address;
6405 length = tvb_get_ntohs(tvb, offset + 1);
6407 ext_tree_gsn_addr = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_gsn_addr, &te, "%s : ", tree_name);
6408 gsn_address = wmem_new0(pinfo->pool, address);
6409 switch (length) {
6410 case 4:
6411 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6412 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6413 if (hf_ipv4 != hf_gtp_gsn_ipv4)
6414 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN));
6415 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
6416 set_address_tvb(gsn_address, AT_IPv4, 4, tvb, offset + 3);
6417 break;
6418 case 5:
6419 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_information_element_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6420 addr_type = tvb_get_uint8(tvb, offset + 3) & 0xC0;
6421 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
6422 addr_len = tvb_get_uint8(tvb, offset + 3) & 0x3F;
6423 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
6424 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv4, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
6425 if (hf_ipv4 != hf_gtp_gsn_ipv4)
6426 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, ENC_BIG_ENDIAN));
6427 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 4));
6428 set_address_tvb(gsn_address, AT_IPv6, 16, tvb, offset + 4);
6429 break;
6430 case 16:
6431 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6432 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv6, tvb, offset + 3, 16, ENC_NA);
6433 if (hf_ipv6 != hf_gtp_gsn_ipv6)
6434 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, ENC_NA));
6435 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
6436 set_address_tvb(gsn_address, AT_IPv4, 4, tvb, offset + 3);
6437 break;
6438 case 17:
6439 proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_address_information_element_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6440 addr_type = tvb_get_uint8(tvb, offset + 3) & 0xC0;
6441 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
6442 addr_len = tvb_get_uint8(tvb, offset + 3) & 0x3F;
6443 proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
6444 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 4));
6445 proto_tree_add_item(ext_tree_gsn_addr, hf_ipv6, tvb, offset + 4, 16, ENC_NA);
6446 if (hf_ipv6 != hf_gtp_gsn_ipv6)
6447 proto_item_set_hidden(proto_tree_add_item(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, ENC_NA));
6448 set_address_tvb(gsn_address, AT_IPv6, 16, tvb, offset + 4);
6449 break;
6450 default:
6451 proto_item_append_text(te, "unknown type or wrong length");
6452 break;
6455 if (g_gtp_session && gtp_version == 1 && !PINFO_FD_VISITED(pinfo)) {
6456 if (!ip_exists(*gsn_address, args->ip_list)) {
6457 copy_address_wmem(pinfo->pool, &args->last_ip, gsn_address);
6458 wmem_list_prepend(args->ip_list, gsn_address);
6461 return 3 + length;
6464 static int
6465 decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args) {
6466 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args, "GSN address", hf_gtp_gsn_ipv4, hf_gtp_gsn_ipv6);
6469 static int
6470 decode_gtp_sgsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6472 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6473 "SGSN Address for control plane", hf_gtp_sgsn_address_for_control_plane_ipv4, hf_gtp_sgsn_address_for_control_plane_ipv6);
6476 static int
6477 decode_gtp_sgsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6479 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6480 "SGSN Address for user traffic", hf_gtp_sgsn_address_for_user_traffic_ipv4, hf_gtp_sgsn_address_for_user_traffic_ipv6);
6483 static int
6484 decode_gtp_ggsn_addr_for_control_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6486 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6487 "GGSN Address for control plane", hf_gtp_ggsn_address_for_control_plane_ipv4, hf_gtp_ggsn_address_for_control_plane_ipv6);
6490 static int
6491 decode_gtp_ggsn_addr_for_user_plane(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
6493 return decode_gtp_gsn_addr_common(tvb, offset, pinfo, tree, args,
6494 "GGSN Address for user traffic", hf_gtp_ggsn_address_for_user_traffic_ipv4, hf_gtp_ggsn_address_for_user_traffic_ipv6);
6497 /* GPRS: 9.60 v7.6.0, chapter 7.9.24
6498 * UMTS: 29.060 v4.0, chapter 7.7.33
6500 static int
6501 decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6503 uint16_t length;
6504 tvbuff_t *next_tvb;
6505 proto_tree *ext_tree_proto;
6507 length = tvb_get_ntohs(tvb, offset + 1);
6509 ext_tree_proto = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_proto, NULL,
6510 val_to_str_ext_const(GTP_EXT_MSISDN, &gtp_val_ext, "Unknown message"));
6512 proto_tree_add_uint(ext_tree_proto, hf_gtp_length, tvb, offset + 1, 2, length);
6514 length = tvb_get_ntohs(tvb, offset + 1);
6516 if (length < 1)
6517 return 3;
6519 next_tvb = tvb_new_subset_length(tvb, offset+3, length);
6520 dissect_gsm_map_msisdn(next_tvb, pinfo, ext_tree_proto);
6522 return 3 + length;
6525 /* GPRS: not present
6526 * UMTS: 29.060 v4.0, chapter 7.7.34
6527 * 24.008 v4.2, chapter 10.5.6.5
6529 static int
6530 decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6533 return decode_qos_umts(tvb, offset, pinfo, tree, "Quality of Service", 2);
6536 /* GPRS: not present
6537 * UMTS: 29.060 v4.0, chapter 7.7.35
6539 static int
6540 decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6543 proto_tree *ext_tree;
6544 uint16_t length;
6545 uint8_t xres_len, auth_len;
6548 length = tvb_get_ntohs(tvb, offset + 1);
6550 ext_tree = proto_tree_add_subtree(tree, tvb, offset, length + 1, ett_gtp_quint, NULL, "Quintuplet");
6551 offset++;
6553 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6554 offset = offset + 2;
6556 proto_tree_add_item(ext_tree, hf_gtp_rand, tvb, offset, 16, ENC_NA);
6557 offset = offset + 16;
6558 xres_len = tvb_get_uint8(tvb, offset);
6559 proto_tree_add_item(ext_tree, hf_gtp_xres_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6560 offset++;
6561 proto_tree_add_item(ext_tree, hf_gtp_xres, tvb, offset, xres_len, ENC_NA);
6562 offset = offset + xres_len;
6563 proto_tree_add_item(ext_tree, hf_gtp_quintuplet_ciphering_key, tvb, offset, 16, ENC_NA);
6564 offset = offset + 16;
6565 proto_tree_add_item(ext_tree, hf_gtp_quintuplet_integrity_key, tvb, offset, 16, ENC_NA);
6566 offset = offset + 16;
6567 auth_len = tvb_get_uint8(tvb, offset);
6568 proto_tree_add_item(ext_tree, hf_gtp_authentication_length, tvb, offset, 1, ENC_BIG_ENDIAN);
6569 offset++;
6570 proto_tree_add_item(ext_tree, hf_gtp_auth, tvb, offset, auth_len, ENC_NA);
6572 return (3 + length);
6576 /* GPRS: not present
6577 * UMTS: 29.060 v4.0, chapter 7.7.36
6578 * 24.008 v4.2, chapter 10.5.6.12
6580 static int
6581 decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6583 proto_tree *ext_tree_tft;
6584 unsigned length;
6586 length = tvb_get_ntohs(tvb, offset + 1);
6588 ext_tree_tft = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_tft, NULL, "Traffic flow template");
6589 proto_tree_add_item(ext_tree_tft, hf_gtp_tft_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6591 /* The detailed coding of Traffic Flow Template
6592 * Description is specified in 3GPP TS 24.008 [5] ,
6593 * clause 10.5.6.12, beginning with octet 3..
6594 * Use the decoding in packet-gsm_a_gm.c
6596 de_sm_tflow_temp(tvb, ext_tree_tft, pinfo, offset + 3, length, NULL, 0);
6598 return 3 + length;
6601 /* GPRS: not present
6602 * UMTS: 3GPP TS 29.060 version 10.4.0 Release 10, chapter 7.7.37
6603 * Type = 138 (Decimal)
6604 * 25.413(RANAP) TargetID
6605 * There are several CRs to this IE make sure to check with a recent spec if dissection is questioned.
6607 static int
6608 decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6611 uint16_t length;
6612 proto_tree *ext_tree;
6615 length = tvb_get_ntohs(tvb, offset + 1);
6617 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_TARGET_ID], NULL, "Target Identification");
6618 offset = offset + 1;
6619 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6620 offset = offset + 2;
6621 if (length == 0){
6622 return 3 + length;
6625 /* Quote from specification:
6626 * The Target Identification information element contains the identification of a target RNC. Octets 4-n shall contain a
6627 * non-transparent copy of the corresponding IEs (see subclause 7.7.2) and be encoded as specified in Figure 51 below.
6628 * The "Target RNC-ID" part of the "Target ID" parameter is specified in 3GPP TS 25.413 [7].
6629 * NOTE 1: The ASN.1 parameter "Target ID" is forwarded non-transparently in order to maintain backward compatibility.
6630 * NOTE 2: The preamble of the "Target RNC-ID" (numerical value of e.g. 0x20) however shall not be included in
6631 * octets 4-n. Also the optional "iE-Extensions" parameter shall not be included into the GTP IE.
6633 /* Octet 4-6 MCC + MNC */
6634 if (length == 9) {
6635 /* Patch for systems still not following NOTE 2 */
6636 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.");
6637 offset+=1;
6638 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, false);
6639 } else {
6640 /* Following Standards */
6641 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
6643 offset+=3;
6645 /* Octet 7-8 LAC */
6646 proto_tree_add_item(ext_tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
6647 offset+=2;
6648 /* Octet 9 RAC */
6649 proto_tree_add_item(ext_tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
6650 offset++;
6651 /* Octet 10-11 RNC-ID*/
6652 proto_tree_add_item(ext_tree, hf_gtp_target_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
6653 offset+=2;
6654 /* If the optional Extended RNC-ID is not included, then the length variable 'n' = 8 and the overall length of the IE is 11
6655 * octets. Otherwise, 'n' = 10 and the overall length of the IE is 13 octets
6657 if(length == 10){
6658 proto_tree_add_item(ext_tree, hf_gtp_target_ext_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
6661 return 3 + length;
6665 /* GPRS: not present
6666 * UMTS: 29.060 v4.0, chapter 7.7.38
6668 static int
6669 decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6672 uint16_t length;
6673 proto_tree *ext_tree;
6674 tvbuff_t *new_tvb;
6675 proto_tree *sub_tree;
6677 length = tvb_get_ntohs(tvb, offset + 1);
6679 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UTRAN_CONT], NULL, "UTRAN transparent Container");
6681 offset = offset + 1;
6682 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6683 offset = offset + 2;
6684 proto_tree_add_item(ext_tree, hf_gtp_utran_field, tvb, offset, length, ENC_NA);
6685 if (length == 0) {
6686 return 3;
6689 switch (pinfo->link_dir) {
6690 case P2P_DIR_UL:
6691 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_utran_cont, NULL, "Source RNC to Target RNC Transparent Container");
6692 new_tvb = tvb_new_subset_length(tvb, offset, length);
6693 dissect_ranap_SourceRNC_ToTargetRNC_TransparentContainer_PDU(new_tvb, pinfo, sub_tree, NULL);
6694 break;
6695 case P2P_DIR_DL:
6696 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_utran_cont, NULL, "Target RNC to Source RNC Transparent Container");
6697 new_tvb = tvb_new_subset_length(tvb, offset, length);
6698 dissect_ranap_TargetRNC_ToSourceRNC_TransparentContainer_PDU(new_tvb, pinfo, sub_tree, NULL);
6699 break;
6700 default:
6701 break;
6704 return 3 + length;
6709 /* GPRS: not present
6710 * UMTS: 29.060 v4.0, chapter 7.7.39
6712 static int
6713 decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6716 uint32_t teid;
6717 uint16_t length;
6718 proto_tree *ext_tree_rab_setup;
6720 length = tvb_get_ntohs(tvb, offset + 1);
6722 ext_tree_rab_setup = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_rab_setup, NULL, "Radio Access Bearer Setup Information");
6724 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rab_setup_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
6725 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
6727 if (length > 1) {
6729 teid = tvb_get_ntohl(tvb, offset + 4);
6731 proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
6733 switch (length) {
6734 case 9:
6735 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
6736 break;
6737 case 21:
6738 proto_tree_add_item(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, ENC_NA);
6739 break;
6740 default:
6741 break;
6745 return 3 + length;
6749 /* GPRS: not present
6750 * UMTS: 29.060 v4.0, chapter 7.7.40
6752 static int
6753 decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6756 int i;
6757 uint8_t length, hdr;
6758 proto_tree *ext_tree_hdr_list;
6760 length = tvb_get_uint8(tvb, offset + 1);
6762 ext_tree_hdr_list = proto_tree_add_subtree(tree, tvb, offset, 2 + length, ett_gtp_hdr_list, NULL,
6763 val_to_str_ext_const(GTP_EXT_HDR_LIST, &gtp_val_ext, "Unknown"));
6765 proto_tree_add_item(ext_tree_hdr_list, hf_gtp_num_ext_hdr_types, tvb, offset + 1, 1, ENC_NA);
6767 for (i = 0; i < length; i++) {
6768 hdr = tvb_get_uint8(tvb, offset + 2 + i);
6770 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,
6771 val_to_str_const(hdr, next_extension_header_fieldvals, "Unknown Extension Header Type"), hdr);
6774 return 2 + length;
6777 /* GPRS: not present
6778 * UMTS: 29.060 v4.0, chapter 7.7.41
6779 * TODO: find TriggerID description
6781 static int
6782 decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6784 uint16_t length;
6785 proto_item* ti;
6787 length = tvb_get_ntohs(tvb, offset + 1);
6789 ti = proto_tree_add_uint_format(tree, hf_gtp_ext_length, tvb, offset, 2, length, "%s length : %u",
6790 val_to_str_ext_const(GTP_EXT_TRIGGER_ID, &gtp_val_ext, "Unknown"), length);
6791 proto_item_set_len(ti, 3 + length);
6793 return 3 + length;
6797 /* GPRS: not present
6798 * UMTS: 29.060 v4.0, chapter 7.7.42
6799 * TODO: find OMC-ID description
6801 static int
6802 decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6804 uint16_t length;
6805 proto_item* ti;
6807 length = tvb_get_ntohs(tvb, offset + 1);
6809 ti = proto_tree_add_uint_format(tree, hf_gtp_ext_length, tvb, offset, 2, length, "%s length : %u",
6810 val_to_str_ext_const(GTP_EXT_OMC_ID, &gtp_val_ext, "Unknown"), length);
6811 proto_item_set_len(ti, 3 + length);
6813 return 3 + length;
6817 /* GPRS: 9.60 v7.6.0, chapter 7.9.25
6818 * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
6820 static int
6821 decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6824 uint16_t length;
6825 proto_tree *ext_tree_chrg_addr;
6826 proto_item *te;
6828 length = tvb_get_ntohs(tvb, offset + 1);
6830 ext_tree_chrg_addr = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CHRG_ADDR], &te,
6831 "%s : ", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"));
6833 proto_tree_add_uint_format(ext_tree_chrg_addr, hf_gtp_ext_length, tvb, offset + 1, 2, length,
6834 "%s length : %u", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"), length);
6836 switch (length) {
6837 case 4:
6838 proto_tree_add_item(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
6839 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
6840 break;
6841 case 16:
6842 proto_tree_add_item(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, ENC_NA);
6843 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
6844 break;
6845 default:
6846 proto_item_append_text(te, "unknown type or wrong length");
6847 break;
6850 return 3 + length;
6853 /* GPRS: ?
6854 * UMTS: 29.060 V9.4.0, chapter 7.7.43 RAN Transparent Container
6855 * The information in the value part of the RAN Transparent Container IE contains all information elements (starting with
6856 * and including the BSSGP "PDU Type") in either of the RAN INFORMATION, RAN INFORMATION REQUEST,
6857 * RAN INFORMATION ACK or RAN INFORMATION ERROR messages respectively as specified in 3GPP TS 48.018
6859 static int
6860 decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6863 uint16_t length;
6864 proto_tree *ext_tree;
6865 tvbuff_t *next_tvb;
6867 length = tvb_get_ntohs(tvb, offset + 1);
6868 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RAN_TR_CONT], NULL,
6869 "%s : ", val_to_str_ext_const(GTP_EXT_RAN_TR_CONT, &gtp_val_ext, "Unknown"));
6871 offset++;
6872 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6873 offset = offset + 2;
6875 next_tvb = tvb_new_subset_length(tvb, offset, length);
6876 if (bssgp_handle) {
6877 #if 0
6878 col_set_fence(pinfo->cinfo, COL_INFO);
6879 #endif
6880 call_dissector(bssgp_handle, next_tvb, pinfo, ext_tree);
6883 return 3 + length;
6887 /* GPRS: ?
6888 * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
6890 static int
6891 decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
6894 uint16_t length;
6895 proto_tree *ext_tree;
6897 length = tvb_get_ntohs(tvb, offset + 1);
6898 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PDP_CONT_PRIO], NULL,
6899 "%s : ", val_to_str_ext_const(GTP_EXT_PDP_CONT_PRIO, &gtp_val_ext, "Unknown"));
6901 if (length == 0) {
6902 return 3;
6905 offset++;
6906 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6907 offset = offset + 2;
6908 /* TODO add decoding of data */
6909 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
6911 return 3 + length;
6915 /* GPRS: ?
6916 * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
6918 static int
6919 decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6922 uint16_t length;
6923 proto_tree *ext_tree;
6925 length = tvb_get_ntohs(tvb, offset + 1);
6926 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_RAB_SETUP_INF], NULL,
6927 "%s : ", val_to_str_ext_const(GTP_EXT_ADD_RAB_SETUP_INF, &gtp_val_ext, "Unknown"));
6929 offset++;
6930 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6931 offset = offset + 2;
6933 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
6934 if (length == 1)
6935 return 3 + length;
6937 offset++;
6938 proto_tree_add_item(ext_tree, hf_gtp_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
6939 offset += 4;
6941 if (length == 9) {
6942 /* RNC IP address IPv4*/
6943 proto_tree_add_item(ext_tree, hf_gtp_rnc_ip_addr_v4, tvb, offset, 4, ENC_BIG_ENDIAN);
6944 } else {
6945 /* RNC IP address IPv6*/
6946 proto_tree_add_item(ext_tree, hf_gtp_rnc_ip_addr_v6, tvb, offset, 16, ENC_NA);
6950 return 3 + length;
6955 /* GPRS: ?
6956 * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
6958 static int
6959 decode_gtp_sgsn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6962 uint16_t length;
6963 proto_tree *ext_tree;
6964 tvbuff_t *new_tvb;
6966 length = tvb_get_ntohs(tvb, offset + 1);
6967 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SGSN_NO], NULL,
6968 "%s", val_to_str_ext_const(GTP_EXT_SGSN_NO, &gtp_val_ext, "Unknown"));
6969 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
6971 offset++;
6972 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6973 offset = offset + 2;
6975 new_tvb = tvb_new_subset_length(tvb, offset, length);
6976 dissect_gsm_map_msisdn(new_tvb, pinfo, ext_tree);
6978 return 3 + length;
6982 /* GPRS: ?
6983 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
6985 static int
6986 decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
6989 uint16_t length;
6990 proto_tree *ext_tree;
6992 length = tvb_get_ntohs(tvb, offset + 1);
6993 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_COMMON_FLGS], NULL,
6994 "%s : ", val_to_str_ext_const(GTP_EXT_COMMON_FLGS, &gtp_val_ext, "Unknown"));
6996 offset++;
6997 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
6998 offset = offset + 2;
6999 /* Dual Address Bearer Flag */
7000 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_dual_addr_bearer_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
7001 /* Upgrade QoS Supported */
7002 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, ENC_BIG_ENDIAN);
7003 /* NRSN bit field */
7004 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, ENC_BIG_ENDIAN);
7005 /* No QoS negotiation */
7006 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, ENC_BIG_ENDIAN);
7007 /* MBMS Counting Information bi */
7008 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, ENC_BIG_ENDIAN);
7009 /* RAN Procedures Ready */
7010 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, ENC_BIG_ENDIAN);
7011 /* MBMS Service Type */
7012 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, ENC_BIG_ENDIAN);
7013 /* Prohibit Payload Compression */
7014 proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, ENC_BIG_ENDIAN);
7016 return 3 + length;
7020 /* GPRS: ?
7021 * UMTS: 29.060 v6.11.0, chapter 7.7.49
7023 static int
7024 decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7027 uint16_t length;
7028 proto_tree *ext_tree_apn_res;
7030 length = tvb_get_ntohs(tvb, offset + 1);
7031 ext_tree_apn_res = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_APN_RES], NULL,
7032 "%s : ", val_to_str_ext_const(GTP_EXT_APN_RES, &gtp_val_ext, "Unknown"));
7034 offset++;
7035 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7036 offset = offset + 2;
7038 /* Restriction Type value */
7039 if (length != 1) {
7040 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_ext_length_mal, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
7041 return 3 + length;
7044 proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, ENC_BIG_ENDIAN);
7045 return 3 + length;
7048 /* GPRS: ?
7049 * UMTS: 29.060 v6.11.0, chapter 7.7.50 RAT Type
7050 * RAT Type
7051 * Type = 151 (Decimal)
7054 static int
7055 decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7058 uint16_t length;
7059 proto_tree *ext_tree_rat_type;
7060 proto_item *te;
7062 length = tvb_get_ntohs(tvb, offset + 1);
7063 ext_tree_rat_type = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RAT_TYPE], &te,
7064 val_to_str_ext_const(GTP_EXT_RAT_TYPE, &gtp_val_ext, "Unknown"));
7066 offset++;
7067 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7068 offset = offset + 2;
7070 /* RAT Type value */
7071 if (length != 1) {
7072 proto_tree_add_expert_format(tree, pinfo, &ei_gtp_ext_length_mal, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
7073 return 3 + length;
7076 proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, ENC_BIG_ENDIAN);
7077 proto_item_append_text(te, ": %s", val_to_str_const(tvb_get_uint8(tvb,offset), gtp_ext_rat_type_vals, "Unknown"));
7079 return 3 + length;
7083 * 7.7.51 User Location Information
7086 void
7087 dissect_gtp_uli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7089 uint8_t geo_loc_type;
7090 proto_item* ti;
7092 /* Geographic Location Type */
7093 geo_loc_type = tvb_get_uint8(tvb, offset);
7094 ti = proto_tree_add_uint(tree, hf_gtp_uli_geo_loc_type, tvb, offset, 1, geo_loc_type);
7096 offset++;
7098 switch(geo_loc_type) {
7099 case 0:
7100 /* Geographic Location field included and it holds the Cell Global
7101 * Identification (CGI) of where the user currently is registered.
7102 * CGI is defined in sub-clause 4.3.1 of 3GPP TS 23.003 [2].
7104 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_CGI, true);
7105 offset+=3;
7106 proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7107 offset+=2;
7108 /* The CI is of fixed length with 2 octets and it can be coded using a full hexadecimal representation */
7109 proto_tree_add_item(tree, hf_gtp_cgi_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
7110 break;
7111 case 1:
7112 /* Geographic Location field included and it holds the Service
7113 * Area Identity (SAI) of where the user currently is registered.
7114 * SAI is defined in sub-clause 9.2.3.9 of 3GPP TS 25.413 [7].
7116 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_SAI, true);
7117 offset+=3;
7118 proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7119 offset+=2;
7120 proto_tree_add_item(tree, hf_gtp_sai_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
7121 break;
7122 case 2:
7123 /* Geographic Location field included and it holds the Routing
7124 * Area Identification (RAI) of where the user currently is
7125 * registered. RAI is defined in sub-clause 4.2 of 3GPP TS 23.003
7126 * [2].
7128 * The routing area code consists of 2 octets and is found in octet
7129 * 10 and octet 11. Only the first octet (10) contains the RAC and
7130 * the second octet (11) is coded as "11111111".
7132 dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_RAI, true);
7133 offset+=3;
7134 proto_tree_add_item(tree, hf_gtp_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
7135 offset+=2;
7136 proto_tree_add_item(tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
7137 break;
7138 default:
7139 expert_add_info(pinfo, ti, &ei_gtp_ext_geo_loc_type);
7140 break;
7144 static int
7145 decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7148 uint16_t length;
7149 proto_tree *ext_tree;
7151 length = tvb_get_ntohs(tvb, offset + 1);
7152 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_USR_LOC_INF], NULL,
7153 val_to_str_ext_const(GTP_EXT_USR_LOC_INF, &gtp_val_ext, "Unknown"));
7155 offset++;
7156 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7157 offset = offset + 2;
7159 dissect_gtp_uli(tvb, offset, pinfo, ext_tree, args);
7161 return 3 + length;
7164 static const value_string daylight_saving_time_vals[] = {
7165 {0, "No adjustment"},
7166 {1, "+1 hour adjustment for Daylight Saving Time"},
7167 {2, "+2 hours adjustment for Daylight Saving Time"},
7168 {3, "Reserved"},
7169 {0, NULL}
7172 /* GPRS: ?
7173 * UMTS: 29.060 v6.11.0, chapter 7.7.52
7174 * MS Time Zone
7175 * Type = 153 (Decimal)
7176 * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
7177 * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
7178 * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
7179 * its value shall be set as defined in 3GPP TS 22.042
7181 static int
7182 decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7185 uint16_t length;
7186 proto_tree *ext_tree;
7187 proto_item *te;
7188 uint8_t data;
7189 char sign;
7191 length = tvb_get_ntohs(tvb, offset + 1);
7192 ext_tree = proto_tree_add_subtree_format(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MS_TIME_ZONE], &te,
7193 "%s: ", val_to_str_ext_const(GTP_EXT_MS_TIME_ZONE, &gtp_val_ext, "Unknown"));
7195 offset++;
7196 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7197 offset = offset + 2;
7199 /* 3GPP TS 23.040 version 6.6.0 Release 6
7200 * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
7202 * The Time Zone indicates the difference, expressed in quarters of an hour,
7203 * between the local time and GMT. In the first of the two semi-octets,
7204 * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
7205 * represents the algebraic sign of this difference (0: positive, 1: negative).
7208 data = tvb_get_uint8(tvb, offset);
7209 sign = (data & 0x08) ? '-' : '+';
7210 data = (data >> 4) + (data & 0x07) * 10;
7212 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);
7213 proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
7214 offset++;
7216 proto_tree_add_item(ext_tree, hf_gtp_timezone_dst, tvb, offset, 1, ENC_NA);
7218 return 3 + length;
7222 /* GPRS: ?
7223 * UMTS: 29.060 v6.11.0, chapter 7.7.53
7224 * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
7225 * Type = 154 (Decimal)
7227 static int
7228 decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7231 uint16_t length;
7232 proto_tree *ext_imeisv;
7233 proto_item *te;
7234 tvbuff_t *next_tvb;
7235 char *digit_str;
7237 length = tvb_get_ntohs(tvb, offset + 1);
7238 ext_imeisv = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_IMEISV], &te,
7239 val_to_str_ext_const(GTP_EXT_IMEISV, &gtp_val_ext, "Unknown"));
7241 offset++;
7242 proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7243 offset = offset + 2;
7245 /* IMEI(SV)
7246 * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
7247 * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
7248 * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
7249 * set to '1111'. Both IMEI and IMEISV are BCD encoded.
7251 next_tvb = tvb_new_subset_length(tvb, offset, length);
7252 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);
7253 proto_item_append_text(te, ": %s", digit_str);
7255 return 3 + length;
7258 /* GPRS: ?
7259 * UMTS: 29.060 v6.11.0, chapter 7.7.54
7260 * CAMEL Charging Information Container
7261 * Type = 155 (Decimal)
7263 static int
7264 decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7267 uint16_t length;
7268 proto_tree *ext_tree;
7270 length = tvb_get_ntohs(tvb, offset + 1);
7271 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CAMEL_CHG_INF_CON], NULL,
7272 val_to_str_ext_const(GTP_EXT_CAMEL_CHG_INF_CON, &gtp_val_ext, "Unknown"));
7274 offset++;
7275 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7276 offset = offset + 2;
7277 dissect_gprscdr_CAMELInformationPDP_PDU(tvb_new_subset_length(tvb, offset, length), pinfo, ext_tree, NULL);
7279 return 3 + length;
7283 /* GPRS: ?
7284 * UMTS: 29.060 v6.11.0, chapter 7.7.55
7285 * MBMS UE Context
7287 static int
7288 decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7291 uint16_t length;
7292 proto_tree *ext_tree;
7293 uint8_t enh_nsapi, trans_id;
7294 uint32_t pdp_type_num, pdp_addr_len, ggsn_addr_len, apn_len;
7296 length = tvb_get_ntohs(tvb, offset + 1);
7297 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_UE_CTX], NULL,
7298 val_to_str_ext_const(GTP_EXT_MBMS_UE_CTX, &gtp_val_ext, "Unknown"));
7300 offset++;
7301 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7302 offset = offset + 2;
7303 proto_tree_add_item(ext_tree, hf_gtp_linked_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7304 offset++;
7305 proto_tree_add_item(ext_tree, hf_gtp_uplink_teid_cp, tvb, offset, 4, ENC_BIG_ENDIAN);
7306 offset += 4;
7307 enh_nsapi = tvb_get_uint8(tvb, offset);
7308 if (enh_nsapi < 128) {
7309 proto_tree_add_uint_format_value(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, enh_nsapi, "Reserved");
7310 } else {
7311 proto_tree_add_item(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7313 offset++;
7314 proto_tree_add_item(ext_tree, hf_gtp_pdp_organization, tvb, offset, 1, ENC_BIG_ENDIAN);
7315 offset++;
7316 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_pdp_type, tvb, offset, 1, ENC_BIG_ENDIAN, &pdp_type_num);
7317 offset++;
7318 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_pdp_address_length, tvb, offset, 1, ENC_BIG_ENDIAN, &pdp_addr_len);
7319 offset++;
7320 if (pdp_addr_len > 0) {
7321 switch (pdp_type_num) {
7322 case 0x21:
7323 proto_tree_add_item(ext_tree, hf_gtp_pdp_address_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
7324 break;
7325 case 0x57:
7326 proto_tree_add_item(ext_tree, hf_gtp_pdp_address_ipv6, tvb, offset, 16, ENC_NA);
7327 break;
7328 default:
7329 break;
7331 offset += pdp_addr_len;
7333 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ggsn_address_length, tvb, offset, 1, ENC_BIG_ENDIAN, &ggsn_addr_len);
7334 offset++;
7336 switch (ggsn_addr_len) {
7337 case 4:
7338 proto_tree_add_item(ext_tree, hf_gtp_ggsn_address_for_control_plane_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
7339 break;
7340 case 16:
7341 proto_tree_add_item(ext_tree, hf_gtp_ggsn_address_for_control_plane_ipv6, tvb, offset, 16, ENC_NA);
7342 break;
7343 default:
7344 /* XXX: Expert info? */
7345 break;
7347 offset += ggsn_addr_len;
7349 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_BIG_ENDIAN, &apn_len);
7350 offset++;
7351 decode_apn(pinfo, tvb, offset, apn_len, ext_tree, NULL);
7352 offset += apn_len;
7354 * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
7355 * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
7356 * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
7357 * MS is stored in the MBMS context IE.
7358 * 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
7359 * octet in this field.
7361 trans_id = tvb_get_uint8(tvb, offset);
7362 proto_tree_add_uint(ext_tree, hf_gtp_transaction_identifier, tvb, offset, 2, trans_id);
7364 return 3 + length;
7368 /* GPRS: ?
7369 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
7370 * Temporary Mobile Group Identity (TMGI)
7371 * The Temporary Mobile Group Identity (TMGI) information element contains
7372 * a TMGI allocated by the BM-SC. It is coded as in the value part defined
7373 * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
7376 static int
7377 decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7380 uint16_t length;
7381 proto_tree *ext_tree, *tmgi_tree;
7382 proto_item *ti;
7383 tvbuff_t *next_tvb;
7385 length = tvb_get_ntohs(tvb, offset + 1);
7386 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_TMGI], NULL,
7387 val_to_str_ext_const(GTP_EXT_TMGI, &gtp_val_ext, "Unknown"));
7389 offset++;
7390 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7391 offset = offset + 2;
7393 ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, ENC_NA);
7395 tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
7396 next_tvb = tvb_new_subset_length(tvb, offset, length);
7397 de_mid(next_tvb, tmgi_tree, pinfo, 0, length, NULL, 0);
7398 return 3 + length;
7402 /* GPRS: ?
7403 * UMTS: 29.060 v6.11.0, chapter 7.7.57
7404 * RIM Routing Address
7406 static int
7407 decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7410 uint16_t length;
7411 proto_tree *ext_tree;
7412 proto_item *pi;
7414 length = tvb_get_ntohs(tvb, offset + 1);
7415 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RIM_RA], NULL,
7416 val_to_str_ext_const(GTP_EXT_RIM_RA, &gtp_val_ext, "Unknown"));
7418 offset++;
7419 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7420 offset = offset + 2;
7421 /* To dissect the Address the Routing Address discriminator must be known */
7423 * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
7425 pi = proto_tree_add_item(ext_tree, hf_gtp_rim_routing_addr, tvb, offset, length, ENC_NA);
7426 if (PINFO_FD_VISITED(pinfo)) {
7427 gtp_private_data_t *gtp_data = gtp_get_private_data(pinfo);
7428 proto_tree *addr_tree = proto_item_add_subtree(pi, ett_gtp_rim_routing_adr);
7430 switch (gtp_data->rim_routing_addr_disc) {
7431 case 0:
7432 de_bssgp_cell_id(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7433 break;
7434 case -1:
7435 case 1:
7436 de_bssgp_rnc_identifier(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7437 break;
7438 case 2:
7439 de_bssgp_enb_id(tvb, addr_tree, pinfo, offset, length, NULL, 0);
7440 break;
7441 default:
7442 break;
7446 return 3 + length;
7450 /* GPRS: ?
7451 * UMTS: 29.060 v6.11.0, chapter 7.7.58
7452 * MBMS Protocol Configuration Options
7454 static int
7455 decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7458 uint16_t length;
7459 proto_tree *ext_tree;
7460 tvbuff_t *next_tvb;
7462 length = tvb_get_ntohs(tvb, offset + 1);
7463 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_PROT_CONF_OPT], NULL,
7464 val_to_str_ext_const(GTP_EXT_MBMS_PROT_CONF_OPT, &gtp_val_ext, "Unknown"));
7466 offset++;
7467 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7468 offset = offset + 2;
7469 /* The MBMS Protocol Configuration Options contains protocol options
7470 * associated with an MBMS context, that may be necessary to transfer
7471 * between the GGSN and the MS. The content and the coding of the MBMS
7472 * Protocol Configuration Options are defined in octets 3-z of the MBMS
7473 * Protocol Configuration Options in 3GPP TS 24.008 [5].
7475 next_tvb = tvb_new_subset_length(tvb, offset, length);
7476 de_sm_mbms_prot_conf_opt(next_tvb, ext_tree, pinfo, 0, length, NULL, 0);
7478 return 3 + length;
7482 /* GPRS: ?
7483 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
7484 * MBMS Session Duration
7486 /* Used for Diameter */
7487 static int
7488 dissect_gtp_mbms_ses_dur(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
7491 int offset = 0;
7493 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
7494 proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, ENC_BIG_ENDIAN);
7496 return 3;
7500 static int
7501 decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7504 uint16_t length;
7505 proto_tree *ext_tree;
7507 length = tvb_get_ntohs(tvb, offset + 1);
7508 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_DUR], NULL,
7509 val_to_str_ext_const(GTP_EXT_MBMS_SES_DUR, &gtp_val_ext, "Unknown"));
7511 offset++;
7512 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7513 offset = offset + 2;
7514 /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
7515 * The MBMS Session Duration information element indicates the estimated
7516 * session duration of the MBMS service data transmission if available.
7517 * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
7518 * in 3GPP TS 29.061 [27], excluding the AVP Header fields
7519 * (as defined in IETF RFC 3588 [36], section 4.1).
7521 /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
7522 * with a length of three octets and indicates the estimated session duration
7523 * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
7524 * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
7525 * for which the maximum allowed value is 18 days. For the whole session duration the seconds
7526 * and days are added together and the maximum session duration is 19 days.
7528 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
7529 proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, ENC_BIG_ENDIAN);
7531 return 3 + length;
7535 /* GPRS: ?
7536 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
7537 * MBMS Service Area
7539 static int
7540 dissect_gtp_3gpp_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) {
7542 int offset = 0;
7543 uint8_t no_of_mbms_sa_codes;
7544 int i;
7546 /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
7547 * The MBMS Service Area information element indicates the area over
7548 * which the Multimedia Broadcast/Multicast Service is to be distributed.
7549 * The payload shall be encoded as per the MBMS-Service-Area AVP defined
7550 * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
7551 * IETF RFC 3588 [36], section 4.1).
7553 /* Number N of MBMS service area codes coded as:
7554 * 1 binary value is '00000000'
7555 * ... ...
7556 * 256 binary value is '11111111'
7558 no_of_mbms_sa_codes = tvb_get_uint8(tvb, offset) + 1;
7559 proto_tree_add_uint(tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
7560 offset++;
7561 /* A consecutive list of N MBMS service area codes
7562 * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
7563 * The length of an MBMS service area code is 2 octets.
7565 for (i = 0; i < no_of_mbms_sa_codes; i++) {
7566 proto_tree_add_item(tree, hf_gtp_mbms_sa_code, tvb, offset, 2, ENC_BIG_ENDIAN);
7567 offset = offset + 2;
7570 return offset;
7573 static int
7574 decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7577 tvbuff_t *next_tvb;
7578 uint16_t length;
7579 proto_tree *ext_tree;
7581 length = tvb_get_ntohs(tvb, offset + 1);
7582 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SA], NULL,
7583 val_to_str_ext_const(GTP_EXT_MBMS_SA, &gtp_val_ext, "Unknown"));
7585 offset++;
7586 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7587 offset = offset + 2;
7588 next_tvb = tvb_new_subset_length(tvb, offset, length-3);
7589 dissect_gtp_3gpp_mbms_service_area(next_tvb, pinfo, ext_tree, NULL);
7591 return 3 + length;
7595 /* GPRS: ?
7596 * UMTS: 29.060 v6.11.0, chapter 7.7.61
7597 * Source RNC PDCP context info
7599 static int
7600 decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7603 uint16_t length;
7604 proto_tree *ext_tree, *sub_tree;
7606 length = tvb_get_ntohs(tvb, offset + 1);
7607 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SRC_RNC_PDP_CTX_INF], NULL,
7608 val_to_str_ext_const(GTP_EXT_SRC_RNC_PDP_CTX_INF, &gtp_val_ext, "Unknown"));
7610 offset++;
7611 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7612 offset = offset + 2;
7614 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_rrc_cont, NULL, "Source RNC to Target RNC Transparent Container");
7615 dissect_rrc_ToTargetRNC_Container_PDU(tvb, pinfo, sub_tree, NULL);
7617 return 3 + length;
7620 /* GPRS: ?
7621 * UMTS: 29.060 v6.11.0, chapter 7.7.62
7622 * Additional Trace Info
7625 static const value_string gtp_trace_depth_vals[] = {
7626 { 0, "minimum" },
7627 { 1, "medium" },
7628 { 2, "maximum" },
7629 { 3, "minimumWithoutVendorSpecificExtension" },
7630 { 4, "mediumWithoutVendorSpecificExtension" },
7631 { 5, "maximumWithoutVendorSpecificExtension" },
7632 { 0, NULL }
7635 static const value_string gtp_trace_activity_control_vals[] = {
7636 { 0, "Trace Deactivation"},
7637 { 1, "Trace Activation"},
7638 { 0, NULL}
7641 static int
7642 decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7645 uint16_t length;
7646 proto_tree *ext_tree;
7648 static int * const trigger_flags[] = {
7649 &hf_gtp_trace_triggers_ggsn_mbms,
7650 &hf_gtp_trace_triggers_ggsn_pdp,
7651 NULL
7654 static int * const loi_flags[] = {
7655 &hf_gtp_trace_loi_ggsn_gmb,
7656 &hf_gtp_trace_loi_ggsn_gi,
7657 &hf_gtp_trace_loi_ggsn_gn,
7658 NULL
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_ADD_TRS_INF], NULL,
7663 val_to_str_ext_const(GTP_EXT_ADD_TRS_INF, &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_trace_ref2, tvb, offset, 3, ENC_BIG_ENDIAN);
7669 offset += 3;
7670 proto_tree_add_item(ext_tree, hf_gtp_trace_rec_session_ref, tvb, offset, 2, ENC_BIG_ENDIAN);
7671 offset += 2;
7672 proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_triggers_ggsn, ett_gtp_trace_triggers_ggsn, trigger_flags, ENC_BIG_ENDIAN);
7673 offset++;
7674 proto_tree_add_item(ext_tree, hf_gtp_trace_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
7675 offset++;
7676 proto_tree_add_bitmask(ext_tree, tvb, offset, hf_gtp_trace_loi_ggsn, ett_gtp_trace_loi_ggsn, loi_flags, ENC_BIG_ENDIAN);
7677 offset++;
7678 proto_tree_add_item(ext_tree, hf_gtp_trace_activity_control, tvb, offset, 1, ENC_BIG_ENDIAN);
7680 return 3 + length;
7684 /* GPRS: ?
7685 * UMTS: 29.060 v6.11.0, chapter 7.7.63
7686 * Hop Counter
7688 static int
7689 decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7692 uint16_t length;
7693 proto_tree *ext_tree;
7695 length = tvb_get_ntohs(tvb, offset + 1);
7696 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_HOP_COUNT], NULL,
7697 val_to_str_ext_const(GTP_EXT_HOP_COUNT, &gtp_val_ext, "Unknown"));
7699 offset++;
7700 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7701 offset = offset + 2;
7702 proto_tree_add_item(ext_tree, hf_gtp_hop_count, tvb, offset, 1, ENC_NA);
7704 return 3 + length;
7708 /* GPRS: ?
7709 * UMTS: 29.060 v6.11.0, chapter 7.7.64
7710 * Selected PLMN ID
7712 static int
7713 decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
7716 uint16_t length;
7717 proto_tree *ext_tree;
7719 length = tvb_get_ntohs(tvb, offset + 1);
7720 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID], NULL,
7721 val_to_str_ext_const(GTP_EXT_SEL_PLMN_ID, &gtp_val_ext, "Unknown"));
7723 offset++;
7724 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7725 offset = offset + 2;
7727 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, false);
7728 return 3 + length;
7732 /* GPRS: ?
7733 * UMTS: 29.060 v6.11.0, chapter 7.7.65
7734 * MBMS Session Identifier
7736 static int
7737 decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7740 uint16_t length;
7741 proto_tree *ext_tree;
7743 length = tvb_get_ntohs(tvb, offset + 1);
7744 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"));
7746 offset++;
7747 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7748 offset = offset + 2;
7749 /* TODO add decoding of data */
7750 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7752 return 3 + length;
7756 /* GPRS: ?
7757 * UMTS: 29.060 v6.11.0, chapter 7.7.66
7758 * MBMS 2G/3G Indicator
7760 static const value_string gtp_mbs_2g_3g_ind_vals[] = {
7761 {0, "2G only"},
7762 {1, "3G only"},
7763 {2, "Both 2G and 3G"},
7764 {0, NULL}
7767 static int
7768 decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7771 uint16_t length;
7772 proto_tree *ext_tree;
7774 length = tvb_get_ntohs(tvb, offset + 1);
7775 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_2G_3G_IND], NULL,
7776 val_to_str_ext_const(GTP_EXT_MBMS_2G_3G_IND, &gtp_val_ext, "Unknown"));
7778 offset++;
7779 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7780 offset = offset + 2;
7781 /* MBMS 2G/3G Indicator */
7782 proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
7784 return 3 + length;
7788 /* GPRS: ?
7789 * UMTS: 29.060 v6.11.0, chapter 7.7.67
7790 * Enhanced NSAPI
7792 static int
7793 decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7796 uint16_t length;
7797 proto_tree *ext_tree;
7798 uint8_t enh_nsapi;
7800 length = tvb_get_ntohs(tvb, offset + 1);
7801 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"));
7803 offset++;
7804 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7805 offset = offset + 2;
7806 enh_nsapi = tvb_get_uint8(tvb, offset);
7807 if (enh_nsapi < 128) {
7808 proto_tree_add_uint_format_value(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, enh_nsapi, "Reserved");
7809 } else {
7810 proto_tree_add_item(ext_tree, hf_gtp_enh_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
7813 return 3 + length;
7817 /* GPRS: ?
7818 * UMTS: 29.060 v6.11.0, chapter 7.7.68
7819 * Additional MBMS Trace Info
7821 static int
7822 decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7825 uint16_t length;
7826 proto_tree *ext_tree;
7828 static int * const trigger_flags[] = {
7829 &hf_gtp_trace_triggers_bm_sc_mbms,
7830 NULL
7833 static int * const loi_flags[] = {
7834 &hf_gtp_trace_loi_bm_sc_gmb,
7835 NULL
7838 length = tvb_get_ntohs(tvb, offset + 1);
7839 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_MBMS_TRS_INF], NULL,
7840 val_to_str_ext_const(GTP_EXT_ADD_MBMS_TRS_INF, &gtpv1_val_ext, "Unknown"));
7842 offset++;
7843 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7844 offset = offset + 2;
7845 /* XXX: There is clearly an error in TS 29.060 V17.1.0 and earlier.
7846 * In Figure 7.7.68.1 the octet column has a gap and is not aligned,
7847 * octets 7-8 should be for the Trace Recording Session Reference, other
7848 * values should be moved up a row, and there should be a value for
7849 * the Trace Activity Control as octet 12, making the IE length 9,
7850 * as with 7.7.62 Additional Trace Info.
7851 * Unfortunately the mistake is carried over into the the length field
7852 * elsewhere in the spec, such as in Table 37.
7854 proto_tree_add_item(ext_tree, hf_gtp_trace_ref2, tvb, offset, 3, ENC_BIG_ENDIAN);
7855 offset += 3;
7856 proto_tree_add_item(ext_tree, hf_gtp_trace_rec_session_ref, tvb, offset, 2, ENC_BIG_ENDIAN);
7857 offset += 2;
7858 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);
7859 offset++;
7860 proto_tree_add_item(ext_tree, hf_gtp_trace_depth, tvb, offset, 1, ENC_BIG_ENDIAN);
7861 offset++;
7862 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);
7863 if(length > 8){
7864 offset++;
7865 proto_tree_add_item(ext_tree, hf_gtp_trace_activity_control, tvb, offset, 1, ENC_BIG_ENDIAN);
7868 return 3 + length;
7872 /* GPRS: ?
7873 * UMTS: 29.060 v6.11.0, chapter 7.7.69
7874 * MBMS Session Identity Repetition Number
7876 static int
7877 decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7880 uint16_t length;
7881 proto_tree *ext_tree;
7883 length = tvb_get_ntohs(tvb, offset + 1);
7884 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_SES_ID_REP_NO], NULL,
7885 val_to_str_ext_const(GTP_EXT_MBMS_SES_ID_REP_NO, &gtpv1_val_ext, "Unknown"));
7887 offset++;
7888 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7889 offset = offset + 2;
7890 /* TODO add decoding of data */
7891 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7893 return 3 + length;
7897 /* GPRS: ?
7898 * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
7899 * MBMS Time To Data Transfer
7901 /* Used for Diameter */
7902 static int
7903 dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
7906 int offset = 0;
7907 uint8_t time_2_dta_tr;
7909 time_2_dta_tr = tvb_get_uint8(tvb, offset) + 1;
7910 proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
7912 return 3;
7916 static int
7917 decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7920 uint16_t length;
7921 proto_tree *ext_tree;
7922 uint8_t time_2_dta_tr;
7924 length = tvb_get_ntohs(tvb, offset + 1);
7925 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_TIME_TO_DATA_TR], NULL,
7926 val_to_str_ext_const(GTP_EXT_MBMS_TIME_TO_DATA_TR, &gtpv1_val_ext, "Unknown"));
7928 offset++;
7929 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7930 offset = offset + 2;
7931 /* TODO add decoding of data
7932 * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
7933 * The MBMS Time To Data Transfer information element contains a
7934 * MBMS Time To Data Transfer allocated by the BM-SC.
7935 * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
7936 * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
7937 * (as defined in IETF RFC 3588 [36], section 4.1).
7939 /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
7940 * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
7941 * Bits
7942 * 8 7 6 5 4 3 2 1
7943 * 0 0 0 0 0 0 0 0 1s
7944 * 0 0 0 0 0 0 0 1 2s
7945 * 0 0 0 0 0 0 1 0 3s
7947 * 1 1 1 1 1 1 1 1 256s
7949 time_2_dta_tr = tvb_get_uint8(tvb, offset) + 1;
7950 proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
7952 return 3 + length;
7956 /* GPRS: ?
7957 * UMTS: 29.060 v6.11.0, chapter 7.7.71
7958 * PS Handover Request Context
7960 static int
7961 decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7964 uint16_t length;
7965 proto_tree *ext_tree;
7967 length = tvb_get_ntohs(tvb, offset + 1);
7968 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PS_HO_REQ_CTX], NULL,
7969 val_to_str_ext_const(GTP_EXT_PS_HO_REQ_CTX, &gtpv1_val_ext, "Unknown"));
7971 offset++;
7972 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7973 offset = offset + 2;
7974 /* TODO add decoding of data */
7975 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
7977 return 3 + length;
7981 /* GPRS: ?
7982 * UMTS: 29.060 v6.11.0, chapter 7.7.72
7983 * BSS Container
7985 static int
7986 decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
7989 uint16_t length;
7990 proto_tree *ext_tree, *sub_tree;
7992 length = tvb_get_ntohs(tvb, offset + 1);
7993 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BSS_CONT], NULL,
7994 val_to_str_ext_const(GTP_EXT_BSS_CONT, &gtpv1_val_ext, "Unknown"));
7996 offset++;
7997 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
7998 offset = offset + 2;
8000 switch (pinfo->link_dir) {
8001 case P2P_DIR_UL:
8002 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_bss_cont, NULL, "Source BSS to Target BSS Transparent Container");
8003 de_bssgp_source_BSS_to_target_BSS_transp_cont(tvb, sub_tree, pinfo, offset, length, NULL, 0);
8004 break;
8005 case P2P_DIR_DL:
8006 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_bss_cont, NULL, "Target BSS to Source BSS Transparent Container");
8007 de_bssgp_target_BSS_to_source_BSS_transp_cont(tvb, sub_tree, pinfo, offset, length, NULL, 0);
8008 break;
8009 default:
8010 break;
8013 * The content of this container is defined in 3GPP TS 48.018
8016 return 3 + length;
8020 /* GPRS: ?
8021 * UMTS: 29.060 v6.11.0, chapter 7.7.73
8022 * Cell Identification
8024 static const value_string gtp_source_type_vals[] = {
8025 { 0, "Source Cell ID"},
8026 { 1, "Source RNC-ID" },
8027 { 0, NULL }
8030 static int
8031 decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8034 uint16_t length;
8035 uint32_t source_type;
8036 proto_tree *ext_tree;
8038 length = tvb_get_ntohs(tvb, offset + 1);
8039 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CELL_ID], NULL,
8040 val_to_str_ext_const(GTP_EXT_CELL_ID, &gtpv1_val_ext, "Unknown"));
8042 offset++;
8043 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8044 offset = offset + 2;
8047 * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
8048 * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
8050 * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
8051 * source RNC (RNC-ID) as defined in 3GPP TS 48.018
8053 * for PS handover from S1 mode, the identification of a target cell (Target Cell ID) as defined in 3GPP TS 48.018.
8054 * Octet 12 shall be set to "Source Cell ID" and octets 13-20 shall be encoded as all zero.
8056 * 3GPP TS 48.018 defines Target and Source Cell ID to use the Cell
8057 * Identifier IE, encoded as 6 octets of the value part of the RAI IE
8058 * followed by 2 octets of the value of the Cell Identity IE, both defined
8059 * in 3GPP TS 24.008. The 3GPP TS 48.018 RNC-ID IE is similar, with the 6
8060 * octet RAI as in 3GPP TS 24.008 followed by two octets of the RNC-ID.
8061 * (Or Extended RNC-ID, but the RNC-ID is presented in network byte order
8062 * with the most significant bits of octet 9 set to "0000", so there is
8063 * no need to distinguish be RNC-ID and Extended RNC-ID.)
8065 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8066 offset += 3;
8067 proto_tree_add_item(ext_tree, hf_gtp_target_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8068 offset += 2;
8069 proto_tree_add_item(ext_tree, hf_gtp_target_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8070 offset += 1;
8071 proto_tree_add_item(ext_tree, hf_gtp_target_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
8072 offset += 2;
8073 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_source_type, tvb, offset, 1, ENC_NA, &source_type);
8074 offset++;
8075 switch (source_type) {
8076 case 0:
8077 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8078 offset += 3;
8079 proto_tree_add_item(ext_tree, hf_gtp_source_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8080 offset += 2;
8081 proto_tree_add_item(ext_tree, hf_gtp_source_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8082 offset += 1;
8083 proto_tree_add_item(ext_tree, hf_gtp_source_ci, tvb, offset, 2, ENC_BIG_ENDIAN);
8084 break;
8085 case 1:
8086 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8087 offset += 3;
8088 proto_tree_add_item(ext_tree, hf_gtp_source_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
8089 offset += 2;
8090 proto_tree_add_item(ext_tree, hf_gtp_source_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
8091 offset += 1;
8092 proto_tree_add_item(ext_tree, hf_gtp_source_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
8093 break;
8094 default:
8095 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_source_type_unknown, tvb, offset-1, 1);
8096 break;
8099 return 3 + length;
8103 /* GPRS: ?
8104 * UMTS: 29.060 v6.11.0, chapter 7.7.74
8105 * PDU Numbers
8107 static int
8108 decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8111 uint16_t length;
8112 proto_tree *ext_tree;
8114 length = tvb_get_ntohs(tvb, offset + 1);
8115 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PDU_NO], NULL,
8116 val_to_str_ext_const(GTP_EXT_PDU_NO, &gtpv1_val_ext, "Unknown"));
8118 offset++;
8119 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8120 offset = offset + 2;
8122 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8123 offset++;
8125 proto_tree_add_item(ext_tree, hf_gtp_sequence_number_down, tvb, offset, 2, ENC_BIG_ENDIAN);
8126 offset += 2;
8127 proto_tree_add_item(ext_tree, hf_gtp_sequence_number_up, tvb, offset, 2, ENC_BIG_ENDIAN);
8128 offset += 2;
8129 /* The Send N-PDU Number is used only when acknowledged peer-to-peer LLC
8130 * operation is used for the PDP context. Send N-PDU Number is the N-PDU
8131 * number to be assigned by SNDCP to the next down link N-PDU received from
8132 * the GGSN.
8134 * The Receive N-PDU Number is used only when acknowledged peer-to-peer LLC
8135 * operation is used for the PDP context. The Receive N-PDU Number is the
8136 * N-PDU number expected by SNDCP from the next up link N-PDU to be
8137 * received from the MS.
8139 * XXX: For some reason, 2 octets are reserved for each the Send and
8140 * Receive N-PDU numbers, even though an N-PDU number in acknowledged
8141 * mode only has values 0-255 (see 3GPP TS 44.065) and is in a one
8142 * octet field in the PDP Context IE (7.7.29). Assume, in the lack
8143 * of other guidance, that the first octet will be zero and the value
8144 * will be in the second octet.
8145 * Cf. 7.7.51 ULI, where there is an explicit note in TS 29.060 that only
8146 * the first octet contains the RAC and the second octet is filler.
8148 proto_tree_add_item(ext_tree, hf_gtp_send_n_pdu_number, tvb, offset, 2, ENC_BIG_ENDIAN);
8149 offset += 2;
8150 proto_tree_add_item(ext_tree, hf_gtp_receive_n_pdu_number, tvb, offset, 2, ENC_BIG_ENDIAN);
8152 return 3 + length;
8156 /* GPRS: ?
8157 * UMTS: 29.060 v6.11.0, chapter 7.7.75
8158 * BSSGP Cause
8160 static int
8161 decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8164 uint16_t length;
8165 proto_tree *ext_tree;
8167 length = tvb_get_ntohs(tvb, offset + 1);
8168 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BSSGP_CAUSE], NULL,
8169 val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, &gtpv1_val_ext, "Unknown"));
8171 offset++;
8172 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8173 offset = offset + 2;
8176 * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
8178 proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
8180 return 3 + length;
8185 * Required MBMS bearer capabilities 7.7.76
8187 static int
8188 decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8190 uint16_t length;
8191 proto_tree *ext_tree;
8193 length = tvb_get_ntohs(tvb, offset + 1);
8194 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_REQ_MBMS_BEARER_CAP], NULL,
8195 val_to_str_ext_const(GTP_EXT_REQ_MBMS_BEARER_CAP, &gtpv1_val_ext, "Unknown"));
8197 offset++;
8198 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8199 #if 0 /* Fix Dead Store Warning */
8200 offset = offset + 2;
8201 #endif
8202 /* The payload shall be encoded as per the
8203 * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
8204 * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
8206 /* TODO Add decoding (call Diameter dissector???) */
8207 return 3 + length;
8211 * RIM Routing Address Discriminator 7.7.77
8214 static const value_string gtp_bssgp_ra_discriminator_vals[] = {
8215 { 0, "A Cell Identifier is used to identify a GERAN cell" },
8216 { 1, "A Global RNC-ID is used to identify a UTRAN RNC" },
8217 { 2, "An eNB identifier is used to identify an E-UTRAN eNodeB or HeNB" },
8218 { 0, NULL }
8221 static int
8222 decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8225 uint16_t length;
8226 proto_tree *ext_tree;
8227 uint32_t val;
8228 gtp_private_data_t *gtp_data = gtp_get_private_data(pinfo);
8230 length = tvb_get_ntohs(tvb, offset + 1);
8231 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RIM_ROUTING_ADDR_DISC], NULL,
8232 val_to_str_ext_const(GTP_EXT_RIM_ROUTING_ADDR_DISC, &gtpv1_val_ext, "Unknown"));
8234 offset++;
8235 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8236 offset = offset + 2;
8237 /* Octet 4 bits 4 - 1 is coded according to 3GPP TS 48.018 [20]
8238 * RIM Routing Information IE octet 3 bits 4 - 1.
8239 * Bits 8 - 5 are coded "0000".
8241 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_bssgp_ra_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN, &val);
8242 gtp_data->rim_routing_addr_disc = (int8_t)val;
8244 return 3 + length;
8248 * List of set-up PFCs 7.7.78
8250 static int
8251 decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8254 uint16_t length;
8255 proto_tree *ext_tree, *sub_tree;
8257 length = tvb_get_ntohs(tvb, offset + 1);
8258 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_LIST_OF_SETUP_PFCS], NULL,
8259 val_to_str_ext_const(GTP_EXT_LIST_OF_SETUP_PFCS, &gtpv1_val_ext, "Unknown"));
8261 offset++;
8262 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8263 offset = offset + 2;
8265 sub_tree = proto_tree_add_subtree(ext_tree, tvb, offset, length, ett_gtp_lst_set_up_pfc, NULL, "List of set-up PFCs");
8266 de_bssgp_list_of_setup_pfcs(tvb, sub_tree, pinfo, offset, length, NULL, 0);
8268 return 3 + length;
8272 * PS Handover XID Parameters 7.7.79
8274 static int
8275 decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8278 uint16_t length;
8279 proto_tree *ext_tree;
8280 tvbuff_t *next_tvb;
8281 uint8_t sapi;
8282 uint8_t xid_par_len;
8284 length = tvb_get_ntohs(tvb, offset + 1);
8285 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_PS_HANDOVER_XIP_PAR], NULL,
8286 val_to_str_ext_const(GTP_EXT_PS_HANDOVER_XIP_PAR, &gtpv1_val_ext, "Unknown"));
8288 offset++;
8289 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8290 offset = offset + 2;
8292 sapi = tvb_get_uint8(tvb, offset) & 0x0F;
8293 proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
8294 offset++;
8296 xid_par_len = tvb_get_uint8(tvb, offset);
8297 proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
8298 offset++;
8300 next_tvb = tvb_new_subset_remaining(tvb, offset);
8301 if (sndcpxid_handle)
8302 call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
8303 else
8304 call_data_dissector(next_tvb, pinfo, tree);
8306 return 4 + length;
8311 * MS Info Change Reporting Action 7.7.80
8313 static int
8314 decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8317 uint16_t length;
8318 proto_tree *ext_tree;
8320 length = tvb_get_ntohs(tvb, offset + 1);
8321 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MS_INF_CHG_REP_ACT], NULL,
8322 val_to_str_ext_const(GTP_EXT_MS_INF_CHG_REP_ACT, &gtpv1_val_ext, "Unknown"));
8324 offset++;
8325 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8326 offset = offset + 2;
8328 proto_tree_add_item(ext_tree, hf_gtp_rep_act_type, tvb, offset, 1, ENC_BIG_ENDIAN);
8330 return 3 + length;
8334 * Direct Tunnel Flags 7.7.81
8336 static int
8337 decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8340 uint16_t length;
8341 proto_tree *ext_tree;
8343 length = tvb_get_ntohs(tvb, offset + 1);
8344 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_DIRECT_TUNNEL_FLGS], NULL,
8345 val_to_str_ext_const(GTP_EXT_DIRECT_TUNNEL_FLGS, &gtpv1_val_ext, "Unknown"));
8347 offset++;
8348 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8349 offset += 2;
8351 proto_tree_add_item(ext_tree, hf_gtp_ext_ei, tvb, offset, 1, ENC_BIG_ENDIAN);
8352 proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8353 proto_tree_add_item(ext_tree, hf_gtp_ext_dti, tvb, offset, 1, ENC_BIG_ENDIAN);
8354 offset++;
8356 if (length == 1) {
8357 return 3 + length;
8359 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8361 return 3 + length;
8365 * Correlation-ID 7.7.82
8367 static int
8368 decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8371 uint16_t length;
8372 proto_tree *ext_tree;
8374 length = tvb_get_ntohs(tvb, offset + 1);
8375 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CORRELATION_ID], NULL,
8376 val_to_str_ext_const(GTP_EXT_CORRELATION_ID, &gtpv1_val_ext, "Unknown"));
8378 offset++;
8379 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8380 offset = offset + 2;
8382 proto_tree_add_item(ext_tree, hf_gtp_correlation_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8384 return 3 + length;
8388 * Bearer Control Mode 7.7.83
8389 * version 10.0.0
8391 static const value_string gtp_pdp_bcm_type_vals[] = {
8392 {0, "MS_only"},
8393 {1, "MS/NW"},
8394 {0, NULL}
8397 static int
8398 decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8401 uint16_t length;
8402 proto_tree *ext_tree;
8404 length = tvb_get_ntohs(tvb, offset + 1);
8405 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_BEARER_CONTROL_MODE], NULL,
8406 val_to_str_ext_const(GTP_EXT_BEARER_CONTROL_MODE, &gtpv1_val_ext, "Unknown"));
8408 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8410 offset++;
8411 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8412 offset = offset + 2;
8414 proto_tree_add_item(ext_tree, hf_gtp_bcm, tvb, offset, 1, ENC_BIG_ENDIAN);
8416 return 3 + length;
8421 * 7.7.84 MBMS Flow Identifier
8423 static int
8424 decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8426 uint16_t length;
8427 proto_tree *ext_tree;
8429 length = tvb_get_ntohs(tvb, offset + 1);
8430 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_FLOW_ID], NULL,
8431 val_to_str_ext_const(GTP_EXT_MBMS_FLOW_ID, &gtpv1_val_ext, "Unknown"));
8432 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8434 offset++;
8435 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8436 offset = offset + 2;
8438 /* 4-n MBMS Flow Identifier */
8439 proto_tree_add_item(ext_tree, hf_gtp_mbms_flow_id, tvb, offset, length, ENC_NA);
8442 return 3 + length;
8446 * 7.7.85 MBMS IP Multicast Distribution
8449 static int
8450 decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8452 uint16_t length;
8453 proto_tree *ext_tree;
8455 length = tvb_get_ntohs(tvb, offset + 1);
8456 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_IP_MCAST_DIST], NULL,
8457 val_to_str_ext_const(GTP_EXT_MBMS_IP_MCAST_DIST, &gtpv1_val_ext, "Unknown"));
8458 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8460 offset++;
8461 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8462 offset = offset + 2;
8464 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8466 return 3 + length;
8470 * 7.7.86 MBMS Distribution Acknowledgement
8472 /* Table 7.7.86.1: Distribution Indication values */
8473 static const value_string gtp_mbms_dist_indic_vals[] = {
8474 {0, "No RNCs have accepted IP multicast distribution"},
8475 {1, "All RNCs have accepted IP multicast distribution"},
8476 {2, "Some RNCs have accepted IP multicast distribution"},
8477 {3, "Spare. For future use."},
8478 {0, NULL}
8480 static int
8481 decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8483 uint16_t length;
8484 proto_tree *ext_tree;
8486 length = tvb_get_ntohs(tvb, offset + 1);
8487 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MBMS_DIST_ACK], NULL,
8488 val_to_str_ext_const(GTP_EXT_MBMS_DIST_ACK, &gtpv1_val_ext, "Unknown"));
8489 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8491 offset++;
8492 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8493 offset = offset + 2;
8495 /* Distribution Indication values */
8496 proto_tree_add_item(ext_tree, hf_gtp_mbms_dist_indic, tvb, offset, 1, ENC_BIG_ENDIAN);
8498 return 3 + length;
8502 * 7.7.87 Reliable INTER RAT HANDOVER INFO
8504 static int
8505 decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8507 uint16_t length;
8508 proto_tree *ext_tree;
8510 length = tvb_get_ntohs(tvb, offset + 1);
8511 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF], NULL,
8512 val_to_str_ext_const(GTP_EXT_RELIABLE_IRAT_HO_INF, &gtpv1_val_ext, "Unknown"));
8513 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8515 offset++;
8516 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8517 offset = offset + 2;
8519 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8521 return 3 + length;
8525 * 7.7.88 RFSP Index
8527 static int
8528 decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8530 uint16_t length;
8531 proto_tree *ext_tree;
8533 length = tvb_get_ntohs(tvb, offset + 1);
8534 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RFSP_INDEX], NULL,
8535 val_to_str_ext_const(GTP_EXT_RFSP_INDEX, &gtpv1_val_ext, "Unknown"));
8536 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8538 offset++;
8539 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8540 offset = offset + 2;
8542 proto_tree_add_item(ext_tree, hf_gtp_rfsp_index, tvb, offset, 2, ENC_BIG_ENDIAN);
8544 return 3 + length;
8547 * 7.7.89 PDP Type
8550 * 7.7.90 Fully Qualified Domain Name (FQDN)
8552 static int
8553 decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8556 uint16_t length;
8557 proto_tree *ext_tree;
8559 length = tvb_get_ntohs(tvb, offset + 1);
8561 ext_tree = proto_tree_add_subtree(tree, tvb, offset, length + 3, ett_gtp_ies[GTP_EXT_FQDN], NULL,
8562 val_to_str_ext_const(GTP_EXT_FQDN, &gtp_val_ext, "Unknown field"));
8563 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8565 proto_tree_add_item(ext_tree, hf_gtp_fqdn_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
8566 decode_fqdn(tvb, offset + 3, length, ext_tree, NULL);
8568 return 3 + length;
8572 * 7.7.91 Evolved Allocation/Retention Priority I
8574 static int
8575 decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8578 uint16_t length;
8579 proto_tree *ext_tree;
8581 length = tvb_get_ntohs(tvb, offset + 1);
8582 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P1], NULL,
8583 val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P1, &gtpv1_val_ext, "Unknown"));
8584 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8586 offset++;
8587 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8588 offset += 2;
8590 proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
8591 proto_tree_add_item(ext_tree, hf_gtp_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
8592 proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
8594 return 3 + length;
8600 * 7.7.92 Evolved Allocation/Retention Priority II
8602 static int
8603 decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8606 uint16_t length;
8607 proto_tree *ext_tree;
8609 length = tvb_get_ntohs(tvb, offset + 1);
8610 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P2], NULL,
8611 val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P2, &gtpv1_val_ext, "Unknown"));
8612 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8614 offset++;
8615 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8616 offset = offset + 2;
8618 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8619 offset++;
8621 proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
8622 proto_tree_add_item(ext_tree, hf_gtp_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
8623 proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
8625 return 3 + length;
8631 * 7.7.93 Extended Common Flags
8633 static int
8634 decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8636 uint16_t length;
8637 proto_tree *ext_tree;
8639 length = tvb_get_ntohs(tvb, offset + 1);
8640 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXTENDED_COMMON_FLGS], NULL,
8641 val_to_str_ext_const(GTP_EXT_EXTENDED_COMMON_FLGS, &gtpv1_val_ext, "Unknown"));
8642 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8644 offset++;
8645 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8646 offset = offset + 2;
8648 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_uasi, tvb, offset, 1, ENC_BIG_ENDIAN);
8649 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_bdwi, tvb, offset, 1, ENC_BIG_ENDIAN);
8650 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_pcri, tvb, offset, 1, ENC_BIG_ENDIAN);
8651 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_vb, tvb, offset, 1, ENC_BIG_ENDIAN);
8652 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_retloc, tvb, offset, 1, ENC_BIG_ENDIAN);
8653 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_cpsr, tvb, offset, 1, ENC_BIG_ENDIAN);
8654 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_ccrsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8655 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_unauthenticated_imsi, tvb, offset, 1, ENC_BIG_ENDIAN);
8656 offset++;
8658 if(length > 1){
8659 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length-1);
8662 return 3 + length;
8666 * 7.7.94 User CSG Information (UCI)
8669 static const value_string gtp_access_mode_vals[] = {
8670 { 0, "Closed Mode" },
8671 { 1, "Hybrid Mode" },
8672 { 2, "Reserved" },
8673 { 3, "Reserved" },
8674 { 0, NULL }
8677 static int
8678 decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8680 uint16_t length;
8681 proto_tree *ext_tree;
8683 length = tvb_get_ntohs(tvb, offset + 1);
8684 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UCI], NULL,
8685 val_to_str_ext_const(GTP_EXT_UCI, &gtpv1_val_ext, "Unknown"));
8686 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8688 offset++;
8689 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8690 offset = offset + 2;
8692 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
8693 offset += 3;
8694 proto_tree_add_item(ext_tree, hf_gtp_csg_id, tvb, offset, 4, ENC_BIG_ENDIAN);
8695 offset += 4;
8697 proto_tree_add_item(ext_tree, hf_gtp_access_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
8698 /* Due to a specification oversight, the CMI values ... are reversed from
8699 * the values of the CSG-Membership-Indication AVP in 3GPP TS 32.299 [56].
8700 * Therefore, when CMI values are sent over the charging interface, the
8701 * values are encoded as specified in 3GPP TS 32.299 [56]. Furthermore,
8702 * the encoding is different between GTPv1 and GTPv2.
8704 proto_tree_add_item(ext_tree, hf_gtp_cmi, tvb, offset, 1, ENC_BIG_ENDIAN);
8706 return 3 + length;
8710 * 7.7.95 CSG Information Reporting Action
8713 static int
8714 decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8716 uint16_t length;
8717 proto_tree *ext_tree;
8719 static int * const flags[] = {
8720 &hf_gtp_csg_inf_rep_act_uciuhc,
8721 &hf_gtp_csg_inf_rep_act_ucishc,
8722 &hf_gtp_csg_inf_rep_act_ucicsg,
8723 NULL
8726 length = tvb_get_ntohs(tvb, offset + 1);
8727 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CSG_INF_REP_ACT], NULL,
8728 val_to_str_ext_const(GTP_EXT_CSG_INF_REP_ACT, &gtpv1_val_ext, "Unknown"));
8729 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8731 offset++;
8732 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8733 offset = offset + 2;
8735 proto_tree_add_bitmask_list(ext_tree, tvb, offset, 1, flags, ENC_BIG_ENDIAN);
8737 return 3 + length;
8740 * 7.7.96 CSG ID
8743 static int
8744 decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8746 uint16_t length;
8747 proto_tree *ext_tree;
8749 length = tvb_get_ntohs(tvb, offset + 1);
8750 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CSG_ID], NULL,
8751 val_to_str_ext_const(GTP_EXT_CSG_ID, &gtpv1_val_ext, "Unknown"));
8752 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8754 offset++;
8755 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8756 offset = offset + 2;
8758 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
8760 return 3 + length;
8763 * 7.7.97 CSG Membership Indication (CMI)
8765 static int
8766 decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8768 uint16_t length;
8769 proto_tree *ext_tree;
8771 length = tvb_get_ntohs(tvb, offset + 1);
8772 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CMI], NULL,
8773 val_to_str_ext_const(GTP_EXT_CMI, &gtpv1_val_ext, "Unknown"));
8774 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8776 offset++;
8777 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8778 offset = offset + 2;
8780 /* Due to a specification oversight, the CMI values ... are reversed from
8781 * the values of the CSG-Membership-Indication AVP in 3GPP TS 32.299 [56].
8782 * Therefore, when CMI values are sent over the charging interface, the
8783 * values are encoded as specified in 3GPP TS 32.299 [56].
8785 proto_tree_add_item(ext_tree, hf_gtp_cmi, tvb, offset, 1, ENC_BIG_ENDIAN);
8787 return 3 + length;
8790 * 7.7.98 APN Aggregate Maximum Bit Rate (APN-AMBR)
8792 static int
8793 decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8795 uint16_t length;
8796 proto_tree *ext_tree;
8798 length = tvb_get_ntohs(tvb, offset + 1);
8799 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF], NULL,
8800 val_to_str_ext_const(GTP_EXT_AMBR, &gtpv1_val_ext, "Unknown"));
8801 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8803 offset++;
8804 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8805 offset = offset + 2;
8807 /* APN Aggregate Maximum Bit Rate (APN-AMBR) is defined in clause 9.9.4.2 of 3GPP TS 24.301 [42], but shall be
8808 * formatted as shown in Figure 7.7.98-1 as Unsigned32 binary integer values in kbps (1000 bits per second).
8810 /* 4 to 7 APN-AMBR for Uplink */
8811 proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8812 offset+=4;
8813 /* 8 to 11 APN-AMBR for Downlink */
8814 proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8816 return 3 + length;
8819 * 7.7.99 UE Network Capability
8821 static int
8822 decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
8824 uint16_t length;
8825 proto_tree *ext_tree;
8827 length = tvb_get_ntohs(tvb, offset + 1);
8828 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_NETWORK_CAP], NULL,
8829 val_to_str_ext_const(GTP_EXT_UE_NETWORK_CAP, &gtpv1_val_ext, "Unknown"));
8831 offset++;
8832 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8833 offset = offset + 2;
8835 de_emm_ue_net_cap(tvb, ext_tree, pinfo, offset, length, NULL, 0);
8837 return 3 + length;
8840 * 7.7.100 UE-AMBR
8843 static int
8844 decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8846 uint16_t length;
8847 proto_tree *ext_tree;
8849 length = tvb_get_ntohs(tvb, offset + 1);
8850 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_AMBR], NULL,
8851 val_to_str_ext_const(GTP_EXT_UE_AMBR, &gtpv1_val_ext, "Unknown"));
8852 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8854 offset++;
8855 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8856 offset = offset + 2;
8858 /* 4 to 7 Subscribed UE-AMBR for Uplink */
8859 proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8860 offset+=4;
8861 /* 8 to 11 Subscribed UE-AMBR for Downlink */
8862 proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8863 offset+=4;
8865 /* Authorized UE-AMBR for Uplink and Downlink fields are present in the IE only if the sender has their valid values
8866 * available. Otherwise, the fields from m to (n+3) shall not be present.
8868 if (length > 8) {
8869 /* m to (m+3) Authorized UE-AMBR for Uplink */
8870 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8871 offset += 4;
8873 /* (m+4) to (n+3) Authorized UE-AMBR for Downlink */
8874 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8875 offset += 4;
8878 if (length > 16) {
8879 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 16);
8882 return 3 + length;
8886 * 7.7.101 APN-AMBR with NSAPI
8888 static int
8889 decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8891 uint16_t length;
8892 proto_tree *ext_tree;
8894 length = tvb_get_ntohs(tvb, offset + 1);
8895 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_APN_AMBR_WITH_NSAPI], NULL,
8896 val_to_str_ext_const(GTP_EXT_APN_AMBR_WITH_NSAPI, &gtpv1_val_ext, "Unknown"));
8897 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8899 offset++;
8900 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8901 offset = offset + 2;
8903 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
8904 offset++;
8906 /* 5 to 8 Authorized APN-AMBR for Uplink */
8907 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
8908 offset+=4;
8910 /* 9 to12 Authorized APN-AMBR for Downlink */
8911 proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
8913 return 3 + length;
8916 * 7.7.102 GGSN Back-Off Time
8918 /* Table 7.7.102.1: GGSN Back-Off Time information element */
8919 static const value_string gtp_ggsn_back_off_time_units_vals[] = {
8920 {0, "value is incremented in multiples of 2 seconds"},
8921 {1, "value is incremented in multiples of 1 minute"},
8922 {2, "value is incremented in multiples of 10 minutes"},
8923 {3, "value is incremented in multiples of 1 hour"},
8924 {4, "value is incremented in multiples of 10 hours"},
8925 {5, "value indicates that the timer is infinite"},
8926 {0, NULL}
8928 static int
8929 decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8931 uint16_t length;
8932 proto_tree *ext_tree;
8934 length = tvb_get_ntohs(tvb, offset + 1);
8935 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_GGSN_BACK_OFF_TIME], NULL,
8936 val_to_str_ext_const(GTP_EXT_GGSN_BACK_OFF_TIME, &gtpv1_val_ext, "Unknown"));
8937 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8939 offset++;
8940 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8941 offset += 2;
8943 /* 4 Timer unit Timer value */
8944 proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_time_units, tvb, offset, 1, ENC_BIG_ENDIAN);
8945 proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_timer, tvb, offset, 1, ENC_BIG_ENDIAN);
8947 return 3 + length;
8951 * 7.7.103 Signalling Priority Indication
8953 static const true_false_string gtp_lapi_tfs = {
8954 "MS is configured for NAS signalling low priority",
8955 "MS is not configured for NAS signalling low priority"
8958 static int
8959 decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8961 uint16_t length;
8962 proto_tree *ext_tree;
8964 length = tvb_get_ntohs(tvb, offset + 1);
8965 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SIG_PRI_IND], NULL,
8966 val_to_str_ext_const(GTP_EXT_SIG_PRI_IND, &gtpv1_val_ext, "Unknown"));
8967 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8969 offset++;
8970 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8971 offset += 2;
8973 proto_tree_add_item(ext_tree, hf_gtp_lapi, tvb, offset, 1, ENC_NA);
8975 return 3 + length;
8978 * 7.7.104 Signalling Priority Indication with NSAPI
8981 static int
8982 decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
8984 uint16_t length;
8985 proto_tree *ext_tree;
8987 length = tvb_get_ntohs(tvb, offset + 1);
8988 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SIG_PRI_IND_W_NSAPI], NULL,
8989 val_to_str_ext_const(GTP_EXT_SIG_PRI_IND_W_NSAPI, &gtpv1_val_ext, "Unknown"));
8990 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
8992 offset++;
8993 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
8994 offset += 2;
8996 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
8997 offset++;
8999 proto_tree_add_item(ext_tree, hf_gtp_lapi, tvb, offset, 1, ENC_NA);
9001 return 3 + length;
9004 * 7.7.105 Higher bitrates than 16 Mbps flag
9006 static const value_string gtp_higher_br_16mb_flg_vals[] = {
9007 {0, "Not allowed"},
9008 {1, "Allowed"},
9009 {0, NULL}
9012 static int
9013 decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9015 uint16_t length;
9016 proto_tree *ext_tree;
9018 length = tvb_get_ntohs(tvb, offset + 1);
9019 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_HIGHER_BR_16MB_FLG], NULL,
9020 val_to_str_ext_const(GTP_EXT_HIGHER_BR_16MB_FLG, &gtpv1_val_ext, "Unknown"));
9021 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9023 offset++;
9024 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9025 offset += 2;
9027 /* Higher bitrates than 16 Mbps flag */
9028 proto_tree_add_item(ext_tree, hf_gtp_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
9030 return 3 + length;
9033 * 7.7.106 Max MBR/APN-AMBR
9036 static int
9037 decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9039 uint16_t length;
9040 proto_tree *ext_tree;
9041 uint32_t max_ul;
9042 uint32_t max_dl;
9044 length = tvb_get_ntohs(tvb, offset + 1);
9045 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MAX_MBR_APN_AMBR], NULL,
9046 val_to_str_ext_const(GTP_EXT_MAX_MBR_APN_AMBR, &gtpv1_val_ext, "Unknown"));
9047 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9049 offset++;
9050 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9051 offset = offset + 2;
9053 /* Max MBR/APN-AMBR for uplink */
9054 max_ul = tvb_get_ntohl(tvb, offset);
9055 proto_tree_add_uint_format_value(ext_tree, hf_gtp_max_mbr_apn_ambr_ul, tvb, offset, 4, max_ul, "%u %s",
9056 (max_ul) > 1000 ? max_ul/1000 : max_ul,
9057 (max_ul) > 1000 ? "Mbps" : "kbps");
9059 offset += 4;
9061 /* Max MBR/APN-AMBR for downlink */
9062 max_dl = tvb_get_ntohl(tvb, offset);
9063 proto_tree_add_uint_format_value(ext_tree, hf_gtp_max_mbr_apn_ambr_dl, tvb, offset, 4, max_dl, "%u %s",
9064 (max_dl) > 1000 ? max_dl/1000 : max_dl,
9065 (max_dl) > 1000 ? "Mbps" : "kbps");
9067 return 3 + length;
9070 * 7.7.107 Additional MM context for SRVCC
9073 static int
9074 decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9076 uint16_t length;
9077 proto_tree *ext_tree;
9078 uint32_t inf_len;
9080 length = tvb_get_ntohs(tvb, offset + 1);
9081 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_MM_CTX_SRVCC], NULL,
9082 val_to_str_ext_const(GTP_EXT_ADD_MM_CTX_SRVCC, &gtpv1_val_ext, "Unknown"));
9083 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9085 offset++;
9086 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9087 offset += 2;
9089 /* Length of the Mobile Station Classmark 2 */
9090 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ms_cm_2_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9091 offset++;
9092 if (inf_len > 0) {
9093 offset += de_ms_cm_2(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9096 /* Length of the Mobile Station Classmark 3 */
9097 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ms_cm_3_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9098 offset++;
9099 if (inf_len > 0) {
9100 offset += de_ms_cm_3(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9103 /* Length of the Supported Codec List */
9104 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_sup_codec_lst_len, tvb, offset, 1, ENC_BIG_ENDIAN, &inf_len);
9105 offset++;
9106 if (inf_len > 0) {
9107 de_sup_codec_list(tvb, ext_tree, pinfo, offset, inf_len, NULL, 0);
9110 return 3 + length;
9114 * 7.7.108 Additional flags for SRVCC
9117 static int
9118 decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9120 uint16_t length;
9121 proto_tree *ext_tree;
9123 length = tvb_get_ntohs(tvb, offset + 1);
9124 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ADD_FLGS_SRVCC], NULL,
9125 val_to_str_ext_const(GTP_EXT_ADD_FLGS_SRVCC, &gtpv1_val_ext, "Unknown"));
9126 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9128 offset++;
9129 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9130 offset += 2;
9132 /* 4 Spare ICS */
9133 proto_tree_add_item(ext_tree, hf_gtp_add_flg_for_srvcc_ics, tvb, offset, 1, ENC_BIG_ENDIAN);
9135 return 3 + length;
9138 * 7.7.109 STN-SR
9140 static int
9141 decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9143 uint16_t length;
9144 proto_tree *ext_tree;
9146 length = tvb_get_ntohs(tvb, offset + 1);
9147 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_STN_SR], NULL,
9148 val_to_str_ext_const(GTP_EXT_STN_SR, &gtpv1_val_ext, "Unknown"));
9149 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9151 offset++;
9152 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9153 offset += 2;
9155 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length);
9157 return 3 + length;
9161 * 7.7.110 C-MSISDN
9164 static int
9165 decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9167 uint16_t length;
9168 proto_tree *ext_tree;
9170 length = tvb_get_ntohs(tvb, offset + 1);
9171 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_C_MSISDN], NULL,
9172 val_to_str_ext_const(GTP_EXT_C_MSISDN, &gtpv1_val_ext, "Unknown"));
9173 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9175 offset++;
9176 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9177 offset += 2;
9179 dissect_e164_msisdn(tvb, ext_tree, offset, length, E164_ENC_BCD);
9181 return 3 + length;
9184 * 7.7.111 Extended RANAP Cause
9186 static int
9187 decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9189 uint16_t length;
9190 proto_tree *ext_tree;
9191 tvbuff_t *new_tvb;
9193 length = tvb_get_ntohs(tvb, offset + 1);
9194 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXT_RANAP_CAUSE], NULL,
9195 val_to_str_ext_const(GTP_EXT_EXT_RANAP_CAUSE, &gtpv1_val_ext, "Unknown"));
9196 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9198 offset++;
9199 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9200 offset += 2;
9202 new_tvb = tvb_new_subset_remaining(tvb, offset);
9204 dissect_ranap_Cause_PDU(new_tvb, pinfo, ext_tree, NULL);
9206 return 3 + length;
9210 * 7.7.112 eNodeB ID
9213 static const value_string gtp_enb_type_vals[] = {
9214 { 0, "Macro eNodeB ID" },
9215 { 1, "Home eNodeB ID" },
9216 { 0, NULL }
9219 static int
9220 decode_gtp_ext_enodeb_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9222 uint16_t length;
9223 proto_tree *ext_tree;
9224 uint32_t enb_type;
9226 length = tvb_get_ntohs(tvb, offset + 1);
9227 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ENODEB_ID], NULL,
9228 val_to_str_ext_const(GTP_EXT_ENODEB_ID, &gtpv1_val_ext, "Unknown"));
9229 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9231 offset++;
9232 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9233 offset += 2;
9235 /* eNodeB Type */
9236 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_enb_type, tvb, offset, 1, ENC_BIG_ENDIAN, &enb_type);
9237 offset++;
9239 dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, E212_NONE, true);
9240 offset += 3;
9242 switch (enb_type){
9243 case 0:
9244 /* Macro eNodeB ID */
9245 proto_tree_add_item(ext_tree, hf_gtp_macro_enodeb_id, tvb, offset, 3, ENC_BIG_ENDIAN);
9246 offset += 3;
9247 proto_tree_add_item(ext_tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
9248 break;
9249 case 1:
9250 /* Home eNodeB ID */
9251 proto_tree_add_item(ext_tree, hf_gtp_home_enodeb_id, tvb, offset, 4, ENC_BIG_ENDIAN);
9252 offset += 4;
9253 proto_tree_add_item(ext_tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
9254 break;
9255 default:
9256 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 4);
9257 break;
9260 return 3 + length;
9264 * 7.7.113 Selection Mode with NSAPI
9267 static const value_string gtp_sel_mode_vals[] = {
9268 { 0, "MS or network provided APN, subscription verified" },
9269 { 1, "MS provided APN, subscription not verified" },
9270 { 2, "Network provided APN, subscription not verified" },
9271 { 3, "For future use. Shall not be sent. If received, shall be interpreted as the value 2" },
9272 { 0, NULL }
9275 static int
9276 decode_gtp_ext_sel_mode_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9278 uint16_t length;
9279 proto_tree *ext_tree;
9281 length = tvb_get_ntohs(tvb, offset + 1);
9282 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SEL_MODE_W_NSAPI], NULL,
9283 val_to_str_ext_const(GTP_EXT_SEL_MODE_W_NSAPI, &gtpv1_val_ext, "Unknown"));
9284 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9286 offset++;
9287 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9288 offset += 2;
9290 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
9291 offset++;
9293 proto_tree_add_item(ext_tree, hf_gtp_sel_mode_val, tvb, offset, 1, ENC_BIG_ENDIAN);
9296 return 3 + length;
9299 * 7.7.114 ULI Timestamp
9301 static int
9302 decode_gtp_ext_uli_timestamp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9304 uint16_t length;
9305 proto_tree *ext_tree;
9307 length = tvb_get_ntohs(tvb, offset + 1);
9308 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_ULI_TIMESTAMP], NULL,
9309 val_to_str_ext_const(GTP_EXT_ULI_TIMESTAMP, &gtpv1_val_ext, "Unknown"));
9310 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9312 offset++;
9313 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9314 offset += 2;
9316 proto_tree_add_item(ext_tree, hf_gtp_uli_timestamp, tvb, offset, 4, ENC_TIME_SECS_NTP|ENC_BIG_ENDIAN);
9318 return 3 + length;
9322 * 7.7.115 Local Home Network ID (LHN-ID) with NSAPI
9324 static int
9325 decode_gtp_ext_lhn_id_w_sapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9327 uint16_t length;
9328 proto_tree *ext_tree;
9330 length = tvb_get_ntohs(tvb, offset + 1);
9331 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_LHN_ID_W_SAPI], NULL,
9332 val_to_str_ext_const(GTP_EXT_LHN_ID_W_SAPI, &gtpv1_val_ext, "Unknown"));
9333 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9335 offset++;
9336 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9337 offset += 2;
9338 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
9339 offset += 1;
9341 proto_tree_add_item(ext_tree, hf_gtp_lhn_id, tvb, offset, length, ENC_APN_STR|ENC_NA);
9343 return 3 + length;
9346 * 7.7.116 CN Operator Selection Entity
9348 static const value_string gtp_sel_entity_vals[] = {
9349 { 0, "The Serving Network has been selected by the UE"},
9350 { 1, "The Serving Network has been selected by the network"},
9351 { 2, "For future use"},
9352 { 3, "For future use"},
9353 { 0, NULL},
9356 static int
9357 decode_gtp_ext_cn_op_sel_entity(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9359 uint16_t length;
9360 proto_tree *ext_tree;
9362 length = tvb_get_ntohs(tvb, offset + 1);
9363 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CN_OP_SEL_ENTITY], NULL,
9364 val_to_str_ext_const(GTP_EXT_CN_OP_SEL_ENTITY, &gtpv1_val_ext, "Unknown"));
9365 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9367 offset++;
9368 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9369 offset += 2;
9371 proto_tree_add_item(ext_tree, hf_gtp_sel_entity, tvb, offset, 1, ENC_BIG_ENDIAN);
9372 offset++;
9374 if (length > 1) {
9375 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9377 return 3 + length;
9381 * 7.7.117 UE Usage Type
9383 static int
9384 decode_gtp_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9386 uint16_t length;
9387 proto_tree *ext_tree;
9389 length = tvb_get_ntohs(tvb, offset + 1);
9390 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UE_USAGE_TYPE], NULL,
9391 val_to_str_ext_const(GTP_EXT_UE_USAGE_TYPE, &gtpv1_val_ext, "Unknown"));
9392 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9394 offset++;
9395 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9396 offset += 2;
9398 proto_tree_add_item(ext_tree, hf_gtp_ue_usage_type_value, tvb, offset, 4, ENC_BIG_ENDIAN);
9399 offset += 4;
9401 if (length > 4) {
9402 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 4);
9405 return 3 + length;
9409 * 7.7.118 Extended Common Flags II
9411 static int
9412 decode_gtp_extended_common_flgs_II(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9414 uint16_t length;
9415 proto_tree *ext_tree;
9417 length = tvb_get_ntohs(tvb, offset + 1);
9418 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_EXT_COMMON_FLGS_II], NULL,
9419 val_to_str_ext_const(GTP_EXT_EXT_COMMON_FLGS_II, &gtpv1_val_ext, "Unknown"));
9420 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9422 offset++;
9423 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9424 offset = offset + 2;
9426 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_pnsi, tvb, offset, 1, ENC_BIG_ENDIAN);
9427 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_dtci, tvb, offset, 1, ENC_BIG_ENDIAN);
9428 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_pmtsmi, tvb, offset, 1, ENC_BIG_ENDIAN);
9429 proto_tree_add_item(ext_tree, hf_gtp_ext_comm_flags_II_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
9431 offset++;
9433 if(length > 1){
9434 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length-1);
9437 return 3 + length;
9441 * 7.7.119 Node Identifier
9443 static int
9444 decode_gtp_ext_node_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9446 uint16_t length;
9447 uint32_t item_len;
9448 proto_tree *ext_tree;
9450 length = tvb_get_ntohs(tvb, offset + 1);
9451 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_NODE_IDENTIFIER], NULL,
9452 val_to_str_ext_const(GTP_EXT_NODE_IDENTIFIER, &gtpv1_val_ext, "Unknown"));
9453 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9455 offset++;
9456 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9457 offset += 2;
9459 /* The Node Name and Node Realm are Diameter Identities, which are
9460 * specified by RFC 6733 to be in ASCII for compatibility with DNS.
9462 proto_tree_add_item_ret_length(ext_tree, hf_gtp_node_name, tvb, offset, 1, ENC_ASCII | ENC_NA, &item_len);
9463 offset += item_len;
9464 proto_tree_add_item_ret_length(ext_tree, hf_gtp_node_realm, tvb, offset, 1, ENC_ASCII | ENC_NA, &item_len);
9466 return 3 + length;
9470 * 7.7.120 CIoT Optimizations Support Indication
9472 static int
9473 decode_gtp_ciot_opt_sup_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9475 uint16_t length;
9476 proto_tree *ext_tree;
9478 length = tvb_get_ntohs(tvb, offset + 1);
9479 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_CIOT_OPT_SUP_IND], NULL,
9480 val_to_str_ext_const(GTP_EXT_CIOT_OPT_SUP_IND, &gtpv1_val_ext, "Unknown"));
9481 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9483 offset++;
9484 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9485 offset += 2;
9487 proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_sgni_pdn, tvb, offset, 1, ENC_NA);
9488 proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_scni_pdn, tvb, offset, 1, ENC_NA);
9489 proto_tree_add_item(ext_tree, hf_gtp_ciot_opt_sup_ind_spare, tvb, offset, 1, ENC_NA);
9490 offset++;
9492 if (length > 1) {
9493 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9496 return 3 + length;
9500 * 7.7.121 SCEF PDN Connection
9502 static int
9503 decode_gtp_scef_pdn_conn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9505 uint16_t length;
9506 proto_tree *ext_tree;
9507 uint32_t apn_length, scef_id_length;
9509 length = tvb_get_ntohs(tvb, offset + 1);
9510 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_SCEF_PDN_CONNECTION], NULL,
9511 val_to_str_ext_const(GTP_EXT_SCEF_PDN_CONNECTION, &gtpv1_val_ext, "Unknown"));
9512 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9514 offset++;
9515 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9516 offset += 2;
9518 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_apn_length, tvb, offset, 1, ENC_NA, &apn_length);
9519 decode_apn(pinfo, tvb, offset + 1, (uint16_t)apn_length, ext_tree, NULL);
9521 offset += 1 + apn_length;
9523 proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_NA);
9524 offset++;
9526 proto_tree_add_item_ret_uint(ext_tree, hf_gtp_scef_id_length, tvb, offset, 2, ENC_BIG_ENDIAN, &scef_id_length);
9527 offset += 2;
9529 proto_tree_add_item(ext_tree, hf_gtp_scef_id, tvb, offset, scef_id_length, ENC_ASCII);
9530 offset += scef_id_length;
9532 if (length > 4 + apn_length + scef_id_length) {
9533 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - (4 + apn_length + scef_id_length));
9536 return 3 + length;
9539 * 7.7.122 IOV_updates counter
9541 static int
9542 decode_gtp_iov_updates_counter(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9544 uint16_t length;
9545 proto_tree *ext_tree;
9547 length = tvb_get_ntohs(tvb, offset + 1);
9548 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_IOV_UPDATES_COUNTER], NULL,
9549 val_to_str_ext_const(GTP_EXT_IOV_UPDATES_COUNTER, &gtpv1_val_ext, "Unknown"));
9550 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9552 offset++;
9553 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9554 offset += 2;
9556 proto_tree_add_item(ext_tree, hf_gtp_iov_updates_counter, tvb, offset, 1, ENC_BIG_ENDIAN);
9557 offset++;
9559 if (length > 1) {
9560 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9563 return 3 + length;
9566 * 7.7.123 Mapped UE Usage Type
9568 static int
9569 decode_gtp_mapped_ue_usage_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9571 uint16_t length;
9572 proto_tree *ext_tree;
9574 length = tvb_get_ntohs(tvb, offset + 1);
9575 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_MAPPED_UE_USAGE_TYPE], NULL,
9576 val_to_str_ext_const(GTP_EXT_MAPPED_UE_USAGE_TYPE, &gtpv1_val_ext, "Unknown"));
9577 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9579 offset++;
9580 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9581 offset += 2;
9583 proto_tree_add_item(ext_tree, hf_gtp_mapped_ue_usage_type, tvb, offset, 2, ENC_BIG_ENDIAN);
9584 offset += 2;
9586 if (length > 2) {
9587 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 2);
9590 return 3 + length;
9593 * 7.7.124 UP Function Selection Indication Flags
9595 static int
9596 decode_gtp_up_fun_sel_ind_flags(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9598 uint16_t length;
9599 proto_tree *ext_tree;
9601 length = tvb_get_ntohs(tvb, offset + 1);
9602 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_ies[GTP_EXT_UP_FUN_SEL_IND_FLAGS], NULL,
9603 val_to_str_ext_const(GTP_EXT_UP_FUN_SEL_IND_FLAGS, &gtpv1_val_ext, "Unknown"));
9604 proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
9606 offset++;
9607 proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9608 offset += 2;
9610 proto_tree_add_item(ext_tree, hf_gtp_up_fun_sel_ind_flags_dcnr, tvb, offset, 1, ENC_BIG_ENDIAN);
9611 proto_tree_add_item(ext_tree, hf_gtp_up_fun_sel_ind_flags_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
9612 offset++;
9614 if (length > 1) {
9615 proto_tree_add_expert(ext_tree, pinfo, &ei_gtp_undecoded, tvb, offset, length - 1);
9618 return 3 + length;
9621 /* TS 32.295, chapter 6.2.4.5.4, page 30 */
9622 static int
9623 decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9626 uint16_t length, n, number;
9627 proto_tree *ext_tree_rel_pack;
9629 length = tvb_get_ntohs(tvb, offset + 1);
9631 ext_tree_rel_pack = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_rel_pack, NULL,
9632 "Sequence numbers of released packets IE");
9634 n = 0;
9636 while (n < length) {
9638 number = tvb_get_ntohs(tvb, offset + 3 + n);
9639 proto_tree_add_uint_format(ext_tree_rel_pack, hf_gtp_seq_num_released, tvb, offset + 3 + n, 2, number, "%u", number);
9640 n = n + 2;
9644 return 3 + length;
9647 /* GPRS: 12.15
9648 * UMTS: 33.015
9650 static int
9651 decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9654 uint16_t length, n, number;
9655 proto_tree *ext_tree_can_pack;
9657 length = tvb_get_ntohs(tvb, offset + 1);
9659 ext_tree_can_pack = proto_tree_add_subtree(tree, tvb, offset, 3 + length, ett_gtp_can_pack, NULL,
9660 "Sequence numbers of cancelled packets IE");
9662 n = 0;
9664 while (n < length) {
9666 number = tvb_get_ntohs(tvb, offset + 3 + n);
9667 proto_tree_add_uint_format(ext_tree_can_pack, hf_gtp_seq_num_canceled, tvb, offset + 3 + n, 2, number, "%u", number);
9668 n += 2;
9671 return 3 + length;
9674 /* CDRs dissector
9675 * 3GPP TS 32.295 version 9.0.0 Release 9
9678 /* 3GPP TS 32.298 version 18.6.0, chapter 6.1, page 259 */
9679 static const value_string gtp_cdr_fmt_vals[] = {
9680 {1, "Basic Encoding Rules (BER)"},
9681 {2, "Unaligned basic Packed Encoding Rules (PER)"},
9682 {3, "Aligned basic Packed Encoding Rules (PER)"},
9683 {4, "XML Encoding Rules (XER)"},
9684 {0, NULL}
9686 static int
9687 decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9690 uint16_t length, cdr_length;
9691 uint8_t no, format, app_id, rel_id, ver_id, i;
9692 bool rel_id_zero = false;
9693 proto_tree *ext_tree, *ver_tree, *cdr_dr_tree;
9694 proto_item *fmt_item;
9695 tvbuff_t *next_tvb;
9697 ext_tree = proto_tree_add_subtree(tree, tvb, offset, 1, ett_gtp_ext, NULL,
9698 val_to_str_ext_const(GTP_EXT_DATA_REQ, &gtp_val_ext, "Unknown message"));
9699 offset++;
9701 length = tvb_get_ntohs(tvb, offset);
9702 proto_tree_add_uint(ext_tree, hf_gtp_length, tvb, offset, 2, length);
9703 offset+=2;
9705 if (length == 0) {
9706 return 3;
9709 /* Octet 4 Number of Data Records */
9710 no = tvb_get_uint8(tvb, offset);
9711 proto_tree_add_item(ext_tree, hf_gtp_number_of_data_records, tvb, offset, 1, ENC_BIG_ENDIAN);
9712 offset++;
9714 /* Octet 5 Data Record Format */
9715 format = tvb_get_uint8(tvb, offset);
9716 fmt_item = proto_tree_add_item(ext_tree, hf_gtp_data_record_format, tvb, offset, 1, ENC_BIG_ENDIAN);
9717 offset++;
9718 /* The value range is 1-255 in decimal. The value '0' should not be used.
9719 * Only the values 1-10 and 51-255 can be used for standards purposes.
9720 * Values in the range of 11-50 are to be configured only by operators, and are not subject to standardization.
9722 if(format < 5) {
9723 proto_item_append_text(fmt_item, " %s", val_to_str_const(format, gtp_cdr_fmt_vals, "Unknown"));
9724 /* Octet 6 -7 Data Record Format Version
9725 * 8 7 6 5 4 3 2 1
9726 * 6 Application Identifier Release Identifier
9727 * 7 Version Identifier
9729 * New with Release 15 and higher:
9730 * 8 Release Identifier Extension
9731 * The Release Identifier indicates the TS release up to and including
9732 * 15. The Release Identifier Extension indicates TS releases above 15,
9733 * in this case the Release Identifier has a value of '0' (decimal)
9735 app_id = tvb_get_uint8(tvb,offset);
9736 rel_id = app_id & 0x0f;
9737 app_id = app_id >>4;
9738 ver_id = tvb_get_uint8(tvb,offset+1);
9739 if (rel_id == 0) {
9740 rel_id_zero = true;
9741 rel_id = tvb_get_uint8(tvb,offset+2);
9743 /* The second octet (#7 in Data Record Packet IE) identifies the version of the TS used to encode the CDR,
9744 * i.e. its value corresponds to the second digit of the version number of the document [51]
9745 * (as shown on the cover sheet), plus '1'.
9746 * E.g. for version 3.4.0, the Version Identifier would be "5".
9747 * In circumstances where the second digit is an alphabetical character, (e.g. 3.b.0), the corresponding ASCII value shall
9748 * be taken, e.g. the Version Identifier would be "66" (ASCII(b)).
9750 if(ver_id < 0x65)
9751 ver_id = ver_id -1;
9752 /* XXX We don't handle ASCCI version */
9754 ver_tree = proto_tree_add_subtree_format(ext_tree, tvb, offset, (rel_id_zero || rel_id == 15) ? 3 : 2, ett_gtp_cdr_ver, NULL,
9755 "Data record format version: AppId %u Rel %u.%u.0", app_id,rel_id,ver_id);
9756 proto_tree_add_item(ver_tree, hf_gtp_cdr_app, tvb, offset, 1, ENC_BIG_ENDIAN);
9757 proto_tree_add_item(ver_tree, hf_gtp_cdr_rel, tvb, offset, 1, ENC_BIG_ENDIAN);
9758 offset++;
9759 proto_tree_add_item(ver_tree, hf_gtp_cdr_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
9760 offset++;
9761 if(rel_id_zero) {
9762 /* The Release Identifier indicates the TS release up to and including 15.
9763 * The Release Identifier Extension indicates TS releases above 15,
9764 * in this case the Release Identifier has a value of '0' (decimal).
9766 fmt_item = proto_tree_add_item(ver_tree, hf_gtp_cdr_rel_ext, tvb, offset, 1, ENC_NA);
9767 offset++;
9768 if(rel_id < 16) {
9769 expert_add_info(pinfo, fmt_item, &ei_gtp_cdr_rel_ext_invalid);
9772 for(i = 0; i < no; ++i) {
9773 cdr_length = tvb_get_ntohs(tvb, offset);
9774 cdr_dr_tree = proto_tree_add_subtree_format(ext_tree, tvb, offset, cdr_length+2,
9775 ett_gtp_cdr_dr, NULL, "Data record %d", i + 1);
9776 proto_tree_add_uint(cdr_dr_tree, hf_gtp_cdr_length, tvb, offset, 2, cdr_length);
9777 offset+=2;
9778 proto_tree_add_item(cdr_dr_tree, hf_gtp_cdr_context, tvb, offset, cdr_length, ENC_NA);
9779 next_tvb = tvb_new_subset_remaining(tvb, offset);
9781 /* XXX this is for release 6, may not work for higher releases */
9782 if(format==1) {
9783 if(rel_id <= 6){
9784 dissect_gprscdr_GPRSCallEventRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
9785 }else{
9786 dissect_gprscdr_GPRSRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
9788 } else {
9789 /* Do we have a dissector registering for this standardized encodings data format? */
9790 dissector_try_uint(gtp_cdr_fmt_dissector_table, format, next_tvb, pinfo, cdr_dr_tree);
9793 offset = offset + cdr_length;
9795 return offset;
9797 } else {
9798 /* Proprietary CDR format */
9799 proto_item_append_text(fmt_item, " Proprietary or un documented format");
9802 next_tvb = tvb_new_subset_remaining(tvb, offset);
9803 if (gtpcdr_handle) {
9804 call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
9805 } else {
9806 /* Do we have a dissector registering for this proprietary data format? */
9807 dissector_try_uint_with_data(gtp_cdr_fmt_dissector_table, format, next_tvb, pinfo, tree, false, &no);
9810 return 3 + length;
9813 /* TS 32.295 */
9814 static int
9815 decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args)
9818 uint16_t length, n;
9819 proto_tree *ext_tree_data_resp;
9820 gtp_msg_hash_t *gcrp = NULL;
9821 unsigned request_responded_seq_no = 0;
9822 gtp_conv_info_t *gtp_info;
9824 gtp_info = find_or_create_gtp_conv_info(pinfo, NULL);
9826 length = tvb_get_ntohs(tvb, offset + 1);
9828 ext_tree_data_resp = proto_tree_add_subtree(tree, tvb, offset, 3 + length,
9829 ett_gtp_data_resp, NULL, "Requests responded");
9831 n = 0;
9833 while (n < length) {
9835 proto_tree_add_item_ret_uint(ext_tree_data_resp, hf_gtp_requests_responded, tvb, offset + 3 + n, 2, ENC_BIG_ENDIAN, &request_responded_seq_no);
9836 n = n + 2;
9838 /* Unlike GTP, sequence number inside GTP' header of response is not used to confirm request.
9839 * Instead of this "Data Record Transfer Response" message includes IE "Requests Responded"
9840 * with sequence numbers of requests to confirm.
9842 uint8_t cause_aux = 128; /* Cause accepted by default. Only used when args is NULL */
9843 if (args) {
9844 cause_aux = args->last_cause;
9846 gcrp = gtp_match_response(tvb, pinfo, tree, request_responded_seq_no, GTP_MSG_DATA_TRANSF_RESP, gtp_info, cause_aux);
9847 /*pass packet to tap for response time reporting*/
9848 if (gcrp) {
9849 tap_queue_packet(gtp_tap, pinfo, gcrp);
9853 return 3 + length;
9857 /* GPRS: 12.15
9858 * UMTS: 33.015
9860 static int
9861 decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, session_args_t * args _U_)
9864 uint16_t length;
9865 proto_tree *ext_tree_node_addr;
9866 proto_item *te;
9868 length = tvb_get_ntohs(tvb, offset + 1);
9870 ext_tree_node_addr = proto_tree_add_subtree(tree, tvb, offset, 3 + length,
9871 ett_gtp_node_addr, &te, "Node address: ");
9873 proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_address_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
9875 switch (length) {
9876 case 4:
9877 proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, ENC_BIG_ENDIAN);
9878 proto_item_append_text(te, "%s", tvb_ip_to_str(pinfo->pool, tvb, offset + 3));
9879 break;
9880 case 16:
9881 proto_tree_add_item(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, ENC_NA);
9882 proto_item_append_text(te, "%s", tvb_ip6_to_str(pinfo->pool, tvb, offset + 3));
9883 break;
9884 default:
9885 proto_item_append_text(te, "unknown type or wrong length");
9886 break;
9889 return 3 + length;
9893 /* GPRS: 9.60 v7.6.0, chapter 7.9.26
9894 * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
9898 static int
9899 decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9902 uint16_t length, ext_id;
9903 proto_tree *ext_tree_priv_ext;
9904 proto_item *te;
9905 tvbuff_t *next_tvb;
9907 ext_tree_priv_ext = proto_tree_add_subtree_format(tree, tvb, offset, 1, ett_gtp_ext, &te,
9908 "%s : ", val_to_str_ext_const(GTP_EXT_PRIV_EXT, &gtp_val_ext, "Unknown message"));
9910 offset++;
9911 length = tvb_get_ntohs(tvb, offset);
9912 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
9913 offset += 2;
9914 if (length >= 2) {
9915 ext_id = tvb_get_ntohs(tvb, offset);
9916 proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
9917 proto_item_append_text(te, "%s (%u)", enterprises_lookup(ext_id, "Unknown"), ext_id);
9918 offset = offset + 2;
9920 if (length > 2) {
9921 next_tvb = tvb_new_subset_length(tvb, offset, length-2);
9922 if(!dissector_try_uint(gtp_priv_ext_dissector_table, ext_id, next_tvb, pinfo, ext_tree_priv_ext)){
9923 proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, ENC_NA);
9928 return 3 + length;
9931 static int
9932 decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, session_args_t * args _U_)
9935 proto_tree_add_expert(tree, pinfo, &ei_gtp_unknown_extension_header, tvb, offset, 1);
9937 return tvb_reported_length_remaining(tvb, offset);
9940 static void
9941 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)
9943 uint32_t session, frame_teid_cp;
9944 proto_item *it;
9946 /* GTP session */
9947 if (tree) {
9948 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
9949 if (session) {
9950 it = proto_tree_add_uint(tree, hf_gtp_session, tvb, 0, 0, session);
9951 proto_item_set_generated(it);
9956 if (!PINFO_FD_VISITED(pinfo) && gtp_version == 1) {
9957 /* If the message does not have any session ID */
9958 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(pinfo->num)));
9959 if (!session) {
9960 /* If the message is not a CPDPCRES, CPDPCREQ, UPDPREQ, UPDPRES
9961 * then we remove its information from teid and ip lists
9962 * XXX: Wouldn't it be better not to insert this information
9963 * in the first place for other message types, instead of
9964 * inserting it and then immediately removing it?
9965 * At the very least, it would be faster to iterate through the
9966 * teid_list and ip_list and remove via keys rather than doing
9967 * removal through a reverse lookup.
9969 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
9970 && gtp_hdr->message != GTP_MSG_UPDATE_PDP_REQ)) {
9971 /* If the lists are not empty*/
9972 if (wmem_list_count(teid_list) && wmem_list_count(ip_list)) {
9973 remove_frame_info(pinfo->num);
9977 if (gtp_hdr->message == GTP_MSG_CREATE_PDP_REQ) {
9978 /* If CPDPCREQ and not already in the list then we create a new session*/
9979 add_gtp_session(pinfo->num, gtp_session_count++);
9980 } else if (gtp_hdr->message != GTP_MSG_CREATE_PDP_RESP) {
9981 /* 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 */
9982 if (gtp_hdr->message == GTP_MSG_ERR_IND) {
9983 if (get_frame(last_ip, last_teid, &frame_teid_cp) == 1) {
9984 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame_teid_cp)));
9985 if (session) {
9986 /* We add the corresponding session to the session list*/
9987 add_gtp_session(pinfo->num, session);
9991 else {
9992 /* 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
9993 the corresponding session ID */
9994 if ((get_frame(pinfo->dst, (uint32_t)gtp_hdr->teid, &frame_teid_cp) == 1)) {
9995 /* Then we have to set its session ID */
9996 session = GPOINTER_TO_UINT(wmem_map_lookup(session_table, GUINT_TO_POINTER(frame_teid_cp)));
9997 if (session) {
9998 /* We add the corresponding session to the list so that when a response came we can associate its session ID*/
9999 add_gtp_session(pinfo->num, session);
10008 static int
10009 dissect_nrup(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree,
10010 void *private_data _U_)
10012 uint32_t pdu_type;
10013 bool dl_disc_blk;
10014 bool dl_flush;
10015 uint32_t dl_disc_num_blks;
10016 int offset = 0;
10018 /* NRUP */
10019 proto_item *nrup_ti;
10020 proto_tree *nrup_tree;
10022 /* Protocol subtree */
10023 nrup_ti = proto_tree_add_item(tree, proto_nrup, tvb, offset, -1, ENC_NA);
10024 nrup_tree = proto_item_add_subtree(nrup_ti, ett_nrup);
10027 proto_tree_add_item_ret_uint(nrup_ti, hf_nrup_pdu_type,tvb, offset, 1, ENC_BIG_ENDIAN, &pdu_type);
10029 switch (pdu_type) {
10030 case NR_UP_DL_USER_DATA:
10032 /* 5.5.2.1 */
10033 bool report_delivered;
10035 /* PDU Type (=0) Spare DL Discard Blocks DL Flush Report polling Octet 1*/
10036 proto_tree_add_item(nrup_tree, hf_nrup_spr_bit_extnd_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10037 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_discrd_blks, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_disc_blk);
10038 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_flush, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_flush);
10039 proto_tree_add_item(nrup_tree, hf_nrup_rpt_poll, tvb, offset, 1, ENC_BIG_ENDIAN);
10040 offset++;
10042 /* Spare Assistance Info. Report Polling Flag Retransmission flag*/
10043 proto_tree_add_item(nrup_tree, hf_nrup_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
10044 proto_tree_add_item(nrup_tree, hf_nrup_request_out_of_seq_report, tvb, offset, 1, ENC_BIG_ENDIAN);
10045 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_report_delivered, tvb, offset, 1, ENC_BIG_ENDIAN, &report_delivered);
10046 proto_tree_add_item(nrup_tree, hf_nrup_user_data_existence_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10047 proto_tree_add_item(nrup_tree, hf_nrup_ass_inf_rep_poll_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10048 proto_tree_add_item(nrup_tree, hf_nrup_retransmission_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
10049 offset++;
10051 /* NR-U Sequence NUmber */
10052 proto_tree_add_item(nrup_tree, hf_nrup_nr_u_seq_num, tvb, offset, 3, ENC_BIG_ENDIAN);
10053 offset += 3;
10055 if (dl_flush) {
10056 /* DL discard NR PDCP PDU SN */
10057 proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_nr_pdcp_pdu_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10058 offset += 3;
10060 /* Discarded blocks */
10061 if (dl_disc_blk) {
10062 /* DL discard Number of blocks */
10063 proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_dl_disc_num_blks, tvb, offset, 1, ENC_BIG_ENDIAN, &dl_disc_num_blks);
10064 offset++;
10065 while (dl_disc_num_blks) {
10066 /* DL discard NR PDCP PDU SN start */
10067 proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_nr_pdcp_pdu_sn_start, tvb, offset, 3, ENC_BIG_ENDIAN);
10068 offset += 3;
10070 /* Discarded Block size */
10071 proto_tree_add_item(nrup_tree, hf_nrup_dl_disc_blk_sz, tvb, offset, 1, ENC_BIG_ENDIAN);
10072 offset++;
10073 dl_disc_num_blks--;
10077 if (report_delivered) {
10078 /* DL report NR PDCP PDU SN */
10079 proto_tree_add_item(nrup_tree, hf_nrup_dl_report_nr_pdcp_pdu_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10080 offset += 3;
10082 break;
10085 case NR_UP_DL_DATA_DELIVERY_STATUS:
10087 /* 5.5.2.2 */
10088 bool high_tx_nr_pdcp_sn_ind;
10089 bool high_del_nr_pdcp_sn_ind;
10090 bool lost_packet_report;
10091 bool high_retx_nr_pdcp_sn_ind;
10092 bool high_del_retx_nr_pdcp_sn_ind;
10093 bool cause_rpt;
10094 bool data_rate_ind;
10095 uint32_t lost_NR_U_SN_range;
10097 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 );
10098 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 );
10099 proto_tree_add_item(nrup_tree, hf_nrup_final_frame_ind,tvb, offset, 1, ENC_BIG_ENDIAN);
10100 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_lost_pkt_rpt,tvb, offset, 1, ENC_BIG_ENDIAN, &lost_packet_report);
10101 offset++;
10103 proto_tree_add_item(nrup_tree, hf_nrup_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
10104 proto_tree_add_item(nrup_tree, hf_nrup_delivered_nr_pdcp_sn_range_ind ,tvb, offset,1, ENC_BIG_ENDIAN);
10105 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_data_rate_ind,tvb, offset,1, ENC_BIG_ENDIAN, &data_rate_ind);
10106 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);
10107 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);
10108 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_cause_rpt,tvb, offset,1, ENC_BIG_ENDIAN, &cause_rpt);
10109 offset++;
10111 proto_tree_add_item(nrup_tree, hf_nrup_desrd_buff_sz_data_radio_bearer,tvb, offset, 4, ENC_BIG_ENDIAN);
10112 offset += 4;
10114 if (data_rate_ind){
10115 proto_tree_add_item(nrup_tree, hf_nrup_desrd_data_rate,tvb, offset, 4, ENC_BIG_ENDIAN);
10116 offset += 4;
10119 if (lost_packet_report) {
10120 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);
10121 offset+=1;
10123 while (lost_NR_U_SN_range) {
10124 proto_tree_add_item(nrup_tree, hf_nrup_start_lost_nru_seq_num,tvb, offset, 3, ENC_BIG_ENDIAN);
10125 offset += 3;
10127 proto_tree_add_item(nrup_tree, hf_nrup_end_lost_nru_seq_num,tvb, offset, 3, ENC_BIG_ENDIAN);
10128 offset += 3;
10129 lost_NR_U_SN_range--;
10133 if (high_del_nr_pdcp_sn_ind) {
10134 proto_tree_add_item(nrup_tree, hf_nrup_high_success_delivered_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10135 offset += 3;
10138 if (high_tx_nr_pdcp_sn_ind) {
10139 proto_tree_add_item(nrup_tree, hf_nrup_high_tx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10140 offset += 3;
10143 if (cause_rpt) {
10144 proto_tree_add_item(nrup_tree, hf_nrup_cause_val,tvb, offset, 1, ENC_BIG_ENDIAN);
10145 offset ++;
10148 if (high_del_retx_nr_pdcp_sn_ind) {
10149 proto_tree_add_item(nrup_tree, hf_nrup_high_success_delivered_retx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10150 offset += 3;
10153 if (high_retx_nr_pdcp_sn_ind) {
10154 proto_tree_add_item(nrup_tree, hf_nrup_high_retx_nr_pdcp_sn,tvb, offset, 3, ENC_BIG_ENDIAN);
10157 break;
10160 case NR_UP_ASSISTANCE_INFORMATION_DATA:
10162 /* 5.5.2.3 */
10163 bool pdcp_duplication_indication;
10164 bool assistance_information_ind;
10165 bool ul_delay_ind;
10166 bool dl_delay_ind;
10167 bool pdcp_duplication_suggestion;
10169 /* Flags */
10170 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_pdcp_duplication_ind, tvb, offset,1, ENC_BIG_ENDIAN, &pdcp_duplication_indication);
10171 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_assistance_information_ind, tvb, offset,1, ENC_BIG_ENDIAN, &assistance_information_ind);
10172 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_ul_delay_ind, tvb, offset,1, ENC_BIG_ENDIAN, &ul_delay_ind);
10173 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_dl_delay_ind, tvb, offset,1, ENC_BIG_ENDIAN, &dl_delay_ind);
10174 offset++;
10175 proto_tree_add_item(nrup_tree, hf_nrup_spare_2, tvb, offset,1, ENC_BIG_ENDIAN);
10176 proto_tree_add_item_ret_boolean(nrup_tree, hf_nrup_pdcp_duplication_activation_suggestion,
10177 tvb, offset,1, ENC_BIG_ENDIAN, &pdcp_duplication_suggestion);
10178 offset++;
10180 /* Number of Assistance Information Fields */
10181 if (assistance_information_ind) {
10182 uint32_t number_of_assistance_information_fields = 0;
10183 uint32_t num_octets_radio_qa_info;
10185 /* Number of assistance info fields */
10186 proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_assistance_info_fields,
10187 tvb, offset,1, ENC_BIG_ENDIAN, &number_of_assistance_information_fields);
10188 offset++;
10190 for (unsigned n=0; n < number_of_assistance_information_fields; n++) {
10191 /* Assistance Information Type */
10192 proto_tree_add_item(nrup_tree, hf_nrup_assistance_information_type,
10193 tvb, offset,1, ENC_BIG_ENDIAN);
10194 offset++;
10195 /* Num octets in assistance info */
10196 proto_tree_add_item_ret_uint(nrup_tree, hf_nrup_num_octets_radio_qa_info,
10197 tvb, offset, 1, ENC_BIG_ENDIAN, &num_octets_radio_qa_info);
10198 offset++;
10199 /* Radio Quality Assistance info */
10200 proto_tree_add_item(nrup_tree, hf_nrup_radio_qa_info, tvb, offset,
10201 num_octets_radio_qa_info, ENC_NA);
10202 offset += num_octets_radio_qa_info;
10206 /* UL Delay DU Result */
10207 if (ul_delay_ind) {
10208 proto_tree_add_item(nrup_tree, hf_nrup_ul_delay_du_result, tvb, offset, 4, ENC_BIG_ENDIAN);
10209 offset += 4;
10211 /* DL Delay DU Result */
10212 if (dl_delay_ind) {
10213 proto_tree_add_item(nrup_tree, hf_nrup_dl_delay_du_result, tvb, offset, 4, ENC_BIG_ENDIAN);
10214 offset += 4;
10216 break;
10218 default:
10219 /* TODO: expert info error for unexpected PDU type? */
10220 break;
10223 return offset;
10226 /* TS 38.425 */
10227 static void
10228 addRANContParameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
10230 tvbuff_t *next_tvb = tvb_new_subset_length(tvb, offset, length);
10231 call_dissector(nrup_handle, next_tvb, pinfo, tree);
10234 static void
10235 dissect_gtp_tpdu_by_handle(dissector_handle_t handle, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int offset)
10237 tvbuff_t *next_tvb;
10238 next_tvb = tvb_new_subset_remaining(tvb, offset);
10239 call_dissector(handle, next_tvb, pinfo, tree);
10240 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP/");
10243 static void
10244 dissect_gtp_tpdu_as_pdcp_lte_info(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t *gtp_hdr, int offset)
10246 /* Check if we have info to call the PDCP dissector */
10247 struct pdcp_lte_info *p_pdcp_info;
10248 uat_pdcp_lte_keys_record_t * found_record;
10249 tvbuff_t *pdcp_lte_tvb;
10251 if ((found_record = look_up_pdcp_lte_keys_record(pinfo, (uint32_t)gtp_hdr->teid))) {
10252 /* Look for attached packet info! */
10253 p_pdcp_info = (struct pdcp_lte_info *)p_get_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0);
10254 /* If we don't have the data, add it */
10255 if (p_pdcp_info == NULL) {
10256 p_pdcp_info = wmem_new0(wmem_file_scope(), pdcp_lte_info);
10257 /* Channel info is needed for RRC parsing */
10258 p_pdcp_info->direction = found_record->direction;
10259 p_pdcp_info->ueid = found_record->ue_id;
10260 p_pdcp_info->channelType = Channel_DCCH;
10261 p_pdcp_info->channelId = found_record->rb_id;
10262 /*p_pdcp_info->BCCHTransport;*/
10264 /* Details of PDCP header */
10265 if (found_record->header_present == PDCP_LTE_HEADER_PRESENT) {
10266 p_pdcp_info->no_header_pdu = false;
10267 } else {
10268 p_pdcp_info->no_header_pdu = true;
10270 p_pdcp_info->plane = found_record->plane;
10271 p_pdcp_info->seqnum_length = found_record->lte_sn_length;
10273 /* RoHC settings */
10274 p_pdcp_info->rohc.rohc_compression = found_record->rohc_compression;
10275 p_pdcp_info->rohc.rohc_ip_version = 4; /* For now set it explicitly */
10276 p_pdcp_info->rohc.cid_inclusion_info = false;
10277 p_pdcp_info->rohc.large_cid_present = false;
10278 p_pdcp_info->rohc.mode = MODE_NOT_SET;
10279 p_pdcp_info->rohc.rnd = false;
10280 p_pdcp_info->rohc.udp_checksum_present = false;
10281 p_pdcp_info->rohc.profile = found_record->rohc_profile;
10283 /* p_pdcp_info->is_retx;*/
10285 /* Used by heuristic dissector only */
10286 /*p_pdcp_info->pdu_length;*/
10287 p_add_proto_data(wmem_file_scope(), pinfo, proto_pdcp_lte, 0, p_pdcp_info);
10289 pdcp_lte_tvb = tvb_new_subset_remaining(tvb, offset);
10290 call_dissector(pdcp_lte_handle, pdcp_lte_tvb, pinfo, tree);
10292 } else {
10293 proto_tree_add_subtree(tree, tvb, offset, -1, ett_gtp_pdcp_no_conf, NULL, "[No PDCP-LTE Configuration data found]");
10294 proto_tree_add_item(tree, hf_pdcp_cont, tvb, offset, -1, ENC_NA);
10298 static void
10299 dissect_gtp_tpsu_as_pdcp_nr_info(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gtp_hdr_t *gtp_hdr, int offset)
10301 /*NR-U DUD or DDDS PDU
10302 * This is NR-U DUD/DDDS PDU. It contains PDCP
10303 * payload as per 3GPP TS 38.323
10305 /* Check if we have info to call the PDCP dissector */
10306 uat_pdcp_nr_keys_record_t* found_record;
10308 if ((found_record = look_up_pdcp_nr_keys_record(pinfo, (uint32_t)gtp_hdr->teid))) {
10309 tvbuff_t *pdcp_tvb;
10310 struct pdcp_nr_info temp_data;
10312 pdcp_tvb = tvb_new_subset_remaining(tvb, offset);
10314 /* Fill in pdcp_nr_info */
10315 temp_data.direction = found_record->direction;
10316 temp_data.bearerType = Bearer_DCCH; /* always */
10317 /* Want to use same ueid as other PDCP config.. */
10318 temp_data.ueid = found_record->ue_id;
10319 /* Get this from table, may also be available from F1AP signalling... */
10320 temp_data.bearerId = found_record->rb_id;
10322 /* Details of PDCP header */
10323 temp_data.plane = found_record->plane;
10324 temp_data.seqnum_length = found_record->pdcp_nr_sn_length;
10325 /* PDCP_NR_(U|D)L_sdap_hdr_PRESENT bitmask */
10326 if (found_record->sdap_header_present == PDCP_NR_SDAP_HEADER_PRESENT) {
10327 if (temp_data.direction == PDCP_NR_DIRECTION_UPLINK) {
10328 temp_data.sdap_header = PDCP_NR_UL_SDAP_HEADER_PRESENT;
10329 } else {
10330 temp_data.sdap_header = PDCP_NR_DL_SDAP_HEADER_PRESENT;
10332 } else {
10333 temp_data.sdap_header = 0;
10335 /* Integrity MAC present? */
10336 temp_data.maci_present = found_record->mac_i_present;
10338 /* RoHC settings */
10339 temp_data.rohc.rohc_compression = found_record->rohc_compression;
10340 temp_data.rohc.rohc_ip_version = 4; /* For now set it explicitly */
10341 temp_data.rohc.cid_inclusion_info = false;
10342 temp_data.rohc.large_cid_present = false;
10343 temp_data.rohc.mode = MODE_NOT_SET;
10344 temp_data.rohc.rnd = false;
10345 temp_data.rohc.udp_checksum_present = false;
10346 temp_data.rohc.profile = found_record->rohc_profile;
10348 temp_data.is_retx = 0;
10350 /* Used by heuristic dissector only */
10351 temp_data.pdu_length = 0;
10353 call_dissector_with_data(pdcp_nr_handle, pdcp_tvb, pinfo, tree, &temp_data);
10354 } else {
10355 proto_tree_add_subtree(tree, tvb, offset, -1, ett_gtp_pdcp_no_conf, NULL, "[No PDCP-NR Configuration data found]");
10356 proto_tree_add_item(tree, hf_pdcp_cont, tvb, offset, -1, ENC_NA);
10360 static int
10361 dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
10363 uint8_t octet;
10364 gtp_hdr_t *gtp_hdr = NULL;
10365 proto_tree *gtp_tree = NULL, *ext_tree;
10366 proto_tree *ran_cont_tree = NULL;
10367 proto_item *ti = NULL, *tf, *ext_hdr_len_item, *message_item;
10368 int i, offset = 0, checked_field, mandatory;
10369 bool gtp_prime, has_SN;
10370 unsigned seq_no = 0;
10371 unsigned flow_label = 0;
10372 unsigned pdu_no, next_hdr = 0;
10373 uint8_t ext_hdr_val;
10374 unsigned ext_hdr_length;
10375 uint32_t ext_hdr_pdcpsn, value;
10376 char *tid_str;
10377 uint8_t acfield_len = 0;
10378 gtp_msg_hash_t *gcrp = NULL;
10379 gtp_conv_info_t *gtp_info;
10380 session_args_t *args = NULL;
10381 ie_decoder *decoder = NULL;
10383 /* Do we have enough bytes for the version and message type? */
10384 if (!tvb_bytes_exist(tvb, 0, 2)) {
10385 /* No - reject the packet. */
10386 return 0;
10388 octet = tvb_get_uint8(tvb, 0);
10389 if (((octet >> 5) & 0x07) > 2) {
10390 /* Version > 2; reject the packet */
10391 return 0;
10393 octet = tvb_get_uint8(tvb, 1);
10394 if (octet == GTP_MSG_UNKNOWN || try_val_to_str(octet, gtp_message_type) == NULL) {
10395 /* Unknown message type; reject the packet */
10396 return 0;
10399 /* Setting everything to 0, so that the TEID is 0 for GTP version 0
10400 * The magic number should perhaps be replaced.
10402 gtp_hdr = wmem_new0(pinfo->pool, gtp_hdr_t);
10404 /* Setting the TEID to -1 to say that the TEID is not valid for this packet */
10405 gtp_hdr->teid = -1;
10407 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
10408 col_clear(pinfo->cinfo, COL_INFO);
10410 if (g_gtp_session) {
10411 args = wmem_new0(pinfo->pool, session_args_t);
10412 args->last_cause = 128; /* It stores the last cause decoded. Cause accepted by default */
10413 /* We create the auxiliary lists */
10414 args->teid_list = wmem_list_new(pinfo->pool);
10415 args->ip_list = wmem_list_new(pinfo->pool);
10418 gtp_info = find_or_create_gtp_conv_info(pinfo, NULL);
10420 gtp_hdr->flags = tvb_get_uint8(tvb, offset);
10422 if (!(gtp_hdr->flags & 0x10)){
10423 gtp_prime = true;
10424 }else{
10425 gtp_prime = false;
10428 switch ((gtp_hdr->flags >> 5) & 0x07) {
10429 case 0:
10430 gtp_version = 0;
10431 break;
10432 case 1:
10433 gtp_version = 1;
10434 break;
10435 default:
10436 gtp_version = 1;
10437 break;
10439 if (tree) {
10440 if (gtp_prime) {
10441 static int * const gtp_prime_flags[] = {
10442 &hf_gtp_prime_flags_ver,
10443 &hf_gtp_flags_pt,
10444 &hf_gtp_flags_spare1,
10445 NULL
10447 static int * const gtp_prime_v0_flags[] = {
10448 &hf_gtp_prime_flags_ver,
10449 &hf_gtp_flags_pt,
10450 &hf_gtp_flags_spare1,
10451 &hf_gtp_flags_hdr_length,
10452 NULL
10455 ti = proto_tree_add_item(tree, proto_gtpprime, tvb, 0, -1, ENC_NA);
10456 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
10458 /* Octet 8 7 6 5 4 3 2 1
10459 * 1 Version | PT| Spare '1 1 1 '| ' 0/1 '
10462 /* Bit 1 of octet 1 is not used in GTP' (except in v0), and it is marked '0'
10463 * in the GTP' header. It is in use in GTP' v0 and distinguishes the used header-length.
10464 * In the case of GTP' v0, this bit being marked one (1) indicates the usage of the 6
10465 * octets header. If the bit is set to '0' (usually the case) the 20-octet header is used.
10466 * For all other versions of GTP', this bit is not used and is set to '0'. However,
10467 * this does not suggest the use of the 20-octet header, rather a shorter 6-octet header.
10469 if (gtp_version == 0) {
10470 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10471 ett_gtp_flags, gtp_prime_v0_flags, gtp_hdr->flags, BMT_NO_APPEND);
10472 } else {
10473 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10474 ett_gtp_flags, gtp_prime_flags, gtp_hdr->flags, BMT_NO_APPEND);
10476 } else {
10477 static int * const gtp_flags[] = {
10478 &hf_gtp_flags_ver,
10479 &hf_gtp_flags_pt,
10480 &hf_gtp_flags_spare2,
10481 &hf_gtp_flags_e,
10482 &hf_gtp_flags_s,
10483 &hf_gtp_flags_pn,
10484 NULL
10486 static int * const gtp_v0_flags[] = {
10487 &hf_gtp_flags_ver,
10488 &hf_gtp_flags_pt,
10489 &hf_gtp_flags_spare1,
10490 &hf_gtp_flags_snn,
10491 NULL
10493 ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, ENC_NA);
10494 gtp_tree = proto_item_add_subtree(ti, ett_gtp);
10496 if (gtp_version == 0) {
10497 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10498 ett_gtp_flags, gtp_v0_flags, gtp_hdr->flags, BMT_NO_APPEND);
10499 } else {
10500 proto_tree_add_bitmask_value_with_flags(gtp_tree, tvb, offset, hf_gtp_flags,
10501 ett_gtp_flags, gtp_flags, gtp_hdr->flags, BMT_NO_APPEND);
10505 offset++;
10507 gtp_hdr->message = tvb_get_uint8(tvb, offset);
10508 /* Link direction is needed to properly dissect PCO */
10509 switch(gtp_hdr->message){
10510 case GTP_MSG_DELETE_PDP_REQ:
10511 case GTP_MSG_UPDATE_PDP_REQ:
10512 case GTP_MSG_CREATE_PDP_REQ:
10513 case GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ:
10514 case GTP_MSG_PDU_NOTIFY_REQ:
10515 case GTP_MSG_PDU_NOTIFY_REJ_REQ:
10516 case GTP_MSG_FORW_RELOC_REQ: /* direction added for UTRAN Container & BSS Container decode */
10517 pinfo->link_dir = P2P_DIR_UL;
10518 break;
10519 case GTP_MSG_DELETE_PDP_RESP:
10520 case GTP_MSG_UPDATE_PDP_RESP:
10521 case GTP_MSG_CREATE_PDP_RESP:
10522 case GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP:
10523 case GTP_MSG_FORW_RELOC_RESP: /* direction added for UTRAN Container & BSS Container decode */
10524 pinfo->link_dir = P2P_DIR_DL;
10525 break;
10526 default:
10527 break;
10529 col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(gtp_hdr->message, &gtp_message_type_ext, "Unknown"));
10530 message_item = proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, offset, 1, gtp_hdr->message);
10531 offset++;
10533 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, ENC_BIG_ENDIAN, &gtp_hdr->length);
10534 offset += 2;
10536 /* We initialize the sequence number*/
10537 has_SN = false;
10538 if (gtp_prime) {
10539 has_SN = true;
10540 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10541 offset += 2;
10542 /* If GTP' version is 0 and bit 1 is 0 20 bytes header is used, dissect it */
10543 if( (gtp_version == 0) && ((gtp_hdr->flags & 0x01) == 0) ) {
10544 proto_tree_add_item(gtp_tree, hf_gtp_dummy_octets, tvb, offset, 14, ENC_NA);
10545 offset += 14;
10548 set_actual_length(tvb, offset + gtp_hdr->length);
10549 } else {
10550 switch (gtp_version) {
10551 case 0:
10552 has_SN = true;
10553 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10554 offset += 2;
10556 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, ENC_BIG_ENDIAN, &flow_label);
10557 offset += 2;
10559 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, ENC_NA, &pdu_no);
10560 offset += 4;
10562 tid_str = id_to_str(tvb, offset);
10563 proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
10564 offset += 8;
10566 set_actual_length(tvb, offset + gtp_hdr->length);
10568 break;
10569 case 1:
10570 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_teid, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
10571 gtp_hdr->teid = value;
10572 offset += 4;
10574 set_actual_length(tvb, offset + gtp_hdr->length);
10576 /* Are sequence number/N-PDU Number/extension header present?
10577 See NOTE 5 of Figure 2 of 3GPP TS 29.060 version 4.3.0
10578 Release 4 - the Sequence Number, N-PDU Number, and
10579 Next Extension Header fields are present if any of
10580 GTP_E_MASK, GTP_S_MASK, or GTP_PN_MASK are set. */
10581 if (gtp_hdr->flags & (GTP_E_MASK|GTP_S_MASK|GTP_PN_MASK)) {
10582 /* Those fields are only *interpreted* if the
10583 particular flag for the field is set. */
10584 if (gtp_hdr->flags & GTP_S_MASK) {
10585 has_SN = true;
10586 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, ENC_BIG_ENDIAN, &seq_no);
10588 offset += 2;
10590 if (gtp_hdr->flags & GTP_PN_MASK) {
10591 proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, ENC_NA, &pdu_no);
10593 offset++;
10595 if (gtp_hdr->flags & GTP_E_MASK) {
10596 proto_item* hdr_ext_item;
10597 hdr_ext_item = proto_tree_add_item_ret_uint(gtp_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, ENC_NA, &next_hdr);
10598 offset++;
10599 /* Add each extension header found. */
10600 while (next_hdr != 0) {
10601 tf = proto_tree_add_item(gtp_tree, hf_gtp_ext_hdr, tvb, offset, 0, ENC_NA);
10602 ext_tree = proto_item_add_subtree(tf, ett_gtp_ext_hdr);
10603 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);
10604 proto_item_set_len(tf, ext_hdr_length * 4);
10605 if (ext_hdr_length == 0) {
10606 expert_add_info_format(pinfo, ext_hdr_len_item, &ei_gtp_ext_length_mal,
10607 "Extension header length is zero");
10608 return tvb_reported_length(tvb);
10610 offset++;
10611 proto_item_append_text(tf, " (%s)", val_to_str_const(next_hdr, next_extension_header_fieldvals, "Unknown"));
10613 switch (next_hdr) {
10615 case GTP_EXT_HDR_UDP_PORT:
10616 /* UDP Port
10617 * 3GPP 29.281 v9.0.0, 5.2.2.1 UDP Port
10618 * "This extension header may be transmitted in
10619 * Error Indication messages to provide the UDP
10620 * Source Port of the G-PDU that triggered the
10621 * Error Indication. It is 4 octets long, and
10622 * therefore the Length field has value 1"
10624 if (ext_hdr_length == 1) {
10625 /* UDP Port of source */
10626 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_udp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
10627 } else {
10628 /* Bad length */
10629 expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the UDP Port Extension header should be 1.");
10631 break;
10633 case GTP_EXT_HDR_RAN_CONT:
10634 /* RAN Container
10635 * 3GPP 29.281 v15.2.0, 5.2.2.4 RAN Container
10636 * This extension header may be transmitted in
10637 * a G-PDU over the X2 user plane interface
10638 * between the eNBs. The RAN Container has a
10639 * variable length and its content is specified
10640 * in 3GPP TS 36.425 [25]. A G-PDU message with
10641 * this extension header may be sent without a T-PDU.
10643 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_ran_cont, tvb, offset, (4*ext_hdr_length)-1, ENC_NA);
10644 break;
10646 case GTP_EXT_HDR_LONG_PDCP_PDU:
10647 /* Long PDCP PDU Number
10648 * 3GPP 29.281 v15.2.0, 5.2.2.2A Long PDCP PDU Number
10649 * This extension header is used for direct X2 or
10650 * indirect S1 DL data forwarding during a Handover
10651 * procedure between two eNBs. The Long PDCP PDU number
10652 * extension header is 8 octets long, and therefore
10653 * the Length field has value 2.
10654 * The PDCP PDU number field of the Long PDCP PDU number
10655 * extension header has a maximum value which requires 18
10656 * bits (see 3GPP TS 36.323 [24]). Bit 2 of octet 2 is
10657 * the most significant bit and bit 1 of octet 4 is the
10658 * least significant bit, see Figure 5.2.2.2A-1. Bits 8 to
10659 * 3 of octet 2, and Bits 8 to 1 of octets 5 to 7 shall be
10660 * set to 0.
10661 * NOTE: A G-PDU which includes a PDCP PDU Number contains
10662 * either the extension header PDCP PDU Number or Long PDCP
10663 * PDU Number.
10665 if (ext_hdr_length == 2) {
10666 proto_tree_add_bits_item(ext_tree, hf_gtp_ext_hdr_spare_bits, tvb, offset<<3, 6, ENC_BIG_ENDIAN);
10667 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_long_pdcp_sn, tvb, offset, 3, ENC_BIG_ENDIAN);
10668 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_spare_bytes, tvb, offset+3, 3, ENC_NA);
10669 } else {
10670 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.");
10672 break;
10674 case GTP_EXT_HDR_XW_RAN_CONT:
10675 /* Xw RAN Container
10676 * 3GPP 29.281 v15.2.0, 5.2.2.5 Xw RAN Container
10677 * This extension header may be transmitted in a
10678 * G-PDU over the Xw user plane interface between
10679 * the eNB and the WLAN Termination (WT). The Xw
10680 * RAN Container has a variable length and its
10681 * content is specified in 3GPP TS 36.464 [27].
10682 * A G-PDU message with this extension header may
10683 * be sent without a T-PDU.
10685 proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_xw_ran_cont, tvb, offset, (4*ext_hdr_length)-1, ENC_NA);
10686 break;
10688 case GTP_EXT_HDR_NR_RAN_CONT:
10689 /* NR RAN Container
10690 * 3GPP 29.281 v15.2.0, 5.2.2.6 NR RAN Container
10691 * This extension header may be transmitted in a
10692 * G-PDU over the X2-U, Xn-U and F1-U user plane
10693 * interfaces, within NG-RAN and, for EN-DC, within
10694 * E-UTRAN. The NR RAN Container has a variable
10695 * length and its content is specified in 3GPP TS
10696 * 38.425 [30]. A G-PDU message with this extension
10697 * header may be sent without a T-PDU.
10699 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");
10700 addRANContParameter(tvb, pinfo, ran_cont_tree, offset, (ext_hdr_length * 4) - 1);
10701 break;
10703 case GTP_EXT_HDR_PDU_SESSION_CONT:
10705 /* PDU Session Container
10706 * 3GPP 29.281 v15.2.0, 5.2.2.7 PDU Session Container
10707 * This extension header may be transmitted in a G-PDU
10708 * over the N3 and N9 user plane interfaces, between
10709 * NG-RAN and UPF, or between two UPFs. The PDU Session
10710 * Container has a variable length and its content is
10711 * specified in 3GPP TS 38.415 [31].
10713 static int * const flags1_dl[] = {
10714 &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
10715 &hf_gtp_ext_hdr_pdu_ses_cont_snp_dl,
10716 &hf_gtp_ext_hdr_pdu_ses_cont_msnp,
10717 &hf_gtp_spare_b0,
10718 NULL
10720 static int * const flags1_ul[] = {
10721 &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
10722 &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind,
10723 &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind,
10724 &hf_gtp_ext_hdr_pdu_ses_cont_snp_ul,
10725 NULL
10727 static int * const flags2[] = {
10728 &hf_gtp_ext_hdr_pdu_ses_cont_ppp,
10729 &hf_gtp_ext_hdr_pdu_ses_cont_rqi,
10730 &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
10731 NULL
10733 static int * const flags3[] = {
10734 &hf_gtp_ext_hdr_pdu_ses_cont_ppi,
10735 &hf_gtp_spare_b4b0,
10736 NULL
10738 static int * const flags4[] = {
10739 &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind,
10740 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag,
10741 &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
10742 NULL
10744 static int * const flags5[] = {
10745 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7,
10746 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6,
10747 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5,
10748 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4,
10749 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3,
10750 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2,
10751 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1,
10752 &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0,
10753 NULL
10755 static int * const flags6[] = {
10756 &hf_gtp_spare_b7b1,
10757 &hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind,
10758 NULL
10761 proto_tree *pdu_ses_cont_tree;
10762 uint32_t pdu_type;
10763 uint64_t flags1_val, flags2_val, flags4_val, flags5_val;
10764 int curr_offset = offset;
10766 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");
10767 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);
10768 switch (pdu_type) {
10769 case 0:
10770 /* PDU Type: DL PDU SESSION INFORMATION (0) */
10771 /* PDU Type QMP SNP MSNP Spare */
10772 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags1_dl, ENC_BIG_ENDIAN, &flags1_val);
10773 curr_offset++;
10774 /* PPP RQI QoS Flow Identifier */
10775 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags2, ENC_BIG_ENDIAN, &flags2_val);
10776 curr_offset++;
10777 if (flags2_val & 0x80) {
10778 /* PPI Spare */
10779 proto_tree_add_bitmask_list(pdu_ses_cont_tree, tvb, curr_offset, 1, flags3, ENC_BIG_ENDIAN);
10780 curr_offset++;
10782 if (flags1_val & 0x08) {
10783 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);
10784 curr_offset += 8;
10786 if (flags1_val & 0x04) {
10787 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);
10788 curr_offset += 3;
10790 if (flags1_val & 0x02) {
10791 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);
10792 //curr_offset += 4;
10794 break;
10795 case 1:
10796 /* PDU Type: UL PDU SESSION INFORMATION (1)*/
10797 /* PDU Type QMP DL Delay Ind UL Delay Ind SNP */
10798 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags1_ul, ENC_BIG_ENDIAN, &flags1_val);
10799 curr_offset++;
10800 /* N3/N9 Delay ind New IE Flag QoS Flow Identifier */
10801 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags4, ENC_BIG_ENDIAN, &flags4_val);
10802 curr_offset++;
10803 if (flags1_val & 0x08) {
10804 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);
10805 curr_offset += 8;
10806 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);
10807 curr_offset += 8;
10808 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);
10809 curr_offset += 8;
10811 if (flags1_val & 0x04) {
10812 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);
10813 curr_offset += 4;
10815 if (flags1_val & 0x02) {
10816 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);
10817 curr_offset += 4;
10819 if (flags1_val & 0x01) {
10820 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);
10821 curr_offset += 3;
10823 if (flags4_val & 0x80) {
10824 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);
10825 curr_offset += 4;
10827 if (flags4_val & 0x40) {
10828 proto_tree_add_bitmask_list_ret_uint64(pdu_ses_cont_tree, tvb, curr_offset, 1, flags5, ENC_BIG_ENDIAN, &flags5_val);
10829 curr_offset++;
10830 if (flags5_val & 0x01) {
10831 proto_tree_add_bitmask_list(pdu_ses_cont_tree, tvb, curr_offset, 1, flags6, ENC_BIG_ENDIAN);
10832 //curr_offset++;
10835 break;
10836 default:
10837 proto_tree_add_expert(pdu_ses_cont_tree, pinfo, &ei_gtp_unknown_pdu_type, tvb, offset, (ext_hdr_length * 4) - 1);
10838 break;
10841 break;
10843 case GTP_EXT_HDR_PDCP_SN:
10844 /* PDCP PDU
10845 * 3GPP 29.281 v9.0.0, 5.2.2.2 PDCP PDU Number
10847 * "This extension header is transmitted, for
10848 * example in UTRAN, at SRNS relocation time,
10849 * to provide the PDCP sequence number of not
10850 * yet acknowledged N-PDUs. It is 4 octets long,
10851 * and therefore the Length field has value 1.
10853 * When used during a handover procedure between
10854 * two eNBs at the X2 interface (direct DL data
10855 * forwarding) or via the S1 interface (indirect
10856 * DL data forwarding) in E-UTRAN, bit 8 of octet
10857 * 2 is spare and shall be set to zero.
10859 * Wireshark Note: TS 29.060 does not define bit
10860 * 5-6 as spare, so no check is possible unless
10861 * a preference is used.
10863 /* First byte is length (should be 1) */
10864 if (ext_hdr_length == 1) {
10865 proto_item* ext_item;
10867 ext_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_pdcpsn, tvb, offset, 2, ENC_BIG_ENDIAN, &ext_hdr_pdcpsn);
10868 if (ext_hdr_pdcpsn & 0x8000) {
10869 expert_add_info(pinfo, ext_item, &ei_gtp_ext_hdr_pdcpsn);
10871 } else {
10872 expert_add_info_format(pinfo, ext_tree, &ei_gtp_ext_length_warn, "The length field for the PDCP SN Extension header should be 1.");
10874 break;
10876 case GTP_EXT_HDR_SUSPEND_REQ:
10877 /* Suspend Request */
10878 break;
10880 case GTP_EXT_HDR_SUSPEND_RESP:
10881 /* Suspend Response */
10882 break;
10884 default:
10886 tvbuff_t * ext_hdr_tvb;
10887 gtp_hdr_ext_info_t gtp_hdr_ext_info;
10889 gtp_hdr_ext_info.hdr_ext_item = hdr_ext_item;
10890 /* NOTE Type and length included in the call */
10891 ext_hdr_tvb = tvb_new_subset_remaining(tvb, offset - 2);
10892 dissector_try_uint_with_data(gtp_hdr_ext_dissector_table, next_hdr, ext_hdr_tvb, pinfo, ext_tree, false, &gtp_hdr_ext_info);
10893 break;
10896 offset += ext_hdr_length*4 - 2;
10897 hdr_ext_item = proto_tree_add_item_ret_uint(ext_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, ENC_NA, &next_hdr);
10898 offset++;
10900 } else
10901 offset++;
10903 break;
10904 default:
10905 break;
10909 if (gtp_hdr->message != GTP_MSG_TPDU) {
10910 uint8_t version = gtp_version;
10911 /* GTP' protocol version has different meaning rather GTP.
10912 * According to 3GPP TS 32.295:
10913 * - GTP' version 1 is the same as version 0 but has, in addendum, the duplicate CDR prevention
10914 * mechanism, introduced in GSM 12.15 version 7.2.1 (1999-07) of the GPRS charging specification.
10915 * - GTP' version 2 is the same as version 1, but the header is just 6 octets long
10917 * Decode GTP' versions v1/v2 as v0.
10919 if (gtp_prime) {
10920 version = 0;
10923 /* Dissect IEs */
10924 mandatory = 0; /* check order of GTP fields against ETSI */
10925 while (tvb_reported_length_remaining(tvb, offset) > 0) {
10926 decoder = NULL;
10927 ext_hdr_val = tvb_get_uint8(tvb, offset);
10928 if (g_gtp_etsi_order) {
10929 checked_field = check_field_presence_and_decoder(version, gtp_hdr->message, ext_hdr_val, &mandatory, &decoder);
10930 switch (checked_field) {
10931 case -2:
10932 expert_add_info(pinfo, message_item, &ei_gtp_message_not_found);
10933 break;
10934 case -1:
10935 expert_add_info(pinfo, message_item, &ei_gtp_field_not_present);
10936 break;
10937 case 0:
10938 break;
10939 default:
10940 expert_add_info_format(pinfo, message_item, &ei_gtp_wrong_next_field, "[WARNING] wrong next field, should be: %s",
10941 val_to_str_ext_const(checked_field, &gtp_val_ext, "Unknown extension field"));
10942 break;
10946 if (decoder == NULL) {
10947 i = -1;
10948 while (gtpopt[++i].optcode)
10949 if (gtpopt[i].optcode == ext_hdr_val)
10950 break;
10951 decoder = gtpopt[i].decode;
10954 offset = offset + (*decoder) (tvb, offset, pinfo, gtp_tree, args);
10957 if (args && !PINFO_FD_VISITED(pinfo)) {
10958 /* We insert the lists inside the table*/
10959 fill_map(args->teid_list, args->ip_list, pinfo->num);
10961 /* Use sequence number to track Req/Resp pairs except GTP' message "Data Record Transfer Response".
10962 * For "Data Record Transfer Response" sequence numbers are analysed inside decoder of TLV "Requests Responded".
10964 if (has_SN && gtp_hdr->message != GTP_MSG_DATA_TRANSF_RESP) {
10965 uint8_t cause_aux = 128; /* Cause accepted by default. Only used when args is NULL */
10966 if (args) {
10967 cause_aux = args->last_cause;
10969 gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr->message, gtp_info, cause_aux);
10970 /*pass packet to tap for response time reporting*/
10971 if (gcrp) {
10972 tap_queue_packet(gtp_tap,pinfo,gcrp);
10976 if (args) {
10977 track_gtp_session(tvb, pinfo, gtp_tree, gtp_hdr, args->teid_list, args->ip_list, args->last_teid, args->last_ip);
10979 proto_item_set_end(ti, tvb, offset);
10981 if ((gtp_hdr->message == GTP_MSG_TPDU) && (tvb_reported_length_remaining(tvb, offset) > 0)) {
10982 switch (dissect_tpdu_as) {
10983 case GTP_TPDU_AS_TPDU_HEUR: {
10984 heur_dtbl_entry_t *hdtbl_entry;
10985 tvbuff_t *next_tvb = tvb_new_subset_remaining(tvb, offset);
10986 if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) {
10987 col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP/");
10988 } else {
10989 proto_tree_add_item(tree, hf_gtp_tpdu_data, next_tvb, 0, -1, ENC_NA);
10991 break;
10993 case GTP_TPDU_AS_PDCP_LTE:
10994 dissect_gtp_tpdu_as_pdcp_lte_info(tvb, pinfo, tree, gtp_hdr, offset);
10995 break;
10996 case GTP_TPDU_AS_PDCP_NR:
10997 dissect_gtp_tpsu_as_pdcp_nr_info(tvb, pinfo, tree, gtp_hdr, offset);
10998 break;
10999 case GTP_TPDU_AS_SYNC:
11000 dissect_gtp_tpdu_by_handle(sync_handle, tvb, pinfo, tree, offset + acfield_len);
11001 break;
11002 case GTP_TPDU_AS_ETHERNET:
11003 dissect_gtp_tpdu_by_handle(eth_handle, tvb, pinfo, tree, offset);
11004 break;
11005 case GTP_TPDU_AS_CUSTOM:
11006 /* Call a custom dissector if available */
11007 if (gtp_tpdu_custom_handle ||
11008 (gtp_tpdu_custom_handle = find_dissector("gtp_tpdu_custom"))) {
11009 dissect_gtp_tpdu_by_handle(gtp_tpdu_custom_handle, tvb, pinfo, tree, offset);
11010 } else {
11011 proto_tree_add_item(tree, hf_gtp_tpdu_data, tvb, offset, -1, ENC_NA);
11013 break;
11014 default:
11015 proto_tree_add_item(tree, hf_gtp_tpdu_data, tvb, offset, -1, ENC_NA);
11016 break;
11020 tap_queue_packet(gtpv1_tap,pinfo, gtp_hdr);
11022 return tvb_reported_length(tvb);
11025 static int
11026 dissect_gtpprime(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
11027 void *private_data _U_)
11029 return dissect_gtp_common(tvb, pinfo, tree);
11032 static int
11033 dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
11034 void *private_data _U_)
11036 uint8_t version;
11039 * Do we have enough data to check the first byte?
11041 if (!tvb_bytes_exist(tvb, 0, 1)) {
11042 /* No. */
11043 return 0;
11047 * If this is GTPv2-C call the gtpv2 dissector if present
11048 * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
11050 version = tvb_get_uint8(tvb,0)>>5;
11051 if (version > 2) {
11052 /* Unknown version - reject the packet */
11053 return 0;
11055 if (version == 2) {
11056 /* GTPv2-C 3GPP TS 29.274 */
11057 if (gtpv2_handle) {
11058 call_dissector(gtpv2_handle, tvb, pinfo, tree);
11059 return tvb_reported_length(tvb);
11063 return dissect_gtp_common(tvb, pinfo, tree);
11066 // Very minimal heuristic dissector for ethernet that recognizes ethernet with a limited
11067 // set of protocols, optionally with a set of vlan tags.
11068 // This dissector is not implemented in the packet-eth.c file as it is too simplistic
11069 // for general purpose.
11070 static bool
11071 dissect_eth_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
11073 int offset;
11074 uint16_t ethertype;
11076 if (tvb_reported_length(tvb) < 14) {
11077 return false;
11080 // skip both mac-addresses, no information to be gained from them
11081 offset = 12;
11083 ethertype = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN);
11084 offset += 2;
11086 if (ethertype == ETHERTYPE_QINQ_OLD || ethertype == ETHERTYPE_IEEE_802_1AD)
11088 if (tvb_reported_length_remaining(tvb, offset) < 4) {
11089 return false;
11091 ethertype = tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN);
11092 if (ethertype != ETHERTYPE_VLAN) {
11093 return false;
11095 offset += 4;
11097 while (ethertype == ETHERTYPE_VLAN)
11099 if (tvb_reported_length_remaining(tvb, offset) < 4) {
11100 return false;
11102 ethertype = tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN);
11103 offset += 4;
11106 switch (ethertype) {
11107 case ETHERTYPE_IP:
11108 case ETHERTYPE_IPv6:
11109 case ETHERTYPE_ARP:
11110 case ETHERTYPE_PPPOED:
11111 case ETHERTYPE_PPPOES:
11112 call_dissector(eth_handle, tvb, pinfo, tree);
11113 return true;
11116 return false;
11119 static void
11120 gtp_init(void)
11122 gtp_session_count = 1;
11125 void
11126 proto_register_gtp(void)
11128 module_t *gtp_module;
11129 expert_module_t* expert_gtp;
11130 unsigned i;
11131 unsigned last_offset;
11133 static hf_register_info hf_gtp[] = {
11135 {&hf_gtp_ie_id,
11136 { "IE Id", "gtp.ie_id",
11137 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtp_val_ext, 0x0,
11138 NULL, HFILL}
11140 {&hf_gtp_response_in,
11141 { "Response In", "gtp.response_in",
11142 FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
11143 "The response to this GTP request is in this frame", HFILL}
11145 {&hf_gtp_response_to,
11146 { "Response To", "gtp.response_to",
11147 FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
11148 "This is a response to the GTP request in this frame", HFILL}
11150 {&hf_gtp_time,
11151 { "Time", "gtp.time",
11152 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
11153 "The time between the Request and the Response", HFILL}
11155 {&hf_gtp_apn,
11156 { "APN", "gtp.apn",
11157 FT_STRING, BASE_NONE, NULL, 0,
11158 "Access Point Name", HFILL}
11160 {&hf_gtp_cause,
11161 { "Cause", "gtp.cause",
11162 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0,
11163 "Cause of operation", HFILL}
11165 {&hf_gtp_chrg_char,
11166 { "Charging characteristics", "gtp.chrg_char",
11167 FT_UINT16, BASE_DEC, NULL, 0,
11168 NULL, HFILL}
11170 {&hf_gtp_chrg_char_s,
11171 { "Spare", "gtp.chrg_char_s",
11172 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S,
11173 NULL, HFILL}
11175 {&hf_gtp_chrg_char_n,
11176 { "Normal charging", "gtp.chrg_char_n",
11177 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N,
11178 NULL, HFILL}
11180 {&hf_gtp_chrg_char_p,
11181 { "Prepaid charging", "gtp.chrg_char_p",
11182 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P,
11183 NULL, HFILL}
11185 {&hf_gtp_chrg_char_f,
11186 { "Flat rate charging", "gtp.chrg_char_f",
11187 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F,
11188 NULL, HFILL}
11190 {&hf_gtp_chrg_char_h,
11191 { "Hot billing charging", "gtp.chrg_char_h",
11192 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H,
11193 NULL, HFILL}
11195 {&hf_gtp_chrg_char_r,
11196 { "Reserved", "gtp.chrg_char_r",
11197 FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R,
11198 NULL, HFILL}
11200 {&hf_gtp_chrg_id,
11201 { "Charging ID", "gtp.chrg_id",
11202 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11203 NULL, HFILL}
11205 {&hf_gtp_chrg_ipv4,
11206 { "CG address IPv4", "gtp.chrg_ipv4",
11207 FT_IPv4, BASE_NONE, NULL, 0,
11208 "Charging Gateway address IPv4", HFILL}
11210 {&hf_gtp_chrg_ipv6,
11211 { "CG address IPv6", "gtp.chrg_ipv6",
11212 FT_IPv6, BASE_NONE, NULL, 0,
11213 "Charging Gateway address IPv6", HFILL}
11215 {&hf_gtp_ext_flow_label,
11216 { "Flow Label Data I", "gtp.ext_flow_label",
11217 FT_UINT16, BASE_HEX, NULL, 0,
11218 NULL, HFILL}
11220 {&hf_gtp_ext_id,
11221 { "Extension identifier", "gtp.ext_id",
11222 FT_UINT16, BASE_ENTERPRISES, STRINGS_ENTERPRISES, 0,
11223 "Private Enterprise number", HFILL}
11225 {&hf_gtp_ext_val,
11226 { "Extension value", "gtp.ext_val",
11227 FT_BYTES, BASE_NONE, NULL, 0,
11228 NULL, HFILL}
11230 {&hf_gtp_flags,
11231 { "Flags", "gtp.flags",
11232 FT_UINT8, BASE_HEX, NULL, 0,
11233 "Ver/PT/Spare...", HFILL}
11235 {&hf_gtp_ext_hdr,
11236 { "Extension header", "gtp.ext_hdr",
11237 FT_NONE, BASE_NONE, NULL, 0,
11238 NULL, HFILL}
11240 {&hf_gtp_ext_hdr_next,
11241 { "Next extension header type", "gtp.ext_hdr.next",
11242 FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0,
11243 NULL, HFILL}
11245 {&hf_gtp_ext_hdr_ran_cont,
11246 { "RAN Container", "gtp.ext_hdr.ran_cont",
11247 FT_BYTES, BASE_NONE, NULL, 0,
11248 NULL, HFILL}
11250 {&hf_gtp_ext_hdr_spare_bits,
11251 { "Spare", "gtp.ext_hdr.spare_bits",
11252 FT_UINT8, BASE_HEX, NULL, 0,
11253 NULL, HFILL}
11255 {&hf_gtp_ext_hdr_spare_bytes,
11256 { "Spare", "gtp.ext_hdr.spare_bytes",
11257 FT_BYTES, BASE_NONE, NULL, 0,
11258 NULL, HFILL}
11260 {&hf_gtp_ext_hdr_long_pdcp_sn,
11261 { "Long PDCP Sequence Number", "gtp.ext_hdr.long_pdcp_sn",
11262 FT_UINT24, BASE_DEC, NULL, 0,
11263 NULL, HFILL}
11265 {&hf_gtp_ext_hdr_xw_ran_cont,
11266 { "Xw RAN Container", "gtp.ext_hdr.xw_ran_cont",
11267 FT_BYTES, BASE_NONE, NULL, 0,
11268 NULL, HFILL}
11271 { &hf_gtp_ext_hdr_pdu_ses_cont_pdu_type,
11272 { "PDU Type", "gtp.ext_hdr.pdu_ses_con.pdu_type",
11273 FT_UINT8, BASE_DEC, VALS(gtp_ext_hdr_pdu_ses_cont_pdu_type_vals), 0xf0,
11274 NULL, HFILL}
11276 { &hf_gtp_ext_hdr_pdu_ses_cont_qmp,
11277 { "QoS Monitoring Packet", "gtp.ext_hdr.pdu_ses_con.qmp",
11278 FT_BOOLEAN, 8, TFS(&tfs_used_notused), 0x08,
11279 NULL, HFILL}
11281 { &hf_gtp_ext_hdr_pdu_ses_cont_snp_dl,
11282 { "Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.snp",
11283 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11284 NULL, HFILL}
11286 { &hf_gtp_ext_hdr_pdu_ses_cont_msnp,
11287 { "MBS Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.msnp",
11288 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11289 NULL, HFILL}
11291 { &hf_gtp_ext_hdr_pdu_ses_cont_ppp,
11292 { "Paging Policy Presence (PPP)", "gtp.ext_hdr.pdu_ses_cont.ppp",
11293 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11294 NULL, HFILL}
11296 { &hf_gtp_ext_hdr_pdu_ses_cont_rqi,
11297 { "Reflective QoS Indicator (RQI)", "gtp.ext_hdr.pdu_ses_cont.rqi",
11298 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11299 NULL, HFILL}
11301 { &hf_gtp_ext_hdr_pdu_ses_cont_qos_flow_id,
11302 { "QoS Flow Identifier (QFI)", "gtp.ext_hdr.pdu_ses_con.qos_flow_id",
11303 FT_UINT8, BASE_DEC, NULL, 0x3f,
11304 NULL, HFILL}
11306 { &hf_gtp_ext_hdr_pdu_ses_cont_ppi,
11307 { "Paging Policy Indicator (PPI)", "gtp.ext_hdr.pdu_ses_cont.ppi",
11308 FT_UINT8, BASE_DEC, NULL, 0xe0,
11309 NULL, HFILL}
11311 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp,
11312 { "DL Sending Time Stamp", "gtp.ext_hdr.pdu_ses_cont.dl_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_qfi_sn,
11317 { "DL QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.dl_qfi_sn",
11318 FT_UINT24, BASE_DEC, NULL, 0,
11319 NULL, HFILL}
11321 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_mbs_qfi_sn,
11322 { "DL MBS QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.dl_mbs_qfi_sn",
11323 FT_UINT32, BASE_DEC, NULL, 0,
11324 NULL, HFILL}
11326 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_ind,
11327 { "DL Delay Ind", "gtp.ext_hdr.pdu_ses_con.dl_delay_ind",
11328 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11329 NULL, HFILL}
11331 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_ind,
11332 { "UL Delay Ind", "gtp.ext_hdr.pdu_ses_con.ul_delay_ind",
11333 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11334 NULL, HFILL}
11336 { &hf_gtp_ext_hdr_pdu_ses_cont_snp_ul,
11337 { "Sequence Number Presence", "gtp.ext_hdr.pdu_ses_con.snp",
11338 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
11339 NULL, HFILL}
11341 { &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_ind,
11342 { "N3/N9 Delay Ind", "gtp.ext_hdr.pdu_ses_con.n3_n9_delay_ind",
11343 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11344 NULL, HFILL}
11346 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag,
11347 { "New IE Flag", "gtp.ext_hdr.pdu_ses_con.new_ie_flag",
11348 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11349 NULL, HFILL}
11351 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_send_time_stamp_repeat,
11352 { "DL Sending Time Stamp Repeated", "gtp.ext_hdr.pdu_ses_cont.dl_send_time_stamp_repeat",
11353 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11354 NULL, HFILL}
11356 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_recv_time_stamp,
11357 { "DL Received Time Stamp", "gtp.ext_hdr.pdu_ses_cont.dl_recv_time_stamp",
11358 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11359 NULL, HFILL}
11361 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_send_time_stamp,
11362 { "UL Sending Time Stamp", "gtp.ext_hdr.pdu_ses_cont.ul_send_time_stamp",
11363 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_NTP_UTC, NULL, 0,
11364 NULL, HFILL}
11366 { &hf_gtp_ext_hdr_pdu_ses_cont_dl_delay_result,
11367 { "DL Delay Result", "gtp.ext_hdr.pdu_ses_cont.dl_delay_result",
11368 FT_UINT32, BASE_DEC, NULL, 0,
11369 NULL, HFILL}
11371 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_delay_result,
11372 { "UL Delay Result", "gtp.ext_hdr.pdu_ses_cont.ul_delay_result",
11373 FT_UINT32, BASE_DEC, NULL, 0,
11374 NULL, HFILL}
11376 { &hf_gtp_ext_hdr_pdu_ses_cont_ul_qfi_sn,
11377 { "UL QFI Sequence Number", "gtp.ext_hdr.pdu_ses_cont.ul_qfi_sn",
11378 FT_UINT24, BASE_DEC, NULL, 0,
11379 NULL, HFILL}
11381 { &hf_gtp_ext_hdr_pdu_ses_cont_n3_n9_delay_result,
11382 { "N3/N9 Delay Result", "gtp.ext_hdr.pdu_ses_cont.n3_n9_delay_result",
11383 FT_UINT32, BASE_DEC, NULL, 0,
11384 NULL, HFILL}
11386 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_7,
11387 { "New IE Flag 7", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_7",
11388 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x80,
11389 NULL, HFILL}
11391 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_6,
11392 { "New IE Flag 6", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_6",
11393 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40,
11394 NULL, HFILL}
11396 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_5,
11397 { "New IE Flag 5", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_5",
11398 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
11399 NULL, HFILL}
11401 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_4,
11402 { "New IE Flag 4", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_4",
11403 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10,
11404 NULL, HFILL}
11406 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_3,
11407 { "New IE Flag 3", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_3",
11408 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
11409 NULL, HFILL}
11411 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_2,
11412 { "New IE Flag 2", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_2",
11413 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
11414 NULL, HFILL}
11416 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_1,
11417 { "New IE Flag 1", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_1",
11418 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
11419 NULL, HFILL}
11421 { &hf_gtp_ext_hdr_pdu_ses_cont_new_ie_flag_0,
11422 { "New IE Flag 0", "gtp.ext_hdr.pdu_ses_cont.new_ie_flag_0",
11423 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
11424 NULL, HFILL}
11426 { &hf_gtp_ext_hdr_pdu_ses_cont_d1_ul_pdcp_delay_result_ind,
11427 { "D1 UL PDCP Delay Result Ind", "gtp.ext_hdr.pdu_ses_cont.d1_ul_pdcp_delay_result_ind",
11428 FT_BOOLEAN, 8, TFS(&tfs_included_not_included), 0x01,
11429 NULL, HFILL}
11432 {&hf_pdcp_cont,
11433 { "PDCP Protocol", "gtp.pdcp",
11434 FT_BYTES, BASE_NONE, NULL, 0,
11435 NULL, HFILL}
11437 {&hf_gtp_ext_hdr_pdcpsn,
11438 { "PDCP Sequence Number", "gtp.ext_hdr.pdcp_sn",
11439 FT_UINT16, BASE_DEC, NULL, 0,
11440 NULL, HFILL}
11442 {&hf_gtp_ext_hdr_udp_port,
11443 { "UDP Port", "gtp.ext_hdr.udp_port",
11444 FT_UINT16, BASE_DEC, NULL, 0,
11445 NULL, HFILL}
11447 {&hf_gtp_ext_hdr_length,
11448 { "Extension Header Length", "gtp.ext_hdr.length",
11449 FT_UINT8, BASE_DEC, NULL, 0,
11450 NULL, HFILL}
11452 {&hf_gtp_flags_ver,
11453 { "Version", "gtp.flags.version",
11454 FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
11455 "GTP Version", HFILL}
11457 {&hf_gtp_prime_flags_ver,
11458 { "Version", "gtp.prim.flags.version",
11459 FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK,
11460 "GTP' Version", HFILL}
11462 {&hf_gtp_flags_pt,
11463 { "Protocol type", "gtp.flags.payload",
11464 FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
11465 NULL, HFILL}
11467 {&hf_gtp_flags_spare1,
11468 { "Reserved", "gtp.flags.reserved",
11469 FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
11470 "Reserved (shall be sent as '111' )", HFILL}
11472 {&hf_gtp_flags_hdr_length,
11473 { "Header length", "gtp.flags.hdr_length",
11474 FT_BOOLEAN, 8, TFS(&gtp_hdr_length_vals), 0x01,
11475 NULL, HFILL}
11477 {&hf_gtp_flags_snn,
11478 { "Is SNDCP N-PDU included?", "gtp.flags.snn",
11479 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_SNN_MASK,
11480 "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}
11482 {&hf_gtp_flags_spare2,
11483 { "Reserved", "gtp.flags.reserved",
11484 FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK,
11485 "Reserved (shall be sent as '1' )", HFILL}
11487 {&hf_gtp_flags_e,
11488 { "Is Next Extension Header present?", "gtp.flags.e",
11489 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_E_MASK,
11490 "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}
11492 {&hf_gtp_flags_s,
11493 { "Is Sequence Number present?", "gtp.flags.s",
11494 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_S_MASK,
11495 "Is Sequence Number present? (1 = yes, 0 = no)", HFILL}
11497 {&hf_gtp_flags_pn,
11498 { "Is N-PDU number present?", "gtp.flags.pn",
11499 FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_PN_MASK,
11500 "Is N-PDU number present? (1 = yes, 0 = no)", HFILL}
11502 {&hf_gtp_flow_ii,
11503 { "Flow Label Data II", "gtp.flow_ii",
11504 FT_UINT16, BASE_DEC, NULL, 0,
11505 "Downlink flow label data", HFILL}
11507 {&hf_gtp_flow_label,
11508 { "Flow label", "gtp.flow_label",
11509 FT_UINT16, BASE_HEX, NULL, 0,
11510 NULL, HFILL}
11512 {&hf_gtp_flow_sig,
11513 { "Flow label Signalling", "gtp.flow_sig",
11514 FT_UINT16, BASE_HEX, NULL, 0,
11515 NULL, HFILL}
11517 {&hf_gtp_gsn_addr_len,
11518 { "GSN Address Length", "gtp.gsn_addr_len",
11519 FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK,
11520 NULL, HFILL}
11522 {&hf_gtp_gsn_addr_type,
11523 { "GSN Address Type", "gtp.gsn_addr_type",
11524 FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK,
11525 NULL, HFILL}
11527 {&hf_gtp_gsn_ipv4,
11528 { "GSN address IPv4", "gtp.gsn_ipv4",
11529 FT_IPv4, BASE_NONE, NULL, 0,
11530 NULL, HFILL}
11532 {&hf_gtp_gsn_ipv6,
11533 { "GSN address IPv6", "gtp.gsn_ipv6",
11534 FT_IPv6, BASE_NONE, NULL, 0,
11535 NULL, HFILL}
11537 {&hf_gtp_length,
11538 { "Length", "gtp.length",
11539 FT_UINT16, BASE_DEC, NULL, 0,
11540 "Length (i.e. number of octets after TID or TEID)", HFILL}
11542 {&hf_gtp_map_cause,
11543 { "MAP cause", "gtp.map_cause",
11544 FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0,
11545 NULL, HFILL}
11547 {&hf_gtp_message_type,
11548 { "Message Type", "gtp.message",
11549 FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gtp_message_type_ext, 0x0,
11550 "GTP Message Type", HFILL}
11552 {&hf_gtp_ms_reason,
11553 { "MS not reachable reason", "gtp.ms_reason",
11554 FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0,
11555 NULL, HFILL}
11557 {&hf_gtp_ms_valid,
11558 { "MS validated", "gtp.ms_valid",
11559 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11560 NULL, HFILL}
11562 {&hf_gtp_node_ipv4,
11563 { "Node address IPv4", "gtp.node_ipv4",
11564 FT_IPv4, BASE_NONE, NULL, 0,
11565 "Recommended node address IPv4", HFILL}
11567 {&hf_gtp_node_ipv6,
11568 { "Node address IPv6", "gtp.node_ipv6",
11569 FT_IPv6, BASE_NONE, NULL, 0,
11570 "Recommended node address IPv6", HFILL}
11572 {&hf_gtp_node_name,
11573 { "Node name", "gtp.node_name",
11574 FT_UINT_STRING, BASE_NONE, NULL, 0,
11575 "Diameter Identity of the node", HFILL}
11577 {&hf_gtp_node_realm,
11578 { "Node realm", "gtp.node_realm",
11579 FT_UINT_STRING, BASE_NONE, NULL, 0,
11580 "Diameter Realm Identity of the node", HFILL}
11582 {&hf_gtp_npdu_number,
11583 { "N-PDU Number", "gtp.npdu_number",
11584 FT_UINT8, BASE_HEX, NULL, 0,
11585 NULL, HFILL}
11587 {&hf_gtp_nsapi,
11588 { "NSAPI", "gtp.nsapi",
11589 FT_UINT8, BASE_DEC, NULL, 0x0f,
11590 "Network layer Service Access Point Identifier", HFILL}
11592 {&hf_gtp_qos_version,
11593 { "Version", "gtp.qos_version",
11594 FT_UINT8, BASE_HEX, NULL, 0,
11595 "Version of the QoS Profile", HFILL}
11597 {&hf_gtp_qos_spare1,
11598 { "Spare", "gtp.qos_spare1",
11599 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK,
11600 "Spare (shall be sent as '00' )", HFILL}
11602 {&hf_gtp_qos_delay,
11603 { "QoS delay", "gtp.qos_delay",
11604 FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK,
11605 "Quality of Service Delay Class", HFILL}
11607 {&hf_gtp_qos_reliability,
11608 { "QoS reliability", "gtp.qos_reliability",
11609 FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
11610 "Quality of Service Reliability Class", HFILL}
11612 {&hf_gtp_qos_peak,
11613 { "QoS peak", "gtp.qos_peak",
11614 FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK,
11615 "Quality of Service Peak Throughput", HFILL}
11617 {&hf_gtp_qos_spare2,
11618 { "Spare", "gtp.qos_spare2",
11619 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK,
11620 "Spare (shall be sent as 0)", HFILL}
11622 {&hf_gtp_qos_precedence,
11623 { "QoS precedence", "gtp.qos_precedence",
11624 FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
11625 "Quality of Service Precedence Class", HFILL}
11627 {&hf_gtp_qos_spare3,
11628 { "Spare", "gtp.qos_spare3",
11629 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK,
11630 "Spare (shall be sent as '000' )", HFILL}
11632 {&hf_gtp_qos_mean,
11633 { "QoS mean", "gtp.qos_mean",
11634 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_mean_type_ext, GTP_EXT_QOS_MEAN_MASK,
11635 "Quality of Service Mean Throughput", HFILL}
11637 {&hf_gtp_qos_al_ret_priority,
11638 { "Allocation/Retention priority", "gtp.qos_al_ret_priority",
11639 FT_UINT8, BASE_DEC, NULL, 0,
11640 NULL, HFILL}
11642 {&hf_gtp_qos_traf_class,
11643 { "Traffic class", "gtp.qos_traf_class",
11644 FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK,
11645 NULL, HFILL}
11647 {&hf_gtp_qos_del_order,
11648 { "Delivery order", "gtp.qos_del_order",
11649 FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK,
11650 NULL, HFILL}
11652 {&hf_gtp_qos_del_err_sdu,
11653 { "Delivery of erroneous SDU", "gtp.qos_del_err_sdu",
11654 FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK,
11655 NULL, HFILL}
11657 /* The SDU size and UL/DL bandwidth items take up one octet in the
11658 * frame, but are multiplied by various factors before being added
11659 * to the tree with proto_item_add_uint[_format_value].
11661 {&hf_gtp_qos_max_sdu_size,
11662 { "Maximum SDU size", "gtp.qos_max_sdu_size",
11663 FT_UINT16, BASE_DEC, VALS(qos_max_sdu_size), 0,
11664 NULL, HFILL}
11666 {&hf_gtp_qos_max_ul,
11667 { "Maximum bit rate for uplink", "gtp.qos_max_ul",
11668 FT_UINT16, BASE_DEC, VALS(qos_max_ul), 0,
11669 NULL, HFILL}
11671 {&hf_gtp_qos_max_dl,
11672 { "Maximum bit rate for downlink", "gtp.qos_max_dl",
11673 FT_UINT16, BASE_DEC, VALS(qos_max_dl), 0,
11674 NULL, HFILL}
11676 {&hf_gtp_qos_res_ber,
11677 { "Residual BER", "gtp.qos_res_ber",
11678 FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK,
11679 "Residual Bit Error Rate", HFILL}
11681 {&hf_gtp_qos_sdu_err_ratio,
11682 { "SDU Error ratio", "gtp.qos_sdu_err_ratio",
11683 FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK,
11684 NULL,
11685 HFILL}
11687 {&hf_gtp_qos_trans_delay,
11688 { "Transfer delay", "gtp.qos_trans_delay",
11689 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_trans_delay_ext, GTP_EXT_QOS_TRANS_DELAY_MASK,
11690 NULL, HFILL}
11692 {&hf_gtp_qos_traf_handl_prio,
11693 { "Traffic handling priority", "gtp.qos_traf_handl_prio",
11694 FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
11695 NULL, HFILL}
11697 {&hf_gtp_qos_guar_ul,
11698 { "Guaranteed bit rate for uplink", "gtp.qos_guar_ul",
11699 FT_UINT16, BASE_DEC, VALS(qos_guar_ul), 0,
11700 NULL, HFILL}
11702 {&hf_gtp_qos_guar_dl,
11703 { "Guaranteed bit rate for downlink", "gtp.qos_guar_dl",
11704 FT_UINT16, BASE_DEC, VALS(qos_guar_dl), 0,
11705 NULL, HFILL}
11707 {&hf_gtp_qos_spare4,
11708 { "Spare", "gtp.qos_spare4",
11709 FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE4_MASK,
11710 "Spare (shall be sent as '000' )", HFILL}
11712 {&hf_gtp_qos_sig_ind,
11713 { "Signalling Indication", "gtp.sig_ind",
11714 FT_BOOLEAN, 8, TFS(&gtp_sig_ind), GTP_EXT_QOS_SIG_IND_MASK,
11715 NULL, HFILL}
11717 {&hf_gtp_qos_src_stat_desc,
11718 { "Source Statistics Descriptor", "gtp.src_stat_desc",
11719 FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), GTP_EXT_QOS_SRC_STAT_DESC_MASK,
11720 NULL, HFILL}
11722 { &hf_gtp_qos_arp,
11723 {"Allocation/Retention Priority", "gtp.qos_arp",
11724 FT_UINT16, BASE_HEX, NULL, 0x0,
11725 NULL, HFILL}
11727 { &hf_gtp_qos_arp_pci,
11728 {"Pre-emption Capability (PCI)", "gtp.qos_arp_pci",
11729 FT_BOOLEAN, 16, TFS(&tfs_disabled_enabled), 0x0040,
11730 NULL, HFILL}
11732 { &hf_gtp_qos_arp_pl,
11733 {"Priority Level", "gtp.qos_arp_pl",
11734 FT_UINT16, BASE_DEC, NULL, 0x003c,
11735 NULL, HFILL}
11737 { &hf_gtp_qos_arp_pvi,
11738 {"Pre-emption Vulnerability (PVI)", "gtp.qos_arp_pvi",
11739 FT_BOOLEAN, 16, TFS(&tfs_disabled_enabled), 0x0001,
11740 NULL, HFILL}
11742 {&hf_gtp_qos_qci,
11743 {"QCI", "gtp.qos_qci",
11744 FT_UINT8, BASE_DEC, NULL, 0x0,
11745 NULL, HFILL}
11747 {&hf_gtp_qos_ul_mbr,
11748 {"Uplink Maximum Bit Rate", "gtp.qos_ul_mbr",
11749 FT_UINT64, BASE_DEC, NULL, 0x0,
11750 NULL, HFILL}
11752 {&hf_gtp_qos_dl_mbr,
11753 {"Downlink Maximum Bit Rate", "gtp.qos_dl_mbr",
11754 FT_UINT64, BASE_DEC, NULL, 0x0,
11755 NULL, HFILL}
11757 {&hf_gtp_qos_ul_gbr,
11758 {"Uplink Guaranteed Bit Rate", "gtp.qos_ul_gbr",
11759 FT_UINT64, BASE_DEC, NULL, 0x0,
11760 NULL, HFILL}
11762 {&hf_gtp_qos_dl_gbr,
11763 {"Downlink Guaranteed Bit Rate", "gtp.qos_dl_gbr",
11764 FT_UINT64, BASE_DEC, NULL, 0x0,
11765 NULL, HFILL}
11767 {&hf_gtp_qos_ul_apn_ambr,
11768 {"Uplink APN Aggregate Maximum Bit Rate", "gtp.qos_ul_apn_ambr",
11769 FT_UINT32, BASE_DEC, NULL, 0x0,
11770 NULL, HFILL}
11772 {&hf_gtp_qos_dl_apn_ambr,
11773 {"Downlink APN Aggregate Maximum Bit Rate", "gtp.qos_dl_apn_ambr",
11774 FT_UINT32, BASE_DEC, NULL, 0x0,
11775 NULL, HFILL}
11777 {&hf_gtp_pkt_flow_id,
11778 { "Packet Flow ID", "gtp.pkt_flow_id",
11779 FT_UINT8, BASE_DEC, NULL, 0,
11780 NULL, HFILL}
11782 {&hf_gtp_ptmsi,
11783 { "P-TMSI", "gtp.ptmsi",
11784 FT_UINT32, BASE_DEC_HEX, NULL, 0,
11785 "Packet-Temporary Mobile Subscriber Identity", HFILL}
11787 {&hf_gtp_ptmsi_sig,
11788 { "P-TMSI Signature", "gtp.ptmsi_sig",
11789 FT_UINT24, BASE_HEX, NULL, 0,
11790 NULL, HFILL}
11792 {&hf_gtp_rab_gtpu_dn,
11793 { "Downlink GTP-U seq number", "gtp.rab_gtp_dn",
11794 FT_UINT16, BASE_DEC, NULL, 0,
11795 "Downlink GTP-U sequence number", HFILL}
11797 {&hf_gtp_rab_gtpu_up,
11798 { "Uplink GTP-U seq number", "gtp.rab_gtp_up",
11799 FT_UINT16, BASE_DEC, NULL, 0,
11800 "Uplink GTP-U sequence number", HFILL}
11802 {&hf_gtp_rab_pdu_dn,
11803 { "Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn",
11804 FT_UINT16, BASE_DEC, NULL, 0,
11805 "Downlink next PDCP-PDU sequence number", HFILL}
11807 {&hf_gtp_rab_pdu_up,
11808 { "Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up",
11809 FT_UINT16, BASE_DEC, NULL, 0,
11810 "Uplink next PDCP-PDU sequence number", HFILL}
11812 {&hf_gtp_uli_geo_loc_type,
11813 { "Geographic Location Type", "gtp.geo_loc_type",
11814 FT_UINT8, BASE_DEC, VALS(geographic_location_type), 0,
11815 NULL, HFILL}
11817 {&hf_gtp_cgi_ci,
11818 { "Cell ID (CI)", "gtp.cgi_ci",
11819 FT_UINT16, BASE_DEC, NULL, 0,
11820 NULL, HFILL}
11822 {&hf_gtp_sai_sac,
11823 { "Service Area Code (SAC)", "gtp.sai_sac",
11824 FT_UINT16, BASE_DEC, NULL, 0,
11825 NULL, HFILL}
11827 {&hf_gtp_rai_rac,
11828 { "Routing Area Code (RAC)", "gtp.rai_rac",
11829 FT_UINT8, BASE_DEC, NULL, 0,
11830 NULL, HFILL}
11832 {&hf_gtp_lac,
11833 { "Location Area Code (LAC)", "gtp.lac",
11834 FT_UINT16, BASE_DEC, NULL, 0,
11835 NULL, HFILL}
11837 { &hf_gtp_tac,
11838 {"TAC", "gtp.tac",
11839 FT_UINT16, BASE_DEC, NULL, 0,
11840 NULL, HFILL}
11842 {&hf_gtp_ranap_cause,
11843 { "RANAP cause", "gtp.ranap_cause",
11844 FT_UINT16, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0,
11845 NULL, HFILL}
11847 {&hf_gtp_recovery,
11848 { "Recovery", "gtp.recovery",
11849 FT_UINT8, BASE_DEC, NULL, 0,
11850 "Restart counter", HFILL}
11852 {&hf_gtp_reorder,
11853 { "Reordering required", "gtp.reorder",
11854 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11855 NULL, HFILL}
11857 {&hf_gtp_rnc_ipv4,
11858 { "RNC address IPv4", "gtp.rnc_ipv4",
11859 FT_IPv4, BASE_NONE, NULL, 0,
11860 "Radio Network Controller address IPv4", HFILL}
11862 {&hf_gtp_rnc_ipv6,
11863 { "RNC address IPv6", "gtp.rnc_ipv6",
11864 FT_IPv6, BASE_NONE, NULL, 0,
11865 "Radio Network Controller address IPv6", HFILL}
11867 {&hf_gtp_rp,
11868 { "Radio Priority", "gtp.rp",
11869 FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK,
11870 "Radio Priority for uplink tx", HFILL}
11872 {&hf_gtp_rp_nsapi,
11873 { "NSAPI in Radio Priority", "gtp.rp_nsapi",
11874 FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
11875 "Network layer Service Access Point Identifier in Radio Priority", HFILL}
11877 {&hf_gtp_rp_sms,
11878 { "Radio Priority SMS", "gtp.rp_sms",
11879 FT_UINT8, BASE_DEC, NULL, 0,
11880 "Radio Priority for MO SMS", HFILL}
11882 {&hf_gtp_rp_spare,
11883 { "Reserved", "gtp.rp_spare",
11884 FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK,
11885 "Spare bit", HFILL}
11887 {&hf_gtp_sel_mode,
11888 { "Selection mode", "gtp.sel_mode",
11889 FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03,
11890 NULL, HFILL}
11892 {&hf_gtp_seq_number,
11893 { "Sequence number", "gtp.seq_number",
11894 FT_UINT16, BASE_HEX_DEC, NULL, 0,
11895 NULL, HFILL}
11897 {&hf_gtp_session,
11898 { "Session", "gtp.session",
11899 FT_UINT32, BASE_DEC, NULL, 0,
11900 NULL, HFILL }
11902 {&hf_gtp_sndcp_number,
11903 { "SNDCP N-PDU LLC Number", "gtp.sndcp_number",
11904 FT_UINT8, BASE_HEX, NULL, 0,
11905 NULL, HFILL}
11907 {&hf_gtp_tear_ind,
11908 { "Teardown Indicator", "gtp.tear_ind",
11909 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
11910 NULL, HFILL}
11912 {&hf_gtp_teid,
11913 { "TEID", "gtp.teid",
11914 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11915 "Tunnel Endpoint Identifier", HFILL}
11917 {&hf_gtp_teid_cp,
11918 { "TEID Control Plane", "gtp.teid_cp",
11919 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11920 "Tunnel Endpoint Identifier Control Plane", HFILL}
11922 {&hf_gtp_uplink_teid_cp,
11923 { "Uplink TEID Control Plane", "gtp.uplink_teid_cp",
11924 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11925 "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}
11927 {&hf_gtp_teid_data,
11928 { "TEID Data I", "gtp.teid_data",
11929 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11930 "Tunnel Endpoint Identifier Data I", HFILL}
11932 {&hf_gtp_uplink_teid_data,
11933 { "Uplink TEID Data I", "gtp.uplink_teid_data",
11934 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11935 "UplinkTunnel Endpoint Identifier Data I", HFILL}
11937 {&hf_gtp_teid_ii,
11938 { "TEID Data II", "gtp.teid_ii",
11939 FT_UINT32, BASE_HEX_DEC, NULL, 0,
11940 "Tunnel Endpoint Identifier Data II", HFILL}
11942 {&hf_gtp_tid,
11943 { "TID", "gtp.tid",
11944 FT_STRING, BASE_NONE, NULL, 0,
11945 "Tunnel Identifier", HFILL}
11947 {&hf_gtp_tlli,
11948 { "TLLI", "gtp.tlli",
11949 FT_UINT32, BASE_HEX, NULL, 0,
11950 "Temporary Logical Link Identity", HFILL}
11952 {&hf_gtp_tr_comm,
11953 { "Packet transfer command", "gtp.tr_comm",
11954 FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0,
11955 NULL, HFILL}
11957 {&hf_gtp_trace_ref,
11958 { "Trace reference", "gtp.trace_ref",
11959 FT_UINT16, BASE_HEX, NULL, 0,
11960 NULL, HFILL}
11962 {&hf_gtp_trace_type,
11963 { "Trace type", "gtp.trace_type",
11964 FT_UINT16, BASE_HEX, NULL, 0,
11965 NULL, HFILL}
11967 {&hf_gtp_user_addr_pdp_org,
11968 { "PDP type organization", "gtp.user_addr_pdp_org",
11969 FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0,
11970 NULL, HFILL}
11972 {&hf_gtp_user_addr_pdp_type,
11973 { "PDP type number", "gtp.user_addr_pdp_type",
11974 FT_UINT8, BASE_HEX, VALS(pdp_type), 0,
11975 NULL, HFILL}
11977 {&hf_gtp_user_ipv4,
11978 { "End user address IPv4", "gtp.user_ipv4",
11979 FT_IPv4, BASE_NONE, NULL, 0,
11980 NULL, HFILL}
11982 {&hf_gtp_user_ipv6,
11983 { "End user address IPv6", "gtp.user_ipv6",
11984 FT_IPv6, BASE_NONE, NULL, 0,
11985 NULL, HFILL}
11987 {&hf_gtp_security_mode,
11988 { "Security Mode", "gtp.security_mode",
11989 FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
11990 NULL, HFILL}
11992 {&hf_gtp_no_of_vectors,
11993 { "No of Vectors", "gtp.no_of_vectors",
11994 FT_UINT8, BASE_DEC, NULL, 0x38,
11995 NULL, HFILL}
11997 {&hf_gtp_cipher_algorithm,
11998 { "Cipher Algorithm", "gtp.cipher_algorithm",
11999 FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
12000 NULL, HFILL}
12002 {&hf_gtp_cksn_ksi,
12003 { "Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
12004 FT_UINT8, BASE_DEC, NULL, 0x07,
12005 "CKSN/KSI", HFILL}
12007 {&hf_gtp_cksn,
12008 { "Ciphering Key Sequence Number (CKSN)", "gtp.cksn",
12009 FT_UINT8, BASE_DEC, NULL, 0x07,
12010 "CKSN", HFILL}
12012 {&hf_gtp_ksi,
12013 { "Key Set Identifier (KSI)", "gtp.ksi",
12014 FT_UINT8, BASE_DEC, NULL, 0x07,
12015 "KSI", HFILL}
12017 {&hf_gtp_ext_length,
12018 { "Length", "gtp.ext_length",
12019 FT_UINT16, BASE_DEC, NULL, 0x0,
12020 "IE Length", HFILL}
12022 {&hf_gtp_utran_field,
12023 { "UTRAN Transparent Field", "gtp.utran_field",
12024 FT_BYTES, BASE_NONE, NULL, 0x0,
12025 NULL, HFILL}
12027 {&hf_gtp_ext_apn_res,
12028 { "Restriction Type", "gtp.ext_apn_res",
12029 FT_UINT8, BASE_DEC, NULL, 0x0,
12030 NULL, HFILL}
12032 {&hf_gtp_ext_rat_type,
12033 { "RAT Type", "gtp.ext_rat_type",
12034 FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
12035 NULL, HFILL}
12037 {&hf_gtp_ext_imeisv,
12038 { "IMEI(SV)", "gtp.ext_imeisv",
12039 FT_STRING, BASE_NONE, NULL, 0x0,
12040 NULL, HFILL}
12042 { &hf_gtp_target_rnc_id,
12043 { "targetRNC-ID", "gtp.targetRNC_ID",
12044 FT_UINT16, BASE_HEX, NULL, 0x0fff,
12045 NULL, HFILL }
12047 { &hf_gtp_target_ext_rnc_id,
12048 { "Extended RNC-ID", "gtp.target_ext_RNC_ID",
12049 FT_UINT16, BASE_HEX, NULL, 0,
12050 NULL, HFILL }
12052 {&hf_gtp_bssgp_cause,
12053 { "BSSGP Cause", "gtp.bssgp_cause",
12054 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_cause_vals_ext, 0,
12055 NULL, HFILL}
12057 { &hf_gtp_bssgp_ra_discriminator,
12058 { "Routing Address Discriminator", "gtp.bssgp.rad",
12059 FT_UINT8, BASE_DEC, VALS(gtp_bssgp_ra_discriminator_vals), 0x0f,
12060 NULL, HFILL }
12062 {&hf_gtp_sapi,
12063 { "PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
12064 FT_UINT8, BASE_DEC, NULL, 0x0F,
12065 NULL, HFILL}
12067 {&hf_gtp_xid_par_len,
12068 { "PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
12069 FT_UINT8, BASE_DEC, NULL, 0x0,
12070 NULL, HFILL}
12072 {&hf_gtp_rep_act_type,
12073 { "Action", "gtp.ms_inf_chg_rep_act",
12074 FT_UINT8, BASE_DEC, VALS(chg_rep_act_type_vals), 0x0,
12075 NULL, HFILL}
12077 {&hf_gtp_correlation_id,
12078 { "Correlation-ID", "gtp.correlation_id",
12079 FT_UINT8, BASE_DEC, NULL, 0,
12080 NULL, HFILL}
12082 {&hf_gtp_earp_pci,
12083 { "PCI Pre-emption Capability", "gtp.EARP_pre_emption_Capability",
12084 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
12085 NULL, HFILL}
12087 {&hf_gtp_earp_pl,
12088 { "PL Priority Level", "gtp.EARP_priority_level",
12089 FT_UINT8, BASE_DEC, NULL, 0x3C,
12090 NULL, HFILL}
12092 {&hf_gtp_earp_pvi,
12093 { "PVI Pre-emption Vulnerability", "gtp.EARP_pre_emption_par_vulnerability",
12094 FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
12095 NULL, HFILL}
12097 {&hf_gtp_ext_comm_flags_uasi,
12098 { "UASI", "gtp.ext_comm_flags.uasi",
12099 FT_BOOLEAN, 8, NULL, 0x80,
12100 NULL, HFILL}
12102 {&hf_gtp_ext_comm_flags_bdwi,
12103 { "BDWI", "gtp.ext_comm_flags.bdwi",
12104 FT_BOOLEAN, 8, NULL, 0x40,
12105 NULL, HFILL}
12107 {&hf_gtp_ext_comm_flags_pcri,
12108 { "PCRI", "gtp.ext_comm_flags.pcri",
12109 FT_BOOLEAN, 8, NULL, 0x20,
12110 NULL, HFILL}
12112 {&hf_gtp_ext_comm_flags_vb,
12113 { "VB", "gtp.ext_comm_flags.vb",
12114 FT_BOOLEAN, 8, NULL, 0x10,
12115 NULL, HFILL}
12117 {&hf_gtp_ext_comm_flags_retloc,
12118 { "RetLoc", "gtp.ext_comm_flags.retloc",
12119 FT_BOOLEAN, 8, NULL, 0x08,
12120 NULL, HFILL}
12122 {&hf_gtp_ext_comm_flags_cpsr,
12123 { "CPSR", "gtp.ext_comm_flags.cpsr",
12124 FT_BOOLEAN, 8, NULL, 0x04,
12125 NULL, HFILL}
12127 {&hf_gtp_ext_comm_flags_ccrsi,
12128 { "CCRSI", "gtp.ext_comm_flags.ccrsi",
12129 FT_BOOLEAN, 8, NULL, 0x02,
12130 NULL, HFILL}
12132 {&hf_gtp_ext_comm_flags_unauthenticated_imsi,
12133 { "Unauthenticated IMSI", "gtp.ext_comm_flags.unauthenticated_imsi",
12134 FT_BOOLEAN, 8, NULL, 0x01,
12135 NULL, HFILL}
12137 {&hf_gtp_csg_id,
12138 { "CSG ID", "gtp.csg_id",
12139 FT_UINT32, BASE_DEC, NULL, 0x07FFFFFF,
12140 NULL, HFILL}
12142 {&hf_gtp_access_mode,
12143 { "Access Mode", "gtp.access_mode",
12144 FT_UINT8, BASE_DEC, VALS(gtp_access_mode_vals), 0xC0,
12145 NULL, HFILL }
12147 {&hf_gtp_cmi,
12148 { "CSG Membership Indication (CMI)", "gtp.cmi",
12149 FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x01,
12150 NULL, HFILL}
12152 {&hf_gtp_csg_inf_rep_act_ucicsg,
12153 { "UCICSG", "gtp.csg_info_rep_act.ucicsg",
12154 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
12155 "Report UCI when the UE enters/leaves/accesses CSG Cell",
12156 HFILL}
12158 {&hf_gtp_csg_inf_rep_act_ucishc,
12159 { "UCISHC", "gtp.csg_info_rep_act.ucishc",
12160 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
12161 "Report UCI when the UE enters/leaves/accesses Subscribed Hybrid Cell",
12162 HFILL}
12164 {&hf_gtp_csg_inf_rep_act_uciuhc,
12165 { "UCIUHC", "gtp.csg_info_rep_act.uciuhc",
12166 FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
12167 "Report UCI when the UE enters/leaves/accesses Unsubscribed Hybrid Cell",
12168 HFILL}
12170 {&hf_gtp_ext_comm_flags_II_pnsi,
12171 { "PNSI", "gtp.ext_comm_flags_II_pnsi",
12172 FT_UINT8, BASE_DEC, NULL, 0x01,
12173 NULL, HFILL}
12175 {&hf_gtp_ext_comm_flags_II_dtci,
12176 { "DTCI", "gtp.ext_comm_flags_II_dtci",
12177 FT_BOOLEAN, 8, NULL, 0x02,
12178 NULL, HFILL}
12180 {&hf_gtp_ext_comm_flags_II_pmtsmi,
12181 { "PMTSMI", "gtp.ext_comm_flags_II_pmtsmi",
12182 FT_UINT8, BASE_DEC, NULL, 0x04,
12183 NULL, HFILL}
12185 {&hf_gtp_ext_comm_flags_II_spare,
12186 { "SPARE", "gtp.ext_comm_flags_II_spare",
12187 FT_UINT8, BASE_HEX, NULL, 0xF8,
12188 NULL, HFILL}
12190 {&hf_gtp_ciot_opt_sup_ind_sgni_pdn,
12191 { "SGNI PDN", "gtp.ciot_opt_sup_ind_sgni_pdn",
12192 FT_BOOLEAN, 8, NULL, 0x01,
12193 NULL, HFILL}
12195 {&hf_gtp_ciot_opt_sup_ind_scni_pdn,
12196 { "SCNI PDN", "gtp.ciot_opt_sup_ind_scni_pdn",
12197 FT_BOOLEAN, 8, NULL, 0x02,
12198 NULL, HFILL}
12200 {&hf_gtp_ciot_opt_sup_ind_spare,
12201 { "SPARE", "gtp.ciot_opt_sup_ind_spare",
12202 FT_UINT8, BASE_HEX, NULL, 0xfc,
12203 NULL, HFILL}
12205 { &hf_gtp_up_fun_sel_ind_flags_dcnr,
12206 { "DCNR", "gtp.up_fun_sel_ind_flags_dcnr",
12207 FT_BOOLEAN, 8, NULL, 0x01,
12208 NULL, HFILL}
12210 { &hf_gtp_up_fun_sel_ind_flags_spare,
12211 { "SPARE", "gtp.up_fun_sel_ind_flags_spare",
12212 FT_UINT8, BASE_HEX, NULL, 0xfe,
12213 NULL, HFILL}
12215 {&hf_gtp_cdr_app,
12216 { "Application Identifier", "gtp.cdr_app",
12217 FT_UINT8, BASE_DEC, NULL, 0xf0,
12218 NULL, HFILL}
12220 { &hf_gtp_cdr_rel,
12221 { "Release Identifier", "gtp.cdr_rel",
12222 FT_UINT8, BASE_DEC, NULL, 0x0f,
12223 NULL, HFILL}
12225 { &hf_gtp_cdr_ver,
12226 { "Version Identifier", "gtp.cdr_ver",
12227 FT_UINT8, BASE_DEC, NULL, 0x0,
12228 NULL, HFILL}
12230 { &hf_gtp_cdr_rel_ext,
12231 { "Release Identifier Extension", "gtp.cdr_rel_ext",
12232 FT_UINT8, BASE_DEC, NULL, 0x0,
12233 NULL, HFILL}
12235 { &hf_gtp_cdr_length,
12236 { "Length", "gtp.cdr_length",
12237 FT_UINT16, BASE_DEC, NULL, 0x0,
12238 NULL, HFILL}
12240 { &hf_gtp_cdr_context,
12241 { "Context", "gtp.cdr_context",
12242 FT_BYTES, BASE_NONE, NULL, 0x0,
12243 NULL, HFILL}
12245 {&hf_gtp_cmn_flg_ppc,
12246 { "Prohibit Payload Compression", "gtp.cmn_flg.ppc",
12247 FT_BOOLEAN, 8, NULL, 0x01,
12248 NULL, HFILL}
12250 {&hf_gtp_cmn_flg_mbs_srv_type,
12251 { "MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
12252 FT_BOOLEAN, 8, NULL, 0x02,
12253 NULL, HFILL}
12255 {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
12256 { "RAN Procedures Ready", "gtp.cmn_flg.mbs_ran_pcd_rdy",
12257 FT_BOOLEAN, 8, NULL, 0x04,
12258 NULL, HFILL}
12260 {&hf_gtp_cmn_flg_mbs_cnt_inf,
12261 { "MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
12262 FT_BOOLEAN, 8, NULL, 0x08,
12263 NULL, HFILL}
12265 {&hf_gtp_cmn_flg_no_qos_neg,
12266 { "No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
12267 FT_BOOLEAN, 8, NULL, 0x10,
12268 NULL, HFILL}
12270 {&hf_gtp_cmn_flg_nrsn,
12271 { "NRSN bit field", "gtp.cmn_flg.nrsn",
12272 FT_BOOLEAN, 8, NULL, 0x20,
12273 NULL, HFILL}
12275 {&hf_gtp_cmn_flg_upgrd_qos_sup,
12276 { "Upgrade QoS Supported", "gtp.cmn_flg.upgrd_qos_sup",
12277 FT_BOOLEAN, 8, NULL, 0x40,
12278 NULL, HFILL}
12280 {&hf_gtp_cmn_flg_dual_addr_bearer_flg,
12281 { "Dual Address Bearer Flag", "gtp.cmn_flg.dual_addr_bearer_flg",
12282 FT_BOOLEAN, 8, NULL, 0x80,
12283 NULL, HFILL}
12285 {&hf_gtp_linked_nsapi,
12286 { "Linked NSAPI", "gtp.linked_nsapi",
12287 FT_UINT8, BASE_DEC, NULL, 0xf0,
12288 NULL, HFILL}
12290 {&hf_gtp_enh_nsapi,
12291 { "Enhanced NSAPI", "gtp.enhanced_nsapi",
12292 FT_UINT8, BASE_DEC, NULL, 0x0,
12293 NULL, HFILL}
12295 {&hf_gtp_tmgi,
12296 { "Temporary Mobile Group Identity (TMGI)", "gtp.tmgi",
12297 FT_BYTES, BASE_NONE, NULL, 0x0,
12298 NULL, HFILL}
12300 {&hf_gtp_no_of_mbms_sa_codes,
12301 { "Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
12302 FT_UINT8, BASE_DEC, NULL, 0x0,
12303 "Number N of MBMS service area codes", HFILL}
12306 {&hf_gtp_mbms_ses_dur_days,
12307 { "Estimated session duration days", "gtp.mbms_ses_dur_days",
12308 FT_UINT24, BASE_DEC, NULL, 0x00007F,
12309 NULL, HFILL}
12311 {&hf_gtp_mbms_ses_dur_s,
12312 { "Estimated session duration seconds", "gtp.mbms_ses_dur_s",
12313 FT_UINT24, BASE_DEC, NULL, 0xFFFF80,
12314 NULL, HFILL}
12316 {&hf_gtp_mbms_sa_code,
12317 { "MBMS service area code", "gtp.mbms_sa_code",
12318 FT_UINT16, BASE_DEC, NULL, 0x0,
12319 NULL, HFILL}
12321 {&hf_gtp_trace_ref2,
12322 { "Trace Reference2", "gtp.trace_ref2",
12323 FT_UINT24, BASE_HEX, NULL, 0,
12324 NULL, HFILL}
12326 {&hf_gtp_trace_rec_session_ref,
12327 { "Trace Recording Session Reference", "gtp.trace_rec_session_ref",
12328 FT_UINT16, BASE_HEX, NULL, 0,
12329 NULL, HFILL}
12331 {&hf_gtp_trace_triggers_ggsn_mbms,
12332 { "MBMS Context", "gtp.trace_triggers.ggsn.mbms",
12333 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x2,
12334 NULL, HFILL}
12336 {&hf_gtp_trace_triggers_ggsn_pdp,
12337 { "PDP Context", "gtp.trace_triggers.ggsn.pdp",
12338 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12339 NULL, HFILL}
12341 {&hf_gtp_trace_triggers_ggsn,
12342 { "Triggering events in GGSN", "gtp.trace_triggers.ggsn",
12343 FT_UINT8, BASE_HEX, NULL, 0,
12344 NULL, HFILL}
12346 {&hf_gtp_trace_depth,
12347 { "Trace Depth", "gtp.trace_depth",
12348 FT_UINT8, BASE_DEC, VALS(gtp_trace_depth_vals), 0,
12349 NULL, HFILL}
12351 {&hf_gtp_trace_loi_ggsn_gmb,
12352 { "Gmb", "gtp.trace_loi.ggsn.gmb",
12353 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x4,
12354 NULL, HFILL}
12356 {&hf_gtp_trace_loi_ggsn_gi,
12357 { "Gi", "gtp.trace_loi.ggsn.gi",
12358 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x2,
12359 NULL, HFILL}
12361 {&hf_gtp_trace_loi_ggsn_gn,
12362 { "Gn", "gtp.trace_loi.ggsn.gn",
12363 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12364 NULL, HFILL}
12366 {&hf_gtp_trace_loi_ggsn,
12367 { "List of interfaces in GGSN", "gtp.trace_loi.ggsn",
12368 FT_UINT8, BASE_HEX, NULL, 0,
12369 NULL, HFILL}
12371 {&hf_gtp_trace_activity_control,
12372 { "Trace Activity Control", "gtp.trace_activity_control",
12373 FT_UINT8, BASE_DEC, VALS(gtp_trace_activity_control_vals), 0,
12374 NULL, HFILL}
12376 {&hf_gtp_hop_count,
12377 { "Hop Counter", "gtp.hop_count",
12378 FT_UINT8, BASE_DEC, NULL, 0x0,
12379 NULL, HFILL}
12381 {&hf_gtp_mbs_2g_3g_ind,
12382 { "MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
12383 FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
12384 NULL, HFILL}
12386 {&hf_gtp_trace_triggers_bm_sc_mbms,
12387 { "MBMS Multicast service activation", "gtp.trace_triggers.bm_sc.mbms",
12388 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12389 NULL, HFILL}
12391 {&hf_gtp_trace_triggers_bm_sc,
12392 { "Triggering events in BM-SC", "gtp.trace_triggers.bm_sc",
12393 FT_UINT8, BASE_HEX, NULL, 0,
12394 NULL, HFILL}
12396 {&hf_gtp_trace_loi_bm_sc_gmb,
12397 { "Gmb", "gtp.trace_loi.bm_sc.gmb",
12398 FT_BOOLEAN, 8, TFS(&tfs_should_be_traced_should_not_be_traced), 0x1,
12399 NULL, HFILL}
12401 {&hf_gtp_trace_loi_bm_sc,
12402 { "List of interfaces in BM-SC", "gtp.trace_loi.bm_sc",
12403 FT_UINT8, BASE_HEX, NULL, 0,
12404 NULL, HFILL}
12406 {&hf_gtp_time_2_dta_tr,
12407 { "Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
12408 FT_UINT8, BASE_DEC, NULL, 0x0,
12409 NULL, HFILL}
12411 {&hf_gtp_target_lac,
12412 { "Target Location Area Code (LAC)", "gtp.target_lac",
12413 FT_UINT16, BASE_DEC, NULL, 0,
12414 NULL, HFILL}
12416 {&hf_gtp_target_rac,
12417 { "Target Routing Area Code (RAC)", "gtp.target_rac",
12418 FT_UINT8, BASE_DEC, NULL, 0,
12419 NULL, HFILL}
12421 {&hf_gtp_target_ci,
12422 { "Target Cell ID (CI)", "gtp.target_ci",
12423 FT_UINT16, BASE_DEC, NULL, 0,
12424 NULL, HFILL}
12426 { &hf_gtp_source_type,
12427 { "Source Type", "gtp.source_type",
12428 FT_UINT8, BASE_DEC, VALS(gtp_source_type_vals), 0x0,
12429 NULL, HFILL}
12431 {&hf_gtp_source_lac,
12432 { "Source Location Area Code (LAC)", "gtp.source_lac",
12433 FT_UINT16, BASE_DEC, NULL, 0,
12434 NULL, HFILL}
12436 {&hf_gtp_source_rac,
12437 { "Source Routing Area Code (RAC)", "gtp.source_rac",
12438 FT_UINT8, BASE_DEC, NULL, 0,
12439 NULL, HFILL}
12441 {&hf_gtp_source_ci,
12442 { "Source Cell ID (CI)", "gtp.source_ci",
12443 FT_UINT16, BASE_DEC, NULL, 0,
12444 NULL, HFILL}
12446 { &hf_gtp_source_rnc_id,
12447 { "Source RNC-ID", "gtp.source.rnc_id",
12448 FT_UINT16, BASE_DEC, NULL, 0x0fff,
12449 NULL, HFILL }
12451 { &hf_gtp_ext_ei,
12452 { "Error Indication (EI)", "gtp.ei",
12453 FT_UINT8, BASE_DEC, NULL, 0x04,
12454 NULL, HFILL}
12456 {&hf_gtp_ext_gcsi,
12457 { "GPRS-CSI (GCSI)", "gtp.gcsi",
12458 FT_UINT8, BASE_DEC, NULL, 0x02,
12459 NULL, HFILL}
12461 { &hf_gtp_ext_dti,
12462 { "Direct Tunnel Indicator (DTI)", "gtp.dti",
12463 FT_UINT8, BASE_DEC, NULL, 0x01,
12464 NULL, HFILL}
12466 { &hf_gtp_ra_prio_lcs,
12467 { "Radio Priority LCS", "gtp.raplcs",
12468 FT_UINT8, BASE_DEC, NULL, 0x07,
12469 NULL, HFILL}
12471 { &hf_gtp_bcm,
12472 { "Bearer Control Mode", "gtp.bcm",
12473 FT_UINT8, BASE_DEC, VALS(gtp_pdp_bcm_type_vals), 0,
12474 NULL, HFILL}
12476 { &hf_gtp_fqdn,
12477 { "FQDN", "gtp.fqdn",
12478 FT_STRING, BASE_NONE, NULL, 0,
12479 "Fully Qualified Domain Name", HFILL}
12481 { &hf_gtp_rim_routing_addr,
12482 { "RIM Routing Address value", "gtp.rim_routing_addr_val",
12483 FT_BYTES, BASE_NONE, NULL, 0,
12484 NULL, HFILL}
12486 { &hf_gtp_mbms_flow_id,
12487 { "MBMS Flow Identifier", "gtp.mbms_flow_id",
12488 FT_BYTES, BASE_NONE, NULL, 0,
12489 NULL, HFILL}
12491 { &hf_gtp_mbms_dist_indic,
12492 { "Distribution Indication", "gtp.mbms_dist_indic",
12493 FT_UINT8, BASE_DEC, VALS(gtp_mbms_dist_indic_vals), 0x03,
12494 NULL, HFILL}
12496 { &hf_gtp_ext_apn_ambr_ul,
12497 { "APN-AMBR for Uplink", "gtp.apn_ambr_ul",
12498 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12499 NULL, HFILL}
12501 { &hf_gtp_ext_apn_ambr_dl,
12502 { "APN-AMBR for Downlink", "gtp.apn_ambr_dl",
12503 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12504 NULL, HFILL}
12506 { &hf_gtp_ext_sub_ue_ambr_ul,
12507 { "Subscribed UE-AMBR for Uplink", "gtp.sub_ue_ambr_ul",
12508 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12509 NULL, HFILL}
12511 { &hf_gtp_ext_sub_ue_ambr_dl,
12512 { "Subscribed UE-AMBR for Downlink", "gtp.sub_ue_ambr_dl",
12513 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12514 NULL, HFILL}
12516 { &hf_gtp_ext_auth_ue_ambr_ul,
12517 { "Authorized UE-AMBR for Uplink", "gtp.auth_ue_ambr_ul",
12518 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12519 NULL, HFILL}
12521 { &hf_gtp_ext_auth_ue_ambr_dl,
12522 { "Authorized UE-AMBR for Downlink", "gtp.auth_ue_ambr_dl",
12523 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12524 NULL, HFILL}
12526 { &hf_gtp_ext_auth_apn_ambr_ul,
12527 { "Authorized APN-AMBR for Uplink", "gtp.auth_apn_ambr_ul",
12528 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12529 NULL, HFILL}
12531 { &hf_gtp_ext_auth_apn_ambr_dl,
12532 { "Authorized APN-AMBR for Downlink", "gtp.auth_apn_ambr_dl",
12533 FT_INT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_kbps), 0x0,
12534 NULL, HFILL}
12536 { &hf_gtp_ext_ggsn_back_off_time_units,
12537 { "Timer unit", "gtp.ggsn_back_off_time_units",
12538 FT_UINT8, BASE_DEC, VALS(gtp_ggsn_back_off_time_units_vals), 0xe0,
12539 NULL, HFILL}
12541 { &hf_gtp_ext_ggsn_back_off_timer,
12542 { "Timer value", "gtp.ggsn_back_off_timer",
12543 FT_UINT8, BASE_DEC, NULL, 0x1f,
12544 NULL, HFILL}
12546 { &hf_gtp_lapi,
12547 { "LAPI", "gtp.lapi",
12548 FT_BOOLEAN, 8, TFS(&gtp_lapi_tfs), 0x01,
12549 "Low Access Priority Indication", HFILL}
12551 { &hf_gtp_higher_br_16mb_flg,
12552 { "Higher bitrates than 16 Mbps flag", "gtp.higher_br_16mb_flg",
12553 FT_UINT8, BASE_DEC, VALS(gtp_higher_br_16mb_flg_vals), 0x0,
12554 NULL, HFILL}
12556 { &hf_gtp_max_mbr_apn_ambr_ul,
12557 { "Max MBR/APN-AMBR for uplink", "gtp.max_mbr_apn_ambr_ul",
12558 FT_UINT32, BASE_DEC, NULL, 0x0,
12559 NULL, HFILL}
12561 { &hf_gtp_max_mbr_apn_ambr_dl,
12562 { "Max MBR/APN-AMBR for downlink", "gtp.max_mbr_apn_ambr_dl",
12563 FT_UINT32, BASE_DEC, NULL, 0x0,
12564 NULL, HFILL}
12566 { &hf_gtp_uli_timestamp,
12567 { "ULI Timestamp", "gtp.uli_timestamp",
12568 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
12569 NULL, HFILL }
12571 { &hf_gtp_lhn_id,
12572 { "Local Home Network ID", "gtp.lhn_id",
12573 FT_STRING, BASE_NONE, NULL, 0,
12574 NULL, HFILL}
12576 { &hf_gtp_sel_entity,
12577 { "Selection Entity", "gtp.selection_entity",
12578 FT_UINT8, BASE_DEC, VALS(gtp_sel_entity_vals), 0x3,
12579 NULL, HFILL}
12581 { &hf_gtp_ue_usage_type_value,
12582 { "UE Usage Type value", "gtp.ue_usage_type_value",
12583 FT_UINT32, BASE_DEC, NULL, 0x0,
12584 NULL, HFILL}
12586 { &hf_gtp_scef_id_length,
12587 { "SCEF-ID length", "gtp.scef_id_length",
12588 FT_UINT16, BASE_DEC, NULL, 0x0,
12589 NULL, HFILL}
12591 { &hf_gtp_scef_id,
12592 { "SCEF-ID", "gtp.scef_id",
12593 FT_STRING, BASE_NONE, NULL, 0x0,
12594 NULL, HFILL}
12596 { &hf_gtp_iov_updates_counter,
12597 { "IOV_updates counter", "gtp.iov_updates_counter",
12598 FT_UINT8, BASE_DEC, NULL, 0x0,
12599 NULL, HFILL}
12601 { &hf_gtp_mapped_ue_usage_type,
12602 { "Mapped UE Usage Type", "gtp.mapped_ue_usage_type",
12603 FT_UINT16, BASE_DEC, NULL, 0x0,
12604 NULL, HFILL}
12607 { &hf_gtp_rand, { "RAND", "gtp.rand", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12608 { &hf_gtp_sres, { "SRES", "gtp.sres", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12609 { &hf_gtp_kc, { "Kc", "gtp.kc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12610 { &hf_gtp_xres_length, { "XRES length", "gtp.xres_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12611 { &hf_gtp_xres, { "XRES", "gtp.xres", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12612 { &hf_gtp_quintuplet_ciphering_key, { "Quintuplet Ciphering Key", "gtp.quintuplet_ciphering_key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12613 { &hf_gtp_quintuplet_integrity_key, { "Quintuplet Integrity Key", "gtp.quintuplet_integrity_key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12614 { &hf_gtp_authentication_length, { "Authentication length", "gtp.authentication_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12615 { &hf_gtp_auth, { "AUTH", "gtp.auth", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12616 { &hf_gtp_ciphering_key_ck, { "Ciphering key CK", "gtp.ciphering_key_ck", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12617 { &hf_gtp_integrity_key_ik, { "Integrity key IK", "gtp.integrity_key_ik", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12618 { &hf_gtp_quintuplets_length, { "Quintuplets length", "gtp.quintuplets_length", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL }},
12619 { &hf_gtp_ciphering_key_kc, { "Ciphering key Kc", "gtp.ciphering_key_kc", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12620 { &hf_gtp_container_length, { "Container length", "gtp.container_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12621 { &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 }},
12622 { &hf_gtp_vplmn_address_allowed, { "VPLMN address allowed", "gtp.vplmn_address_allowed", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40, NULL, HFILL }},
12623 { &hf_gtp_activity_status_indicator, { "Activity Status Indicator", "gtp.activity_status_indicator", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL }},
12624 { &hf_gtp_reordering_required, { "Reordering required", "gtp.reordering_required", FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10, NULL, HFILL }},
12625 { &hf_gtp_pdp_cntxt_sapi, { "SAPI", "gtp.pdp_cntxt.sapi", FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL }},
12626 { &hf_gtp_sequence_number_down, { "Sequence number down", "gtp.sequence_number_down", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12627 { &hf_gtp_sequence_number_up, { "Sequence number up", "gtp.sequence_number_up", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12628 { &hf_gtp_send_n_pdu_number, { "Send N-PDU number", "gtp.send_n_pdu_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12629 { &hf_gtp_receive_n_pdu_number, { "Receive N-PDU number", "gtp.receive_n_pdu_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12630 { &hf_gtp_uplink_flow_label_signalling, { "Uplink flow label signalling", "gtp.uplink_flow_label_signalling", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12631 { &hf_gtp_pdp_context_identifier, { "PDP context identifier", "gtp.pdp_context_identifier", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12632 { &hf_gtp_pdp_organization, { "PDP organization", "gtp.pdp_organization", FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0x0F, NULL, HFILL }},
12633 { &hf_gtp_pdp_type, { "PDP type", "gtp.pdp_type", FT_UINT8, BASE_DEC, VALS(pdp_type), 0x0, NULL, HFILL }},
12634 { &hf_gtp_pdp_address_length, { "PDP address length", "gtp.pdp_address_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12635 { &hf_gtp_pdp_address_ipv4, { "PDP address", "gtp.pdp_address.ipv4", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12636 { &hf_gtp_pdp_address_ipv6, { "PDP address", "gtp.pdp_address.ipv6", FT_IPv6, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12637 { &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 }},
12638 { &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 }},
12639 { &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 }},
12640 { &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 }},
12641 { &hf_gtp_ggsn_address_length, { "GGSN address length", "gtp.ggsn_address_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12642 { &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 }},
12643 { &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 }},
12644 { &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 }},
12645 { &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 }},
12646 { &hf_gtp_apn_length, { "APN length", "gtp.apn_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12647 { &hf_gtp_transaction_identifier, { "Transaction identifier", "gtp.transaction_identifier", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12648 { &hf_gtp_gsn_address_length, { "GSN address length", "gtp.gsn_address_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12649 { &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 }},
12650 { &hf_gtp_tft_length, { "TFT length", "gtp.tft_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12651 { &hf_gtp_rab_setup_length, { "RAB setup length", "gtp.rab_setup_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12652 { &hf_gtp_timezone, { "Timezone", "gtp.timezone", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12653 { &hf_gtp_timezone_dst, { "DST", "gtp.timezone_dst", FT_UINT8, BASE_DEC, VALS(daylight_saving_time_vals), 0x03, NULL, HFILL }},
12654 { &hf_gtp_rfsp_index, { "RFSP Index", "gtp.rfsp_index", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12655 { &hf_gtp_fqdn_length, { "FQDN length", "gtp.fqdn_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12656 { &hf_gtp_number_of_data_records, { "Number of data records", "gtp.number_of_data_records", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12657 { &hf_gtp_data_record_format, { "Data record format", "gtp.data_record_format", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12658 { &hf_gtp_node_address_length, { "Node address length", "gtp.node_address_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12659 { &hf_gtp_seq_num_released, { "Sequence number released", "gtp.seq_num_released", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12660 { &hf_gtp_seq_num_canceled, { "Sequence number cancelled", "gtp.seq_num_canceled", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12661 { &hf_gtp_requests_responded, { "Requests responded", "gtp.requests_responded", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }},
12662 { &hf_gtp_hyphen_separator, { "Hyphen separator: -", "gtp.hyphen_separator", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }},
12663 { &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 }},
12664 { &hf_gtp_iei, { "IEI", "gtp.iei", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12665 { &hf_gtp_iei_mobile_id_len, { "Length", "gtp.iei.mobile_id_len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12666 { &hf_gtp_qos_umts_length, { "Length", "gtp.qos_umts_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
12667 { &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 }},
12668 { &hf_gtp_ext_hdr_type, { "Extension Header Type", "gtp.ext_hdr_type", FT_UINT8, BASE_DEC, VALS(next_extension_header_fieldvals), 0x0, NULL, HFILL }},
12669 { &hf_gtp_tpdu_data, { "T-PDU Data", "gtp.tpdu_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
12670 { &hf_gtp_ext_enb_type, { "enb_type", "gtp.enb_type", FT_UINT8, BASE_DEC, VALS(gtp_enb_type_vals), 0x0, NULL, HFILL } },
12671 { &hf_gtp_macro_enodeb_id,
12672 { "Macro eNodeB ID", "gtp.macro_enodeb_id",
12673 FT_UINT24, BASE_HEX, NULL, 0x0fffff,
12674 NULL, HFILL }
12676 { &hf_gtp_home_enodeb_id,
12677 { "Home eNodeB ID", "gtp.home_enodeb_id",
12678 FT_UINT32, BASE_HEX, NULL, 0x0fffffff,
12679 NULL, HFILL }
12681 { &hf_gtp_dummy_octets,
12682 { "Dummy octets", "gtp.dummy_octets",
12683 FT_BYTES, BASE_NONE, NULL, 0x0,
12684 NULL, HFILL }
12686 { &hf_gtp_spare_b0,
12687 { "Spare", "gtp.spare",
12688 FT_UINT8, BASE_HEX, NULL, 0x01,
12689 NULL, HFILL }
12691 { &hf_gtp_spare_b4b0,
12692 { "Spare", "gtp.spare",
12693 FT_UINT8, BASE_HEX, NULL, 0x1f,
12694 NULL, HFILL }
12696 { &hf_gtp_spare_b7b1,
12697 { "Spare", "gtp.spare",
12698 FT_UINT8, BASE_HEX, NULL, 0xfe,
12699 NULL, HFILL }
12701 { &hf_gtp_rnc_ip_addr_v4,
12702 { "RNC IP address", "gtp.rnc_ip_addr_v4",
12703 FT_IPv4, BASE_NONE, NULL, 0x0,
12704 NULL, HFILL }
12706 { &hf_gtp_rnc_ip_addr_v6,
12707 { "RNC IP address", "gtp.rnc_ip_addr_v6",
12708 FT_IPv6, BASE_NONE, NULL, 0x0,
12709 NULL, HFILL }
12711 { &hf_gtp_ms_cm_2_len,
12712 { "Length of the Mobile Station Classmark 2", "gtp.ms_cm_2_len",
12713 FT_UINT8, BASE_DEC, NULL, 0x0,
12714 NULL, HFILL }
12716 { &hf_gtp_ms_cm_3_len,
12717 { "Length of the Mobile Station Classmark 3", "gtp.ms_cm_3_len",
12718 FT_UINT8, BASE_DEC, NULL, 0x0,
12719 NULL, HFILL }
12721 { &hf_gtp_sup_codec_lst_len,
12722 { "Length of the Supported Codec List", "gtp.sup_codec_lst_len",
12723 FT_UINT8, BASE_DEC, NULL, 0x0,
12724 NULL, HFILL }
12726 { &hf_gtp_add_flg_for_srvcc_ics,
12727 { "ICS (IMS Centralized Service)", "gtp.add_flg_for_srvcc_ics",
12728 FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
12729 NULL, HFILL }
12731 { &hf_gtp_sel_mode_val,
12732 { "Selection Mode Value", "gtp.sel_mode_val",
12733 FT_UINT8, BASE_DEC, VALS(gtp_sel_mode_vals), 0x03,
12734 NULL, HFILL }
12739 static hf_register_info hf_nrup[] =
12741 {&hf_nrup_pdu_type,
12742 { "PDU Type", "nrup.pdu_type",
12743 FT_UINT8, BASE_DEC, VALS(nr_pdu_type_cnst), 0xf0,
12744 NULL, HFILL}
12746 {&hf_nrup_spr_bit_extnd_flag,
12747 { "Spare", "nrup.spr_bit",
12748 FT_BOOLEAN, 8, NULL, 0x08,
12749 NULL, HFILL}
12751 {&hf_nrup_dl_discrd_blks,
12752 { "DL Discard Blocks", "nrup.dl_disc_blks",
12753 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
12754 "Presence of DL discard Number of blocks, discard NR PDCP PDU SN start and Discarded Block size", HFILL}
12756 {&hf_nrup_dl_flush,
12757 { "DL Flush", "nrup.dl_flush",
12758 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
12759 "Presence of DL discard NR PDCP PDU SN", HFILL}
12761 {&hf_nrup_rpt_poll,
12762 { "Report Polling", "nrup.report_polling",
12763 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
12764 "Indicates that the node hosting the NR PDCP entity requests providing the downlink delivery status report", HFILL}
12766 {&hf_nrup_retransmission_flag,
12767 { "Retransmission Flag", "nrup.retransmission_flag",
12768 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12769 "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}
12771 { &hf_nrup_ass_inf_rep_poll_flag,
12772 { "Assistance Info. Report Polling Flag", "nrup.ass_inf_rep_poll_flag",
12773 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12774 NULL, HFILL }
12776 { &hf_nrup_spare,
12777 { "Spare", "nrup.spare",
12778 FT_UINT8, BASE_DEC, NULL, 0xe0,
12779 NULL, HFILL }
12781 { &hf_nrup_request_out_of_seq_report,
12782 { "Request Out Of Seq Report", "nrup.request_out_of_seq_report",
12783 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12784 NULL, HFILL}
12787 {&hf_nrup_report_delivered,
12788 { "Report Delivered", "nrup.report_delivered",
12789 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12790 "Presence of DL report NR PDCP PDU SN", HFILL}
12792 {&hf_nrup_user_data_existence_flag,
12793 { "User Data Existence Flag", "nrup.user_data_existence_flag",
12794 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12795 "Whether the node hosting the NR PDCP entity has some user data for the concerned data radio bearer", HFILL}
12797 {&hf_nrup_nr_u_seq_num,
12798 { "NR-U Sequence Number", "nrup.seq_num",
12799 FT_UINT24, BASE_DEC, NULL, 0,
12800 "NR-U sequence number as assigned by the node hosting the NR PDCP entity", HFILL}
12802 {&hf_nrup_dl_disc_nr_pdcp_pdu_sn,
12803 { "DL discard NR PDCP PDU SN", "nrup.dl_disc_nr_pdcp_pdu_sn",
12804 FT_UINT24, BASE_DEC, NULL, 0,
12805 NULL, HFILL}
12807 {&hf_nrup_dl_disc_num_blks,
12808 { "DL discard Number of blocks", "nrup.dl_disc_num_blks",
12809 FT_UINT8, BASE_DEC, NULL, 0x0,
12810 NULL, HFILL}
12812 {&hf_nrup_dl_disc_nr_pdcp_pdu_sn_start,
12813 { "DL discard NR PDCP PDU SN Start", "nrup.dl_disc_nr_pdcp_pdu_sn_start",
12814 FT_UINT24, BASE_DEC, NULL, 0,
12815 NULL, HFILL}
12817 {&hf_nrup_dl_disc_blk_sz,
12818 { "Discarded block size", "nrup.disc_blk_sz",
12819 FT_UINT8, BASE_DEC, NULL, 0,
12820 "The number of NR PDCP PDUs counted from the starting SN to be discarded", HFILL}
12822 {&hf_nrup_dl_report_nr_pdcp_pdu_sn,
12823 { "DL report NR PDCP PDU SN", "nrup.dl_report_nr_pdcp_pdu_sn",
12824 FT_UINT24, BASE_DEC, NULL, 0,
12825 "DL delivery status report wanted when this SN has been delivered", HFILL}
12828 {&hf_nrup_high_tx_nr_pdcp_sn_ind,
12829 { "Highest Transmitted NR PDCP SN Ind", "nrup.high_tx_nr_pdcp_sn_ind",
12830 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12831 NULL, HFILL}
12833 {&hf_nrup_high_delivered_nr_pdcp_sn_ind,
12834 { "Highest Delivered NR PDCP SN Ind", "nrup.high_delivered_nr_pdcp_sn_ind",
12835 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12836 NULL, HFILL}
12838 {&hf_nrup_final_frame_ind,
12839 { "Final Frame Indication", "nrup.final_frame_ind",
12840 FT_BOOLEAN, 8, TFS(&tfs_final_frame_indication), 0x02,
12841 "Whether the frame is the last DL status report", HFILL}
12843 {&hf_nrup_lost_pkt_rpt,
12844 { "Lost Packet Report", "nrup.lost_pkt_rpt",
12845 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12846 "Indicates the presence of Number of lost NR-U Sequence Number ranges reported" , HFILL}
12848 {&hf_nrup_high_retx_nr_pdcp_sn_ind,
12849 { "Highest Retransmitted NR PDCP SN Ind", "nrup.high_retx_nr_pdcp_sn_ind",
12850 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12851 NULL, HFILL}
12853 {&hf_nrup_cause_rpt,
12854 { "Cause Report", "nrup.cause_rpt",
12855 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
12856 "Presence of Cause Value", HFILL}
12858 {&hf_nrup_delivered_nr_pdcp_sn_range_ind,
12859 { "Delivered NR PDCP SN Range Ind", "nrup.delivered_nr_pdcp_sn_range_ind",
12860 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12861 NULL, HFILL}
12863 {&hf_nrup_data_rate_ind,
12864 { "Data Rate Ind", "nrup.data_rate_ind",
12865 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12866 NULL, HFILL}
12868 {&hf_nrup_desrd_buff_sz_data_radio_bearer,
12869 { "Desired buffer size for the data radio bearer", "nrup.desrd_buff_sz_data_radio_bearer",
12870 FT_UINT32, BASE_DEC, NULL, 0,
12871 NULL, HFILL}
12873 {&hf_nrup_high_delivered_retx_nr_pdcp_sn_ind,
12874 { "Highest Delivered Retransmitted NR PDCP SN Ind", "nrup.high_delivered_retx_nr_pdcp_sn_ind",
12875 FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12876 NULL, HFILL}
12878 {&hf_nrup_desrd_data_rate,
12879 { "Desired data rate", "nrup.desrd_data_rate",
12880 FT_UINT32, BASE_DEC, NULL, 0,
12881 NULL, HFILL}
12883 {&hf_nrup_num_lost_nru_seq_num,
12884 { "Number of lost NR-U Sequence Number ranges reported", "nrup.num_lost_nru_seq_num",
12885 FT_UINT8, BASE_DEC, NULL, 0,
12886 NULL, HFILL}
12888 {&hf_nrup_start_lost_nru_seq_num,
12889 { "Start of lost NR-U Sequence Number range", "nrup.start_num_lost_nru_seq_num",
12890 FT_UINT24, BASE_DEC, NULL, 0,
12891 NULL, HFILL}
12893 {&hf_nrup_end_lost_nru_seq_num,
12894 { "End of lost NR-U Sequence Number range", "nrup.end_num_lost_nru_seq_num",
12895 FT_UINT24, BASE_DEC, NULL, 0,
12896 NULL, HFILL}
12898 {&hf_nrup_high_success_delivered_nr_pdcp_sn,
12899 { "Highest Successfully Delivered NR PDCP SN", "nrup.high_success_delivered_nr_pdcp_sn",
12900 FT_UINT24, BASE_DEC, NULL, 0,
12901 NULL, HFILL}
12903 {&hf_nrup_high_tx_nr_pdcp_sn,
12904 { "Highest transmitted NR PDCP SN", "nrup.high_tx_nr_pdcp_sn",
12905 FT_UINT24, BASE_DEC, NULL, 0,
12906 NULL, HFILL}
12908 {&hf_nrup_cause_val ,
12909 { "Cause Value", "nrup.cause_val",
12910 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(nr_up_cause_vals), 0,
12911 "Indicates specific events reported by the corresponding node", HFILL}
12913 {&hf_nrup_high_success_delivered_retx_nr_pdcp_sn,
12914 { "Highest Successfully Delivered Retransmitted NR PDCP SN", "nrup.high_success_delivered_retx_nr_pdcp_sn",
12915 FT_UINT24, BASE_DEC, NULL, 0,
12916 NULL, HFILL}
12918 {&hf_nrup_high_retx_nr_pdcp_sn,
12919 { "Highest Retransmitted NR PDCP SN Ind", "nrup.high_retx_nr_pdcp_sn",
12920 FT_UINT24, BASE_DEC, NULL, 0,
12921 NULL, HFILL}
12924 {&hf_nrup_pdcp_duplication_ind,
12925 { "PDCP Duplication Indication", "nrup.pdcp_duplication_ind",
12926 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x08,
12927 NULL, HFILL}
12929 {&hf_nrup_assistance_information_ind,
12930 { "Assistance Information Indication", "nrup.assistance_information_ind",
12931 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04,
12932 NULL, HFILL}
12934 {&hf_nrup_ul_delay_ind,
12935 { "UL Delay Indicator", "nrup.ul_delay_ind",
12936 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
12937 NULL, HFILL}
12939 {&hf_nrup_dl_delay_ind,
12940 { "DL Delay Indicator", "nrup.dl_delay_ind",
12941 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
12942 NULL, HFILL}
12944 {&hf_nrup_spare_2,
12945 { "Spare", "nrup.spare",
12946 FT_UINT8, BASE_HEX, NULL, 0xfe,
12947 NULL, HFILL}
12949 {&hf_nrup_pdcp_duplication_activation_suggestion,
12950 { "PDCP Duplication Activation Suggestion", "nrup.pdcp_duplication_activation_suggestion",
12951 FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
12952 NULL, HFILL}
12954 {&hf_nrup_num_assistance_info_fields,
12955 { "Number of Assistance Information Fields", "nrup.num_assistance_info_fields",
12956 FT_UINT8, BASE_DEC, NULL, 0x0,
12957 NULL, HFILL}
12959 {&hf_nrup_assistance_information_type,
12960 { "Assistance Information Type", "nrup.assistance_info_type",
12961 FT_UINT8, BASE_DEC|BASE_RANGE_STRING, RVALS(assistance_info_type), 0x0,
12962 NULL, HFILL}
12964 {&hf_nrup_num_octets_radio_qa_info,
12965 { "Number of octets for Radio Quality Assistance Information Fields", "nrup.num_octets_radio_qa_info",
12966 FT_UINT8, BASE_DEC, NULL, 0x0,
12967 NULL, HFILL}
12969 {&hf_nrup_radio_qa_info,
12970 { "Radio Quality Assistance Information", "nrup.radio_qa_info",
12971 FT_BYTES, BASE_NONE, NULL, 0x0,
12972 NULL, HFILL}
12974 {&hf_nrup_ul_delay_du_result,
12975 { "UL Delay DU Result", "nrup.ul_delay_du_result",
12976 FT_UINT32, BASE_DEC, NULL, 0x0,
12977 NULL, HFILL}
12979 {&hf_nrup_dl_delay_du_result,
12980 { "DL Delay DU Result", "nrup.dl_delay_du_result",
12981 FT_UINT32, BASE_DEC, NULL, 0x0,
12982 NULL, HFILL}
12987 static ei_register_info ei[] = {
12988 { &ei_gtp_ext_length_mal, { "gtp.ext_length.invalid", PI_MALFORMED, PI_ERROR, "Malformed length", EXPFILL }},
12989 { &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 }},
12990 { &ei_gtp_ext_length_warn, { "gtp.ext_length.invalid", PI_PROTOCOL, PI_WARN, "Length warning", EXPFILL }},
12991 { &ei_gtp_undecoded, { "gtp.undecoded", PI_UNDECODED, PI_WARN, "Data not decoded yet", EXPFILL }},
12992 { &ei_gtp_message_not_found, { "gtp.message_not_found", PI_PROTOCOL, PI_WARN, "Message not found", EXPFILL }},
12993 { &ei_gtp_field_not_present, { "gtp.field_not_present", PI_PROTOCOL, PI_WARN, "Field not present", EXPFILL }},
12994 { &ei_gtp_wrong_next_field, { "gtp.wrong_next_field", PI_PROTOCOL, PI_WARN, "Wrong next field", EXPFILL }},
12995 { &ei_gtp_field_not_support_in_version, { "gtp.field_not_support_in_version", PI_PROTOCOL, PI_WARN, "GTP version not supported for field", EXPFILL }},
12996 { &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 }},
12997 { &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 }},
12998 { &ei_gtp_ext_geo_loc_type, { "gtp.ext_geo_loc_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown Location type data", EXPFILL }},
12999 { &ei_gtp_iei, { "gtp.iei.unknown", PI_PROTOCOL, PI_WARN, "Unknown IEI - Later spec than TS 29.060 9.4.0 used?", EXPFILL }},
13000 { &ei_gtp_unknown_extension_header, { "gtp.unknown_extension_header", PI_PROTOCOL, PI_WARN, "Unknown extension header", EXPFILL }},
13001 { &ei_gtp_unknown_pdu_type, { "gtp.unknown_pdu_type", PI_PROTOCOL, PI_WARN, "Unknown PDU type", EXPFILL }},
13002 { &ei_gtp_source_type_unknown, { "gtp.source_type.unknown", PI_PROTOCOL, PI_WARN, "Unknown source type", EXPFILL }},
13003 { &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}},
13006 /* Setup protocol subtree array */
13007 #define GTP_NUM_INDIVIDUAL_ELEMS 39
13008 static int *ett_gtp_array[GTP_NUM_INDIVIDUAL_ELEMS + NUM_GTP_IES];
13010 ett_gtp_array[0] = &ett_gtp;
13011 ett_gtp_array[1] = &ett_gtp_flags;
13012 ett_gtp_array[2] = &ett_gtp_ext;
13013 ett_gtp_array[3] = &ett_gtp_cdr_dr;
13014 ett_gtp_array[4] = &ett_gtp_qos;
13015 ett_gtp_array[5] = &ett_gtp_qos_arp;
13016 ett_gtp_array[6] = &ett_gtp_flow_ii;
13017 ett_gtp_array[7] = &ett_gtp_ext_hdr;
13018 ett_gtp_array[8] = &ett_gtp_rp;
13019 ett_gtp_array[9] = &ett_gtp_pkt_flow_id;
13020 ett_gtp_array[10] = &ett_gtp_data_resp;
13021 ett_gtp_array[11] = &ett_gtp_cdr_ver;
13022 ett_gtp_array[12] = &ett_gtp_tmgi;
13023 ett_gtp_array[13] = &ett_gtp_trip;
13024 ett_gtp_array[14] = &ett_gtp_quint;
13025 ett_gtp_array[15] = &ett_gtp_drx;
13026 ett_gtp_array[16] = &ett_gtp_net_cap;
13027 ett_gtp_array[17] = &ett_gtp_can_pack;
13028 ett_gtp_array[18] = &ett_gtp_proto;
13029 ett_gtp_array[19] = &ett_gtp_gsn_addr;
13030 ett_gtp_array[20] = &ett_gtp_tft;
13031 ett_gtp_array[21] = &ett_gtp_rab_setup;
13032 ett_gtp_array[22] = &ett_gtp_hdr_list;
13033 ett_gtp_array[23] = &ett_gtp_rel_pack;
13034 ett_gtp_array[24] = &ett_gtp_node_addr;
13035 ett_gtp_array[25] = &ett_gtp_mm_cntxt;
13036 ett_gtp_array[26] = &ett_gtp_utran_cont;
13037 ett_gtp_array[27] = &ett_gtp_nr_ran_cont;
13038 ett_gtp_array[28] = &ett_gtp_pdcp_no_conf;
13039 ett_gtp_array[29] = &ett_pdu_session_cont;
13040 ett_gtp_array[30] = &ett_gtp_trace_triggers_ggsn;
13041 ett_gtp_array[31] = &ett_gtp_trace_loi_ggsn;
13042 ett_gtp_array[32] = &ett_gtp_trace_triggers_bm_sc;
13043 ett_gtp_array[33] = &ett_gtp_trace_loi_bm_sc;
13044 ett_gtp_array[34] = &ett_gtp_bss_cont;
13045 ett_gtp_array[35] = &ett_gtp_lst_set_up_pfc;
13046 ett_gtp_array[36] = &ett_gtp_rrc_cont;
13047 ett_gtp_array[37] = &ett_gtp_rim_routing_adr;
13048 ett_gtp_array[38] = &ett_nrup;
13050 last_offset = GTP_NUM_INDIVIDUAL_ELEMS;
13052 for (i=0; i < NUM_GTP_IES; i++, last_offset++)
13054 ett_gtp_array[last_offset] = &ett_gtp_ies[i];
13058 proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
13059 proto_gtpprime = proto_register_protocol("GPRS Tunneling Protocol Prime", "GTP (Prime)", "gtpprime");
13061 proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
13062 proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
13063 expert_gtp = expert_register_protocol(proto_gtp);
13064 expert_register_field_array(expert_gtp, ei, array_length(ei));
13066 proto_nrup = proto_register_protocol("NRUP", "NRUP", "nrup");
13067 proto_register_field_array(proto_nrup, hf_nrup, array_length(hf_nrup));
13070 gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
13071 /* For reading older preference files with "gtpv0." or "gtpv1." preferences */
13072 prefs_register_module_alias("gtpv0", gtp_module);
13073 prefs_register_module_alias("gtpv1", gtp_module);
13075 prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 and GTP' port", "GTPv0 and GTP' port (default 3386)", 10, &g_gtpv0_port);
13076 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,
13077 &g_gtpv1c_port);
13078 prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
13079 &g_gtpv1u_port);
13080 prefs_register_enum_preference(gtp_module, "dissect_tpdu_as",
13081 "Dissect T-PDU as",
13082 "Dissect T-PDU as",
13083 &dissect_tpdu_as,
13084 gtp_decode_tpdu_as,
13085 false);
13086 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);
13088 prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
13089 prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
13090 prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
13091 prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
13092 prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
13093 prefs_register_obsolete_preference(gtp_module, "dissect_tpdu");
13095 /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
13096 * The preference is set to true by default forbackward compatibility
13098 prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
13099 prefs_register_bool_preference(gtp_module, "track_gtp_session", "Track GTP session", "Track GTP session", &g_gtp_session);
13101 /* --- PDCP DECODE ADDITIONS --- */
13103 static uat_field_t pdcp_lte_keys_uat_flds[] = {
13104 UAT_FLD_CSTRING_OTHER(pdcp_lte_users, ip_addr_str, "Dst IP address", pdcp_uat_fld_ip_chk_cb, "IPv4 or IPv6 address"),
13105 UAT_FLD_CSTRING_OTHER(pdcp_lte_users, teid_str, "TEID value or \"" PDCP_TEID_WILDCARD "\"", pdcp_uat_fld_teid_chk_cb, "Tunnel Endpoint Identifier"),
13106 UAT_FLD_VS(pdcp_lte_users, direction, "Direction", vs_direction, "Direction of frames"),
13107 UAT_FLD_VS(pdcp_lte_users, header_present, "Header present", vs_header_present, "Header present flag"),
13108 UAT_FLD_VS(pdcp_lte_users, plane, "Plane", vs_pdcp_plane, "Signaling or user plane"),
13109 UAT_FLD_VS(pdcp_lte_users, lte_sn_length, "PDCP SN length", vs_pdcp_lte_sn_length, "Length of PDCP sequence number"),
13110 UAT_FLD_VS(pdcp_lte_users, rohc_compression, "ROHC compression", vs_rohc_compression, "Header compression"),
13111 //UAT_FLD_VS(pdcp_lte_users, rohc_mode, "ROHC mode", vs_rohc_mode, "ROHC mode"),
13112 UAT_FLD_VS(pdcp_lte_users, rohc_profile, "ROHC profile", vs_rohc_profile, "ROHC profile"),
13113 UAT_FLD_DEC(pdcp_lte_users, ue_id, "UE Id", "UE Identifier to match other PDCP config"),
13114 UAT_FLD_DEC(pdcp_lte_users, rb_id, "RB Id", "Radio Bearer Identifier"),
13115 UAT_END_FIELDS
13118 pdcp_lte_keys_uat = uat_new("PDCP-LTE Keys",
13119 sizeof(uat_pdcp_lte_keys_record_t), /* record size */
13120 "gtp_pdcp_lte_keys2", /* filename */
13121 true, /* from_profile */
13122 &uat_pdcp_lte_keys_records, /* data_ptr */
13123 &num_pdcp_lte_keys_uat, /* numitems_ptr */
13124 UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
13125 NULL, /* help */
13126 pdcp_lte_copy_cb, /* copy callback */
13127 pdcp_lte_update_cb, /* update callback */
13128 pdcp_lte_free_cb, /* free callback */
13129 NULL, /* post update callback */
13130 NULL, /* reset callback */
13131 pdcp_lte_keys_uat_flds); /* UAT field definitions */
13134 prefs_register_uat_preference(gtp_module,
13135 "pdcp_lte_table",
13136 "GTP PDCP-LTE Keys",
13137 "Preconfigured PDCP-LTE Keys",
13138 pdcp_lte_keys_uat);
13140 static uat_field_t pdcp_nr_keys_uat_flds[] = {
13141 UAT_FLD_CSTRING_OTHER(pdcp_nr_users, ip_addr_str, "Dst IP address", pdcp_uat_fld_ip_chk_cb, "IPv4 or IPv6 address"),
13142 UAT_FLD_CSTRING_OTHER(pdcp_nr_users, teid_str, "TEID value or \"" PDCP_TEID_WILDCARD "\"", pdcp_uat_fld_teid_chk_cb, "Tunnel Endpoint Identifier"),
13143 UAT_FLD_VS(pdcp_nr_users, direction, "Direction", vs_direction, "Direction of frames"),
13144 UAT_FLD_VS(pdcp_nr_users, sdap_header_present, "SDAP header present flag", vs_sdap_header_present, "SDAP header present flag"),
13145 UAT_FLD_VS(pdcp_nr_users, mac_i_present, "MAC-I present flag", vs_mac_i_present, "MAC-I present flag"),
13146 UAT_FLD_VS(pdcp_nr_users, plane, "Plane", vs_pdcp_plane, "Signaling or user plane"),
13147 UAT_FLD_VS(pdcp_nr_users, pdcp_nr_sn_length, "PDCP SN length", vs_pdcp_nr_sn_length, "Length of PDCP sequence number"),
13148 UAT_FLD_VS(pdcp_nr_users, rohc_compression, "ROHC compression", vs_rohc_compression, "Header compression"),
13149 //UAT_FLD_VS(pdcp_nr_users, rohc_mode, "ROHC mode", vs_rohc_mode, "ROHC mode"),
13150 UAT_FLD_VS(pdcp_nr_users, rohc_profile, "ROHC profile", vs_rohc_profile, "ROHC profile"),
13151 UAT_FLD_DEC(pdcp_nr_users, ue_id, "UE Id", "UE Identifier to match other PDCP config"),
13152 UAT_FLD_DEC(pdcp_nr_users, rb_id, "RB Id", "Radio Bearer Identifier"),
13153 UAT_END_FIELDS
13156 pdcp_nr_keys_uat = uat_new("PDCP-NR Keys",
13157 sizeof(uat_pdcp_nr_keys_record_t), /* record size */
13158 "gtp_pdcp_nr_keys2", /* filename */
13159 true, /* from_profile */
13160 &uat_pdcp_nr_keys_records, /* data_ptr */
13161 &num_pdcp_nr_keys_uat, /* numitems_ptr */
13162 UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
13163 NULL, /* help */
13164 pdcp_nr_copy_cb, /* copy callback */
13165 pdcp_nr_update_cb, /* update callback */
13166 pdcp_nr_free_cb, /* free callback */
13167 NULL, /* post update callback */
13168 NULL, /* reset callback */
13169 pdcp_nr_keys_uat_flds); /* UAT field definitions */
13171 /* Set default values for new entries to this table. Choosing SRB-1 (DL) */
13172 /* N.B. currently doesn't seem to work.. */
13173 static const char *nr_keys_uat_defaults_[] = {
13174 NULL, /*dst-address*/
13175 "*", /*teid*/
13176 PDCP_DIRECTION_DOWNLINK_STR, PDCP_NR_SDAP_HEADER_NOT_PRESENT_STR, MAC_I_PRESENT_TRUE_STR,
13177 SIGNALING_PLANE_STR, PDCP_SN_LENGTH_12_BITS_STR, ROHC_COMPRESSION_FALSE_STR, ROHC_PROFILE_UNCOMPRESSED_STR,
13178 "1", /*ueid*/ "1" /*rb*/
13180 uat_set_default_values(pdcp_nr_keys_uat, nr_keys_uat_defaults_);
13183 prefs_register_uat_preference(gtp_module,
13184 "pdcp_nr_table",
13185 "GTP PDCP-NR Keys",
13186 "Preconfigured PDCP-NR Keys",
13187 pdcp_nr_keys_uat);
13189 /* --- END PDCP NR DECODE ADDITIONS ---*/
13191 gtp_handle = register_dissector("gtp", dissect_gtp, proto_gtp);
13192 gtp_prime_handle = register_dissector("gtpprime", dissect_gtpprime, proto_gtpprime);
13193 nrup_handle = register_dissector("nrup", dissect_nrup, proto_nrup);
13195 gtp_priv_ext_dissector_table = register_dissector_table("gtp.priv_ext", "GTP Private Extension", proto_gtp, FT_UINT16, BASE_DEC);
13196 gtp_cdr_fmt_dissector_table = register_dissector_table("gtp.cdr_fmt", "GTP Data Record Type", proto_gtp, FT_UINT16, BASE_DEC);
13197 gtp_hdr_ext_dissector_table = register_dissector_table("gtp.hdr_ext", "GTP Header Extension", proto_gtp, FT_UINT16, BASE_DEC);
13199 session_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
13200 frame_map = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), gtp_info_hash, gtp_info_equal);
13201 register_init_routine(gtp_init);
13202 gtp_tap = register_tap("gtp");
13203 gtpv1_tap = register_tap("gtpv1");
13205 register_srt_table(proto_gtp, NULL, 1, gtpstat_packet, gtpstat_init, NULL);
13207 heur_subdissector_list = register_heur_dissector_list("gtp.tpdu", proto_gtp);
13209 /* TS 132 295 V9.0.0 (2010-02)
13210 * 5.1.3 Port usage
13211 * - The UDP Destination Port may be the server port number 3386 which has been reserved for GTP'.
13212 * Alternatively another port can be used, which has been configured by O&M, except Port Number 2123
13213 * which is used by GTPv2-C.
13215 * The TCP Destination Port may be the server port number 3386, which has been reserved for G-PDUs. Alternatively,
13216 * another port may be used as configured by O&M. Extra implementation-specific destination ports are possible but
13217 * all CGFs shall support the server port number.
13220 void
13221 proto_reg_handoff_gtp(void)
13223 static bool Initialized = false;
13224 static bool gtp_over_tcp;
13225 static unsigned gtpv0_port;
13226 static unsigned gtpv1c_port;
13227 static unsigned gtpv1u_port;
13229 if (!Initialized) {
13231 radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
13232 radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
13234 eth_handle = find_dissector_add_dependency("eth_withoutfcs", proto_gtp);
13235 ip_handle = find_dissector_add_dependency("ip", proto_gtp);
13236 ipv6_handle = find_dissector_add_dependency("ipv6", proto_gtp);
13237 ppp_handle = find_dissector_add_dependency("ppp", proto_gtp);
13238 sync_handle = find_dissector_add_dependency("sync", proto_gtp);
13239 gtpcdr_handle = find_dissector_add_dependency("gtpcdr", proto_gtp);
13240 sndcpxid_handle = find_dissector_add_dependency("sndcpxid", proto_gtp);
13241 gtpv2_handle = find_dissector_add_dependency("gtpv2", proto_gtp);
13242 bssgp_handle = find_dissector_add_dependency("bssgp", proto_gtp);
13243 pdcp_nr_handle = find_dissector_add_dependency("pdcp-nr", proto_gtp);
13244 pdcp_lte_handle = find_dissector_add_dependency("pdcp-lte", proto_gtp);
13245 proto_pdcp_lte = dissector_handle_get_protocol_index(pdcp_lte_handle);
13247 bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
13248 /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
13249 dissector_add_uint("diameter.3gpp", 5, create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
13250 /* AVP Code: 903 MBMS-Service-Area */
13251 dissector_add_uint("diameter.3gpp", 903, create_dissector_handle(dissect_gtp_3gpp_mbms_service_area, proto_gtp));
13252 /* AVP Code: 904 MBMS-Session-Duration */
13253 dissector_add_uint("diameter.3gpp", 904, create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
13254 /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
13255 dissector_add_uint("diameter.3gpp", 911, create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
13257 // TPDU payload detection
13258 int eth_proto_id = dissector_handle_get_protocol_index(eth_handle);
13259 heur_dissector_add("gtp.tpdu", dissect_eth_heur, "Ethernet over GTP", "eth_gtp.tpdu", eth_proto_id, HEURISTIC_ENABLE);
13261 Initialized = true;
13262 } else {
13263 dissector_delete_uint("udp.port", gtpv0_port, gtp_prime_handle);
13264 dissector_delete_uint("udp.port", gtpv1c_port, gtp_handle);
13265 dissector_delete_uint("udp.port", gtpv1u_port, gtp_handle);
13267 if (gtp_over_tcp) {
13268 dissector_delete_uint("tcp.port", gtpv0_port, gtp_prime_handle);
13269 dissector_delete_uint("tcp.port", gtpv1c_port, gtp_handle);
13270 dissector_delete_uint("tcp.port", gtpv1u_port, gtp_handle);
13274 gtp_over_tcp = g_gtp_over_tcp;
13275 gtpv0_port = g_gtpv0_port;
13276 gtpv1c_port = g_gtpv1c_port;
13277 gtpv1u_port = g_gtpv1u_port;
13279 /* This doesn't use the "auto preference" API because the port
13280 description is too specific */
13281 dissector_add_uint("udp.port", g_gtpv0_port, gtp_prime_handle);
13282 dissector_add_uint("udp.port", g_gtpv1c_port, gtp_handle);
13283 dissector_add_uint("udp.port", g_gtpv1u_port, gtp_handle);
13285 if (g_gtp_over_tcp) {
13286 /* This doesn't use the "auto preference" API because the port
13287 description is too specific */
13288 dissector_add_uint("tcp.port", g_gtpv0_port, gtp_prime_handle);
13289 dissector_add_uint("tcp.port", g_gtpv1c_port, gtp_handle);
13290 dissector_add_uint("tcp.port", g_gtpv1u_port, gtp_handle);
13295 * Editor modelines - https://www.wireshark.org/tools/modelines.html
13297 * Local variables:
13298 * c-basic-offset: 4
13299 * tab-width: 8
13300 * indent-tabs-mode: nil
13301 * End:
13303 * vi: set shiftwidth=4 tabstop=8 expandtab:
13304 * :indentSize=4:tabSize=8:noTabs=true: