ipv6.h File Reference

IPv6 (Internet Protocol Version 6) More...

#include "core/net.h"
#include "core/ethernet.h"
#include "ipv6/ipv6_frag.h"

Go to the source code of this file.

Data Structures

struct  Ipv6AddrEntry
 IPv6 address entry. More...
 
struct  Ipv6PrefixEntry
 Prefix list entry. More...
 
struct  Ipv6RouterEntry
 Default router list entry. More...
 
struct  Ipv6SrcAddrList
 Source address list. 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_MAX_MULTICAST_SOURCES   0
 
#define IPV6_VERSION   6
 
#define IPV6_DEFAULT_MTU   1280
 
#define IPV6_ADDR(a, b, c, d, e, f, g, h)
 
#define ipv6CopyAddr(destIpAddr, srcIpAddr)    osMemcpy(destIpAddr, srcIpAddr, sizeof(Ipv6Addr))
 
#define ipv6CompAddr(ipAddr1, ipAddr2)    (!osMemcmp(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)
 

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, PV6_OPTION_TUNNEL_ENCAPSULATION_LIMIT = 0x04,
  IPV6_OPTION_TYPE_ROUTER_ALERT = 0x05
}
 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 ipv6SetDefaultHopLimit (NetInterface *interface, uint8_t hopLimit)
 Set default Hop Limit value for outgoing IPv6 packets. 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...
 
Ipv6AddrState ipv6GetLinkLocalAddrState (NetInterface *interface)
 Get the state of the 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...
 
Ipv6AddrState ipv6GetGlobalAddrState (NetInterface *interface, uint_t index)
 Get the state of the specified 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, NetRxAncillary *ancillary)
 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 ipv6ParseAhHeader (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
 Parse AH header. More...
 
error_t ipv6ParseEspHeader (NetInterface *interface, const NetBuffer *ipPacket, size_t ipPacketOffset, size_t *headerOffset, size_t *nextHeaderOffset)
 Parse ESP 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, const Ipv6PseudoHeader *pseudoHeader, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send an IPv6 datagram. More...
 
error_t ipv6SendPacket (NetInterface *interface, const Ipv6PseudoHeader *pseudoHeader, uint32_t fragId, size_t fragOffset, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send an IPv6 packet. More...
 
error_t ipv6FormatHopByHopOptHeader (uint8_t *nextHeader, NetBuffer *buffer, size_t *offset)
 Format Hop-by-Hop Options header. More...
 
error_t ipv6FormatFragmentHeader (uint32_t fragId, size_t fragOffset, uint8_t *nextHeader, NetBuffer *buffer, size_t *offset)
 Format Fragment header. 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

typedef __packed_struct
 IPv6 network address. More...
 
 Ipv6Addr
 
__packed_struct _Ipv6Header
 IPv6 header. More...
 
uint8_t version
 
uint8_t flowLabelH
 
uint8_t trafficClassL
 
uint16_t flowLabelL
 
uint16_t payloadLen
 
uint8_t nextHeader
 
uint8_t hopLimit
 
Ipv6Addr srcAddr
 
Ipv6Addr destAddr
 
uint8_t payload []
 
uint8_t hdrExtLen
 
uint8_t options []
 
 Ipv6HopByHopOptHeader
 
 Ipv6DestOptHeader
 
uint8_t routingType
 
uint8_t segmentsLeft
 
uint32_t reserved
 
Ipv6Addr address []
 
 Ipv6RoutingHeader
 
__packed_struct _Ipv6FragmentHeader
 IPv6 Fragment header. More...
 
uint16_t fragmentOffset
 
uint32_t identification
 
uint32_t securityParamIndex
 
uint32_t sequenceNumber
 
uint8_t authData []
 
 Ipv6AuthHeader
 
uint8_t payloadData []
 
 Ipv6EspHeader
 
uint8_t length
 
uint8_t data []
 
 Ipv6Option
 
uint16_t value
 
 Ipv6RouterAlertOption
 
__packed_struct _Ipv6PseudoHeader
 IPv6 pseudo header. More...
 
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

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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
2.4.4

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)}}}

Definition at line 118 of file ipv6.h.

◆ IPV6_ADDR_LIST_SIZE

#define IPV6_ADDR_LIST_SIZE   3

Definition at line 65 of file ipv6.h.

◆ IPV6_ANYCAST_ADDR_LIST_SIZE

#define IPV6_ANYCAST_ADDR_LIST_SIZE   1

Definition at line 72 of file ipv6.h.

◆ IPV6_DEFAULT_HOP_LIMIT

#define IPV6_DEFAULT_HOP_LIMIT   64

Definition at line 58 of file ipv6.h.

◆ IPV6_DEFAULT_MTU

#define IPV6_DEFAULT_MTU   1280

Definition at line 115 of file ipv6.h.

◆ IPV6_DNS_SERVER_LIST_SIZE

#define IPV6_DNS_SERVER_LIST_SIZE   2

Definition at line 93 of file ipv6.h.

◆ IPV6_MAX_MULTICAST_SOURCES

#define IPV6_MAX_MULTICAST_SOURCES   0

Definition at line 107 of file ipv6.h.

◆ IPV6_MULTICAST_FILTER_SIZE

#define IPV6_MULTICAST_FILTER_SIZE   8

Definition at line 100 of file ipv6.h.

◆ IPV6_PREFIX_LIST_SIZE

#define IPV6_PREFIX_LIST_SIZE   2

Definition at line 79 of file ipv6.h.

◆ IPV6_ROUTER_LIST_SIZE

#define IPV6_ROUTER_LIST_SIZE   2

Definition at line 86 of file ipv6.h.

◆ IPV6_SUPPORT

#define IPV6_SUPPORT   DISABLED

Definition at line 51 of file ipv6.h.

◆ IPV6_VERSION

#define IPV6_VERSION   6

Definition at line 113 of file ipv6.h.

◆ ipv6CompAddr

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

Definition at line 127 of file ipv6.h.

◆ ipv6CopyAddr

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

Definition at line 123 of file ipv6.h.

◆ Ipv6FragmentHeader

#define Ipv6FragmentHeader   struct _Ipv6FragmentHeader

Definition at line 39 of file ipv6.h.

◆ Ipv6Header

#define Ipv6Header   struct _Ipv6Header

Definition at line 36 of file ipv6.h.

◆ ipv6IsLinkLocalUnicastAddr

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

Definition at line 131 of file ipv6.h.

◆ ipv6IsMulticastAddr

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

Definition at line 139 of file ipv6.h.

◆ ipv6IsSiteLocalUnicastAddr

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

Definition at line 135 of file ipv6.h.

◆ ipv6IsSolicitedNodeAddr

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

Definition at line 143 of file ipv6.h.

◆ Ipv6PseudoHeader

#define Ipv6PseudoHeader   struct _Ipv6PseudoHeader

Definition at line 42 of file ipv6.h.

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 230 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 156 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 171 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 203 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 184 of file ipv6.h.

◆ Ipv6OptionType

IPv6 option types.

Enumerator
IPV6_OPTION_TYPE_MASK 
IPV6_OPTION_TYPE_PAD1 
IPV6_OPTION_TYPE_PADN 
PV6_OPTION_TUNNEL_ENCAPSULATION_LIMIT 
IPV6_OPTION_TYPE_ROUTER_ALERT 

Definition at line 216 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 2329 of file ipv6.c.

◆ ipv6DumpHeader()

void ipv6DumpHeader ( const Ipv6Header ipHeader)

Dump IPv6 header for debugging purpose.

Parameters
[in]ipHeaderIPv6 header

Definition at line 2400 of file ipv6.c.

◆ ipv6FormatFragmentHeader()

error_t ipv6FormatFragmentHeader ( uint32_t  fragId,
size_t  fragOffset,
uint8_t *  nextHeader,
NetBuffer buffer,
size_t *  offset 
)

Format Fragment header.

Parameters
[in]fragIdFragment identification field
[in]fragOffsetFragment offset field
[in,out]nextHeaderValue of the Next Header field
[in]bufferMulti-part buffer containing the payload
[in,out]offsetOffset to the first payload byte
Returns
Error code

Definition at line 2130 of file ipv6.c.

◆ ipv6FormatHopByHopOptHeader()

error_t ipv6FormatHopByHopOptHeader ( uint8_t *  nextHeader,
NetBuffer buffer,
size_t *  offset 
)

Format Hop-by-Hop Options header.

Parameters
[in,out]nextHeaderValue of the Next Header field
[in]bufferMulti-part buffer containing the payload
[in,out]offsetOffset to the first payload byte
Returns
Error code

Definition at line 2063 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 552 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 765 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 852 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 394 of file ipv6.c.

◆ ipv6GetGlobalAddrState()

Ipv6AddrState ipv6GetGlobalAddrState ( NetInterface interface,
uint_t  index 
)

Get the state of the specified global address.

Parameters
[in]interfacePointer to the desired network interface
[in]indexZero-based index
Returns
Address state

Definition at line 446 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 286 of file ipv6.c.

◆ ipv6GetLinkLocalAddrState()

Ipv6AddrState ipv6GetLinkLocalAddrState ( NetInterface interface)

Get the state of the link-local address.

Parameters
[in]interfacePointer to the desired network interface
Returns
Address state

Definition at line 327 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 195 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 652 of file ipv6.c.

◆ ipv6Init()

error_t ipv6Init ( NetInterface interface)

IPv6 related initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 96 of file ipv6.c.

◆ ipv6LinkChangeEvent()

void ipv6LinkChangeEvent ( NetInterface interface)

Callback function for link change event.

Parameters
[in]interfaceUnderlying network interface

Definition at line 884 of file ipv6.c.

◆ ipv6ParseAhHeader()

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

Parse AH 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 1535 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 1399 of file ipv6.c.

◆ ipv6ParseEspHeader()

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

Parse ESP 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 1556 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 1320 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 1577 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 1463 of file ipv6.c.

◆ ipv6ProcessPacket()

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

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
[in]ancillaryAdditional options passed to the stack along with the packet

Definition at line 976 of file ipv6.c.

◆ ipv6SendDatagram()

error_t ipv6SendDatagram ( NetInterface interface,
const Ipv6PseudoHeader pseudoHeader,
NetBuffer buffer,
size_t  offset,
NetTxAncillary ancillary 
)

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]ancillaryAdditional options passed to the stack along with the packet
Returns
Error code

Definition at line 1703 of file ipv6.c.

◆ ipv6SendPacket()

error_t ipv6SendPacket ( NetInterface interface,
const Ipv6PseudoHeader pseudoHeader,
uint32_t  fragId,
size_t  fragOffset,
NetBuffer buffer,
size_t  offset,
NetTxAncillary ancillary 
)

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]ancillaryAdditional options passed to the stack along with the packet
Returns
Error code

Definition at line 1781 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 473 of file ipv6.c.

◆ ipv6SetDefaultHopLimit()

error_t ipv6SetDefaultHopLimit ( NetInterface interface,
uint8_t  hopLimit 
)

Set default Hop Limit value for outgoing IPv6 packets.

Parameters
[in]interfaceUnderlying network interface
[in]hopLimitDefault Hop Limit value
Returns
Error code

Definition at line 220 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 707 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 817 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 354 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 248 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 150 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 588 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 2174 of file ipv6.c.

Variable Documentation

◆ __packed_struct

typedef __packed_struct
Initial value:
{
__packed_union
{
uint8_t b[16];
uint16_t w[8];
uint32_t dw[4];
}

IPv6 network address.

IPv6 Router Alert option.

IPv6 option.

IPv6 Encapsulating Security Payload header.

IPv6 Authentication header.

IPv6 Type 0 Routing header.

IPv6 Destination Options header.

IPv6 Hop-by-Hop Options header.

Definition at line 252 of file ipv6.h.

◆ _Ipv6FragmentHeader

__packed_struct _Ipv6FragmentHeader
Initial value:
{
uint8_t nextHeader

IPv6 Fragment header.

Definition at line 333 of file ipv6.h.

◆ _Ipv6Header

__packed_struct _Ipv6Header
Initial value:
{
uint8_t trafficClassH : 4

IPv6 header.

Definition at line 267 of file ipv6.h.

◆ _Ipv6PseudoHeader

__packed_struct _Ipv6PseudoHeader
Initial value:

IPv6 pseudo header.

Definition at line 397 of file ipv6.h.

◆ address

Ipv6Addr address[]

Definition at line 325 of file ipv6.h.

◆ authData

uint8_t authData[]

Definition at line 353 of file ipv6.h.

◆ data

uint8_t data[]

Definition at line 377 of file ipv6.h.

◆ destAddr

Ipv6Addr destAddr

Definition at line 285 of file ipv6.h.

◆ flowLabelH

uint8_t flowLabelH

Definition at line 277 of file ipv6.h.

◆ flowLabelL

uint16_t flowLabelL

Definition at line 280 of file ipv6.h.

◆ fragmentOffset

uint16_t fragmentOffset

Definition at line 337 of file ipv6.h.

◆ hdrExtLen

uint8_t hdrExtLen

Definition at line 297 of file ipv6.h.

◆ hopLimit

uint8_t hopLimit

Definition at line 283 of file ipv6.h.

◆ identification

uint32_t identification

Definition at line 338 of file ipv6.h.

◆ IPV6_LINK_LOCAL_ADDR_PREFIX

const Ipv6Addr IPV6_LINK_LOCAL_ADDR_PREFIX
extern

Definition at line 82 of file ipv6.c.

◆ IPV6_LINK_LOCAL_ALL_NODES_ADDR

const Ipv6Addr IPV6_LINK_LOCAL_ALL_NODES_ADDR
extern

Definition at line 74 of file ipv6.c.

◆ IPV6_LINK_LOCAL_ALL_ROUTERS_ADDR

const Ipv6Addr IPV6_LINK_LOCAL_ALL_ROUTERS_ADDR
extern

Definition at line 78 of file ipv6.c.

◆ IPV6_LOOPBACK_ADDR

const Ipv6Addr IPV6_LOOPBACK_ADDR
extern

Definition at line 70 of file ipv6.c.

◆ IPV6_SOLICITED_NODE_ADDR_PREFIX

const Ipv6Addr IPV6_SOLICITED_NODE_ADDR_PREFIX
extern

Definition at line 86 of file ipv6.c.

◆ IPV6_UNSPECIFIED_ADDR

const Ipv6Addr IPV6_UNSPECIFIED_ADDR
extern

Definition at line 66 of file ipv6.c.

◆ Ipv6Addr

Ipv6Addr

Definition at line 260 of file ipv6.h.

◆ Ipv6AuthHeader

Ipv6AuthHeader

Definition at line 354 of file ipv6.h.

◆ Ipv6DestOptHeader

Ipv6DestOptHeader

Definition at line 311 of file ipv6.h.

◆ Ipv6EspHeader

Ipv6EspHeader

Definition at line 366 of file ipv6.h.

◆ Ipv6HopByHopOptHeader

Ipv6HopByHopOptHeader

Definition at line 299 of file ipv6.h.

◆ Ipv6Option

Ipv6Option

Definition at line 378 of file ipv6.h.

◆ Ipv6RouterAlertOption

Ipv6RouterAlertOption

Definition at line 390 of file ipv6.h.

◆ Ipv6RoutingHeader

Ipv6RoutingHeader

Definition at line 326 of file ipv6.h.

◆ length

uint32_t length

Definition at line 376 of file ipv6.h.

◆ nextHeader

uint8_t nextHeader

Definition at line 282 of file ipv6.h.

◆ options

uint8_t options[]

Definition at line 298 of file ipv6.h.

◆ payload

uint8_t payload[]

Definition at line 286 of file ipv6.h.

◆ payloadData

uint8_t payloadData[]

Definition at line 365 of file ipv6.h.

◆ payloadLen

uint8_t payloadLen

Definition at line 281 of file ipv6.h.

◆ reserved

uint8_t reserved[3]

Definition at line 324 of file ipv6.h.

◆ routingType

uint8_t routingType

Definition at line 322 of file ipv6.h.

◆ securityParamIndex

uint32_t securityParamIndex

Definition at line 351 of file ipv6.h.

◆ segmentsLeft

uint8_t segmentsLeft

Definition at line 323 of file ipv6.h.

◆ sequenceNumber

uint32_t sequenceNumber

Definition at line 352 of file ipv6.h.

◆ srcAddr

Ipv6Addr srcAddr

Definition at line 284 of file ipv6.h.

◆ trafficClassL

uint8_t trafficClassL

Definition at line 278 of file ipv6.h.

◆ value

uint16_t value

Definition at line 389 of file ipv6.h.

◆ version

uint8_t version

Definition at line 276 of file ipv6.h.

uint8_t b
Definition: nbns_common.h:104
uint8_t a
Definition: ndp.h:411
Ipv6Addr
Definition: ipv6.h:260
uint8_t h
Definition: ndp.h:302
Ipv6Addr srcAddr
Definition: ipv6.h:284
uint8_t nextHeader
Definition: ipv6.h:282
#define MSB(x)
Definition: os_port.h:59
#define LSB(x)
Definition: os_port.h:55
uint8_t c
Definition: ndp.h:514