Open Lighting Architecture
0.9.2
|
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. | |
IPV4Address (const IPV4Address &other) | |
Copy constructor. | |
IPV4Address & | operator= (const IPV4Address &other) |
Assignment operator. | |
bool | operator== (const IPV4Address &other) const |
Equals operator. | |
bool | operator!= (const IPV4Address &other) const |
Not equals operator. | |
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. | |
bool | IsWildcard () const |
Checks if this address is the wildcard address (0.0.0.0). | |
void | Get (uint8_t ptr[LENGTH]) |
Copy the IPV4Address to a memory location. | |
std::string | ToString () const |
Convert the IPV4Address to a string. |
Static Public Member Functions | |
static IPV4Address * | FromString (const std::string &address) |
Convert a string to an IPV4Address. | |
static bool | FromString (const std::string &address, IPV4Address *target) |
Convert a string to an IPV4Address. | |
static IPV4Address | FromStringOrDie (const std::string &address) |
Convert a string to an IPV4Address or abort. | |
static bool | ToCIDRMask (IPV4Address address, uint8_t *mask) |
Convert a subnet mask to its CIDR format value. | |
static IPV4Address | WildCard () |
Returns the wildcard address INADDR_ANY (0.0.0.0). | |
static IPV4Address | Broadcast () |
Returns the broadcast address INADDR_NONE (255.255.255.255). | |
static IPV4Address | Loopback () |
Returns the loopback address (127.0.0.1). |
Friends | |
std::ostream & | operator<< (std::ostream &out, const IPV4Address &address) |
Write the string representation of this IPV4Address to an ostream. |
|
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 |
Less than operator for partial ordering.
|
inline |
Assignment operator.
other | the IPV4Address to assign to this object. |
|
inline |
Equals operator.
other | the IPV4Address to compare. |
|
inline |
Greater than operator.
|
static |
Convert a subnet mask to its CIDR format value.
address | the subnet mask as an IPV4Address object |
mask | the mask variable to populate |
std::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 | to address to write. |