Import 2.3.9
[davej-history.git] / include / net / dn_fib.h
blobd8118449c8ffee4e71a668e9db09335a08a074a2
1 #ifndef _NET_DN_FIB_H
2 #define _NET_DN_FIB_H
4 #include <linux/config.h>
6 #ifdef CONFIG_DECNET_ROUTER
9 struct dn_fib_res {
10 dn_address res_addr;
11 dn_address res_mask;
12 int res_ifindex;
13 int res_proto;
14 int res_cost;
15 int res_type;
16 struct dn_fib_node *res_fn;
17 struct dn_fib_action *res_fa;
20 struct dn_fib_action {
21 struct dn_fib_action *fa_next;
22 dn_address fa_key;
23 dn_address fa_mask;
24 int fa_ifindex;
25 int fa_proto;
26 int fa_cost;
27 int fa_type;
28 union {
29 struct neighbour *fau_neigh; /* Normal route */
30 int fau_error; /* Reject */
31 int fau_table; /* Throw */
32 } fa_u;
33 #define fa_neigh fa_u.fau_neigh
34 #define fa_error fa_u.fau_error
35 #define fa_table fa_u.fau_table
38 struct dn_fib_node {
39 struct dn_fib_node *fn_up;
40 dn_address fn_cmpmask;
41 dn_address fn_key;
42 int fn_shift;
43 struct dn_fib_action *fn_action;
44 struct dn_fib_node *fn_children[2];
47 #define DN_FIB_NEXT(fibnode, key) ((fibnode)->fn_children[((key) ^ (fibnode)->fn_cmpmask) >> (fibnode)->fn_shift])
49 struct dn_fib_walker_t;
51 struct dn_fib_table {
52 int n;
53 unsigned long count;
54 struct dn_fib_node *root;
56 int (*insert)(struct dn_fib_table *t, struct dn_fib_action *fa);
57 int (*delete)(struct dn_fib_table *t, struct dn_fib_action *fa);
58 int (*lookup)(struct dn_fib_table *t, struct dn_fib_res *res);
59 int (*walk)(struct dn_fib_walker_t *fwt);
60 #ifdef CONFIG_RTNETLINK
61 int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb);
62 #endif /* CONFIG_RTNETLINK */
65 struct dn_fib_walker_t {
66 struct dn_fib_table *table;
67 void *arg;
68 int (*fxn)(struct dn_fib_walker_t *fwt, struct dn_fib_node *n);
71 extern void dn_fib_init(void);
72 extern void dn_fib_cleanup(void);
74 extern int dn_fib_rt_message(struct sk_buff *skb);
75 extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
77 #ifdef CONFIG_RTNETLINK
78 extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
79 extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
80 extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
81 extern int dn_fib_rtm_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
82 #endif /* CONFIG_RTNETLINK */
83 #endif /* CONFIG_DECNET_ROUTER */
85 #endif /* _NET_DN_FIB_H */