Initial import
[sliver-openvswitch.git] / include / flow.h
1 #ifndef FLOW_H
2 #define FLOW_H 1
3
4 #include <stdint.h>
5 #include "util.h"
6
7 struct buffer;
8
9 /* Identification data for a flow.
10    All fields are in network byte order.
11    In decreasing order by size, so that flow structures can be hashed or
12    compared bytewise. */
13 struct flow {
14     uint32_t nw_src;            /* IP source address. */
15     uint32_t nw_dst;            /* IP destination address. */
16     uint16_t in_port;           /* Input switch port. */
17     uint16_t dl_vlan;           /* Input VLAN. */
18     uint16_t dl_type;           /* Ethernet frame type. */
19     uint16_t tp_src;            /* TCP/UDP source port. */
20     uint16_t tp_dst;            /* TCP/UDP destination port. */
21     uint8_t dl_src[6];          /* Ethernet source address. */
22     uint8_t dl_dst[6];          /* Ethernet destination address. */
23     uint8_t nw_proto;           /* IP protocol. */
24     uint8_t reserved;           /* One byte of padding. */
25 };
26 BUILD_ASSERT_DECL(sizeof (struct flow) == 32);
27
28 void flow_extract(const struct buffer *, uint16_t in_port, struct flow *);
29 void flow_print(FILE *, const struct flow *);
30 int flow_compare(const struct flow *, const struct flow *);
31 unsigned long int flow_hash(const struct flow *, uint32_t basis);
32
33 #endif /* flow.h */