Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

ipv6.c File Reference

ipv6.c File Reference

IPv6 (Internet Protocol Version 6) More...

Go to the source code of this file.

Functions

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

Detailed Description

IPv6 (Internet Protocol Version 6)

License

Copyright (C) 2010-2017 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.

Description

IP version 6 (IPv6) is a new version of the Internet Protocol, designed as the successor to IP version 4 (IPv4). Refer to RFC 2460

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

Definition in file ipv6.c.


Function Documentation

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 2055 of file ipv6.c.

void ipv6DumpHeader ( const Ipv6Header *  ipHeader )

Dump IPv6 header for debugging purpose.

Parameters:
[in]ipHeaderIPv6 header

Definition at line 2124 of file ipv6.c.

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 451 of file ipv6.c.

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 656 of file ipv6.c.

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 741 of file ipv6.c.

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 327 of file ipv6.c.

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 245 of file ipv6.c.

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 182 of file ipv6.c.

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 546 of file ipv6.c.

error_t ipv6Init ( NetInterface *  interface )

IPv6 related initialization.

Parameters:
[in]interfaceUnderlying network interface
Returns:
Error code

Definition at line 93 of file ipv6.c.

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 1768 of file ipv6.c.

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 1853 of file ipv6.c.

void ipv6LinkChangeEvent ( NetInterface *  interface )

Callback function for link change event.

Parameters:
[in]interfaceUnderlying network interface

Definition at line 773 of file ipv6.c.

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 1308 of file ipv6.c.

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 1174 of file ipv6.c.

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 1328 of file ipv6.c.

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 1096 of file ipv6.c.

error_t ipv6ParseOptions ( NetInterface *  interface,
const NetBuffer ipPacket,
size_t  ipPacketOffset,
size_t  optOffset,
size_t  optLength 
)

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]optOffsetOffset to the first byte of the Options field
[in]optLengthLength of the Options field Error code

Definition at line 1348 of file ipv6.c.

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 1237 of file ipv6.c.

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 859 of file ipv6.c.

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 1473 of file ipv6.c.

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 1539 of file ipv6.c.

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 379 of file ipv6.c.

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 601 of file ipv6.c.

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 707 of file ipv6.c.

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 288 of file ipv6.c.

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 207 of file ipv6.c.

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 141 of file ipv6.c.

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 486 of file ipv6.c.

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 1915 of file ipv6.c.