 |
Kea
1.5.0
|
Go to the documentation of this file.
15 #include <boost/asio/ip/address.hpp>
27 static constexpr
size_t V6ADDRESS_LEN = 16;
30 static constexpr
size_t V4ADDRESS_LEN = 4;
34 static constexpr
size_t V4ADDRESS_TEXT_MAX_LEN = 15u;
39 static constexpr
size_t V6ADDRESS_TEXT_MAX_LEN = 39u;
54 IOAddress(
const std::string& address_str);
74 IOAddress(
const boost::asio::ip::address& asio_address);
93 std::string
toText()
const;
104 return (asio_address_.is_v4());
126 return (asio_address_.is_v6());
158 std::vector<uint8_t>
toBytes()
const;
166 return (asio_address_ == other.asio_address_);
200 return (this->asio_address_.to_v6() < other.asio_address_.to_v6());
202 return (this->asio_address_.to_v4() < other.asio_address_.to_v4());
323 boost::asio::ip::address asio_address_;
340 operator<<(std::ostream& os,
const IOAddress& address);
344 #endif // IO_ADDRESS_H
The IOAddress class represents an IP addresses (version agnostic)
IOAddress(const std::string &address_str)
Constructor from string.
bool operator!=(const IOAddress &other) const
Compare addresses for inequality.
std::ostream & operator<<(std::ostream &os, const IOAddress &address)
Insert the IOAddress as a string into stream.
bool nequals(const IOAddress &other) const
Compare addresses for inequality.
bool isV6() const
Convenience function to check for an IPv6 address.
bool isV4Zero() const
Convenience function to check if it is an IPv4 zero address.
bool isV6LinkLocal() const
checks whether and address is IPv6 and is link-local
std::vector< uint8_t > toBytes() const
Return address as set of bytes.
bool isV4Bcast() const
Convenience function to check if it is an IPv4 broadcast address.
Defines the logger used by the top-level component of kea-dhcp-ddns.
bool smallerEqual(const IOAddress &other) const
Checks if one address is smaller or equal than the other.
static const IOAddress & IPV4_BCAST_ADDRESS()
Returns a "255.255.255.255" broadcast address.
bool lessThan(const IOAddress &other) const
Checks if one address is smaller than the other.
bool isV6Multicast() const
checks whether and address is IPv6 and is multicast
static IOAddress increase(const IOAddress &addr)
Returns an address increased by one.
static const IOAddress & IPV4_ZERO_ADDRESS()
Returns an address set to all zeros.
static IOAddress fromBytes(short family, const uint8_t *data)
Creates an address from over wire data.
std::string toText() const
Convert the address to a string.
bool operator==(const IOAddress &other) const
Compare addresses for equality.
A wrapper interface for the ASIO library.
uint32_t toUint32() const
Converts IPv4 address to uint32_t.
short getFamily() const
Returns the address family.
bool equals(const IOAddress &other) const
Compare addresses for equality.
bool isV6Zero() const
Convenience function to check if it is an IPv4 zero address.
bool operator<=(const IOAddress &other) const
Checks if one address is smaller or equal than the other.
bool operator<(const IOAddress &other) const
Checks if one address is smaller than the other.
bool isV4() const
Convenience function to check for an IPv4 address.
static IOAddress subtract(const IOAddress &a, const IOAddress &b)
Subtracts one address from another (a - b)
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.