NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
registered-prefix.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_DETAIL_REGISTERED_PREFIX_HPP
23 #define NDN_DETAIL_REGISTERED_PREFIX_HPP
24 
25 #include "../common.hpp"
26 #include "../name.hpp"
27 #include "../interest.hpp"
28 
32 
33 namespace ndn {
34 
35 class RegisteredPrefix : noncopyable
36 {
37 public:
40  typedef function<void(const nfd::ControlParameters&)> SuccessCallback;
41 
44  typedef function<void(uint32_t/*code*/,const std::string&/*reason*/)> FailureCallback;
45 
46  RegisteredPrefix(const Name& prefix,
47  const shared_ptr<InterestFilterRecord>& filter,
48  const nfd::CommandOptions& options)
49  : m_prefix(prefix)
50  , m_filter(filter)
51  , m_options(options)
52  {
53  }
54 
55  const Name&
56  getPrefix() const
57  {
58  return m_prefix;
59  }
60 
61  const shared_ptr<InterestFilterRecord>&
62  getFilter() const
63  {
64  return m_filter;
65  }
66 
67  const nfd::CommandOptions&
69  {
70  return m_options;
71  }
72 
73 private:
74  Name m_prefix;
75  shared_ptr<InterestFilterRecord> m_filter;
76  nfd::CommandOptions m_options;
77 };
78 
82 class RegisteredPrefixId;
83 
88 {
89 public:
90  explicit
91  MatchRegisteredPrefixId(const RegisteredPrefixId* registeredPrefixId)
92  : m_id(registeredPrefixId)
93  {
94  }
95 
96  bool
97  operator()(const shared_ptr<RegisteredPrefix>& registeredPrefix) const
98  {
99  return (reinterpret_cast<const RegisteredPrefixId*>(registeredPrefix.get()) == m_id);
100  }
101 private:
102  const RegisteredPrefixId* m_id;
103 };
104 
105 
106 } // namespace ndn
107 
108 #endif // NDN_DETAIL_REGISTERED_PREFIX_HPP
Copyright (c) 2011-2015 Regents of the University of California.
RegisteredPrefix(const Name &prefix, const shared_ptr< InterestFilterRecord > &filter, const nfd::CommandOptions &options)
function< void(uint32_t, const std::string &)> FailureCallback
a callback on command failure
MatchRegisteredPrefixId(const RegisteredPrefixId *registeredPrefixId)
function< void(const nfd::ControlParameters &)> SuccessCallback
a callback on command success
const Name & getPrefix() const
bool operator()(const shared_ptr< RegisteredPrefix > &registeredPrefix) const
const shared_ptr< InterestFilterRecord > & getFilter() const
contains options for ControlCommand execution
Name abstraction to represent an absolute name.
Definition: name.hpp:46
Functor to match RegisteredPrefixId.
const nfd::CommandOptions & getCommandOptions() const