NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
unsolicited-data-policy.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
27 
28 namespace nfd {
29 namespace fw {
30 
31 std::ostream&
32 operator<<(std::ostream& os, UnsolicitedDataDecision d)
33 {
34  switch (d) {
36  return os << "drop";
38  return os << "cache";
39  }
40  return os << static_cast<int>(d);
41 }
42 
43 UnsolicitedDataPolicy::Registry&
44 UnsolicitedDataPolicy::getRegistry()
45 {
46  static Registry registry;
47  return registry;
48 }
49 
50 unique_ptr<UnsolicitedDataPolicy>
51 UnsolicitedDataPolicy::create(const std::string& key)
52 {
53  Registry& registry = getRegistry();
54  auto i = registry.find(key);
55  return i == registry.end() ? nullptr : i->second();
56 }
57 
59 
61 DropAllUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
62 {
64 }
65 
67 
69 AdmitLocalUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
70 {
71  if (inFace.getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
73  }
75 }
76 
78 
80 AdmitNetworkUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
81 {
82  if (inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
84  }
86 }
87 
89 
91 AdmitAllUnsolicitedDataPolicy::decide(const Face& inFace, const Data& data) const
92 {
94 }
95 
96 } // namespace fw
97 } // namespace nfd
virtual UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
#define NFD_REGISTER_UNSOLICITED_DATA_POLICY(P, key)
registers an unsolicited data policy
generalization of a network interface
Definition: face.hpp:67
virtual UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
virtual UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final
admits unsolicited Data from local faces
admits unsolicited Data from non-local faces
the Data should be dropped
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
ndn::nfd::FaceScope getScope() const
Definition: face.hpp:265
UnsolicitedDataDecision
a decision made by UnsolicitedDataPolicy
the Data should be cached in the ContentStore
std::ostream & operator<<(std::ostream &os, UnsolicitedDataDecision d)
represents a Data packet
Definition: data.hpp:37
static unique_ptr< UnsolicitedDataPolicy > create(const std::string &key)
virtual UnsolicitedDataDecision decide(const Face &inFace, const Data &data) const final