Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
More...
#include <ipv6_addr.h>
|
bool | IsEmbeddedIPV4 () const |
| An IPADDR6 object can store a IPv4 or IPv6 address. This function returns true if the instance contains an IPv4 address.
|
|
IPADDR4 | Extract4 () const |
| Extracts an IPv4 address from the object.
|
|
bool | IsNull () const |
| Check if the IP address is null.
|
|
bool | NotNull () const |
| Check if the IP address is not null.
|
|
bool | IsLoopBack () const |
| Check if the IP address is the loopback address for the interface.
|
|
bool | IsMultiCast () const |
| Check if the IPADDR6 object contains a Multicast IP address the interface.
|
|
bool | IsLinkLocal () const |
| Check if the IP address is the link-local address for the interface.
|
|
MACADR | McastMac () const |
| Return the MAC address used for Multicasts for the interface.
|
|
void | print (bool bCompact=true, bool bShowV4Raw=false) const |
| Print the IP address value to stdout.
|
|
void | fdprint (int fd, bool bCompact=true, bool bShowV4Raw=false) const |
| Print the IP address to the specified file descriptor.
|
|
int | sprintf (char *cp, int maxl, bool bCompact=true, bool bShowV4Raw=false) const |
| Print the IP address to the specified buffer.
|
|
void | SetFromAscii (const char *cp, bool bembed_v4addresses=true) |
| Set the IP address value of an IPADDR6 object.
|
|
void | SetFromIP4 (IPADDR4 ip) |
| Set the IP address value of an IPADDR6 object from an IPADD4 object.
|
|
void | SetFromUint32Shortcut (uint32_t w0, uint32_t w1, uint32_t w2, uint32_t w3) |
| Set the IP address value of an IPADDR6 object from 4 discrete uint32_t values.
|
|
void | SetNull () |
| Set the IP address value of an IPADDR6 object to null.
|
|
|
static IPADDR6 | AsciiToIp6 (const char *cp, bool bembed_v4addresses=true) |
| Static function to return an IPADDR6 object created from an ASCII value IPv4 or IPv6 address.
|
|
static IPADDR6 | NullIP () |
| Static function to return a null IPADDR6 object.
|
|
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
- Note
- It is recommended to use the IPADDR object, which can hold either an IPv4 or IPv6 address, rather than explicitly specifying IPv6.
◆ AsciiToIp6()
static IPADDR6 IPADDR6::AsciiToIp6 |
( |
const char * | cp, |
|
|
bool | bembed_v4addresses = true ) |
|
static |
Static function to return an IPADDR6 object created from an ASCII value IPv4 or IPv6 address.
- Parameters
-
*cp | Pointer to the ASCII string representing an IPv4 or IPv6 address |
bembed_v4addresses | If false function will only process an IPv6 address |
- Return values
-
- See also
- NullIP()
◆ Extract4()
IPADDR4 IPADDR6::Extract4 |
( |
| ) |
const |
|
inline |
Extracts an IPv4 address from the object.
- Return values
-
◆ fdprint()
void IPADDR6::fdprint |
( |
int | fd, |
|
|
bool | bCompact = true, |
|
|
bool | bShowV4Raw = false ) const |
Print the IP address to the specified file descriptor.
- Parameters
-
fd | Valid file descriptor to send the data |
bCompact | Display IPv6 address in compact notation |
bShowV4Raw | Normally set to false. If set to true, will display the IPv4 address 128-bits of the IP address object in the raw format "::FFFF:xx.xx.xx.xx" |
- See also
- print(), sprintf()
◆ IsEmbeddedIPV4()
bool IPADDR6::IsEmbeddedIPV4 |
( |
| ) |
const |
|
inline |
An IPADDR6 object can store a IPv4 or IPv6 address. This function returns true if the instance contains an IPv4 address.
Internally, an IPv4 address is stored in the format: "::FFFF:xx.xx.xx.xx"
- Return values
-
true | If the IPADDR6 object contains and IPv4 address |
false | Otherwise |
◆ IsLinkLocal()
bool IPADDR6::IsLinkLocal |
( |
| ) |
const |
|
inline |
Check if the IP address is the link-local address for the interface.
Link local is
. Masks the top 10 bits and check.
- Return values
-
true | if the IP address value is the link-local address |
- See also
- IsLoopBack(), IsMultiCast()
◆ IsLoopBack()
bool IPADDR6::IsLoopBack |
( |
| ) |
const |
|
inline |
Check if the IP address is the loopback address for the interface.
- Return values
-
true | if the IP address value is the loopback address |
- See also
- IsMultiCast(), IsLinkLocal()
◆ IsMultiCast()
bool IPADDR6::IsMultiCast |
( |
| ) |
const |
|
inline |
Check if the IPADDR6 object contains a Multicast IP address the interface.
- Return values
-
true | if the IP address value is a Multicast address |
- See also
- IsLoopBack(), IsLinkLocal()
◆ IsNull()
bool IPADDR6::IsNull |
( |
| ) |
const |
|
inline |
Check if the IP address is null.
- Return values
-
true | if the IP address value is null |
- See also
- NotNull()
◆ McastMac()
MACADR IPADDR6::McastMac |
( |
| ) |
const |
Return the MAC address used for Multicasts for the interface.
- Return values
-
MACADR | if a Multicast address exists |
null | otherwise |
◆ NotNull()
bool IPADDR6::NotNull |
( |
| ) |
const |
|
inline |
Check if the IP address is not null.
- Return values
-
true | if the IP address value is not null |
- See also
- IsNull()
◆ NullIP()
Static function to return a null IPADDR6 object.
Static functions can be called without a specific C++ object. For example,
iprintf("myIPAddress is null\r\n");
else
iprintf("myIPAddress = %I\r\n", myIPAddress);
static IPADDR6 NullIP()
Static function to return a null IPADDR6 object.
IPADDR6::NullIP() can be used on IPADDR, IPADDR4 and IPADDR6 objects.
- Return values
-
- See also
- AsciiToIp6()
◆ print()
void IPADDR6::print |
( |
bool | bCompact = true, |
|
|
bool | bShowV4Raw = false ) const |
Print the IP address value to stdout.
- Parameters
-
bCompact | Display IPv6 address in compact notation |
bShowV4Raw | Normally set to false. if set to true, will display the IPv4 address 128-bits of the IP address object in the raw format "::FFFF:xx.xx.xx.xx" |
- See also
- fdprint(), sprintf()
◆ SetFromAscii()
void IPADDR6::SetFromAscii |
( |
const char * | cp, |
|
|
bool | bembed_v4addresses = true ) |
Set the IP address value of an IPADDR6 object.
- Parameters
-
*cp | Pointer to the ASCII string representing an IPv4 or IPv6 address |
bembed_v4addresses | If false function will only process an IPv6 address |
- See also
- SetFromIP4(), SetNull()
◆ SetFromIP4()
void IPADDR6::SetFromIP4 |
( |
IPADDR4 | ip | ) |
|
◆ SetFromUint32Shortcut()
void IPADDR6::SetFromUint32Shortcut |
( |
uint32_t | w0, |
|
|
uint32_t | w1, |
|
|
uint32_t | w2, |
|
|
uint32_t | w3 ) |
|
inline |
Set the IP address value of an IPADDR6 object from 4 discrete uint32_t values.
- Parameters
-
w0 | Unsigned 32-bit integer |
w1 | Unsigned 32-bit integer |
w2 | Unsigned 32-bit integer |
w3 | Unsigned 32-bit integer |
- See also
- SetFromAscii(), SetFromIP4(), SetNull()
◆ SetNull()
void IPADDR6::SetNull |
( |
| ) |
|
|
inline |
◆ sprintf()
int IPADDR6::sprintf |
( |
char * | cp, |
|
|
int | maxl, |
|
|
bool | bCompact = true, |
|
|
bool | bShowV4Raw = false ) const |
Print the IP address to the specified buffer.
- Parameters
-
*cp | Pointer to the destination buffer to store the data |
maxl | Maximum number of bytes to write to buffer |
bCompact | Display IPv6 address in compact notation |
bShowV4Raw | Normally set to false. if set to true, will display the IPv4 address 128-bits of the IP address object in the raw format "::FFFF:xx.xx.xx.xx" |
- Returns
- Number of bytes copied to buffer
- See also
- print(), fdprint()
The documentation for this class was generated from the following file: