[PFCP] Added missing User Plane Inactivity Timer IE value_string
[metze/wireshark/wip.git] / epan / dissectors / packet-pfcp.c
1 /* packet-pfcp.c
2 *
3 * Routines for Packet Forwarding Control Protocol (PFCP) dissection
4 *
5 * Copyright 2017, Anders Broman <anders.broman@ericsson.com>
6 *
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * Ref 3GPP TS 29.244 V14.1.0 (2017-09)
14 */
15 #include "config.h"
16
17 #include <epan/packet.h>
18 #include <epan/expert.h>
19 #include <epan/sminmpec.h>
20 #include <epan/addr_resolv.h> /* Needed for BASE_ENTERPRISES */
21
22 #include "packet-ntp.h"
23
24 void proto_register_pfcp(void);
25 void proto_reg_handoff_pfcp(void);
26
27 static dissector_handle_t pfcp_handle;
28 static dissector_handle_t pfcp_3gpp_ies_handle;
29
30 #define UDP_PORT_PFCP  8805
31
32 static int proto_pfcp = -1;
33
34 static int hf_pfcp_msg_type = -1;
35 static int hf_pfcp_msg_length = -1;
36 static int hf_pfcp_hdr_flags = -1;
37 static int hf_pfcp_version = -1;
38 static int hf_pfcp_mp_flag = -1;
39 static int hf_pfcp_s_flag = -1;
40 static int hf_pfcp_seid = -1;
41 static int hf_pfcp_seqno = -1;
42 static int hf_pfcp_mp = -1;
43
44 static int hf_pfcp2_ie = -1;
45 static int hf_pfcp2_ie_len = -1;
46 static int hf_pfcp2_enterprise_ie = -1;
47 static int hf_pfcp_enterprice_id = -1;
48
49 static int hf_pfcp_spare_b2 = -1;
50 static int hf_pfcp_spare_b3 = -1;
51 static int hf_pfcp_spare_b4 = -1;
52 static int hf_pfcp_spare_b5 = -1;
53 static int hf_pfcp_spare_b6 = -1;
54 static int hf_pfcp_spare_b7 = -1;
55 static int hf_pfcp_spare_b7_b6 = -1;
56 static int hf_pfcp_spare_b7_b5 = -1;
57 static int hf_pfcp_spare_b7_b4 = -1;
58 static int hf_pfcp_spare_b7_b3 = -1;
59 static int hf_pfcp_spare_b7_b2 = -1;
60 static int hf_pfcp_spare_b7_b1 = -1;
61 static int hf_pfcp_spare_h0 = -1;
62 static int hf_pfcp_spare_h1 = -1;
63 static int hf_pfcp_spare_oct = -1;
64 static int hf_pfcp_spare = -1;
65
66 static int hf_pfcp2_cause = -1;
67 static int hf_pfcp_node_id_type = -1;
68 static int hf_pfcp_node_id_ipv4 = -1;
69 static int hf_pfcp_node_id_ipv6 = -1;
70 static int hf_pfcp_node_id_fqdn = -1;
71 static int hf_pfcp_recovery_time_stamp = -1;
72 static int hf_pfcp_f_seid_flags = -1;
73 static int hf_pfcp_b0_v6 = -1;
74 static int hf_pfcp_b1_v4 = -1;
75 static int hf_pfcp_f_seid_ipv4 = -1;
76 static int hf_pfcp_f_seid_ipv6 = -1;
77 static int hf_pfcp_pdr_id = -1;
78 static int hf_pfcp_precedence = -1;
79 static int hf_pfcp_source_interface = -1;
80 static int hf_pfcp_f_teid_flags = -1;
81 static int hf_pfcp_fteid_flg_spare = -1;
82 static int hf_pfcp_fteid_flg_b3_ch_id = -1;
83 static int hf_pfcp_fteid_flg_b2_ch = -1;
84 static int hf_pfcp_fteid_flg_b1_v6 = -1;
85 static int hf_pfcp_fteid_flg_b0_v4 = -1;
86 static int hf_pfcp_f_teid_ch_id = -1;
87 static int hf_pfcp_f_teid_teid = -1;
88 static int hf_pfcp_f_teid_ipv4 = -1;
89 static int hf_pfcp_f_teid_ipv6 = -1;
90 static int hf_pfcp_network_instance = -1;
91 static int hf_pfcp_pdn_type = -1;
92 static int hf_pfcp_failed_rule_id_type = -1;
93 static int hf_pfcp_time_qouta_mechanism_bti_type = -1;
94 static int hf_pfcp_time_qouta_mechanism_bti = -1;
95 static int hf_pfcp_ue_ip_address_flags = -1;
96 static int hf_pfcp_ue_ip_address_flag_b0_v6 = -1;
97 static int hf_pfcp_ue_ip_address_flag_b1_v4 = -1;
98 static int hf_pfcp_ue_ip_address_flag_b2_sd = -1;
99 static int hf_pfcp_ue_ip_addr_ipv4 = -1;
100 static int hf_pfcp_ue_ip_add_ipv6 = -1;
101 static int hf_pfcp_application_id = -1;
102 static int hf_pfcp_sdf_filter_flags = -1;
103 static int hf_pfcp_sdf_filter_b0_fd = -1;
104 static int hf_pfcp_sdf_filter_b1_ttc = -1;
105 static int hf_pfcp_sdf_filter_b2_spi = -1;
106 static int hf_pfcp_sdf_filter_b3_fl = -1;
107 static int hf_pfcp_flow_desc_len = -1;
108 static int hf_pfcp_fd = -1;
109 static int hf_pfcp_ttc = -1;
110 static int hf_pfcp_spi = -1;
111 static int hf_pfcp_fl = -1;
112 static int hf_pfcp_out_hdr_desc = -1;
113 static int hf_pfcp_far_id_flg = -1;
114 static int hf_pfcp_far_id = -1;
115 static int hf_pfcp_urr_id_flg = -1;
116 static int hf_pfcp_urr_id = -1;
117 static int hf_pfcp_qer_id_flg = -1;
118 static int hf_pfcp_qer_id = -1;
119 static int hf_pfcp_predef_rules_name = -1;
120 static int hf_pfcp_apply_action_flags = -1;
121 static int hf_pfcp_apply_action_b4_dupl = -1;
122 static int hf_pfcp_apply_action_b3_nocp = -1;
123 static int hf_pfcp_apply_action_b2_buff = -1;
124 static int hf_pfcp_apply_action_b1_forw = -1;
125 static int hf_pfcp_apply_action_b0_drop = -1;
126 static int hf_pfcp_bar_id = -1;
127 static int hf_pfcp_fq_csid_node_id_type = -1;
128 static int hf_pfcp_num_csid = -1;
129 static int hf_pfcp_fq_csid_node_id_ipv4 = -1;
130 static int hf_pfcp_fq_csid_node_id_ipv6 = -1;
131 static int hf_pfcp_fq_csid_node_id_mcc_mnc = -1;
132 static int hf_pfcp_fq_csid_node_id_int = -1;
133 static int hf_pfcp_fq_csid = -1;
134 static int hf_pfcp_measurement_period = -1;
135 static int hf_pfcp_duration_measurement = -1;
136 static int hf_pfcp_time_of_first_packet = -1;
137 static int hf_pfcp_time_of_last_packet = -1;
138 static int hf_pfcp_dst_interface = -1;
139 static int hf_pfcp_redirect_address_type = -1;
140 static int hf_pfcp_redirect_server_addr_len = -1;
141 static int hf_pfcp_redirect_server_address = -1;
142 static int hf_pfcp_linked_urr_id = -1;
143 static int hf_pfcp_outer_hdr_desc = -1;
144 static int hf_pfcp_outer_hdr_creation_teid = -1;
145 static int hf_pfcp_outer_hdr_creation_ipv4 = -1;
146 static int hf_pfcp_outer_hdr_creation_ipv6 = -1;
147 static int hf_pfcp_outer_hdr_creation_port = -1;
148 static int hf_pfcp_tos_traf_class = -1;
149 static int hf_pfcp_time_threshold = -1;
150 static int hf_pfcp_forwarding_policy_id_len = -1;
151 static int hf_pfcp_forwarding_policy_id = -1;
152 static int hf_pfcp_measurement_method_flags = -1;
153 static int hf_pfcp_b0_durat = -1;
154 static int hf_pfcp_b1_volume = -1;
155 static int hf_pfcp_b2_event = -1;
156 static int hf_pfcp_subsequent_time_threshold = -1;
157 static int hf_pfcp_inactivity_detection_time = -1;
158 static int hf_pfcp_monitoring_time = -1;
159
160 static int hf_pfcp_reporting_triggers = -1;
161 static int hf_pfcp_reporting_triggers_b15_liusa = -1;
162 static int hf_pfcp_reporting_triggers_b14_droth = -1;
163 static int hf_pfcp_reporting_triggers_b13_stopt = -1;
164 static int hf_pfcp_reporting_triggers_b12_start = -1;
165 static int hf_pfcp_reporting_triggers_b11_quhti = -1;
166 static int hf_pfcp_reporting_triggers_b10_timth = -1;
167 static int hf_pfcp_reporting_triggers_b9_volth = -1;
168 static int hf_pfcp_reporting_triggers_b8_perio = -1;
169 static int hf_pfcp_reporting_triggers_b7_b3_spare = -1;
170 static int hf_pfcp_reporting_triggers_b2_envcl = -1;
171 static int hf_pfcp_reporting_triggers_b1_timqu = -1;
172 static int hf_pfcp_reporting_triggers_b0_volqu = -1;
173
174 static int hf_pfcp_volume_threshold = -1;
175 static int hf_pfcp_b2_dlvol = -1;
176 static int hf_pfcp_b1_ulvol = -1;
177 static int hf_pfcp_b0_tovol = -1;
178 static int hf_pfcp_volume_threshold_tovol = -1;
179 static int hf_pfcp_volume_threshold_ulvol = -1;
180 static int hf_pfcp_volume_threshold_dlvol = -1;
181
182 static int hf_pfcp_volume_quota = -1;
183 static int hf_pfcp_volume_quota_tovol = -1;
184 static int hf_pfcp_volume_quota_ulvol = -1;
185 static int hf_pfcp_volume_quota_dlvol = -1;
186
187 static int hf_pfcp_subseq_volume_threshold = -1;
188 static int hf_pfcp_subseq_volume_threshold_b2_dlvol = -1;
189 static int hf_pfcp_subseq_volume_threshold_b1_ulvol = -1;
190 static int hf_pfcp_subseq_volume_threshold_b0_tovol = -1;
191 static int hf_pfcp_subseq_volume_threshold_tovol = -1;
192 static int hf_pfcp_subseq_volume_threshold_ulvol = -1;
193 static int hf_pfcp_subseq_volume_threshold_dlvol = -1;
194 static int hf_pfcp_time_quota = -1;
195 static int hf_pfcp_start_time = -1;
196 static int hf_pfcp_end_time = -1;
197 static int hf_pfcp_quota_holding_time = -1;
198 static int hf_pfcp_dropped_dl_traffic_threshold = -1;
199 static int hf_pfcp_dropped_dl_traffic_threshold_b0_dlpa = -1;
200 static int hf_pfcp_downlink_packets = -1;
201 static int hf_pfcp_qer_correlation_id = -1;
202 static int hf_pfcp_gate_status = -1;
203 static int hf_pfcp_gate_status_b0b1_dlgate = -1;
204 static int hf_pfcp_gate_status_b3b2_ulgate = -1;
205 static int hf_pfcp_ul_mbr = -1;
206 static int hf_pfcp_dl_mbr = -1;
207 static int hf_pfcp_ul_gbr = -1;
208 static int hf_pfcp_dl_gbr = -1;
209 static int hf_pfcp_report_type = -1;
210 static int hf_pfcp_b2_erir = -1;
211 static int hf_pfcp_b1_usar = -1;
212 static int hf_pfcp_b0_dldr = -1;
213 static int hf_pfcp_offending_ie = -1;
214
215 static int hf_pfcp_up_function_features = -1;
216 static int hf_pfcp_b1_b7_spare = -1;
217 static int hf_pfcp_b0_empu = -1;
218 static int hf_pfcp_b15_treu = -1;
219 static int hf_pfcp_b14_heeu = -1;
220 static int hf_pfcp_b13_pfdm = -1;
221 static int hf_pfcp_b12_ftup = -1;
222 static int hf_pfcp_b11_trst = -1;
223 static int hf_pfcp_b10_dlbd = -1;
224 static int hf_pfcp_b9_ddnd = -1;
225 static int hf_pfcp_b8_bucp = -1;
226 static int hf_pfcp_sequence_number = -1;
227 static int hf_pfcp_metric = -1;
228 static int hf_pfcp_timer_unit = -1;
229 static int hf_pfcp_timer_value = -1;
230
231 static int hf_pfcp_usage_report_trigger = -1;
232 static int hf_pfcp_usage_report_trigger_b15_immer = -1;
233 static int hf_pfcp_usage_report_trigger_b14_droth = -1;
234 static int hf_pfcp_usage_report_trigger_b13_stopt = -1;
235 static int hf_pfcp_usage_report_trigger_b12_start = -1;
236 static int hf_pfcp_usage_report_trigger_b11_quhti = -1;
237 static int hf_pfcp_usage_report_trigger_b10_timth = -1;
238 static int hf_pfcp_usage_report_trigger_b9_volth = -1;
239 static int hf_pfcp_usage_report_trigger_b8_perio = -1;
240 static int hf_pfcp_usage_report_trigger_b7_b6_spare = -1;
241 static int hf_pfcp_usage_report_trigger_b5_envcl = -1;
242 static int hf_pfcp_usage_report_trigger_b4_monit = -1;
243 static int hf_pfcp_usage_report_trigger_b3_termr = -1;
244 static int hf_pfcp_usage_report_trigger_b2_liusa = -1;
245 static int hf_pfcp_usage_report_trigger_b1_timqu = -1;
246 static int hf_pfcp_usage_report_trigger_b0_volqu = -1;
247
248 static int hf_pfcp_volume_measurement = -1;
249 static int hf_pfcp_vol_meas_tovol = -1;
250 static int hf_pfcp_vol_meas_ulvol = -1;
251 static int hf_pfcp_vol_meas_dlvol = -1;
252 static int hf_pfcp_cp_function_features = -1;
253 static int hf_pfcp_b0_load = -1;
254 static int hf_pfcp_b1_ovrl = -1;
255 static int hf_pfcp_usage_information = -1;
256 static int hf_pfcp_b3_ube = -1;
257 static int hf_pfcp_b2_uae = -1;
258 static int hf_pfcp_b1_aft = -1;
259 static int hf_pfcp_b0_bef = -1;
260 static int hf_pfcp_application_instance_id = -1;
261 static int hf_pfcp_flow_dir = -1;
262 static int hf_pfcp_packet_rate = -1;
263 static int hf_pfcp_ulpr_b0 = -1;
264 static int hf_pfcp_dlpr_b1 = -1;
265 static int hf_pfcp_ul_time_unit = -1;
266 static int hf_pfcp_max_ul_pr = -1;
267 static int hf_pfcp_dl_time_unit = -1;
268 static int hf_pfcp_max_dl_pr = -1;
269 static int hf_pfcp_dl_flow_level_marking = -1;
270 static int hf_pfcp_b0_ttc = -1;
271 static int hf_pfcp_b1_sci = -1;
272 static int hf_pfcp_sci = -1;
273 static int hf_pfcp_dl_data_notification_delay = -1;
274 static int hf_pfcp_packet_count = -1;
275 static int hf_pfcp_pfcp_dl_data_service_inf_flags = -1;
276 static int hf_pfcp_b0_ppi = -1;
277 static int hf_pfcp_ppi = -1;
278 static int hf_pfcp_sxsmreq_flags = -1;
279 static int hf_pfcp_b0_drobu = -1;
280 static int hf_pfcp_b1_sndem = -1;
281 static int hf_pfcp_b2_qaurr = -1;
282 static int hf_pfcp_sxsrrsp_flags = -1;
283 static int hf_pfcp_pfd_contents_flags = -1;
284 static int hf_pfcp_b0_fd = -1;
285 static int hf_pfcp_b3_cp = -1;
286 static int hf_pfcp_b2_dn = -1;
287 static int hf_pfcp_b1_url = -1;
288 static int hf_pfcp_url_len = -1;
289 static int hf_pfcp_url = -1;
290 static int hf_pfcp_dn_len = -1;
291 static int hf_pfcp_dn = -1;
292 static int hf_pfcp_cp_len = -1;
293 static int hf_pfcp_cp = -1;
294 static int hf_pfcp_header_type = -1;
295 static int hf_pfcp_hf_len = -1;
296 static int hf_pfcp_hf_name = -1;
297 static int hf_pfcp_hf_val_len = -1;
298 static int hf_pfcp_hf_val = -1;
299 static int hf_pfcp_measurement_info = -1;
300 static int hf_pfcp_b0_mbqe = -1;
301 static int hf_pfcp_b1_inam = -1;
302 static int hf_pfcp_node_report_type = -1;
303 static int hf_pfcp_b0_upfr = -1;
304 static int hf_pfcp_remote_gtp_u_peer = -1;
305 static int hf_pfcp_gtp_u_peer_flag_b0_v6 = -1;
306 static int hf_pfcp_gtp_u_peer_flag_b1_v4 = -1;
307 static int hf_pfcp_remote_gtp_u_peer_ipv4 = -1;
308 static int hf_pfcp_remote_gtp_u_peer_ipv6 = -1;
309 static int hf_pfcp_ur_seqn = -1;
310 static int hf_pfcp_oci_flags = -1;
311 static int hf_pfcp_b0_aoci = -1;
312 static int hf_pfcp_sx_assoc_rel_req_flags = -1;
313 static int hf_pfcp_b0_sarr = -1;
314 static int hf_pfcp_upiri_flags = -1;
315 static int hf_pfcp_upiri_flg_b0_v4 = -1;
316 static int hf_pfcp_upiri_flg_b1_v6 = -1;
317 static int hf_pfcp_upiri_flg_b5_assoni = -1;
318 static int hf_pfcp_upiri_teidri = -1;
319 static int hf_pfcp_upiri_teid_range = -1;
320 static int hf_pfcp_upiri_ipv4 = -1;
321 static int hf_pfcp_upiri_ipv6 = -1;
322 static int hf_pfcp_upiri_network_instance = -1;
323 static int hf_pfcp_user_plane_inactivity_timer = -1;
324
325 static int ett_pfcp = -1;
326 static int ett_pfcp_flags = -1;
327 static int ett_pfcp_ie = -1;
328 static int ett_pfcp_grouped_ie = -1;
329 static int ett_pfcp_f_seid_flags = -1;
330 static int ett_f_teid_flags = -1;
331 static int ett_pfcp_ue_ip_address_flags = -1;
332 static int ett_pfcp_sdf_filter_flags = -1;
333 static int ett_pfcp_apply_action_flags = -1;
334 static int ett_pfcp_measurement_method_flags = -1;
335 static int ett_pfcp_reporting_triggers = -1;
336 static int ett_pfcp_volume_threshold = -1;
337 static int ett_pfcp_volume_quota = -1;
338 static int ett_pfcp_subseq_volume_threshold = -1;
339 static int ett_pfcp_dropped_dl_traffic_threshold = -1;
340 static int ett_pfcp_gate_status = -1;
341 static int ett_pfcp_report_type = -1;
342 static int ett_pfcp_up_function_features = -1;
343 static int ett_pfcp_report_trigger = -1;
344 static int ett_pfcp_volume_measurement = -1;
345 static int ett_pfcp_cp_function_features = -1;
346 static int ett_pfcp_usage_information = -1;
347 static int ett_pfcp_packet_rate = -1;
348 static int ett_pfcp_pfcp_dl_flow_level_marking = -1;
349 static int ett_pfcp_dl_data_service_inf = -1;
350 static int ett_pfcp_sxsmreq = -1;
351 static int ett_pfcp_sxsrrsp = -1;
352 static int ett_pfcp_measurement_info = -1;
353 static int ett_pfcp_node_report_type = -1;
354 static int ett_pfcp_remote_gtp_u_peer = -1;
355 static int ett_pfcp_oci_flags = -1;
356 static int ett_sx_assoc_rel_req_flags = -1;
357 static int ett_pfcp_upiri_flags = -1;
358
359 static expert_field ei_pfcp_ie_reserved = EI_INIT;
360 static expert_field ei_pfcp_ie_data_not_decoded = EI_INIT;
361 static expert_field ei_pfcp_ie_not_decoded_null = EI_INIT;
362 static expert_field ei_pfcp_ie_not_decoded_to_large = EI_INIT;
363 static expert_field ei_pfcp_enterprise_ie_3gpp = EI_INIT;
364 static expert_field ei_pfcp_ie_encoding_error = EI_INIT;
365
366
367
368 static dissector_table_t pfcp_enterprise_ies_dissector_table;
369
370 static void dissect_pfcp_ies_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint offset, guint8 message_type);
371 static void dissect_pfcp_create_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
372 static void dissect_pfcp_pdi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
373 static void dissect_pfcp_create_far(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
374 static void dissect_pfcp_forwarding_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
375 static void dissect_pfcp_duplicating_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
376 static void dissect_pfcp_create_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
377 static void dissect_pfcp_create_qer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
378 static void dissect_pfcp_created_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
379 static void dissect_pfcp_update_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
380 static void dissect_pfcp_update_far(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
381 static void dissect_pfcp_upd_forwarding_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
382 static void dissect_pfcp_update_bar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
383 static void dissect_pfcp_update_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
384 static void dissect_pfcp_update_qer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
385 static void dissect_pfcp_remove_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
386 static void dissect_pfcp_remove_far(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
387 static void dissect_pfcp_remove_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
388 static void dissect_pfcp_remove_qer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
389 static void dissect_pfcp_load_control_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
390 static void dissect_pfcp_overload_control_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
391 static void dissect_pfcp_application_ids_pfds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
392 static void dissect_pfcp_pfd_context(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
393 static void dissect_pfcp_application_detection_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
394 static void dissect_pfcp_pfcp_query_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
395 static void dissect_pfcp_usage_report_smr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
396 static void dissect_pfcp_usage_report_sdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
397 static void dissect_pfcp_usage_report_srr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
398 static void dissect_pfcp_downlink_data_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
399 static void dissect_pfcp_create_bar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
400 static void dissect_pfcp_update_bar_smr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
401 static void dissect_pfcp_remove_bar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
402 static void dissect_pfcp_error_indication_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
403 static void dissect_pfcp_user_plane_path_failure_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
404 static void dissect_pfcp_update_duplicating_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type);
405
406 static const true_false_string pfcp_id_predef_dynamic_tfs = {
407     "Predefined by UP",
408     "Dynamic by CP",
409 };
410
411 #define PFCP_MSG_RESERVED_0    0
412
413 static const value_string pfcp_message_type[] = {
414     {PFCP_MSG_RESERVED_0,             "Reserved"},
415     /* Sx Node related messages */
416
417     { 1, "Sx Heartbeat Request"},
418     { 2, "Sx Heartbeat Response"},
419     { 3, "Sx PFD Management Request"},
420     { 4, "Sx PFD Management Response"},
421     { 5, "Sx Association Setup Request"},
422     { 6, "Sx Association Setup Response"},
423     { 7, "Sx Association Update Request"},
424     { 8, "Sx Association Update Response"},
425     { 9, "Sx Association Release Request"},
426     { 10, "Sx Association Release Response"},
427     { 11, "Sx Version Not Supported Response"},
428     { 12, "Sx Node Report Request"},
429     { 13, "Sx Node Report Response"},
430     { 14, "Sx Session Set Deletion Request"},
431     { 15, "Sx Session Set Deletion Response"},
432     //16 to 49  For future use
433     //Sx Session related messages
434     { 50, "Sx Session Establishment Request"},
435     { 51, "Sx Session Establishment Response"},
436     { 52, "Sx Session Modification Request"},
437     { 53, "Sx Session Modification Response"},
438     { 54, "Sx Session Deletion Request"},
439     { 55, "Sx Session Deletion Response"},
440     { 56, "Sx Session Report Request"},
441     { 57, "Sx Session Report Response"},
442     //58 to 99  For future use
443     //Other messages
444     //100 to 255        For future use
445     {0, NULL}
446 };
447 static value_string_ext pfcp_message_type_ext = VALUE_STRING_EXT_INIT(pfcp_message_type);
448
449 /* 8.1.2    Information Element Types */
450 #define PFCP_IE_ID_CREATE_PDR                   1
451 #define PFCP_IE_ID_PDI                          2
452 #define PFCP_IE_CREATE_FAR                      3
453 #define PFCP_IE_FORWARDING_PARAMETERS           4
454 #define PFCP_IE_DUPLICATING_PARAMETERS          5
455 #define PFCP_IE_CREATE_URR                      6
456 #define PFCP_IE_CREATE_QER                      7
457 #define PFCP_IE_CREATED_PDR                     8
458 #define PFCP_IE_UPDATE_PDR                      9
459 #define PFCP_IE_UPDATE_FAR                     10
460 #define PFCP_IE_UPD_FORWARDING_PARAM   11
461 #define PFCP_IE_UPDATE_BAR                     12
462 #define PFCP_IE_UPDATE_URR                     13
463 #define PFCP_IE_UPDATE_QER                     14
464 #define PFCP_IE_REMOVE_PDR                     15
465 #define PFCP_IE_REMOVE_FAR                     16
466 #define PFCP_IE_REMOVE_URR                     17
467 #define PFCP_IE_REMOVE_QER                     18
468
469 #define PFCP_LOAD_CONTROL_INFORMATION          51
470 #define PFCP_OVERLOAD_CONTROL_INFORMATION      54
471 #define PFCP_APPLICATION_IDS_PFDS              58
472 #define PFCP_PFD_CONTEXT                       59
473 #define PFCP_APPLICATION_DETECTION_INF         68
474 #define PFCP_QUERY_URR                         77
475 #define PFCP_USAGE_REPORT_SMR                  78
476 #define PFCP_USAGE_REPORT_SDR                  79
477 #define PFCP_USAGE_REPORT_SRR                  80
478 #define PFCP_DOWNLINK_DATA_REPORT              83
479 #define PFCP_CREATE_BAR                        85
480 #define PFCP_UPDATE_BAR_SMR                    86
481 #define PFCP_REMOVE_BAR                        87
482 #define PFCP_ERROR_INDICATION_REPORT           99
483 #define PFCP_USER_PLANE_PATH_FAILURE_REPORT   102
484 #define PFCP_UPDATE_DUPLICATING_PARAMETERS    105
485
486 static const value_string pfcp_ie_type[] = {
487
488     { 0, "Reserved"},
489     { 1, "Create PDR"},                                             /* Extendable / Table 7.5.2.2-1 */
490     { 2, "PDI"},                                                    /* Extendable / Table 7.5.2.2-2 */
491     { 3, "Create FAR"},                                             /* Extendable / Table 7.5.2.3-1 */
492     { 4, "Forwarding Parameters"},                                  /* Extendable / Table 7.5.2.3-2 */
493     { 5, "Duplicating Parameters"},                                 /* Extendable / Table 7.5.2.3-3 */
494     { 6, "Create URR"},                                             /* Extendable / Table 7.5.2.4-1 */
495     { 7, "Create QER"},                                             /* Extendable / Table 7.5.2.5-1 */
496     { 8, "Created PDR"},                                            /* Extendable / Table 7.5.3.2-1 */
497     { 9, "Update PDR" },                                            /* Extendable / Table 7.5.4.2-1 */
498     { 10, "Update FAR" },                                           /* Extendable / Table 7.5.4.3-1 */
499     { 11, "Update Forwarding Parameters" },                         /* Extendable / Table 7.5.4.3-2 */
500     { 12, "Update BAR (Sx Session Report Response)" },              /* Extendable / Table 7.5.9.2-1 */
501     { 13, "Update URR" },                                           /* Extendable / Table 7.5.4.4 */
502     { 14, "Update QER" },                                           /* Extendable / Table 7.5.4.5 */
503     { 15, "Remove PDR" },                                           /* Extendable / Table 7.5.4.6 */
504     { 16, "Remove FAR" },                                           /* Extendable / Table 7.5.4.7 */
505     { 17, "Remove URR" },                                           /* Extendable / Table 7.5.4.8 */
506     { 18, "Remove QER" },                                           /* Extendable / Table 7.5.4.9 */
507     { 19, "Cause" },                                                /* Fixed / Subclause 8.2.1 */
508     { 20, "Source Interface" },                                     /* Extendable / Subclause 8.2.2 */
509     { 21, "F-TEID" },                                               /* Extendable / Subclause 8.2.3 */
510     { 22, "Network Instance" },                                     /* Variable Length / Subclause 8.2.4 */
511     { 23, "SDF Filter" },                                           /* Extendable / Subclause 8.2.5 */
512     { 24, "Application ID" },                                       /* Variable Length / Subclause 8.2.6 */
513     { 25, "Gate Status" },                                          /* Extendable / Subclause 8.2.7 */
514     { 26, "MBR" },                                                  /* Extendable / Subclause 8.2.8 */
515     { 27, "GBR" },                                                  /* Extendable / Subclause 8.2.9 */
516     { 28, "QER Correlation ID" },                                   /* Extendable / Subclause 8.2.10 */
517     { 29, "Precedence" },                                           /* Extendable / Subclause 8.2.11 */
518     { 30, "DL Transport Level Marking" },                           /* Extendable / Subclause 8.2.12 */
519     { 31, "Volume Threshold" },                                     /* Extendable /Subclause 8.2.13 */
520     { 32, "Time Threshold" },                                       /* Extendable /Subclause 8.2.14 */
521     { 33, "Monitoring Time" },                                      /* Extendable /Subclause 8.2.15 */
522     { 34, "Subsequent Volume Threshold" },                          /* Extendable /Subclause 8.2.16 */
523     { 35, "Subsequent Time Threshold" },                            /* Extendable /Subclause 8.2.17 */
524     { 36, "Inactivity Detection Time" },                            /* Extendable /Subclause 8.2.18 */
525     { 37, "Reporting Triggers" },                                   /* Extendable /Subclause 8.2.19 */
526     { 38, "Redirect Information" },                                 /* Extendable /Subclause 8.2.20 */
527     { 39, "Report Type" },                                          /* Extendable / Subclause 8.2.21 */
528     { 40, "Offending IE" },                                         /* Fixed / Subclause 8.2.22 */
529     { 41, "Forwarding Policy" },                                    /* Extendable / Subclause 8.2.23 */
530     { 42, "Destination Interface" },                                /* Extendable / Subclause 8.2.24 */
531     { 43, "UP Function Features" },                                 /* Extendable / Subclause 8.2.25 */
532     { 44, "Apply Action" },                                         /* Extendable / Subclause 8.2.26 */
533     { 45, "Downlink Data Service Information" },                    /* Extendable / Subclause 8.2.27 */
534     { 46, "Downlink Data Notification Delay" },                     /* Extendable / Subclause 8.2.28 */
535     { 47, "DL Buffering Duration" },                                /* Extendable / Subclause 8.2.29 */
536     { 48, "DL Buffering Suggested Packet Count" },                  /* Variable / Subclause 8.2.30 */
537     { 49, "SxSMReq-Flags" },                                        /* Extendable / Subclause 8.2.31 */
538     { 50, "SxSRRsp-Flags" },                                        /* Extendable / Subclause 8.2.32 */
539     { 51, "Load Control Information" },                             /* Extendable / Table 7.5.3.3-1 */
540     { 52, "Sequence Number" },                                      /* Fixed Length / Subclause 8.2.33 */
541     { 53, "Metric" },                                               /* Fixed Length / Subclause 8.2.34 */
542     { 54, "Overload Control Information" },                         /* Extendable / Table 7.5.3.4-1 */
543     { 55, "Timer" },                                                /* Extendable / Subclause 8.2 35 */
544     { 56, "Packet Detection Rule ID" },                             /* Extendable / Subclause 8.2 36 */
545     { 57, "F-SEID" },                                               /* Extendable / Subclause 8.2 37 */
546     { 58, "Application ID's PFDs" },                                /* Extendable / Table 7.4.3.1-2 */
547     { 59, "PFD context" },                                          /* Extendable / Table 7.4.3.1-3 */
548     { 60, "Node ID" },                                              /* Extendable / Subclause 8.2.38 */
549     { 61, "PFD contents" },                                         /* Extendable / Subclause 8.2.39 */
550     { 62, "Measurement Method" },                                   /* Extendable / Subclause 8.2.40 */
551     { 63, "Usage Report Trigger" },                                 /* Extendable / Subclause 8.2.41 */
552     { 64, "Measurement Period" },                                   /* Extendable / Subclause 8.2.42 */
553     { 65, "FQ-CSID" },                                              /* Extendable / Subclause 8.2.43 */
554     { 66, "Volume Measurement" },                                   /* Extendable / Subclause 8.2.44 */
555     { 67, "Duration Measurement" },                                 /* Extendable / Subclause 8.2.45 */
556     { 68, "Application Detection Information" },                    /* Extendable / Table 7.5.8.3-2 */
557     { 69, "Time of First Packet" },                                 /* Extendable / Subclause 8.2.46 */
558     { 70, "Time of Last Packet" },                                  /* Extendable / Subclause 8.2.47 */
559     { 71, "Quota Holding Time" },                                   /* Extendable / Subclause 8.2.48 */
560     { 72, "Dropped DL Traffic Threshold" },                         /* Extendable / Subclause 8.2.49 */
561     { 73, "Volume Quota" },                                         /* Extendable / Subclause 8.2.50 */
562     { 74, "Time Quota" },                                           /* Extendable / Subclause 8.2.51 */
563     { 75, "Start Time" },                                           /* Extendable / Subclause 8.2.52 */
564     { 76, "End Time" },                                             /* Extendable / Subclause 8.2.53 */
565     { 77, "Query URR" },                                            /* Extendable / Table 7.5.4.10-1 */
566     { 78, "Usage Report (in Session Modification Response)" },      /* Extendable / Table 7.5.5.2-1 */
567     { 79, "Usage Report (Session Deletion Response)" },             /* Extendable / Table 7.5.7.2-1 */
568     { 80, "Usage Report (Session Report Request)" },                /* Extendable / Table 7.5.8.3-1 */
569     { 81, "URR ID" },                                               /* Extendable / Subclause 8.2.54 */
570     { 82, "Linked URR ID" },                                        /* Extendable / Subclause 8.2.55 */
571     { 83, "Downlink Data Report" },                                 /* Extendable / Table 7.5.8.2-1 */
572     { 84, "Outer Header Creation" },                                /* Extendable / Subclause 8.2.56 */
573     { 85, "Create BAR" },                                           /* Extendable / Table 7.5.2.6-1 */
574     { 86, "Update BAR (Session Modification Request)" },            /* Extendable / Table 7.5.4.11-1 */
575     { 87, "Remove BAR" },                                           /* Extendable / Table 7.5.4.12-1 */
576     { 88, "BAR ID" },                                               /* Extendable / Subclause 8.2.57 */
577     { 89, "CP Function Features" },                                 /* Extendable / Subclause 8.2.58 */
578     { 90, "Usage Information" },                                    /* Extendable / Subclause 8.2.59 */
579     { 91, "Application Instance ID" },                              /* Variable Length / Subclause 8.2.60 */
580     { 92, "Flow Information" },                                     /* Extendable / Subclause 8.2.61 */
581     { 93, "UE IP Address" },                                        /* Extendable / Subclause 8.2.62 */
582     { 94, "Packet Rate" },                                          /* Extendable / Subclause 8.2.63 */
583     { 95, "Outer Header Removal" },                                 /* Extendable / Subclause 8.2.64 */
584     { 96, "Recovery Time Stamp" },                                  /* Extendable / Subclause 8.2.65 */
585     { 97, "DL Flow Level Marking" },                                /* Extendable / Subclause 8.2.66 */
586     { 98, "Header Enrichment" },                                    /* Extendable / Subclause 8.2.67 */
587     { 99, "Error Indication Report" },                              /* Extendable / Table 7.5.8.4-1 */
588     { 100, "Measurement Information" },                             /* Extendable / Subclause 8.2.68 */
589     { 101, "Node Report Type" },                                    /* Extendable / Subclause 8.2.69 */
590     { 102, "User Plane Path Failure Report" },                      /* Extendable / Table 7.4.5.1.2-1 */
591     { 103, "Remote GTP-U Peer" },                                   /* Extendable / Subclause 8.2.70 */
592     { 104, "UR-SEQN" },                                             /* Fixed Length / Subclause 8.2.71 */
593     { 105, "Update Duplicating Parameters" },                       /* Extendable / Table 7.5.4.3-3 */
594     { 106, "Activate Predefined Rules" },                           /* Variable Length / Subclause 8.2.72 */
595     { 107, "Deactivate Predefined Rules" },                         /* Variable Length / Subclause 8.2.73 */
596     { 108, "FAR ID" },                                              /* Extendable / Subclause 8.2.74 */
597     { 109, "QER ID" },                                              /* Extendable / Subclause 8.2.75 */
598     { 110, "OCI Flags" },                                           /* Extendable / Subclause 8.2.76 */
599     { 111, "Sx Association Release Request" },                      /* Extendable / Subclause 8.2.77 */
600     { 112, "Graceful Release Period" },                             /* Extendable / Subclause 8.2.78 */
601     { 113, "PDN Type" },                                            /* Fixed Length / Subclause 8.2.79 */
602     { 114, "Failed Rule ID" },                                      /* Extendable / Subclause 8.2.80 */
603     { 115, "Time Quota Mechanism" },                                /* Extendable / Subclause 8.2.81 */
604     { 116, "User Plane IP Resource Information" },                  /* Extendable / Subclause 8.2.82 */
605     { 117, "User Plane Inactivity Timer" },                         /* Extendable / Subclause 8.2.83 */
606     //118 to 65535      Spare. For future use.
607     {0, NULL}
608 };
609
610 static value_string_ext pfcp_ie_type_ext = VALUE_STRING_EXT_INIT(pfcp_ie_type);
611
612 static void
613 dissect_pfcp_reserved(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
614 {
615     proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_reserved, tvb, 0, length);
616 }
617
618 /*
619  * 8.2.1    Cause
620  */
621 static const value_string pfcp_cause_vals[] = {
622
623     {  0, "Reserved" },
624     {  1, "Request accepted(success)" },
625     /* 2 - 63 Spare. */
626     { 64, "Request rejected(reason not specified)" },
627     { 65, "Session context not found" },
628     { 66, "Mandatory IE missing" },
629     { 67, "Conditional IE missing" },
630     { 68, "Invalid length" },
631     { 69, "Mandatory IE incorrect" },
632     { 70, "Invalid Forwarding Policy" },
633     { 71, "Invalid F - TEID allocation option" },
634     { 72, "No established Sx Association" },
635     { 73, "Rule creation / modification Failure" },
636     { 74, "PFCP entity in congestion" },
637     { 75, "No resources available" },
638     { 76, "Service not supported" },
639     { 77, "System failure" },
640     /* 78 to 255 Spare for future use in a response message. */
641     {0, NULL}
642 };
643
644 static void
645 dissect_pfcp_cause(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_)
646 {
647     /* Octet 5 Cause value */
648     proto_tree_add_item(tree, hf_pfcp2_cause, tvb, 0, 1, ENC_BIG_ENDIAN);
649 }
650 /*
651  * 8.2.2    Source Interface
652  */
653 static const value_string pfcp_source_interface_vals[] = {
654
655     { 0, "Access" },
656     { 1, "Core" },
657     { 2, "SGi-LAN" },
658     { 3, "CP-function" },
659     { 0, NULL }
660 };
661 static void
662 dissect_pfcp_source_interface(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
663 {
664     int offset = 0;
665     guint32 value;
666     /* Octet 5 Spare    Interface value */
667     proto_tree_add_item(tree, hf_pfcp_spare_h1, tvb, offset, 1, ENC_BIG_ENDIAN);
668     proto_tree_add_item_ret_uint(tree, hf_pfcp_source_interface, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
669     offset += 1;
670
671     proto_item_append_text(item, "%s", val_to_str_const(value, pfcp_source_interface_vals, "Unknown"));
672
673     if (offset < length) {
674         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
675     }
676
677 }
678 /*
679  * 8.2.3    F-TEID
680  */
681 static void
682 dissect_pfcp_f_teid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
683 {
684     int offset = 0;
685     guint64 fteid_flags_val;
686
687     static const int * pfcp_fteid_flags[] = {
688         &hf_pfcp_fteid_flg_spare,
689         &hf_pfcp_fteid_flg_b3_ch_id,
690         &hf_pfcp_fteid_flg_b2_ch,
691         &hf_pfcp_fteid_flg_b1_v6,
692         &hf_pfcp_fteid_flg_b0_v4,
693         NULL
694     };
695     /* Octet 5  Spare  Spare  Spare  Spare  CHID  CH  V6  V4*/
696     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_f_teid_flags,
697         ett_f_teid_flags, pfcp_fteid_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS, &fteid_flags_val);
698     offset += 1;
699     /* The following flags are coded within Octet 5:
700      * Bit 1 - V4: If this bit is set to "1" and the CH bit is not set, then the IPv4 address field shall be present,
701      *         otherwise the IPv4 address field shall not be present.
702      * Bit 2 - V6: If this bit is set to "1" and the CH bit is not set, then the IPv6 address field shall be present,
703      *         otherwise the IPv6 address field shall not be present.
704      * Bit 3 - CH (CHOOSE): If this bit is set to "1", then the TEID, IPv4 address and IPv6 address fields shall not be
705      *         present and the UP function shall assign an F-TEID with an IP4 or an IPv6 address if the V4 or V6 bit is set respectively.
706      *         This bit shall only be set by the CP function.
707      * Bit 4 - CHID (CHOOSE_ID):If this bit is set to "1", then the UP function shall assign the same F-TEID to the
708      *         PDRs requested to be created in a Sx Session Establishment Request or Sx Session Modification Request with
709      *         the same CHOOSE ID value.
710      *         This bit may only be set to "1" if the CH bit is set to "1".
711      *         This bit shall only be set by the CP function.
712      */
713
714     if ((fteid_flags_val & 0x4) == 4) {
715         if ((fteid_flags_val & 0x8) == 8) {
716             proto_tree_add_item(tree, hf_pfcp_f_teid_ch_id, tvb, offset, 1, ENC_NA);
717             offset += 1;
718         }
719     } else {
720
721         /* Octet 6 to 9    TEID */
722         proto_tree_add_item(tree, hf_pfcp_f_teid_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
723         offset += 4;
724
725         if ((fteid_flags_val & 0x1) == 1) {
726             /* m to (m+3)    IPv4 address */
727             proto_tree_add_item(tree, hf_pfcp_f_teid_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
728             offset += 4;
729         }
730         if ((fteid_flags_val & 0x2) == 2) {
731             /* p to (p+15)   IPv6 address */
732             proto_tree_add_item(tree, hf_pfcp_f_teid_ipv6, tvb, offset, 16, ENC_NA);
733             offset += 16;
734         }
735         /* If the value of CH bit is set to "0", but the value of CHID bit is "1" */
736         if ((fteid_flags_val & 0x8) == 8) {
737             proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_encoding_error, tvb, 0, 1);
738         }
739     }
740     if (offset < length) {
741         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
742     }
743
744 }
745 /*
746  * 8.2.4    Network Instance
747  */
748 static void
749 dissect_pfcp_network_instance(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
750 {
751     int offset = 0;
752     /* Octet 5 5 to (n+4)   Network Instance
753      * The Network instance field shall be encoded as an OctetString
754      */
755     proto_tree_add_item(tree, hf_pfcp_network_instance, tvb, offset, length, ENC_NA);
756 }
757 /*
758  * 8.2.5    SDF Filter
759  */
760 static void
761 dissect_pfcp_sdf_filter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_)
762 {
763     int offset = 0;
764     guint64 flags_val;
765     guint32 fd_length;
766
767     static const int * pfcp_sdf_filter_flags[] = {
768         &hf_pfcp_spare_h1,
769         &hf_pfcp_sdf_filter_b3_fl,
770         &hf_pfcp_sdf_filter_b2_spi,
771         &hf_pfcp_sdf_filter_b1_ttc,
772         &hf_pfcp_sdf_filter_b0_fd,
773         NULL
774     };
775     /* Octet 5  Spare   FL  SPI TTC FD*/
776     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_sdf_filter_flags,
777         ett_pfcp_sdf_filter_flags, pfcp_sdf_filter_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS, &flags_val);
778     offset += 1;
779     /* Octet 6 Spare*/
780     proto_tree_add_item(tree, hf_pfcp_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
781     offset += 1;
782
783     if ((flags_val & 0x1) == 1) {
784         /* FD (Flow Description): If this bit is set to "1",
785          * then the Length of Flow Description and the Flow Description fields shall be present
786          */
787         /* m to (m+1)   Length of Flow Description */
788         proto_tree_add_item_ret_uint(tree, hf_pfcp_flow_desc_len, tvb, offset, 2, ENC_BIG_ENDIAN, &fd_length);
789         offset += 2;
790         /* Flow Description
791          * The Flow Description field, when present, shall be encoded as an OctetString
792          * as specified in subclause 5.4.2 of 3GPP TS 29.212
793          */
794         proto_tree_add_item(tree, hf_pfcp_fd, tvb, offset, fd_length, ENC_NA);
795         offset += fd_length;
796     }
797     if ((flags_val & 0x2) == 2) {
798         /* TTC (ToS Traffic Class): If this bit is set to "1", then the ToS Traffic Class field shall be present */
799         /* ToS Traffic Class field, when present, shall be encoded as an OctetString on two octets
800          * as specified in subclause 5.3.15 of 3GPP TS 29.212
801          */
802         proto_tree_add_item(tree, hf_pfcp_ttc, tvb, offset, 2, ENC_NA);
803         offset += 2;
804     }
805
806     if ((flags_val & 0x4) == 4) {
807         /* SPI (The Security Parameter Index) field, when present, shall be encoded as an OctetString on four octets and shall
808          * contain the IPsec security parameter index (which is a 32-bit field),
809          * as specified in subclause 5.3.51 of 3GPP TS 29.212
810          */
811         proto_tree_add_item(tree, hf_pfcp_spi, tvb, offset, 4, ENC_NA);
812         offset += 4;
813     }
814     if ((flags_val & 0x8) == 8) {
815         /* FL (Flow Label), when present, shall be encoded as an OctetString on 3 octets as specified in
816          * subclause 5.3.52 of 3GPP TS 29.212 and shall contain an IPv6 flow label (which is a 20-bit field).
817          * The bits 8 to 5 of the octet "v" shall be spare and set to zero, and the remaining 20 bits shall
818          * contain the IPv6 flow label.*/
819         proto_tree_add_item(tree, hf_pfcp_fl, tvb, offset, 3, ENC_NA);
820         offset += 3;
821     }
822
823     if (offset < length) {
824         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
825     }
826 }
827 /*
828  * 8.2.6    Application ID
829  */
830 static void
831 dissect_pfcp_application_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
832 {
833     int offset = 0;
834     /* Octet 5 to (n+4) Application Identifier
835     * The Application Identifier shall be encoded as an OctetString (see 3GPP TS 29.212)
836     */
837     proto_tree_add_item(tree, hf_pfcp_application_id, tvb, offset, length, ENC_NA);
838 }
839 /*
840  * 8.2.7    Gate Status
841  */
842 static const value_string pfcp_gate_status_vals[] = {
843     { 0, "OPEN" },
844     { 1, "CLOSED" },
845     { 0, NULL }
846 };
847
848
849 static void
850 dissect_pfcp_gate_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
851 {
852     int offset = 0;
853
854     static const int * pfcp_gate_status_flags[] = {
855         &hf_pfcp_gate_status_b3b2_ulgate,
856         &hf_pfcp_gate_status_b0b1_dlgate,
857         NULL
858     };
859     /* Octet 5  Spare   UL Gate DL Gate */
860     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_gate_status,
861         ett_pfcp_gate_status, pfcp_gate_status_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
862     offset += 1;
863
864     if (offset < length) {
865         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
866     }
867
868 }
869
870
871 /*
872  * 8.2.8    MBR
873  */
874 static void
875 dissect_pfcp_mbr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
876 {
877     int offset = 0;
878     int len1 = (length != 10) ? length/2 : 5;
879
880     /* In case length is not in accordance with documentation */
881     if ( length != 10) {
882         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_encoding_error, tvb, 0, 1);
883     }
884
885     /* 5 to 9   UL MBR
886     * The UL/DL MBR fields shall be encoded as kilobits per second (1 kbps = 1000 bps) in binary value
887     */
888     proto_tree_add_item(tree, hf_pfcp_ul_mbr, tvb, offset, len1, ENC_BIG_ENDIAN);
889     offset += len1;
890
891     /* 10 to 14 DL MBR */
892     proto_tree_add_item(tree, hf_pfcp_dl_mbr, tvb, offset, len1, ENC_BIG_ENDIAN);
893     offset += len1;
894
895     if (offset < length) {
896         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
897     }
898
899 }
900
901 /*
902  * 8.2.9    GBR
903  */
904 static void
905 dissect_pfcp_gbr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
906 {
907     int offset = 0;
908     int len1 = (length != 10) ? length/2 : 5;
909
910     /* In case length is not in accordance with documentation */
911     if ( length != 10) {
912         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_encoding_error, tvb, 0, 1);
913     }
914
915     /* 5 to 9   UL GBR
916     * The UL/DL MBR fields shall be encoded as kilobits per second (1 kbps = 1000 bps) in binary value
917     */
918     proto_tree_add_item(tree, hf_pfcp_ul_gbr, tvb, offset, len1, ENC_BIG_ENDIAN);
919     offset += len1;
920
921     /* 10 to 14 DL GBR */
922     proto_tree_add_item(tree, hf_pfcp_dl_gbr, tvb, offset, len1, ENC_BIG_ENDIAN);
923     offset += len1;
924
925     if (offset < length) {
926         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
927     }
928
929 }
930
931 /*
932  * 8.2.10   QER Correlation ID
933  */
934 static void
935 dissect_pfcp_qer_correlation_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
936 {
937     int offset = 0;
938     guint32 value;
939     /* 5 to 8   QER Correlation ID value */
940     proto_tree_add_item_ret_uint(tree, hf_pfcp_qer_correlation_id, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
941     offset += 4;
942
943     proto_item_append_text(item, "%u", value);
944
945     if (offset < length) {
946         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
947     }
948
949 }
950 /*
951  * 8.2.11   Precedence
952  */
953 static void
954 dissect_pfcp_precedence(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
955 {
956     int offset = 0;
957     guint32 value;
958     /* Octet 5 5 to 8   Precedence value */
959     proto_tree_add_item_ret_uint(tree, hf_pfcp_precedence, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
960     offset += 4;
961
962     proto_item_append_text(item, "%u", value);
963
964     if (offset < length) {
965         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
966     }
967
968 }
969 /*
970  * 8.2.12   Transport Level Marking
971  */
972 static void
973 dissect_pfcp_transport_level_marking(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
974 {
975     int offset = 0;
976     /* Octet 5 to 6     ToS/Traffic Class
977     * The ToS/Traffic Class shall be encoded on two octets as an OctetString.
978     * The first octet shall contain the IPv4 Type-of-Service or the IPv6 Traffic-Class field and the second octet shall contain the ToS/Traffic Class mask field
979     */
980     proto_tree_add_item(tree, hf_pfcp_tos_traf_class, tvb, offset, 2, ENC_BIG_ENDIAN);
981     offset += 2;
982
983     if (offset < length) {
984         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
985     }
986
987 }
988
989 /*
990  * 8.2.13   Volume Threshold
991  */
992 static void
993 dissect_pfcp_volume_threshold(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
994 {
995     int offset = 0;
996     guint64 flags_val;
997
998     static const int * pfcp_volume_threshold_flags[] = {
999         &hf_pfcp_spare_b7_b3,
1000         &hf_pfcp_b2_dlvol,
1001         &hf_pfcp_b1_ulvol,
1002         &hf_pfcp_b0_tovol,
1003         NULL
1004     };
1005     /* Octet 5  Spare   DLVOL   ULVOL   TOVOL*/
1006     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_volume_threshold,
1007         ett_pfcp_volume_threshold, pfcp_volume_threshold_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags_val);
1008     offset += 1;
1009
1010     /* The Total Volume, Uplink Volume and Downlink Volume fields shall be encoded as an Unsigned64 binary integer value.
1011     * They shall contain the total, uplink or downlink number of octets respectively.
1012     */
1013     if ((flags_val & 0x1) == 1) {
1014         /* m to (m+7)   Total Volume
1015         * TOVOL: If this bit is set to "1", then the Total Volume field shall be present
1016         */
1017         proto_tree_add_item(tree, hf_pfcp_volume_threshold_tovol, tvb, offset, 8, ENC_BIG_ENDIAN);
1018         offset += 8;
1019     }
1020     if ((flags_val & 0x2) == 2) {
1021         /* p to (p+7)   Uplink Volume
1022         * ULVOL: If this bit is set to "1", then the Uplink Volume field shall be present
1023         */
1024         proto_tree_add_item(tree, hf_pfcp_volume_threshold_ulvol, tvb, offset, 8, ENC_BIG_ENDIAN);
1025         offset += 8;
1026     }
1027     if ((flags_val & 0x4) == 4) {
1028         /* q to (q+7)   Downlink Volume
1029         * DLVOL: If this bit is set to "1", then the Downlink Volume field shall be present
1030         */
1031         proto_tree_add_item(tree, hf_pfcp_volume_threshold_dlvol, tvb, offset, 8, ENC_BIG_ENDIAN);
1032         offset += 8;
1033     }
1034
1035     if (offset < length) {
1036         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1037     }
1038 }
1039 /*
1040  * 8.2.14   Time Threshold
1041  */
1042 static void
1043 dissect_pfcp_time_threshold(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1044 {
1045     int offset = 0;
1046     guint value;
1047
1048     /* Octet 5 to 8     Time Threshold
1049     * The Time Threshold field shall be encoded as an Unsigned32 binary integer value.
1050     * It shall contain the duration in seconds.
1051     */
1052     proto_tree_add_item_ret_uint(tree, hf_pfcp_time_threshold, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
1053     offset += 4;
1054
1055     proto_item_append_text(item, "%u s", value);
1056
1057     if (offset < length) {
1058         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1059     }
1060
1061 }
1062
1063 /*
1064  * 8.2.15   Monitoring Time
1065  */
1066 static void
1067 dissect_pfcp_monitoring_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1068 {
1069     const gchar *time_str;
1070     int offset = 0;
1071
1072     /* The Monitoring Time field shall indicate the monitoring time in UTC time.
1073     * Octets 5 to 8 shall be encoded in the same format as the first four octets
1074     * of the 64-bit timestamp format as defined in section 6 of IETF RFC 5905.
1075     */
1076     time_str = tvb_ntp_fmt_ts_sec(tvb, 0);
1077     proto_tree_add_string(tree, hf_pfcp_monitoring_time, tvb, offset, 4, time_str);
1078     proto_item_append_text(item, "%s", time_str);
1079     offset += 4;
1080
1081     if (offset < length) {
1082         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1083     }
1084
1085 }
1086 /*
1087  * 8.2.16   Subsequent Volume Threshold
1088  */
1089 static void
1090 dissect_pfcp_subseq_volume_threshold(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1091 {
1092     int offset = 0;
1093     guint64 flags_val;
1094
1095     static const int * pfcp_subseq_volume_threshold_flags[] = {
1096         &hf_pfcp_spare_b7_b3,
1097         &hf_pfcp_subseq_volume_threshold_b2_dlvol,
1098         &hf_pfcp_subseq_volume_threshold_b1_ulvol,
1099         &hf_pfcp_subseq_volume_threshold_b0_tovol,
1100         NULL
1101     };
1102     /* Octet 5  Spare   DLVOL   ULVOL   TOVOL*/
1103     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_subseq_volume_threshold,
1104         ett_pfcp_subseq_volume_threshold, pfcp_subseq_volume_threshold_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags_val);
1105     offset += 1;
1106
1107     /* The Total Volume, Uplink Volume and Downlink Volume fields shall be encoded as an Unsigned64 binary integer value.
1108     * They shall contain the total, uplink or downlink number of octets respectively.
1109     */
1110     if ((flags_val & 0x1) == 1) {
1111         /* m to (m+7)   Total Volume
1112         * TOVOL: If this bit is set to "1", then the Total Volume field shall be present
1113         */
1114         proto_tree_add_item(tree, hf_pfcp_subseq_volume_threshold_tovol, tvb, offset, 8, ENC_BIG_ENDIAN);
1115         offset += 8;
1116     }
1117     if ((flags_val & 0x2) == 2) {
1118         /* p to (p+7)   Uplink Volume
1119         * ULVOL: If this bit is set to "1", then the Uplink Volume field shall be present
1120         */
1121         proto_tree_add_item(tree, hf_pfcp_subseq_volume_threshold_ulvol, tvb, offset, 8, ENC_BIG_ENDIAN);
1122         offset += 8;
1123     }
1124     if ((flags_val & 0x4) == 4) {
1125         /* q to (q+7)   Downlink Volume
1126         * DLVOL: If this bit is set to "1", then the Downlink Volume field shall be present
1127         */
1128         proto_tree_add_item(tree, hf_pfcp_subseq_volume_threshold_dlvol, tvb, offset, 8, ENC_BIG_ENDIAN);
1129         offset += 8;
1130     }
1131
1132     if (offset < length) {
1133         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1134     }
1135 }
1136
1137 /*
1138  * 8.2.17   Subsequent Time Threshold
1139  */
1140 static void
1141 dissect_pfcp_subsequent_time_threshold(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1142 {
1143     int offset = 0;
1144     guint32 value;
1145     /* 5 to 8   Subsequent Time Threshold */
1146     proto_tree_add_item_ret_uint(tree, hf_pfcp_subsequent_time_threshold, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
1147     offset += 4;
1148
1149     proto_item_append_text(item, "%u s", value);
1150
1151     if (offset < length) {
1152         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1153     }
1154 }
1155 /*
1156  * 8.2.18   Inactivity Detection Time
1157  */
1158 static void
1159 dissect_pfcp_inactivity_detection_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1160 {
1161     int offset = 0;
1162     guint32 value;
1163     /* 5 to 8   Inactivity Detection Time */
1164     proto_tree_add_item_ret_uint(tree, hf_pfcp_inactivity_detection_time, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
1165     offset += 4;
1166
1167     proto_item_append_text(item, "%u s", value);
1168
1169     if (offset < length) {
1170         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1171     }
1172 }
1173
1174 /*
1175  * 8.2.19   Reporting Triggers
1176  */
1177 static void
1178 dissect_pfcp_reporting_triggers(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1179 {
1180     int offset = 0;
1181
1182     static const int * pfcp_reporting_triggers_flags[] = {
1183                 &hf_pfcp_reporting_triggers_b15_liusa,
1184                 &hf_pfcp_reporting_triggers_b14_droth,
1185                 &hf_pfcp_reporting_triggers_b13_stopt,
1186                 &hf_pfcp_reporting_triggers_b12_start,
1187                 &hf_pfcp_reporting_triggers_b11_quhti,
1188                 &hf_pfcp_reporting_triggers_b10_timth,
1189                 &hf_pfcp_reporting_triggers_b9_volth,
1190                 &hf_pfcp_reporting_triggers_b8_perio,
1191                 &hf_pfcp_reporting_triggers_b7_b3_spare,
1192                 &hf_pfcp_reporting_triggers_b2_envcl,
1193                 &hf_pfcp_reporting_triggers_b1_timqu,
1194                 &hf_pfcp_reporting_triggers_b0_volqu,
1195         NULL
1196     };
1197     /* Octet 5 [Bits 15-08] LIUSA   DROTH   STOPT   START   QUHTI   TIMTH   VOLTH   PERIO */
1198     /* Octet 6 [Bits 07-00] SPARE   SPARE   SPARE   SPARE   SPARE   ENVCL   TIMQU   VOLQU */
1199     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_reporting_triggers,
1200         ett_pfcp_reporting_triggers, pfcp_reporting_triggers_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
1201     offset += 2;
1202
1203     if (offset < length) {
1204         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1205     }
1206
1207 }
1208
1209 /*
1210  * 8.2.20   Redirect Information
1211  */
1212 static const value_string pfcp_redirect_address_type_vals[] = {
1213
1214     { 0, "IPv4 address" },
1215     { 1, "IPv6 address" },
1216     { 2, "URL" },
1217     { 3, "SIP URI" },
1218     { 0, NULL }
1219 };
1220
1221 static void
1222 dissect_pfcp_redirect_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1223 {
1224     int offset = 0;
1225     guint32 value, addr_len;
1226
1227     /* Octet Spare  Redirect Address Type */
1228     proto_tree_add_item(tree, hf_pfcp_spare_h1, tvb, offset, 1, ENC_BIG_ENDIAN);
1229     proto_tree_add_item_ret_uint(tree, hf_pfcp_redirect_address_type, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
1230     offset++;
1231
1232     /* 6-7  Redirect Server Address Length=a */
1233     proto_tree_add_item_ret_uint(tree, hf_pfcp_redirect_server_addr_len, tvb, offset, 2, ENC_BIG_ENDIAN, &addr_len);
1234     offset+=2;
1235
1236     /* 8-(8+a)  Redirect Server Address */
1237     proto_tree_add_item(tree, hf_pfcp_redirect_server_address, tvb, offset, addr_len, ENC_UTF_8 | ENC_NA);
1238     offset += addr_len;
1239
1240     if (offset < length) {
1241         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1242     }
1243 }
1244 /*
1245  * 8.2.21   Report Type
1246  */
1247 static void
1248 dissect_pfcp_report_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1249 {
1250     int offset = 0;
1251
1252     static const int * pfcp_report_type_flags[] = {
1253         &hf_pfcp_spare_b7_b3,
1254         &hf_pfcp_b2_erir,
1255         &hf_pfcp_b1_usar,
1256         &hf_pfcp_b0_dldr,
1257         NULL
1258     };
1259     /* Octet 5  Spare   ERIR    USAR    DLDR */
1260     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_report_type,
1261         ett_pfcp_report_type, pfcp_report_type_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
1262     offset += 1;
1263
1264     if (offset < length) {
1265         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1266     }
1267
1268 }
1269 /*
1270  * 8.2.22   Offending IE
1271  */
1272 static void
1273 dissect_pfcp_offending_ie(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_)
1274 {
1275     guint32 value;
1276     /* Octet 5 to 6 Type of the offending IE */
1277     proto_tree_add_item_ret_uint(tree, hf_pfcp_offending_ie, tvb, 0, 2, ENC_BIG_ENDIAN, &value);
1278
1279     proto_item_append_text(item, "%s", val_to_str_const(value, pfcp_ie_type, "Unknown"));
1280
1281 }
1282 /*
1283  * 8.2.23   Forwarding Policy
1284  */
1285 static void
1286 dissect_pfcp_forwarding_policy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1287 {
1288     int offset = 0;
1289     guint32 id_len;
1290
1291     /* Octet Forwarding Policy Identifier Length */
1292     proto_tree_add_item_ret_uint(tree, hf_pfcp_forwarding_policy_id_len, tvb, offset, 1, ENC_BIG_ENDIAN, &id_len);
1293     offset += 1;
1294
1295     proto_tree_add_item(tree, hf_pfcp_forwarding_policy_id, tvb, offset, id_len, ENC_NA);
1296     offset += id_len;
1297
1298     if (offset < length) {
1299         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1300     }
1301
1302 }
1303 /*
1304  * 8.2.24   Destination Interface
1305  */
1306 static const value_string pfcp_dst_interface_vals[] = {
1307
1308     { 0, "Access" },
1309     { 1, "Core" },
1310     { 2, "SGi-LAN" },
1311     { 3, "CP- Function" },
1312     { 4, "LI Function" },
1313     { 0, NULL }
1314 };
1315
1316 static void
1317 dissect_pfcp_destination_interface(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1318 {
1319     int offset = 0;
1320     guint32 value;
1321
1322     /* Octet 5    Spare Interface value*/
1323     proto_tree_add_item(tree, hf_pfcp_spare_h1, tvb, offset, 1, ENC_BIG_ENDIAN);
1324     proto_tree_add_item_ret_uint(tree, hf_pfcp_dst_interface, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
1325     offset++;
1326
1327     proto_item_append_text(item, "%s", val_to_str_const(value, pfcp_dst_interface_vals, "Unknown"));
1328
1329     if (offset < length) {
1330         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1331     }
1332
1333 }
1334 /*
1335  * 8.2.25   UP Function Features
1336  */
1337 static void
1338 dissect_pfcp_up_function_features(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1339 {
1340     int offset = 0;
1341
1342     static const int * pfcp_up_function_features_flags[] = {
1343         &hf_pfcp_b15_treu,
1344         &hf_pfcp_b14_heeu,
1345         &hf_pfcp_b13_pfdm,
1346         &hf_pfcp_b12_ftup,
1347         &hf_pfcp_b11_trst,
1348         &hf_pfcp_b10_dlbd,
1349         &hf_pfcp_b9_ddnd,
1350         &hf_pfcp_b8_bucp,
1351         &hf_pfcp_b1_b7_spare,
1352         &hf_pfcp_b0_empu,
1353         NULL
1354     };
1355     /* Octet 5  TREU   HEEU   PFDM   FTUP   TRST   DLBD   DDND   BUCP*/
1356     /* Octet 6  Spare   Spare   Spare   Spare   Spare   Spare   Spare   EMPU*/
1357     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_up_function_features,
1358         ett_pfcp_up_function_features, pfcp_up_function_features_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
1359     offset += 2;
1360
1361     if (offset < length) {
1362         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1363     }
1364
1365 }
1366 /*
1367  * 8.2.26   Apply Action
1368  */
1369 static void
1370 dissect_pfcp_apply_action(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1371 {
1372     int offset = 0;
1373
1374     static const int * pfcp_apply_action_flags[] = {
1375         &hf_pfcp_spare_b7_b5,
1376         &hf_pfcp_apply_action_b4_dupl,
1377         &hf_pfcp_apply_action_b3_nocp,
1378         &hf_pfcp_apply_action_b2_buff,
1379         &hf_pfcp_apply_action_b1_forw,
1380         &hf_pfcp_apply_action_b0_drop,
1381         NULL
1382     };
1383     /* Octet 5  Spare   Spare   Spare   DUPL    NOCP    BUFF    FORW    DROP */
1384     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_apply_action_flags,
1385         ett_pfcp_apply_action_flags, pfcp_apply_action_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS);
1386     offset += 1;
1387
1388     if (offset < length) {
1389         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1390     }
1391
1392 }
1393 /*
1394  * 8.2.27   Downlink Data Service Information
1395  */
1396 static void
1397 dissect_pfcp_dl_data_service_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1398 {
1399     int offset = 0;
1400     guint64 flags;
1401
1402     static const int * pfcp_dl_data_service_inf_flags[] = {
1403         &hf_pfcp_spare_b7_b1,
1404         &hf_pfcp_b0_ppi,
1405         NULL
1406     };
1407     /* Octet 5  Spare   PPI */
1408     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_pfcp_dl_data_service_inf_flags,
1409         ett_pfcp_dl_data_service_inf, pfcp_dl_data_service_inf_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS, &flags);
1410     offset += 1;
1411     /* The PPI flag in octet 5 indicates whether the Paging Policy Indication value in octet 'm' shall be present */
1412     if ((flags & 0x1) == 1) {
1413         /* m    Spare   Paging Policy Indication value
1414          * encoded as the DSCP in TOS (IPv4) or TC (IPv6) information received in the IP payload of the GTP-U packet
1415          * from the PGW (see IETF RFC 2474
1416          */
1417         proto_tree_add_item(tree, hf_pfcp_spare_b7_b6, tvb, offset, 1, ENC_BIG_ENDIAN);
1418         proto_tree_add_item(tree, hf_pfcp_ppi, tvb, offset, 1, ENC_BIG_ENDIAN);
1419         offset++;
1420     }
1421
1422     if (offset < length) {
1423         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1424     }
1425
1426 }
1427 /*
1428  * 8.2.28   Downlink Data Notification Delay
1429  */
1430 static void
1431 dissect_pfcp_dl_data_notification_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1432 {
1433     int offset = 0;
1434     guint32 value;
1435     /* Octet 5 Delay Value in integer multiples of 50 millisecs, or zero */
1436     proto_tree_add_item_ret_uint(tree, hf_pfcp_dl_data_notification_delay, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
1437     offset += 1;
1438
1439     proto_item_append_text(item, "%u ms", value * 50);
1440
1441     if (offset < length) {
1442         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1443     }
1444 }
1445
1446 /*
1447  * 8.2.29   DL Buffering Duration
1448  */
1449 static const value_string pfcp_timer_unit_vals[] = {
1450     { 0, "value is incremented in multiples of 2 seconds" },
1451     { 1, "value is incremented in multiples of 1 minute" },
1452     { 2, "value is incremented in multiples of 10 minutes" },
1453     { 3, "value is incremented in multiples of 1 hour" },
1454     { 4, "value is incremented in multiples of 10 hour" },
1455     { 5, "values shall be interpreted as multiples of 1 minute(version 14.0.0)" },
1456     { 6, "values shall be interpreted as multiples of 1 minute(version 14.0.0)" },
1457     { 7, "value indicates that the timer is infinite" },
1458     { 0, NULL }
1459 };
1460
1461 static void
1462 dissect_pfcp_dl_buffering_dur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_)
1463 {
1464     int offset = 0;
1465     guint32 unit, value;
1466
1467     /* Octet 5  Timer unit  Timer value */
1468     proto_tree_add_item_ret_uint(tree, hf_pfcp_timer_unit, tvb, offset, 1, ENC_BIG_ENDIAN, &unit);
1469     proto_tree_add_item_ret_uint(tree, hf_pfcp_timer_value, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
1470     offset++;
1471
1472     unit = unit >> 5;
1473     switch (unit) {
1474     case 0:
1475         proto_item_append_text(item, "%u s", value * 2);
1476         break;
1477     case 1:
1478         proto_item_append_text(item, "%u min", value);
1479         break;
1480     case 2:
1481         proto_item_append_text(item, "%u min", value * 10);
1482         break;
1483     case 3:
1484         proto_item_append_text(item, "%u hours", value);
1485         break;
1486     case 4:
1487         proto_item_append_text(item, "%u hours", value * 10);
1488         break;
1489     case 7:
1490         proto_item_append_text(item, "%u Infinite", value);
1491         break;
1492         /* Value 5 and 6 */
1493     default:
1494         proto_item_append_text(item, "%u min", value * 10);
1495         break;
1496     }
1497     if ((unit != 7) && (value == 0)) {
1498         proto_item_append_text(item, " Stopped");
1499     }
1500
1501     if (offset < length) {
1502         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1503     }
1504
1505 }
1506
1507 /*
1508  * 8.2.30   DL Buffering Suggested Packet Count
1509  */
1510 static void
1511 dissect_pfcp_dl_buffering_suggested_packet_count(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1512 {
1513     /* Octet 5 to n+4 Packet Count Value
1514     * The length shall be set to 1 or 2 octets.
1515     */
1516     proto_tree_add_item(tree, hf_pfcp_packet_count, tvb, 0, length, ENC_BIG_ENDIAN);
1517 }
1518 /*
1519  * 8.2.31   SxSMReq-Flags
1520  */
1521 static void
1522 dissect_pfcp_sxsmreq_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1523 {
1524     int offset = 0;
1525
1526     static const int * pfcp_sxsmreq_flags[] = {
1527         &hf_pfcp_spare_b7_b3,
1528         &hf_pfcp_b2_qaurr,
1529         &hf_pfcp_b1_sndem,
1530         &hf_pfcp_b0_drobu,
1531         NULL
1532     };
1533     /* Octet 5  Spare   Spare   Spare   Spare   Spare   QAURR   SNDEM   DROBU */
1534     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_sxsmreq_flags,
1535         ett_pfcp_sxsmreq, pfcp_sxsmreq_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
1536     offset += 1;
1537
1538     if (offset < length) {
1539         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1540     }
1541
1542 }
1543 /*
1544  * 8.2.32   SxSRRsp-Flags
1545  */
1546 static void
1547 dissect_pfcp_sxsrrsp_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1548 {
1549     int offset = 0;
1550
1551     static const int * pfcp_sxsrrsp_flags[] = {
1552         &hf_pfcp_spare_b7_b1,
1553         &hf_pfcp_b0_drobu,
1554         NULL
1555     };
1556     /* Octet 5  Spare   Spare   Spare   Spare   Spare   Spare   Spare   DROBU */
1557     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_sxsrrsp_flags,
1558         ett_pfcp_sxsrrsp, pfcp_sxsrrsp_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
1559     offset += 1;
1560
1561     if (offset < length) {
1562         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1563     }
1564
1565 }
1566
1567 /*
1568  * 8.2.33   Sequence Number
1569  */
1570 static void
1571 dissect_pfcp_sequence_number(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_)
1572 {
1573     guint32 value;
1574     /* Octet 5 to 8     Sequence Number */
1575     proto_tree_add_item_ret_uint(tree, hf_pfcp_sequence_number, tvb, 0, 4, ENC_BIG_ENDIAN, &value);
1576
1577     proto_item_append_text(item, "%u", value);
1578
1579 }
1580
1581 /*
1582  * 8.2.34   Metric
1583  */
1584 static void
1585 dissect_pfcp_metric(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_)
1586 {
1587     guint32 value;
1588     /* Octet 5  Metric */
1589     proto_tree_add_item_ret_uint(tree, hf_pfcp_metric, tvb, 0, 1, ENC_BIG_ENDIAN, &value);
1590
1591     proto_item_append_text(item, "%u", value);
1592
1593 }
1594
1595 /*
1596  * 8.2.35   Timer
1597  */
1598 static void
1599 dissect_pfcp_timer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_)
1600 {
1601     int offset = 0;
1602     guint32 unit, value;
1603
1604     /* Octet 5  Timer unit  Timer value */
1605     proto_tree_add_item_ret_uint(tree, hf_pfcp_timer_unit, tvb, offset, 1, ENC_BIG_ENDIAN, &unit);
1606     proto_tree_add_item_ret_uint(tree, hf_pfcp_timer_value, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
1607     offset++;
1608
1609     unit = unit >> 5;
1610     switch (unit) {
1611     case 0:
1612         proto_item_append_text(item, "%u s", value * 2);
1613         break;
1614     case 1:
1615         proto_item_append_text(item, "%u min", value);
1616         break;
1617     case 2:
1618         proto_item_append_text(item, "%u min", value * 10);
1619         break;
1620     case 3:
1621         proto_item_append_text(item, "%u hours", value);
1622         break;
1623     case 4:
1624         proto_item_append_text(item, "%u hours", value * 10);
1625         break;
1626     case 7:
1627         proto_item_append_text(item, "%u Infinite", value);
1628         break;
1629         /* Value 5 and 6 */
1630     default:
1631         proto_item_append_text(item, "%u min", value * 10);
1632         break;
1633     }
1634     if ((unit != 7) && (value == 0)) {
1635         proto_item_append_text(item, " Stopped");
1636     }
1637
1638     if (offset < length) {
1639         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1640     }
1641
1642 }
1643
1644 /*
1645  * 8.2.36   Packet Detection Rule ID (PDR ID)
1646  */
1647 static int
1648 decode_pfcp_pdr_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, gint offset)
1649 {
1650     guint32 rule_id;
1651     /* Octet 5 to 6 Rule ID*/
1652     proto_tree_add_item_ret_uint(tree, hf_pfcp_pdr_id, tvb, offset, 2, ENC_BIG_ENDIAN, &rule_id);
1653     offset += 2;
1654
1655     proto_item_append_text(item, "%u", rule_id);
1656
1657     return offset;
1658 }
1659 static void
1660 dissect_pfcp_pdr_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1661 {
1662     int offset = 0;
1663
1664     offset = decode_pfcp_pdr_id(tvb, pinfo, tree, item, offset);
1665
1666     if (offset < length) {
1667         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1668     }
1669 }
1670 /*
1671  * 8.2.37   F-SEID
1672  */
1673 static void
1674 dissect_pfcp_f_seid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1675 {
1676     int offset = 0;
1677     guint64 f_seid_flags;
1678
1679     static const int * pfcp_f_seid_flags[] = {
1680         &hf_pfcp_spare_b7,
1681         &hf_pfcp_spare_b6,
1682         &hf_pfcp_spare_b5,
1683         &hf_pfcp_spare_b4,
1684         &hf_pfcp_spare_b3,
1685         &hf_pfcp_spare_b2,
1686         &hf_pfcp_b1_v4,
1687         &hf_pfcp_b0_v6,
1688         NULL
1689     };
1690     /* Octet 5  Spare   Spare   Spare   Spare   Spare   Spare   V4  V6*/
1691     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_f_seid_flags,
1692         ett_pfcp_f_seid_flags, pfcp_f_seid_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS, &f_seid_flags);
1693     offset += 1;
1694
1695     if ((f_seid_flags & 0x3) == 0) {
1696         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_encoding_error, tvb, 0, 1);
1697         return;
1698     }
1699     /* Octet 6 to 13    SEID  */
1700     proto_tree_add_item(tree, hf_pfcp_seid, tvb, offset, 8, ENC_BIG_ENDIAN);
1701     offset += 8;
1702     /* IPv4 address (if present)*/
1703     if ((f_seid_flags & 0x2) == 2) {
1704         proto_tree_add_item(tree, hf_pfcp_f_seid_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
1705         offset += 4;
1706     }
1707     /* IPv6 address (if present)*/
1708     if ((f_seid_flags & 0x1) == 1) {
1709         proto_tree_add_item(tree, hf_pfcp_f_seid_ipv6, tvb, offset, 16, ENC_NA);
1710         offset += 16;
1711     }
1712     if (offset < length) {
1713         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1714     }
1715 }
1716
1717 /*
1718  *   8.2.38   Node ID
1719  */
1720
1721 static const value_string pfcp_node_id_type_vals[] = {
1722
1723     { 0, "IPv4 address" },
1724     { 1, "IPv6 address" },
1725     { 2, "FQDN" },
1726     { 0, NULL }
1727 };
1728
1729 static void
1730 dissect_pfcp_node_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1731 {
1732     int offset = 0, name_len, tmp;
1733     guint32 node_id_type;
1734     guint8 *fqdn = NULL;
1735
1736     /* Octet 5    Spare Node ID Type*/
1737     proto_tree_add_item(tree, hf_pfcp_spare_h1, tvb, offset, 1, ENC_BIG_ENDIAN);
1738     proto_tree_add_item_ret_uint(tree, hf_pfcp_node_id_type, tvb, offset, 1, ENC_BIG_ENDIAN, &node_id_type);
1739     offset++;
1740
1741     switch (node_id_type) {
1742         case 0:
1743             /* IPv4 address */
1744             proto_tree_add_item(tree, hf_pfcp_node_id_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
1745             proto_item_append_text(item, "IPv4 %s", tvb_ip_to_str(tvb, offset));
1746             offset += 4;
1747             break;
1748         case 1:
1749             /* IPv6 address */
1750             proto_tree_add_item(tree, hf_pfcp_node_id_ipv6, tvb, offset, 16, ENC_NA);
1751             proto_item_append_text(item, "IPv6 %s", tvb_ip6_to_str(tvb, offset));
1752             offset += 16;
1753             break;
1754         case 2:
1755             /* FQDN, the Node ID value encoding shall be identical to the encoding of a FQDN
1756              * within a DNS message of section 3.1 of IETF RFC 1035 [27] but excluding the trailing zero byte.
1757              */
1758             if (length > 1) {
1759                 name_len = tvb_get_guint8(tvb, offset);
1760                 /* NOTE 1: The FQDN field in the IE is not encoded as a dotted string as commonly used in DNS master zone files. */
1761                 if (name_len < 0x40) {
1762                     fqdn = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 1, length - 2, ENC_ASCII);
1763                     for (;;) {
1764                         if (name_len >= length - 2)
1765                             break;
1766                         tmp = name_len;
1767                         name_len = name_len + fqdn[tmp] + 1;
1768                         fqdn[tmp] = '.';
1769                     }
1770                 }
1771                 /* In case the FQDN field is incorrectly in dotted string form.*/
1772                 else {
1773                     fqdn = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length - 1, ENC_ASCII);
1774                     proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_encoding_error, tvb, offset, length - 1);
1775                 }
1776                 proto_tree_add_string(tree, hf_pfcp_node_id_fqdn, tvb, offset, length - 1, fqdn);
1777                 proto_item_append_text(item, "%s", fqdn);
1778                 offset += length - 1;
1779             }
1780             break;
1781         default:
1782             break;
1783     }
1784
1785     if (offset < length) {
1786         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1787     }
1788
1789 }
1790 /*
1791  * 8.2.39   PFD Contents
1792  */
1793 static void
1794 dissect_pfcp_pfd_contents(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1795 {
1796     int offset = 0;
1797     guint64 flags;
1798     guint32 len;
1799
1800     static const int * pfcp_pfd_contents_flags[] = {
1801         &hf_pfcp_spare_b7_b4,
1802         &hf_pfcp_b3_cp,
1803         &hf_pfcp_b2_dn,
1804         &hf_pfcp_b1_url,
1805         &hf_pfcp_b0_fd,
1806         NULL
1807     };
1808     /* Octet 5  Spare   CP  DN  URL FD*/
1809     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_pfd_contents_flags,
1810         ett_pfcp_measurement_method_flags, pfcp_pfd_contents_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags);
1811     offset += 1;
1812
1813     /* Bit 1 - FD (Flow Description): If this bit is set to "1", then the Length of Flow Description
1814      * and the Flow Description fields shall be present
1815      */
1816     if ((flags & 0x1) == 1) {
1817         /* The Flow Description field, when present, shall be encoded as an OctetString
1818         * as specified in subclause 6.4.3.7 of 3GPP TS 29.251
1819         */
1820         /* m to (m+1)   Length of Flow Description */
1821         proto_tree_add_item_ret_uint(tree, hf_pfcp_flow_desc_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len);
1822         offset += 2;
1823
1824         /* (m+2) to p   Flow Description */
1825         proto_tree_add_item(tree, hf_pfcp_fd, tvb, offset, len, ENC_NA);
1826         offset += len;
1827     }
1828
1829
1830     /* Bit 2 - URL (URL): If this bit is set to "1", then the Length of URL and the URL fields shall be present */
1831     if ((flags & 0x2) == 2) {
1832         /* q to (q+1)   Length of URL */
1833         proto_tree_add_item_ret_uint(tree, hf_pfcp_url_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len);
1834         offset += 2;
1835         /* (q+2) to r   URL */
1836         proto_tree_add_item(tree, hf_pfcp_url, tvb, offset, len, ENC_NA);
1837         offset += len;
1838
1839     }
1840
1841     /* Bit 3 - DN (Domain Name): If this bit is set to "1", then the Length of Domain Name and
1842     * the Domain Name fields shall be present
1843     */
1844     if ((flags & 0x4) == 4) {
1845         /* s to (s+1)   Length of Domain Name */
1846         proto_tree_add_item_ret_uint(tree, hf_pfcp_dn_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len);
1847         offset += 2;
1848         /* (s+2) to t   Domain Name */
1849         proto_tree_add_item(tree, hf_pfcp_dn, tvb, offset, len, ENC_NA);
1850         offset += len;
1851     }
1852
1853     /* Bit 4 - CP (Custom PFD Content): If this bit is set to "1", then the Length of Custom PFD Content and
1854      * the Custom PFD Content fields shall be present
1855      */
1856     if ((flags & 0x8) == 8) {
1857         /* u to (u+1)   Length of Custom PFD Content */
1858         proto_tree_add_item_ret_uint(tree, hf_pfcp_cp_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len);
1859         offset += 2;
1860         /* (u+2) to v   Custom PFD Content */
1861         proto_tree_add_item(tree, hf_pfcp_cp, tvb, offset, len, ENC_NA);
1862         offset += len;
1863     }
1864
1865     if (offset < length) {
1866         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1867     }
1868
1869 }
1870 /*
1871  * 8.2.40   Measurement Method
1872  */
1873 static void
1874 dissect_pfcp_measurement_method(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1875 {
1876     int offset = 0;
1877
1878     static const int * pfcp_measurement_method_flags[] = {
1879         &hf_pfcp_spare_b7_b3,
1880         &hf_pfcp_b2_event,
1881         &hf_pfcp_b1_volume,
1882         &hf_pfcp_b0_durat,
1883         NULL
1884     };
1885     /* Octet 5  Spare   Spare   Spare   Spare   Spare   EVENT   VOLUM   DURAT*/
1886     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_measurement_method_flags,
1887         ett_pfcp_measurement_method_flags, pfcp_measurement_method_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
1888     offset += 1;
1889
1890     if (offset < length) {
1891         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1892     }
1893
1894 }
1895
1896 /*
1897  * 8.2.41   Usage Report Trigger
1898  */
1899 static void
1900 dissect_pfcp_usage_report_trigger(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1901 {
1902     int offset = 0;
1903
1904     static const int * pfcp_usage_report_trigger_flags[] = {
1905
1906         &hf_pfcp_usage_report_trigger_b15_immer,
1907         &hf_pfcp_usage_report_trigger_b14_droth,
1908         &hf_pfcp_usage_report_trigger_b13_stopt,
1909         &hf_pfcp_usage_report_trigger_b12_start,
1910         &hf_pfcp_usage_report_trigger_b11_quhti,
1911         &hf_pfcp_usage_report_trigger_b10_timth,
1912         &hf_pfcp_usage_report_trigger_b9_volth,
1913         &hf_pfcp_usage_report_trigger_b8_perio,
1914         &hf_pfcp_usage_report_trigger_b7_b6_spare,
1915         &hf_pfcp_usage_report_trigger_b5_envcl,
1916         &hf_pfcp_usage_report_trigger_b4_monit,
1917         &hf_pfcp_usage_report_trigger_b3_termr,
1918         &hf_pfcp_usage_report_trigger_b2_liusa,
1919         &hf_pfcp_usage_report_trigger_b1_timqu,
1920         &hf_pfcp_usage_report_trigger_b0_volqu,
1921         NULL
1922     };
1923     /* Octet 5  IMMER   DROTH   STOPT   START   QUHTI   TIMTH   VOLTH   PERIO*/
1924     /* Octet 6  Spare   Spare   ENVCL   MONIT   TERMR   LIUSA   TIMQU   VOLQU*/
1925     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_usage_report_trigger,
1926         ett_pfcp_report_trigger, pfcp_usage_report_trigger_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
1927     offset += 2;
1928
1929     if (offset < length) {
1930         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1931     }
1932
1933 }
1934
1935 /*
1936  * 8.2.42   Measurement Period
1937  */
1938 static void
1939 dissect_pfcp_measurement_period(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
1940 {
1941     int offset = 0;
1942     guint32 value;
1943     /* 5 to 8   Measurement Period*/
1944     proto_tree_add_item_ret_uint(tree, hf_pfcp_measurement_period, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
1945     offset += 4;
1946
1947     proto_item_append_text(item, "%u", value);
1948
1949     if (offset < length) {
1950         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1951     }
1952 }
1953
1954 /*
1955  * 8.2.43   Fully qualified PDN Connection Set Identifier (FQ-CSID)
1956  */
1957 static const value_string pfcp_fq_csid_node_id_type_vals[] = {
1958
1959     { 0, "Node-Address is a global unicast IPv4 address" },
1960     { 1, "Node-Address is a global unicast IPv6 address" },
1961     { 2, "Node-Address is a 4 octets long field" },
1962     { 0, NULL }
1963 };
1964
1965 static void
1966 dissect_pfcp_fq_csid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
1967 {
1968     int offset = 0;
1969     guint32 node_id_type, num_csid;
1970
1971     /* Octet 5  FQ-CSID Node-ID Type    Number of CSIDs= m*/
1972     proto_tree_add_item_ret_uint(tree, hf_pfcp_fq_csid_node_id_type, tvb, offset, 1, ENC_BIG_ENDIAN, &node_id_type);
1973     proto_tree_add_item_ret_uint(tree, hf_pfcp_num_csid, tvb, offset, 1, ENC_BIG_ENDIAN, &num_csid);
1974     offset++;
1975
1976     /* 6 to p   Node-Address  */
1977     switch (node_id_type) {
1978     case 0:
1979         /* 0    indicates that Node-Address is a global unicast IPv4 address and p = 9 */
1980         proto_tree_add_item(tree, hf_pfcp_fq_csid_node_id_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
1981         offset += 4;
1982         break;
1983     case 1:
1984         /* 1    indicates that Node-Address is a global unicast IPv6 address and p = 21 */
1985         proto_tree_add_item(tree, hf_pfcp_fq_csid_node_id_ipv6, tvb, offset, 16, ENC_NA);
1986         offset += 16;
1987         break;
1988     case 2:
1989         /* 2    indicates that Node-Address is a 4 octets long field with a 32 bit value stored in network order, and p= 9
1990          *      Most significant 20 bits are the binary encoded value of (MCC * 1000 + MNC).
1991          *      Least significant 12 bits is a 12 bit integer assigned by an operator to an MME, SGW-C, SGW-U, PGW-C or PGW-U
1992          */
1993         proto_tree_add_item(tree, hf_pfcp_fq_csid_node_id_mcc_mnc, tvb, offset, 4, ENC_BIG_ENDIAN);
1994         proto_tree_add_item(tree, hf_pfcp_fq_csid_node_id_int, tvb, offset, 4, ENC_BIG_ENDIAN);
1995         offset += 4;
1996         break;
1997     default:
1998         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
1999         break;
2000     }
2001
2002     while (num_csid > 0) {
2003         proto_tree_add_item(tree, hf_pfcp_fq_csid, tvb, offset, 2, ENC_BIG_ENDIAN);
2004         offset += 2;
2005         num_csid--;
2006     }
2007     if (offset < length) {
2008         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2009     }
2010
2011 }
2012 /*
2013  * 8.2.44   Volume Measurement
2014  */
2015 static void
2016 dissect_pfcp_volume_measurement(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2017 {
2018     int offset = 0;
2019     guint64 flags;
2020
2021     static const int * pfcp_volume_measurement_flags[] = {
2022         &hf_pfcp_spare_b7_b3,
2023         &hf_pfcp_b2_dlvol,
2024         &hf_pfcp_b1_ulvol,
2025         &hf_pfcp_b0_tovol,
2026         NULL
2027     };
2028     /* Octet 5  Spare   DLVOL   ULVOL   TOVOL*/
2029     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_volume_measurement,
2030         ett_pfcp_volume_measurement, pfcp_volume_measurement_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags);
2031     offset += 1;
2032
2033     /* Bit 1 - TOVOL: If this bit is set to "1", then the Total Volume field shall be present*/
2034     if ((flags & 0x1) == 1) {
2035         /* m to (m+7)   Total Volume */
2036         proto_tree_add_item(tree, hf_pfcp_vol_meas_tovol, tvb, offset, 8, ENC_BIG_ENDIAN);
2037         offset += 8;
2038     }
2039     /* Bit 2 - ULVOL: If this bit is set to "1", then the Total Volume field shall be present*/
2040     if ((flags & 0x2) == 2) {
2041         /* p to (p+7)   Uplink Volume */
2042         proto_tree_add_item(tree, hf_pfcp_vol_meas_ulvol, tvb, offset, 8, ENC_BIG_ENDIAN);
2043         offset += 8;
2044     }
2045     /* Bit 3 - DLVOL: If this bit is set to "1", then the Total Volume field shall be present*/
2046     if ((flags & 0x4) == 4) {
2047         /*q to (q+7)    Downlink Volume */
2048         proto_tree_add_item(tree, hf_pfcp_vol_meas_dlvol, tvb, offset, 8, ENC_BIG_ENDIAN);
2049         offset += 8;
2050     }
2051
2052     if (offset < length) {
2053         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2054     }
2055
2056 }
2057 /*
2058  * 8.2.45   Duration Measurement
2059  */
2060 static void
2061 dissect_pfcp_duration_measurement(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2062 {
2063     int offset = 0;
2064     guint32 value;
2065     /* 5 to 8   Duration value*/
2066     proto_tree_add_item_ret_uint(tree, hf_pfcp_duration_measurement, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
2067     offset += 4;
2068
2069     proto_item_append_text(item, "%u s", value);
2070
2071     if (offset < length) {
2072         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2073     }
2074 }
2075 /*
2076  * 8.2.46   Time of First Packet
2077  */
2078 static void
2079 dissect_pfcp_time_of_first_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2080 {
2081     int offset = 0;
2082     const gchar *time_str;
2083
2084     /* Octets 5 to 8 shall be encoded in the same format as the first four octets of the 64-bit timestamp
2085      * format as defined in section 6 of IETF RFC 5905
2086      */
2087
2088     time_str = tvb_ntp_fmt_ts_sec(tvb, 0);
2089     proto_tree_add_string(tree, hf_pfcp_time_of_first_packet, tvb, offset, 4, time_str);
2090     proto_item_append_text(item, "%s", time_str);
2091     offset += 4;
2092
2093     if (offset < length) {
2094         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2095     }
2096 }
2097 /*
2098  * 8.2.47   Time of Last Packet
2099  */
2100 static void
2101 dissect_pfcp_time_of_last_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2102 {
2103     int offset = 0;
2104     const gchar *time_str;
2105
2106     /* Octets 5 to 8 shall be encoded in the same format as the first four octets of the 64-bit timestamp
2107     * format as defined in section 6 of IETF RFC 5905
2108     */
2109
2110     time_str = tvb_ntp_fmt_ts_sec(tvb, 0);
2111     proto_tree_add_string(tree, hf_pfcp_time_of_last_packet, tvb, offset, 4, time_str);
2112     proto_item_append_text(item, "%s", time_str);
2113     offset += 4;
2114
2115     if (offset < length) {
2116         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2117     }
2118 }
2119 /*
2120  * 8.2.48   Quota Holding Time
2121  */
2122 static void
2123 dissect_pfcp_quota_holding_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2124 {
2125     int offset = 0;
2126     guint32 value;
2127     /* Octet 5 to 8     Time Quota value
2128     * TThe Time Quota value shall be encoded as an Unsigned32 binary integer value. It contains a duration in seconds
2129     */
2130     proto_tree_add_item_ret_uint(tree, hf_pfcp_quota_holding_time, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
2131     offset += 4;
2132
2133     proto_item_append_text(item, "%u s", value);
2134
2135     if (offset < length) {
2136         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2137     }
2138
2139 }
2140
2141 /*
2142  * 8.2.49   Dropped DL Traffic Threshold
2143  */
2144 static void
2145 dissect_pfcp_dropped_dl_traffic_threshold(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2146 {
2147     int offset = 0;
2148     guint64 flags_val;
2149
2150     static const int * pfcp_dropped_dl_traffic_threshold_flags[] = {
2151         &hf_pfcp_dropped_dl_traffic_threshold_b0_dlpa,
2152         NULL
2153     };
2154     /* Octet 5  Spare   DLPA*/
2155     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_dropped_dl_traffic_threshold,
2156         ett_pfcp_dropped_dl_traffic_threshold, pfcp_dropped_dl_traffic_threshold_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags_val);
2157     offset += 1;
2158
2159     if ((flags_val & 0x1) == 1) {
2160         /* m to (m+7)   Downlink Packets
2161         * DLPA: If this bit is set to "1", then the Downlink Packets field shall be present
2162         */
2163         proto_tree_add_item(tree, hf_pfcp_downlink_packets, tvb, offset, 8, ENC_BIG_ENDIAN);
2164         offset += 8;
2165     }
2166     if (offset < length) {
2167         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2168     }
2169 }
2170 /*
2171  * 8.2.50   Volume Quota
2172  */
2173 static void
2174 dissect_pfcp_volume_quota(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2175 {
2176     int offset = 0;
2177     guint64 flags_val;
2178
2179     static const int * pfcp_volume_quota_flags[] = {
2180         &hf_pfcp_spare_b7_b3,
2181         &hf_pfcp_b2_dlvol,
2182         &hf_pfcp_b1_ulvol,
2183         &hf_pfcp_b0_tovol,
2184         NULL
2185     };
2186     /* Octet 5  Spare   DLVOL   ULVOL   TOVOL*/
2187     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_volume_quota,
2188         ett_pfcp_volume_quota, pfcp_volume_quota_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags_val);
2189     offset += 1;
2190
2191     /* The Total Volume, Uplink Volume and Downlink Volume fields shall be encoded as an Unsigned64 binary integer value.
2192     * They shall contain the total, uplink or downlink number of octets respectively.
2193     */
2194     if ((flags_val & 0x1) == 1) {
2195         /* m to (m+7)   Total Volume
2196         * TOVOL: If this bit is set to "1", then the Total Volume field shall be present
2197         */
2198         proto_tree_add_item(tree, hf_pfcp_volume_quota_tovol, tvb, offset, 8, ENC_BIG_ENDIAN);
2199         offset += 8;
2200     }
2201     if ((flags_val & 0x2) == 2) {
2202         /* p to (p+7)   Uplink Volume
2203         * ULVOL: If this bit is set to "1", then the Uplink Volume field shall be present
2204         */
2205         proto_tree_add_item(tree, hf_pfcp_volume_quota_ulvol, tvb, offset, 8, ENC_BIG_ENDIAN);
2206         offset += 8;
2207     }
2208     if ((flags_val & 0x4) == 4) {
2209         /* q to (q+7)   Downlink Volume
2210         * DLVOL: If this bit is set to "1", then the Downlink Volume field shall be present
2211         */
2212         proto_tree_add_item(tree, hf_pfcp_volume_quota_dlvol, tvb, offset, 8, ENC_BIG_ENDIAN);
2213         offset += 8;
2214     }
2215
2216     if (offset < length) {
2217         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2218     }
2219 }
2220 /*
2221  * 8.2.51   Time Quota
2222  */
2223 static void
2224 dissect_pfcp_time_quota(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2225 {
2226     int offset = 0;
2227     guint32 value;
2228     /* Octet 5 to 8     Time Quota value
2229     * TThe Time Quota value shall be encoded as an Unsigned32 binary integer value. It contains a duration in seconds
2230     */
2231     proto_tree_add_item_ret_uint(tree, hf_pfcp_time_quota, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
2232     offset += 4;
2233
2234     proto_item_append_text(item, "%u s", value);
2235
2236     if (offset < length) {
2237         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2238     }
2239
2240 }
2241 /*
2242  * 8.2.52   Start Time
2243  */
2244 static void
2245 dissect_pfcp_start_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2246 {
2247     const gchar *time_str;
2248     int offset = 0;
2249
2250     /* The Start Time field shall contain a UTC time. Octets 5 to 8 are encoded in the same format as
2251     * the first four octets of the 64-bit timestamp format as defined in section 6 of IETF RFC 5905 [26].
2252     */
2253     time_str = tvb_ntp_fmt_ts_sec(tvb, 0);
2254     proto_tree_add_string(tree, hf_pfcp_start_time, tvb, offset, 4, time_str);
2255     proto_item_append_text(item, "%s", time_str);
2256     offset += 4;
2257
2258     if (offset < length) {
2259         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2260     }
2261
2262 }
2263 /*
2264  * 8.2.53   End Time
2265  */
2266 static void
2267 dissect_pfcp_end_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2268 {
2269     const gchar *time_str;
2270     int offset = 0;
2271
2272     /* The End Time field shall contain a UTC time. Octets 5 to 8 are encoded in the same format as
2273     * the first four octets of the 64-bit timestamp format as defined in section 6 of IETF RFC 5905 [26].
2274     */
2275     time_str = tvb_ntp_fmt_ts_sec(tvb, 0);
2276     proto_tree_add_string(tree, hf_pfcp_end_time, tvb, offset, 4, time_str);
2277     proto_item_append_text(item, "%s", time_str);
2278     offset += 4;
2279
2280     if (offset < length) {
2281         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2282     }
2283
2284 }
2285
2286 /*
2287  * 8.2.54   URR ID
2288  */
2289 static int
2290 decode_pfcp_urr_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint offset)
2291 {
2292     guint32 urr_id;
2293     /* Octet 5 to 8 URR ID value
2294     * The bit 8 of octet 5 is used to indicate if the Rule ID is dynamically allocated by the CP function
2295     * or predefined in the UP function. If set to 0, it indicates that the Rule is dynamically provisioned
2296     * by the CP Function. If set to 1, it indicates that the Rule is predefined in the UP Function
2297     */
2298     proto_tree_add_item(tree, hf_pfcp_urr_id_flg, tvb, offset, 4, ENC_BIG_ENDIAN);
2299     proto_tree_add_item_ret_uint(tree, hf_pfcp_urr_id, tvb, offset, 4, ENC_BIG_ENDIAN, &urr_id);
2300     offset += 4;
2301
2302     proto_item_append_text(item, "%s %u",
2303         ((urr_id & 80000000) ? pfcp_id_predef_dynamic_tfs.true_string : pfcp_id_predef_dynamic_tfs.false_string),
2304         (urr_id & 0x7fffffff));
2305
2306     return offset;
2307 }
2308 static void
2309 dissect_pfcp_urr_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2310 {
2311     int offset = 0;
2312
2313     offset = decode_pfcp_urr_id(tvb, pinfo, tree, item, offset);
2314
2315     if (offset < length) {
2316         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2317     }
2318
2319 }
2320 /*
2321  * 8.2.55   Linked URR ID IE
2322  */
2323 static void
2324 dissect_pfcp_linked_urr_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2325 {
2326     int offset = 0;
2327     guint32 value;
2328     /* Octet 5 to 8 Linked URR ID value
2329     * The Linked URR ID value shall be encoded as an Unsigned32 binary integer value
2330     */
2331     proto_tree_add_item_ret_uint(tree, hf_pfcp_linked_urr_id, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
2332     offset += 4;
2333
2334     proto_item_append_text(item, "%u s", value);
2335
2336     if (offset < length) {
2337         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2338     }
2339
2340 }
2341 /*
2342  * 8.2.56   Outer Header Creation
2343  */
2344
2345 static const value_string pfcp_outer_hdr_desc_vals[] = {
2346
2347     { 0x0100, "GTP-U/UDP/IPv4 " },
2348     { 0x0200, "GTP-U/UDP/IPv6 " },
2349     { 0x0300, "GTP-U/UDP/IPv4/IPv6 " },
2350     { 0x0400, "UDP/IPv4 " },
2351     { 0x0800, "UDP/IPv6 " },
2352     { 0x0C00, "UDP/IPv4/IPv6 " },
2353     { 0, NULL }
2354 };
2355
2356 static void
2357 dissect_pfcp_outer_header_creation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2358 {
2359     int offset = 0;
2360     guint32 value;
2361
2362     /* Octet 5  Outer Header Creation Description */
2363     proto_tree_add_item_ret_uint(tree, hf_pfcp_outer_hdr_desc, tvb, offset, 2, ENC_BIG_ENDIAN, &value);
2364     offset += 2;
2365
2366     /* m to (m+3)   TEID
2367      * The TEID field shall be present if the Outer Header Creation Description requests the creation of a GTP-U header.
2368      * Otherwise it shall not be present
2369      */
2370     if ((value & 0x0100) || (value & 0x0200)) {
2371         proto_tree_add_item(tree, hf_pfcp_outer_hdr_creation_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
2372         offset += 4;
2373     }
2374
2375     /*
2376     * p to (p+3)   IPv4
2377     * The IPv4 Address field shall be present if the Outer Header Creation Description requests the creation of a IPv4 header
2378     */
2379     if ((value & 0x0100) || (value & 0x0400)) {
2380         proto_tree_add_item(tree, hf_pfcp_outer_hdr_creation_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
2381         offset += 4;
2382     }
2383
2384     /*
2385     * q to (q+15)   IPv6
2386     * The IPv6 Address field shall be present if the Outer Header Creation Description requests the creation of a IPv6 header
2387     */
2388     if ((value & 0x0200) || (value & 0x0800)) {
2389         proto_tree_add_item(tree, hf_pfcp_outer_hdr_creation_ipv6, tvb, offset, 16, ENC_NA);
2390         offset += 16;
2391     }
2392
2393     /*
2394     * r to (r+1)   Port Number
2395     * The Port Number field shall be present if the Outer Header Creation Description requests the creation of a UDP/IP header
2396     */
2397     if ((value & 0x0400) || (value & 0x0800)) {
2398         proto_tree_add_item(tree, hf_pfcp_outer_hdr_creation_port, tvb, offset, 2, ENC_BIG_ENDIAN);
2399         offset += 2;
2400     }
2401
2402     if (offset < length) {
2403         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2404     }
2405
2406 }
2407 /*
2408  * 8.2.57   BAR ID
2409  */
2410 static int
2411 decode_pfcp_bar_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 offset)
2412 {
2413     /* Octet 5 BAR ID value
2414     * The BAR ID value shall be encoded as a binary integer value
2415     */
2416     proto_tree_add_item(tree, hf_pfcp_bar_id, tvb, offset, 1, ENC_BIG_ENDIAN);
2417     offset++;
2418
2419     return offset;
2420 }
2421 static void
2422 dissect_pfcp_bar_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2423 {
2424     int offset = 0;
2425
2426     offset = decode_pfcp_bar_id(tvb, pinfo, tree, item, offset);
2427
2428     if (offset < length) {
2429         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2430     }
2431
2432 }
2433
2434 /*
2435  * 8.2.58   CP Function Features
2436  */
2437 static void
2438 dissect_pfcp_cp_function_features(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2439 {
2440     int offset = 0;
2441
2442     static const int * pfcp_cp_function_features_flags[] = {
2443         &hf_pfcp_b1_ovrl,
2444         &hf_pfcp_b0_load,
2445         NULL
2446     };
2447     /* Octet 5
2448      * 5/1 LOAD
2449      * 5/2 OVRL
2450      */
2451     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_cp_function_features,
2452         ett_pfcp_cp_function_features, pfcp_cp_function_features_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
2453     offset += 1;
2454
2455     if (offset < length) {
2456         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2457     }
2458
2459 }
2460
2461 /*
2462  * 8.2.59   Usage Information
2463  */
2464 static void
2465 dissect_pfcp_usage_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2466 {
2467     int offset = 0;
2468
2469     static const int * pfcp_usage_information_flags[] = {
2470         &hf_pfcp_spare_h1,
2471         &hf_pfcp_b3_ube,
2472         &hf_pfcp_b2_uae,
2473         &hf_pfcp_b1_aft,
2474         &hf_pfcp_b0_bef,
2475         NULL
2476     };
2477     /* Octet 5  Spare   UBE UAE AFT BEF */
2478     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_usage_information,
2479         ett_pfcp_usage_information, pfcp_usage_information_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
2480     offset += 1;
2481
2482     if (offset < length) {
2483         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2484     }
2485
2486 }
2487
2488 /*
2489  * 8.2.60   Application Instance ID
2490  */
2491 static void
2492 dissect_pfcp_application_instance_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2493 {
2494     /* Octet 5 5 to (n+4)   Application Instance Identifier
2495      * The Application Instance Identifier shall be encoded as an OctetString (see 3GPP TS 29.212)
2496      */
2497     proto_tree_add_item(tree, hf_pfcp_application_instance_id, tvb, 0, length, ENC_NA);
2498 }
2499
2500 /*
2501  * 8.2.61   Flow Information
2502  */
2503 static const value_string pfcp_flow_dir_vals[] = {
2504     { 0, "Unspecified" },
2505     { 1, "Downlink (traffic to the UE)" },
2506     { 2, "Uplink (traffic from the UE)" },
2507     { 3, "Bidirectional" },
2508     { 0, NULL }
2509 };
2510
2511 static void
2512 dissect_pfcp_flow_inf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2513 {
2514     int offset = 0;
2515     guint32 len;
2516     /* Octet 5 Spare    Flow Direction */
2517     proto_tree_add_item(tree, hf_pfcp_spare_b7_b3, tvb, offset, 1, ENC_BIG_ENDIAN);
2518     proto_tree_add_item(tree, hf_pfcp_flow_dir, tvb, offset, 1, ENC_BIG_ENDIAN);
2519     offset++;
2520
2521     /* 6 to 7   Length of Flow Description */
2522     proto_tree_add_item_ret_uint(tree, hf_pfcp_flow_desc_len, tvb, offset, 2, ENC_BIG_ENDIAN, &len);
2523     offset += 2;
2524     /* Flow Description
2525     * The Flow Description field, when present, shall be encoded as an OctetString
2526     * as specified in subclause 5.4.2 of 3GPP TS 29.212
2527     */
2528     proto_tree_add_item(tree, hf_pfcp_fd, tvb, offset, len, ENC_NA);
2529     offset += len;
2530
2531     if (offset < length) {
2532         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2533     }
2534
2535 }
2536
2537 /*
2538  * 8.2.62   UE IP Address
2539  */
2540 static const true_false_string pfcp_ue_ip_add_sd_flag_vals = {
2541     "Destination IP address",
2542     "Source IP address",
2543 };
2544
2545 static void
2546 dissect_pfcp_ue_ip_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2547 {
2548     int offset = 0;
2549     guint64 ue_ip_address_flags;
2550
2551     static const int * pfcp_ue_ip_address_flags[] = {
2552         &hf_pfcp_spare_b7_b3,
2553         &hf_pfcp_ue_ip_address_flag_b2_sd,
2554         &hf_pfcp_ue_ip_address_flag_b1_v4,
2555         &hf_pfcp_ue_ip_address_flag_b0_v6,
2556         NULL
2557     };
2558     /* Octet 5  Spare   S/D V4  V6*/
2559     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_ue_ip_address_flags,
2560         ett_pfcp_ue_ip_address_flags, pfcp_ue_ip_address_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS, &ue_ip_address_flags);
2561     offset += 1;
2562
2563     /* IPv4 address (if present)*/
2564     if ((ue_ip_address_flags & 0x2) == 2) {
2565         proto_tree_add_item(tree, hf_pfcp_ue_ip_addr_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
2566         offset += 4;
2567     }
2568     /* IPv6 address (if present)*/
2569     if ((ue_ip_address_flags & 0x1) == 1) {
2570         proto_tree_add_item(tree, hf_pfcp_ue_ip_add_ipv6, tvb, offset, 16, ENC_NA);
2571         offset += 16;
2572     }
2573
2574     if (offset < length) {
2575         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2576     }
2577
2578 }
2579 /*
2580  * 8.2.63   Packet Rate
2581  */
2582 static const value_string pfcp_pr_time_unit_vals[] = {
2583     { 0, "Minute" },
2584     { 1, "6 minutes" },
2585     { 2, "Hour" },
2586     { 3, "Day" },
2587     { 4, "Week" },
2588     { 0, NULL }
2589 };
2590
2591 static void
2592 dissect_pfcp_packet_rate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2593 {
2594     int offset = 0;
2595     guint64 flags;
2596
2597     static const int * pfcp_packet_rate_flags[] = {
2598         &hf_pfcp_spare_b7_b2,
2599         &hf_pfcp_dlpr_b1,
2600         &hf_pfcp_ulpr_b0,
2601         NULL
2602     };
2603     /* Octet 5  Spare   DLPR    ULPR */
2604     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_packet_rate,
2605         ett_pfcp_packet_rate, pfcp_packet_rate_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags);
2606     offset += 1;
2607
2608     /* Bit 1 - ULPR (Uplink Packet Rate): If this bit is set to "1", then octets m to (m+2) shall be present */
2609     if ((flags & 0x1) == 1) {
2610         /* m */
2611         proto_tree_add_item(tree, hf_pfcp_spare_b7_b3, tvb, offset, 1, ENC_BIG_ENDIAN);
2612         proto_tree_add_item(tree, hf_pfcp_ul_time_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
2613         offset += 1;
2614         /* (m+1) to (m+2)   Maximum Uplink Packet Rate */
2615         proto_tree_add_item(tree, hf_pfcp_max_ul_pr, tvb, offset, 2, ENC_BIG_ENDIAN);
2616         offset += 2;
2617     }
2618     /* Bit 2 - DLPR (Downlink Packet Rate): If this bit is set to "1", then octets p to (p+2) shall be present*/
2619     if ((flags & 0x2) == 2) {
2620         proto_tree_add_item(tree, hf_pfcp_spare_b7_b3, tvb, offset, 1, ENC_BIG_ENDIAN);
2621         proto_tree_add_item(tree, hf_pfcp_dl_time_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
2622         offset += 1;
2623         /* (m+1) to (m+2)   Maximum Uplink Packet Rate */
2624         proto_tree_add_item(tree, hf_pfcp_max_dl_pr, tvb, offset, 2, ENC_BIG_ENDIAN);
2625         offset += 2;
2626     }
2627
2628     if (offset < length) {
2629         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2630     }
2631
2632 }
2633
2634 /*
2635  * 8.2.64   Outer Header Removal
2636  */
2637 static const value_string pfcp_out_hdr_desc_vals[] = {
2638     { 0, "GTP-U/UDP/IPv4" },
2639     { 1, "GTP-U/UDP/IPv6" },
2640     { 2, "UDP/IPv4" },
2641     { 3, "UDP/IPv6 " },
2642     { 0, NULL }
2643 };
2644
2645 static void
2646 dissect_pfcp_outer_hdr_rem(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2647 {
2648     int offset = 0;
2649     guint32 value;
2650     /* Octet 5 to (n+4) Application Identifier
2651     * The Application Identifier shall be encoded as an OctetString (see 3GPP TS 29.212)
2652     */
2653     proto_tree_add_item_ret_uint(tree, hf_pfcp_out_hdr_desc, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
2654     offset++;
2655
2656     proto_item_append_text(item, "%s", val_to_str_const(value, pfcp_out_hdr_desc_vals, "Unknown"));
2657
2658     if (offset < length) {
2659         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2660     }
2661 }
2662  /*
2663  * 8.2.65   Recovery Time Stamp
2664  */
2665
2666 static void
2667 dissect_pfcp_recovery_time_stamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2668 {
2669     const gchar *time_str;
2670     int offset = 0;
2671
2672     /* indicates the UTC time when the node started. Octets 5 to 8 are encoded in the same format as
2673     * the first four octets of the 64-bit timestamp format as defined in section 6 of IETF RFC 5905 [26].
2674     */
2675     time_str = tvb_ntp_fmt_ts_sec(tvb, 0);
2676     proto_tree_add_string(tree, hf_pfcp_recovery_time_stamp, tvb, offset, 4, time_str);
2677     proto_item_append_text(item, "%s", time_str);
2678     offset += 4;
2679
2680     if (offset < length) {
2681         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2682     }
2683
2684 }
2685 /*
2686  * 8.2.66   DL Flow Level Marking
2687  */
2688 static void
2689 dissect_pfcp_dl_flow_level_marking(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2690 {
2691     int offset = 0;
2692     guint64 flags_val;
2693
2694     static const int * pfcp_dl_flow_level_marking_flags[] = {
2695         &hf_pfcp_spare_b7_b2,
2696         &hf_pfcp_b1_sci,
2697         &hf_pfcp_b0_ttc,
2698         NULL
2699     };
2700     /* Octet 5  Spare   SCI TTC*/
2701     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_dl_flow_level_marking,
2702         ett_pfcp_pfcp_dl_flow_level_marking, pfcp_dl_flow_level_marking_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &flags_val);
2703     offset += 1;
2704
2705     /* Bit 1 - TTC (ToS/Traffic Class): If this bit is set to "1",
2706      * then the ToS/Traffic Class field shall be present
2707      */
2708     if ((flags_val & 0x1) == 1) {
2709         /* m to (m+1)   ToS/Traffic Class
2710         * The ToS/Traffic Class shall be encoded on two octets as an OctetString.
2711         * The first octet shall contain the IPv4 Type-of-Service or the IPv6 Traffic-Class field and
2712         * the second octet shall contain the ToS/Traffic Class mask field
2713         */
2714         proto_tree_add_item(tree, hf_pfcp_tos_traf_class, tvb, offset, 2, ENC_BIG_ENDIAN);
2715         offset += 2;
2716     }
2717     /* SCI (Service Class Indicator): If this bit is set to "1",
2718      * then the Service Class Indicator field shall be present
2719      */
2720     if ((flags_val & 0x2) == 2) {
2721         /* Octets p and (p+1) of the Service Class Indicator field, when present,
2722         * shall be encoded respectively as octets 2 and 3 of the Service Class Indicator Extension Header
2723         * specified in Figure 5.2.2.3-1 of 3GPP TS 29.281
2724         */
2725         proto_tree_add_item(tree, hf_pfcp_sci, tvb, offset, 2, ENC_BIG_ENDIAN);
2726         offset += 2;
2727     }
2728
2729     if (offset < length) {
2730         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2731     }
2732
2733 }
2734
2735 /*
2736  * 8.2.67   Header Enrichment
2737  */
2738 static const value_string pfcp_header_type_vals[] = {
2739     { 0, "HTTP" },
2740     { 0, NULL }
2741 };
2742
2743 static void
2744 dissect_pfcp_header_enrichment(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2745 {
2746     int offset = 0;
2747     guint32 len;
2748     /* Octet 5 Spare    Header Type
2749     */
2750     proto_tree_add_item(tree, hf_pfcp_spare_b7_b5, tvb, offset, 1, ENC_BIG_ENDIAN);
2751     proto_tree_add_item(tree, hf_pfcp_header_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2752     offset++;
2753
2754     /* 6    Length of Header Field Name */
2755     proto_tree_add_item_ret_uint(tree, hf_pfcp_hf_len, tvb, offset, 1, ENC_BIG_ENDIAN, &len);
2756     offset++;
2757
2758     /* 7 to m Header Field Name
2759      * Header Field Name shall be encoded as an OctetString
2760      */
2761     proto_tree_add_item(tree, hf_pfcp_hf_name, tvb, offset, len, ENC_NA);
2762     offset+= len;
2763
2764     /* p    Length of Header Field Value*/
2765     proto_tree_add_item_ret_uint(tree, hf_pfcp_hf_val_len, tvb, offset, 1, ENC_BIG_ENDIAN, &len);
2766     offset++;
2767
2768     /* (p+1) to q   Header Field Value */
2769     proto_tree_add_item(tree, hf_pfcp_hf_val, tvb, offset, len, ENC_NA);
2770     offset += len;
2771
2772     if (offset < length) {
2773         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2774     }
2775 }
2776
2777 /*
2778  * 8.2.68   Measurement Information
2779  */
2780 static void
2781 dissect_pfcp_measurement_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2782 {
2783     int offset = 0;
2784
2785     static const int * pfcp_measurement_info_flags[] = {
2786         &hf_pfcp_spare_b7_b2,
2787         &hf_pfcp_b1_inam,
2788         &hf_pfcp_b0_mbqe,
2789         NULL
2790     };
2791     /* Octet 5  Spare   INAM    MBQE */
2792     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_measurement_info,
2793         ett_pfcp_measurement_info, pfcp_measurement_info_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
2794     offset += 1;
2795
2796     if (offset < length) {
2797         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2798     }
2799
2800 }
2801 /*
2802  * 8.2.69   Node Report Type
2803  */
2804 static void
2805 dissect_pfcp_node_report_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2806 {
2807     int offset = 0;
2808
2809     static const int * pfcp_node_report_type_flags[] = {
2810         &hf_pfcp_spare_b7_b1,
2811         &hf_pfcp_b0_upfr,
2812         NULL
2813     };
2814     /* Octet 5  Spare   INAM    MBQE */
2815     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_node_report_type,
2816         ett_pfcp_node_report_type, pfcp_node_report_type_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
2817     offset += 1;
2818
2819     if (offset < length) {
2820         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2821     }
2822
2823 }
2824 /*
2825  * 8.2.70   Remote GTP-U Peer
2826  */
2827 static void
2828 dissect_pfcp_remote_gtp_u_peer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type _U_)
2829 {
2830     int offset = 0;
2831     guint64 flags;
2832
2833     static const int * pfcp_remote_gtp_u_peer_flags[] = {
2834         &hf_pfcp_spare_b7_b2,
2835         &hf_pfcp_gtp_u_peer_flag_b1_v4,
2836         &hf_pfcp_gtp_u_peer_flag_b0_v6,
2837         NULL
2838     };
2839     /* Octet 5  Spare   V4  V6*/
2840     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_remote_gtp_u_peer,
2841         ett_pfcp_remote_gtp_u_peer, pfcp_remote_gtp_u_peer_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS, &flags);
2842     offset += 1;
2843
2844     /* IPv6 address (if present)*/
2845     if ((flags & 0x1) == 1) {
2846         proto_tree_add_item(tree, hf_pfcp_remote_gtp_u_peer_ipv6, tvb, offset, 16, ENC_NA);
2847         proto_item_append_text(item, "IPv6 %s", tvb_ip6_to_str(tvb, offset));
2848         offset += 16;
2849     }
2850     /* IPv4 address (if present)*/
2851     if ((flags & 0x2) == 2) {
2852         proto_tree_add_item(tree, hf_pfcp_remote_gtp_u_peer_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
2853         proto_item_append_text(item, "IPv4 %s", tvb_ip_to_str(tvb, offset));
2854         offset += 4;
2855     }
2856
2857     if (offset < length) {
2858         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2859     }
2860
2861 }
2862
2863 /*
2864  * 8.2.71   UR-SEQN
2865  */
2866 static void
2867 dissect_pfcp_ur_seqn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_)
2868 {
2869     guint value;
2870
2871     /* 5 to 8   UR-SEQN
2872     * The UR-SEQN value shall be encoded as an Unsigned32 binary integer value
2873     */
2874     proto_tree_add_item_ret_uint(tree, hf_pfcp_ur_seqn, tvb, 0, 4, ENC_BIG_ENDIAN, &value);
2875
2876     proto_item_append_text(item, "%u", value);
2877
2878
2879 }
2880
2881 /*
2882  * 8.2.72   Activate Predefined Rules
2883  */
2884 static void
2885 dissect_pfcp_act_predef_rules(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2886 {
2887     int offset = 0;
2888     /* Octet 5 to (n+4) Predefined Rules Name
2889     * The Predefined Rules Name field shall be encoded as an OctetString
2890     */
2891     proto_tree_add_item(tree, hf_pfcp_predef_rules_name, tvb, offset, length, ENC_NA);
2892 }
2893 /*
2894  * 8.2.73   Deactivate Predefined Rules
2895  */
2896 static void
2897 dissect_pfcp_deact_predef_rules(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2898 {
2899     int offset = 0;
2900     /* Octet 5 to (n+4) Predefined Rules Name
2901     * The Predefined Rules Name field shall be encoded as an OctetString
2902     */
2903     proto_tree_add_item(tree, hf_pfcp_predef_rules_name, tvb, offset, length, ENC_NA);
2904 }
2905 /*
2906  * 8.2.74   FAR ID
2907  */
2908 static int
2909 decode_pfcp_far_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, gint offset)
2910 {
2911     guint32 far_id;
2912     /* Octet 5 to 8 FAR ID value
2913      * The bit 8 of octet 5 is used to indicate if the Rule ID is dynamically allocated
2914      * by the CP function or predefined in the UP function. If set to 0, it indicates that
2915      * the Rule is dynamically provisioned by the CP Function. If set to 1, it indicates that
2916      * the Rule is predefined in the UP Function.
2917      */
2918     proto_tree_add_item(tree, hf_pfcp_far_id_flg, tvb, offset, 4, ENC_BIG_ENDIAN);
2919     proto_tree_add_item_ret_uint(tree, hf_pfcp_far_id, tvb, offset, 4, ENC_BIG_ENDIAN, &far_id);
2920     offset += 4;
2921
2922     proto_item_append_text(item, "%s %u",
2923         ((far_id&80000000)? pfcp_id_predef_dynamic_tfs.true_string : pfcp_id_predef_dynamic_tfs.false_string),
2924         (far_id & 0x7fffffff));
2925
2926     return offset;
2927 }
2928 static void
2929 dissect_pfcp_far_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2930 {
2931     int offset = 0;
2932
2933     offset = decode_pfcp_far_id(tvb, pinfo, tree, item, offset);
2934
2935     if (offset < length) {
2936         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2937     }
2938
2939 }
2940 /*
2941  * 8.2.75   QER ID
2942  */
2943 static int
2944 decode_pfcp_qer_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint offset)
2945 {
2946     guint32 qer_id;
2947     /* Octet 5 to 8 QER ID value
2948     * The bit 8 of octet 5 is used to indicate if the Rule ID is dynamically allocated by the CP function
2949     * or predefined in the UP function. If set to 0, it indicates that the Rule is dynamically provisioned
2950     * by the CP Function. If set to 1, it indicates that the Rule is predefined in the UP Function
2951     */
2952     proto_tree_add_item(tree, hf_pfcp_qer_id_flg, tvb, offset, 4, ENC_BIG_ENDIAN);
2953     proto_tree_add_item_ret_uint(tree, hf_pfcp_qer_id, tvb, offset, 4, ENC_BIG_ENDIAN, &qer_id);
2954     offset += 4;
2955
2956     proto_item_append_text(item, "%s %u",
2957         ((qer_id & 80000000) ? pfcp_id_predef_dynamic_tfs.true_string : pfcp_id_predef_dynamic_tfs.false_string),
2958         (qer_id & 0x7fffffff));
2959
2960     return offset;
2961
2962 }
2963 static void
2964 dissect_pfcp_qer_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2965 {
2966     int offset = 0;
2967
2968     offset = decode_pfcp_qer_id(tvb, pinfo, tree, item, offset);
2969
2970     if (offset < length) {
2971         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2972     }
2973
2974 }
2975 /*
2976  * 8.2.76   OCI Flags
2977  */
2978 static void
2979 dissect_pfcp_oci_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
2980 {
2981     int offset = 0;
2982
2983     static const int * pfcp_oci_flags_flags[] = {
2984         &hf_pfcp_spare_b7_b1,
2985         &hf_pfcp_b0_aoci,
2986         NULL
2987     };
2988     /* Octet 5  Spare   AOCI */
2989     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_oci_flags,
2990         ett_pfcp_oci_flags, pfcp_oci_flags_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
2991     offset += 1;
2992
2993     if (offset < length) {
2994         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
2995     }
2996
2997 }
2998
2999 /*
3000  * 8.2.77   Sx Association Release Request
3001  */
3002 static void
3003 dissect_pfcp_sx_assoc_rel_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
3004 {
3005     int offset = 0;
3006
3007     static const int * pfcp_sx_assoc_rel_req_flags[] = {
3008         &hf_pfcp_spare_b7_b1,
3009         &hf_pfcp_b0_sarr,
3010         NULL
3011     };
3012     /* Octet 5  Spare    SARR */
3013     proto_tree_add_bitmask_with_flags(tree, tvb, offset, hf_pfcp_sx_assoc_rel_req_flags,
3014         ett_sx_assoc_rel_req_flags, pfcp_sx_assoc_rel_req_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT);
3015     offset += 1;
3016
3017     if (offset < length) {
3018         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
3019     }
3020
3021 }
3022
3023 /*
3024  * 8.2.78   Graceful Release Period
3025  */
3026 static void
3027 dissect_pfcp_graceful_release_period(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item, guint16 length _U_, guint8 message_type _U_)
3028 {
3029     int offset = 0;
3030     guint32 unit, value;
3031
3032     /* Octet 5  Timer unit  Timer value */
3033     proto_tree_add_item_ret_uint(tree, hf_pfcp_timer_unit, tvb, offset, 1, ENC_BIG_ENDIAN, &unit);
3034     proto_tree_add_item_ret_uint(tree, hf_pfcp_timer_value, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
3035     offset++;
3036
3037     unit = unit >> 5;
3038     switch (unit) {
3039     case 0:
3040         proto_item_append_text(item, "%u s", value * 2);
3041         break;
3042     case 1:
3043         proto_item_append_text(item, "%u min", value);
3044         break;
3045     case 2:
3046         proto_item_append_text(item, "%u min", value * 10);
3047         break;
3048     case 3:
3049         proto_item_append_text(item, "%u hours", value);
3050         break;
3051     case 4:
3052         proto_item_append_text(item, "%u hours", value * 10);
3053         break;
3054     case 7:
3055         proto_item_append_text(item, "%u Infinite", value);
3056         break;
3057         /* Value 5 and 6 */
3058     default:
3059         proto_item_append_text(item, "%u min", value * 10);
3060         break;
3061     }
3062     if ((unit != 7) && (value == 0)) {
3063         proto_item_append_text(item, " Stopped");
3064     }
3065
3066     if (offset < length) {
3067         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
3068     }
3069
3070 }
3071 /*
3072  * 8.2.79    PDN Type
3073  */
3074 static const value_string pfcp_pdn_type_vals[] = {
3075     { 0, "Reserved" },
3076     { 1, "IPv4" },
3077     { 2, "IPv6" },
3078     { 3, "IPv4V6" },
3079     { 4, "Non-IP" },
3080     { 0, NULL }
3081 };
3082
3083 static void
3084 dissect_pfcp_pdn_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
3085 {
3086     int offset = 0;
3087     guint32 value;
3088     /* Octet 5  Application Identifier
3089     * The Application Identifier shall be encoded as an OctetString (see 3GPP TS 29.212)
3090     */
3091     proto_tree_add_item_ret_uint(tree, hf_pfcp_pdn_type, tvb, offset, 1, ENC_BIG_ENDIAN, &value);
3092     offset++;
3093
3094     proto_item_append_text(item, "%s", val_to_str_const(value, pfcp_pdn_type_vals, "Unknown"));
3095
3096     if (offset < length) {
3097         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
3098     }
3099 }
3100 /*
3101  * 8.2.80    Failed Rule ID
3102  */
3103 static const value_string pfcp_failed_rule_id_type_vals[] = {
3104     { 0, "PDR" },
3105     { 1, "FAR" },
3106     { 2, "QER" },
3107     { 3, "URR" },
3108     { 4, "BAR" },
3109     { 0, NULL }
3110 };
3111
3112 static void
3113 dissect_pfcp_failed_rule_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
3114 {
3115     int offset = 0;
3116     guint32 rule_type;
3117
3118     /* Octet 5  Rule ID Type */
3119     proto_tree_add_item_ret_uint(tree, hf_pfcp_failed_rule_id_type, tvb, offset, 1, ENC_BIG_ENDIAN, &rule_type);
3120     offset++;
3121
3122     proto_item_append_text(item, "%s", val_to_str_const(rule_type, pfcp_failed_rule_id_type_vals, "Unknown"));
3123
3124     /* 6 to p  Rule ID value
3125     * The length and the value of the Rule ID value field shall be set as specified for the
3126     * PDR ID, FAR ID, QER ID, URR ID and BAR ID IE types respectively.
3127     */
3128     switch (rule_type) {
3129         case 0:
3130             /* PDR ID */
3131             offset = decode_pfcp_pdr_id(tvb, pinfo, tree, item, offset);
3132             break;
3133         case 1:
3134             /* FAR ID */
3135             offset = decode_pfcp_far_id(tvb, pinfo, tree, item, offset);
3136             break;
3137         case 2:
3138             /* QER ID */
3139             offset = decode_pfcp_qer_id(tvb, pinfo, tree, item, offset);
3140             break;
3141         case 3:
3142             /* URR ID */
3143             offset = decode_pfcp_urr_id(tvb, pinfo, tree, item, offset);
3144             break;
3145         case 4:
3146             /* BAR ID */
3147             offset = decode_pfcp_bar_id(tvb, pinfo, tree, item, offset);
3148             break;
3149         default:
3150             break;
3151     }
3152
3153     if (offset < length) {
3154         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
3155     }
3156 }
3157 /*
3158  * 8.2.81    Time Quota Mechanism
3159  */
3160 static const value_string pfcp_time_qouta_mechanism_bti_type_vals[] = {
3161     { 0, "CTP" },
3162     { 1, "DTP" },
3163     { 0, NULL }
3164 };
3165
3166 static void
3167 dissect_pfcp_time_qouta_mechanism(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
3168 {
3169     int offset = 0;
3170     guint32 bti_type;
3171
3172     /* Octet 5  BIT Type */
3173     proto_tree_add_item_ret_uint(tree, hf_pfcp_time_qouta_mechanism_bti_type, tvb, offset, 1, ENC_BIG_ENDIAN, &bti_type);
3174     offset++;
3175
3176     proto_item_append_text(item, "%s", val_to_str_const(bti_type, pfcp_time_qouta_mechanism_bti_type_vals, "Unknown"));
3177
3178     /* Base Time Interval
3179     * The Base Time Interval, shall be encoded as an Unsigned32
3180     * as specified in subclause 7.2.29 of 3GPP TS 32.299
3181     */
3182     proto_tree_add_item(tree, hf_pfcp_time_qouta_mechanism_bti, tvb, offset, 4, ENC_BIG_ENDIAN);
3183     offset += 4;
3184
3185     if (offset < length) {
3186         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
3187     }
3188 }
3189 /*
3190  * 8.2.82    User Plane IP Resource Information
3191  */
3192 static void
3193 dissect_pfcp_user_plane_ip_resource_infomation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
3194 {
3195     int offset = 0;
3196     guint64 upiri_flags_val;
3197     guint32 upiri_teid_range;
3198
3199     static const int * pfcp_upiri_flags[] = {
3200         &hf_pfcp_spare_b7_b6,
3201         &hf_pfcp_upiri_flg_b5_assoni,
3202         &hf_pfcp_upiri_flg_b1_v6,
3203         &hf_pfcp_upiri_flg_b0_v4,
3204         NULL
3205     };
3206     /* Octet 5  Spare  Spare  ASSONI  TEIDRI  TEIDRI  TEIDRI  V6  V4*/
3207     proto_tree_add_bitmask_with_flags_ret_uint64(tree, tvb, offset, hf_pfcp_upiri_flags,
3208         ett_pfcp_upiri_flags, pfcp_upiri_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT | BMT_NO_TFS, &upiri_flags_val);
3209
3210     /* The following flags are coded within Octet 5:
3211      * Bit 1   - V4: If this bit is set to "1" and the CH bit is not set, then the IPv4 address field shall be present,
3212      *           otherwise the IPv4 address field shall not be present.
3213      * Bit 2   - V6: If this bit is set to "1" and the CH bit is not set, then the IPv6 address field shall be present,
3214      *           otherwise the IPv6 address field shall not be present.
3215      * Bit 3-5 - TEIDRI (TEID Range Indication): the value of this field indicates the number of bits in the most significant
3216      *           octet of a TEID that are used to partition the TEID range, e.g. if this field is set to "4", then the first
3217      *           4 bits in the TEID are used to partition the TEID range.
3218      * Bit 6   - ASSONI (Associated Network Instance): if this bit is set to "1", then the Network Instance field shall be present,
3219      *           otherwise the Network Instance field shall not be present,
3220      *           i.e. User Plane IP Resource Information provided can be used by CP function for any Network Instance of
3221      *           GTP-U user plane in the UP function.
3222      */
3223
3224     /* Octet 5, bit 3-5, TEID Range Indication */
3225     proto_tree_add_item_ret_uint(tree, hf_pfcp_upiri_teidri, tvb, offset, 1, ENC_BIG_ENDIAN, &upiri_teid_range);
3226     offset += 1;
3227
3228     if (upiri_teid_range > 0)
3229     {
3230         /* Octet 6    TEID Range */
3231         proto_tree_add_item(tree, hf_pfcp_upiri_teid_range, tvb, offset, 1, ENC_BIG_ENDIAN);
3232         offset++;
3233     }
3234
3235     if ((upiri_flags_val & 0x1) == 1) {
3236         /* m to (m+3)    IPv4 address */
3237         proto_tree_add_item(tree, hf_pfcp_upiri_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN);
3238         offset += 4;
3239     }
3240     if ((upiri_flags_val & 0x2) == 2) {
3241         /* p to (p+15)   IPv6 address */
3242         proto_tree_add_item(tree, hf_pfcp_upiri_ipv6, tvb, offset, 16, ENC_NA);
3243         offset += 16;
3244     }
3245     if ((upiri_flags_val & 0x20) == 32) {
3246         /* k to (l)   Network Instance */
3247         proto_tree_add_item(tree, hf_pfcp_upiri_network_instance, tvb, offset, length - offset, ENC_NA);
3248         offset = length;
3249     }
3250
3251     if (offset < length) {
3252         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
3253     }
3254
3255 }
3256
3257 /*
3258  * 8.2.83    User Plane Inactivity Timer
3259  */
3260 static void
3261 dissect_pfcp_user_plane_inactivity_timer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_)
3262 {
3263     int offset = 0;
3264     guint32 value;
3265     /*
3266     * The User Plane Inactivity Timer field shall be encoded as an Unsigned32 binary integer value.
3267     * The timer value "0" shall be interpreted as an indication that
3268     * user plane inactivity detection and reporting is stopped.
3269     */
3270
3271     /* 5 to 8   Inactivity Timer */
3272     proto_tree_add_item_ret_uint(tree, hf_pfcp_user_plane_inactivity_timer, tvb, offset, 4, ENC_BIG_ENDIAN, &value);
3273     offset += 4;
3274
3275     if(value == 0)
3276         proto_item_append_text(item, " (Stopped)");
3277
3278     if (offset < length) {
3279         proto_tree_add_expert(tree, pinfo, &ei_pfcp_ie_data_not_decoded, tvb, offset, -1);
3280     }
3281
3282 }
3283
3284 /* Array of functions to dissect IEs
3285 * (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3286 */
3287 typedef struct _pfcp_ie {
3288     void(*decode) (tvbuff_t *, packet_info *, proto_tree *, proto_item *, guint16, guint8);
3289 } pfcp_ie_t;
3290
3291 static const pfcp_ie_t pfcp_ies[] = {
3292 /*      0 */    { dissect_pfcp_reserved },
3293 /*      1 */    { dissect_pfcp_create_pdr },                                    /* Create PDR                                       Extendable / Table 7.5.2.2-1 */
3294 /*      2 */    { dissect_pfcp_pdi },                                           /* PDI                                              Extendable / Table 7.5.2.2-2 */
3295 /*      3 */    { dissect_pfcp_create_far },                                    /* Create FAR                                       Extendable / Table 7.5.2.3-1 */
3296 /*      4 */    { dissect_pfcp_forwarding_parameters },                         /* Forwarding Parameters                            Extendable / Table 7.5.2.3-2 */
3297 /*      5 */    { dissect_pfcp_duplicating_parameters },                        /* Duplicating Parameters                           Extendable / Table 7.5.2.3-3 */
3298 /*      6 */    { dissect_pfcp_create_urr },                                    /* Create URR                                       Extendable / Table 7.5.2.4-1 */
3299 /*      7 */    { dissect_pfcp_create_qer },                                    /* Create QER                                       Extendable / Table 7.5.2.5-1 */
3300 /*      8 */    { dissect_pfcp_created_pdr },                                   /* Created PDR                                      Extendable / Table 7.5.3.2-1 */
3301 /*      9 */    { dissect_pfcp_update_pdr },                                    /* Update PDR                                       Extendable / Table 7.5.4.2-1 */
3302 /*     10 */    { dissect_pfcp_update_far },                                    /* Update FAR                                       Extendable / Table 7.5.4.3-1 */
3303 /*     11 */    { dissect_pfcp_upd_forwarding_param },                          /* Update Forwarding Parameters                     Extendable / Table 7.5.4.3-2 */
3304 /*     12 */    { dissect_pfcp_update_bar },                                    /* Update BAR (Sx Session Report Response)          Extendable / Table 7.5.9.2-1 */
3305 /*     13 */    { dissect_pfcp_update_urr },                                    /* Update URR                                       Extendable / Table 7.5.4.4 */
3306 /*     14 */    { dissect_pfcp_update_qer },                                    /* Update QER                                       Extendable / Table 7.5.4.5 */
3307 /*     15 */    { dissect_pfcp_remove_pdr },                                    /* Remove PDR                                       Extendable / Table 7.5.4.6 */
3308 /*     16 */    { dissect_pfcp_remove_far },                                    /* Remove FAR                                       Extendable / Table 7.5.4.7 */
3309 /*     17 */    { dissect_pfcp_remove_urr },                                    /* Remove URR                                       Extendable / Table 7.5.4.8 */
3310 /*     18 */    { dissect_pfcp_remove_qer },                                    /* Remove QER                                       Extendable / Table 7.5.4.9 */
3311 /*     19 */    { dissect_pfcp_cause },                                         /* Cause                                            Fixed / Subclause 8.2.1 */
3312 /*     20 */    { dissect_pfcp_source_interface },                              /* Source Interface                                 Extendable / Subclause 8.2.2 */
3313 /*     21 */    { dissect_pfcp_f_teid },                                        /* F-TEID                                           Extendable / Subclause 8.2.3 */
3314 /*     22 */    { dissect_pfcp_network_instance },                              /* Network Instance                                 Variable Length / Subclause 8.2.4 */
3315 /*     23 */    { dissect_pfcp_sdf_filter },                                    /* SDF Filter                                       Extendable / Subclause 8.2.5 */
3316 /*     24 */    { dissect_pfcp_application_id },                                /* Application ID                                   Variable Length / Subclause 8.2.6 */
3317 /*     25 */    { dissect_pfcp_gate_status },                                   /* Gate Status                                     Extendable / Subclause 8.2.7 */
3318 /*     26 */    { dissect_pfcp_mbr },                                           /* MBR                                             Extendable / Subclause 8.2.8 */
3319 /*     27 */    { dissect_pfcp_gbr },                                           /* GBR                                             Extendable / Subclause 8.2.9 */
3320 /*     28 */    { dissect_pfcp_qer_correlation_id },                            /* QER Correlation ID                              Extendable / Subclause 8.2.10 */
3321 /*     29 */    { dissect_pfcp_precedence },                                    /* Precedence                                      Extendable / Subclause 8.2.11 */
3322 /*     30 */    { dissect_pfcp_transport_level_marking },                       /* Transport Level Marking                         Extendable / Subclause 8.2.12 */
3323 /*     31 */    { dissect_pfcp_volume_threshold },                              /* Volume Threshold                                Extendable /Subclause 8.2.13 */
3324 /*     32 */    { dissect_pfcp_time_threshold },                                /* Time Threshold                                  Extendable /Subclause 8.2.14 */
3325 /*     33 */    { dissect_pfcp_monitoring_time },                               /* Monitoring Time                                 Extendable /Subclause 8.2.15 */
3326 /*     34 */    { dissect_pfcp_subseq_volume_threshold },                       /* Subsequent Volume Threshold                     Extendable /Subclause 8.2.16 */
3327 /*     35 */    { dissect_pfcp_subsequent_time_threshold },                     /* Subsequent Time Threshold                       Extendable /Subclause 8.2.17 */
3328 /*     36 */    { dissect_pfcp_inactivity_detection_time },                     /* Inactivity Detection Time                       Extendable /Subclause 8.2.18 */
3329 /*     37 */    { dissect_pfcp_reporting_triggers },                            /* Reporting Triggers                              Extendable /Subclause 8.2.19 */
3330 /*     38 */    { dissect_pfcp_redirect_information },                          /* Redirect Information                            Extendable /Subclause 8.2.20 */
3331 /*     39 */    { dissect_pfcp_report_type },                                   /* Report Type                                     Extendable / Subclause 8.2.21 */
3332 /*     40 */    { dissect_pfcp_offending_ie },                                  /* Offending IE                                    Fixed / Subclause 8.2.22 */
3333 /*     41 */    { dissect_pfcp_forwarding_policy },                             /* Forwarding Policy                               Extendable / Subclause 8.2.23 */
3334 /*     42 */    { dissect_pfcp_destination_interface },                         /* Destination Interface                           Extendable / Subclause 8.2.24 */
3335 /*     43 */    { dissect_pfcp_up_function_features },                          /* UP Function Features                            Extendable / Subclause 8.2.25 */
3336 /*     44 */    { dissect_pfcp_apply_action },                                  /* Apply Action                                    Extendable / Subclause 8.2.26 */
3337 /*     45 */    { dissect_pfcp_dl_data_service_inf },                           /* Downlink Data Service Information               Extendable / Subclause 8.2.27 */
3338 /*     46 */    { dissect_pfcp_dl_data_notification_delay },                    /* Downlink Data Notification Delay                Extendable / Subclause 8.2.28 */
3339 /*     47 */    { dissect_pfcp_dl_buffering_dur },                              /* DL Buffering Duration                           Extendable / Subclause 8.2.29 */
3340 /*     48 */    { dissect_pfcp_dl_buffering_suggested_packet_count },           /* DL Buffering Suggested Packet Count             Variable / Subclause 8.2.30 */
3341 /*     49 */    { dissect_pfcp_sxsmreq_flags },                                 /* SxSMReq-Flags                                   Extendable / Subclause 8.2.31 */
3342 /*     50 */    { dissect_pfcp_sxsrrsp_flags },                                 /* SxSRRsp-Flags                                   Extendable / Subclause 8.2.32 */
3343 /*     51 */    { dissect_pfcp_load_control_information },                      /* Load Control Information                        Extendable / Table 7.5.3.3-1 */
3344 /*     52 */    { dissect_pfcp_sequence_number },                               /* Sequence Number                                 Fixed Length / Subclause 8.2.33 */
3345 /*     53 */    { dissect_pfcp_metric },                                        /* Metric                                          Fixed Length / Subclause 8.2.34 */
3346 /*     54 */    { dissect_pfcp_overload_control_information },                  /* Overload Control Information                    Extendable / Table 7.5.3.4-1 */
3347 /*     55 */    { dissect_pfcp_timer },                                         /* Timer                                           Extendable / Subclause 8.2 35 */
3348 /*     56 */    { dissect_pfcp_pdr_id },                                        /* Packet Detection Rule ID                        Extendable / Subclause 8.2 36 */
3349 /*     57 */    { dissect_pfcp_f_seid },                                        /* F-SEID                                          Extendable / Subclause 8.2 37 */
3350 /*     58 */    { dissect_pfcp_application_ids_pfds },                          /* Application ID's PFDs                           Extendable / Table 7.4.3.1-2 */
3351 /*     59 */    { dissect_pfcp_pfd_context },                                   /* PFD context                                     Extendable / Table 7.4.3.1-3 */
3352 /*     60 */    { dissect_pfcp_node_id },                                       /* Node ID                                         Extendable / Subclause 8.2.38 */
3353 /*     61 */    { dissect_pfcp_pfd_contents },                                  /* PFD contents                                    Extendable / Subclause 8.2.39 */
3354 /*     62 */    { dissect_pfcp_measurement_method },                            /* Measurement Method                              Extendable / Subclause 8.2.40 */
3355 /*     63 */    { dissect_pfcp_usage_report_trigger },                          /* Usage Report Trigger                            Extendable / Subclause 8.2.41 */
3356 /*     64 */    { dissect_pfcp_measurement_period },                            /* Measurement Period                              Extendable / Subclause 8.2.42 */
3357 /*     65 */    { dissect_pfcp_fq_csid },                                       /* FQ-CSID                                         Extendable / Subclause 8.2.43 */
3358 /*     66 */    { dissect_pfcp_volume_measurement },                            /* Volume Measurement                              Extendable / Subclause 8.2.44 */
3359 /*     67 */    { dissect_pfcp_duration_measurement },                          /* Duration Measurement                            Extendable / Subclause 8.2.45 */
3360 /*     68 */    { dissect_pfcp_application_detection_inf },                     /* Application Detection Information               Extendable / Table 7.5.8.3-2 */
3361 /*     69 */    { dissect_pfcp_time_of_first_packet },                          /* Time of First Packet                            Extendable / Subclause 8.2.46 */
3362 /*     70 */    { dissect_pfcp_time_of_last_packet },                           /* Time of Last Packet                             Extendable / Subclause 8.2.47 */
3363 /*     71 */    { dissect_pfcp_quota_holding_time },                            /* Quota Holding Time                              Extendable / Subclause 8.2.48 */
3364 /*     72 */    { dissect_pfcp_dropped_dl_traffic_threshold },                  /* Dropped DL Traffic Threshold                    Extendable / Subclause 8.2.49 */
3365 /*     73 */    { dissect_pfcp_volume_quota },                                  /* Volume Quota                                    Extendable / Subclause 8.2.50 */
3366 /*     74 */    { dissect_pfcp_time_quota },                                    /* Time Quota                                      Extendable / Subclause 8.2.51 */
3367 /*     75 */    { dissect_pfcp_start_time },                                    /* Start Time                                      Extendable / Subclause 8.2.52 */
3368 /*     76 */    { dissect_pfcp_end_time },                                      /* End Time                                        Extendable / Subclause 8.2.53 */
3369 /*     77 */    { dissect_pfcp_pfcp_query_urr },                                /* Query URR                                       Extendable / Table 7.5.4.10-1 */
3370 /*     78 */    { dissect_pfcp_usage_report_smr },                              /* Usage Report (in Session Modification Response) Extendable / Table 7.5.5.2-1 */
3371 /*     79 */    { dissect_pfcp_usage_report_sdr },                              /* Usage Report (Session Deletion Response)        Extendable / Table 7.5.7.2-1 */
3372 /*     80 */    { dissect_pfcp_usage_report_srr },                              /* Usage Report (Session Report Request)           Extendable / Table 7.5.8.3-1 */
3373 /*     81 */    { dissect_pfcp_urr_id },                                        /* URR ID                                          Extendable / Subclause 8.2.54 */
3374 /*     82 */    { dissect_pfcp_linked_urr_id },                                 /* Linked URR ID                                   Extendable / Subclause 8.2.55 */
3375 /*     83 */    { dissect_pfcp_downlink_data_report },                          /* Downlink Data Report                            Extendable / Table 7.5.8.2-1 */
3376 /*     84 */    { dissect_pfcp_outer_header_creation },                         /* Outer Header Creation                           Extendable / Subclause 8.2.56 */
3377 /*     85 */    { dissect_pfcp_create_bar },                                    /* Create BAR                                      Extendable / Table 7.5.2.6-1 */
3378 /*     86 */    { dissect_pfcp_update_bar_smr },                                /* Update BAR (Session Modification Request)       Extendable / Table 7.5.4.11-1 */
3379 /*     87 */    { dissect_pfcp_remove_bar },                                    /* Remove BAR                                      Extendable / Table 7.5.4.12-1 */
3380 /*     88 */    { dissect_pfcp_bar_id },                                        /* BAR ID                                          Extendable / Subclause 8.2.57 */
3381 /*     89 */    { dissect_pfcp_cp_function_features },                          /* CP Function Features                            Extendable / Subclause 8.2.58 */
3382 /*     90 */    { dissect_pfcp_usage_information },                             /* Usage Information                               Extendable / Subclause 8.2.59 */
3383 /*     91 */    { dissect_pfcp_application_instance_id },                       /* Application Instance ID                         Variable Length / Subclause 8.2.60 */
3384 /*     92 */    { dissect_pfcp_flow_inf },                                      /* Flow Information                                Extendable / Subclause 8.2.61 */
3385 /*     93 */    { dissect_pfcp_ue_ip_address },                                 /* UE IP Address                                   Extendable / Subclause 8.2.62 */
3386 /*     94 */    { dissect_pfcp_packet_rate },                                   /* Packet Rate                                     Extendable / Subclause 8.2.63 */
3387 /*     95 */    { dissect_pfcp_outer_hdr_rem },                                 /* Outer Header Removal                            Extendable / Subclause 8.2.64 */
3388 /*     96 */    { dissect_pfcp_recovery_time_stamp },                           /* Recovery Time Stamp                             Extendable / Subclause 8.2.65 */
3389 /*     97 */    { dissect_pfcp_dl_flow_level_marking },                         /* DL Flow Level Marking                           Extendable / Subclause 8.2.66 */
3390 /*     98 */    { dissect_pfcp_header_enrichment },                             /* Header Enrichment                               Extendable / Subclause 8.2.67 */
3391 /*     99 */    { dissect_pfcp_error_indication_report },                       /* Error Indication Report                         Extendable / Table 7.5.8.4-1 */
3392 /*    100 */    { dissect_pfcp_measurement_info },                              /* Measurement Information                         Extendable / Subclause 8.2.68 */
3393 /*    101 */    { dissect_pfcp_node_report_type },                              /* Node Report Type                                Extendable / Subclause 8.2.69 */
3394 /*    102 */    { dissect_pfcp_user_plane_path_failure_report },                /* User Plane Path Failure Report                  Extendable / Table 7.4.5.1.2-1 */
3395 /*    103 */    { dissect_pfcp_remote_gtp_u_peer },                             /* Remote GTP-U Peer                               Extendable / Subclause 8.2.70 */
3396 /*    104 */    { dissect_pfcp_ur_seqn },                                       /* UR-SEQN                                         Fixed Length / Subclause 8.2.71 */
3397 /*    105 */    { dissect_pfcp_update_duplicating_parameters },                 /* Update Duplicating Parameters                   Extendable / Table 7.5.4.3-3 */
3398 /*    106 */    { dissect_pfcp_act_predef_rules },                              /* Activate Predefined Rules                       Variable Length / Subclause 8.2.72 */
3399 /*    107 */    { dissect_pfcp_deact_predef_rules },                            /* Deactivate Predefined Rules                     Variable Length / Subclause 8.2.73 */
3400 /*    108 */    { dissect_pfcp_far_id },                                        /* FAR ID                                          Extendable / Subclause 8.2.74 */
3401 /*    109 */    { dissect_pfcp_qer_id },                                        /* QER ID                                          Extendable / Subclause 8.2.75 */
3402 /*    110 */    { dissect_pfcp_oci_flags },                                     /* OCI Flags                                       Extendable / Subclause 8.2.76 */
3403 /*    111 */    { dissect_pfcp_sx_assoc_rel_req },                              /* Sx Association Release Request                  Extendable / Subclause 8.2.77 */
3404 /*    112 */    { dissect_pfcp_graceful_release_period },                       /* Graceful Release Period                         Extendable / Subclause 8.2.78 */
3405 /*    113 */    { dissect_pfcp_pdn_type },                                      /* PDN Type                                        Fixed Length / Subclause 8.2.79 */
3406 /*    114 */    { dissect_pfcp_failed_rule_id },                                /* Failed Rule ID                                  Extendable / Subclause 8.2.80 */
3407 /*    115 */    { dissect_pfcp_time_qouta_mechanism },                          /* Time Quota Mechanism                            Extendable / Subclause 8.2.81 */
3408 /*    116 */    { dissect_pfcp_user_plane_ip_resource_infomation },             /* User Plane IP Resource Information              Extendable / Subclause 8.2.82 */
3409 /*    117 */    { dissect_pfcp_user_plane_inactivity_timer },                   /* User Plane Inactivity Timer                     Extendable / Subclause 8.2.83 */
3410     { NULL },                                                        /* End of List */
3411 };
3412
3413 #define NUM_PFCP_IES (sizeof(pfcp_ies)/sizeof(pfcp_ie_t))
3414 /* Set up the array to hold "etts" for each IE*/
3415 gint ett_pfcp_elem[NUM_PFCP_IES-1];
3416
3417 /* 7.2.3.3  Grouped Information Elements */
3418
3419 static void
3420 dissect_pfcp_grouped_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type, int ett_index)
3421 {
3422     int         offset = 0;
3423     tvbuff_t   *new_tvb;
3424     proto_tree *grouped_tree;
3425
3426     proto_item_append_text(item, "[Grouped IE]");
3427     grouped_tree = proto_item_add_subtree(tree, ett_index);
3428
3429     new_tvb = tvb_new_subset_length(tvb, offset, length);
3430     dissect_pfcp_ies_common(new_tvb, pinfo, grouped_tree, 0, message_type);
3431
3432 }
3433
3434 static void
3435 dissect_pfcp_pdi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3436 {
3437     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_ID_PDI]);
3438 }
3439
3440 static void
3441 dissect_pfcp_create_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3442 {
3443     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_ID_CREATE_PDR]);
3444 }
3445
3446 static void
3447 dissect_pfcp_create_far(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3448 {
3449     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_CREATE_FAR]);
3450 }
3451
3452 static void
3453 dissect_pfcp_forwarding_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3454 {
3455     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_FORWARDING_PARAMETERS]);
3456 }
3457
3458 static void
3459 dissect_pfcp_duplicating_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3460 {
3461     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_DUPLICATING_PARAMETERS]);
3462 }
3463
3464 static void
3465 dissect_pfcp_create_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3466 {
3467     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_CREATE_URR]);
3468 }
3469
3470 static void
3471 dissect_pfcp_create_qer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3472 {
3473     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_CREATE_QER]);
3474 }
3475
3476 static void
3477 dissect_pfcp_created_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3478 {
3479     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_CREATED_PDR]);
3480 }
3481
3482 static void
3483 dissect_pfcp_update_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3484 {
3485     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_UPDATE_PDR]);
3486 }
3487
3488 static void
3489 dissect_pfcp_update_far(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3490 {
3491     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_UPDATE_FAR]);
3492 }
3493
3494 static void
3495 dissect_pfcp_upd_forwarding_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3496 {
3497     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_UPD_FORWARDING_PARAM]);
3498 }
3499
3500 static void
3501 dissect_pfcp_update_bar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3502 {
3503     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_UPDATE_BAR]);
3504 }
3505
3506 static void
3507 dissect_pfcp_update_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3508 {
3509     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_UPDATE_URR]);
3510 }
3511
3512 static void
3513 dissect_pfcp_update_qer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3514 {
3515     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_UPDATE_QER]);
3516 }
3517
3518 static void
3519 dissect_pfcp_remove_pdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3520 {
3521     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_REMOVE_PDR]);
3522 }
3523
3524 static void
3525 dissect_pfcp_remove_far(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3526 {
3527     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_REMOVE_FAR]);
3528 }
3529
3530 static void
3531 dissect_pfcp_remove_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3532 {
3533     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_REMOVE_URR]);
3534 }
3535
3536 static void
3537 dissect_pfcp_remove_qer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3538 {
3539     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_IE_REMOVE_QER]);
3540 }
3541
3542 static void
3543 dissect_pfcp_load_control_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3544 {
3545     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_LOAD_CONTROL_INFORMATION]);
3546 }
3547
3548 static void
3549 dissect_pfcp_overload_control_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3550 {
3551     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_OVERLOAD_CONTROL_INFORMATION]);
3552 }
3553
3554 static void
3555 dissect_pfcp_application_ids_pfds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3556 {
3557     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_APPLICATION_IDS_PFDS]);
3558 }
3559
3560 static void
3561 dissect_pfcp_pfd_context(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3562 {
3563     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_PFD_CONTEXT]);
3564 }
3565
3566
3567 static void
3568 dissect_pfcp_application_detection_inf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3569 {
3570     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_APPLICATION_DETECTION_INF]);
3571 }
3572
3573 static void
3574 dissect_pfcp_pfcp_query_urr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3575 {
3576     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_QUERY_URR]);
3577 }
3578
3579 static void
3580 dissect_pfcp_usage_report_smr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3581 {
3582     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_USAGE_REPORT_SMR]);
3583 }
3584
3585 static void
3586 dissect_pfcp_usage_report_sdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3587 {
3588     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_USAGE_REPORT_SDR]);
3589 }
3590
3591 static void
3592 dissect_pfcp_usage_report_srr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3593 {
3594     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_USAGE_REPORT_SRR]);
3595 }
3596
3597 static void
3598 dissect_pfcp_downlink_data_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3599 {
3600     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_DOWNLINK_DATA_REPORT]);
3601 }
3602
3603 static void
3604 dissect_pfcp_create_bar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3605 {
3606     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_CREATE_BAR]);
3607 }
3608
3609 static void
3610 dissect_pfcp_update_bar_smr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3611 {
3612     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_UPDATE_BAR_SMR]);
3613 }
3614
3615 static void
3616 dissect_pfcp_remove_bar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3617 {
3618     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_REMOVE_BAR]);
3619 }
3620
3621 static void
3622 dissect_pfcp_error_indication_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3623 {
3624     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_ERROR_INDICATION_REPORT]);
3625 }
3626
3627 static void
3628 dissect_pfcp_user_plane_path_failure_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3629 {
3630     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_USER_PLANE_PATH_FAILURE_REPORT]);
3631 }
3632
3633 static void
3634 dissect_pfcp_update_duplicating_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item, guint16 length, guint8 message_type)
3635 {
3636     dissect_pfcp_grouped_ie(tvb, pinfo, tree, item, length, message_type, ett_pfcp_elem[PFCP_UPDATE_DUPLICATING_PARAMETERS]);
3637 }
3638
3639
3640 static void
3641 dissect_pfcp_ies_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint offset, guint8 message_type)
3642 {
3643     proto_tree *ie_tree;
3644     proto_item *ti;
3645     tvbuff_t   *ie_tvb;
3646     guint16 type, length, enterprise_type;
3647     guint16 enterprise_id;
3648
3649     /* 8.1.1    Information Element Format */
3650     /*
3651     Octets      8   7   6   5   4   3   2   1
3652     1 to 2      Type = xxx (decimal)
3653     3 to 4      Length = n
3654     p to (p+1)  Enterprise ID
3655     k to (n+4)  IE specific data or content of a grouped IE
3656
3657     If the Bit 8 of Octet 1 is not set, this indicates that the IE is defined by 3GPP and the Enterprise ID is absent.
3658     If Bit 8 of Octet 1 is set, this indicates that the IE is defined by a vendor and the Enterprise ID is present
3659     identified by the Enterprise ID
3660     */
3661
3662     /*Enterprise ID : if the IE type value is within the range of 32768 to 65535,
3663      * this field shall contain the IANA - assigned "SMI Network Management Private Enterprise Codes"
3664      * value of the vendor defining the IE.
3665      */
3666     /* Length: this field contains the length of the IE excluding the first four octets, which are common for all IEs */
3667
3668     /* Process the IEs*/
3669     while (offset < (gint)tvb_reported_length(tvb)) {
3670         /* Octet 1 -2 */
3671         type = tvb_get_ntohs(tvb, offset);
3672         length = tvb_get_ntohs(tvb, offset + 2);
3673
3674         if ((type & 0x8000) == 0x8000 ) {
3675             enterprise_id = tvb_get_ntohs(tvb, offset + 4);
3676             enterprise_type = (type & 0x8000);
3677             ie_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4 + length, ett_pfcp_ie, &ti, "Enterprise %s specific IE: %u",
3678                 try_enterprises_lookup(enterprise_id),
3679                 enterprise_type);
3680
3681             proto_tree_add_item(ie_tree, hf_pfcp2_enterprise_ie, tvb, offset, 2, ENC_BIG_ENDIAN);
3682             offset += 2;
3683
3684             proto_tree_add_item(ie_tree, hf_pfcp2_ie_len, tvb, offset, 2, ENC_BIG_ENDIAN);
3685             offset += 2;
3686
3687             /* Bit 8 of Octet 1 is set, this indicates that the IE is defined by a vendor and the Enterprise ID is present */
3688             proto_tree_add_item(ie_tree, hf_pfcp_enterprice_id, tvb, offset, 2, ENC_BIG_ENDIAN);
3689
3690             /* give the whole IE to the subdissector */
3691             ie_tvb = tvb_new_subset_length(tvb, offset-4, length);
3692             dissector_try_uint_new(pfcp_enterprise_ies_dissector_table, enterprise_id, ie_tvb, pinfo, ie_tree, FALSE, ti);
3693             offset += length;
3694         } else {
3695             int tmp_ett;
3696             if (type < (NUM_PFCP_IES - 1)) {
3697                 tmp_ett = ett_pfcp_elem[type];
3698             } else {
3699                 tmp_ett = ett_pfcp_ie;
3700             }
3701             ie_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4 + length, tmp_ett, &ti, "%s : ",
3702                 val_to_str_ext_const(type, &pfcp_ie_type_ext, "Unknown"));
3703
3704             proto_tree_add_item(ie_tree, hf_pfcp2_ie, tvb, offset, 2, ENC_BIG_ENDIAN);
3705             offset += 2;
3706             proto_tree_add_item(ie_tree, hf_pfcp2_ie_len, tvb, offset, 2, ENC_BIG_ENDIAN);
3707             offset += 2;
3708             if (type < (NUM_PFCP_IES -1)) {
3709                 ie_tvb = tvb_new_subset_length(tvb, offset, length);
3710                 if(pfcp_ies[type].decode){
3711                     (*pfcp_ies[type].decode) (ie_tvb, pinfo, ie_tree, ti, length, message_type);
3712                 } else {
3713                     /* NULL function pointer, we have no decoding function*/
3714                     proto_tree_add_expert(ie_tree, pinfo, &ei_pfcp_ie_not_decoded_null, tvb, offset, length);
3715                 }
3716             } else {
3717                 /* IE id outside of array, We have no decoding function for it */
3718                 proto_tree_add_expert(ie_tree, pinfo, &ei_pfcp_ie_not_decoded_to_large, tvb, offset, length);
3719             }
3720
3721             offset += length;
3722         }
3723     }
3724 }
3725
3726 static int
3727 dissect_pfcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void *data _U_)
3728 {
3729     proto_item          *item;
3730     proto_tree          *sub_tree;
3731     int                  offset = 0;
3732     guint64              pfcp_flags;
3733     guint8               message_type;
3734     guint32              length;
3735
3736     static const int * pfcp_hdr_flags[] = {
3737         &hf_pfcp_version,
3738         &hf_pfcp_spare_b4,
3739         &hf_pfcp_spare_b3,
3740         &hf_pfcp_spare_b2,
3741         &hf_pfcp_mp_flag,
3742         &hf_pfcp_s_flag,
3743         NULL
3744     };
3745
3746     col_set_str(pinfo->cinfo, COL_PROTOCOL, "PFCP");
3747     col_clear(pinfo->cinfo, COL_INFO);
3748
3749     message_type = tvb_get_guint8(tvb, 1);
3750     col_set_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(message_type, &pfcp_message_type_ext, "Unknown"));
3751
3752     item = proto_tree_add_item(tree, proto_pfcp, tvb, 0, -1, ENC_NA);
3753     sub_tree = proto_item_add_subtree(item, ett_pfcp);
3754
3755     /* 7.2.2    Message Header */
3756     /*
3757         Octet     8     7     6     5     4     3     2     1
3758           1    | Version         |Spare|Spare|Spare|  MP  |  S  |
3759           2    |        Message Type                            |
3760           3    |        Message Length (1st Octet)              |
3761           4    |        Message Length (2nd Octet)              |
3762         m to   | If S flag is set to 1, then SEID shall be      |
3763         k(m+7) | placed into octets 5-12. Otherwise, SEID field |
3764                | is not present at all.                         |
3765         n to   | Sequence Number                                |
3766         (n+2)  |                                                |
3767         (n+3)  |         Spare                                  |
3768
3769     */
3770     /* Octet 1 */
3771     proto_tree_add_bitmask_with_flags_ret_uint64(sub_tree, tvb, offset, hf_pfcp_hdr_flags,
3772         ett_pfcp_flags, pfcp_hdr_flags, ENC_BIG_ENDIAN, BMT_NO_FALSE | BMT_NO_INT, &pfcp_flags);
3773     offset += 1;
3774
3775     /* Octet 2 Message Type */
3776     proto_tree_add_item(sub_tree, hf_pfcp_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN);
3777     offset += 1;
3778
3779     /* Octet 3 - 4 Message Length */
3780     proto_tree_add_item_ret_uint(sub_tree, hf_pfcp_msg_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
3781     offset += 2;
3782
3783     if ((pfcp_flags & 0x1) == 1) {
3784         /* If S flag is set to 1, then SEID shall be placed into octets 5-12*/
3785         /* Session Endpoint Identifier 8 Octets */
3786         proto_tree_add_item(sub_tree, hf_pfcp_seid, tvb, offset, 8, ENC_BIG_ENDIAN);
3787         offset += 8;
3788     }
3789     /* 7.2.2.2  PFCP Header for Node Related Messages */
3790     /*
3791         Octet     8     7     6     5     4     3     2     1
3792           1    | Version         |Spare|Spare|Spare| MP=0 | S=0 |
3793           2    |        Message Type                            |
3794           3    |        Message Length (1st Octet)              |
3795           4    |        Message Length (2nd Octet)              |
3796           5    |        Sequence Number (1st Octet)             |
3797           6    |        Sequence Number (2st Octet)             |
3798           7    |        Sequence Number (3st Octet)             |
3799           8    |             Spare                              |
3800           */
3801     proto_tree_add_item(sub_tree, hf_pfcp_seqno, tvb, offset, 3, ENC_BIG_ENDIAN);
3802     offset += 3;
3803     if ((pfcp_flags & 0x2) == 0x2) {
3804         /* If the "MP" flag is set to "1", then bits 8 to 5 of octet 16 shall indicate the message priority.*/
3805         proto_tree_add_item(sub_tree, hf_pfcp_mp, tvb, offset, 1, ENC_BIG_ENDIAN);
3806         proto_tree_add_item(sub_tree, hf_pfcp_spare_h0, tvb, offset, 1, ENC_BIG_ENDIAN);
3807     } else {
3808         proto_tree_add_item(sub_tree, hf_pfcp_spare_oct, tvb, offset, 1, ENC_BIG_ENDIAN);
3809     }
3810     offset++;
3811
3812     /* Dissect the IEs in the message */
3813     dissect_pfcp_ies_common(tvb, pinfo, sub_tree, offset, message_type);
3814
3815     return tvb_reported_length(tvb);
3816 }
3817
3818 /* Enterprise IE decoding 3GPP */
3819 static int
3820 dissect_pfcp_3gpp_enterprise_ies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
3821 {
3822     proto_item *top_item = (proto_item *)data;
3823     /* We are give the complete ie, but the first 6 octets are dissected in the pfcp dissector*/
3824     proto_item_append_text(top_item, " Enterprise ID set to '10415' shall not be used for the vendor specific IEs.");
3825     proto_tree_add_expert(tree, pinfo, &ei_pfcp_enterprise_ie_3gpp, tvb, 0, -1);
3826
3827     return tvb_reported_length(tvb);
3828 }
3829
3830 void
3831 proto_register_pfcp(void)
3832 {
3833
3834     static hf_register_info hf_pfcp[] = {
3835
3836         { &hf_pfcp_msg_type,
3837         { "Message Type", "pfcp.msg_type",
3838         FT_UINT8, BASE_DEC | BASE_EXT_STRING, &pfcp_message_type_ext, 0x0,
3839         NULL, HFILL }
3840         },
3841         { &hf_pfcp_msg_length,
3842         { "Length", "pfcp.length",
3843         FT_UINT8, BASE_DEC, NULL, 0x0,
3844         NULL, HFILL }
3845         },
3846         { &hf_pfcp_hdr_flags,
3847         { "Flags", "pfcp.flags",
3848         FT_UINT8, BASE_HEX, NULL, 0x0,
3849         NULL, HFILL }
3850         },
3851         { &hf_pfcp_version,
3852         { "Version", "pfcp.version",
3853         FT_UINT8, BASE_DEC, NULL, 0xe0,
3854         NULL, HFILL }
3855         },
3856         { &hf_pfcp_mp_flag,
3857         { "MP", "pfcp.mp_flag",
3858         FT_BOOLEAN, 8, NULL, 0x02,
3859         NULL, HFILL }
3860         },
3861         { &hf_pfcp_s_flag,
3862         { "S", "pfcp.s",
3863         FT_BOOLEAN, 8, NULL, 0x01,
3864         NULL, HFILL }
3865         },
3866         { &hf_pfcp_spare_b2,
3867         { "Spare", "pfcp.spare_b2",
3868         FT_UINT8, BASE_DEC, NULL, 0x04,
3869         NULL, HFILL }
3870         },
3871         { &hf_pfcp_spare_b3,
3872         { "Spare", "pfcp.spare_b3",
3873         FT_UINT8, BASE_DEC, NULL, 0x08,
3874         NULL, HFILL }
3875         },
3876         { &hf_pfcp_spare_b4,
3877         { "Spare", "pfcp.spare_b4",
3878         FT_UINT8, BASE_DEC, NULL, 0x10,
3879         NULL, HFILL }
3880         },
3881         { &hf_pfcp_spare_b5,
3882         { "Spare", "pfcp.spare_b5",
3883         FT_UINT8, BASE_DEC, NULL, 0x20,
3884         NULL, HFILL }
3885         },
3886         { &hf_pfcp_spare_b6,
3887         { "Spare", "pfcp.spare_b6",
3888         FT_UINT8, BASE_DEC, NULL, 0x40,
3889         NULL, HFILL }
3890         },
3891         { &hf_pfcp_spare_b7,
3892         { "Spare", "pfcp.spare_b7",
3893         FT_UINT8, BASE_DEC, NULL, 0x80,
3894         NULL, HFILL }
3895         },
3896         { &hf_pfcp_spare_b7_b6,
3897         { "Spare", "pfcp.spare_b7_b6",
3898         FT_UINT8, BASE_DEC, NULL, 0xc0,
3899         NULL, HFILL }
3900         },
3901         { &hf_pfcp_spare_b7_b5,
3902         { "Spare", "pfcp.spare_b7_b5",
3903         FT_UINT8, BASE_DEC, NULL, 0xe0,
3904         NULL, HFILL }
3905         },
3906         { &hf_pfcp_spare_b7_b4,
3907         { "Spare", "pfcp.spare_b7_b4",
3908         FT_UINT8, BASE_DEC, NULL, 0xf0,
3909         NULL, HFILL }
3910         },
3911         { &hf_pfcp_spare_b7_b3,
3912         { "Spare", "pfcp.spare_b7_b3",
3913         FT_UINT8, BASE_DEC, NULL, 0xf8,
3914         NULL, HFILL }
3915         },
3916         { &hf_pfcp_spare_b7_b2,
3917         { "Spare", "pfcp.spare_b7_b2",
3918         FT_UINT8, BASE_DEC, NULL, 0xfc,
3919         NULL, HFILL }
3920         },
3921         { &hf_pfcp_spare_b7_b1,
3922         { "Spare", "pfcp.spare_b7_b1",
3923         FT_UINT8, BASE_DEC, NULL, 0xfe,
3924         NULL, HFILL }
3925         },
3926         { &hf_pfcp_spare_oct,
3927         { "Spare", "pfcp.spare_oct",
3928         FT_UINT8, BASE_DEC, NULL, 0x0,
3929         NULL, HFILL }
3930         },
3931         { &hf_pfcp_spare_h0,
3932         { "Spare", "pfcp.spare_h0",
3933         FT_UINT8, BASE_DEC, NULL, 0x0f,
3934         NULL, HFILL }
3935         },
3936         { &hf_pfcp_spare_h1,
3937         { "Spare", "pfcp.spare_h1",
3938         FT_UINT8, BASE_DEC, NULL, 0xf0,
3939         NULL, HFILL }
3940         },
3941         { &hf_pfcp_spare,
3942         { "Spare", "pfcp.spare",
3943         FT_UINT8, BASE_DEC, NULL, 0x0,
3944         NULL, HFILL }
3945         },
3946         { &hf_pfcp_seid,
3947         { "SEID", "pfcp.seid",
3948         FT_UINT64, BASE_HEX, NULL, 0x0,
3949         NULL, HFILL }
3950         },
3951         { &hf_pfcp_seqno,
3952         { "Sequence Number", "pfcp.seqno",
3953         FT_UINT24, BASE_DEC, NULL, 0x0,
3954         NULL, HFILL }
3955         },
3956         { &hf_pfcp_mp,
3957         { "Message Priority", "pfcp.mp",
3958         FT_UINT24, BASE_DEC, NULL, 0xf0,
3959         NULL, HFILL }
3960         },
3961         { &hf_pfcp_enterprice_id,
3962         { "Enterprise ID",      "pfcp.enterprice_id",
3963         FT_UINT16, BASE_ENTERPRISES, STRINGS_ENTERPRISES,
3964         0x0, NULL, HFILL } },
3965         { &hf_pfcp2_ie,
3966         { "IE Type", "pfcp.ie_type",
3967         FT_UINT16, BASE_DEC | BASE_EXT_STRING, &pfcp_ie_type_ext, 0x0,
3968         NULL, HFILL }
3969         },
3970         { &hf_pfcp2_enterprise_ie,
3971         { "Enterprise specific IE Type", "pfcp.enterprise_ie",
3972         FT_UINT16, BASE_DEC, NULL, 0x7fff,
3973         NULL, HFILL }
3974         },
3975         { &hf_pfcp2_ie_len,
3976         { "IE Length", "pfcp.ie_len",
3977         FT_UINT16, BASE_DEC, NULL, 0x0,
3978         NULL, HFILL }
3979         },
3980         { &hf_pfcp_recovery_time_stamp,
3981         { "Recovery Time Stamp", "pfcp.recovery_time_stamp",
3982         FT_STRING, BASE_NONE, NULL, 0,
3983         NULL, HFILL }
3984         },
3985         { &hf_pfcp2_cause,
3986         { "Cause", "pfcp.cause",
3987         FT_UINT8, BASE_DEC, VALS(pfcp_cause_vals), 0x0,
3988         NULL, HFILL }
3989         },
3990         { &hf_pfcp_node_id_type,
3991         { "Node ID Type", "pfcp.node_id_type",
3992             FT_UINT8, BASE_DEC, VALS(pfcp_node_id_type_vals), 0x0f,
3993             NULL, HFILL }
3994         },
3995         { &hf_pfcp_node_id_ipv4,
3996         { "Node ID IPv4", "pfcp.node_id_ipv4",
3997             FT_IPv4, BASE_NONE, NULL, 0x0,
3998             NULL, HFILL }
3999         },
4000         { &hf_pfcp_node_id_ipv6,
4001         { "Node ID IPv6", "pfcp.node_id_ipv6",
4002             FT_IPv6, BASE_NONE, NULL, 0x0,
4003             NULL, HFILL }
4004         },
4005         { &hf_pfcp_node_id_fqdn,
4006         { "Node ID FQDN", "pfcp.node_id_fqdn",
4007             FT_STRING, BASE_NONE, NULL, 0x0,
4008             NULL, HFILL }
4009         },
4010         { &hf_pfcp_f_seid_flags,
4011         { "Flags", "pfcp.f_seid_flags",
4012             FT_UINT8, BASE_HEX, NULL, 0x0,
4013             NULL, HFILL }
4014         },
4015         { &hf_pfcp_b0_v6,
4016         { "V6 (IPv6)", "pfcp.f_seid_flags.v6",
4017             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4018             NULL, HFILL }
4019         },
4020         { &hf_pfcp_b1_v4,
4021         { "V4 (IPv4)", "pfcp.f_seid_flags.v4",
4022             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4023             NULL, HFILL }
4024         },
4025         { &hf_pfcp_f_seid_ipv4,
4026         { "IPv4 address", "pfcp.f_seid.ipv4",
4027             FT_IPv4, BASE_NONE, NULL, 0x0,
4028             NULL, HFILL }
4029         },
4030         { &hf_pfcp_f_seid_ipv6,
4031         { "IPv6 address", "pfcp.f_seid.ipv6",
4032             FT_IPv6, BASE_NONE, NULL, 0x0,
4033             NULL, HFILL }
4034         },
4035         { &hf_pfcp_pdr_id,
4036         { "Rule ID", "pfcp.pdr_id",
4037             FT_UINT16, BASE_DEC, NULL, 0x0,
4038             NULL, HFILL }
4039         },
4040         { &hf_pfcp_precedence,
4041         { "Precedence", "pfcp.precedence",
4042             FT_UINT16, BASE_DEC, NULL, 0x0,
4043             NULL, HFILL }
4044         },
4045         { &hf_pfcp_source_interface,
4046         { "Source Interface", "pfcp.source_interface",
4047             FT_UINT8, BASE_DEC, VALS(pfcp_source_interface_vals), 0x0f,
4048             NULL, HFILL }
4049         },
4050         { &hf_pfcp_f_teid_flags,
4051         { "Flags", "pfcp.f_teid_flags",
4052             FT_UINT8, BASE_HEX, NULL, 0x0,
4053             NULL, HFILL }
4054         },
4055         { &hf_pfcp_fteid_flg_spare,
4056         { "Spare", "pfcp.fteid_flg.spare",
4057             FT_UINT8, BASE_DEC, NULL, 0xf0,
4058             NULL, HFILL }
4059         },
4060         { &hf_pfcp_fteid_flg_b3_ch_id,
4061         { "CHID (CHOOSE_ID)", "pfcp.f_teid_flags.ch_id",
4062             FT_BOOLEAN, 8, NULL, 0x08,
4063             NULL, HFILL }
4064         },
4065         { &hf_pfcp_fteid_flg_b2_ch,
4066         { "CH (CHOOSE)", "pfcp.f_teid_flags.ch",
4067             FT_BOOLEAN, 8, NULL, 0x04,
4068             NULL, HFILL }
4069         },
4070         { &hf_pfcp_fteid_flg_b1_v6,
4071         { "V6 (IPv6)", "pfcp.f_teid_flags.v6",
4072             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4073             NULL, HFILL }
4074         },
4075         { &hf_pfcp_fteid_flg_b0_v4,
4076         { "V4 (IPv4)", "pfcp.f_teid_flags.v4",
4077             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4078             NULL, HFILL }
4079         },
4080         { &hf_pfcp_f_teid_ch_id,
4081         { "Choose Id", "pfcp.f_teid.choose_id",
4082             FT_BYTES, BASE_NONE, NULL, 0x0,
4083             NULL, HFILL }
4084         },
4085         { &hf_pfcp_f_teid_teid,
4086         { "TEID", "pfcp.f_teid.teid",
4087             FT_UINT32, BASE_HEX, NULL, 0x0,
4088             NULL, HFILL }
4089         },
4090         { &hf_pfcp_f_teid_ipv4,
4091         { "IPv4 address", "pfcp.f_teid.ipv4_addr",
4092             FT_IPv4, BASE_NONE, NULL, 0x0,
4093             NULL, HFILL }
4094         },
4095         { &hf_pfcp_f_teid_ipv6,
4096         { "IPv6 address", "pfcp.f_teid.ipv6_addr",
4097             FT_IPv6, BASE_NONE, NULL, 0x0,
4098             NULL, HFILL }
4099         },
4100         { &hf_pfcp_network_instance,
4101         { "Network Instance", "pfcp.network_instance",
4102             FT_BYTES, BASE_NONE, NULL, 0x0,
4103             NULL, HFILL }
4104         },
4105         { &hf_pfcp_pdn_type,
4106         { "PDN Type", "pfcp.pdn_type",
4107             FT_UINT8, BASE_DEC, VALS(pfcp_pdn_type_vals), 0x7,
4108             NULL, HFILL }
4109         },
4110         { &hf_pfcp_failed_rule_id_type,
4111         { "Failed Rule ID Type", "pfcp.failed_rule_id_type",
4112             FT_UINT8, BASE_DEC, VALS(pfcp_failed_rule_id_type_vals), 0x7,
4113             NULL, HFILL }
4114         },
4115         { &hf_pfcp_time_qouta_mechanism_bti_type,
4116         { "Base Time Interval Type", "pfcp.time_qouta_mechanism_bti_type",
4117             FT_UINT8, BASE_DEC, VALS(pfcp_time_qouta_mechanism_bti_type_vals), 0x3,
4118             NULL, HFILL }
4119         },
4120         { &hf_pfcp_time_qouta_mechanism_bti,
4121         { "Base Time Interval", "pfcp.time_qouta_mechanism_bti",
4122             FT_UINT32, BASE_DEC, NULL, 0x0,
4123             NULL, HFILL }
4124         },
4125         { &hf_pfcp_ue_ip_address_flags,
4126         { "Flags", "pfcp.ue_ip_address_flags",
4127             FT_UINT8, BASE_HEX, NULL, 0x0,
4128             NULL, HFILL }
4129         },
4130         { &hf_pfcp_ue_ip_address_flag_b0_v6,
4131         { "V6 (IPv6)", "pfcp.ue_ip_address_flag.v6",
4132             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4133             NULL, HFILL }
4134         },
4135         { &hf_pfcp_ue_ip_address_flag_b1_v4,
4136         { "V4 (IPv4)", "pfcp.ue_ip_address_flag.v4",
4137             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4138             NULL, HFILL }
4139         },
4140         { &hf_pfcp_ue_ip_address_flag_b2_sd,
4141         { "S/D", "pfcp.ue_ip_address_flag.sd",
4142             FT_BOOLEAN, 8, TFS(&pfcp_ue_ip_add_sd_flag_vals), 0x04,
4143             NULL, HFILL }
4144         },
4145         { &hf_pfcp_ue_ip_addr_ipv4,
4146         { "IPv4 address", "pfcp.ue_ip_addr_ipv4",
4147             FT_IPv4, BASE_NONE, NULL, 0x0,
4148             NULL, HFILL }
4149         },
4150         { &hf_pfcp_ue_ip_add_ipv6,
4151         { "IPv6 address", "pfcp.ue_ip_addr_ipv6",
4152             FT_IPv6, BASE_NONE, NULL, 0x0,
4153             NULL, HFILL }
4154         },
4155         { &hf_pfcp_application_id,
4156         { "Application Identifier", "pfcp.application_id",
4157             FT_BYTES, BASE_NONE, NULL, 0x0,
4158             NULL, HFILL }
4159         },
4160         { &hf_pfcp_sdf_filter_flags,
4161         { "Flags", "pfcp.sdf_filter_flags",
4162             FT_UINT8, BASE_HEX, NULL, 0x0,
4163             NULL, HFILL }
4164         },
4165         { &hf_pfcp_sdf_filter_b0_fd,
4166         { "FD (Flow Description)", "pfcp.sdf_filter.fd",
4167             FT_BOOLEAN, 8, NULL, 0x01,
4168             NULL, HFILL }
4169         },
4170         { &hf_pfcp_sdf_filter_b1_ttc,
4171         { "TTC (ToS Traffic Class)", "pfcp.sdf_filter.ttc",
4172             FT_BOOLEAN, 8, NULL, 0x02,
4173             NULL, HFILL }
4174         },
4175         { &hf_pfcp_sdf_filter_b2_spi,
4176         { "SPI (Security Parameter Index)", "pfcp.sdf_filter.spi",
4177             FT_BOOLEAN, 8, NULL, 0x04,
4178             NULL, HFILL }
4179         },
4180         { &hf_pfcp_sdf_filter_b3_fl,
4181         { "FL (Flow Label)", "pfcp.sdf_filter.fl",
4182             FT_BOOLEAN, 8, NULL, 0x08,
4183             NULL, HFILL }
4184         },
4185         { &hf_pfcp_flow_desc_len,
4186         { "Length of Flow Description", "pfcp.flow_desc_len",
4187             FT_UINT16, BASE_DEC, NULL, 0x0,
4188             NULL, HFILL }
4189         },
4190         { &hf_pfcp_fd,
4191         { "Flow Description field", "pfcp.fd",
4192             FT_BYTES, BASE_NONE, NULL, 0x0,
4193             NULL, HFILL }
4194         },
4195         { &hf_pfcp_ttc,
4196         { "ToS Traffic Class field", "pfcp.ttc",
4197             FT_BYTES, BASE_NONE, NULL, 0x0,
4198             NULL, HFILL }
4199         },
4200         { &hf_pfcp_spi,
4201         { "Security Parameter Index field", "pfcp.spi",
4202             FT_BYTES, BASE_NONE, NULL, 0x0,
4203             NULL, HFILL }
4204         },
4205         { &hf_pfcp_fl,
4206         { "Flow Label field", "pfcp.fl",
4207             FT_BYTES, BASE_NONE, NULL, 0x0,
4208             NULL, HFILL }
4209         },
4210         { &hf_pfcp_out_hdr_desc,
4211         { "Outer Header Removal Description", "pfcp.out_hdr_desc",
4212             FT_UINT8, BASE_DEC, VALS(pfcp_out_hdr_desc_vals), 0x0,
4213             NULL, HFILL }
4214         },
4215         { &hf_pfcp_far_id_flg,
4216         { "Allocation type", "pfcp.far_id_flg",
4217             FT_BOOLEAN, 32, TFS(&pfcp_id_predef_dynamic_tfs), 0x80000000,
4218             NULL, HFILL }
4219         },
4220         { &hf_pfcp_far_id,
4221         { "FAR ID", "pfcp.far_id",
4222             FT_UINT32, BASE_DEC, NULL, 0x7fffffff,
4223             NULL, HFILL }
4224         },
4225         { &hf_pfcp_urr_id_flg,
4226         { "Allocation type", "pfcp.urr_id_flg",
4227             FT_BOOLEAN, 32, TFS(&pfcp_id_predef_dynamic_tfs), 0x80000000,
4228             NULL, HFILL }
4229         },
4230         { &hf_pfcp_urr_id,
4231         { "URR ID", "pfcp.urr_id",
4232             FT_UINT32, BASE_DEC, NULL, 0x7fffffff,
4233             NULL, HFILL }
4234         },
4235         { &hf_pfcp_qer_id_flg,
4236         { "Allocation type", "pfcp.qer_id_flg",
4237             FT_BOOLEAN, 32, TFS(&pfcp_id_predef_dynamic_tfs), 0x80000000,
4238             NULL, HFILL }
4239         },
4240         { &hf_pfcp_qer_id,
4241         { "QER ID", "pfcp.qer_id",
4242             FT_UINT32, BASE_DEC, NULL, 0x7fffffff,
4243             NULL, HFILL }
4244         },
4245         { &hf_pfcp_predef_rules_name,
4246         { "Predefined Rules Name", "pfcp.predef_rules_name",
4247             FT_BYTES, BASE_NONE, NULL, 0x0,
4248             NULL, HFILL }
4249         },
4250         { &hf_pfcp_apply_action_flags,
4251         { "Flags", "pfcp.apply_action_flags",
4252             FT_UINT8, BASE_HEX, NULL, 0x0,
4253             NULL, HFILL }
4254         },
4255         { &hf_pfcp_apply_action_b0_drop,
4256         { "DROP (Drop)", "pfcp.apply_action.drop",
4257             FT_BOOLEAN, 8, NULL, 0x01,
4258             NULL, HFILL }
4259         },
4260         { &hf_pfcp_apply_action_b1_forw,
4261         { "FORW (Forward)", "pfcp.apply_action.forw",
4262             FT_BOOLEAN, 8, NULL, 0x02,
4263             NULL, HFILL }
4264         },
4265         { &hf_pfcp_apply_action_b2_buff,
4266         { "BUFF (Buffer)", "pfcp.apply_action.buff",
4267             FT_BOOLEAN, 8, NULL, 0x04,
4268             NULL, HFILL }
4269         },
4270         { &hf_pfcp_apply_action_b3_nocp,
4271         { "NOCP (Notify the CP function)", "pfcp.apply_action.nocp",
4272             FT_BOOLEAN, 8, NULL, 0x08,
4273             NULL, HFILL }
4274         },
4275         { &hf_pfcp_apply_action_b4_dupl,
4276         { "DUPL (Duplicate)", "pfcp.apply_action.dupl",
4277             FT_BOOLEAN, 8, NULL, 0x10,
4278             NULL, HFILL }
4279         },
4280         { &hf_pfcp_bar_id,
4281         { "BAR ID", "pfcp.bar_id",
4282             FT_UINT8, BASE_DEC, NULL, 0x0,
4283             NULL, HFILL }
4284         },
4285         { &hf_pfcp_fq_csid_node_id_type,
4286         { "FQ-CSID Node-ID Type", "pfcp.fq_csid_node_id_type",
4287             FT_UINT8, BASE_DEC, VALS(pfcp_fq_csid_node_id_type_vals), 0xf0,
4288             NULL, HFILL }
4289         },
4290         { &hf_pfcp_num_csid,
4291         { "Number of CSID", "pfcp.num_csid",
4292             FT_UINT8, BASE_DEC, NULL, 0x0f,
4293             NULL, HFILL }
4294         },
4295         { &hf_pfcp_fq_csid_node_id_ipv4,
4296         { "Node-Address", "pfcp.q_csid_node_id.ipv4",
4297             FT_IPv4, BASE_NONE, NULL, 0x0,
4298             NULL, HFILL }
4299         },
4300         { &hf_pfcp_fq_csid_node_id_ipv6,
4301         { "Node-Address", "pfcp.q_csid_node_id.ipv6",
4302             FT_IPv6, BASE_NONE, NULL, 0x0,
4303             NULL, HFILL }
4304         },
4305         { &hf_pfcp_fq_csid_node_id_mcc_mnc,
4306         { "Node-Address MCC MNC", "pfcp.q_csid_node_id.mcc_mnc",
4307             FT_UINT32, BASE_DEC, NULL, 0xfffff000,
4308             NULL, HFILL }
4309         },
4310         { &hf_pfcp_fq_csid_node_id_int,
4311         { "Node-Address Number", "pfcp.q_csid_node_id.int",
4312             FT_UINT32, BASE_DEC, NULL, 0x00000fff,
4313             NULL, HFILL }
4314         },
4315         { &hf_pfcp_fq_csid,
4316         { "PDN Connection Set Identifier (CSID)", "pfcp.csid",
4317             FT_UINT16, BASE_DEC, NULL, 0x0,
4318             NULL, HFILL }
4319         },
4320         { &hf_pfcp_measurement_period,
4321         { "Measurement Period", "pfcp.measurement_period",
4322             FT_UINT32, BASE_DEC, NULL, 0x0,
4323             NULL, HFILL }
4324         },
4325         { &hf_pfcp_duration_measurement,
4326         { "Duration", "pfcp.duration_measurement",
4327             FT_UINT32, BASE_DEC, NULL, 0x0,
4328             NULL, HFILL }
4329         },
4330         { &hf_pfcp_time_of_first_packet,
4331         { "Time of First Packet", "pfcp.time_of_first_packet",
4332             FT_STRING, BASE_NONE, NULL, 0,
4333             NULL, HFILL }
4334         },
4335         { &hf_pfcp_time_of_last_packet,
4336         { "Time of Last Packet", "pfcp.time_of_last_packet",
4337             FT_STRING, BASE_NONE, NULL, 0,
4338             NULL, HFILL }
4339         },
4340         { &hf_pfcp_dst_interface,
4341         { "Interface", "pfcp.dst_interface",
4342             FT_UINT8, BASE_DEC, VALS(pfcp_dst_interface_vals), 0x0f,
4343             NULL, HFILL }
4344         },
4345         { &hf_pfcp_redirect_address_type,
4346         { "Redirect Address Type", "pfcp.redirect_address_type",
4347             FT_UINT8, BASE_DEC, VALS(pfcp_redirect_address_type_vals), 0x0f,
4348             NULL, HFILL }
4349         },
4350         { &hf_pfcp_redirect_server_addr_len,
4351         { "Redirect Server Address Length", "pfcp.redirect_server_addr_len",
4352             FT_UINT16, BASE_DEC, NULL, 0x0,
4353             NULL, HFILL }
4354         },
4355         { &hf_pfcp_redirect_server_address,
4356         { "Redirect Server Address", "pfcp.redirect_server_address",
4357             FT_STRING, BASE_NONE, NULL, 0x0,
4358             NULL, HFILL }
4359         },
4360         { &hf_pfcp_linked_urr_id,
4361         { "Linked URR ID", "pfcp.linked_urr_id",
4362             FT_UINT16, BASE_DEC, NULL, 0x0,
4363             NULL, HFILL }
4364         },
4365         { &hf_pfcp_outer_hdr_desc,
4366         { "Outer Header Creation Description", "pfcp.outer_hdr_desc",
4367             FT_UINT16, BASE_DEC, VALS(pfcp_outer_hdr_desc_vals), 0x0,
4368             NULL, HFILL }
4369         },
4370         { &hf_pfcp_outer_hdr_creation_teid,
4371         { "TEID", "pfcp.outer_hdr_creation.teid",
4372             FT_UINT32, BASE_HEX, NULL, 0x0,
4373             NULL, HFILL }
4374         },
4375         { &hf_pfcp_outer_hdr_creation_ipv4,
4376         { "IPv4 Address", "pfcp.outer_hdr_creation.ipv4",
4377             FT_IPv4, BASE_NONE, NULL, 0x0,
4378             NULL, HFILL }
4379         },
4380         { &hf_pfcp_outer_hdr_creation_ipv6,
4381         { "IPv6 Address", "pfcp.outer_hdr_creation.ipv6",
4382             FT_IPv6, BASE_NONE, NULL, 0x0,
4383             NULL, HFILL }
4384         },
4385         { &hf_pfcp_outer_hdr_creation_port,
4386         { "Port Number", "pfcp.outer_hdr_creation.port",
4387             FT_UINT16, BASE_DEC, NULL, 0x0,
4388             NULL, HFILL }
4389         },
4390         { &hf_pfcp_tos_traf_class,
4391         { "ToS/Traffic Class", "pfcp.tos_traf_class.port",
4392             FT_UINT16, BASE_DEC, NULL, 0x0,
4393             NULL, HFILL }
4394         },
4395         { &hf_pfcp_time_threshold,
4396         { "Time Threshold", "pfcp.time_threshold",
4397             FT_UINT16, BASE_DEC, NULL, 0x0,
4398             NULL, HFILL }
4399         },
4400         { &hf_pfcp_forwarding_policy_id_len,
4401         { "Forwarding Policy Identifier Length", "pfcp.forwarding_policy_id_len",
4402             FT_UINT8, BASE_DEC, NULL, 0x0,
4403             NULL, HFILL }
4404         },
4405         { &hf_pfcp_forwarding_policy_id,
4406         { "Forwarding Policy Identifier", "pfcp.forwarding_policy_id",
4407             FT_BYTES, BASE_NONE, NULL, 0x0,
4408             NULL, HFILL }
4409         },
4410         { &hf_pfcp_measurement_method_flags,
4411         { "Flags", "pfcp.measurement_method_flags",
4412             FT_UINT8, BASE_HEX, NULL, 0x0,
4413             NULL, HFILL }
4414         },
4415         { &hf_pfcp_b0_durat,
4416         { "DURAT (Duration)", "pfcp.measurement_method_flags.durat",
4417             FT_BOOLEAN, 8, NULL, 0x01,
4418             NULL, HFILL }
4419         },
4420         { &hf_pfcp_b1_volume,
4421         { "VOLUM (Volume)", "pfcp.measurement_method_flags.volume",
4422             FT_BOOLEAN, 8, NULL, 0x02,
4423             NULL, HFILL }
4424         },
4425         { &hf_pfcp_b2_event,
4426         { "EVENT (Event)", "pfcp.measurement_method_flags.event",
4427             FT_BOOLEAN, 8, NULL, 0x04,
4428             NULL, HFILL }
4429         },
4430         { &hf_pfcp_subsequent_time_threshold,
4431         { "Subsequent Time Threshold", "pfcp.subsequent_time_threshold",
4432             FT_UINT32, BASE_DEC, NULL, 0x0,
4433             NULL, HFILL }
4434         },
4435         { &hf_pfcp_inactivity_detection_time,
4436         { "Inactivity Detection Time", "pfcp.inactivity_detection_time",
4437             FT_UINT32, BASE_DEC, NULL, 0x0,
4438             NULL, HFILL }
4439         },
4440         { &hf_pfcp_monitoring_time,
4441         { "Monitoring Time", "pfcp.monitoring_time",
4442             FT_STRING, BASE_NONE, NULL, 0,
4443             NULL, HFILL }
4444         },
4445         { &hf_pfcp_reporting_triggers,
4446         { "Flags", "pfcp.reporting_triggers_flags",
4447             FT_UINT16, BASE_HEX, NULL, 0x0,
4448             NULL, HFILL }
4449         },
4450         { &hf_pfcp_reporting_triggers_b0_volqu,
4451         { "VOLQU (Volume Quota)", "pfcp.reporting_triggers_flags.volqu",
4452             FT_BOOLEAN, 16, NULL, 0x0001,
4453             NULL, HFILL }
4454         },
4455         { &hf_pfcp_reporting_triggers_b1_timqu,
4456         { "TIMQU (Time Quota)", "pfcp.reporting_triggers_flags.timqu",
4457             FT_BOOLEAN, 16, NULL, 0x0002,
4458             NULL, HFILL }
4459         },
4460         { &hf_pfcp_reporting_triggers_b2_envcl,
4461         { "ENVCL (Envelope Closure)", "pfcp.reporting_triggers_flags.envcl",
4462             FT_BOOLEAN, 16, NULL, 0x0004,
4463             NULL, HFILL }
4464         },
4465         { &hf_pfcp_reporting_triggers_b7_b3_spare,
4466         { "Spare", "pfcp.reporting_triggers_flags.spare",
4467             FT_UINT16, BASE_DEC, NULL, 0x00F8,
4468             NULL, HFILL }
4469         },
4470         { &hf_pfcp_reporting_triggers_b8_perio,
4471         { "PERIO (Periodic Reporting)", "pfcp.reporting_triggers_flags.perio",
4472             FT_BOOLEAN, 16, NULL, 0x0100,
4473             NULL, HFILL }
4474         },
4475         { &hf_pfcp_reporting_triggers_b9_volth,
4476         { "VOLTH (Volume Threshold)", "pfcp.reporting_triggers_flags.volth",
4477             FT_BOOLEAN, 16, NULL, 0x0200,
4478             NULL, HFILL }
4479         },
4480         { &hf_pfcp_reporting_triggers_b10_timth,
4481                 { "TIMTH (Time Threshold)", "pfcp.reporting_triggers_flags.timth",
4482             FT_BOOLEAN, 16, NULL, 0x0400,
4483             NULL, HFILL }
4484         },
4485         { &hf_pfcp_reporting_triggers_b11_quhti,
4486         { "QUHTI (Quota Holding Time)", "pfcp.reporting_triggers_flags.quhti",
4487             FT_BOOLEAN, 16, NULL, 0x0800,
4488             NULL, HFILL }
4489         },
4490         { &hf_pfcp_reporting_triggers_b12_start,
4491         { "START (Start of Traffic)", "pfcp.reporting_triggers_flags.start",
4492             FT_BOOLEAN, 16, NULL, 0x1000,
4493             NULL, HFILL }
4494         },
4495         { &hf_pfcp_reporting_triggers_b13_stopt,
4496         { "STOPT (Stop of Traffic)", "pfcp.reporting_triggers_flags.stopt",
4497             FT_BOOLEAN, 16, NULL, 0x2000,
4498             NULL, HFILL }
4499         },
4500         { &hf_pfcp_reporting_triggers_b14_droth,
4501         { "DROTH (Dropped DL Traffic Threshold)", "pfcp.reporting_triggers_flags.droth",
4502             FT_BOOLEAN, 16, NULL, 0x4000,
4503             NULL, HFILL }
4504         },
4505         { &hf_pfcp_reporting_triggers_b15_liusa,
4506         { "LIUSA (Linked Usage Reporting)", "pfcp.reporting_triggers_flags.liusa",
4507             FT_BOOLEAN, 16, NULL, 0x8000,
4508             NULL, HFILL }
4509         },
4510
4511         { &hf_pfcp_usage_report_trigger,
4512         { "Flags", "pfcp.usage_report_trigger",
4513             FT_UINT16, BASE_HEX, NULL, 0x0,
4514             NULL, HFILL }
4515         },
4516
4517         { &hf_pfcp_usage_report_trigger_b0_volqu,
4518         { "VOLQU (Volume Quota)", "pfcp.usage_report_trigger_flags.volqu",
4519             FT_BOOLEAN, 16, NULL, 0x0001,
4520             NULL, HFILL }
4521         },
4522         { &hf_pfcp_usage_report_trigger_b1_timqu,
4523         { "TIMQU (Time Quota)", "pfcp.usage_report_trigger_flags.timqu",
4524             FT_BOOLEAN, 16, NULL, 0x0002,
4525             NULL, HFILL }
4526         },
4527         { &hf_pfcp_usage_report_trigger_b2_liusa,
4528                 { "LIUSA (Linked Usage Reporting)", "pfcp.usage_report_trigger_flags.liusa",
4529             FT_BOOLEAN, 16, NULL, 0x0004,
4530             NULL, HFILL }
4531         },
4532         { &hf_pfcp_usage_report_trigger_b3_termr,
4533         { "TERMR (Termination Report)", "pfcp.usage_report_trigger.term",
4534             FT_BOOLEAN, 16, NULL, 0x0008,
4535             NULL, HFILL }
4536         },
4537         { &hf_pfcp_usage_report_trigger_b4_monit,
4538         { "MONIT (Monitoring Time)", "pfcp.usage_report_trigger.monit",
4539             FT_BOOLEAN, 16, NULL, 0x0010,
4540             NULL, HFILL }
4541         },
4542         { &hf_pfcp_usage_report_trigger_b5_envcl,
4543         { "ENVCL (Envelope Closure)", "pfcp.usage_report_trigger_flags.envcl",
4544             FT_BOOLEAN, 16, NULL, 0x0020,
4545             NULL, HFILL }
4546         },
4547         { &hf_pfcp_usage_report_trigger_b7_b6_spare,
4548         { "Spare", "pfcp.reporting_triggers_flags.spare",
4549             FT_UINT16, BASE_DEC, NULL, 0x00C0,
4550             NULL, HFILL }
4551         },
4552         { &hf_pfcp_usage_report_trigger_b8_perio,
4553         { "PERIO (Periodic Reporting)", "pfcp.usage_report_trigger_flags.perio",
4554             FT_BOOLEAN, 16, NULL, 0x0100,
4555             NULL, HFILL }
4556         },
4557         { &hf_pfcp_usage_report_trigger_b9_volth,
4558         { "VOLTH (Volume Threshold)", "pfcp.usage_report_trigger_flags.volth",
4559             FT_BOOLEAN, 16, NULL, 0x0200,
4560             NULL, HFILL }
4561         },
4562         { &hf_pfcp_usage_report_trigger_b10_timth,
4563         { "TIMTH (Time Threshold)", "pfcp.usage_report_trigger_flags.timth",
4564             FT_BOOLEAN, 16, NULL, 0x0400,
4565             NULL, HFILL }
4566         },
4567         { &hf_pfcp_usage_report_trigger_b11_quhti,
4568         { "QUHTI (Quota Holding Time)", "pfcp.usage_report_trigger_flags.quhti",
4569             FT_BOOLEAN, 16, NULL, 0x0800,
4570             NULL, HFILL }
4571         },
4572         { &hf_pfcp_usage_report_trigger_b12_start,
4573         { "START (Start of Traffic)", "pfcp.usage_report_trigger_flags.start",
4574             FT_BOOLEAN, 16, NULL, 0x1000,
4575             NULL, HFILL }
4576         },
4577         { &hf_pfcp_usage_report_trigger_b13_stopt,
4578         { "STOPT (Stop of Traffic)", "pfcp.usage_report_trigger_flags.stopt",
4579             FT_BOOLEAN, 16, NULL, 0x2000,
4580             NULL, HFILL }
4581         },
4582         { &hf_pfcp_usage_report_trigger_b14_droth,
4583         { "DROTH (Dropped DL Traffic Threshold)", "pfcp.usage_report_trigger_flags.droth",
4584             FT_BOOLEAN, 16, NULL, 0x4000,
4585             NULL, HFILL }
4586         },
4587         { &hf_pfcp_usage_report_trigger_b15_immer,
4588         { "IMMER (Immediate Report)", "pfcp.usage_report_trigger.immer",
4589             FT_BOOLEAN, 16, NULL, 0x8000,
4590             NULL, HFILL }
4591         },
4592
4593         { &hf_pfcp_volume_threshold,
4594         { "Flags", "pfcp.volume_threshold",
4595             FT_UINT8, BASE_HEX, NULL, 0x0,
4596             NULL, HFILL }
4597         },
4598         { &hf_pfcp_b0_tovol,
4599         { "TOVOL", "pfcp.tovol_flg",
4600             FT_BOOLEAN, 8, NULL, 0x01,
4601             NULL, HFILL }
4602         },
4603         { &hf_pfcp_b1_ulvol,
4604         { "ULVOL", "pfcp.ulvol_flg",
4605             FT_BOOLEAN, 8, NULL, 0x02,
4606             NULL, HFILL }
4607         },
4608         { &hf_pfcp_b2_dlvol,
4609         { "DLVOL", "pfcp.dlvol_flg",
4610             FT_BOOLEAN, 8, NULL, 0x04,
4611             NULL, HFILL }
4612         },
4613         { &hf_pfcp_volume_threshold_tovol,
4614         { "Total Volume", "pfcp.volume_threshold.tovol",
4615             FT_UINT64, BASE_DEC, NULL, 0x0,
4616             NULL, HFILL }
4617         },
4618         { &hf_pfcp_volume_threshold_ulvol,
4619         { "Uplink Volume", "pfcp.volume_threshold.ulvol",
4620             FT_UINT64, BASE_DEC, NULL, 0x0,
4621             NULL, HFILL }
4622         },
4623         { &hf_pfcp_volume_threshold_dlvol,
4624         { "Downlink Volume", "pfcp.volume_threshold.dlvol",
4625             FT_UINT64, BASE_DEC, NULL, 0x0,
4626             NULL, HFILL }
4627         },
4628         { &hf_pfcp_volume_quota,
4629         { "Flags", "pfcp.volume_quota",
4630             FT_UINT8, BASE_HEX, NULL, 0x0,
4631             NULL, HFILL }
4632         },
4633         { &hf_pfcp_volume_quota_tovol,
4634         { "Total Volume", "pfcp.volume_quota.tovol",
4635             FT_UINT64, BASE_DEC, NULL, 0x0,
4636             NULL, HFILL }
4637         },
4638         { &hf_pfcp_volume_quota_ulvol,
4639         { "Uplink Volume", "pfcp.volume_quota.ulvol",
4640             FT_UINT64, BASE_DEC, NULL, 0x0,
4641             NULL, HFILL }
4642         },
4643         { &hf_pfcp_volume_quota_dlvol,
4644         { "Downlink Volume", "pfcp.volume_quota.dlvol",
4645             FT_UINT64, BASE_DEC, NULL, 0x0,
4646             NULL, HFILL }
4647         },
4648         { &hf_pfcp_subseq_volume_threshold,
4649         { "Flags", "pfcp.subseq_volume_threshold",
4650             FT_UINT8, BASE_HEX, NULL, 0x0,
4651             NULL, HFILL }
4652         },
4653         { &hf_pfcp_subseq_volume_threshold_b0_tovol,
4654         { "TOVOL", "pfcp.subseq_volume_threshold.tovol_flg",
4655             FT_BOOLEAN, 8, NULL, 0x01,
4656             NULL, HFILL }
4657         },
4658         { &hf_pfcp_subseq_volume_threshold_b1_ulvol,
4659         { "ULVOL", "pfcp.subseq_volume_threshold.ulvol_flg",
4660             FT_BOOLEAN, 8, NULL, 0x02,
4661             NULL, HFILL }
4662         },
4663         { &hf_pfcp_subseq_volume_threshold_b2_dlvol,
4664         { "DLVOL", "pfcp.subseq_volume_threshold.dlvol_flg",
4665             FT_BOOLEAN, 8, NULL, 0x04,
4666             NULL, HFILL }
4667         },
4668         { &hf_pfcp_subseq_volume_threshold_tovol,
4669         { "Total Volume", "pfcp.subseq_volume_threshold.tovol",
4670             FT_UINT64, BASE_DEC, NULL, 0x0,
4671             NULL, HFILL }
4672         },
4673         { &hf_pfcp_subseq_volume_threshold_ulvol,
4674         { "Uplink Volume", "pfcp.subseq_volume_threshold.ulvol",
4675             FT_UINT64, BASE_DEC, NULL, 0x0,
4676             NULL, HFILL }
4677         },
4678         { &hf_pfcp_subseq_volume_threshold_dlvol,
4679         { "Downlink Volume", "pfcp.subseq_volume_threshold.dlvol",
4680             FT_UINT64, BASE_DEC, NULL, 0x0,
4681             NULL, HFILL }
4682         },
4683         { &hf_pfcp_time_quota,
4684         { "Time Quota", "pfcp.time_quota",
4685             FT_UINT32, BASE_DEC, NULL, 0x0,
4686             NULL, HFILL }
4687         },
4688         { &hf_pfcp_start_time,
4689         { "Start Time", "pfcp.start_time",
4690             FT_STRING, BASE_NONE, NULL, 0,
4691             NULL, HFILL }
4692         },
4693         { &hf_pfcp_end_time,
4694         { "End Time", "pfcp.start_time",
4695             FT_STRING, BASE_NONE, NULL, 0,
4696             NULL, HFILL }
4697         },
4698         { &hf_pfcp_quota_holding_time,
4699         { "Quota Holding Time", "pfcp.quota_holding_time",
4700             FT_UINT32, BASE_DEC, NULL, 0x0,
4701             NULL, HFILL }
4702         },
4703         { &hf_pfcp_dropped_dl_traffic_threshold,
4704         { "Flags", "pfcp.dropped_dl_traffic_threshold",
4705             FT_UINT8, BASE_HEX, NULL, 0x0,
4706             NULL, HFILL }
4707         },
4708         { &hf_pfcp_dropped_dl_traffic_threshold_b0_dlpa,
4709         { "DLPA", "pfcp.dropped_dl_traffic_threshold.dlpa_flg",
4710             FT_BOOLEAN, 8, NULL, 0x01,
4711             NULL, HFILL }
4712         },
4713         { &hf_pfcp_downlink_packets,
4714         { "Downlink Packets", "pfcp.downlink_packets",
4715             FT_UINT64, BASE_DEC, NULL, 0x0,
4716             NULL, HFILL }
4717         },
4718         { &hf_pfcp_qer_correlation_id,
4719         { "QER Correlation ID", "pfcp.qer_correlation_id",
4720             FT_UINT32, BASE_DEC, NULL, 0x0,
4721             NULL, HFILL }
4722         },
4723         { &hf_pfcp_gate_status,
4724         { "Flags", "pfcp.gate_status",
4725             FT_UINT8, BASE_HEX, NULL, 0x0,
4726             NULL, HFILL }
4727         },
4728         { &hf_pfcp_gate_status_b0b1_dlgate,
4729         { "DL Gate", "pfcp.gate_status.ulgate",
4730             FT_UINT8, BASE_DEC, VALS(pfcp_gate_status_vals), 0x03,
4731             NULL, HFILL }
4732         },
4733         { &hf_pfcp_gate_status_b3b2_ulgate,
4734         { "UL Gate", "pfcp.gate_status.ulgate",
4735             FT_UINT8, BASE_DEC, VALS(pfcp_gate_status_vals), 0x0e,
4736             NULL, HFILL }
4737         },
4738         { &hf_pfcp_ul_mbr,
4739         { "UL MBR", "pfcp.ul_mbr",
4740             FT_UINT40, BASE_DEC, NULL, 0x0,
4741             NULL, HFILL }
4742         },
4743         { &hf_pfcp_dl_mbr,
4744         { "DL MBR", "pfcp.dl_mbr",
4745             FT_UINT40, BASE_DEC, NULL, 0x0,
4746             NULL, HFILL }
4747         },
4748         { &hf_pfcp_ul_gbr,
4749         { "UL GBR", "pfcp.ul_gbr",
4750             FT_UINT40, BASE_DEC, NULL, 0x0,
4751             NULL, HFILL }
4752         },
4753         { &hf_pfcp_dl_gbr,
4754         { "DL GBR", "pfcp.dl_gbr",
4755             FT_UINT40, BASE_DEC, NULL, 0x0,
4756             NULL, HFILL }
4757         },
4758         { &hf_pfcp_report_type,
4759         { "Flags", "pfcp.report_type",
4760             FT_UINT8, BASE_HEX, NULL, 0x0,
4761             NULL, HFILL }
4762         },
4763         { &hf_pfcp_b2_erir,
4764         { "ERIR (Error Indication Report)", "pfcp.report_type.erir",
4765             FT_BOOLEAN, 8, NULL, 0x04,
4766             NULL, HFILL }
4767         },
4768         { &hf_pfcp_b1_usar,
4769         { "USAR (Usage Report)", "pfcp.report_type.usar",
4770             FT_BOOLEAN, 8, NULL, 0x02,
4771             NULL, HFILL }
4772         },
4773         { &hf_pfcp_b0_dldr,
4774         { "DLDR (Downlink Data Report)", "pfcp.report_type.dldr",
4775             FT_BOOLEAN, 8, NULL, 0x01,
4776             NULL, HFILL }
4777         },
4778         { &hf_pfcp_offending_ie,
4779         { "Type of the offending IE", "pfcp.offending_ie",
4780             FT_UINT16, BASE_DEC | BASE_EXT_STRING, &pfcp_ie_type_ext, 0x0,
4781             NULL, HFILL }
4782         },
4783
4784         { &hf_pfcp_up_function_features,
4785         { "Flags", "pfcp.up_function_features",
4786             FT_UINT16, BASE_HEX, NULL, 0x0,
4787             NULL, HFILL }
4788         },
4789         { &hf_pfcp_b8_bucp,
4790         { "BUCP", "pfcp.up_function_features.bucp",
4791             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0100,
4792             "Downlink Data Buffering in CP function", HFILL }
4793         },
4794         { &hf_pfcp_b9_ddnd,
4795         { "DDND", "pfcp.up_function_features.ddnd",
4796             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0200,
4797             "Buffering parameter 'Downlink Data Notification Delay", HFILL }
4798         },
4799         { &hf_pfcp_b10_dlbd,
4800         { "DLBD", "pfcp.up_function_features.dlbd",
4801             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0400,
4802             NULL, HFILL }
4803         },
4804         { &hf_pfcp_b11_trst,
4805         { "TRST", "pfcp.up_function_features.trst",
4806             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0800,
4807             "Traffic Steering", HFILL }
4808         },
4809         { &hf_pfcp_b12_ftup,
4810         { "FTUP", "pfcp.up_function_features.ftup",
4811             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x1000,
4812             "F-TEID allocation / release in the UP function", HFILL }
4813         },
4814         { &hf_pfcp_b13_pfdm,
4815         { "PFDM", "pfcp.up_function_features.pfdm",
4816             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x2000,
4817             "PFD Management procedure", HFILL }
4818         },
4819         { &hf_pfcp_b14_heeu,
4820         { "HEEU", "pfcp.up_function_features.heeu",
4821             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x4000,
4822             "Header Enrichment of Uplink traffic", HFILL }
4823         },
4824         { &hf_pfcp_b15_treu,
4825         { "TREU", "pfcp.up_function_features.treu",
4826             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x8000,
4827             "Traffic Redirection Enforcement in the UP function", HFILL }
4828         },
4829         { &hf_pfcp_b0_empu,
4830         { "EMPU", "pfcp.up_function_features.empu",
4831             FT_BOOLEAN, 16, TFS(&tfs_supported_not_supported), 0x0001,
4832             "Sending of End Marker packets", HFILL }
4833         },
4834         { &hf_pfcp_b1_b7_spare,
4835         { "Spare", "pfcp.up_function_features.spare",
4836             FT_BOOLEAN, 16, NULL , 0x00FE,
4837             "Sending of End Marker packets", HFILL }
4838         },
4839         { &hf_pfcp_sequence_number,
4840         { "Sequence Number", "pfcp.sequence_number",
4841             FT_UINT32, BASE_DEC, NULL, 0x0,
4842             NULL, HFILL }
4843         },
4844         { &hf_pfcp_metric,
4845         { "Metric", "pfcp.metric",
4846             FT_UINT8, BASE_DEC, NULL, 0x0,
4847             NULL, HFILL }
4848         },
4849         { &hf_pfcp_timer_unit,
4850         { "Timer unit", "pfcp.timer_unit",
4851             FT_UINT8, BASE_DEC, VALS(pfcp_timer_unit_vals), 0xe0,
4852             NULL, HFILL }
4853         },
4854         { &hf_pfcp_timer_value,
4855         { "Timer value", "pfcp.timer_value",
4856             FT_UINT8, BASE_DEC, NULL, 0x1f,
4857             NULL, HFILL }
4858         },
4859         { &hf_pfcp_volume_measurement,
4860         { "Flags", "pfcp.volume_measurement",
4861             FT_UINT8, BASE_HEX, NULL, 0x0,
4862             NULL, HFILL }
4863         },
4864         { &hf_pfcp_vol_meas_tovol,
4865         { "Total Volume", "pfcp.volume_measurement.tovol",
4866             FT_UINT64, BASE_DEC, NULL, 0x0,
4867             NULL, HFILL }
4868         },
4869         { &hf_pfcp_vol_meas_ulvol,
4870         { "Uplink Volume", "pfcp.volume_measurement.ulvol",
4871             FT_UINT64, BASE_DEC, NULL, 0x0,
4872             NULL, HFILL }
4873         },
4874         { &hf_pfcp_vol_meas_dlvol,
4875         { "Downlink Volume", "pfcp.volume_measurement.dlvol",
4876             FT_UINT64, BASE_DEC, NULL, 0x0,
4877             NULL, HFILL }
4878         },
4879         { &hf_pfcp_cp_function_features,
4880         { "Flags", "pfcp.cp_function_features",
4881             FT_UINT8, BASE_HEX, NULL, 0x0,
4882             NULL, HFILL }
4883         },
4884         { &hf_pfcp_b0_load,
4885         { "LOAD", "pfcp.cp_function_features.load",
4886             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4887             "Load Control", HFILL }
4888         },
4889         { &hf_pfcp_b1_ovrl,
4890         { "OVRL", "pfcp.cp_function_features.ovrl",
4891             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4892             "Overload Control", HFILL }
4893         },
4894         { &hf_pfcp_usage_information,
4895         { "Flags", "pfcp.usage_information",
4896             FT_UINT8, BASE_HEX, NULL, 0x0,
4897             NULL, HFILL }
4898         },
4899         { &hf_pfcp_b0_bef,
4900         { "BEF (Before)", "pfcp.usage_information.bef",
4901             FT_BOOLEAN, 8, NULL, 0x01,
4902             NULL, HFILL }
4903         },
4904         { &hf_pfcp_b1_aft,
4905         { "AFT (After)", "pfcp.usage_information.aft",
4906             FT_BOOLEAN, 8, NULL, 0x02,
4907             NULL, HFILL }
4908         },
4909         { &hf_pfcp_b2_uae,
4910         { "UAE (Usage After Enforcement)", "pfcp.usage_information.uae",
4911             FT_BOOLEAN, 8, NULL, 0x04,
4912             NULL, HFILL }
4913         },
4914         { &hf_pfcp_b3_ube,
4915         { "UBE (Usage Before Enforcement)", "pfcp.usage_information.ube",
4916             FT_BOOLEAN, 8, NULL, 0x08,
4917             NULL, HFILL }
4918         },
4919         { &hf_pfcp_application_instance_id,
4920         { "Application Instance Identifier", "pfcp.application_instance_id",
4921             FT_BYTES, BASE_NONE, NULL, 0x0,
4922             NULL, HFILL }
4923         },
4924         { &hf_pfcp_flow_dir,
4925         { "Flow Direction", "pfcp.flow_dir",
4926             FT_UINT8, BASE_DEC, VALS(pfcp_flow_dir_vals), 0x07,
4927             NULL, HFILL }
4928         },
4929         { &hf_pfcp_packet_rate,
4930         { "Flags", "pfcp.packet_rate",
4931             FT_UINT8, BASE_HEX, NULL, 0x0,
4932             NULL, HFILL }
4933         },
4934         { &hf_pfcp_ulpr_b0,
4935         { "ULPR (Uplink Packet Rate)", "pfcp.packet_rate.ulpr",
4936             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4937             NULL, HFILL }
4938         },
4939         { &hf_pfcp_dlpr_b1,
4940         { "DLPR (Downlink Packet Rate)", "pfcp.packet_rate.dlpr",
4941             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4942             NULL, HFILL }
4943         },
4944         { &hf_pfcp_ul_time_unit,
4945         { "Uplink Time Unit", "pfcp.ul_time_unit",
4946             FT_UINT8, BASE_DEC, VALS(pfcp_pr_time_unit_vals), 0x07,
4947             NULL, HFILL }
4948         },
4949         { &hf_pfcp_max_ul_pr,
4950         { "Maximum Uplink Packet Rate", "pfcp.max_ul_pr",
4951             FT_UINT16, BASE_DEC, NULL, 0x0,
4952             NULL, HFILL }
4953         },
4954         { &hf_pfcp_dl_time_unit,
4955         { "Downlink Time Unit", "pfcp.dl_time_unit",
4956             FT_UINT8, BASE_DEC, VALS(pfcp_pr_time_unit_vals), 0x07,
4957             NULL, HFILL }
4958         },
4959         { &hf_pfcp_max_dl_pr,
4960         { "Maximum Downlink Packet Rate", "pfcp.max_dl_pr",
4961             FT_UINT16, BASE_DEC, NULL, 0x0,
4962             NULL, HFILL }
4963         },
4964         { &hf_pfcp_dl_flow_level_marking,
4965         { "Flags", "pfcp.dl_flow_level_marking",
4966             FT_UINT8, BASE_HEX, NULL, 0x0,
4967             NULL, HFILL }
4968         },
4969         { &hf_pfcp_b0_ttc,
4970         { "TTC (ToS/Traffic Class)", "pfcp.dl_flow_level_marking.ttc",
4971             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
4972             NULL, HFILL }
4973         },
4974         { &hf_pfcp_b1_sci,
4975         { "SCI(Service Class Indicator)", "pfcp.dl_flow_level_marking.sci",
4976             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
4977             NULL, HFILL }
4978         },
4979         { &hf_pfcp_sci,
4980         { "Service Class Indicator", "pfcp.sci",
4981             FT_UINT16, BASE_HEX, NULL, 0x0,
4982             NULL, HFILL }
4983         },
4984         { &hf_pfcp_dl_data_notification_delay,
4985         { "Delay Value", "pfcp.dl_data_notification_delay",
4986             FT_UINT8, BASE_DEC, NULL, 0x0,
4987             "Delay Value in integer multiples of 50 millisecs, or zero", HFILL }
4988         },
4989         { &hf_pfcp_packet_count,
4990         { "Packet Count", "pfcp.packet_count",
4991             FT_UINT16, BASE_DEC, NULL, 0x0,
4992             NULL, HFILL }
4993         },
4994         { &hf_pfcp_pfcp_dl_data_service_inf_flags,
4995         { "Flags", "pfcp.dl_data_service_inf_flags",
4996             FT_UINT8, BASE_HEX, NULL, 0x0,
4997             NULL, HFILL }
4998         },
4999         { &hf_pfcp_b0_ppi,
5000         { "PPI(Paging Policy Indication)", "pfcp.dl_data_service_inf.ppi",
5001             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
5002             NULL, HFILL }
5003         },
5004         { &hf_pfcp_ppi,
5005         { "Paging Policy Indication", "pfcp.ppi",
5006             FT_UINT16, BASE_DEC, NULL, 0x7f,
5007             NULL, HFILL }
5008         },
5009         { &hf_pfcp_sxsmreq_flags,
5010         { "Flags", "pfcp.sxsmreq_flags",
5011             FT_UINT8, BASE_HEX, NULL, 0x0,
5012             NULL, HFILL }
5013         },
5014         { &hf_pfcp_b0_drobu,
5015         { "DROBU (Drop Buffered Packets)", "pfcp.sxsmreq_flags.drobu",
5016             FT_BOOLEAN, 8, NULL, 0x01,
5017             NULL, HFILL }
5018         },
5019         { &hf_pfcp_b1_sndem,
5020         { "SNDEM (Send End Marker Packets)", "pfcp.sxsmreq_flags.sndem",
5021             FT_BOOLEAN, 8, NULL, 0x02,
5022             NULL, HFILL }
5023         },
5024         { &hf_pfcp_b2_qaurr,
5025         { "QAURR (Query All URRs)", "pfcp.sxsmreq_flags.qaurr",
5026             FT_BOOLEAN, 8, NULL, 0x04,
5027             NULL, HFILL }
5028         },
5029         { &hf_pfcp_sxsrrsp_flags,
5030         { "Flags", "pfcp.sxsrrsp_flags",
5031             FT_UINT8, BASE_HEX, NULL, 0x0,
5032             NULL, HFILL }
5033         },
5034         { &hf_pfcp_pfd_contents_flags,
5035         { "Flags", "pfcp.pfd_contents_flags",
5036             FT_UINT8, BASE_HEX, NULL, 0x0,
5037             NULL, HFILL }
5038         },
5039         { &hf_pfcp_b0_fd,
5040         { "FD (Flow Description)", "pfcp.pfd_contents_flags.fd",
5041             FT_BOOLEAN, 8, NULL, 0x01,
5042             NULL, HFILL }
5043         },
5044         { &hf_pfcp_b1_url,
5045         { "URL (URL)", "pfcp.pfd_contents_flags.url",
5046             FT_BOOLEAN, 8, NULL, 0x02,
5047             NULL, HFILL }
5048         },
5049         { &hf_pfcp_b2_dn,
5050         { "DN (Domain Name)", "pfcp.pfd_contents_flags.dn",
5051             FT_BOOLEAN, 8, NULL, 0x04,
5052             NULL, HFILL }
5053         },
5054         { &hf_pfcp_b3_cp,
5055         { "CP (Custom PFD Content)", "pfcp.pfd_contents_flags.cp",
5056             FT_BOOLEAN, 8, NULL, 0x08,
5057             NULL, HFILL }
5058         },
5059         { &hf_pfcp_url_len,
5060         { "Length of URL", "pfcp.url_len",
5061             FT_UINT16, BASE_DEC, NULL, 0x0,
5062             NULL, HFILL }
5063         },
5064         { &hf_pfcp_url,
5065         { "URL", "pfcp.url",
5066             FT_BYTES, BASE_NONE, NULL, 0x0,
5067             NULL, HFILL }
5068         },
5069         { &hf_pfcp_dn_len,
5070         { "Length of Domain Name", "pfcp.dn_len",
5071             FT_UINT16, BASE_DEC, NULL, 0x0,
5072             NULL, HFILL }
5073         },
5074         { &hf_pfcp_dn,
5075         { "Domain Name", "pfcp.dn",
5076             FT_BYTES, BASE_NONE, NULL, 0x0,
5077             NULL, HFILL }
5078         },
5079         { &hf_pfcp_cp_len,
5080         { "Length of Custom PFD Content", "pfcp.cp_len",
5081             FT_UINT16, BASE_DEC, NULL, 0x0,
5082             NULL, HFILL }
5083         },
5084         { &hf_pfcp_cp,
5085         { "Custom PFD Content", "pfcp.cp",
5086             FT_BYTES, BASE_NONE, NULL, 0x0,
5087             NULL, HFILL }
5088         },
5089         { &hf_pfcp_header_type,
5090         { "Header Type", "pfcp.header_type",
5091             FT_UINT8, BASE_DEC, VALS(pfcp_header_type_vals), 0x1f,
5092             NULL, HFILL }
5093         },
5094         { &hf_pfcp_hf_len,
5095         { "Length of Header Field Name", "pfcp.hf_len",
5096             FT_UINT8, BASE_DEC, NULL, 0x0,
5097             NULL, HFILL }
5098         },
5099         { &hf_pfcp_hf_name,
5100         { "Header Field Name", "pfcp.hf_name",
5101             FT_BYTES, BASE_NONE, NULL, 0x0,
5102             NULL, HFILL }
5103         },
5104         { &hf_pfcp_hf_val_len,
5105         { "Length of Header Field Value", "pfcp.hf_val_len",
5106             FT_UINT8, BASE_DEC, NULL, 0x0,
5107             NULL, HFILL }
5108         },
5109         { &hf_pfcp_hf_val,
5110         { "Header Field Value", "pfcp.hf_val",
5111             FT_BYTES, BASE_NONE, NULL, 0x0,
5112             NULL, HFILL }
5113         },
5114         { &hf_pfcp_measurement_info,
5115         { "Flags", "pfcp.measurement_info",
5116             FT_UINT8, BASE_HEX, NULL, 0x0,
5117             NULL, HFILL }
5118         },
5119         { &hf_pfcp_b0_mbqe,
5120         { "MBQE (Measurement Before QoS Enforcement)", "pfcp.measurement_info.fd",
5121             FT_BOOLEAN, 8, NULL, 0x01,
5122             NULL, HFILL }
5123         },
5124         { &hf_pfcp_b1_inam,
5125         { "INAM (Inactive Measurement)", "pfcp.measurement_info.inam",
5126             FT_BOOLEAN, 8, NULL, 0x02,
5127             NULL, HFILL }
5128         },
5129         { &hf_pfcp_node_report_type,
5130         { "Flags", "pfcp.node_report_type",
5131             FT_UINT8, BASE_HEX, NULL, 0x0,
5132             NULL, HFILL }
5133         },
5134         { &hf_pfcp_b0_upfr,
5135         { "UPFR (User Plane Path Failure Report)", "pfcp.node_report_type.upfr",
5136             FT_BOOLEAN, 8, NULL, 0x01,
5137             NULL, HFILL }
5138         },
5139         { &hf_pfcp_remote_gtp_u_peer,
5140         { "Flags", "pfcp.remote_gtp_u_peer",
5141             FT_UINT8, BASE_HEX, NULL, 0x0,
5142             NULL, HFILL }
5143         },
5144         { &hf_pfcp_gtp_u_peer_flag_b0_v6,
5145         { "V6 (IPv6)", "pfcp.gtp_u_peer_flag.v6",
5146             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
5147             NULL, HFILL }
5148         },
5149         { &hf_pfcp_gtp_u_peer_flag_b1_v4,
5150         { "V4 (IPv4)", "pfcp.gtp_u_peer_flag.v4",
5151             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
5152             NULL, HFILL }
5153         },
5154         { &hf_pfcp_remote_gtp_u_peer_ipv4,
5155         { "IPv4 address", "pfcp.node_id_ipv4",
5156             FT_IPv4, BASE_NONE, NULL, 0x0,
5157             NULL, HFILL }
5158         },
5159         { &hf_pfcp_remote_gtp_u_peer_ipv6,
5160         { "IPv6 address", "pfcp.node_id_ipv6",
5161             FT_IPv6, BASE_NONE, NULL, 0x0,
5162             NULL, HFILL }
5163         },
5164         { &hf_pfcp_ur_seqn,
5165         { "UR-SEQN", "pfcp.ur_seqn",
5166             FT_UINT32, BASE_DEC, NULL, 0x0,
5167             NULL, HFILL }
5168         },
5169         { &hf_pfcp_oci_flags,
5170         { "Flags", "pfcp.oci_flags",
5171             FT_UINT8, BASE_HEX, NULL, 0x0,
5172             NULL, HFILL }
5173         },
5174         { &hf_pfcp_b0_aoci,
5175         { "AOCI: Associate OCI with Node ID", "pfcp.oci_flags.aoci",
5176             FT_BOOLEAN, 8, NULL, 0x01,
5177             NULL, HFILL }
5178         },
5179         { &hf_pfcp_sx_assoc_rel_req_flags,
5180         { "Flags", "pfcp.sx_assoc_rel_req",
5181             FT_UINT8, BASE_HEX, NULL, 0x0,
5182             NULL, HFILL }
5183         },
5184         { &hf_pfcp_b0_sarr,
5185         { "SARR (Sx Association Release Request)", "pfcp.sx_assoc_rel_req.sarr",
5186             FT_BOOLEAN, 8, NULL, 0x01,
5187             NULL, HFILL }
5188         },
5189         { &hf_pfcp_upiri_flags,
5190         { "Flags", "pfcp.upiri_flags",
5191             FT_UINT8, BASE_HEX, NULL, 0x0,
5192             NULL, HFILL }
5193         },
5194         { &hf_pfcp_upiri_flg_b5_assoni,
5195         { "ASSONI (Associated Network Instance)", "pfcp.upiri_flags.assoni",
5196             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x20,
5197             NULL, HFILL }
5198         },
5199         { &hf_pfcp_upiri_flg_b1_v6,
5200         { "V6 (IPv6)", "pfcp.upiri_flags.v6",
5201             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x02,
5202             NULL, HFILL }
5203         },
5204         { &hf_pfcp_upiri_flg_b0_v4,
5205         { "V4 (IPv4)", "pfcp.upiri_flags.v4",
5206             FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01,
5207             NULL, HFILL }
5208         },
5209         { &hf_pfcp_upiri_teidri,
5210         { "TEID Range Indication", "pfcp.upiri.teidri",
5211             FT_UINT8, BASE_DEC, NULL, 0x1C,
5212             NULL, HFILL }
5213         },
5214         { &hf_pfcp_upiri_teid_range,
5215         { "TEID", "pfcp.upiri.teid_range",
5216             FT_UINT32, BASE_HEX, NULL, 0x0,
5217             NULL, HFILL }
5218         },
5219         { &hf_pfcp_upiri_ipv4,
5220         { "IPv4 address", "pfcp.upiri.ipv4_addr",
5221             FT_IPv4, BASE_NONE, NULL, 0x0,
5222             NULL, HFILL }
5223         },
5224         { &hf_pfcp_upiri_ipv6,
5225         { "IPv6 address", "pfcp.upiri.ipv6_addr",
5226             FT_IPv6, BASE_NONE, NULL, 0x0,
5227             NULL, HFILL }
5228         },
5229         { &hf_pfcp_upiri_network_instance,
5230         { "Network Instance", "pfcp.upiri.network_instance",
5231             FT_BYTES, BASE_NONE, NULL, 0x0,
5232             NULL, HFILL }
5233         },
5234         { &hf_pfcp_user_plane_inactivity_timer,
5235         { "User Plane Inactivity Timer", "pfcp.user_plane_inactivity_time",
5236             FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0,
5237             NULL, HFILL }
5238         },
5239
5240     };
5241
5242     /* Setup protocol subtree array */
5243 #define NUM_INDIVIDUAL_ELEMS_PFCP    33
5244     gint *ett[NUM_INDIVIDUAL_ELEMS_PFCP +
5245         (NUM_PFCP_IES - 1)];
5246
5247     ett[0] = &ett_pfcp;
5248     ett[1] = &ett_pfcp_flags;
5249     ett[2] = &ett_pfcp_ie;
5250     ett[3] = &ett_pfcp_grouped_ie;
5251     ett[4] = &ett_pfcp_f_seid_flags;
5252     ett[5] = &ett_f_teid_flags;
5253     ett[6] = &ett_pfcp_ue_ip_address_flags;
5254     ett[7] = &ett_pfcp_sdf_filter_flags;
5255     ett[8] = &ett_pfcp_apply_action_flags;
5256     ett[9] = &ett_pfcp_measurement_method_flags;
5257     ett[10] = &ett_pfcp_reporting_triggers;
5258     ett[11] = &ett_pfcp_volume_threshold;
5259     ett[12] = &ett_pfcp_volume_quota;
5260     ett[13] = &ett_pfcp_subseq_volume_threshold;
5261     ett[14] = &ett_pfcp_dropped_dl_traffic_threshold;
5262     ett[15] = &ett_pfcp_gate_status;
5263     ett[16] = &ett_pfcp_report_type;
5264     ett[17] = &ett_pfcp_up_function_features;
5265     ett[18] = &ett_pfcp_report_trigger;
5266     ett[19] = &ett_pfcp_volume_measurement;
5267     ett[20] = &ett_pfcp_cp_function_features;
5268     ett[21] = &ett_pfcp_usage_information;
5269     ett[22] = &ett_pfcp_packet_rate;
5270     ett[23] = &ett_pfcp_pfcp_dl_flow_level_marking;
5271     ett[24] = &ett_pfcp_dl_data_service_inf;
5272     ett[25] = &ett_pfcp_sxsmreq;
5273     ett[26] = &ett_pfcp_sxsrrsp;
5274     ett[27] = &ett_pfcp_measurement_info;
5275     ett[28] = &ett_pfcp_node_report_type;
5276     ett[29] = &ett_pfcp_remote_gtp_u_peer;
5277     ett[30] = &ett_pfcp_oci_flags;
5278     ett[31] = &ett_sx_assoc_rel_req_flags;
5279     ett[32] = &ett_pfcp_upiri_flags;
5280
5281
5282     static ei_register_info ei[] = {
5283         { &ei_pfcp_ie_reserved,{ "pfcp.ie_id_reserved", PI_PROTOCOL, PI_ERROR, "Reserved IE value used", EXPFILL } },
5284         { &ei_pfcp_ie_data_not_decoded,{ "pfcp.ie_data_not_decoded", PI_UNDECODED, PI_NOTE, "IE data not decoded by WS yet", EXPFILL } },
5285         { &ei_pfcp_ie_not_decoded_null,{ "pfcp.ie_not_decoded_null", PI_UNDECODED, PI_NOTE, "IE not decoded yet(WS:no decoding function(NULL))", EXPFILL } },
5286         { &ei_pfcp_ie_not_decoded_to_large,{ "pfcp.ie_not_decoded", PI_UNDECODED, PI_NOTE, "IE not decoded yet(WS:IE id to large)", EXPFILL } },
5287         { &ei_pfcp_enterprise_ie_3gpp,{ "pfcp.ie_enterprise_3gpp", PI_PROTOCOL, PI_ERROR, "IE not decoded yet(WS:No vendor dissector)", EXPFILL } },
5288         { &ei_pfcp_ie_encoding_error,{ "pfcp.ie_encoding_error", PI_PROTOCOL, PI_ERROR, "IE wrongly encoded)", EXPFILL } },
5289     };
5290
5291     expert_module_t* expert_pfcp;
5292
5293     guint last_index = NUM_INDIVIDUAL_ELEMS_PFCP, i;
5294
5295     for (i = 0; i < (NUM_PFCP_IES-1); i++, last_index++)
5296     {
5297         ett_pfcp_elem[i] = -1;
5298         ett[last_index] = &ett_pfcp_elem[i];
5299     }
5300     proto_pfcp = proto_register_protocol("Packet Forwarding Control Protocol", "PFCP", "pfcp");
5301     pfcp_handle = register_dissector("pfcp", dissect_pfcp, proto_pfcp);
5302
5303     proto_register_field_array(proto_pfcp, hf_pfcp, array_length(hf_pfcp));
5304     proto_register_subtree_array(ett, array_length(ett));
5305     expert_pfcp = expert_register_protocol(proto_pfcp);
5306     expert_register_field_array(expert_pfcp, ei, array_length(ei));
5307
5308     /* Register dissector table for enterprise IE dissectors */
5309     pfcp_enterprise_ies_dissector_table = register_dissector_table("pfcp.enterprise_ies", "PFCP Enterprice IEs",
5310         proto_pfcp, FT_UINT32, BASE_DEC);
5311
5312     pfcp_3gpp_ies_handle = register_dissector("pfcp_3gpp_ies", dissect_pfcp_3gpp_enterprise_ies, proto_pfcp);
5313
5314
5315 }
5316
5317 void
5318 proto_reg_handoff_pfcp(void)
5319 {
5320     dissector_add_uint_with_preference("udp.port", UDP_PORT_PFCP, pfcp_handle);
5321     /* Register 3GPP in the table to give expert info and serve as an example how to add decoding of enterprise IEs*/
5322     dissector_add_uint("pfcp.enterprise_ies", VENDOR_THE3GPP, pfcp_3gpp_ies_handle);
5323
5324
5325 }
5326
5327 /*
5328 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
5329 *
5330 * Local variables:
5331 * c-basic-offset: 4
5332 * tab-width: 8
5333 * indent-tabs-mode: nil
5334 * End:
5335 *
5336 * vi: set shiftwidth=4 tabstop=8 expandtab:
5337 * :indentSize=4:tabSize=8:noTabs=true:
5338 */