NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
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
~
UnsolicitedDataPolicy
() =
default
;
54
55
virtual
UnsolicitedDataDecision
56
decide(
const
Face
& inFace,
const
Data
& data)
const
= 0;
57
58
public
:
// registry
59
template
<
typename
P>
60
static
void
61
registerPolicy
(
const
std::string& key)
62
{
63
Registry& registry = getRegistry();
64
BOOST_ASSERT(registry.count(key) == 0);
65
registry[key] = [] {
return
make_unique<P>(); };
66
}
67
70
static
unique_ptr<UnsolicitedDataPolicy>
71
create(
const
std::string& key);
72
73
private
:
74
typedef
std::function<unique_ptr<UnsolicitedDataPolicy>()> CreateFunc;
75
typedef
std::map<std::string, CreateFunc> Registry;
// indexed by key
76
77
static
Registry&
78
getRegistry();
79
};
80
83
class
DropAllUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
84
{
85
public
:
86
virtual
UnsolicitedDataDecision
87
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
88
};
89
92
class
AdmitLocalUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
93
{
94
public
:
95
virtual
UnsolicitedDataDecision
96
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
97
};
98
101
class
AdmitNetworkUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
102
{
103
public
:
104
virtual
UnsolicitedDataDecision
105
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
106
};
107
110
class
AdmitAllUnsolicitedDataPolicy
:
public
UnsolicitedDataPolicy
111
{
112
public
:
113
virtual
UnsolicitedDataDecision
114
decide(
const
Face
& inFace,
const
Data
& data)
const
final
;
115
};
116
119
typedef
DropAllUnsolicitedDataPolicy
DefaultUnsolicitedDataPolicy
;
120
121
}
// namespace fw
122
}
// namespace nfd
123
128
#define NFD_REGISTER_UNSOLICITED_DATA_POLICY(P, key) \
129
static class NfdAuto ## P ## UnsolicitedDataPolicyRegistrationClass \
130
{ \
131
public: \
132
NfdAuto ## P ## UnsolicitedDataPolicyRegistrationClass() \
133
{ \
134
::nfd::fw::UnsolicitedDataPolicy::registerPolicy<P>(key); \
135
} \
136
} g_nfdAuto ## P ## UnsolicitedDataPolicyRegistrationVariable
137
138
#endif // NFD_DAEMON_FW_UNSOLICITED_DATA_POLICY_HPP
nfd::fw::AdmitAllUnsolicitedDataPolicy
admits all unsolicited Data
Definition:
unsolicited-data-policy.hpp:110
face.hpp
nfd::face::Face
generalization of a network interface
Definition:
face.hpp:67
nfd::fw::UnsolicitedDataPolicy
determines how to process an unsolicited Data
Definition:
unsolicited-data-policy.hpp:50
nfd::fw::UnsolicitedDataPolicy::registerPolicy
static void registerPolicy(const std::string &key)
Definition:
unsolicited-data-policy.hpp:61
nfd::fw::AdmitLocalUnsolicitedDataPolicy
admits unsolicited Data from local faces
Definition:
unsolicited-data-policy.hpp:92
nfd::fw::DefaultUnsolicitedDataPolicy
DropAllUnsolicitedDataPolicy DefaultUnsolicitedDataPolicy
the default UnsolicitedDataPolicy
Definition:
unsolicited-data-policy.hpp:119
nfd::fw::AdmitNetworkUnsolicitedDataPolicy
admits unsolicited Data from non-local faces
Definition:
unsolicited-data-policy.hpp:101
nfd::fw::UnsolicitedDataDecision::DROP
the Data should be dropped
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:83
nfd::fw::operator<<
std::ostream & operator<<(std::ostream &os, UnsolicitedDataDecision d)
Definition:
unsolicited-data-policy.cpp:32
ndn::Data
represents a Data packet
Definition:
data.hpp:37
ndnSIM
NFD
daemon
fw
unsolicited-data-policy.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13