29 #include <boost/range/adaptor/reversed.hpp>
75 if (expirationPeriod == time::milliseconds::max())
78 m_expirationPeriod = expirationPeriod;
86 m_expirationPeriod = std::nullopt;
91 template<encoding::Tag TAG>
95 size_t totalLength = 0;
97 if (m_expirationPeriod) {
99 static_cast<uint64_t
>(m_expirationPeriod->count()));
106 totalLength += block.prependVarNumber(totalLength);
125 m_wire = buffer.block();
149 m_origin = readNonNegativeIntegerAs<RouteOrigin>(*val);
177 m_expirationPeriod = std::nullopt;
195 <<
"FaceId: " << route.
getFaceId() <<
", "
196 <<
"Origin: " << route.
getOrigin() <<
", "
197 <<
"Cost: " << route.
getCost() <<
", "
204 os <<
"ExpirationPeriod: infinite";
230 m_routes.push_back(route);
243 template<encoding::Tag TAG>
247 size_t totalLength = 0;
249 for (
const auto& route : m_routes | boost::adaptors::reversed) {
250 totalLength += route.wireEncode(block);
254 totalLength += block.prependVarNumber(totalLength);
273 m_wire = buffer.block();
302 m_routes.emplace_back(*val);
313 aRoutes.
size() != bRoutes.size())
316 std::vector<bool> matched(bRoutes.size(),
false);
317 return std::all_of(aRoutes.begin(), aRoutes.end(),
318 [&] (
const Route& route) {
319 for (size_t i = 0; i < bRoutes.size(); ++i) {
320 if (!matched[i] && bRoutes[i] == route) {
332 os <<
"RibEntry(Prefix: " << entry.
getName() <<
",\n"
Helper class to convert a number to hexadecimal format, for use with stream insertion operators.
Represents a TLV element of the NDN packet format.
element_const_iterator elements_begin() const noexcept
Equivalent to elements().begin().
element_const_iterator elements_end() const noexcept
Equivalent to elements().end().
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
uint32_t type() const noexcept
Return the TLV-TYPE of the Block.
void reset() noexcept
Reset the Block to a default-constructed state.
void parse() const
Parse TLV-VALUE into sub-elements.
Represents an absolute name.
size_t size() const noexcept
Returns the number of components.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Prepend wire encoding to encoder.
void wireDecode(const Block &wire)
Decode name from wire encoding.
Represents an item in NFD RIB dataset.
const Name & getName() const
RibEntry & addRoute(const Route &route)
void wireDecode(const Block &block)
const std::vector< Route > & getRoutes() const
const Block & wireEncode() const
RibEntry & setName(const Name &prefix)
Represents a route in a RibEntry.
Route & unsetExpirationPeriod()
Route & setFlags(uint64_t flags)
bool hasExpirationPeriod() const
RouteOrigin getOrigin() const
Route & setCost(uint64_t cost)
Route & setOrigin(RouteOrigin origin)
uint64_t getFaceId() const
Route & setFaceId(uint64_t faceId)
const Block & wireEncode() const
uint64_t getFlags() const
Route & setExpirationPeriod(time::milliseconds expirationPeriod)
time::milliseconds getExpirationPeriod() const
void wireDecode(const Block &block)
#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
EncodingImpl< EstimatorTag > EncodingEstimator
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
EncodingImpl< EncoderTag > EncodingBuffer
Contains classes and functions related to the NFD Management protocol.
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
::boost::chrono::milliseconds milliseconds
std::ostream & operator<<(std::ostream &os, const Data &data)
ostream_joiner< std::decay_t< DelimT >, CharT, Traits > make_ostream_joiner(std::basic_ostream< CharT, Traits > &os, DelimT &&delimiter)
Backport of ostream_joiner from the Library Fundamentals v2 TS.