34 #ifndef INCLUDE_OLA_NETWORK_IPV4ADDRESS_H_ 35 #define INCLUDE_OLA_NETWORK_IPV4ADDRESS_H_ 82 : m_address(other.m_address) {
91 m_address = other.m_address;
102 return m_address == other.m_address;
111 return !(*
this == other);
128 uint32_t
AsInt()
const {
return m_address; }
142 void Get(uint8_t ptr[LENGTH])
const {
143 memcpy(ptr, reinterpret_cast<const uint8_t*>(&m_address), LENGTH);
222 #endif // INCLUDE_OLA_NETWORK_IPV4ADDRESS_H_ bool operator>(const IPV4Address &other) const
Greater than operator.
Definition: IPV4Address.cpp:63
static IPV4Address * FromString(const std::string &address)
Convert a string to an IPV4Address.
Definition: IPV4Address.cpp:114
IPV4Address(const IPV4Address &other)
Copy constructor.
Definition: IPV4Address.h:81
static IPV4Address Broadcast()
Returns the broadcast address INADDR_NONE (255.255.255.255).
Definition: IPV4Address.cpp:161
IPV4Address & operator=(const IPV4Address &other)
Assignment operator.
Definition: IPV4Address.h:89
IPV4Address()
Create a new IPv4 Address set to INADDR_ANY (0.0.0.0).
Definition: IPV4Address.h:65
std::string ToString() const
Convert the IPV4Address to a string.
Definition: IPV4Address.cpp:98
static IPV4Address WildCard()
Returns the wildcard address INADDR_ANY (0.0.0.0).
Definition: IPV4Address.cpp:157
Represents a IPv4 Address.
Definition: IPV4Address.h:55
bool operator!=(const IPV4Address &other) const
Not equals operator.
Definition: IPV4Address.h:110
static IPV4Address FromStringOrDie(const std::string &address)
Convert a string to an IPV4Address or abort.
Definition: IPV4Address.cpp:132
bool operator==(const IPV4Address &other) const
Equals operator.
Definition: IPV4Address.h:101
bool IsWildcard() const
Checks if this address is the wildcard address (0.0.0.0).
Definition: IPV4Address.cpp:94
IPV4Address(uint32_t address)
Create a new IPv4 Address from an uint32.
Definition: IPV4Address.h:73
friend std::ostream & operator<<(std::ostream &out, const IPV4Address &address)
Write the string representation of this IPV4Address to an ostream.
Definition: IPV4Address.h:158
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
uint32_t AsInt() const
Return the IPV4Address as an int in network-byte order.
Definition: IPV4Address.h:128
static IPV4Address Loopback()
Returns the loopback address (127.0.0.1).
Definition: IPV4Address.cpp:165
static bool ToCIDRMask(IPV4Address address, uint8_t *mask)
Convert a subnet mask to its CIDR format value.
Definition: IPV4Address.cpp:138
void Get(uint8_t ptr[LENGTH]) const
Copy the IPV4Address to a memory location.
Definition: IPV4Address.h:142
bool operator<(const IPV4Address &other) const
Less than operator for partial ordering.
Definition: IPV4Address.cpp:58