UbixOS V2 2.0

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