Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cNetHost6 Class Reference

#include <cNetHost.h>

Public Member Functions

 cNetHost6 () noexcept
 
 cNetHost6 (const in6_addr &ip) noexcept
 
 cNetHost6 (const in_addr &ip)
 
 cNetHost6 (const char *pszIP)
 
void SetEmptyHostAddr () noexcept
 
bool isHostValid () const
 
bool isHostLoopback () const
 
bool isHostPrivate () const
 
bool isHostIP4 () const
 
HRESULT put_HostStr (const char *pszIP)
 
cStringA get_HostStr () const
 
 operator in6_addr () const noexcept
 
const in6_addr & get_HostIp6 () const noexcept
 
HASHCODE_t get_HashCode () const noexcept
 
bool operator== (const in6_addr &ip) const noexcept
 

Static Public Member Functions

static StrLen_t GRAYCALL GetIP6Format (const char *pszIP, bool bTerm=true)
 

Static Public Attributes

static const in6_addr k_AddrNull = IN6ADDR_ANY_INIT
 invalid address for initialize. More...
 

Protected Attributes

in6_addr m_ipa6
 (network order bytes) (16 bytes) More...
 

Detailed Description

AF_INET6 IPv6 format. 16 bytes = 128 bit address. sizeof(GUID) includes support for IPv4 as a subset. isHostIP4 Broadcast for ip6 is just a multi homed device ?

Constructor & Destructor Documentation

◆ cNetHost6() [1/4]

GrayLib::cNetHost6::cNetHost6 ( )
inlinenoexcept

◆ cNetHost6() [2/4]

GrayLib::cNetHost6::cNetHost6 ( const in6_addr &  ip)
inlinenoexcept

◆ cNetHost6() [3/4]

GrayLib::cNetHost6::cNetHost6 ( const in_addr &  ip)
inline

Set ipv6 from ipv4 - IN6_IS_ADDR_V4MAPPED

◆ cNetHost6() [4/4]

GrayLib::cNetHost6::cNetHost6 ( const char *  pszIP)
inline

Set IP as "2001:0db8:85a3:08d3:1319:8a2e:0370:7334" Any port info (or host name) is ignored.

Member Function Documentation

◆ get_HashCode()

HASHCODE_t GrayLib::cNetHost6::get_HashCode ( ) const
noexcept

Make a hash code from the full address. use CRC32 ?

◆ get_HostIp6()

const in6_addr& GrayLib::cNetHost6::get_HostIp6 ( ) const
inlinenoexcept

◆ get_HostStr()

cStringA GrayLib::cNetHost6::get_HostStr ( ) const

return string in format "fec0::9256:a00:20ff:fe12:528" lower case hex numbers and removed leading zeros. 0 sequences can be collapsed away to "::"

Note
This can also be done with getnameinfo(NI_NUMERICHOST)

◆ GetIP6Format()

StrLen_t GRAYCALL GrayLib::cNetHost6::GetIP6Format ( const char *  pszIP,
bool  bTerm = true 
)
static

is pszIP in IPv6 format? e.g. "fec0::9256:a00:20ff:fe12:528"

  • bTerm = true = must be '\0' terminated

◆ isHostIP4()

bool GrayLib::cNetHost6::isHostIP4 ( ) const

◆ isHostLoopback()

bool GrayLib::cNetHost6::isHostLoopback ( ) const

localhost = "::1"

◆ isHostPrivate()

bool GrayLib::cNetHost6::isHostPrivate ( ) const

◆ isHostValid()

bool GrayLib::cNetHost6::isHostValid ( ) const

0 = unspecified.

◆ operator in6_addr()

GrayLib::cNetHost6::operator in6_addr ( ) const
inlinenoexcept

◆ operator==()

bool GrayLib::cNetHost6::operator== ( const in6_addr &  ip) const
inlinenoexcept

◆ put_HostStr()

HRESULT GrayLib::cNetHost6::put_HostStr ( const char *  pszIP)

inet_pton() replaces inet_addr for ipv6. ASSUME no port. RtlIpv6StringToAddress() only for Win vista or later. http://en.wikipedia.org/wiki/IPv6

Note
This must be in ip6 format. "2001:0db8:85a3:0000:0000:8a2e:0370:7334", or "2001:db8::1428:57ab" collapse zeros to ::, can only be used once in string. e.g. 2001:0db8:85a3:08d3:1319:8a2e:0370:7348 = 2001-db8-85a3-8d3-1319-8a2e-370-7348.ipv6-literal.net

◆ SetEmptyHostAddr()

void GrayLib::cNetHost6::SetEmptyHostAddr ( )
inlinenoexcept

Member Data Documentation

◆ k_AddrNull

const in6_addr GrayLib::cNetHost6::k_AddrNull = IN6ADDR_ANY_INIT
static

invalid address for initialize.

◆ m_ipa6

in6_addr GrayLib::cNetHost6::m_ipa6
protected

(network order bytes) (16 bytes)


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