NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
command-validator.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25
#ifndef NFD_DAEMON_MGMT_COMMAND_VALIDATOR_HPP
26
#define NFD_DAEMON_MGMT_COMMAND_VALIDATOR_HPP
27
28
#include "common.hpp"
29
#include "config-file.hpp"
30
#include <ndn-cxx/util/command-interest-validator.hpp>
31
32
namespace
nfd
{
33
34
class
CommandValidator
35
{
36
public
:
37
38
class
Error
:
public
std::runtime_error
39
{
40
public
:
41
explicit
42
Error
(
const
std::string& what)
43
:
std
::runtime_error(what)
44
{
45
46
}
47
};
48
49
CommandValidator
();
50
51
~CommandValidator
();
52
53
void
54
setConfigFile
(
ConfigFile
& configFile);
55
62
void
63
onConfig
(
const
ConfigSection
& section,
bool
isDryRun,
const
std::string& filename);
64
69
void
70
addSupportedPrivilege
(
const
std::string& privilege);
71
72
void
73
addInterestRule
(
const
std::string& regex,
74
const
ndn::IdentityCertificate
& certificate);
75
76
void
77
addInterestRule
(
const
std::string& regex,
78
const
Name
& keyName,
79
const
ndn::PublicKey
& publicKey);
80
81
void
82
validate
(
const
Interest
& interest,
83
const
ndn::OnInterestValidated
& onValidated,
84
const
ndn::OnInterestValidationFailed
& onValidationFailed);
85
86
private
:
87
ndn::CommandInterestValidator
m_validator;
88
std::set<std::string> m_supportedPrivileges;
89
};
90
91
inline
void
92
CommandValidator::addInterestRule
(
const
std::string& regex,
93
const
ndn::IdentityCertificate
& certificate)
94
{
95
m_validator.addInterestRule(regex, certificate);
96
}
97
98
inline
void
99
CommandValidator::addInterestRule
(
const
std::string& regex,
100
const
Name
& keyName,
101
const
ndn::PublicKey
& publicKey)
102
{
103
m_validator.addInterestRule(regex, keyName, publicKey);
104
}
105
106
inline
void
107
CommandValidator::validate
(
const
Interest
& interest,
108
const
ndn::OnInterestValidated
& onValidated,
109
const
ndn::OnInterestValidationFailed
& onValidationFailed)
110
{
111
m_validator.validate(interest, onValidated, onValidationFailed);
112
}
113
114
}
// namespace nfd
115
116
#endif // NFD_DAEMON_MGMT_COMMAND_VALIDATOR_HPP
nfd::CommandValidator::addInterestRule
void addInterestRule(const std::string ®ex, const ndn::IdentityCertificate &certificate)
Definition:
command-validator.hpp:92
nfd::CommandValidator::setConfigFile
void setConfigFile(ConfigFile &configFile)
Definition:
command-validator.cpp:49
ndn::CommandInterestValidator
Helper class to validate CommandInterests.
Definition:
command-interest-validator.hpp:42
nfd::ConfigFile
Definition:
config-file.hpp:48
std
STL namespace.
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:45
nfd::CommandValidator::onConfig
void onConfig(const ConfigSection §ion, bool isDryRun, const std::string &filename)
Definition:
command-validator.cpp:66
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::CommandValidator
Definition:
command-validator.hpp:34
nfd::CommandValidator::CommandValidator
CommandValidator()
Definition:
command-validator.cpp:38
nfd::CommandValidator::Error::Error
Error(const std::string &what)
Definition:
command-validator.hpp:42
nfd::ConfigSection
boost::property_tree::ptree ConfigSection
Definition:
ndn-l3-protocol.hpp:38
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::CommandValidator::Error
Definition:
command-validator.hpp:38
ndn::OnInterestValidationFailed
function< void(const shared_ptr< const Interest > &, const std::string &)> OnInterestValidationFailed
Callback to report a failed Interest validation.
Definition:
validation-request.hpp:35
nfd::CommandValidator::validate
void validate(const Interest &interest, const ndn::OnInterestValidated &onValidated, const ndn::OnInterestValidationFailed &onValidationFailed)
Definition:
command-validator.hpp:107
ndn::PublicKey
Definition:
public-key.hpp:41
nfd::CommandValidator::addSupportedPrivilege
void addSupportedPrivilege(const std::string &privilege)
Definition:
command-validator.cpp:213
ndn::OnInterestValidated
function< void(const shared_ptr< const Interest > &)> OnInterestValidated
Callback to report a successful Interest validation.
Definition:
validation-request.hpp:31
ndn::IdentityCertificate
Definition:
identity-certificate.hpp:32
nfd::CommandValidator::~CommandValidator
~CommandValidator()
Definition:
command-validator.cpp:43
ndnSIM
NFD
daemon
mgmt
command-validator.hpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12