NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
network-predicate.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014-2019, Regents of the University of California,
4
* Arizona Board of Regents,
5
* Colorado State University,
6
* University Pierre & Marie Curie, Sorbonne University,
7
* Washington University in St. Louis,
8
* Beijing Institute of Technology,
9
* The University of Memphis.
10
*
11
* This file is part of NFD (Named Data Networking Forwarding Daemon).
12
* See AUTHORS.md for complete list of NFD authors and contributors.
13
*
14
* NFD is free software: you can redistribute it and/or modify it under the terms
15
* of the GNU General Public License as published by the Free Software Foundation,
16
* either version 3 of the License, or (at your option) any later version.
17
*
18
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20
* PURPOSE. See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License along with
23
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24
*/
25
26
#ifndef NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
27
#define NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
28
29
#include "
core/common.hpp
"
30
31
#include <
ndn-cxx/net/network-interface.hpp
>
32
33
namespace
nfd
{
34
namespace
face {
35
36
class
NetworkPredicateBase
37
{
38
public
:
39
NetworkPredicateBase
();
40
41
virtual
42
~NetworkPredicateBase
();
43
47
void
48
clear
();
49
50
void
51
parseWhitelist
(
const
boost::property_tree::ptree& list);
52
53
void
54
parseBlacklist
(
const
boost::property_tree::ptree& list);
55
56
void
57
assign
(std::initializer_list<std::pair<std::string, std::string>> whitelist,
58
std::initializer_list<std::pair<std::string, std::string>> blacklist);
59
60
bool
61
operator==
(
const
NetworkPredicateBase
& other)
const
;
62
63
bool
64
operator!=
(
const
NetworkPredicateBase
& other)
const
65
{
66
return
!this->
operator==
(other);
67
}
68
69
private
:
70
virtual
bool
71
isRuleSupported(
const
std::string& key) = 0;
72
73
virtual
bool
74
isRuleValid(
const
std::string& key,
const
std::string& value) = 0;
75
76
void
77
parseList(std::set<std::string>& set,
const
boost::property_tree::ptree& list,
const
std::string& section);
78
79
void
80
parseList(std::set<std::string>& set, std::initializer_list<std::pair<std::string, std::string>> list);
81
82
PUBLIC_WITH_TESTS_ELSE_PROTECTED
:
83
std::set<std::string>
m_whitelist
;
84
std::set<std::string>
m_blacklist
;
85
};
86
97
class
NetworkInterfacePredicate
:
public
NetworkPredicateBase
98
{
99
public
:
100
bool
101
operator()
(
const
ndn::net::NetworkInterface
& netif)
const
;
102
103
private
:
104
bool
105
isRuleSupported(
const
std::string& key)
final
;
106
107
bool
108
isRuleValid(
const
std::string& key,
const
std::string& value)
final
;
109
};
110
119
class
IpAddressPredicate
:
public
NetworkPredicateBase
120
{
121
public
:
122
bool
123
operator()
(
const
boost::asio::ip::address& address)
const
;
124
125
private
:
126
bool
127
isRuleSupported(
const
std::string& key)
final
;
128
129
bool
130
isRuleValid(
const
std::string& key,
const
std::string& value)
final
;
131
};
132
133
}
// namespace face
134
}
// namespace nfd
135
136
#endif // NFD_DAEMON_FACE_NETWORK_PREDICATE_HPP
nfd::face::NetworkPredicateBase::parseWhitelist
void parseWhitelist(const boost::property_tree::ptree &list)
Definition:
network-predicate.cpp:102
nfd::face::NetworkPredicateBase::clear
void clear()
Set the whitelist to "*" and clear the blacklist.
Definition:
network-predicate.cpp:43
ndn::net::NetworkInterface
Represents one network interface attached to the host.
Definition:
network-interface.hpp:70
nfd::face::NetworkPredicateBase::operator!=
bool operator!=(const NetworkPredicateBase &other) const
Definition:
network-predicate.hpp:64
nfd::face::NetworkInterfacePredicate
Represents a predicate to accept or reject a ndn::net::NetworkInterface.
Definition:
network-predicate.hpp:98
nfd::face::NetworkPredicateBase::assign
void assign(std::initializer_list< std::pair< std::string, std::string >> whitelist, std::initializer_list< std::pair< std::string, std::string >> blacklist)
Definition:
network-predicate.cpp:114
nfd::face::NetworkPredicateBase::operator==
bool operator==(const NetworkPredicateBase &other) const
Definition:
network-predicate.cpp:166
common.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::face::NetworkInterfacePredicate::operator()
bool operator()(const ndn::net::NetworkInterface &netif) const
Definition:
network-predicate.cpp:199
nfd::face::NetworkPredicateBase::NetworkPredicateBase
NetworkPredicateBase()
Definition:
network-predicate.cpp:35
nfd::face::IpAddressPredicate::operator()
bool operator()(const boost::asio::ip::address &address) const
Definition:
network-predicate.cpp:220
nfd::face::NetworkPredicateBase
Definition:
network-predicate.hpp:37
nfd::face::NetworkPredicateBase::~NetworkPredicateBase
virtual ~NetworkPredicateBase()
nfd::face::NetworkPredicateBase::m_whitelist
std::set< std::string > m_whitelist
Definition:
network-predicate.hpp:83
network-interface.hpp
PUBLIC_WITH_TESTS_ELSE_PROTECTED
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
Definition:
common.hpp:40
nfd::face::IpAddressPredicate
Represents a predicate to accept or reject an IP address.
Definition:
network-predicate.hpp:120
nfd::face::NetworkPredicateBase::m_blacklist
std::set< std::string > m_blacklist
Definition:
network-predicate.hpp:84
nfd::face::NetworkPredicateBase::parseBlacklist
void parseBlacklist(const boost::property_tree::ptree &list)
Definition:
network-predicate.cpp:108
ndnSIM
NFD
daemon
face
network-predicate.hpp
Generated on Mon Jun 1 2020 22:32:16 for ndnSIM by
1.8.18