FD.io VPP  v18.10-34-gcce845e
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/pg/pg.h>
21 #include <vnet/ethernet/ethernet.h>
22 #include <vnet/ethernet/packet.h>
23 #include <vnet/ip/ip_packet.h>
24 #include <vnet/ip/ip4_packet.h>
25 #include <vnet/ip/ip6_packet.h>
26 #include <vnet/udp/udp.h>
27 #include <vlib/cli.h>
28 #include <vppinfra/error.h>
29 #include <vppinfra/hash.h>
30 #include <vppinfra/cache.h>
31 
33 
34 /* ipfix field definitions for a particular report */
35 typedef struct
36 {
40 
41 /* Used to build the rewrite */
42 typedef struct
43 {
48 
49 struct flow_report_main;
50 struct flow_report;
51 
52 typedef vlib_frame_t *(vnet_flow_data_callback_t) (struct flow_report_main *,
53  struct flow_report *,
54  vlib_frame_t *, u32 *,
55  u32);
56 
57 typedef u8 *(vnet_flow_rewrite_callback_t) (struct flow_report_main *,
58  struct flow_report *,
59  ip4_address_t *,
60  ip4_address_t *, u16,
62  u32 n_elts, u32 * stream_index);
63 
64 u8 *vnet_flow_rewrite_generic_callback (struct flow_report_main *,
65  struct flow_report *,
66  ip4_address_t *,
67  ip4_address_t *, u16,
69  u32 n_elts, u32 * stream_index);
70 
71 typedef union
72 {
73  void *as_ptr;
75 } opaque_t;
76 
77 typedef struct
78 {
85 
86 typedef struct flow_report
87 {
88  /* ipfix rewrite, set by callback */
94 
95  /* Bitmap of fields to send */
97 
98  /* Opaque data */
100 
101  /* build-the-template-packet rewrite callback */
106 
107  /* Send-flow-data callback */
109 } flow_report_t;
110 
111 typedef struct flow_report_main
112 {
115 
116  /* ipfix collector ip address, port, our ip address, fib index */
121 
122  /* Path MTU */
124 
125  /* time interval in seconds after which to resend templates */
127 
128  /* UDP checksum calculation enable flag */
130 
131  /* time scale transform. Joy. */
134 
135  /* convenience variables */
139 
141 
143 
145  int enable_disable);
146 typedef struct
147 {
153  int is_add;
158 
161  u16 * template_id);
162 
164 
166 
168 
170  u32 old_domain_id, u16 old_src_port,
171  u32 new_domain_id, u16 new_src_port);
172 
173 #endif /* __included_vnet_flow_report_h__ */
174 
175 /*
176  * fd.io coding-style-patch-verification: ON
177  *
178  * Local Variables:
179  * eval: (c-set-style "gnu")
180  * End:
181  */
flow_report_main_t flow_report_main
Definition: flow_report.c:21
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:470
a
Definition: bitmap.h:538
uword as_uword
Definition: flow_report.h:74
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:337
u32 stream_index
Definition: flow_report.h:91
clib_error_t * flow_report_add_del_error_to_clib_error(int error)
Definition: flow_report.c:417
opaque_t opaque
Definition: flow_report.h:99
ip4_address_t src_address
Definition: flow_report.h:119
uword * fields_to_send
Definition: flow_report.h:96
unsigned char u8
Definition: types.h:56
ip4_address_t ipfix_collector
Definition: flow_report.h:117
double f64
Definition: types.h:142
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:57
u32 n_report_elements
Definition: flow_report.h:104
flow_report_stream_t * streams
Definition: flow_report.h:114
void vnet_stream_reset(flow_report_main_t *frm, u32 stream_index)
Definition: flow_report.c:455
u32 sw_if_index
Definition: vxlan_gbp.api:39
vnet_flow_rewrite_callback_t * rewrite_callback
Definition: flow_report.h:149
unsigned int u32
Definition: types.h:88
vlib_frame_t *( vnet_flow_data_callback_t)(struct flow_report_main *, struct flow_report *, vlib_frame_t *, u32 *, u32)
Definition: flow_report.h:52
int vnet_flow_report_enable_disable(u32 sw_if_index, u32 table_index, int enable_disable)
flow_report_t * reports
Definition: flow_report.h:113
ipfix_report_element_t * report_elements
Definition: flow_report.h:150
u8 * rewrite
Definition: flow_report.h:89
unsigned short u16
Definition: types.h:57
vnet_main_t * vnet_main
Definition: flow_report.h:137
struct flow_report_main flow_report_main_t
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:171
void vnet_flow_reports_reset(flow_report_main_t *frm)
Definition: flow_report.c:438
vlib_main_t * vlib_main
Definition: flow_report.h:136
ipfix_report_element_t * report_elements
Definition: flow_report.h:103
u16 template_id
Definition: flow_report.h:90
u32 * stream_indexp
Definition: flow_report.h:105
vnet_flow_data_callback_t * flow_data_callback
Definition: flow_report.h:108
struct flow_report flow_report_t
struct _vlib_node_registration vlib_node_registration_t
int update_rewrite
Definition: flow_report.h:93
f64 last_template_sent
Definition: flow_report.h:92
ipfix_template_packet_t ipfix
Definition: flow_report.h:46
u64 uword
Definition: types.h:112
vnet_flow_data_callback_t * flow_data_callback
Definition: flow_report.h:148
vnet_flow_rewrite_callback_t * rewrite_callback
Definition: flow_report.h:102
vlib_node_registration_t flow_report_process_node
(constructor) VLIB_REGISTER_NODE (flow_report_process_node)
Definition: flow_report.c:329
void * as_ptr
Definition: flow_report.h:73