Commit | Line | Data |
---|---|---|
9d3a4132 SE |
1 | #ifndef netlink_h |
2 | #define netlink_h | |
3 | ||
7138d0c5 SE |
4 | #include "ipaddr.h" |
5 | ||
9d3a4132 SE |
6 | #define DEFAULT_BUFSIZE 2048 |
7 | #define DEFAULT_MTU 1000 | |
8 | #define ICMP_BUFSIZE 1024 | |
9 | ||
10 | struct netlink_client { | |
11 | struct subnet_list *networks; | |
12 | netlink_deliver_fn *deliver; | |
13 | void *dst; | |
14 | string_t name; | |
15 | uint32_t link_quality; | |
3454dce4 | 16 | uint32_t options; |
9d3a4132 SE |
17 | struct netlink_client *next; |
18 | }; | |
19 | ||
20 | struct netlink_route { | |
21 | struct subnet net; | |
22 | bool_t hard; | |
3454dce4 | 23 | bool_t allow_route; |
9d3a4132 SE |
24 | bool_t up; |
25 | bool_t kup; | |
042a8da9 | 26 | uint32_t quality; /* provided by client */ |
9d3a4132 SE |
27 | struct netlink_client *c; |
28 | }; | |
29 | ||
30 | typedef bool_t netlink_route_fn(void *cst, struct netlink_route *route); | |
31 | ||
32 | /* Netlink provides one function to the device driver, to call to deliver | |
33 | a packet from the device. The device driver provides one function to | |
34 | netlink, for it to call to deliver a packet to the device. */ | |
35 | ||
36 | struct netlink { | |
37 | closure_t cl; | |
38 | struct netlink_if ops; | |
39 | void *dst; /* Pointer to host interface state */ | |
40 | string_t name; | |
41 | uint32_t max_start_pad; | |
42 | uint32_t max_end_pad; | |
43 | struct subnet_list networks; | |
44 | struct subnet_list exclude_remote_networks; | |
c6f79b17 SE |
45 | uint32_t secnet_address; /* our own address, or possibly the address of |
46 | the other end of a point-to-point link */ | |
47 | bool_t ptp; | |
9d3a4132 SE |
48 | uint32_t mtu; |
49 | struct netlink_client *clients; | |
50 | netlink_deliver_fn *deliver_to_host; /* Provided by driver */ | |
51 | netlink_route_fn *set_route; /* Provided by driver */ | |
52 | struct buffer_if icmp; /* Buffer for assembly of outgoing ICMP */ | |
53 | uint32_t n_routes; /* How many routes do we know about? */ | |
54 | struct netlink_route *routes; | |
55 | }; | |
56 | ||
57 | extern netlink_deliver_fn *netlink_init(struct netlink *st, | |
58 | void *dst, struct cloc loc, | |
59 | dict_t *dict, string_t description, | |
60 | netlink_route_fn *set_route, | |
61 | netlink_deliver_fn *to_host); | |
62 | ||
63 | #endif /* netlink_h */ |