#include <mxmIPAddress.h>
Inheritance diagram for mxmIPAddress:
Public Member Functions | |
mxmIPAddress () | |
Initializes as null -IP, which is 0.0.0.0 , no port. | |
mxmIPAddress (int ip1, int ip2, int ip3, int ip4, int port=NoPort) | |
Initializes as specified IP4 address, including port if given. | |
mxmIPAddress (const mxmString &hostName) | |
Initializes from the specified host name. | |
mxmIPAddress (const mxmIPAddress &ip) | |
Copy constructor. | |
mxmIPAddress & | operator= (const mxmIPAddress &ip) |
Assignment. | |
mxmIPAddress & | operator= (const mxmString &hostName) |
Assignment. | |
bool | operator== (const mxmIPAddress &ip) const |
Comparison. | |
bool | operator!= (const mxmIPAddress &ip) const |
Negated Comparison. | |
bool | sameHost (const mxmIPAddress &ip) const |
Comparison like above, but ignoring the port settings. | |
void | setPort (int port) |
Reconfigures port information, mxmIPAddress::NoPort unsets port. | |
int | ip1 () const |
int | ip2 () const |
int | ip3 () const |
int | ip4 () const |
int | port () const |
bool | resolved () const |
mxmString | toString () const |
Returns string representation in form of ip1.ip2.ip3.ip4[:port]
| |
bool | resolve () const |
Explicitly triggers DNS resolving. | |
Static Public Member Functions | |
static mxmIPAddress | nullIP () |
Returns a nully -IP. | |
Static Public Attributes | |
static const int | NoPort = -1 |
static const int | PortMax = 65535 |
Private Member Functions | |
void | initCommonStuff () |
void | setFromNetwork (mxm::u32 networkOrderIp) |
Uses ntohl() to properly convert the byte order - the port setting is cleared. | |
Private Attributes | |
int | IP1 |
int | IP2 |
int | IP3 |
int | IP4 |
int | Port |
mxmString | HostName |
bool | Resolved |
void * | StableABIDataExtension |
This implementation is a join of the obsoleted mxcpcIPAddress
and the former mxmIPAddress
that was developed on the camera.
The class does lazy DNS lookup automatically, i.e. the address is resolved exactly once, when the data is used. To force the DNS lookup the resolve()
method can be used.
There is a special value named null
-IP, being nonsensical 0.0.0.0
, no port. It can be conveniently used in APIs to denote "no IP set".
WSAStartup()
/ WSACleanup()
hazzle on the Windows
platform is currently transparently taken care of by mxmIPAddress
.
|
Comparison.
A comparison with unresolvable addresses involved always returns
|
|
Explicitly triggers If the address is already resolved, the method does nothing.
|
|
Reconfigures port information, Only works for resolvable addresses. |