File: /usr/src/linux/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     #define ND_OPT_SOURCE_LL_ADDR		1
19     #define ND_OPT_TARGET_LL_ADDR		2
20     #define ND_OPT_PREFIX_INFO		3
21     #define ND_OPT_REDIRECT_HDR		4
22     #define ND_OPT_MTU			5
23     
24     #define MAX_RTR_SOLICITATION_DELAY	HZ
25     
26     #define ND_REACHABLE_TIME		(30*HZ)
27     #define ND_RETRANS_TIMER		HZ
28     
29     #define ND_MIN_RANDOM_FACTOR		(1/2)
30     #define ND_MAX_RANDOM_FACTOR		(3/2)
31     
32     #ifdef __KERNEL__
33     
34     #include <linux/skbuff.h>
35     #include <linux/netdevice.h>
36     #include <linux/icmpv6.h>
37     #include <net/neighbour.h>
38     #include <asm/atomic.h>
39     
40     extern struct neigh_table nd_tbl;
41     
42     struct nd_msg {
43             struct icmp6hdr	icmph;
44             struct in6_addr	target;
45             struct {
46                     __u8	opt_type;
47                     __u8	opt_len;
48                     __u8	link_addr[MAX_ADDR_LEN];
49             } opt;
50     };
51     
52     struct ra_msg {
53             struct icmp6hdr		icmph;
54     	__u32			reachable_time;
55     	__u32			retrans_timer;
56     };
57     
58     
59     extern int			ndisc_init(struct net_proto_family *ops);
60     
61     extern void			ndisc_cleanup(void);
62     
63     extern int			ndisc_rcv(struct sk_buff *skb);
64     
65     extern void			ndisc_send_ns(struct net_device *dev,
66     					      struct neighbour *neigh,
67     					      struct in6_addr *solicit,
68     					      struct in6_addr *daddr,
69     					      struct in6_addr *saddr);
70     
71     extern void			ndisc_send_rs(struct net_device *dev,
72     					      struct in6_addr *saddr,
73     					      struct in6_addr *daddr);
74     
75     extern void			ndisc_forwarding_on(void);
76     extern void			ndisc_forwarding_off(void);
77     
78     extern void			ndisc_send_redirect(struct sk_buff *skb,
79     						    struct neighbour *neigh,
80     						    struct in6_addr *target);
81     
82     extern int			ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
83     
84     
85     struct rt6_info *		dflt_rt_lookup(void);
86     
87     /*
88      *	IGMP
89      */
90     extern int			igmp6_init(struct net_proto_family *ops);
91     
92     extern void			igmp6_cleanup(void);
93     
94     extern int			igmp6_event_query(struct sk_buff *skb);
95     
96     extern int			igmp6_event_report(struct sk_buff *skb);
97     
98     extern void			igmp6_cleanup(void);
99     
100     static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr)
101     {
102     
103     	if (dev)
104     		return __neigh_lookup(&nd_tbl, addr, dev, 1);
105     
106     	return NULL;
107     }
108     
109     
110     #endif /* __KERNEL__ */
111     
112     
113     #endif
114