FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
flow_report.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __included_vnet_flow_report_h__
16 #define __included_vnet_flow_report_h__
17 
18 #include <vlib/vlib.h>
19 #include <vnet/vnet.h>
20 #include <vnet/ethernet/ethernet.h>
21 #include <vnet/ethernet/packet.h>
22 #include <vnet/ip/ip_packet.h>
23 #include <vnet/ip/ip4_packet.h>
24 #include <vnet/ip/ip6_packet.h>
25 #include <vnet/udp/udp_packet.h>
26 #include <vlib/cli.h>
27 #include <vppinfra/error.h>
28 #include <vppinfra/hash.h>
29 #include <vppinfra/cache.h>
30 
32 
33 /* ipfix field definitions for a particular report */
34 typedef struct
35 {
39 
40 /* Used to build the rewrite */
41 typedef struct
42 {
47 
48 struct flow_report_main;
49 struct flow_report;
50 
52  struct flow_report *,
53  vlib_frame_t *, u32 *,
54  u32);
55 
57  struct flow_report *,
58  ip4_address_t *,
59  ip4_address_t *, u16,
61  u32 n_elts, u32 * stream_index);
62 
64  struct flow_report *,
65  ip4_address_t *,
66  ip4_address_t *, u16,
68  u32 n_elts, u32 * stream_index);
69 
70 typedef union
71 {
72  void *as_ptr;
74 } opaque_t;
75 
76 typedef struct
77 {
84 
85 typedef struct flow_report
86 {
87  /* ipfix rewrite, set by callback */
93 
94  /* Bitmap of fields to send */
96 
97  /* Opaque data */
99 
100  /* build-the-template-packet rewrite callback */
105 
106  /* Send-flow-data callback */
108 } flow_report_t;
109 
110 typedef struct flow_report_main
111 {
114 
115  /* ipfix collector ip address, port, our ip address, fib index */
120 
121  /* Path MTU */
123 
124  /* time interval in seconds after which to resend templates */
126 
127  /* UDP checksum calculation enable flag */
129 
130  /* time scale transform. Joy. */
133 
134  /* convenience variables */
137 
140 
142 
144 
146  int enable_disable);
147 typedef struct
148 {
154  int is_add;
159 
162  u16 * template_id);
163 
165 
167 
168 void vnet_stream_reset (flow_report_main_t * frm, u32 stream_index);
169 
171  u32 old_domain_id, u16 old_src_port,
172  u32 new_domain_id, u16 new_src_port);
173 
174 #endif /* __included_vnet_flow_report_h__ */
175 
176 /*
177  * fd.io coding-style-patch-verification: ON
178  *
179  * Local Variables:
180  * eval: (c-set-style "gnu")
181  * End:
182  */
vlib.h
vnet_flow_report_add_del_args_t::domain_id
u32 domain_id
Definition: flow_report.h:155
flow_report_stream_t::sequence_number
u32 sequence_number
Definition: flow_report.h:79
vnet_flow_report_add_del_args_t::report_elements
ipfix_report_element_t * report_elements
Definition: flow_report.h:151
flow_report_main::udp_checksum
u8 udp_checksum
Definition: flow_report.h:128
flow_report_stream_t::n_reports
u16 n_reports
Definition: flow_report.h:81
flow_report_main::vlib_main
vlib_main_t * vlib_main
Definition: flow_report.h:135
flow_report_t
struct flow_report flow_report_t
flow_report::stream_index
u32 stream_index
Definition: flow_report.h:90
opaque_t::as_uword
uword as_uword
Definition: flow_report.h:73
flow_report_stream_t::domain_id
u32 domain_id
Definition: flow_report.h:78
vnet_flow_report_add_del_args_t::n_report_elements
u32 n_report_elements
Definition: flow_report.h:152
flow_report
Definition: flow_report.h:85
u16
unsigned short u16
Definition: types.h:57
flow_report::stream_indexp
u32 * stream_indexp
Definition: flow_report.h:104
flow_report_main::template_interval
u32 template_interval
Definition: flow_report.h:125
ip_packet.h
vnet_flow_rewrite_callback_t
u8 *() vnet_flow_rewrite_callback_t(struct flow_report_main *, struct flow_report *, ip4_address_t *, ip4_address_t *, u16, ipfix_report_element_t *elts, u32 n_elts, u32 *stream_index)
Definition: flow_report.h:56
flow_report_main::fib_index
u32 fib_index
Definition: flow_report.h:119
vlib_frame_t
Definition: node.h:372
udp_header_t
Definition: udp_packet.h:45
ip4_header_t
Definition: ip4_packet.h:87
ethernet.h
error
Definition: cJSON.c:88
ip4_ipfix_template_packet_t
Definition: flow_report.h:41
ip6_packet.h
vnet_flow_reports_reset
void vnet_flow_reports_reset(flow_report_main_t *frm)
Definition: flow_report.c:445
flow_report::last_template_sent
f64 last_template_sent
Definition: flow_report.h:91
vnet_flow_report_add_del_args_t::opaque
opaque_t opaque
Definition: flow_report.h:153
ip4_ipfix_template_packet_t::udp
udp_header_t udp
Definition: flow_report.h:44
hash.h
packet.h
error.h
flow_report_stream_t::src_port
u16 src_port
Definition: flow_report.h:80
vnet_stream_change
int vnet_stream_change(flow_report_main_t *frm, u32 old_domain_id, u16 old_src_port, u32 new_domain_id, u16 new_src_port)
Definition: flow_report.c:477
vnet_flow_report_add_del_args_t::src_port
u16 src_port
Definition: flow_report.h:156
flow_report_main::ipfix_collector
ip4_address_t ipfix_collector
Definition: flow_report.h:116
vnet_flow_data_callback_t
vlib_frame_t *() vnet_flow_data_callback_t(struct flow_report_main *, struct flow_report *, vlib_frame_t *, u32 *, u32)
Definition: flow_report.h:51
ipfix_packet.h
udp_packet.h
uword
u64 uword
Definition: types.h:112
ipfix_report_element_t
Definition: flow_report.h:34
vnet_flow_report_add_del_args_t::stream_indexp
u32 * stream_indexp
Definition: flow_report.h:157
flow_report_main::msg_id_base
u16 msg_id_base
Definition: flow_report.h:138
opaque_t
Definition: flow_report.h:70
vnet_flow_report_add_del_args_t::flow_data_callback
vnet_flow_data_callback_t * flow_data_callback
Definition: flow_report.h:149
f64
double f64
Definition: types.h:142
flow_report_main
Definition: flow_report.h:110
ip4_address_t
Definition: ip4_packet.h:50
flow_report_main::streams
flow_report_stream_t * streams
Definition: flow_report.h:113
vnet_stream_reset
void vnet_stream_reset(flow_report_main_t *frm, u32 stream_index)
Definition: flow_report.c:462
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
flow_report::update_rewrite
int update_rewrite
Definition: flow_report.h:92
flow_report_main::collector_port
u16 collector_port
Definition: flow_report.h:117
flow_report_main::path_mtu
u32 path_mtu
Definition: flow_report.h:122
ip4_packet.h
ipfix_report_element_t::info_element
u32 info_element
Definition: flow_report.h:36
vnet_main_t
Definition: vnet.h:76
flow_report_main
flow_report_main_t flow_report_main
Definition: flow_report.c:22
flow_report_main::src_address
ip4_address_t src_address
Definition: flow_report.h:118
vnet_flow_report_enable_disable
int vnet_flow_report_enable_disable(u32 sw_if_index, u32 table_index, int enable_disable)
ip4_ipfix_template_packet_t::ip4
ip4_header_t ip4
Definition: flow_report.h:43
flow_report::template_id
u16 template_id
Definition: flow_report.h:89
opaque_t::as_ptr
void * as_ptr
Definition: flow_report.h:72
cache.h
flow_report::rewrite_callback
vnet_flow_rewrite_callback_t * rewrite_callback
Definition: flow_report.h:101
flow_report_process_node
vlib_node_registration_t flow_report_process_node
(constructor) VLIB_REGISTER_NODE (flow_report_process_node)
Definition: flow_report.c:336
ipfix_template_packet_t
Definition: ipfix_packet.h:190
u32
unsigned int u32
Definition: types.h:88
flow_report_stream_t
Definition: flow_report.h:76
vnet_flow_report_add_del_args_t
Definition: flow_report.h:147
ipfix_report_element_t::size
u32 size
Definition: flow_report.h:37
cli.h
flow_report_main::unix_time_0
u32 unix_time_0
Definition: flow_report.h:131
flow_report::fields_to_send
uword * fields_to_send
Definition: flow_report.h:95
flow_report::report_elements
ipfix_report_element_t * report_elements
Definition: flow_report.h:102
vlib_main_t
Definition: main.h:102
flow_report_add_del_error_to_clib_error
clib_error_t * flow_report_add_del_error_to_clib_error(int error)
Definition: flow_report.c:424
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
a
a
Definition: bitmap.h:525
vnet_flow_report_add_del
int vnet_flow_report_add_del(flow_report_main_t *frm, vnet_flow_report_add_del_args_t *a, u16 *template_id)
Definition: flow_report.c:344
flow_report_main::reports
flow_report_t * reports
Definition: flow_report.h:112
flow_report_main_t
struct flow_report_main flow_report_main_t
flow_report_main::vnet_main
vnet_main_t * vnet_main
Definition: flow_report.h:136
flow_report_main::vlib_time_0
f64 vlib_time_0
Definition: flow_report.h:132
flow_report::n_report_elements
u32 n_report_elements
Definition: flow_report.h:103
vnet.h
vnet_flow_rewrite_generic_callback
u8 * vnet_flow_rewrite_generic_callback(struct flow_report_main *, struct flow_report *, ip4_address_t *, ip4_address_t *, u16, ipfix_report_element_t *elts, u32 n_elts, u32 *stream_index)
Definition: flow_report.c:166
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
flow_report::rewrite
u8 * rewrite
Definition: flow_report.h:88
flow_report::flow_data_callback
vnet_flow_data_callback_t * flow_data_callback
Definition: flow_report.h:107
vnet_flow_report_add_del_args_t::rewrite_callback
vnet_flow_rewrite_callback_t * rewrite_callback
Definition: flow_report.h:150
flow_report::opaque
opaque_t opaque
Definition: flow_report.h:98
vnet_flow_report_add_del_args_t::is_add
int is_add
Definition: flow_report.h:154
ip4_ipfix_template_packet_t::ipfix
ipfix_template_packet_t ipfix
Definition: flow_report.h:45
flow_report_stream_t::next_template_no
u16 next_template_no
Definition: flow_report.h:82