Open Lighting Architecture
Latest Git
|
Represents a IPv4 Address.
All methods use network byte order unless otherwise mentioned.
Public Types | |
enum | { LENGTH = 4 } |
The length in bytes of an IPv4 address. | |
Public Member Functions | |
IPV4Address () | |
Create a new IPv4 Address set to INADDR_ANY (0.0.0.0). | |
IPV4Address (uint32_t address) | |
Create a new IPv4 Address from an uint32. More... | |
IPV4Address (const IPV4Address &other) | |
Copy constructor. More... | |
IPV4Address & | operator= (const IPV4Address &other) |
Assignment operator. More... | |
bool | operator== (const IPV4Address &other) const |
Equals operator. More... | |
bool | operator!= (const IPV4Address &other) const |
Not equals operator. More... | |
bool | operator< (const IPV4Address &other) const |
Less than operator for partial ordering. | |
bool | operator> (const IPV4Address &other) const |
Greater than operator. | |
uint32_t | AsInt () const |
Return the IPV4Address as an int in network-byte order. More... | |
bool | IsWildcard () const |
Checks if this address is the wildcard address (0.0.0.0). More... | |
void | Get (uint8_t ptr[LENGTH]) const |
Copy the IPV4Address to a memory location. More... | |
std::string | ToString () const |
Convert the IPV4Address to a string. More... | |
Static Public Member Functions | |
static IPV4Address * | FromString (const std::string &address) |
Convert a string to an IPV4Address. More... | |
static bool | FromString (const std::string &address, IPV4Address *target) |
Convert a string to an IPV4Address. More... | |
static IPV4Address | FromStringOrDie (const std::string &address) |
Convert a string to an IPV4Address or abort. More... | |
static bool | ToCIDRMask (IPV4Address address, uint8_t *mask) |
Convert a subnet mask to its CIDR format value. More... | |
static IPV4Address | WildCard () |
Returns the wildcard address INADDR_ANY (0.0.0.0). More... | |
static IPV4Address | Broadcast () |
Returns the broadcast address INADDR_NONE (255.255.255.255). More... | |
static IPV4Address | Loopback () |
Returns the loopback address (127.0.0.1). More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const IPV4Address &address) |
Write the string representation of this IPV4Address to an ostream. More... | |
|
inlineexplicit |
Create a new IPv4 Address from an uint32.
address | the ip address, in network byte order. |
|
inline |
Copy constructor.
other | the IPV4Address to copy. |
|
inline |
Return the IPV4Address as an int in network-byte order.
|
static |
Returns the broadcast address INADDR_NONE (255.255.255.255).
|
static |
Convert a string to an IPV4Address.
address | the IP address string to convert. |
|
static |
Convert a string to an IPV4Address.
address | the IP address string to convert. | |
[out] | target | the converted IPV4Address. |
|
static |
Convert a string to an IPV4Address or abort.
address | the IP address to convert. |
|
inline |
Copy the IPV4Address to a memory location.
ptr | the memory location to copy the address to. The location should be at least LENGTH bytes. |
bool ola::network::IPV4Address::IsWildcard | ( | ) | const |
Checks if this address is the wildcard address (0.0.0.0).
|
static |
Returns the loopback address (127.0.0.1).
|
inline |
Not equals operator.
other | the IPV4Address to compare. |
|
inline |
Assignment operator.
other | the IPV4Address to assign to this object. |
|
inline |
Equals operator.
other | the IPV4Address to compare. |
|
static |
Convert a subnet mask to its CIDR format value.
address | the subnet mask as an IPV4Address object |
mask | the mask variable to populate |
string ola::network::IPV4Address::ToString | ( | ) | const |
Convert the IPV4Address to a string.
|
static |
Returns the wildcard address INADDR_ANY (0.0.0.0).
|
friend |
Write the string representation of this IPV4Address to an ostream.
out | the ostream to write to. |
address | the address to write. |