The Pedigree Project  0.1
prot/nd6.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
25 /*
26  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without modification,
30  * are permitted provided that the following conditions are met:
31  *
32  * 1. Redistributions of source code must retain the above copyright notice,
33  * this list of conditions and the following disclaimer.
34  * 2. Redistributions in binary form must reproduce the above copyright notice,
35  * this list of conditions and the following disclaimer in the documentation
36  * and/or other materials provided with the distribution.
37  * 3. The name of the author may not be used to endorse or promote products
38  * derived from this software without specific prior written permission.
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
41  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
42  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
43  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
45  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
48  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
49  * OF SUCH DAMAGE.
50  *
51  * This file is part of the lwIP TCP/IP stack.
52  *
53  * Author: Adam Dunkels <adam@sics.se>
54  *
55  */
56 #ifndef LWIP_HDR_PROT_ND6_H
57 #define LWIP_HDR_PROT_ND6_H
58 
59 #include "lwip/arch.h"
60 #include "lwip/ip6_addr.h"
61 #include "lwip/prot/ip6.h"
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
68 #ifdef PACK_STRUCT_USE_INCLUDES
69 # include "arch/bpstruct.h"
70 #endif
72 struct ns_header {
73  PACK_STRUCT_FLD_8(u8_t type);
74  PACK_STRUCT_FLD_8(u8_t code);
75  PACK_STRUCT_FIELD(u16_t chksum);
76  PACK_STRUCT_FIELD(u32_t reserved);
77  PACK_STRUCT_FLD_S(ip6_addr_p_t target_address);
78  /* Options follow. */
79 } PACK_STRUCT_STRUCT;
81 #ifdef PACK_STRUCT_USE_INCLUDES
82 # include "arch/epstruct.h"
83 #endif
84 
86 #ifdef PACK_STRUCT_USE_INCLUDES
87 # include "arch/bpstruct.h"
88 #endif
90 struct na_header {
91  PACK_STRUCT_FLD_8(u8_t type);
92  PACK_STRUCT_FLD_8(u8_t code);
93  PACK_STRUCT_FIELD(u16_t chksum);
94  PACK_STRUCT_FLD_8(u8_t flags);
95  PACK_STRUCT_FLD_8(u8_t reserved[3]);
96  PACK_STRUCT_FLD_S(ip6_addr_p_t target_address);
97  /* Options follow. */
98 } PACK_STRUCT_STRUCT;
100 #ifdef PACK_STRUCT_USE_INCLUDES
101 # include "arch/epstruct.h"
102 #endif
103 #define ND6_FLAG_ROUTER (0x80)
104 #define ND6_FLAG_SOLICITED (0x40)
105 #define ND6_FLAG_OVERRIDE (0x20)
106 
108 #ifdef PACK_STRUCT_USE_INCLUDES
109 # include "arch/bpstruct.h"
110 #endif
112 struct rs_header {
113  PACK_STRUCT_FLD_8(u8_t type);
114  PACK_STRUCT_FLD_8(u8_t code);
115  PACK_STRUCT_FIELD(u16_t chksum);
116  PACK_STRUCT_FIELD(u32_t reserved);
117  /* Options follow. */
118 } PACK_STRUCT_STRUCT;
120 #ifdef PACK_STRUCT_USE_INCLUDES
121 # include "arch/epstruct.h"
122 #endif
123 
125 #define ND6_RA_FLAG_MANAGED_ADDR_CONFIG (0x80)
126 #define ND6_RA_FLAG_OTHER_CONFIG (0x40)
127 #define ND6_RA_FLAG_HOME_AGENT (0x20)
128 #define ND6_RA_PREFERENCE_MASK (0x18)
129 #define ND6_RA_PREFERENCE_HIGH (0x08)
130 #define ND6_RA_PREFERENCE_MEDIUM (0x00)
131 #define ND6_RA_PREFERENCE_LOW (0x18)
132 #define ND6_RA_PREFERENCE_DISABLED (0x10)
133 #ifdef PACK_STRUCT_USE_INCLUDES
134 # include "arch/bpstruct.h"
135 #endif
137 struct ra_header {
138  PACK_STRUCT_FLD_8(u8_t type);
139  PACK_STRUCT_FLD_8(u8_t code);
140  PACK_STRUCT_FIELD(u16_t chksum);
141  PACK_STRUCT_FLD_8(u8_t current_hop_limit);
142  PACK_STRUCT_FLD_8(u8_t flags);
143  PACK_STRUCT_FIELD(u16_t router_lifetime);
144  PACK_STRUCT_FIELD(u32_t reachable_time);
145  PACK_STRUCT_FIELD(u32_t retrans_timer);
146  /* Options follow. */
147 } PACK_STRUCT_STRUCT;
149 #ifdef PACK_STRUCT_USE_INCLUDES
150 # include "arch/epstruct.h"
151 #endif
152 
154 #ifdef PACK_STRUCT_USE_INCLUDES
155 # include "arch/bpstruct.h"
156 #endif
159  PACK_STRUCT_FLD_8(u8_t type);
160  PACK_STRUCT_FLD_8(u8_t code);
161  PACK_STRUCT_FIELD(u16_t chksum);
162  PACK_STRUCT_FIELD(u32_t reserved);
163  PACK_STRUCT_FLD_S(ip6_addr_p_t target_address);
164  PACK_STRUCT_FLD_S(ip6_addr_p_t destination_address);
165  /* Options follow. */
166 } PACK_STRUCT_STRUCT;
168 #ifdef PACK_STRUCT_USE_INCLUDES
169 # include "arch/epstruct.h"
170 #endif
171 
173 #define ND6_OPTION_TYPE_SOURCE_LLADDR (0x01)
174 #define ND6_OPTION_TYPE_TARGET_LLADDR (0x02)
175 #ifdef PACK_STRUCT_USE_INCLUDES
176 # include "arch/bpstruct.h"
177 #endif
180  PACK_STRUCT_FLD_8(u8_t type);
181  PACK_STRUCT_FLD_8(u8_t length);
183 } PACK_STRUCT_STRUCT;
185 #ifdef PACK_STRUCT_USE_INCLUDES
186 # include "arch/epstruct.h"
187 #endif
188 
190 #define ND6_OPTION_TYPE_PREFIX_INFO (0x03)
191 #define ND6_PREFIX_FLAG_ON_LINK (0x80)
192 #define ND6_PREFIX_FLAG_AUTONOMOUS (0x40)
193 #define ND6_PREFIX_FLAG_ROUTER_ADDRESS (0x20)
194 #define ND6_PREFIX_FLAG_SITE_PREFIX (0x10)
195 #ifdef PACK_STRUCT_USE_INCLUDES
196 # include "arch/bpstruct.h"
197 #endif
200  PACK_STRUCT_FLD_8(u8_t type);
201  PACK_STRUCT_FLD_8(u8_t length);
202  PACK_STRUCT_FLD_8(u8_t prefix_length);
203  PACK_STRUCT_FLD_8(u8_t flags);
204  PACK_STRUCT_FIELD(u32_t valid_lifetime);
205  PACK_STRUCT_FIELD(u32_t preferred_lifetime);
206  PACK_STRUCT_FLD_8(u8_t reserved2[3]);
207  PACK_STRUCT_FLD_8(u8_t site_prefix_length);
208  PACK_STRUCT_FLD_S(ip6_addr_p_t prefix);
209 } PACK_STRUCT_STRUCT;
211 #ifdef PACK_STRUCT_USE_INCLUDES
212 # include "arch/epstruct.h"
213 #endif
214 
216 #define ND6_OPTION_TYPE_REDIR_HDR (0x04)
217 #ifdef PACK_STRUCT_USE_INCLUDES
218 # include "arch/bpstruct.h"
219 #endif
222  PACK_STRUCT_FLD_8(u8_t type);
223  PACK_STRUCT_FLD_8(u8_t length);
224  PACK_STRUCT_FLD_8(u8_t reserved[6]);
225  /* Portion of redirected packet follows. */
226  /* PACK_STRUCT_FLD_8(u8_t redirected[8]); */
227 } PACK_STRUCT_STRUCT;
229 #ifdef PACK_STRUCT_USE_INCLUDES
230 # include "arch/epstruct.h"
231 #endif
232 
234 #define ND6_OPTION_TYPE_MTU (0x05)
235 #ifdef PACK_STRUCT_USE_INCLUDES
236 # include "arch/bpstruct.h"
237 #endif
239 struct mtu_option {
240  PACK_STRUCT_FLD_8(u8_t type);
241  PACK_STRUCT_FLD_8(u8_t length);
242  PACK_STRUCT_FIELD(u16_t reserved);
243  PACK_STRUCT_FIELD(u32_t mtu);
244 } PACK_STRUCT_STRUCT;
246 #ifdef PACK_STRUCT_USE_INCLUDES
247 # include "arch/epstruct.h"
248 #endif
249 
251 #define ND6_OPTION_TYPE_ROUTE_INFO (24)
252 #ifdef PACK_STRUCT_USE_INCLUDES
253 # include "arch/bpstruct.h"
254 #endif
256 struct route_option {
257  PACK_STRUCT_FLD_8(u8_t type);
258  PACK_STRUCT_FLD_8(u8_t length);
259  PACK_STRUCT_FLD_8(u8_t prefix_length);
260  PACK_STRUCT_FLD_8(u8_t preference);
261  PACK_STRUCT_FIELD(u32_t route_lifetime);
262  PACK_STRUCT_FLD_S(ip6_addr_p_t prefix);
263 } PACK_STRUCT_STRUCT;
265 #ifdef PACK_STRUCT_USE_INCLUDES
266 # include "arch/epstruct.h"
267 #endif
268 
270 #if LWIP_ND6_RDNSS_MAX_DNS_SERVERS
271 #define LWIP_RDNSS_OPTION_MAX_SERVERS LWIP_ND6_RDNSS_MAX_DNS_SERVERS
272 #else
273 #define LWIP_RDNSS_OPTION_MAX_SERVERS 1
274 #endif
275 #define ND6_OPTION_TYPE_RDNSS (25)
276 #ifdef PACK_STRUCT_USE_INCLUDES
277 # include "arch/bpstruct.h"
278 #endif
280 struct rdnss_option {
281  PACK_STRUCT_FLD_8(u8_t type);
282  PACK_STRUCT_FLD_8(u8_t length);
283  PACK_STRUCT_FIELD(u16_t reserved);
284  PACK_STRUCT_FIELD(u32_t lifetime);
285  PACK_STRUCT_FLD_S(ip6_addr_p_t rdnss_address[LWIP_RDNSS_OPTION_MAX_SERVERS]);
286 } PACK_STRUCT_STRUCT;
288 #ifdef PACK_STRUCT_USE_INCLUDES
289 # include "arch/epstruct.h"
290 #endif
291 
292 #ifdef __cplusplus
293 }
294 #endif
295 
296 #endif /* LWIP_HDR_PROT_ND6_H */
#define PACK_STRUCT_BEGIN
Definition: arch.h:261
#define NETIF_MAX_HWADDR_LEN
Definition: netif.h:82
#define PACK_STRUCT_FLD_S(x)
Definition: arch.h:310
#define PACK_STRUCT_END
Definition: arch.h:270
#define PACK_STRUCT_FLD_8(x)
Definition: arch.h:301
#define PACK_STRUCT_FIELD(x)
Definition: arch.h:292
#define LWIP_RDNSS_OPTION_MAX_SERVERS
Definition: prot/nd6.h:273