Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef _LINUX_ICMPV6_H |
2 | #define _LINUX_ICMPV6_H |
||
3 | |||
4 | #include <asm/byteorder.h> |
||
5 | |||
6 | struct icmp6hdr { |
||
7 | |||
8 | __u8 icmp6_type; |
||
9 | __u8 icmp6_code; |
||
10 | __u16 icmp6_cksum; |
||
11 | |||
12 | |||
13 | union { |
||
14 | __u32 un_data32[1]; |
||
15 | __u16 un_data16[2]; |
||
16 | __u8 un_data8[4]; |
||
17 | |||
18 | struct icmpv6_echo { |
||
19 | __u16 identifier; |
||
20 | __u16 sequence; |
||
21 | } u_echo; |
||
22 | |||
23 | struct icmpv6_nd_advt { |
||
24 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
||
25 | __u32 reserved:5, |
||
26 | override:1, |
||
27 | solicited:1, |
||
28 | router:1, |
||
29 | reserved2:24; |
||
30 | #elif defined(__BIG_ENDIAN_BITFIELD) |
||
31 | __u32 router:1, |
||
32 | solicited:1, |
||
33 | override:1, |
||
34 | reserved:29; |
||
35 | #else |
||
36 | #error "Please fix <asm/byteorder.h>" |
||
37 | #endif |
||
38 | } u_nd_advt; |
||
39 | |||
40 | struct icmpv6_nd_ra { |
||
41 | __u8 hop_limit; |
||
42 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
||
43 | __u8 reserved:6, |
||
44 | other:1, |
||
45 | managed:1; |
||
46 | |||
47 | #elif defined(__BIG_ENDIAN_BITFIELD) |
||
48 | __u8 managed:1, |
||
49 | other:1, |
||
50 | reserved:6; |
||
51 | #else |
||
52 | #error "Please fix <asm/byteorder.h>" |
||
53 | #endif |
||
54 | __u16 rt_lifetime; |
||
55 | } u_nd_ra; |
||
56 | |||
57 | } icmp6_dataun; |
||
58 | |||
59 | #define icmp6_identifier icmp6_dataun.u_echo.identifier |
||
60 | #define icmp6_sequence icmp6_dataun.u_echo.sequence |
||
61 | #define icmp6_pointer icmp6_dataun.un_data32[0] |
||
62 | #define icmp6_mtu icmp6_dataun.un_data32[0] |
||
63 | #define icmp6_unused icmp6_dataun.un_data32[0] |
||
64 | #define icmp6_maxdelay icmp6_dataun.un_data16[0] |
||
65 | #define icmp6_router icmp6_dataun.u_nd_advt.router |
||
66 | #define icmp6_solicited icmp6_dataun.u_nd_advt.solicited |
||
67 | #define icmp6_override icmp6_dataun.u_nd_advt.override |
||
68 | #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved |
||
69 | #define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit |
||
70 | #define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed |
||
71 | #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other |
||
72 | #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime |
||
73 | }; |
||
74 | |||
75 | |||
76 | #define ICMPV6_DEST_UNREACH 1 |
||
77 | #define ICMPV6_PKT_TOOBIG 2 |
||
78 | #define ICMPV6_TIME_EXCEED 3 |
||
79 | #define ICMPV6_PARAMPROB 4 |
||
80 | |||
81 | #define ICMPV6_INFOMSG_MASK 0x80 |
||
82 | |||
83 | #define ICMPV6_ECHO_REQUEST 128 |
||
84 | #define ICMPV6_ECHO_REPLY 129 |
||
85 | #define ICMPV6_MGM_QUERY 130 |
||
86 | #define ICMPV6_MGM_REPORT 131 |
||
87 | #define ICMPV6_MGM_REDUCTION 132 |
||
88 | |||
89 | /* definitions for MLDv2 */ |
||
90 | |||
91 | #define MLD2_MODE_IS_INCLUDE 1 |
||
92 | #define MLD2_MODE_IS_EXCLUDE 2 |
||
93 | #define MLD2_CHANGE_TO_INCLUDE 3 |
||
94 | #define MLD2_CHANGE_TO_EXCLUDE 4 |
||
95 | #define MLD2_ALLOW_NEW_SOURCES 5 |
||
96 | #define MLD2_BLOCK_OLD_SOURCES 6 |
||
97 | |||
98 | /* this must be an IANA-assigned value; 206 for testing only */ |
||
99 | #define ICMPV6_MLD2_REPORT 206 |
||
100 | #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } |
||
101 | |||
102 | /* |
||
103 | * Codes for Destination Unreachable |
||
104 | */ |
||
105 | #define ICMPV6_NOROUTE 0 |
||
106 | #define ICMPV6_ADM_PROHIBITED 1 |
||
107 | #define ICMPV6_NOT_NEIGHBOUR 2 |
||
108 | #define ICMPV6_ADDR_UNREACH 3 |
||
109 | #define ICMPV6_PORT_UNREACH 4 |
||
110 | |||
111 | /* |
||
112 | * Codes for Time Exceeded |
||
113 | */ |
||
114 | #define ICMPV6_EXC_HOPLIMIT 0 |
||
115 | #define ICMPV6_EXC_FRAGTIME 1 |
||
116 | |||
117 | /* |
||
118 | * Codes for Parameter Problem |
||
119 | */ |
||
120 | #define ICMPV6_HDR_FIELD 0 |
||
121 | #define ICMPV6_UNK_NEXTHDR 1 |
||
122 | #define ICMPV6_UNK_OPTION 2 |
||
123 | |||
124 | /* |
||
125 | * constants for (set|get)sockopt |
||
126 | */ |
||
127 | |||
128 | #define ICMPV6_FILTER 1 |
||
129 | |||
130 | /* |
||
131 | * ICMPV6 filter |
||
132 | */ |
||
133 | |||
134 | #define ICMPV6_FILTER_BLOCK 1 |
||
135 | #define ICMPV6_FILTER_PASS 2 |
||
136 | #define ICMPV6_FILTER_BLOCKOTHERS 3 |
||
137 | #define ICMPV6_FILTER_PASSONLY 4 |
||
138 | |||
139 | struct icmp6_filter { |
||
140 | __u32 data[8]; |
||
141 | }; |
||
142 | |||
143 | #ifdef __KERNEL__ |
||
144 | |||
145 | #include <linux/netdevice.h> |
||
146 | #include <linux/skbuff.h> |
||
147 | |||
148 | |||
149 | extern void icmpv6_send(struct sk_buff *skb, |
||
150 | int type, int code, |
||
151 | __u32 info, |
||
152 | struct net_device *dev); |
||
153 | |||
154 | extern int icmpv6_init(struct net_proto_family *ops); |
||
155 | extern int icmpv6_err_convert(int type, int code, |
||
156 | int *err); |
||
157 | extern void icmpv6_cleanup(void); |
||
158 | extern void icmpv6_param_prob(struct sk_buff *skb, |
||
159 | int code, int pos); |
||
160 | #endif |
||
161 | |||
162 | #endif |