20f6939dda59e989501f1cd6baac5c4de80a7acd
[vpp.git] / plugins / flowperpkt-plugin / flowperpkt / flowperpkt.h
1 /*
2  * flowperpkt.h - skeleton vpp engine plug-in header file
3  *
4  * Copyright (c) <current-year> <your-organization>
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef __included_flowperpkt_h__
18 #define __included_flowperpkt_h__
19
20 #include <vnet/vnet.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/ethernet/ethernet.h>
23
24 #include <vppinfra/hash.h>
25 #include <vppinfra/error.h>
26 #include <vnet/flow/flow_report.h>
27 #include <vnet/flow/flow_report_classify.h>
28
29 /**
30  * @file
31  * @brief flow-per-packet plugin header file
32  */
33 typedef struct
34 {
35   /** API message ID base */
36   u16 msg_id_base;
37
38   /** Have the reports [templates] been created? */
39   int ipv4_report_created;
40   int l2_report_created;
41
42   /** stream/template IDs */
43   u16 ipv4_report_id;
44   u16 l2_report_id;
45
46   /** ipfix buffers under construction, per-worker thread */
47   vlib_buffer_t **ipv4_buffers_per_worker;
48   vlib_buffer_t **l2_buffers_per_worker;
49
50   /** frames containing ipfix buffers, per-worker thread */
51   vlib_frame_t **ipv4_frames_per_worker;
52   vlib_frame_t **l2_frames_per_worker;
53
54   /** next record offset, per worker thread */
55   u16 *ipv4_next_record_offset_per_worker;
56   u16 *l2_next_record_offset_per_worker;
57
58   /** Time reference pair */
59   u64 nanosecond_time_0;
60   f64 vlib_time_0;
61
62   /** convenience vlib_main_t pointer */
63   vlib_main_t *vlib_main;
64   /** convenience vnet_main_t pointer */
65   vnet_main_t *vnet_main;
66 } flowperpkt_main_t;
67
68 typedef enum
69 {
70   FLOW_VARIANT_IPV4,
71   FLOW_VARIANT_L2,
72   FLOW_N_VARIANTS,
73 } flowperpkt_variant_t;
74
75 extern flowperpkt_main_t flowperpkt_main;
76
77 extern vlib_node_registration_t flowperpkt_ipv4_node;
78
79 void flowperpkt_flush_callback_ipv4 (void);
80 void flowperpkt_flush_callback_l2 (void);
81
82 #endif /* __included_flowperpkt_h__ */
83
84 /*
85  * fd.io coding-style-patch-verification: ON
86  *
87  * Local Variables:
88  * eval: (c-set-style "gnu")
89  * End:
90  */