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;
75 IOAddress(
const std::string& address_str);
85 IOAddress(
const boost::asio::ip::address& asio_address);
104 std::string
toText()
const;
115 return (asio_address_.is_v4());
137 return (asio_address_.is_v6());
169 std::vector<uint8_t>
toBytes()
const;
177 return (asio_address_ == other.asio_address_);
202 return (asio_address_ < other.asio_address_);
209 return (asio_address_ <= other.asio_address_);
297 boost::asio::ip::address asio_address_;
314operator<<(std::ostream& os,
const IOAddress& address);
The IOAddress class represents an IP addresses (version agnostic)
bool nequals(const IOAddress &other) const
Compare addresses for inequality.
bool operator<=(const IOAddress &other) const
Checks if one address is smaller or equal than the other.
static const IOAddress & IPV4_ZERO_ADDRESS()
Returns an address set to all zeros.
bool isV4Zero() const
Convenience function to check if it is an IPv4 zero address.
static IOAddress subtract(const IOAddress &a, const IOAddress &b)
Subtracts one address from another (a - b)
std::string toText() const
Convert the address to a string.
static const IOAddress & IPV4_BCAST_ADDRESS()
Returns a "255.255.255.255" broadcast address.
uint32_t toUint32() const
Converts IPv4 address to uint32_t.
bool isV6() const
Convenience function to check for an IPv6 address.
bool isV4() const
Convenience function to check for an IPv4 address.
std::vector< uint8_t > toBytes() const
Return address as set of bytes.
bool isV6Multicast() const
checks whether and address is IPv6 and is multicast
static IOAddress increase(const IOAddress &addr)
Returns an address increased by one.
bool isV6Zero() const
Convenience function to check if it is an IPv4 zero address.
bool equals(const IOAddress &other) const
Compare addresses for equality.
IOAddress(const std::string &address_str)
Constructor from string.
bool isV4Bcast() const
Convenience function to check if it is an IPv4 broadcast address.
bool operator!=(const IOAddress &other) const
Compare addresses for inequality.
bool operator<(const IOAddress &other) const
Checks if one address is smaller than the other.
bool isV6LinkLocal() const
checks whether and address is IPv6 and is link-local
short getFamily() const
Returns the address family.
bool operator==(const IOAddress &other) const
Compare addresses for equality.
static const IOAddress & IPV6_ZERO_ADDRESS()
Returns an IPv6 zero address.
static IOAddress fromBytes(short family, const uint8_t *data)
Creates an address from over wire data.
A wrapper interface for the ASIO library.
std::ostream & operator<<(std::ostream &os, const IOAddress &address)
Insert the IOAddress as a string into stream.
size_t hash_value(const IOAddress &address)
Hash the IOAddress.
Defines the logger used by the top-level component of kea-lfc.
An IOAddress hash enabling the use in the unordered STL containers.
size_t operator()(const IOAddress &io_address) const
A hashing operator.