![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cNetDNS.h>
Public Member Functions | |
cNetDNS () noexcept | |
cNetDNS (const char *pszHost, NET_PORT_t wPortDefault=k_NET_PORT_INVALID) | |
bool | SetAddrList (const hostent *pHostEnt) |
HRESULT | SetByName (const char *pszHost, NET_PORT_t wPortDefault=k_NET_PORT_INVALID) |
const cNetAddress * | GetByFamily (sa_family_t nFamily=AF_UNSPEC) const |
const cNetAddress *_cdecl | GetByFamilyV (sa_family_t nFamily,...) const |
UNITTEST_FRIEND (cNetDNS) | |
Static Public Member Functions | |
static cStringA GRAYCALL | GetHostName (const cNetAddress &rAddr, bool bAliases=false) |
static cStringA GRAYCALL | GetHostName2 (const cNetAddress &rAddr, bool bAliases=false, OUT cStringA *psPort=nullptr, bool bWait=true) |
static bool GRAYCALL | IsValidHostEntry (const hostent *pHostEnt) |
static const hostent *GRAYCALL | FindHostEntryByName (const char *pszHostName) |
Public Attributes | |
cNetAddressArray | m_AddrList |
List of cNetAddress resolved from hostname (String) on DNS. More... | |
DNS helper functions. similar to 'nslookup' command . A hostname (from DNS server) can return a list of host addresses. e.g. 1 for ip6 and 1 for ip4. etc. Allow reverse lookup of address to name. May be in local cache or a blocking call to a DNS server. Assume k_NET_HOSTNAME_MAX
|
inlinenoexcept |
|
inline |
blocking access to DNS services. May be cached or not.
|
static |
lookup hostent by name. This is an old call. it has security problems. use getaddrinfo. Legacy IPv4 version The return value is only good until the next call to this function on this thread. danger. call cNetSocket::GetLastError. on failure.
const cNetAddress * GrayLib::cNetDNS::GetByFamily | ( | sa_family_t | nFamily = AF_UNSPEC | ) | const |
Find an cNetAddress entry by preferred sa_family_t.
const cNetAddress *_cdecl GrayLib::cNetDNS::GetByFamilyV | ( | sa_family_t | nFamily, |
... | |||
) | const |
Find an cNetAddress entry by preferred sa_family_t.
|
static |
Try to reverse lookup a name for this cNetAddress. multiple host addressed in "HOSTENT" This is a blocking (synchronous) call! Legacy Equiv of GetAddrInfo() getnameinfo(). Use GetHostName2() or GetNameInfoW
|
static |
Try to reverse lookup a name for this address. Modern version of GetHostName() ::getnameinfo() NOT supported in WIN2K (or UNDER_CE ?) USE_WINSOCK2_ADDR
|
static |
valid HOSTENT ? has at least 1 entry.
bool GrayLib::cNetDNS::SetAddrList | ( | const hostent * | pHostEnt | ) |
Legacy IPv4 version
HRESULT GrayLib::cNetDNS::SetByName | ( | const char * | pszHost, |
NET_PORT_t | wPortDefault = k_NET_PORT_INVALID |
||
) |
Get the IP list from the address name we looked up. NOT set port.
GrayLib::cNetDNS::UNITTEST_FRIEND | ( | cNetDNS | ) |
cNetAddressArray GrayLib::cNetDNS::m_AddrList |
List of cNetAddress resolved from hostname (String) on DNS.