openthread-br  0.3.0-72c0388
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
otbr::Ip6Address Class Reference

#include <src/common/types.hpp>

Public Member Functions

 Ip6Address (void)
 
 Ip6Address (uint16_t aLocator)
 
 Ip6Address (const uint8_t(&aAddress)[16])
 
bool operator< (const Ip6Address &aOther) const
 
bool operator== (const Ip6Address &aOther) const
 
uint16_t ToLocator (void) const
 
Ip6Address ToSolicitedNodeMulticastAddress (void) const
 
std::string ToString (void) const
 
bool IsUnspecified (void) const
 
bool IsMulticast (void) const
 
bool IsLinkLocal (void) const
 
bool IsLoopback (void) const
 
void CopyTo (struct sockaddr_in6 &aSockAddr) const
 
void CopyFrom (const struct sockaddr_in6 &aSockAddr)
 
void CopyTo (struct in6_addr &aIn6Addr) const
 
void CopyFrom (const struct in6_addr &aIn6Addr)
 

Static Public Member Functions

static const Ip6AddressGetLinkLocalAllNodesMulticastAddress (void)
 
static const Ip6AddressGetSolicitedMulticastAddressPrefix (void)
 
static otbrError FromString (const char *aStr, Ip6Address &aAddr)
 

Public Attributes

union {
   uint8_t   m8 [16]
 
   uint16_t   m16 [8]
 
   uint32_t   m32 [4]
 
   uint64_t   m64 [2]
 
}; 
 

Detailed Description

This class implements the Ipv6 address functionality.

Constructor & Destructor Documentation

◆ Ip6Address() [1/3]

otbr::Ip6Address::Ip6Address ( void  )
inline

Default constructor.

◆ Ip6Address() [2/3]

otbr::Ip6Address::Ip6Address ( uint16_t  aLocator)
inline

Constructor with an 16-bit Thread locator.

Parameters
[in]aLocatorThe 16-bit Thread locator, RLOC or ALOC.

◆ Ip6Address() [3/3]

otbr::Ip6Address::Ip6Address ( const uint8_t(&)  aAddress[16])

Constructor with an Ip6 address.

Parameters
[in]aAddressThe Ip6 address.

Member Function Documentation

◆ CopyFrom() [1/2]

void otbr::Ip6Address::CopyFrom ( const struct in6_addr &  aIn6Addr)

This method copies the Ip6 address from a in6_addr structure.

Parameters
[in]aIn6AddrThe in6_addr structure to copy the Ip6 address from.

◆ CopyFrom() [2/2]

void otbr::Ip6Address::CopyFrom ( const struct sockaddr_in6 &  aSockAddr)

This method copies the Ip6 address from a sockaddr_in6 structure.

Parameters
[in]aSockAddrThe sockaddr_in6 structure to copy the Ip6 address from.

◆ CopyTo() [1/2]

void otbr::Ip6Address::CopyTo ( struct in6_addr &  aIn6Addr) const

This method copies the Ip6 address to a in6_addr structure.

Parameters
[out]aIn6AddrThe in6_addr structure to copy the Ip6 address to.

◆ CopyTo() [2/2]

void otbr::Ip6Address::CopyTo ( struct sockaddr_in6 &  aSockAddr) const

This method copies the Ip6 address to a sockaddr_in6 structure.

Parameters
[out]aSockAddrThe sockaddr_in6 structure to copy the Ip6 address to.

◆ FromString()

otbrError otbr::Ip6Address::FromString ( const char *  aStr,
Ip6Address aAddr 
)
static

This function converts Ip6 addresses from text to Ip6Address.

Parameters
[in]aStrThe Ip6 address text.
[out]aAddrA reference to Ip6Address to output the Ip6 address.
Return values
OTBR_ERROR_NONEIf the Ip6 address was successfully converted.
OTBR_ERROR_INVALID_ARGSIf aStr is not a valid string representing of Ip6 address.

◆ GetLinkLocalAllNodesMulticastAddress()

static const Ip6Address& otbr::Ip6Address::GetLinkLocalAllNodesMulticastAddress ( void  )
inlinestatic

This function returns the wellknown Link Local All Nodes Multicast Address (ff02::1).

Returns
The Link Local All Nodes Multicast Address.

◆ GetSolicitedMulticastAddressPrefix()

static const Ip6Address& otbr::Ip6Address::GetSolicitedMulticastAddressPrefix ( void  )
inlinestatic

This function returns the wellknown Solicited Node Multicast Address Prefix (ff02::01:ff00:0).

Returns
The Solicited Node Multicast Address Prefix.

◆ IsLinkLocal()

bool otbr::Ip6Address::IsLinkLocal ( void  ) const
inline

This method returns if the Ip6 address is a link-local address.

Returns
Whether the Ip6 address is a link-local address.

◆ IsLoopback()

bool otbr::Ip6Address::IsLoopback ( void  ) const
inline

This method returns whether or not the Ip6 address is the Loopback Address.

Return values
TRUEIf the Ip6 address is the Loopback Address.
FALSEIf the Ip6 address is not the Loopback Address.

◆ IsMulticast()

bool otbr::Ip6Address::IsMulticast ( void  ) const
inline

This method returns if the Ip6 address is a multicast address.

Returns
Whether the Ip6 address is a multicast address.

◆ IsUnspecified()

bool otbr::Ip6Address::IsUnspecified ( void  ) const
inline

This method indicates whether or not the Ip6 address is the Unspecified Address.

Return values
TRUEIf the Ip6 address is the Unspecified Address.
FALSEIf the Ip6 address is not the Unspecified Address.

◆ operator<()

bool otbr::Ip6Address::operator< ( const Ip6Address aOther) const
inline

This method overloads < operator and compares if the Ip6 address is smaller than the other address.

Parameters
[in]aOtherThe other Ip6 address to compare with.
Returns
Whether the Ip6 address is smaller than the other address.

◆ operator==()

bool otbr::Ip6Address::operator== ( const Ip6Address aOther) const
inline

This method overloads == operator and compares if the Ip6 address is equal to the other address.

Parameters
[in]aOtherThe other Ip6 address to compare with.
Returns
Whether the Ip6 address is equal to the other address.

◆ ToLocator()

uint16_t otbr::Ip6Address::ToLocator ( void  ) const
inline

Retrieve the 16-bit Thread locator.

Returns
RLOC16 or ALOC16.

◆ ToSolicitedNodeMulticastAddress()

Ip6Address otbr::Ip6Address::ToSolicitedNodeMulticastAddress ( void  ) const

This method returns the solicited node multicast address.

Returns
The solicited node multicast address.

◆ ToString()

std::string otbr::Ip6Address::ToString ( void  ) const

This method returns the string representation for the Ip6 address.

Returns
The string representation of the Ip6 address.

The documentation for this class was generated from the following files: