Blame view

include/linux/icmpv6.h 4.5 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_ICMPV6_H
  #define _LINUX_ICMPV6_H
1cc49ae2e   Jaswinder Singh Rajput   headers_check fix...
3
  #include <linux/types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
5
6
7
8
9
  #include <asm/byteorder.h>
  
  struct icmp6hdr {
  
  	__u8		icmp6_type;
  	__u8		icmp6_code;
9981a0e36   Al Viro   [NET]: Annotate c...
10
  	__sum16		icmp6_cksum;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
12
13
  
  
  	union {
a27ee7a4d   Al Viro   [IPV6]: annotate ...
14
15
  		__be32			un_data32[1];
  		__be16			un_data16[2];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
17
18
  		__u8			un_data8[4];
  
  		struct icmpv6_echo {
a27ee7a4d   Al Viro   [IPV6]: annotate ...
19
20
  			__be16		identifier;
  			__be16		sequence;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  		} u_echo;
  
                  struct icmpv6_nd_advt {
  #if defined(__LITTLE_ENDIAN_BITFIELD)
                          __u32		reserved:5,
                          		override:1,
                          		solicited:1,
                          		router:1,
  					reserved2:24;
  #elif defined(__BIG_ENDIAN_BITFIELD)
                          __u32		router:1,
  					solicited:1,
                          		override:1,
                          		reserved:29;
  #else
  #error	"Please fix <asm/byteorder.h>"
  #endif						
                  } u_nd_advt;
  
                  struct icmpv6_nd_ra {
  			__u8		hop_limit;
  #if defined(__LITTLE_ENDIAN_BITFIELD)
22441cfa0   Pedro Ribeiro   IPV6: Fix default...
43
  			__u8		reserved:3,
ebacaaa0f   YOSHIFUJI Hideaki   [IPV6]: ROUTE: Ad...
44
  					router_pref:2,
22441cfa0   Pedro Ribeiro   IPV6: Fix default...
45
  					home_agent:1,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
47
48
49
50
51
  					other:1,
  					managed:1;
  
  #elif defined(__BIG_ENDIAN_BITFIELD)
  			__u8		managed:1,
  					other:1,
22441cfa0   Pedro Ribeiro   IPV6: Fix default...
52
  					home_agent:1,
ebacaaa0f   YOSHIFUJI Hideaki   [IPV6]: ROUTE: Ad...
53
  					router_pref:2,
22441cfa0   Pedro Ribeiro   IPV6: Fix default...
54
  					reserved:3;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
56
57
  #else
  #error	"Please fix <asm/byteorder.h>"
  #endif
a27ee7a4d   Al Viro   [IPV6]: annotate ...
58
  			__be16		rt_lifetime;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
                  } u_nd_ra;
  
  	} icmp6_dataun;
  
  #define icmp6_identifier	icmp6_dataun.u_echo.identifier
  #define icmp6_sequence		icmp6_dataun.u_echo.sequence
  #define icmp6_pointer		icmp6_dataun.un_data32[0]
  #define icmp6_mtu		icmp6_dataun.un_data32[0]
  #define icmp6_unused		icmp6_dataun.un_data32[0]
  #define icmp6_maxdelay		icmp6_dataun.un_data16[0]
  #define icmp6_router		icmp6_dataun.u_nd_advt.router
  #define icmp6_solicited		icmp6_dataun.u_nd_advt.solicited
  #define icmp6_override		icmp6_dataun.u_nd_advt.override
  #define icmp6_ndiscreserved	icmp6_dataun.u_nd_advt.reserved
  #define icmp6_hop_limit		icmp6_dataun.u_nd_ra.hop_limit
  #define icmp6_addrconf_managed	icmp6_dataun.u_nd_ra.managed
  #define icmp6_addrconf_other	icmp6_dataun.u_nd_ra.other
  #define icmp6_rt_lifetime	icmp6_dataun.u_nd_ra.rt_lifetime
ebacaaa0f   YOSHIFUJI Hideaki   [IPV6]: ROUTE: Ad...
77
  #define icmp6_router_pref	icmp6_dataun.u_nd_ra.router_pref
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
  };
cc70ab261   Arnaldo Carvalho de Melo   [ICMP6]: Introduc...
79
80
81
82
83
  #ifdef __KERNEL__
  #include <linux/skbuff.h>
  
  static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
  {
9c70220b7   Arnaldo Carvalho de Melo   [SK_BUFF]: Introd...
84
  	return (struct icmp6hdr *)skb_transport_header(skb);
cc70ab261   Arnaldo Carvalho de Melo   [ICMP6]: Introduc...
85
86
  }
  #endif
ebacaaa0f   YOSHIFUJI Hideaki   [IPV6]: ROUTE: Ad...
87
88
89
90
  #define ICMPV6_ROUTER_PREF_LOW		0x3
  #define ICMPV6_ROUTER_PREF_MEDIUM	0x0
  #define ICMPV6_ROUTER_PREF_HIGH		0x1
  #define ICMPV6_ROUTER_PREF_INVALID	0x2
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
  
  #define ICMPV6_DEST_UNREACH		1
  #define ICMPV6_PKT_TOOBIG		2
  #define ICMPV6_TIME_EXCEED		3
  #define ICMPV6_PARAMPROB		4
  
  #define ICMPV6_INFOMSG_MASK		0x80
  
  #define ICMPV6_ECHO_REQUEST		128
  #define ICMPV6_ECHO_REPLY		129
  #define ICMPV6_MGM_QUERY		130
  #define ICMPV6_MGM_REPORT       	131
  #define ICMPV6_MGM_REDUCTION    	132
  
  #define ICMPV6_NI_QUERY			139
  #define ICMPV6_NI_REPLY			140
  
  #define ICMPV6_MLD2_REPORT		143
  
  #define ICMPV6_DHAAD_REQUEST		144
  #define ICMPV6_DHAAD_REPLY		145
  #define ICMPV6_MOBILE_PREFIX_SOL	146
  #define ICMPV6_MOBILE_PREFIX_ADV	147
  
  /*
   *	Codes for Destination Unreachable
   */
  #define ICMPV6_NOROUTE			0
  #define ICMPV6_ADM_PROHIBITED		1
  #define ICMPV6_NOT_NEIGHBOUR		2
  #define ICMPV6_ADDR_UNREACH		3
  #define ICMPV6_PORT_UNREACH		4
  
  /*
   *	Codes for Time Exceeded
   */
  #define ICMPV6_EXC_HOPLIMIT		0
  #define ICMPV6_EXC_FRAGTIME		1
  
  /*
   *	Codes for Parameter Problem
   */
  #define ICMPV6_HDR_FIELD		0
  #define ICMPV6_UNK_NEXTHDR		1
  #define ICMPV6_UNK_OPTION		2
  
  /*
   *	constants for (set|get)sockopt
   */
  
  #define ICMPV6_FILTER			1
  
  /*
   *	ICMPV6 filter
   */
  
  #define ICMPV6_FILTER_BLOCK		1
  #define ICMPV6_FILTER_PASS		2
  #define ICMPV6_FILTER_BLOCKOTHERS	3
  #define ICMPV6_FILTER_PASSONLY		4
  
  struct icmp6_filter {
  	__u32		data[8];
  };
  
  /*
   *	Definitions for MLDv2
   */
  #define MLD2_MODE_IS_INCLUDE	1
  #define MLD2_MODE_IS_EXCLUDE	2
  #define MLD2_CHANGE_TO_INCLUDE	3
  #define MLD2_CHANGE_TO_EXCLUDE	4
  #define MLD2_ALLOW_NEW_SOURCES	5
  #define MLD2_BLOCK_OLD_SOURCES	6
  
  #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }
  
  #ifdef __KERNEL__
  
  #include <linux/netdevice.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
171
172
  
  extern void				icmpv6_send(struct sk_buff *skb,
d5fdd6bab   Brian Haley   ipv6: Use correct...
173
  						    u8 type, u8 code,
3ffe533c8   Alexey Dobriyan   ipv6: drop unused...
174
  						    __u32 info);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
175

9b0f976f2   Denis V. Lunev   [INET]: Remove st...
176
  extern int				icmpv6_init(void);
d5fdd6bab   Brian Haley   ipv6: Use correct...
177
  extern int				icmpv6_err_convert(u8 type, u8 code,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
179
180
  							   int *err);
  extern void				icmpv6_cleanup(void);
  extern void				icmpv6_param_prob(struct sk_buff *skb,
d5fdd6bab   Brian Haley   ipv6: Use correct...
181
  							  u8 code, int pos);
95e41e93e   YOSHIFUJI Hideaki   [IPV6]: Make ndis...
182
183
  
  struct flowi;
f59d43899   David S. Miller   [IPV6]: Fix power...
184
  struct in6_addr;
95e41e93e   YOSHIFUJI Hideaki   [IPV6]: Make ndis...
185
186
187
188
189
190
  extern void				icmpv6_flow_init(struct sock *sk,
  							 struct flowi *fl,
  							 u8 type,
  							 const struct in6_addr *saddr,
  							 const struct in6_addr *daddr,
  							 int oif);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
191
192
193
  #endif
  
  #endif