NetBurner 3.5.0
PDF Version
 
IPADDR6 Class Reference

Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode. More...

#include <ipv6_addr.h>

Public Member Functions

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 Public Member Functions

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.
 

Detailed Description

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.

Member Function Documentation

◆ 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
*cpPointer to the ASCII string representing an IPv4 or IPv6 address
bembed_v4addressesIf false function will only process an IPv6 address
Return values
IPADDR6object
See also
NullIP()

◆ Extract4()

IPADDR4 IPADDR6::Extract4 ( ) const
inline

Extracts an IPv4 address from the object.

Return values
IPADDR4Value of the IPv4 address

◆ fdprint()

void IPADDR6::fdprint ( int fd,
bool bCompact = true,
bool bShowV4Raw = false ) const

Print the IP address to the specified file descriptor.

Parameters
fdValid file descriptor to send the data
bCompactDisplay IPv6 address in compact notation
bShowV4RawNormally 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
trueIf the IPADDR6 object contains and IPv4 address
falseOtherwise

◆ IsLinkLocal()

bool IPADDR6::IsLinkLocal ( ) const
inline

Check if the IP address is the link-local address for the interface.

Link local is

FE80::/10

. Masks the top 10 bits and check.

Return values
trueif 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
trueif 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
trueif 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
trueif 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
MACADRif a Multicast address exists
nullotherwise

◆ NotNull()

bool IPADDR6::NotNull ( ) const
inline

Check if the IP address is not null.

Return values
trueif the IP address value is not null
See also
IsNull()

◆ NullIP()

static IPADDR6 IPADDR6::NullIP ( )
static

Static function to return a null IPADDR6 object.

Static functions can be called without a specific C++ object. For example,

if ( myIPAddress == IPADDR6::NullIP() )
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
nullIPADDR6 object
See also
AsciiToIp6()

◆ print()

void IPADDR6::print ( bool bCompact = true,
bool bShowV4Raw = false ) const

Print the IP address value to stdout.

Parameters
bCompactDisplay IPv6 address in compact notation
bShowV4RawNormally 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
*cpPointer to the ASCII string representing an IPv4 or IPv6 address
bembed_v4addressesIf false function will only process an IPv6 address
See also
SetFromIP4(), SetNull()

◆ SetFromIP4()

void IPADDR6::SetFromIP4 ( IPADDR4 ip)

Set the IP address value of an IPADDR6 object from an IPADD4 object.

Parameters
ipIPADDR4 object
See also
SetFromAscii(), SetNull()

◆ 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
w0Unsigned 32-bit integer
w1Unsigned 32-bit integer
w2Unsigned 32-bit integer
w3Unsigned 32-bit integer
See also
SetFromAscii(), SetFromIP4(), SetNull()

◆ SetNull()

void IPADDR6::SetNull ( )
inline

Set the IP address value of an IPADDR6 object to null.

See also
SetFromAscii(), SetFromIP4()

◆ sprintf()

int IPADDR6::sprintf ( char * cp,
int maxl,
bool bCompact = true,
bool bShowV4Raw = false ) const

Print the IP address to the specified buffer.

Parameters
*cpPointer to the destination buffer to store the data
maxlMaximum number of bytes to write to buffer
bCompactDisplay IPv6 address in compact notation
bShowV4RawNormally 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: