NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
unsolicited-data-policy.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_FW_UNSOLICITED_DATA_POLICY_HPP
27
#define NFD_DAEMON_FW_UNSOLICITED_DATA_POLICY_HPP
28
29
#include "
face/face.hpp
"
30
31
namespace
nfd
{
32
namespace
fw {
33
36
enum class
UnsolicitedDataDecision
{
37
DROP
,
38
CACHE
39
};
40
41
std::ostream&
42
operator<<
(std::ostream& os,
UnsolicitedDataDecision
d);
43
50
class
UnsolicitedDataPolicy
: noncopyable
51
{
52
public
:
53
virtual
54
~
UnsolicitedDataPolicy
() =
default
;
55
56
virtual
UnsolicitedDataDecision
57
decide(
const
Face
& inFace,
const
Data
& data)
const
= 0;
58
59
public
:
// registry
60
template
<
typename
P>
61
static
void
62
registerPolicy
(
const
std::string& policyName = P::POLICY_NAME)
63
{
64
Registry& registry = getRegistry();
65
BOOST_ASSERT(registry.count(policyName) == 0);
66
registry[policyName] = [] {
return
make_unique<P>(); };
67
}
68
72
static
unique_ptr<UnsolicitedDataPolicy>
73
create(
const
std::string& policyName);
74
77
static
std::set<std::string>
78
getPolicyNames();
79
80
private
:
81
typedef
std::function<unique_ptr<UnsolicitedDataPolicy>()> CreateFunc;
82
typedef
std::map<std::string, CreateFunc> Registry;
// indexed by policy name
83
84
static
Registry&
85
getRegistry();
86
};
87
90
class
DropAllUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
91
{
92
public
:
93
UnsolicitedDataDecision
94
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
95
96
public
:
97
static
const
std::string
POLICY_NAME
;
98
};
99
102
class
AdmitLocalUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
103
{
104
public
:
105
UnsolicitedDataDecision
106
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
107
108
public
:
109
static
const
std::string
POLICY_NAME
;
110
};
111
114
class
AdmitNetworkUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
115
{
116
public
:
117
UnsolicitedDataDecision
118
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
119
120
public
:
121
static
const
std::string
POLICY_NAME
;
122
};
123
126
class
AdmitAllUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
127
{
128
public
:
129
UnsolicitedDataDecision
130
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
131
132
public
:
133
static
const
std::string
POLICY_NAME
;
134
};
135
138
typedef
DropAllUnsolicitedDataPolicy
DefaultUnsolicitedDataPolicy
;
139
140
}
// namespace fw
141
}
// namespace nfd
142
147
#define NFD_REGISTER_UNSOLICITED_DATA_POLICY(P) \
148
static class NfdAuto ## P ## UnsolicitedDataPolicyRegistrationClass \
149
{ \
150
public: \
151
NfdAuto ## P ## UnsolicitedDataPolicyRegistrationClass() \
152
{ \
153
::nfd::fw::UnsolicitedDataPolicy::registerPolicy<P>(); \
154
} \
155
} g_nfdAuto ## P ## UnsolicitedDataPolicyRegistrationVariable
156
157
#endif // NFD_DAEMON_FW_UNSOLICITED_DATA_POLICY_HPP
nfd::fw::AdmitAllUnsolicitedDataPolicy
admits all unsolicited Data
Definition:
unsolicited-data-policy.hpp:126
face.hpp
nfd::fw::AdmitNetworkUnsolicitedDataPolicy::POLICY_NAME
static const std::string POLICY_NAME
Definition:
unsolicited-data-policy.hpp:121
nfd::fw::UnsolicitedDataPolicy
determines how to process an unsolicited Data
Definition:
unsolicited-data-policy.hpp:50
nfd::fw::AdmitLocalUnsolicitedDataPolicy::POLICY_NAME
static const std::string POLICY_NAME
Definition:
unsolicited-data-policy.hpp:109
nfd::fw::AdmitLocalUnsolicitedDataPolicy
admits unsolicited Data from local faces
Definition:
unsolicited-data-policy.hpp:102
nfd::fw::DefaultUnsolicitedDataPolicy
DropAllUnsolicitedDataPolicy DefaultUnsolicitedDataPolicy
the default UnsolicitedDataPolicy
Definition:
unsolicited-data-policy.hpp:138
nfd::fw::DropAllUnsolicitedDataPolicy::POLICY_NAME
static const std::string POLICY_NAME
Definition:
unsolicited-data-policy.hpp:97
nfd::fw::AdmitAllUnsolicitedDataPolicy::POLICY_NAME
static const std::string POLICY_NAME
Definition:
unsolicited-data-policy.hpp:133
Face
ndn Face
Definition:
face-impl.hpp:41
nfd::fw::AdmitNetworkUnsolicitedDataPolicy
admits unsolicited Data from non-local faces
Definition:
unsolicited-data-policy.hpp:114
nfd::fw::UnsolicitedDataDecision::DROP
the Data should be dropped
nfd::fw::UnsolicitedDataPolicy::registerPolicy
static void registerPolicy(const std::string &policyName=P::POLICY_NAME)
Definition:
unsolicited-data-policy.hpp:62
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::fw::UnsolicitedDataDecision
UnsolicitedDataDecision
a decision made by UnsolicitedDataPolicy
Definition:
unsolicited-data-policy.hpp:36
nfd::fw::UnsolicitedDataDecision::CACHE
the Data should be cached in the ContentStore
nfd::fw::DropAllUnsolicitedDataPolicy
drops all unsolicited Data
Definition:
unsolicited-data-policy.hpp:90
nfd::fw::operator<<
std::ostream & operator<<(std::ostream &os, UnsolicitedDataDecision d)
Definition:
unsolicited-data-policy.cpp:34
ndn::Data
Represents a Data packet.
Definition:
data.hpp:35
ndnSIM
NFD
daemon
fw
unsolicited-data-policy.hpp
Generated on Thu Nov 2 2017 03:30:29 for ndnSIM by
1.8.11