EtherSia
A minimal IPv6 Ethernet library for Arduino.
|
Class for the storage and manipulation of IPv6 addresses. More...
#include <IPv6Address.h>
Public Member Functions | |
IPv6Address () | |
Constructor for a new / all-zero IPv6 address (::) | |
IPv6Address (const uint8_t *address) | |
Constructor from a 128 bit (16-byte) array of bytes. More... | |
IPv6Address (const char *addrstr) | |
Constructor from a human readable IPv6 address string. More... | |
IPv6Address (const __FlashStringHelper *addrstr) | |
Constructor from a human readable IPv6 address Flash string (use the F() macro) More... | |
boolean | fromString (const char *addrstr) |
Set address to the a human readable IPv6 string The address string can contain double colon :: notation to save space. More... | |
boolean | fromString (const __FlashStringHelper *addrstr) |
Set address to the a human readable IPv6 Flash string (use the F() macro) The address string can contain double colon :: notation to save space. More... | |
uint8_t | type () |
Get the IPv6 address type. More... | |
operator uint8_t * () | |
Cast the IPv6 address to an array of octets. | |
boolean | operator== (const IPv6Address &address) const |
Check if the address equals another IPv6 address. More... | |
boolean | operator!= (const IPv6Address &address) const |
Check if the address is not equal to another IPv6 address. More... | |
void | setLinkLocalPrefix () |
Set the first two bytes to the link-local prefix (FE80:) Note this only sets the first 64-bits of the address. More... | |
void | setLinkLocalAllNodes () |
Set address to multicast address for all nodes on the local network segment (FF02::1) | |
boolean | isLinkLocalAllNodes () const |
Check if multicast address for all nodes on the local network segment (FF02::1) More... | |
void | setLinkLocalAllRouters () |
Set address to multicast address for all routers on the local network segment (FF02::2) | |
boolean | isLinkLocalAllRouters () const |
Check if multicast address for all routers on the local network segment (FF02::2) More... | |
void | setEui64 (const MACAddress &macAddress) |
Set the last 64-bits of the IPv6 address to a EUI-64 based on a 48-bit MAC Address Note this only sets the last 64-bits of the address. More... | |
void | setSolicitedNodeMulticastAddress (const IPv6Address &address) |
Set the address to a Solicited Node Multicast Address For example the multicast address for fe80::2aa:ff:fe28:9c5a would be ff02::1:ff28:9c5a. More... | |
boolean | isSolicitedNodeMulticastAddress (const IPv6Address &address) const |
Check if address is a specific node multicast address. More... | |
void | setZero () |
Set the address to all-zeros (::) | |
boolean | isMulticast () const |
Check if the address is a multicast address (starts FF) More... | |
boolean | isLinkLocal () const |
Check if the address is a link-local address (starts FE80) More... | |
boolean | isZero () const |
Check if the address is empty / all-zeros (::) More... | |
boolean | inSameSubnet (const IPv6Address &address) const |
Returns true if two addresses are in the same subnet. More... | |
void | print (Print &print=Serial) const |
Print a IPv6 address to a stream as a human readable string. More... | |
void | println (Print &print=Serial) const |
Print a IPv6 address to a stream with line ending. More... | |
Class for the storage and manipulation of IPv6 addresses.
IPv6Address::IPv6Address | ( | const uint8_t * | address | ) |
Constructor from a 128 bit (16-byte) array of bytes.
address | an array of bytes |
IPv6Address::IPv6Address | ( | const char * | addrstr | ) |
Constructor from a human readable IPv6 address string.
addrstr | the address to parse |
References fromString().
IPv6Address::IPv6Address | ( | const __FlashStringHelper * | addrstr | ) |
Constructor from a human readable IPv6 address Flash string (use the F() macro)
addrstr | the address to parse |
References fromString().
boolean IPv6Address::fromString | ( | const char * | addrstr | ) |
Set address to the a human readable IPv6 string The address string can contain double colon :: notation to save space.
addrstr | an IPv6 address as a null-terminated string |
References asciiToHex(), and MAX_IPV6_ADDRESS_STR_LEN.
boolean IPv6Address::fromString | ( | const __FlashStringHelper * | addrstr | ) |
Set address to the a human readable IPv6 Flash string (use the F() macro) The address string can contain double colon :: notation to save space.
addrstr | an IPv6 address as a null-terminated string |
References fromString().
boolean IPv6Address::inSameSubnet | ( | const IPv6Address & | address | ) | const |
Returns true if two addresses are in the same subnet.
address | the address to |
boolean IPv6Address::isLinkLocal | ( | ) | const |
Check if the address is a link-local address (starts FE80)
boolean IPv6Address::isLinkLocalAllNodes | ( | ) | const |
Check if multicast address for all nodes on the local network segment (FF02::1)
References setLinkLocalAllNodes().
boolean IPv6Address::isLinkLocalAllRouters | ( | ) | const |
Check if multicast address for all routers on the local network segment (FF02::2)
References setLinkLocalAllRouters().
boolean IPv6Address::isMulticast | ( | ) | const |
Check if the address is a multicast address (starts FF)
boolean IPv6Address::isSolicitedNodeMulticastAddress | ( | const IPv6Address & | address | ) | const |
Check if address is a specific node multicast address.
For example the multicast address for fe80::2aa:ff:fe28:9c5a would be ff02::1:ff28:9c5a
address | The IPv6 unicast address to calculate the multicast address from |
References setSolicitedNodeMulticastAddress().
boolean IPv6Address::isZero | ( | ) | const |
Check if the address is empty / all-zeros (::)
boolean IPv6Address::operator!= | ( | const IPv6Address & | address | ) | const |
Check if the address is not equal to another IPv6 address.
address | the second address to compare to |
boolean IPv6Address::operator== | ( | const IPv6Address & | address | ) | const |
Check if the address equals another IPv6 address.
address | the second address to compare to |
void IPv6Address::print | ( | Print & | print = Serial | ) | const |
Print a IPv6 address to a stream as a human readable string.
The stream to print to (defaults to Serial) |
References printPaddedHex().
void IPv6Address::println | ( | Print & | print = Serial | ) | const |
Print a IPv6 address to a stream with line ending.
The stream to print to (defaults to Serial) |
References print().
void IPv6Address::setEui64 | ( | const MACAddress & | macAddress | ) |
Set the last 64-bits of the IPv6 address to a EUI-64 based on a 48-bit MAC Address Note this only sets the last 64-bits of the address.
The first 64-bits are left unmodified.
macAddress | The MAC address |
void IPv6Address::setLinkLocalPrefix | ( | ) |
Set the first two bytes to the link-local prefix (FE80:) Note this only sets the first 64-bits of the address.
The last 64-bits are left unmodified.
void IPv6Address::setSolicitedNodeMulticastAddress | ( | const IPv6Address & | address | ) |
Set the address to a Solicited Node Multicast Address For example the multicast address for fe80::2aa:ff:fe28:9c5a would be ff02::1:ff28:9c5a.
address | The IPv6 unicast address |
References setZero().
uint8_t IPv6Address::type | ( | ) |
Get the IPv6 address type.
References ADDRESS_TYPE_GLOBAL, ADDRESS_TYPE_LINK_LOCAL, ADDRESS_TYPE_MULTICAST, isLinkLocal(), and isMulticast().