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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 #ifndef __included_vnet_flow_report_h__
16 #define __included_vnet_flow_report_h__
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/ip/udp.h>
28 #include <vppinfra/error.h>
29 #include <vppinfra/hash.h>
30 #include <vppinfra/cache.h>
32 #include <vnet/flow/ipfix_packet.h>
34 /* Used to build the rewrite */
38 ipfix_template_packet_t ipfix;
39 } ip4_ipfix_template_packet_t;
41 struct flow_report_main;
44 typedef u8 * (vnet_flow_rewrite_callback_t)(struct flow_report_main *,
49 typedef vlib_frame_t * (vnet_flow_data_callback_t) (struct flow_report_main *,
51 vlib_frame_t *, u32 *,
53 typedef struct flow_report {
54 /* ipfix rewrite, set by callback */
58 f64 last_template_sent;
61 /* Bitmap of fields to send */
62 uword * fields_to_send;
67 /* build-the-rewrite callback */
68 vnet_flow_rewrite_callback_t *rewrite_callback;
70 /* Send-flow-data callback */
71 vnet_flow_data_callback_t *flow_data_callback;
74 typedef struct flow_report_main {
75 flow_report_t * reports;
77 /* ipfix collector, our ip address */
78 ip4_address_t ipfix_collector;
79 ip4_address_t src_address;
81 /* time scale transform. Joy. */
85 /* convenience variables */
86 vlib_main_t * vlib_main;
87 vnet_main_t * vnet_main;
90 flow_report_main_t flow_report_main;
92 vlib_node_registration_t flow_report_process_node;
94 int vnet_flow_report_enable_disable (u32 sw_if_index, u32 table_index,
97 vnet_flow_data_callback_t *flow_data_callback;
98 vnet_flow_rewrite_callback_t *rewrite_callback;
102 } vnet_flow_report_add_del_args_t;
104 int vnet_flow_report_add_del (flow_report_main_t *frm,
105 vnet_flow_report_add_del_args_t *a);
107 #endif /* __included_vnet_flow_report_h__ */