nfd::IpAddressPredicate Class Reference

Represents a predicate to accept or reject an IP address. More...

#include <core/network-predicate.hpp>

+ Inheritance diagram for nfd::IpAddressPredicate:
+ Collaboration diagram for nfd::IpAddressPredicate:

Public Member Functions

void assign (std::initializer_list< std::pair< std::string, std::string >> whitelist, std::initializer_list< std::pair< std::string, std::string >> blacklist)
 
void clear ()
 Set the whitelist to "*" and clear the blacklist. More...
 
bool operator!= (const NetworkPredicateBase &other) const
 
bool operator() (const boost::asio::ip::address &address) const
 
bool operator== (const NetworkPredicateBase &other) const
 
void parseBlacklist (const boost::property_tree::ptree &list)
 
void parseWhitelist (const boost::property_tree::ptree &list)
 

Protected Attributes

std::set< std::string > m_blacklist
 
std::set< std::string > m_whitelist
 

Detailed Description

Represents a predicate to accept or reject an IP address.

The predicate consists of a whitelist and a blacklist. Whitelist and blacklist can contain, in no particular order, IPv4 and IPv6 subnets (e.g., subnet 192.0.2.0/24 or subnet 2001:db8:2::/64) or a wildcard (*) that matches all IP addresses. An IP address is accepted if it matches any entry in the whitelist and none of the entries in the blacklist.

Definition at line 117 of file network-predicate.hpp.

Member Function Documentation

void nfd::NetworkPredicateBase::assign ( std::initializer_list< std::pair< std::string, std::string >>  whitelist,
std::initializer_list< std::pair< std::string, std::string >>  blacklist 
)
inherited

Definition at line 109 of file network-predicate.cpp.

void nfd::NetworkPredicateBase::clear ( )
inherited

Set the whitelist to "*" and clear the blacklist.

Definition at line 43 of file network-predicate.cpp.

bool nfd::NetworkPredicateBase::operator!= ( const NetworkPredicateBase other) const
inlineinherited

Definition at line 62 of file network-predicate.hpp.

bool nfd::IpAddressPredicate::operator() ( const boost::asio::ip::address &  address) const

Definition at line 215 of file network-predicate.cpp.

bool nfd::NetworkPredicateBase::operator== ( const NetworkPredicateBase other) const
inherited

Definition at line 161 of file network-predicate.cpp.

void nfd::NetworkPredicateBase::parseBlacklist ( const boost::property_tree::ptree &  list)
inherited

Definition at line 103 of file network-predicate.cpp.

void nfd::NetworkPredicateBase::parseWhitelist ( const boost::property_tree::ptree &  list)
inherited

Definition at line 97 of file network-predicate.cpp.

Member Data Documentation

std::set<std::string> nfd::NetworkPredicateBase::m_blacklist
protectedinherited

Definition at line 82 of file network-predicate.hpp.

std::set<std::string> nfd::NetworkPredicateBase::m_whitelist
protectedinherited

Definition at line 81 of file network-predicate.hpp.