NetBurner 3.3.4
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. More...
 
IPADDR4 Extract4 () const
 Extracts an IPv4 address from the object. More...
 
bool IsNull () const
 Check if the IP address is null. More...
 
bool NotNull () const
 Check if the IP address is not null. More...
 
bool IsLoopBack () const
 Check if the IP address is the loopback address for the interface. More...
 
bool IsMultiCast () const
 Check if the IPADDR6 object contains a Multicast IP address the interface. More...
 
bool IsLinkLocal () const
 Check if the IP address is the link-local address for the interface. More...
 
MACADR McastMac () const
 Return the MAC address used for Multicasts for the interface. More...
 
void print (bool bCompact=true, bool bShowV4Raw=false) const
 Print the IP address value to stdout. More...
 
void fdprint (int fd, bool bCompact=true, bool bShowV4Raw=false) const
 Print the IP address to the specified file descriptor. More...
 
int sprintf (char *cp, int maxl, bool bCompact=true, bool bShowV4Raw=false) const
 Print the IP address to the specified buffer. More...
 
void SetFromAscii (const char *cp, bool bembed_v4addresses=true)
 Set the IP address value of an IPADDR6 object. More...
 
void SetFromIP4 (IPADDR4 ip)
 Set the IP address value of an IPADDR6 object from an IPADD4 object. More...
 
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. More...
 
void SetNull ()
 Set the IP address value of an IPADDR6 object to null. More...
 

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. More...
 
static IPADDR6 NullIP ()
 Static function to return a null IPADDR6 object. More...
 

Detailed Description

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

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

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.

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

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.
Definition: ipv6_addr.cpp:334

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 files: