Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cNetDNS.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cNetDNS_H
7 #define _INC_cNetDNS_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cNetAddr.h"
13 
14 namespace GrayLib
15 {
17 
19  {
26 
27  public:
29 
30  public:
31  cNetDNS() noexcept
32  {
33  }
34  cNetDNS(const char* pszHost, NET_PORT_t wPortDefault = k_NET_PORT_INVALID)
35  {
37  SetByName(pszHost, wPortDefault);
38  }
39 
40  static cStringA GRAYCALL GetHostName(const cNetAddress& rAddr, bool bAliases = false);
41  static cStringA GRAYCALL GetHostName2(const cNetAddress& rAddr, bool bAliases = false, OUT cStringA* psPort = nullptr, bool bWait = true);
42 
43  static bool GRAYCALL IsValidHostEntry(const hostent* pHostEnt);
44  static const hostent* GRAYCALL FindHostEntryByName(const char* pszHostName);
45 
46  bool SetAddrList(const hostent* pHostEnt);
47 
48 #ifdef USE_WINSOCK2_ADDR
49  // Stuff not supported in <= Win2K or UNDER_CE
50  static const addrinfo* GRAYCALL FindAddrInfoByName(const char* pszHostName, NET_PORT_t wPortDefault = k_NET_PORT_INVALID, sa_family_t nFamily = AF_UNSPEC);
51  static void GRAYCALL FreeAddrInfoX(const addrinfo* pAddr);
52  bool SetAddrList(const addrinfo* pAddr);
53 #endif
54 
55  HRESULT SetByName(const char* pszHost, NET_PORT_t wPortDefault = k_NET_PORT_INVALID);
56  const cNetAddress* GetByFamily(sa_family_t nFamily = AF_UNSPEC) const;
57  const cNetAddress* _cdecl GetByFamilyV(sa_family_t nFamily, ...) const;
58 
60  };
61 }
62 #endif // _INC_cNetDNS_H
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
short sa_family_t
enum of network family types. e.g. AF_UNSPEC=0, AF_INET = 2, AF_INET6 = 23, AF_NETBIOS = 17,...
Definition: cNetHost.h:19
Definition: cNetAddr.h:31
Definition: cNetDNS.h:19
cNetAddressArray m_AddrList
List of cNetAddress resolved from hostname (String) on DNS.
Definition: cNetDNS.h:28
cNetDNS(const char *pszHost, NET_PORT_t wPortDefault=k_NET_PORT_INVALID)
Definition: cNetDNS.h:34
UNITTEST_FRIEND(cNetDNS)
cNetDNS() noexcept
Definition: cNetDNS.h:31
Definition: cMesh.h:22
WORD NET_PORT_t
WinINet calls ports NET_PORT_t INTERNET_PORT = a service.
Definition: cNetPort.h:21
UNITTEST2_PREDEF(cQuadtree)