30 #include <boost/range/adaptor/reversed.hpp> 86 if (expirationPeriod == time::milliseconds::max())
89 m_expirationPeriod = expirationPeriod;
102 template<encoding::Tag TAG>
106 size_t totalLength = 0;
108 if (m_expirationPeriod) {
110 static_cast<uint64_t>(m_expirationPeriod->count()));
117 totalLength += block.prependVarNumber(totalLength);
136 m_wire = buffer.block();
160 m_origin = readNonNegativeIntegerAs<RouteOrigin>(*val);
206 <<
"FaceId: " << route.
getFaceId() <<
", " 207 <<
"Origin: " << route.
getOrigin() <<
", " 208 <<
"Cost: " << route.
getCost() <<
", " 215 os <<
"ExpirationPeriod: infinite";
241 m_routes.push_back(route);
254 template<encoding::Tag TAG>
258 size_t totalLength = 0;
260 for (
const auto& route : m_routes | boost::adaptors::reversed) {
261 totalLength += route.wireEncode(block);
263 totalLength += m_prefix.wireEncode(block);
265 totalLength += block.prependVarNumber(totalLength);
284 m_wire = buffer.block();
305 m_prefix.wireDecode(*val);
313 m_routes.emplace_back(*val);
324 aRoutes.
size() != bRoutes.size())
327 std::vector<bool> matched(bRoutes.size(),
false);
328 return std::all_of(aRoutes.begin(), aRoutes.end(),
329 [&] (
const Route& route) {
330 for (
size_t i = 0; i < bRoutes.size(); ++i) {
331 if (!matched[i] && bRoutes[i] == route) {
343 os <<
"RibEntry(Prefix: " << entry.
getName() <<
",\n"
Copyright (c) 2011-2015 Regents of the University of California.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
Route & setFlags(uint64_t flags)
const Name & getName() const
void wireDecode(const Block &block)
Route & setOrigin(RouteOrigin origin)
Helper class to convert a number to hexadecimal format, for use with stream insertion operators...
void parse() const
Parse TLV-VALUE into sub-elements.
time::milliseconds getExpirationPeriod() const
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ChannelStatus)
Represents a TLV element of the NDN packet format.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
element_const_iterator elements_begin() const
Equivalent to elements().begin()
represents a route in a RibEntry
void wireDecode(const Block &block)
Route & setCost(uint64_t cost)
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
element_const_iterator elements_end() const
Equivalent to elements().end()
Copyright (c) 2011-2015 Regents of the University of California.
void reset() noexcept
Reset the Block to a default-constructed state.
Backport of ostream_joiner from the Library Fundamentals v2 TS.
const Block & wireEncode() const
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
uint64_t getFaceId() const
ostream_joiner< std::decay_t< DelimT >, CharT, Traits > make_ostream_joiner(std::basic_ostream< CharT, Traits > &os, DelimT &&delimiter)
RibEntry & addRoute(const Route &route)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
Represents an absolute name.
concept check for an item in a Status Dataset
size_t size() const
Returns the number of components.
Route & unsetExpirationPeriod()
bool hasExpirationPeriod() const
uint32_t type() const noexcept
Return the TLV-TYPE of the Block.
const Block & wireEncode() const
uint64_t getFlags() const
Route & setFaceId(uint64_t faceId)
const std::vector< Route > & getRoutes() const
Route & setExpirationPeriod(time::milliseconds expirationPeriod)
RibEntry & setName(const Name &prefix)
represents an item in NFD RIB dataset
EncodingImpl< EncoderTag > EncodingBuffer
const nullopt_t nullopt((nullopt_t::init()))
RouteOrigin getOrigin() const
const uint64_t INVALID_FACE_ID
EncodingImpl< EstimatorTag > EncodingEstimator
boost::chrono::milliseconds milliseconds