NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
rib-entry.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2019 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_MGMT_NFD_RIB_ENTRY_HPP
23
#define NDN_MGMT_NFD_RIB_ENTRY_HPP
24
25
#include "
ndn-cxx/name.hpp
"
26
#include "
ndn-cxx/encoding/block.hpp
"
27
#include "
ndn-cxx/mgmt/nfd/route-flags-traits.hpp
"
28
#include "
ndn-cxx/util/time.hpp
"
29
30
namespace
ndn
{
31
namespace
nfd
{
32
42
class
Route
:
public
RouteFlagsTraits
<Route>
43
{
44
public
:
45
class
Error
:
public
tlv::Error
46
{
47
public
:
48
using
tlv::Error::Error
;
49
};
50
51
Route
();
52
53
explicit
54
Route
(
const
Block
& block);
55
56
uint64_t
57
getFaceId
()
const
58
{
59
return
m_faceId;
60
}
61
62
Route
&
63
setFaceId
(uint64_t faceId);
64
65
RouteOrigin
66
getOrigin
()
const
67
{
68
return
m_origin;
69
}
70
71
Route
&
72
setOrigin
(
RouteOrigin
origin);
73
74
uint64_t
75
getCost
()
const
76
{
77
return
m_cost;
78
}
79
80
Route
&
81
setCost
(uint64_t cost);
82
83
uint64_t
84
getFlags
()
const
85
{
86
return
m_flags;
87
}
88
89
Route
&
90
setFlags
(uint64_t flags);
91
92
bool
93
hasExpirationPeriod
()
const
94
{
95
return
!!m_expirationPeriod;
96
}
97
98
time::milliseconds
99
getExpirationPeriod
()
const
100
{
101
return
m_expirationPeriod ? *m_expirationPeriod : time::milliseconds::max();
102
}
103
104
Route
&
105
setExpirationPeriod
(time::milliseconds expirationPeriod);
106
107
Route
&
108
unsetExpirationPeriod
();
109
110
template
<encoding::Tag TAG>
111
size_t
112
wireEncode
(
EncodingImpl<TAG>
& block)
const
;
113
114
const
Block
&
115
wireEncode
()
const
;
116
117
void
118
wireDecode
(
const
Block
& block);
119
120
private
:
121
uint64_t m_faceId;
122
RouteOrigin
m_origin;
123
uint64_t m_cost;
124
uint64_t m_flags;
125
optional<time::milliseconds> m_expirationPeriod;
126
127
mutable
Block
m_wire;
128
};
129
130
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
Route
);
131
132
bool
133
operator==
(
const
Route
& a,
const
Route
& b);
134
135
inline
bool
136
operator!=
(
const
Route
& a,
const
Route
& b)
137
{
138
return
!(a == b);
139
}
140
141
std::ostream&
142
operator<<
(std::ostream& os,
const
Route
& route);
143
144
153
class
RibEntry
154
{
155
public
:
156
class
Error
:
public
tlv::Error
157
{
158
public
:
159
using
tlv::Error::Error
;
160
};
161
162
RibEntry
();
163
164
explicit
165
RibEntry
(
const
Block
& block);
166
167
const
Name
&
168
getName
()
const
169
{
170
return
m_prefix;
171
}
172
173
RibEntry
&
174
setName
(
const
Name
& prefix);
175
176
const
std::vector<Route>&
177
getRoutes
()
const
178
{
179
return
m_routes;
180
}
181
182
template
<
typename
InputIt>
183
RibEntry
&
184
setRoutes
(InputIt first, InputIt last)
185
{
186
m_routes.assign(first, last);
187
m_wire.
reset
();
188
return
*
this
;
189
}
190
191
RibEntry
&
192
addRoute
(
const
Route
& route);
193
194
RibEntry
&
195
clearRoutes
();
196
197
template
<encoding::Tag TAG>
198
size_t
199
wireEncode
(
EncodingImpl<TAG>
& block)
const
;
200
201
const
Block
&
202
wireEncode
()
const
;
203
204
void
205
wireDecode
(
const
Block
& block);
206
207
private
:
208
Name
m_prefix;
209
std::vector<Route> m_routes;
210
211
mutable
Block
m_wire;
212
};
213
214
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
(
RibEntry
);
215
216
bool
217
operator==
(
const
RibEntry
& a,
const
RibEntry
& b);
218
219
inline
bool
220
operator!=
(
const
RibEntry
& a,
const
RibEntry
& b)
221
{
222
return
!(a == b);
223
}
224
225
std::ostream&
226
operator<<
(std::ostream& os,
const
RibEntry
& entry);
227
228
}
// namespace nfd
229
}
// namespace ndn
230
231
#endif // NDN_MGMT_NFD_RIB_ENTRY_HPP
ndn::nfd::Route
represents a route in a RibEntry
Definition:
rib-entry.hpp:43
ndn::nfd::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
ndn::nfd::Route::getExpirationPeriod
time::milliseconds getExpirationPeriod() const
Definition:
rib-entry.hpp:99
ndn::nfd::Route::setCost
Route & setCost(uint64_t cost)
Definition:
rib-entry.cpp:68
ndn::nfd::Route::getCost
uint64_t getCost() const
Definition:
rib-entry.hpp:75
ndn::nfd::Route::setFlags
Route & setFlags(uint64_t flags)
Definition:
rib-entry.cpp:76
ndn::nfd::operator<<
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Definition:
nfd-constants.cpp:36
ndn::nfd::Route::wireEncode
const Block & wireEncode() const
Definition:
rib-entry.cpp:125
ndn::nfd::RibEntry::setRoutes
RibEntry & setRoutes(InputIt first, InputIt last)
Definition:
rib-entry.hpp:184
ndn::nfd::RibEntry::clearRoutes
RibEntry & clearRoutes()
Definition:
rib-entry.cpp:247
block.hpp
ndn::nfd::Route::getFlags
uint64_t getFlags() const
Definition:
rib-entry.hpp:84
ndn::nfd::Route::setExpirationPeriod
Route & setExpirationPeriod(time::milliseconds expirationPeriod)
Definition:
rib-entry.cpp:84
name.hpp
ndn::nfd::Route::unsetExpirationPeriod
Route & unsetExpirationPeriod()
Definition:
rib-entry.cpp:95
ndn::nfd::Route::wireDecode
void wireDecode(const Block &block)
Definition:
rib-entry.cpp:141
ndn::nfd::RibEntry::Error
Definition:
rib-entry.hpp:157
ndn::Block::reset
void reset() noexcept
Reset the Block to a default-constructed state.
Definition:
block.cpp:250
ndn::nfd::RouteOrigin
RouteOrigin
Definition:
nfd-constants.hpp:99
ndn::nfd::Route::getFaceId
uint64_t getFaceId() const
Definition:
rib-entry.hpp:57
ndn::nfd::RibEntry::RibEntry
RibEntry()
ndn::Name
Represents an absolute name.
Definition:
name.hpp:44
ndn::nfd::RibEntry
represents an item in NFD RIB dataset
Definition:
rib-entry.hpp:154
ndn::nfd::Route::getOrigin
RouteOrigin getOrigin() const
Definition:
rib-entry.hpp:66
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
ndn::nfd::Route::hasExpirationPeriod
bool hasExpirationPeriod() const
Definition:
rib-entry.hpp:93
ndn::nfd::RibEntry::getRoutes
const std::vector< Route > & getRoutes() const
Definition:
rib-entry.hpp:177
route-flags-traits.hpp
ndn::nfd::RibEntry::wireDecode
void wireDecode(const Block &block)
Definition:
rib-entry.cpp:289
ndn::nfd::RibEntry::setName
RibEntry & setName(const Name &prefix)
Definition:
rib-entry.cpp:231
ndn::encoding::EncodingImpl
Definition:
encoding-buffer-fwd.hpp:36
ndn::nfd::Route::Route
Route()
Definition:
rib-entry.cpp:38
ndn::nfd::Route::Error
Definition:
rib-entry.hpp:46
ndn::Block
Represents a TLV element of NDN packet format.
Definition:
block.hpp:43
nfd::rib::RibEntry
RibEntry
Definition:
rib-entry.cpp:34
ndn::nfd::RibEntry::wireEncode
const Block & wireEncode() const
Definition:
rib-entry.cpp:273
ndn::tlv::nfd::Route
@ Route
Definition:
tlv-nfd.hpp:103
ndn::nfd::operator!=
bool operator!=(const ChannelStatus &a, const ChannelStatus &b)
Definition:
channel-status.hpp:81
ndn::nfd::operator==
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
Definition:
channel-status.cpp:97
time.hpp
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition:
tlv.hpp:53
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition:
tlv.cpp:27
ndn::nfd::RibEntry::addRoute
RibEntry & addRoute(const Route &route)
Definition:
rib-entry.cpp:239
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::nfd::RouteFlagsTraits
defines getters for each route inheritance flag
Definition:
route-flags-traits.hpp:39
ndn::nfd::RibEntry::getName
const Name & getName() const
Definition:
rib-entry.hpp:168
ndn::nfd::Route::setFaceId
Route & setFaceId(uint64_t faceId)
Definition:
rib-entry.cpp:52
ndn::nfd::Route::setOrigin
Route & setOrigin(RouteOrigin origin)
Definition:
rib-entry.cpp:60
ndnSIM
ndn-cxx
ndn-cxx
mgmt
nfd
rib-entry.hpp
Generated on Mon Jun 1 2020 22:32:16 for ndnSIM by
1.8.18