ipv6.h
Go to the documentation of this file.
1 /**
2  * @file ipv6.h
3  * @brief IPv6 (Internet Protocol Version 6)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.6
29  **/
30 
31 #ifndef _IPV6_H
32 #define _IPV6_H
33 
34 //Forward declaration of structures
35 struct _Ipv6Header;
36 #define Ipv6Header struct _Ipv6Header
37 
38 struct _Ipv6FragmentHeader;
39 #define Ipv6FragmentHeader struct _Ipv6FragmentHeader
40 
41 struct _Ipv6PseudoHeader;
42 #define Ipv6PseudoHeader struct _Ipv6PseudoHeader
43 
44 //Dependencies
45 #include <string.h>
46 #include "core/net.h"
47 #include "core/ethernet.h"
48 #include "ipv6/ipv6_frag.h"
49 
50 //IPv6 support
51 #ifndef IPV6_SUPPORT
52  #define IPV6_SUPPORT DISABLED
53 #elif (IPV6_SUPPORT != ENABLED && IPV6_SUPPORT != DISABLED)
54  #error IPV6_SUPPORT parameter is not valid
55 #endif
56 
57 //Default IPv6 Hop Limit field
58 #ifndef IPV6_DEFAULT_HOP_LIMIT
59  #define IPV6_DEFAULT_HOP_LIMIT 64
60 #elif (IPV6_DEFAULT_HOP_LIMIT < 1)
61  #error IPV6_DEFAULT_HOP_LIMIT parameter is not valid
62 #endif
63 
64 //Maximum number of IPv6 unicast addresses
65 #ifndef IPV6_ADDR_LIST_SIZE
66  #define IPV6_ADDR_LIST_SIZE 3
67 #elif (IPV6_ADDR_LIST_SIZE < 2)
68  #error IPV6_ADDR_LIST_SIZE parameter is not valid
69 #endif
70 
71 //Maximum number of IPv6 anycast addresses
72 #ifndef IPV6_ANYCAST_ADDR_LIST_SIZE
73  #define IPV6_ANYCAST_ADDR_LIST_SIZE 1
74 #elif (IPV6_ANYCAST_ADDR_LIST_SIZE < 1)
75  #error IPV6_ANYCAST_ADDR_LIST_SIZE parameter is not valid
76 #endif
77 
78 //Size of the prefix list
79 #ifndef IPV6_PREFIX_LIST_SIZE
80  #define IPV6_PREFIX_LIST_SIZE 2
81 #elif (IPV6_PREFIX_LIST_SIZE < 1)
82  #error IPV6_PREFIX_LIST_SIZE parameter is not valid
83 #endif
84 
85 //Maximum number number of default routers
86 #ifndef IPV6_ROUTER_LIST_SIZE
87  #define IPV6_ROUTER_LIST_SIZE 2
88 #elif (IPV6_ROUTER_LIST_SIZE < 1)
89  #error IPV6_ROUTER_LIST_SIZE parameter is not valid
90 #endif
91 
92 //Maximum number of DNS servers
93 #ifndef IPV6_DNS_SERVER_LIST_SIZE
94  #define IPV6_DNS_SERVER_LIST_SIZE 2
95 #elif (IPV6_DNS_SERVER_LIST_SIZE < 1)
96  #error IPV6_DNS_SERVER_LIST_SIZE parameter is not valid
97 #endif
98 
99 //Size of the IPv6 multicast filter
100 #ifndef IPV6_MULTICAST_FILTER_SIZE
101  #define IPV6_MULTICAST_FILTER_SIZE 8
102 #elif (IPV6_MULTICAST_FILTER_SIZE < 1)
103  #error IPV6_MULTICAST_FILTER_SIZE parameter is not valid
104 #endif
105 
106 //Version number for IPv6
107 #define IPV6_VERSION 6
108 //Minimum MTU that routers and physical links are required to handle
109 #define IPV6_DEFAULT_MTU 1280
110 
111 //Macro used for defining an IPv6 address
112 #define IPV6_ADDR(a, b, c, d, e, f, g, h) {{{ \
113  MSB(a), LSB(a), MSB(b), LSB(b), MSB(c), LSB(c), MSB(d), LSB(d), \
114  MSB(e), LSB(e), MSB(f), LSB(f), MSB(g), LSB(g), MSB(h), LSB(h)}}}
115 
116 //Copy IPv6 address
117 #define ipv6CopyAddr(destIpAddr, srcIpAddr) \
118  memcpy(destIpAddr, srcIpAddr, sizeof(Ipv6Addr))
119 
120 //Compare IPv6 addresses
121 #define ipv6CompAddr(ipAddr1, ipAddr2) \
122  (!memcmp(ipAddr1, ipAddr2, sizeof(Ipv6Addr)))
123 
124 //Determine whether an IPv6 address is a link-local unicast address
125 #define ipv6IsLinkLocalUnicastAddr(ipAddr) \
126  ((ipAddr)->b[0] == 0xFE && ((ipAddr)->b[1] & 0xC0) == 0x80)
127 
128 //Determine whether an IPv6 address is a site-local unicast address
129 #define ipv6IsSiteLocalUnicastAddr(ipAddr) \
130  ((ipAddr)->b[0] == 0xFE && ((ipAddr)->b[1] & 0xC0) == 0xC0)
131 
132 //Determine whether an IPv6 address is a multicast address
133 #define ipv6IsMulticastAddr(ipAddr) \
134  ((ipAddr)->b[0] == 0xFF)
135 
136 //Determine whether an IPv6 address is a solicited-node address
137 #define ipv6IsSolicitedNodeAddr(ipAddr) \
138  ipv6CompPrefix(ipAddr, &IPV6_SOLICITED_NODE_ADDR_PREFIX, 104)
139 
140 //Get the state of the link-local address
141 #define ipv6GetLinkLocalAddrState(interface) \
142  (interface->ipv6Context.addrList[0].state)
143 
144 //C++ guard
145 #ifdef __cplusplus
146 extern "C" {
147 #endif
148 
149 
150 /**
151  * @brief IPv6 address scopes
152  **/
153 
154 typedef enum
155 {
162 } Ipv6AddrScope;
163 
164 
165 /**
166  * @brief IPv6 address state
167  **/
168 
169 typedef enum
170 {
171  IPV6_ADDR_STATE_INVALID = 0, ///<An address that is not assigned to any interface
172  IPV6_ADDR_STATE_TENTATIVE = 1, ///<An address whose uniqueness on a link is being verified
173  IPV6_ADDR_STATE_PREFERRED = 2, ///<An address assigned to an interface whose use is unrestricted
174  IPV6_ADDR_STATE_DEPRECATED = 3 ///<An address assigned to an interface whose use is discouraged
175 } Ipv6AddrState;
176 
177 
178 /**
179  * @brief IPv6 Next Header types
180  **/
181 
182 typedef enum
183 {
195 
196 
197 /**
198  * @brief IPv6 fragment offset field
199  **/
200 
201 typedef enum
202 {
204  IPV6_FLAG_RES1 = 0x0004,
205  IPV6_FLAG_RES2 = 0x0002,
206  IPV6_FLAG_M = 0x0001
208 
209 
210 /**
211  * @brief IPv6 option types
212  **/
213 
214 typedef enum
215 {
220 
221 
222 /**
223  * @brief Actions to be taken for unrecognized options
224  **/
225 
226 typedef enum
227 {
233 } Ipv6Actions;
234 
235 
236 //CodeWarrior or Win32 compiler?
237 #if defined(__CWCC__) || defined(_WIN32)
238  #pragma pack(push, 1)
239 #endif
240 
241 
242 /**
243  * @brief IPv6 network address
244  **/
245 
246 typedef __start_packed struct
247 {
248  __start_packed union
249  {
250  uint8_t b[16];
251  uint16_t w[8];
252  uint32_t dw[4];
253  };
255 
256 
257 /**
258  * @brief IPv6 header
259  **/
260 
261 __start_packed struct _Ipv6Header
262 {
263 #ifdef _CPU_BIG_ENDIAN
264  uint8_t version : 4; //0
265  uint8_t trafficClassH : 4;
266  uint8_t trafficClassL : 4; //1
267  uint8_t flowLabelH : 4;
268 #else
269  uint8_t trafficClassH : 4; //0
270  uint8_t version : 4;
271  uint8_t flowLabelH : 4; //1
272  uint8_t trafficClassL : 4;
273 #endif
274  uint16_t flowLabelL; //2-3
275  uint16_t payloadLen; //4-5
276  uint8_t nextHeader; //6
277  uint8_t hopLimit; //7
280  uint8_t payload[]; //40
281 } __end_packed;
282 
283 
284 /**
285  * @brief IPv6 Hop-by-Hop Options header
286  **/
287 
288 typedef __start_packed struct
289 {
290  uint8_t nextHeader; //0
291  uint8_t hdrExtLen; //1
292  uint8_t options[]; //2
294 
295 
296 /**
297  * @brief IPv6 Destination Options header
298  **/
299 
300 typedef __start_packed struct
301 {
302  uint8_t nextHeader; //0
303  uint8_t hdrExtLen; //1
304  uint8_t options[]; //2
306 
307 
308 /**
309  * @brief IPv6 Type 0 Routing header
310  **/
311 
312 typedef __start_packed struct
313 {
314  uint8_t nextHeader; //0
315  uint8_t hdrExtLen; //1
316  uint8_t routingType; //2
317  uint8_t segmentsLeft; //3
318  uint32_t reserved; //4-7
321 
322 
323 /**
324  * @brief IPv6 Fragment header
325  **/
326 
327 __start_packed struct _Ipv6FragmentHeader
328 {
329  uint8_t nextHeader; //0
330  uint8_t reserved; //1
331  uint16_t fragmentOffset; //2-3
332  uint32_t identification; //4-7
333 } __end_packed;
334 
335 
336 /**
337  * @brief IPv6 Authentication header
338  **/
339 
340 typedef __start_packed struct
341 {
342  uint8_t nextHeader; //0
343  uint8_t payloadLen; //1
344  uint16_t reserved; //2-3
345  uint32_t securityParamIndex; //4-7
346  uint32_t sequenceNumber; //8-11
347  uint8_t authData[]; //12
349 
350 
351 /**
352  * @brief IPv6 Encapsulating Security Payload header
353  **/
354 
355 typedef __start_packed struct
356 {
357  uint32_t securityParamIndex; //0-3
358  uint32_t sequenceNumber; //4-7
359  uint8_t payloadData[]; //8
361 
362 
363 /**
364  * @brief IPv6 option
365  **/
366 
367 typedef __start_packed struct
368 {
369  uint8_t type; //0
370  uint8_t length; //1
371  uint8_t data[]; //2
373 
374 
375 /**
376  * @brief IPv6 pseudo header
377  **/
378 
379 __start_packed struct _Ipv6PseudoHeader
380 {
383  uint32_t length; //32-35
384  uint32_t reserved : 24; //36-38
385  uint32_t nextHeader : 8; //39
386 } __end_packed;
387 
388 
389 //CodeWarrior or Win32 compiler?
390 #if defined(__CWCC__) || defined(_WIN32)
391  #pragma pack(pop)
392 #endif
393 
394 
395 /**
396  * @brief IPv6 address entry
397  **/
398 
399 typedef struct
400 {
401  Ipv6Addr addr; ///<IPv6 address
402  Ipv6AddrState state; ///<IPv6 address state
403  bool_t duplicate; ///<The address is a duplicate
404  systime_t validLifetime; ///<Valid lifetime
405  systime_t preferredLifetime; ///<Preferred lifetime
406  bool_t permanent; ///<Permanently assigned address
407  systime_t timestamp; ///<Timestamp to manage entry lifetime
408  systime_t dadTimeout; ///<Timeout value for Duplicate Address Detection
409  uint_t dadRetransmitCount; ///<Retransmission counter for Duplicate Address Detection
410 } Ipv6AddrEntry;
411 
412 
413 /**
414  * @brief Prefix list entry
415  **/
416 
417 typedef struct
418 {
419  Ipv6Addr prefix; ///<IPv6 prefix information
420  uint8_t prefixLen; ///<IPv6 prefix length
421  bool_t onLinkFlag; ///<On-link flag
422  bool_t autonomousFlag; ///<Autonomous flag
423  systime_t validLifetime; ///<Valid lifetime
424  systime_t preferredLifetime; ///<Preferred lifetime
425  bool_t permanent; ///<Permanently assigned prefix
426  systime_t timestamp; ///<Timestamp to manage entry lifetime
428 
429 
430 /**
431  * @brief Default router list entry
432  **/
433 
434 typedef struct
435 {
436  Ipv6Addr addr; ///<Router address
437  systime_t lifetime; ///<Router lifetime
438  uint8_t preference; ///<Preference value
439  bool_t permanent; ///<Permanently assigned router
440  systime_t timestamp; ///<Timestamp to manage entry lifetime
442 
443 
444 /**
445  * @brief IPv6 multicast filter entry
446  **/
447 
448 typedef struct
449 {
450  Ipv6Addr addr; ///<Multicast address
451  uint_t refCount; ///<Reference count for the current entry
452  uint_t state; ///<MLD node state
453  bool_t flag; ///<MLD flag
454  systime_t timer; ///<Delay timer
456 
457 
458 /**
459  * @brief IPv6 context
460  **/
461 
462 typedef struct
463 {
464  size_t linkMtu; ///<Maximum transmission unit
465  bool_t isRouter; ///<A flag indicating whether routing is enabled on this interface
466  uint8_t curHopLimit; ///<Default value for the Hop Limit field
467  bool_t enableMulticastEchoReq; ///<Support for multicast ICMPv6 Echo Request messages
468  Ipv6AddrEntry addrList[IPV6_ADDR_LIST_SIZE]; ///<IPv6 unicast address list
469  Ipv6Addr anycastAddrList[IPV6_ANYCAST_ADDR_LIST_SIZE]; ///<IPv6 anycast address list
470  Ipv6PrefixEntry prefixList[IPV6_PREFIX_LIST_SIZE]; ///<Prefix list
471  Ipv6RouterEntry routerList[IPV6_ROUTER_LIST_SIZE]; ///<Default router list
472  Ipv6Addr dnsServerList[IPV6_DNS_SERVER_LIST_SIZE]; ///<DNS servers
473  Ipv6FilterEntry multicastFilter[IPV6_MULTICAST_FILTER_SIZE]; ///<Multicast filter table
474 #if (IPV6_FRAG_SUPPORT == ENABLED)
475  uint32_t identification; ///<IPv6 fragment identification field
476  Ipv6FragDesc fragQueue[IPV6_MAX_FRAG_DATAGRAMS]; ///<IPv6 fragment reassembly queue
477 #endif
478 } Ipv6Context;
479 
480 
481 //IPv6 related constants
482 extern const Ipv6Addr IPV6_UNSPECIFIED_ADDR;
483 extern const Ipv6Addr IPV6_LOOPBACK_ADDR;
488 
489 //IPv6 related functions
490 error_t ipv6Init(NetInterface *interface);
491 
492 error_t ipv6SetMtu(NetInterface *interface, size_t mtu);
493 error_t ipv6GetMtu(NetInterface *interface, size_t *mtu);
494 
497 
498 error_t ipv6SetGlobalAddr(NetInterface *interface, uint_t index, const Ipv6Addr *addr);
500 
501 error_t ipv6SetAnycastAddr(NetInterface *interface, uint_t index, const Ipv6Addr *addr);
503 
505  uint_t index, const Ipv6Addr *prefix, uint_t length);
506 
508  uint_t index, Ipv6Addr *prefix, uint_t *length);
509 
510 error_t ipv6SetDefaultRouter(NetInterface *interface, uint_t index, const Ipv6Addr *addr);
512 
513 error_t ipv6SetDnsServer(NetInterface *interface, uint_t index, const Ipv6Addr *addr);
515 
516 void ipv6LinkChangeEvent(NetInterface *interface);
517 
518 void ipv6ProcessPacket(NetInterface *interface,
519  NetBuffer *ipPacket, size_t ipPacketOffset);
520 
522  size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset);
523 
525  size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset);
526 
528  size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset);
529 
531  size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset);
532 
534  size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset);
535 
537  size_t ipPacketOffset, size_t optionOffset, size_t optionLen);
538 
539 error_t ipv6SendDatagram(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader,
540  NetBuffer *buffer, size_t offset, uint_t flags);
541 
542 error_t ipv6SendPacket(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader,
543  uint32_t fragId, size_t fragOffset, NetBuffer *buffer, size_t offset,
544  uint_t flags);
545 
548 
551 
552 void ipv6DumpHeader(const Ipv6Header *ipHeader);
553 
554 //C++ guard
555 #ifdef __cplusplus
556 }
557 #endif
558 
559 #endif
@ IPV6_ADDR_STATE_TENTATIVE
An address whose uniqueness on a link is being verified.
Definition: ipv6.h:172
systime_t timestamp
Timestamp to manage entry lifetime.
Definition: ipv6.h:440
error_t ipv6GetPrefix(NetInterface *interface, uint_t index, Ipv6Addr *prefix, uint_t *length)
Retrieve IPv6 prefix.
Definition: ipv6.c:568
@ IPV6_ESP_HEADER
Definition: ipv6.h:189
bool_t enableMulticastEchoReq
Support for multicast ICMPv6 Echo Request messages.
Definition: ipv6.h:467
systime_t lifetime
Router lifetime.
Definition: ipv6.h:437
error_t ipv6SetGlobalAddr(NetInterface *interface, uint_t index, const Ipv6Addr *addr)
Assign global address.
Definition: ipv6.c:300
int bool_t
Definition: compiler_port.h:49
error_t ipv6GetGlobalAddr(NetInterface *interface, uint_t index, Ipv6Addr *addr)
Retrieve global address.
Definition: ipv6.c:339
uint32_t identification
IPv6 fragment identification field.
Definition: ipv6.h:475
__start_packed struct @184 Ipv6EspHeader
IPv6 Encapsulating Security Payload header.
uint8_t routingType
Definition: ipv6.h:316
uint32_t reserved
Definition: ipv6.h:318
error_t ipv6ParseOptions(NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t optionOffset, size_t optionLen)
Parse IPv6 options.
Definition: ipv6.c:1451
@ IPV6_ADDR_SCOPE_INTERFACE_LOCAL
Definition: ipv6.h:156
uint8_t flowLabelH
Definition: ipv6.h:271
const Ipv6Addr IPV6_UNSPECIFIED_ADDR
Definition: ipv6.c:67
uint8_t curHopLimit
Default value for the Hop Limit field.
Definition: ipv6.h:466
systime_t preferredLifetime
Preferred lifetime.
Definition: ipv6.h:424
error_t ipv6JoinMulticastGroup(NetInterface *interface, const Ipv6Addr *groupAddr)
Join an IPv6 multicast group.
Definition: ipv6.c:1928
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:88
uint_t dadRetransmitCount
Retransmission counter for Duplicate Address Detection.
Definition: ipv6.h:409
Ipv6Addr destAddr
Definition: ipv6.h:382
uint8_t nextHeader
Definition: ipv6.h:329
Ipv6NextHeaderType
IPv6 Next Header types.
Definition: ipv6.h:182
@ IPV6_FLAG_RES1
Definition: ipv6.h:204
error_t ipv6SetAnycastAddr(NetInterface *interface, uint_t index, const Ipv6Addr *addr)
Assign anycast address.
Definition: ipv6.c:391
error_t ipv6SendDatagram(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset, uint_t flags)
Send an IPv6 datagram.
Definition: ipv6.c:1576
Ipv6Addr addr
IPv6 address.
Definition: ipv6.h:401
Ipv6Addr srcAddr
Definition: ipv6.h:278
systime_t preferredLifetime
Preferred lifetime.
Definition: ipv6.h:405
#define Ipv6Header
Definition: ipv6.h:36
systime_t timestamp
Timestamp to manage entry lifetime.
Definition: ipv6.h:426
bool_t autonomousFlag
Autonomous flag.
Definition: ipv6.h:422
systime_t validLifetime
Valid lifetime.
Definition: ipv6.h:423
@ IPV6_FLAG_RES2
Definition: ipv6.h:205
error_t ipv6SendPacket(NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, uint32_t fragId, size_t fragOffset, NetBuffer *buffer, size_t offset, uint_t flags)
Send an IPv6 packet.
Definition: ipv6.c:1649
uint32_t securityParamIndex
Definition: ipv6.h:345
@ IPV6_OPTION_TYPE_PAD1
Definition: ipv6.h:217
@ IPV6_ICMPV6_HEADER
Definition: ipv6.h:191
Ipv6Addr prefix
IPv6 prefix information.
Definition: ipv6.h:419
uint_t state
MLD node state.
Definition: ipv6.h:452
char_t * ipv6AddrToString(const Ipv6Addr *ipAddr, char_t *str)
Convert a binary IPv6 address to a string representation.
Definition: ipv6.c:2254
@ IPV6_ACTION_SEND_ICMP_ERROR_ALL
Definition: ipv6.h:231
__start_packed struct @185 Ipv6Option
IPv6 option.
@ IPV6_ACTION_DISCARD_PACKET
Definition: ipv6.h:230
uint32_t reserved
Definition: ipv6.h:384
Ipv6Addr addr
Router address.
Definition: ipv6.h:436
uint8_t trafficClassL
Definition: ipv6.h:272
Ipv6Addr prefix
error_t ipv6GetLinkLocalAddr(NetInterface *interface, Ipv6Addr *addr)
Retrieve link-local address.
Definition: ipv6.c:257
IPv6 context.
Definition: ipv6.h:462
uint8_t length
Definition: ipv6.h:370
@ IPV6_ADDR_STATE_INVALID
An address that is not assigned to any interface.
Definition: ipv6.h:171
void ipv6DumpHeader(const Ipv6Header *ipHeader)
Dump IPv6 header for debugging purpose.
Definition: ipv6.c:2323
Ethernet.
@ IPV6_OFFSET_MASK
Definition: ipv6.h:203
uint8_t ipPacket[]
Definition: ndp.h:430
error_t ipv6ParseAuthHeader(NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
Parse Authentication header.
Definition: ipv6.c:1411
systime_t timer
Delay timer.
Definition: ipv6.h:454
Ipv6AddrScope
IPv6 address scopes.
Definition: ipv6.h:154
@ IPV6_ADDR_SCOPE_ADMIN_LOCAL
Definition: ipv6.h:158
error_t ipv6ParseDestOptHeader(NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
Parse Destination Options header.
Definition: ipv6.c:1277
Ipv6AddrState
IPv6 address state.
Definition: ipv6.h:169
Ipv6FragmentOffset
IPv6 fragment offset field.
Definition: ipv6.h:201
uint16_t payloadLen
Definition: ipv6.h:275
error_t
Error codes.
Definition: error.h:42
uint32_t identification
Definition: ipv6.h:332
#define Ipv6PseudoHeader
Definition: ipv6.h:42
@ IPV6_ACTION_SKIP_OPTION
Definition: ipv6.h:229
systime_t dadTimeout
Timeout value for Duplicate Address Detection.
Definition: ipv6.h:408
Prefix list entry.
Definition: ipv6.h:417
uint8_t b[16]
Definition: ipv6.h:250
uint8_t payloadData[]
Definition: ipv6.h:359
@ IPV6_UDP_HEADER
Definition: ipv6.h:186
uint8_t version
Definition: ipv6.h:270
uint8_t hdrExtLen
Definition: ipv6.h:291
uint8_t preference
Preference value.
Definition: ipv6.h:438
error_t ipv6SetDefaultRouter(NetInterface *interface, uint_t index, const Ipv6Addr *addr)
Configure default router.
Definition: ipv6.c:623
uint8_t reserved
Definition: ipv6.h:330
bool_t permanent
Permanently assigned address.
Definition: ipv6.h:406
#define NetInterface
Definition: net.h:36
uint32_t length
Definition: ipv6.h:383
void ipv6LinkChangeEvent(NetInterface *interface)
Callback function for link change event.
Definition: ipv6.c:797
void ipv6ProcessPacket(NetInterface *interface, NetBuffer *ipPacket, size_t ipPacketOffset)
Incoming IPv6 packet processing.
Definition: ipv6.c:887
error_t ipv6Init(NetInterface *interface)
IPv6 related initialization.
Definition: ipv6.c:97
uint8_t nextHeader
Definition: ipv6.h:290
@ IPV6_ADDR_SCOPE_GLOBAL
Definition: ipv6.h:161
uint32_t nextHeader
Definition: ipv6.h:385
@ IPV6_HOP_BY_HOP_OPT_HEADER
Definition: ipv6.h:184
const Ipv6Addr IPV6_LINK_LOCAL_ADDR_PREFIX
Definition: ipv6.c:83
uint8_t hopLimit
Definition: ipv6.h:277
#define IPV6_MULTICAST_FILTER_SIZE
Definition: ipv6.h:101
error_t ipv6ParseRoutingHeader(NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
Parse Routing header.
Definition: ipv6.c:1340
bool_t flag
MLD flag.
Definition: ipv6.h:453
uint8_t fragOffset[3]
Definition: dtls_misc.h:189
__start_packed struct @179 Ipv6Addr
IPv6 network address.
Fragmented packet descriptor.
Definition: ipv6_frag.h:130
#define IPV6_DNS_SERVER_LIST_SIZE
Definition: ipv6.h:94
uint_t refCount
Reference count for the current entry.
Definition: ipv6.h:451
bool_t duplicate
The address is a duplicate.
Definition: ipv6.h:403
@ IPV6_ADDR_SCOPE_LINK_LOCAL
Definition: ipv6.h:157
error_t ipv6GetDefaultRouter(NetInterface *interface, uint_t index, Ipv6Addr *addr)
Retrieve default router.
Definition: ipv6.c:680
error_t ipv6LeaveMulticastGroup(NetInterface *interface, const Ipv6Addr *groupAddr)
Leave an IPv6 multicast group.
Definition: ipv6.c:2038
uint32_t mtu
Definition: icmpv6.h:173
uint8_t nextHeader
Definition: ipv6.h:276
const Ipv6Addr IPV6_LINK_LOCAL_ALL_NODES_ADDR
Definition: ipv6.c:75
Ipv6Addr addr
Multicast address.
Definition: ipv6.h:450
uint8_t type
Definition: ipv6.h:369
bool_t onLinkFlag
On-link flag.
Definition: ipv6.h:421
error_t ipv6SetDnsServer(NetInterface *interface, uint_t index, const Ipv6Addr *addr)
Configure DNS server.
Definition: ipv6.c:731
IPv6 fragmentation and reassembly.
bool_t permanent
Permanently assigned prefix.
Definition: ipv6.h:425
uint8_t flags
Definition: tcp.h:314
error_t ipv6SetPrefix(NetInterface *interface, uint_t index, const Ipv6Addr *prefix, uint_t length)
Configure IPv6 prefix.
Definition: ipv6.c:504
error_t ipv6ParseEspHeader(NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
Parse Encapsulating Security Payload header.
Definition: ipv6.c:1431
char char_t
Definition: compiler_port.h:43
__start_packed struct @180 Ipv6HopByHopOptHeader
IPv6 Hop-by-Hop Options header.
uint32_t dw[4]
Definition: ipv6.h:252
uint8_t prefixLen
IPv6 prefix length.
Definition: ipv6.h:420
const Ipv6Addr IPV6_LOOPBACK_ADDR
Definition: ipv6.c:71
error_t ipv6SetLinkLocalAddr(NetInterface *interface, const Ipv6Addr *addr)
Assign link-local address.
Definition: ipv6.c:219
#define IPV6_ANYCAST_ADDR_LIST_SIZE
Definition: ipv6.h:73
Ipv6OptionType
IPv6 option types.
Definition: ipv6.h:214
Default router list entry.
Definition: ipv6.h:434
IPv6 address entry.
Definition: ipv6.h:399
uint8_t data[]
Definition: ipv6.h:371
@ IPV6_TCP_HEADER
Definition: ipv6.h:185
#define IPV6_ROUTER_LIST_SIZE
Definition: ipv6.h:87
uint16_t w[8]
Definition: ipv6.h:251
Ipv6Addr destAddr
Definition: ipv6.h:279
#define IPV6_ADDR_LIST_SIZE
Definition: ipv6.h:66
Ipv6Addr address[]
Definition: ipv6.h:319
@ IPV6_NO_NEXT_HEADER
Definition: ipv6.h:192
uint8_t authData[]
Definition: ipv6.h:347
@ IPV6_OPTION_TYPE_MASK
Definition: ipv6.h:216
@ IPV6_ADDR_SCOPE_ORGANIZATION_LOCAL
Definition: ipv6.h:160
uint8_t trafficClassH
Definition: ipv6.h:269
error_t ipv6GetAnycastAddr(NetInterface *interface, uint_t index, Ipv6Addr *addr)
Retrieve anycast address.
Definition: ipv6.c:469
error_t ipv6ParseHopByHopOptHeader(NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
Parse Hop-by-Hop Options header.
Definition: ipv6.c:1199
uint16_t fragmentOffset
Definition: ipv6.h:331
@ IPV6_FLAG_M
Definition: ipv6.h:206
Ipv4Addr groupAddr
Definition: igmp.h:127
__start_packed struct _Ipv6Header __end_packed
__start_packed struct @181 Ipv6DestOptHeader
IPv6 Destination Options header.
uint32_t sequenceNumber
Definition: ipv6.h:346
uint16_t flowLabelL
Definition: ipv6.h:274
IPv6 pseudo header.
Definition: ipv6.h:379
systime_t validLifetime
Valid lifetime.
Definition: ipv6.h:404
@ IPV6_ADDR_SCOPE_SITE_LOCAL
Definition: ipv6.h:159
IPv6 Fragment header.
Definition: ipv6.h:327
Ipv4Addr addr
Definition: nbns_common.h:121
bool_t isRouter
A flag indicating whether routing is enabled on this interface.
Definition: ipv6.h:465
uint8_t payloadLen
Definition: ipv6.h:343
@ IPV6_OPTION_TYPE_PADN
Definition: ipv6.h:218
@ IPV6_ADDR_STATE_PREFERRED
An address assigned to an interface whose use is unrestricted.
Definition: ipv6.h:173
bool_t permanent
Permanently assigned router.
Definition: ipv6.h:439
uint8_t segmentsLeft
Definition: ipv6.h:317
Ipv6AddrState state
IPv6 address state.
Definition: ipv6.h:402
uint8_t payload[]
Definition: ipv6.h:280
Ipv6Addr srcAddr
Definition: ipv6.h:381
#define IPV6_PREFIX_LIST_SIZE
Definition: ipv6.h:80
__start_packed struct @183 Ipv6AuthHeader
IPv6 Authentication header.
unsigned int uint_t
Definition: compiler_port.h:45
#define IPV6_MAX_FRAG_DATAGRAMS
Definition: ipv6_frag.h:62
TCP/IP stack core.
error_t ipv6SetMtu(NetInterface *interface, size_t mtu)
Change the MTU of a network interface.
Definition: ipv6.c:149
@ IPV6_ROUTING_HEADER
Definition: ipv6.h:187
@ IPV6_ADDR_STATE_DEPRECATED
An address assigned to an interface whose use is discouraged.
Definition: ipv6.h:174
const Ipv6Addr IPV6_SOLICITED_NODE_ADDR_PREFIX
Definition: ipv6.c:87
error_t ipv6GetDnsServer(NetInterface *interface, uint_t index, Ipv6Addr *addr)
Retrieve DNS server.
Definition: ipv6.c:765
const Ipv6Addr IPV6_LINK_LOCAL_ALL_ROUTERS_ADDR
Definition: ipv6.c:79
error_t ipv6GetMtu(NetInterface *interface, size_t *mtu)
Retrieve the MTU for the specified interface.
Definition: ipv6.c:194
size_t linkMtu
Maximum transmission unit.
Definition: ipv6.h:464
uint32_t systime_t
Definition: compiler_port.h:46
uint8_t ipAddr[4]
Definition: mib_common.h:187
@ IPV6_DEST_OPT_HEADER
Definition: ipv6.h:193
Ipv6Actions
Actions to be taken for unrecognized options.
Definition: ipv6.h:226
uint8_t options[]
Definition: ipv6.h:292
@ IPV6_ACTION_SEND_ICMP_ERROR_UNI
Definition: ipv6.h:232
IPv6 header.
Definition: ipv6.h:261
@ IPV6_AH_HEADER
Definition: ipv6.h:190
@ IPV6_ACTION_MASK
Definition: ipv6.h:228
@ IPV6_FRAGMENT_HEADER
Definition: ipv6.h:188
error_t ipv6StringToAddr(const char_t *str, Ipv6Addr *ipAddr)
Convert a string representation of an IPv6 address to a binary IPv6 address.
Definition: ipv6.c:2114
systime_t timestamp
Timestamp to manage entry lifetime.
Definition: ipv6.h:407
__start_packed struct @182 Ipv6RoutingHeader
IPv6 Type 0 Routing header.
IPv6 multicast filter entry.
Definition: ipv6.h:448