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