NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
remote-registrator.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_RIB_REMOTE_REGISTRATOR_HPP
27
#define NFD_RIB_REMOTE_REGISTRATOR_HPP
28
29
#include "
rib.hpp
"
30
#include "
core/config-file.hpp
"
31
#include "
rib-status-publisher.hpp
"
32
33
#include <unordered_map>
34
#include <ndn-cxx/security/key-chain.hpp>
35
#include <ndn-cxx/management/nfd-controller.hpp>
36
#include <ndn-cxx/management/nfd-control-command.hpp>
37
#include <ndn-cxx/management/nfd-control-parameters.hpp>
38
#include <ndn-cxx/management/nfd-command-options.hpp>
39
#include <ndn-cxx/util/signal.hpp>
40
41
namespace
nfd
{
42
namespace
rib {
43
48
class
RemoteRegistrator
: noncopyable
49
{
50
public
:
51
class
Error
:
public
std::runtime_error
52
{
53
public
:
54
explicit
55
Error
(
const
std::string& what)
56
:
std
::runtime_error(what)
57
{
58
}
59
};
60
61
RemoteRegistrator
(
ndn::nfd::Controller
& controller,
62
ndn::KeyChain& keyChain,
63
Rib
& rib);
64
65
~RemoteRegistrator
();
66
72
void
73
loadConfig
(
const
ConfigSection
& configSection);
74
79
void
80
enable
();
81
86
void
87
disable
();
88
98
void
99
registerPrefix
(
const
Name
& prefix);
100
110
void
111
unregisterPrefix
(
const
Name
& prefix);
112
113
private
:
123
std::pair<Name, size_t>
124
findIdentityForRegistration(
const
Name
& prefix);
125
131
void
132
startRegistration(
const
ndn::nfd::ControlParameters
& parameters,
133
const
ndn::nfd::CommandOptions
& options,
134
int
nRetries);
135
141
void
142
startUnregistration(
const
ndn::nfd::ControlParameters
& parameters,
143
const
ndn::nfd::CommandOptions
& options,
144
int
nRetries);
155
void
156
onRegSuccess(
const
ndn::nfd::ControlParameters
& parameters,
157
const
ndn::nfd::CommandOptions
& options);
158
171
void
172
onRegFailure(uint32_t code,
const
std::string& reason,
173
const
ndn::nfd::ControlParameters
& parameters,
174
const
ndn::nfd::CommandOptions
& options,
175
int
nRetries);
176
177
void
178
onUnregSuccess(
const
ndn::nfd::ControlParameters
& parameters,
179
const
ndn::nfd::CommandOptions
& options);
180
193
void
194
onUnregFailure(uint32_t code,
const
std::string& reason,
195
const
ndn::nfd::ControlParameters
& parameters,
196
const
ndn::nfd::CommandOptions
& options,
197
int
nRetries);
198
204
void
205
redoRegistration();
206
212
void
213
clearRefreshEvents();
214
215
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
225
typedef
std::unordered_map<Name, scheduler::EventId> RegisteredList;
226
typedef
RegisteredList::iterator
RegisteredEntryIt;
227
typedef
RegisteredList::value_type RegisteredEntry;
228
RegisteredList m_regEntries;
229
230
private
:
231
ndn::nfd::Controller
& m_nfdController;
232
ndn::KeyChain& m_keyChain;
233
Rib
& m_rib;
234
ndn::util::signal::ScopedConnection
m_afterInsertConnection;
235
ndn::util::signal::ScopedConnection
m_afterEraseConnection;
236
ndn::nfd::ControlParameters
m_controlParameters;
237
ndn::nfd::CommandOptions
m_commandOptions;
238
time::seconds m_refreshInterval;
239
bool
m_hasConnectedHub;
240
int
m_nRetries;
241
242
static
const
Name
LOCAL_REGISTRATION_PREFIX;
// /localhost
243
static
const
Name
REMOTE_HUB_PREFIX;
// /localhop/nfd
244
static
const
name::Component
IGNORE_COMMPONENT;
// rib
245
};
246
247
}
// namespace rib
248
}
// namespace nfd
249
250
#endif // NFD_RIB_REMOTE_REGISTRATOR_HPP
nfd::rib::Rib
represents the RIB
Definition:
rib.hpp:45
ndn::nfd::ControlParameters
represents parameters in a ControlCommand request or response
Definition:
nfd-control-parameters.hpp:75
nfd::rib::RemoteRegistrator::registerPrefix
void registerPrefix(const Name &prefix)
register a prefix to remote hub(s).
Definition:
remote-registrator.cpp:143
nfd::rib::RemoteRegistrator::unregisterPrefix
void unregisterPrefix(const Name &prefix)
unregister a prefix from remote hub(s).
Definition:
remote-registrator.cpp:205
nfd::rib::RemoteRegistrator::disable
void disable()
disable remote registration/unregistration.
Definition:
remote-registrator.cpp:136
std
STL namespace.
nfd::rib::RemoteRegistrator::loadConfig
void loadConfig(const ConfigSection &configSection)
load the "remote_register" section from config file
Definition:
remote-registrator.cpp:65
rib-status-publisher.hpp
config-file.hpp
nfd::cs::iterator
Table::const_iterator iterator
Definition:
cs-internal.hpp:41
rib.hpp
ndn::nfd::CommandOptions
contains options for ControlCommand execution
Definition:
nfd-command-options.hpp:39
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:38
ndn::util::signal::ScopedConnection
disconnects a Connection automatically upon destruction
Definition:
signal-scoped-connection.hpp:33
ndn::nfd::Controller
NFD Management protocol - ControlCommand client.
Definition:
nfd-controller.hpp:41
nfd::ConfigSection
boost::property_tree::ptree ConfigSection
Definition:
ndn-l3-protocol.hpp:39
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::rib::RemoteRegistrator::Error
Definition:
remote-registrator.hpp:51
nfd::rib::RemoteRegistrator
define the RemoteRegistrator class, which handles the registration/unregistration to remote hub(s)...
Definition:
remote-registrator.hpp:48
nfd::rib::RemoteRegistrator::Error::Error
Error(const std::string &what)
Definition:
remote-registrator.hpp:55
ndn::name::Component
Component holds a read-only name component value.
Definition:
name-component.hpp:47
nfd::rib::RemoteRegistrator::RemoteRegistrator
RemoteRegistrator(ndn::nfd::Controller &controller, ndn::KeyChain &keyChain, Rib &rib)
Definition:
remote-registrator.cpp:43
nfd::rib::RemoteRegistrator::enable
void enable()
enable remote registration/unregistration.
Definition:
remote-registrator.cpp:120
nfd::rib::RemoteRegistrator::~RemoteRegistrator
~RemoteRegistrator()
Definition:
remote-registrator.cpp:55
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:39
ndnSIM
NFD
rib
remote-registrator.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11