netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / lib / netflow.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef NETFLOW_H
18 #define NETFLOW_H 1
19
20 /* NetFlow v5 protocol definitions. */
21
22 #include <stdint.h>
23 #include "openvswitch/types.h"
24 #include "util.h"
25
26 #define NETFLOW_V5_VERSION 5
27
28 /* Every NetFlow v5 message contains the header that follows.  This is
29  * followed by up to thirty records that describe a terminating flow.
30  * We only send a single record per NetFlow message.
31  */
32 struct netflow_v5_header {
33     ovs_be16 version;              /* NetFlow version is 5. */
34     ovs_be16 count;                /* Number of records in this message. */
35     ovs_be32 sysuptime;            /* System uptime in milliseconds. */
36     ovs_be32 unix_secs;            /* Number of seconds since Unix epoch. */
37     ovs_be32 unix_nsecs;           /* Number of residual nanoseconds
38                                       after epoch seconds. */
39     ovs_be32 flow_seq;             /* Number of flows since sending
40                                       messages began. */
41     uint8_t  engine_type;          /* Engine type. */
42     uint8_t  engine_id;            /* Engine id. */
43     ovs_be16 sampling_interval;    /* Set to zero. */
44 };
45 BUILD_ASSERT_DECL(sizeof(struct netflow_v5_header) == 24);
46
47 /* A NetFlow v5 description of a terminating flow.  It is preceded by a
48  * NetFlow v5 header.
49  */
50 struct netflow_v5_record {
51     ovs_be32 src_addr;             /* Source IP address. */
52     ovs_be32 dst_addr;             /* Destination IP address. */
53     ovs_be32 nexthop;              /* IP address of next hop.  Set to 0. */
54     ovs_be16 input;                /* Input interface index. */
55     ovs_be16 output;               /* Output interface index. */
56     ovs_be32 packet_count;         /* Number of packets. */
57     ovs_be32 byte_count;           /* Number of bytes. */
58     ovs_be32 init_time;            /* Value of sysuptime on first packet. */
59     ovs_be32 used_time;            /* Value of sysuptime on last packet. */
60
61     /* The 'src_port' and 'dst_port' identify the source and destination
62      * port, respectively, for TCP and UDP.  For ICMP, the high-order
63      * byte identifies the type and low-order byte identifies the code
64      * in the 'dst_port' field. */
65     ovs_be16 src_port;
66     ovs_be16 dst_port;
67
68     uint8_t  pad1;
69     uint8_t  tcp_flags;            /* Union of seen TCP flags. */
70     uint8_t  ip_proto;             /* IP protocol. */
71     uint8_t  ip_tos;               /* IP TOS value. */
72     ovs_be16 src_as;               /* Source AS ID.  Set to 0. */
73     ovs_be16 dst_as;               /* Destination AS ID.  Set to 0. */
74     uint8_t  src_mask;             /* Source mask bits.  Set to 0. */
75     uint8_t  dst_mask;             /* Destination mask bits.  Set to 0. */
76     uint8_t  pad[2];
77 };
78 BUILD_ASSERT_DECL(sizeof(struct netflow_v5_record) == 48);
79
80 #endif /* lib/netflow.h */