blob: 61d16949b9103815eac593021cbe5df95aa3d8cb [file] [log] [blame]
Dave Hudsondcd08fb2013-11-22 09:25:16 -06001/*
2 * sfe_ipv4.h
3 * Shortcut forwarding engine.
4 *
5 * XXX - fill in the appropriate GPL notice.
6 */
7
8/*
9 * IPv4 connection flags.
10 */
11#define SFE_IPV4_CREATE_FLAG_NO_SEQ_CHECK 0x1
12 /* Indicates that we should not check sequence numbers */
13
14/*
15 * IPv4 connection creation structure.
16 */
17struct sfe_ipv4_create {
18 int protocol;
19 struct net_device *src_dev;
20 struct net_device *dest_dev;
21 uint32_t flags;
22 uint32_t src_mtu;
23 uint32_t dest_mtu;
24 __be32 src_ip;
25 __be32 src_ip_xlate;
26 __be32 dest_ip;
27 __be32 dest_ip_xlate;
28 __be16 src_port;
29 __be16 src_port_xlate;
30 __be16 dest_port;
31 __be16 dest_port_xlate;
32 uint8_t src_mac[ETH_ALEN];
33 uint8_t src_mac_xlate[ETH_ALEN];
34 uint8_t dest_mac[ETH_ALEN];
35 uint8_t dest_mac_xlate[ETH_ALEN];
36 uint8_t src_td_window_scale;
37 uint32_t src_td_max_window;
38 uint32_t src_td_end;
39 uint32_t src_td_max_end;
40 uint8_t dest_td_window_scale;
41 uint32_t dest_td_max_window;
42 uint32_t dest_td_end;
43 uint32_t dest_td_max_end;
44};
45
46/*
47 * IPv4 connection destruction structure.
48 */
49struct sfe_ipv4_destroy {
50 int protocol;
51 __be32 src_ip;
52 __be32 dest_ip;
53 __be16 src_port;
54 __be16 dest_port;
55};
56
57/*
58 * Structure used to sync IPv4 connection stats/state back within the system.
59 *
60 * NOTE: The addresses here are NON-NAT addresses, i.e. the true endpoint addressing.
61 * 'src' is the creator of the connection.
62 */
63struct sfe_ipv4_sync {
64 int protocol; /* IP protocol number (IPPROTO_...) */
65 __be32 src_ip; /* Non-NAT source address, i.e. the creator of the connection */
66 __be16 src_port; /* Non-NAT source port */
67 __be32 dest_ip; /* Non-NAT destination address, i.e. to whom the connection was created */
68 __be16 dest_port; /* Non-NAT destination port */
69 uint32_t src_td_max_window;
70 uint32_t src_td_end;
71 uint32_t src_td_max_end;
72 uint64_t src_packet_count;
73 uint64_t src_byte_count;
74 uint32_t dest_td_max_window;
75 uint32_t dest_td_end;
76 uint32_t dest_td_max_end;
77 uint64_t dest_packet_count;
78 uint64_t dest_byte_count;
79 uint64_t delta_jiffies; /* Time to be added to the current timeout to keep the connection alive */
80};
81
82/*
83 * Type used for a sync rule callback.
84 */
85typedef void (*sfe_ipv4_sync_rule_callback_t)(struct sfe_ipv4_sync *);
86
87extern int sfe_ipv4_recv(struct net_device *dev, struct sk_buff *skb);
88extern void sfe_ipv4_create_rule(struct sfe_ipv4_create *sic);
89extern void sfe_ipv4_destroy_rule(struct sfe_ipv4_destroy *sid);
90extern void sfe_ipv4_destroy_all_rules_for_dev(struct net_device *dev);
91extern void sfe_ipv4_register_sync_rule_callback(sfe_ipv4_sync_rule_callback_t callback);
92