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