![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cNetAddrName.h>
Public Member Functions | |
cNetAddrName (NET_PORT_t wPortDefault=k_NET_PORT_INVALID) | |
cNetAddrName (const char *pszHostAndPort, bool bWait=false) | |
cNetAddrName (const char *pszHostAndMaybePort, NET_PORT_t wPortDefault, bool bWait=false) | |
cNetAddrName (in_addr ip, NET_PORT_t wPort) | |
HRESULT | UpdateHostAddrFromName (bool bWait) |
HRESULT | UpdateHostNameFromAddr (bool bWait) |
bool | isAddrValid () const |
const cNetAddress & | get_Addr () const |
cNetAddress & | ref_Addr () |
HRESULT | SetAddr (const cNetAddress &rAddr, bool bWait=false) |
NET_PORT_t | get_AddrPort () const |
void | SetAddrPort (NET_PORT_t wPort, bool bHasNonDefaultPort=false) |
bool | MakeValidHostAddr () |
bool | isEmptyAddrName () const |
void | SetEmptyAddrName () |
cStringA | get_AddrName () const |
HRESULT | SetAddrName (cStringA sAddr, bool bWait=false) |
cStringA | get_HostName () const |
HRESULT | SetHostName (const char *pszHost, bool bWait=false) |
HRESULT | SetHostNameLocal (bool bWait) |
void | ResetHost () |
UNITTEST_FRIEND (cNetAddrName) | |
Static Public Member Functions | |
static bool | IsValidHostNameChar (char ch) |
Protected Member Functions | |
void | FixAddrName () |
Protected Attributes | |
cStringA | m_sAddrName |
This can be "hostname:port" or just "hostname". use NI_MAXHOST. More... | |
NET_PORT_t | m_wPortDefault |
This default port might (need not) be in name string. m_sAddrName. More... | |
cNetAddress | m_Addr |
resolved/Converted to native binary format. (NOTE: this may just be the first in a list resolved from DNS) More... | |
the resolved net address + port from the original DNS host name (or ip address) string (plus port). the IP for the host name may change (or have multiple values). we can re-resolve the host name via DNS later. This can be "hostname:port" or "IP:port" may or may not have a port.
k_NET_HOSTNAME_MAX = NI_MAXHOST = max length of a host name. (was MAXHOSTNAMELEN?) Windows = 255 or 1024 ? Solaris = 256 characters OLD UNIX version code = 99 HP-UX = 64 characters
|
inline |
invalid address.
|
inline |
|
inline |
Set the address by hostname.
|
inline |
IPv4 = cNetHost4
|
protected |
Strip port from the m_sAddrName text if its the default port else leave it in.
|
inline |
|
inline |
|
inline |
cStringA GrayLib::cNetAddrName::get_HostName | ( | ) | const |
|
inline |
|
inline |
|
inlinestatic |
|
inline |
Update IP address from name only if needed. Leave port.
|
inline |
for use with cNetHostAsync::AsyncComplete
|
inline |
Reset just host (so it will re-resolve) but not the port.
|
inline |
set the host and port by name.
void GrayLib::cNetAddrName::SetAddrPort | ( | NET_PORT_t | wPort, |
bool | bHasNonDefaultPort = false |
||
) |
Set just the port. Reflect this back to the AddrName if not default port.
|
inline |
HRESULT GrayLib::cNetAddrName::SetHostName | ( | const char * | pszHost, |
bool | bWait = false |
||
) |
strip out port if it has one.
HRESULT GrayLib::cNetAddrName::SetHostNameLocal | ( | bool | bWait | ) |
Set this to the local host name. port is not set. lookup my actual IP if they want me to (and possible).
GrayLib::cNetAddrName::UNITTEST_FRIEND | ( | cNetAddrName | ) |
HRESULT GrayLib::cNetAddrName::UpdateHostAddrFromName | ( | bool | bWait | ) |
Update IP address from name. port will not change. sometimes the IP address will change for the same host name over time! DNS lease expires, etc.
HRESULT GrayLib::cNetAddrName::UpdateHostNameFromAddr | ( | bool | bWait | ) |
Find the best DNS host name for the IP address. port not effected.
|
protected |
resolved/Converted to native binary format. (NOTE: this may just be the first in a list resolved from DNS)
|
protected |
This can be "hostname:port" or just "hostname". use NI_MAXHOST.
Save the address name (hostname:port) that will be converted to an IP:port.
|
protected |
This default port might (need not) be in name string. m_sAddrName.