![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cNetHost.h>
Public Member Functions | |
cNetHost4 () noexcept | |
cNetHost4 (UINT uIP4) noexcept | |
cNetHost4 (const in_addr &ip) noexcept | |
cNetHost4 (const char *pszIP) | |
bool | isHostValid () const noexcept |
bool | isHostLoopback () const noexcept |
bool | isHostBroadcast () const noexcept |
bool | isHostPrivate () const |
bool | isHostLocalTo (const cNetHost4 &ip, UINT32 dwMask=0xFFFFFF00) const noexcept |
bool | operator== (cNetHost4 ip) const noexcept |
void | SetEmptyHostAddr () noexcept |
operator in_addr () const noexcept | |
BYTE | GetByte (int i=0) const |
in_addr | get_HostIp4 () const noexcept |
UINT32 | get_HostIp4_H () const noexcept |
void | put_HostIp4 (in_addr addr4) noexcept |
void | put_HostIp4_H (UINT32 uIP4) noexcept |
void | put_HostLoopback () noexcept |
HASHCODE32_t | get_HashCode () const noexcept |
cStringA | get_HostStr () const |
HRESULT | put_HostStr (const char *pszIP) |
UNITTEST_FRIEND (cNetHost) | |
Static Public Member Functions | |
static StrLen_t GRAYCALL | GetIP4Format (const char *pszIP, bool bTerm=true) |
Static Public Attributes | |
static const UINT32 | k_LOOPBACK_N = 0x7F000001 |
INADDR_LOOPBACK in network order bytes. INADDR_LOOPBACK. More... | |
static const UINT32 | k_BROADCAST = 0xFFFFFFFF |
INADDR_BROADCAST. More... | |
static const in_addr | k_AddrNull |
invalid address. INADDR_ANY (NOT INADDR_NONE) More... | |
static const in_addr | k_AddrBroadcast |
Broadcast. INADDR_BROADCAST. More... | |
Protected Attributes | |
in_addr | m_ipa4 |
(network order bytes) (4 bytes) More... | |
AF_INET The machine/host IPv4 32 bit address. (network order bytes) Not the port and does NOT handle IPv6 of course. ASSERT sizeof(cNetHost4) = 4 = sizeof(in_addr) = sizeof(IN_ADDR)
INADDR_ANY (u_long)0x00000000 INADDR_LOOPBACK 0x7f000001 = host order bytes INADDR_BROADCAST (u_long)0xffffffff INADDR_NONE 0xffffffff
|
inlinenoexcept |
|
inlineexplicitnoexcept |
init via Host order 32 bit IP address.
|
inlinenoexcept |
|
inline |
Set IP as "1.2.3.4" format. Any port info (or host name) is ignored/lost.
|
inlinenoexcept |
get a hash code for the IP address alone. not including port number. for sorting by the IP. ASSUME sort host order.
|
inlinenoexcept |
just get the address as a 32 bit struct. Net Order
|
inlinenoexcept |
just get the address as a 32 bit number. Host Order. Now i can compare against INADDR_LOOPBACK.
cStringA GrayLib::cNetHost4::get_HostStr | ( | ) | const |
Return the numeric "1.1.1.1" string like deprecated "::inet_ntoa()"
|
inline |
get s_net,s_host,s_lh,s_impno,
is pszIP in format of "1.1.1.1"?
|
inlinenoexcept |
broadcast on my LAN?
|
inlinenoexcept |
is this IP on the same local sub net ? dwMask = host order. Private address ranges are local by definition? cause we can either reach them or we can't? dwMask = 0xFFFFFF00 = 255.255.255.0 - host order.
|
inlinenoexcept |
my local loop back address?
|
inline |
private LAN address ranges. Not for the general Internet.
|
inlinenoexcept |
is NOT 0, but 0xffffffff=INADDR_NONE = broadcast is OK.
|
inlinenoexcept |
Get network order structure.
|
inlinenoexcept |
|
inlinenoexcept |
in_addr = network order.
|
inlinenoexcept |
uIP4 = host order. m_ipa4 = network order.
|
inlinenoexcept |
in_addr = network order.
HRESULT GrayLib::cNetHost4::put_HostStr | ( | const char * | pszIP | ) |
|
inlinenoexcept |
DO NOT reflect up to set the m_sAddrName
GrayLib::cNetHost4::UNITTEST_FRIEND | ( | cNetHost | ) |
|
static |
Broadcast. INADDR_BROADCAST.
|
static |
invalid address. INADDR_ANY (NOT INADDR_NONE)
|
static |
INADDR_BROADCAST.
|
static |
INADDR_LOOPBACK in network order bytes. INADDR_LOOPBACK.
|
protected |
(network order bytes) (4 bytes)