[INET_SOCK]: Move struct inet_sock & helper functions to net/inet_sock.h
[safe/jmp/linux-2.6] / include / net / ndisc.h
1 #ifndef _NDISC_H
2 #define _NDISC_H
3
4 /*
5  *      ICMP codes for neighbour discovery messages
6  */
7
8 #define NDISC_ROUTER_SOLICITATION       133
9 #define NDISC_ROUTER_ADVERTISEMENT      134
10 #define NDISC_NEIGHBOUR_SOLICITATION    135
11 #define NDISC_NEIGHBOUR_ADVERTISEMENT   136
12 #define NDISC_REDIRECT                  137
13
14 /*
15  *      ndisc options
16  */
17
18 enum {
19         __ND_OPT_PREFIX_INFO_END = 0,
20         ND_OPT_SOURCE_LL_ADDR = 1,      /* RFC2461 */
21         ND_OPT_TARGET_LL_ADDR = 2,      /* RFC2461 */
22         ND_OPT_PREFIX_INFO = 3,         /* RFC2461 */
23         ND_OPT_REDIRECT_HDR = 4,        /* RFC2461 */
24         ND_OPT_MTU = 5,                 /* RFC2461 */
25         __ND_OPT_MAX
26 };
27
28 #define MAX_RTR_SOLICITATION_DELAY      HZ
29
30 #define ND_REACHABLE_TIME               (30*HZ)
31 #define ND_RETRANS_TIMER                HZ
32
33 #define ND_MIN_RANDOM_FACTOR            (1/2)
34 #define ND_MAX_RANDOM_FACTOR            (3/2)
35
36 #ifdef __KERNEL__
37
38 #include <linux/config.h>
39 #include <linux/compiler.h>
40 #include <linux/icmpv6.h>
41 #include <linux/in6.h>
42 #include <linux/types.h>
43
44 #include <net/neighbour.h>
45
46 struct ctl_table;
47 struct file;
48 struct inet6_dev;
49 struct net_device;
50 struct net_proto_family;
51 struct sk_buff;
52
53 extern struct neigh_table nd_tbl;
54
55 struct nd_msg {
56         struct icmp6hdr icmph;
57         struct in6_addr target;
58         __u8            opt[0];
59 };
60
61 struct rs_msg {
62         struct icmp6hdr icmph;
63         __u8            opt[0];
64 };
65
66 struct ra_msg {
67         struct icmp6hdr         icmph;
68         __u32                   reachable_time;
69         __u32                   retrans_timer;
70 };
71
72 struct nd_opt_hdr {
73         __u8            nd_opt_type;
74         __u8            nd_opt_len;
75 } __attribute__((__packed__));
76
77
78 extern int                      ndisc_init(struct net_proto_family *ops);
79
80 extern void                     ndisc_cleanup(void);
81
82 extern int                      ndisc_rcv(struct sk_buff *skb);
83
84 extern void                     ndisc_send_ns(struct net_device *dev,
85                                               struct neighbour *neigh,
86                                               struct in6_addr *solicit,
87                                               struct in6_addr *daddr,
88                                               struct in6_addr *saddr);
89
90 extern void                     ndisc_send_rs(struct net_device *dev,
91                                               struct in6_addr *saddr,
92                                               struct in6_addr *daddr);
93
94 extern void                     ndisc_forwarding_on(void);
95 extern void                     ndisc_forwarding_off(void);
96
97 extern void                     ndisc_send_redirect(struct sk_buff *skb,
98                                                     struct neighbour *neigh,
99                                                     struct in6_addr *target);
100
101 extern int                      ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
102
103
104 struct rt6_info *               dflt_rt_lookup(void);
105
106 /*
107  *      IGMP
108  */
109 extern int                      igmp6_init(struct net_proto_family *ops);
110
111 extern void                     igmp6_cleanup(void);
112
113 extern int                      igmp6_event_query(struct sk_buff *skb);
114
115 extern int                      igmp6_event_report(struct sk_buff *skb);
116
117 extern void                     igmp6_cleanup(void);
118
119 #ifdef CONFIG_SYSCTL
120 extern int                      ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
121                                                            int write,
122                                                            struct file * filp,
123                                                            void __user *buffer,
124                                                            size_t *lenp,
125                                                            loff_t *ppos);
126 #endif
127
128 extern void                     inet6_ifinfo_notify(int event,
129                                                     struct inet6_dev *idev);
130
131 static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr)
132 {
133
134         if (dev)
135                 return __neigh_lookup(&nd_tbl, addr, dev, 1);
136
137         return NULL;
138 }
139
140
141 #endif /* __KERNEL__ */
142
143
144 #endif