IPv6 (Internet Protocol Version 6) More...

#include <string.h>
#include "core/net.h"
#include "core/ethernet.h"
#include "ipv6/ipv6_frag.h"

Go to the source code of this file.

Data Structures

struct  _Ipv6Header
 IPv6 header. More...
 
struct  _Ipv6FragmentHeader
 IPv6 Fragment header. More...
 
struct  _Ipv6PseudoHeader
 IPv6 pseudo header. More...
 
struct  Ipv6AddrEntry
 IPv6 address entry. More...
 
struct  Ipv6PrefixEntry
 Prefix list entry. More...
 
struct  Ipv6RouterEntry
 Default router list entry. More...
 
struct  Ipv6FilterEntry
 IPv6 multicast filter entry. More...
 
struct  Ipv6Context
 IPv6 context. More...
 

Macros

#define Ipv6Header   struct _Ipv6Header
 
#define Ipv6FragmentHeader   struct _Ipv6FragmentHeader
 
#define Ipv6PseudoHeader   struct _Ipv6PseudoHeader
 
#define IPV6_SUPPORT   DISABLED
 
#define IPV6_DEFAULT_HOP_LIMIT   64
 
#define IPV6_ADDR_LIST_SIZE   3
 
#define IPV6_ANYCAST_ADDR_LIST_SIZE   1
 
#define IPV6_PREFIX_LIST_SIZE   2
 
#define IPV6_ROUTER_LIST_SIZE   2
 
#define IPV6_DNS_SERVER_LIST_SIZE   2
 
#define IPV6_MULTICAST_FILTER_SIZE   8
 
#define IPV6_VERSION   6
 
#define IPV6_DEFAULT_MTU   1280
 
#define IPV6_ADDR(a, b, c, d, e, f, g, h)
 
#define ipv6CopyAddr(destIpAddr, srcIpAddr)   memcpy(destIpAddr, srcIpAddr, sizeof(Ipv6Addr))
 
#define ipv6CompAddr(ipAddr1, ipAddr2)   (!memcmp(ipAddr1, ipAddr2, sizeof(Ipv6Addr)))
 
#define ipv6IsLinkLocalUnicastAddr(ipAddr)   ((ipAddr)->b[0] == 0xFE && ((ipAddr)->b[1] & 0xC0) == 0x80)
 
#define ipv6IsSiteLocalUnicastAddr(ipAddr)   ((ipAddr)->b[0] == 0xFE && ((ipAddr)->b[1] & 0xC0) == 0xC0)
 
#define ipv6IsMulticastAddr(ipAddr)   ((ipAddr)->b[0] == 0xFF)
 
#define ipv6IsSolicitedNodeAddr(ipAddr)   ipv6CompPrefix(ipAddr, &IPV6_SOLICITED_NODE_ADDR_PREFIX, 104)
 
#define ipv6GetLinkLocalAddrState(interface)   (interface->ipv6Context.addrList[0].state)
 

Typedefs

struct {
   union {
      uint8_t   b [16]
 
      uint16_t   w [8]
 
      uint32_t   dw [4]
 
   } 
 
Ipv6Addr
 IPv6 network address. More...
 
struct {
   uint8_t   nextHeader
 
   uint8_t   hdrExtLen
 
   uint8_t   options []
 
Ipv6HopByHopOptHeader
 IPv6 Hop-by-Hop Options header. More...
 
struct {
   uint8_t   nextHeader
 
   uint8_t   hdrExtLen
 
   uint8_t   options []
 
Ipv6DestOptHeader
 IPv6 Destination Options header. More...
 
struct {
   uint8_t   nextHeader
 
   uint8_t   hdrExtLen
 
   uint8_t   routingType
 
   uint8_t   segmentsLeft
 
   uint32_t   reserved
 
   Ipv6Addr   address []
 
Ipv6RoutingHeader
 IPv6 Type 0 Routing header. More...
 
struct {
   uint8_t   nextHeader
 
   uint8_t   payloadLen
 
   uint16_t   reserved
 
   uint32_t   securityParamIndex
 
   uint32_t   sequenceNumber
 
   uint8_t   authData []
 
Ipv6AuthHeader
 IPv6 Authentication header. More...
 
struct {
   uint32_t   securityParamIndex
 
   uint32_t   sequenceNumber
 
   uint8_t   payloadData []
 
Ipv6EspHeader
 IPv6 Encapsulating Security Payload header. More...
 
struct {
   uint8_t   type
 
   uint8_t   length
 
   uint8_t   data []
 
Ipv6Option
 IPv6 option. More...
 

Enumerations

enum  Ipv6AddrScope {
  IPV6_ADDR_SCOPE_INTERFACE_LOCAL = 1, IPV6_ADDR_SCOPE_LINK_LOCAL = 2, IPV6_ADDR_SCOPE_ADMIN_LOCAL = 4, IPV6_ADDR_SCOPE_SITE_LOCAL = 5,
  IPV6_ADDR_SCOPE_ORGANIZATION_LOCAL = 8, IPV6_ADDR_SCOPE_GLOBAL = 14
}
 IPv6 address scopes. More...
 
enum  Ipv6AddrState { IPV6_ADDR_STATE_INVALID = 0, IPV6_ADDR_STATE_TENTATIVE = 1, IPV6_ADDR_STATE_PREFERRED = 2, IPV6_ADDR_STATE_DEPRECATED = 3 }
 IPv6 address state. More...
 
enum  Ipv6NextHeaderType {
  IPV6_HOP_BY_HOP_OPT_HEADER = 0, IPV6_TCP_HEADER = 6, IPV6_UDP_HEADER = 17, IPV6_ROUTING_HEADER = 43,
  IPV6_FRAGMENT_HEADER = 44, IPV6_ESP_HEADER = 50, IPV6_AH_HEADER = 51, IPV6_ICMPV6_HEADER = 58,
  IPV6_NO_NEXT_HEADER = 59, IPV6_DEST_OPT_HEADER = 60
}
 IPv6 Next Header types. More...
 
enum  Ipv6FragmentOffset { IPV6_OFFSET_MASK = 0xFFF8, IPV6_FLAG_RES1 = 0x0004, IPV6_FLAG_RES2 = 0x0002, IPV6_FLAG_M = 0x0001 }
 IPv6 fragment offset field. More...
 
enum  Ipv6OptionType { IPV6_OPTION_TYPE_MASK = 0x1F, IPV6_OPTION_TYPE_PAD1 = 0x00, IPV6_OPTION_TYPE_PADN = 0x01 }
 IPv6 option types. More...
 
enum  Ipv6Actions {
  IPV6_ACTION_MASK = 0xC0, IPV6_ACTION_SKIP_OPTION = 0x00, IPV6_ACTION_DISCARD_PACKET = 0x40, IPV6_ACTION_SEND_ICMP_ERROR_ALL = 0x80,
  IPV6_ACTION_SEND_ICMP_ERROR_UNI = 0xC0
}
 Actions to be taken for unrecognized options. More...
 

Functions

error_t ipv6Init (NetInterface *interface)
 IPv6 related initialization. More...
 
error_t ipv6SetMtu (NetInterface *interface, size_t mtu)
 Change the MTU of a network interface. More...
 
error_t ipv6GetMtu (NetInterface *interface, size_t *mtu)
 Retrieve the MTU for the specified interface. More...
 
error_t ipv6SetLinkLocalAddr (NetInterface *interface, const Ipv6Addr *addr)
 Assign link-local address. More...
 
error_t ipv6GetLinkLocalAddr (NetInterface *interface, Ipv6Addr *addr)
 Retrieve link-local address. More...
 
error_t ipv6SetGlobalAddr (NetInterface *interface, uint_t index, const Ipv6Addr *addr)
 Assign global address. More...
 
error_t ipv6GetGlobalAddr (NetInterface *interface, uint_t index, Ipv6Addr *addr)
 Retrieve global address. More...
 
error_t ipv6SetAnycastAddr (NetInterface *interface, uint_t index, const Ipv6Addr *addr)
 Assign anycast address. More...
 
error_t ipv6GetAnycastAddr (NetInterface *interface, uint_t index, Ipv6Addr *addr)
 Retrieve anycast address. More...
 
error_t ipv6SetPrefix (NetInterface *interface, uint_t index, const Ipv6Addr *prefix, uint_t length)
 Configure IPv6 prefix. More...
 
error_t ipv6GetPrefix (NetInterface *interface, uint_t index, Ipv6Addr *prefix, uint_t *length)
 Retrieve IPv6 prefix. More...
 
error_t ipv6SetDefaultRouter (NetInterface *interface, uint_t index, const Ipv6Addr *addr)
 Configure default router. More...
 
error_t ipv6GetDefaultRouter (NetInterface *interface, uint_t index, Ipv6Addr *addr)
 Retrieve default router. More...
 
error_t ipv6SetDnsServer (NetInterface *interface, uint_t index, const Ipv6Addr *addr)
 Configure DNS server. More...
 
error_t ipv6GetDnsServer (NetInterface *interface, uint_t index, Ipv6Addr *addr)
 Retrieve DNS server. More...
 
void ipv6LinkChangeEvent (NetInterface *interface)
 Callback function for link change event. More...
 
void ipv6ProcessPacket (NetInterface *interface, NetBuffer *ipPacket, size_t ipPacketOffset)
 Incoming IPv6 packet processing. More...
 
error_t ipv6ParseHopByHopOptHeader (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
 Parse Hop-by-Hop Options header. More...
 
error_t ipv6ParseDestOptHeader (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
 Parse Destination Options header. More...
 
error_t ipv6ParseRoutingHeader (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
 Parse Routing header. More...
 
error_t ipv6ParseAuthHeader (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
 Parse Authentication header. More...
 
error_t ipv6ParseEspHeader (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
 Parse Encapsulating Security Payload header. More...
 
error_t ipv6ParseOptions (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t optionOffset, size_t optionLen)
 Parse IPv6 options. More...
 
error_t ipv6SendDatagram (NetInterface *interface, Ipv6PseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset, uint8_t hopLimit)
 Send an IPv6 datagram. More...
 
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. More...
 
error_t ipv6JoinMulticastGroup (NetInterface *interface, const Ipv6Addr *groupAddr)
 Join an IPv6 multicast group. More...
 
error_t ipv6LeaveMulticastGroup (NetInterface *interface, const Ipv6Addr *groupAddr)
 Leave an IPv6 multicast group. More...
 
void ipv6UpdateInStats (NetInterface *interface, const Ipv6Addr *destIpAddr, size_t length)
 Update IPv6 input statistics. More...
 
void ipv6UpdateOutStats (NetInterface *interface, const Ipv6Addr *destIpAddr, size_t length)
 Update IPv6 output statistics. More...
 
error_t ipv6StringToAddr (const char_t *str, Ipv6Addr *ipAddr)
 Convert a string representation of an IPv6 address to a binary IPv6 address. More...
 
char_tipv6AddrToString (const Ipv6Addr *ipAddr, char_t *str)
 Convert a binary IPv6 address to a string representation. More...
 
void ipv6DumpHeader (const Ipv6Header *ipHeader)
 Dump IPv6 header for debugging purpose. More...
 

Variables

__start_packed struct _Ipv6Header __end_packed
 
const Ipv6Addr IPV6_UNSPECIFIED_ADDR
 
const Ipv6Addr IPV6_LOOPBACK_ADDR
 
const Ipv6Addr IPV6_LINK_LOCAL_ALL_NODES_ADDR
 
const Ipv6Addr IPV6_LINK_LOCAL_ALL_ROUTERS_ADDR
 
const Ipv6Addr IPV6_LINK_LOCAL_ADDR_PREFIX
 
const Ipv6Addr IPV6_SOLICITED_NODE_ADDR_PREFIX
 

Detailed Description

IPv6 (Internet Protocol Version 6)

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file ipv6.h.

Macro Definition Documentation

◆ IPV6_ADDR

#define IPV6_ADDR (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)
Value:
{{{ \
MSB(a), LSB(a), MSB(b), LSB(b), MSB(c), LSB(c), MSB(d), LSB(d), \
MSB(e), LSB(e), MSB(f), LSB(f), MSB(g), LSB(g), MSB(h), LSB(h)}}}
uint8_t c
Definition: ndp.h:510
#define MSB(x)
Definition: os_port.h:56
#define LSB(x)
Definition: os_port.h:52
uint8_t a
Definition: ndp.h:407
uint8_t b[16]
Definition: ipv6.h:248
uint8_t h
Definition: ndp.h:297

Definition at line 110 of file ipv6.h.

◆ IPV6_ADDR_LIST_SIZE

#define IPV6_ADDR_LIST_SIZE   3

Definition at line 64 of file ipv6.h.

◆ IPV6_ANYCAST_ADDR_LIST_SIZE

#define IPV6_ANYCAST_ADDR_LIST_SIZE   1

Definition at line 71 of file ipv6.h.

◆ IPV6_DEFAULT_HOP_LIMIT

#define IPV6_DEFAULT_HOP_LIMIT   64

Definition at line 57 of file ipv6.h.

◆ IPV6_DEFAULT_MTU

#define IPV6_DEFAULT_MTU   1280

Definition at line 107 of file ipv6.h.

◆ IPV6_DNS_SERVER_LIST_SIZE

#define IPV6_DNS_SERVER_LIST_SIZE   2

Definition at line 92 of file ipv6.h.

◆ IPV6_MULTICAST_FILTER_SIZE

#define IPV6_MULTICAST_FILTER_SIZE   8

Definition at line 99 of file ipv6.h.

◆ IPV6_PREFIX_LIST_SIZE

#define IPV6_PREFIX_LIST_SIZE   2

Definition at line 78 of file ipv6.h.

◆ IPV6_ROUTER_LIST_SIZE

#define IPV6_ROUTER_LIST_SIZE   2

Definition at line 85 of file ipv6.h.

◆ IPV6_SUPPORT

#define IPV6_SUPPORT   DISABLED

Definition at line 50 of file ipv6.h.

◆ IPV6_VERSION

#define IPV6_VERSION   6

Definition at line 105 of file ipv6.h.

◆ ipv6CompAddr

#define ipv6CompAddr (   ipAddr1,
  ipAddr2 
)    (!memcmp(ipAddr1, ipAddr2, sizeof(Ipv6Addr)))

Definition at line 119 of file ipv6.h.

◆ ipv6CopyAddr

#define ipv6CopyAddr (   destIpAddr,
  srcIpAddr 
)    memcpy(destIpAddr, srcIpAddr, sizeof(Ipv6Addr))

Definition at line 115 of file ipv6.h.

◆ Ipv6FragmentHeader

#define Ipv6FragmentHeader   struct _Ipv6FragmentHeader

Definition at line 37 of file ipv6.h.

◆ ipv6GetLinkLocalAddrState

#define ipv6GetLinkLocalAddrState (   interface)    (interface->ipv6Context.addrList[0].state)

Definition at line 139 of file ipv6.h.

◆ Ipv6Header

#define Ipv6Header   struct _Ipv6Header

Definition at line 34 of file ipv6.h.

◆ ipv6IsLinkLocalUnicastAddr

#define ipv6IsLinkLocalUnicastAddr (   ipAddr)    ((ipAddr)->b[0] == 0xFE && ((ipAddr)->b[1] & 0xC0) == 0x80)

Definition at line 123 of file ipv6.h.

◆ ipv6IsMulticastAddr

#define ipv6IsMulticastAddr (   ipAddr)    ((ipAddr)->b[0] == 0xFF)

Definition at line 131 of file ipv6.h.

◆ ipv6IsSiteLocalUnicastAddr

#define ipv6IsSiteLocalUnicastAddr (   ipAddr)    ((ipAddr)->b[0] == 0xFE && ((ipAddr)->b[1] & 0xC0) == 0xC0)

Definition at line 127 of file ipv6.h.

◆ ipv6IsSolicitedNodeAddr

#define ipv6IsSolicitedNodeAddr (   ipAddr)    ipv6CompPrefix(ipAddr, &IPV6_SOLICITED_NODE_ADDR_PREFIX, 104)

Definition at line 135 of file ipv6.h.

◆ Ipv6PseudoHeader

#define Ipv6PseudoHeader   struct _Ipv6PseudoHeader

Definition at line 40 of file ipv6.h.

Typedef Documentation

◆ Ipv6Addr

typedef { ... } Ipv6Addr

IPv6 network address.

◆ Ipv6AuthHeader

typedef { ... } Ipv6AuthHeader

IPv6 Authentication header.

◆ Ipv6DestOptHeader

typedef { ... } Ipv6DestOptHeader

IPv6 Destination Options header.

◆ Ipv6EspHeader

typedef { ... } Ipv6EspHeader

IPv6 Encapsulating Security Payload header.

◆ Ipv6HopByHopOptHeader

typedef { ... } Ipv6HopByHopOptHeader

IPv6 Hop-by-Hop Options header.

◆ Ipv6Option

typedef { ... } Ipv6Option

IPv6 option.

◆ Ipv6RoutingHeader

typedef { ... } Ipv6RoutingHeader

IPv6 Type 0 Routing header.

Enumeration Type Documentation

◆ Ipv6Actions

Actions to be taken for unrecognized options.

Enumerator
IPV6_ACTION_MASK 
IPV6_ACTION_SKIP_OPTION 
IPV6_ACTION_DISCARD_PACKET 
IPV6_ACTION_SEND_ICMP_ERROR_ALL 
IPV6_ACTION_SEND_ICMP_ERROR_UNI 

Definition at line 224 of file ipv6.h.

◆ Ipv6AddrScope

IPv6 address scopes.

Enumerator
IPV6_ADDR_SCOPE_INTERFACE_LOCAL 
IPV6_ADDR_SCOPE_LINK_LOCAL 
IPV6_ADDR_SCOPE_ADMIN_LOCAL 
IPV6_ADDR_SCOPE_SITE_LOCAL 
IPV6_ADDR_SCOPE_ORGANIZATION_LOCAL 
IPV6_ADDR_SCOPE_GLOBAL 

Definition at line 152 of file ipv6.h.

◆ Ipv6AddrState

IPv6 address state.

Enumerator
IPV6_ADDR_STATE_INVALID 

An address that is not assigned to any interface.

IPV6_ADDR_STATE_TENTATIVE 

An address whose uniqueness on a link is being verified.

IPV6_ADDR_STATE_PREFERRED 

An address assigned to an interface whose use is unrestricted.

IPV6_ADDR_STATE_DEPRECATED 

An address assigned to an interface whose use is discouraged.

Definition at line 167 of file ipv6.h.

◆ Ipv6FragmentOffset

IPv6 fragment offset field.

Enumerator
IPV6_OFFSET_MASK 
IPV6_FLAG_RES1 
IPV6_FLAG_RES2 
IPV6_FLAG_M 

Definition at line 199 of file ipv6.h.

◆ Ipv6NextHeaderType

IPv6 Next Header types.

Enumerator
IPV6_HOP_BY_HOP_OPT_HEADER 
IPV6_TCP_HEADER 
IPV6_UDP_HEADER 
IPV6_ROUTING_HEADER 
IPV6_FRAGMENT_HEADER 
IPV6_ESP_HEADER 
IPV6_AH_HEADER 
IPV6_ICMPV6_HEADER 
IPV6_NO_NEXT_HEADER 
IPV6_DEST_OPT_HEADER 

Definition at line 180 of file ipv6.h.

◆ Ipv6OptionType

IPv6 option types.

Enumerator
IPV6_OPTION_TYPE_MASK 
IPV6_OPTION_TYPE_PAD1 
IPV6_OPTION_TYPE_PADN 

Definition at line 212 of file ipv6.h.

Function Documentation

◆ ipv6AddrToString()

char_t* ipv6AddrToString ( const Ipv6Addr ipAddr,
char_t str 
)

Convert a binary IPv6 address to a string representation.

Call ipv6AddrToString() to convert an IPv6 address to a text representation. The implementation of ipv6AddrToString() function follows RFC 5952 recommendations

Parameters
[in]ipAddrBinary representation of the IPv6 address
[out]strNULL-terminated string representing the IPv6 address
Returns
Pointer to the formatted string

Definition at line 2298 of file ipv6.c.

◆ ipv6DumpHeader()

void ipv6DumpHeader ( const Ipv6Header ipHeader)

Dump IPv6 header for debugging purpose.

Parameters
[in]ipHeaderIPv6 header

Definition at line 2367 of file ipv6.c.

◆ ipv6GetAnycastAddr()

error_t ipv6GetAnycastAddr ( NetInterface interface,
uint_t  index,
Ipv6Addr addr 
)

Retrieve anycast address.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[out]addrAnycast address
Returns
Error code

Definition at line 467 of file ipv6.c.

◆ ipv6GetDefaultRouter()

error_t ipv6GetDefaultRouter ( NetInterface interface,
uint_t  index,
Ipv6Addr addr 
)

Retrieve default router.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[out]addrDefault router address
Returns
Error code

Definition at line 678 of file ipv6.c.

◆ ipv6GetDnsServer()

error_t ipv6GetDnsServer ( NetInterface interface,
uint_t  index,
Ipv6Addr addr 
)

Retrieve DNS server.

Parameters
[in]interfacePointer to the desired network interface
[in]indexThis parameter selects between the primary and secondary DNS server
[out]addrDNS server address
Returns
Error code

Definition at line 763 of file ipv6.c.

◆ ipv6GetGlobalAddr()

error_t ipv6GetGlobalAddr ( NetInterface interface,
uint_t  index,
Ipv6Addr addr 
)

Retrieve global address.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[out]addrGlobal address
Returns
Error code

Definition at line 337 of file ipv6.c.

◆ ipv6GetLinkLocalAddr()

error_t ipv6GetLinkLocalAddr ( NetInterface interface,
Ipv6Addr addr 
)

Retrieve link-local address.

Parameters
[in]interfacePointer to the desired network interface
[out]addrlink-local address
Returns
Error code

Definition at line 255 of file ipv6.c.

◆ ipv6GetMtu()

error_t ipv6GetMtu ( NetInterface interface,
size_t *  mtu 
)

Retrieve the MTU for the specified interface.

Parameters
[in]interfacePointer to the desired network interface
[out]mtuMaximum transmit unit
Returns
Error code

Definition at line 192 of file ipv6.c.

◆ ipv6GetPrefix()

error_t ipv6GetPrefix ( NetInterface interface,
uint_t  index,
Ipv6Addr prefix,
uint_t length 
)

Retrieve IPv6 prefix.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[out]prefixIPv6 prefix
[out]lengthThe number of leading bits in the prefix that are valid
Returns
Error code

Definition at line 566 of file ipv6.c.

◆ ipv6Init()

error_t ipv6Init ( NetInterface interface)

IPv6 related initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 95 of file ipv6.c.

◆ ipv6JoinMulticastGroup()

error_t ipv6JoinMulticastGroup ( NetInterface interface,
const Ipv6Addr groupAddr 
)

Join an IPv6 multicast group.

Parameters
[in]interfaceUnderlying network interface
[in]groupAddrIPv6 Multicast address to join
Returns
Error code

Definition at line 1904 of file ipv6.c.

◆ ipv6LeaveMulticastGroup()

error_t ipv6LeaveMulticastGroup ( NetInterface interface,
const Ipv6Addr groupAddr 
)

Leave an IPv6 multicast group.

Parameters
[in]interfaceUnderlying network interface
[in]groupAddrIPv6 multicast address to drop
Returns
Error code

Definition at line 2014 of file ipv6.c.

◆ ipv6LinkChangeEvent()

void ipv6LinkChangeEvent ( NetInterface interface)

Callback function for link change event.

Parameters
[in]interfaceUnderlying network interface

Definition at line 795 of file ipv6.c.

◆ ipv6ParseAuthHeader()

error_t ipv6ParseAuthHeader ( NetInterface interface,
const NetBuffer ipPacket,
size_t  ipPacketOffset,
size_t *  headerOffset,
size_t *  nextHeaderOffset 
)

Parse Authentication header.

Parameters
[in]interfaceUnderlying network interface
[in]ipPacketMulti-part buffer containing the IPv6 packet
[in]ipPacketOffsetOffset to the first byte of the IPv6 packet
[in,out]headerOffsetOffset to the Authentication header
[in,out]nextHeaderOffsetOffset to the Next Header field Error code

Definition at line 1409 of file ipv6.c.

◆ ipv6ParseDestOptHeader()

error_t ipv6ParseDestOptHeader ( NetInterface interface,
const NetBuffer ipPacket,
size_t  ipPacketOffset,
size_t *  headerOffset,
size_t *  nextHeaderOffset 
)

Parse Destination Options header.

Parameters
[in]interfaceUnderlying network interface
[in]ipPacketMulti-part buffer containing the IPv6 packet
[in]ipPacketOffsetOffset to the first byte of the IPv6 packet
[in,out]headerOffsetOffset to the Destination Options header
[in,out]nextHeaderOffsetOffset to the Next Header field Error code

Definition at line 1275 of file ipv6.c.

◆ ipv6ParseEspHeader()

error_t ipv6ParseEspHeader ( NetInterface interface,
const NetBuffer ipPacket,
size_t  ipPacketOffset,
size_t *  headerOffset,
size_t *  nextHeaderOffset 
)

Parse Encapsulating Security Payload header.

Parameters
[in]interfaceUnderlying network interface
[in]ipPacketMulti-part buffer containing the IPv6 packet
[in]ipPacketOffsetOffset to the first byte of the IPv6 packet
[in,out]headerOffsetOffset to the Encapsulating Security Payload header
[in,out]nextHeaderOffsetOffset to the Next Header field Error code

Definition at line 1429 of file ipv6.c.

◆ ipv6ParseHopByHopOptHeader()

error_t ipv6ParseHopByHopOptHeader ( NetInterface interface,
const NetBuffer ipPacket,
size_t  ipPacketOffset,
size_t *  headerOffset,
size_t *  nextHeaderOffset 
)

Parse Hop-by-Hop Options header.

Parameters
[in]interfaceUnderlying network interface
[in]ipPacketMulti-part buffer containing the IPv6 packet
[in]ipPacketOffsetOffset to the first byte of the IPv6 packet
[in,out]headerOffsetOffset to the Hop-by-Hop Options header
[in,out]nextHeaderOffsetOffset to the Next Header field Error code

Definition at line 1197 of file ipv6.c.

◆ ipv6ParseOptions()

error_t ipv6ParseOptions ( NetInterface interface,
const NetBuffer ipPacket,
size_t  ipPacketOffset,
size_t  optionOffset,
size_t  optionLen 
)

Parse IPv6 options.

Parameters
[in]interfaceUnderlying network interface
[in]ipPacketMulti-part buffer containing the IPv6 packet
[in]ipPacketOffsetOffset to the first byte of the IPv6 packet
[in]optionOffsetOffset to the first byte of the Options field
[in]optionLenLength of the Options field Error code

Definition at line 1449 of file ipv6.c.

◆ ipv6ParseRoutingHeader()

error_t ipv6ParseRoutingHeader ( NetInterface interface,
const NetBuffer ipPacket,
size_t  ipPacketOffset,
size_t *  headerOffset,
size_t *  nextHeaderOffset 
)

Parse Routing header.

Parameters
[in]interfaceUnderlying network interface
[in]ipPacketMulti-part buffer containing the IPv6 packet
[in]ipPacketOffsetOffset to the first byte of the IPv6 packet
[in,out]headerOffsetOffset to the Routing header
[in,out]nextHeaderOffsetOffset to the Next Header field Error code

Definition at line 1338 of file ipv6.c.

◆ ipv6ProcessPacket()

void ipv6ProcessPacket ( NetInterface interface,
NetBuffer ipPacket,
size_t  ipPacketOffset 
)

Incoming IPv6 packet processing.

Parameters
[in]interfaceUnderlying network interface
[in]ipPacketMulti-part buffer that holds the incoming IPv6 packet
[in]ipPacketOffsetOffset to the first byte of the IPv6 packet

Definition at line 885 of file ipv6.c.

◆ ipv6SendDatagram()

error_t ipv6SendDatagram ( NetInterface interface,
Ipv6PseudoHeader pseudoHeader,
NetBuffer buffer,
size_t  offset,
uint8_t  hopLimit 
)

Send an IPv6 datagram.

Parameters
[in]interfaceUnderlying network interface
[in]pseudoHeaderIPv6 pseudo header
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
[in]hopLimitHop Limit value. Default value is used when this parameter is zero
Returns
Error code

Definition at line 1574 of file ipv6.c.

◆ ipv6SendPacket()

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.

Parameters
[in]interfaceUnderlying network interface
[in]pseudoHeaderIPv6 pseudo header
[in]fragIdFragment identification field
[in]fragOffsetFragment offset field
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
[in]hopLimitHop Limit value
Returns
Error code

Definition at line 1647 of file ipv6.c.

◆ ipv6SetAnycastAddr()

error_t ipv6SetAnycastAddr ( NetInterface interface,
uint_t  index,
const Ipv6Addr addr 
)

Assign anycast address.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[in]addrAnycast address
Returns
Error code

Definition at line 389 of file ipv6.c.

◆ ipv6SetDefaultRouter()

error_t ipv6SetDefaultRouter ( NetInterface interface,
uint_t  index,
const Ipv6Addr addr 
)

Configure default router.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[in]addrDefault router address
Returns
Error code

Definition at line 621 of file ipv6.c.

◆ ipv6SetDnsServer()

error_t ipv6SetDnsServer ( NetInterface interface,
uint_t  index,
const Ipv6Addr addr 
)

Configure DNS server.

Parameters
[in]interfacePointer to the desired network interface
[in]indexThis parameter selects between the primary and secondary DNS server
[in]addrDNS server address
Returns
Error code

Definition at line 729 of file ipv6.c.

◆ ipv6SetGlobalAddr()

error_t ipv6SetGlobalAddr ( NetInterface interface,
uint_t  index,
const Ipv6Addr addr 
)

Assign global address.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[in]addrGlobal address
Returns
Error code

Definition at line 298 of file ipv6.c.

◆ ipv6SetLinkLocalAddr()

error_t ipv6SetLinkLocalAddr ( NetInterface interface,
const Ipv6Addr addr 
)

Assign link-local address.

Parameters
[in]interfacePointer to the desired network interface
[in]addrLink-local address
Returns
Error code

Definition at line 217 of file ipv6.c.

◆ ipv6SetMtu()

error_t ipv6SetMtu ( NetInterface interface,
size_t  mtu 
)

Change the MTU of a network interface.

Parameters
[in]interfacePointer to the desired network interface
[in]mtuMaximum transmit unit
Returns
Error code

Definition at line 147 of file ipv6.c.

◆ ipv6SetPrefix()

error_t ipv6SetPrefix ( NetInterface interface,
uint_t  index,
const Ipv6Addr prefix,
uint_t  length 
)

Configure IPv6 prefix.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
[in]prefixIPv6 prefix
[in]lengthThe number of leading bits in the prefix that are valid

Definition at line 502 of file ipv6.c.

◆ ipv6StringToAddr()

error_t ipv6StringToAddr ( const char_t str,
Ipv6Addr ipAddr 
)

Convert a string representation of an IPv6 address to a binary IPv6 address.

Parameters
[in]strNULL-terminated string representing the IPv6 address
[out]ipAddrBinary representation of the IPv6 address
Returns
Error code

Definition at line 2158 of file ipv6.c.

◆ ipv6UpdateInStats()

void ipv6UpdateInStats ( NetInterface interface,
const Ipv6Addr destIpAddr,
size_t  length 
)

Update IPv6 input statistics.

Parameters
[in]interfaceUnderlying network interface
[in]destIpAddrDestination IP address
[in]lengthLength of the incoming IP packet

Definition at line 2090 of file ipv6.c.

◆ ipv6UpdateOutStats()

void ipv6UpdateOutStats ( NetInterface interface,
const Ipv6Addr destIpAddr,
size_t  length 
)

Update IPv6 output statistics.

Parameters
[in]interfaceUnderlying network interface
[in]destIpAddrDestination IP address
[in]lengthLength of the outgoing IP packet

Definition at line 2117 of file ipv6.c.

Variable Documentation

◆ __end_packed

__start_packed struct _Ipv6PseudoHeader __end_packed

◆ address

Ipv6Addr address[]

Definition at line 317 of file ipv6.h.

◆ authData

uint8_t authData[]

Definition at line 345 of file ipv6.h.

◆ b

uint8_t b[16]

Definition at line 248 of file ipv6.h.

◆ data

uint8_t data[]

Definition at line 369 of file ipv6.h.

◆ dw

uint32_t dw[4]

Definition at line 250 of file ipv6.h.

◆ hdrExtLen

uint8_t hdrExtLen

Definition at line 289 of file ipv6.h.

◆ IPV6_LINK_LOCAL_ADDR_PREFIX

const Ipv6Addr IPV6_LINK_LOCAL_ADDR_PREFIX

Definition at line 81 of file ipv6.c.

◆ IPV6_LINK_LOCAL_ALL_NODES_ADDR

const Ipv6Addr IPV6_LINK_LOCAL_ALL_NODES_ADDR

Definition at line 73 of file ipv6.c.

◆ IPV6_LINK_LOCAL_ALL_ROUTERS_ADDR

const Ipv6Addr IPV6_LINK_LOCAL_ALL_ROUTERS_ADDR

Definition at line 77 of file ipv6.c.

◆ IPV6_LOOPBACK_ADDR

const Ipv6Addr IPV6_LOOPBACK_ADDR

Definition at line 69 of file ipv6.c.

◆ IPV6_SOLICITED_NODE_ADDR_PREFIX

const Ipv6Addr IPV6_SOLICITED_NODE_ADDR_PREFIX

Definition at line 85 of file ipv6.c.

◆ IPV6_UNSPECIFIED_ADDR

const Ipv6Addr IPV6_UNSPECIFIED_ADDR

Definition at line 65 of file ipv6.c.

◆ length

uint8_t length

Definition at line 368 of file ipv6.h.

◆ nextHeader

uint8_t nextHeader

Definition at line 288 of file ipv6.h.

◆ options

uint8_t options[]

Definition at line 290 of file ipv6.h.

◆ payloadData

uint8_t payloadData[]

Definition at line 357 of file ipv6.h.

◆ payloadLen

uint8_t payloadLen

Definition at line 341 of file ipv6.h.

◆ reserved

uint16_t reserved

Definition at line 316 of file ipv6.h.

◆ routingType

uint8_t routingType

Definition at line 314 of file ipv6.h.

◆ securityParamIndex

uint32_t securityParamIndex

Definition at line 343 of file ipv6.h.

◆ segmentsLeft

uint8_t segmentsLeft

Definition at line 315 of file ipv6.h.

◆ sequenceNumber

uint32_t sequenceNumber

Definition at line 344 of file ipv6.h.

◆ type

uint8_t type

Definition at line 367 of file ipv6.h.

◆ w

uint16_t w[8]

Definition at line 249 of file ipv6.h.