26 #ifndef NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
27 #define NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
31 #include <boost/operators.hpp>
32 #include <boost/property_tree/ptree_fwd.hpp>
34 #include <ndn-cxx/net/network-interface.hpp>
58 assign(std::initializer_list<std::pair<std::string, std::string>> whitelist,
59 std::initializer_list<std::pair<std::string, std::string>> blacklist);
82 isRuleSupported(
const std::string& key) = 0;
85 isRuleValid(
const std::string& key,
const std::string& value) = 0;
88 parseList(std::set<std::string>& set,
const boost::property_tree::ptree& list,
const std::string& section);
91 parseList(std::set<std::string>& set, std::initializer_list<std::pair<std::string, std::string>> list);
120 operator()(
const ndn::net::NetworkInterface& netif)
const;
124 isRuleSupported(
const std::string& key)
final;
127 isRuleValid(
const std::string& key,
const std::string& value)
final;
142 operator()(
const boost::asio::ip::address& address)
const;
146 isRuleSupported(
const std::string& key)
final;
149 isRuleValid(
const std::string& key,
const std::string& value)
final;
Represents a predicate to accept or reject an IP address.
bool operator()(const boost::asio::ip::address &address) const
Represents a predicate to accept or reject a ndn::net::NetworkInterface.
bool operator()(const ndn::net::NetworkInterface &netif) const
NetworkPredicateBase & operator=(const NetworkPredicateBase &)=delete
NetworkPredicateBase(const NetworkPredicateBase &)=delete
void clear()
Set the whitelist to "*" and clear the blacklist.
void parseWhitelist(const boost::property_tree::ptree &list)
NetworkPredicateBase(NetworkPredicateBase &&)=default
friend bool operator==(const NetworkPredicateBase &lhs, const NetworkPredicateBase &rhs)
std::set< std::string > m_whitelist
NetworkPredicateBase & operator=(NetworkPredicateBase &&)=default
void parseBlacklist(const boost::property_tree::ptree &list)
void assign(std::initializer_list< std::pair< std::string, std::string >> whitelist, std::initializer_list< std::pair< std::string, std::string >> blacklist)
~NetworkPredicateBase()=default
std::set< std::string > m_blacklist
#define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED