26 #ifndef NFD_CORE_NETWORK_HPP
27 #define NFD_CORE_NETWORK_HPP
29 #include <boost/asio/ip/address.hpp>
30 #include <boost/operators.hpp>
32 #include <string_view>
36 class Network :
private boost::equality_comparable<Network>
41 Network(
const boost::asio::ip::address& minAddress,
42 const boost::asio::ip::address& maxAddress);
45 doesContain(
const boost::asio::ip::address& address)
const noexcept
47 return m_minAddress <= address && address <= m_maxAddress;
63 return lhs.m_minAddress == rhs.m_minAddress &&
64 lhs.m_maxAddress == rhs.m_maxAddress;
74 boost::asio::ip::address m_minAddress;
75 boost::asio::ip::address m_maxAddress;
79 operator<<(std::ostream& os,
const Network& network);
82 operator>>(std::istream& is, Network& network);
friend std::istream & operator>>(std::istream &is, Network &network)
static bool isValidCidr(std::string_view cidr) noexcept
static const Network & getMaxRangeV6()
static const Network & getMaxRangeV4()
bool doesContain(const boost::asio::ip::address &address) const noexcept
friend std::ostream & operator<<(std::ostream &os, const Network &network)
friend bool operator==(const Network &lhs, const Network &rhs) noexcept
std::ostream & operator<<(std::ostream &os, const Network &network)
std::istream & operator>>(std::istream &is, Network &network)