30 #include <boost/algorithm/string/predicate.hpp> 
   35 namespace validator_config {
 
   38 Filter::match(uint32_t pktType, 
const Name& pktName, 
const shared_ptr<ValidationState>& state)
 
   63     return matchName(pktName);
 
   69   , m_relation(relation)
 
   74 RelationNameFilter::matchName(
const Name& name)
 
   85 RegexNameFilter::matchName(
const Name& name)
 
   87   return m_regex.
match(name);
 
   93   auto propertyIt = configSection.begin();
 
   95   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, 
"type")) {
 
   99   std::string type = propertyIt->second.data();
 
  100   if (boost::iequals(type, 
"name"))
 
  101     return createNameFilter(configSection, configFilename);
 
  107 Filter::createNameFilter(
const ConfigSection& configSection, 
const std::string& configFilename)
 
  109   auto propertyIt = configSection.begin();
 
  112   if (propertyIt == configSection.end())
 
  115   if (boost::iequals(propertyIt->first, 
"name")) {
 
  119       name = 
Name(propertyIt->second.data());
 
  122       NDN_THROW_NESTED(Error(
"Invalid <filter.name>: " + propertyIt->second.data()));
 
  128     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, 
"relation")) {
 
  129       NDN_THROW(Error(
"Expecting <filter.relation>"));
 
  135     if (propertyIt != configSection.end())
 
  136       NDN_THROW(Error(
"Expecting end of <filter>"));
 
  138     return make_unique<RelationNameFilter>(name, relation);
 
  140   else if (boost::iequals(propertyIt->first, 
"regex")) {
 
  141     std::string regexString = propertyIt->second.data();
 
  144     if (propertyIt != configSection.end())
 
  145       NDN_THROW(Error(
"Expecting end of <filter>"));
 
  148       return make_unique<RegexNameFilter>(
Regex(regexString));
 
  150     catch (
const Regex::Error&) {
 
  155     NDN_THROW(Error(
"Unrecognized <filter> property: " + propertyIt->first));
 
Represents an absolute name.
 
PartialName getPrefix(ssize_t nComponents) const
Returns a prefix of the name.
 
size_t size() const
Returns the number of components.
 
bool match(const Name &name)
 
provides a tag type for simple types
 
static unique_ptr< Filter > create(const ConfigSection &configSection, const std::string &configFilename)
Create a filter from the configuration section.
 
bool match(uint32_t pktType, const Name &pktName, const shared_ptr< ValidationState > &state)
 
RegexNameFilter(const Regex ®ex)
 
RelationNameFilter(const Name &name, NameRelation relation)
 
#define NDN_THROW_NESTED(e)
 
boost::property_tree::ptree ConfigSection
 
bool checkNameRelation(NameRelation relation, const Name &name1, const Name &name2)
check whether name1 and name2 satisfies relation
 
NameRelation getNameRelationFromString(const std::string &relationString)
convert relationString to NameRelation
 
@ V03
Sign Interest using Packet Specification v0.3 semantics.
 
const size_t MIN_SIZE
minimal number of components for Signed Interest
 
@ ParametersSha256DigestComponent