26 #include <boost/algorithm/string/predicate.hpp>
27 #include <boost/lexical_cast.hpp>
41 return os <<
"non-local";
45 return os << static_cast<unsigned>(faceScope);
51 switch (facePersistency) {
55 return os <<
"persistent";
57 return os <<
"on-demand";
59 return os <<
"permanent";
61 return os << static_cast<unsigned>(facePersistency);
71 return os <<
"point-to-point";
73 return os <<
"multi-access";
77 return os << static_cast<unsigned>(linkType);
83 switch (faceEventKind) {
87 return os <<
"created";
89 return os <<
"destroyed";
95 return os << static_cast<unsigned>(faceEventKind);
101 using boost::algorithm::iequals;
106 if (iequals(s,
"none"))
108 else if (iequals(s,
"app"))
110 else if (iequals(s,
"autoreg"))
112 else if (iequals(s,
"client"))
114 else if (iequals(s,
"autoconf"))
116 else if (iequals(s,
"nlsr"))
118 else if (iequals(s,
"prefixann"))
120 else if (iequals(s,
"static"))
124 using RouteOriginUnderlyingType = std::underlying_type_t<RouteOrigin>;
125 static_assert(std::numeric_limits<RouteOriginUnderlyingType>::max() <= std::numeric_limits<int>::max());
129 v = boost::lexical_cast<int>(s);
131 catch (
const boost::bad_lexical_cast&) {
134 if (v >= std::numeric_limits<RouteOriginUnderlyingType>::min() &&
135 v <= std::numeric_limits<RouteOriginUnderlyingType>::max()) {
140 is.setstate(std::ios::failbit);
150 switch (routeOrigin) {
156 return os <<
"autoreg";
158 return os <<
"client";
160 return os <<
"autoconf";
164 return os <<
"prefixann";
166 return os <<
"static";
168 return os << static_cast<unsigned>(routeOrigin);
178 static const std::map<RouteFlags, std::string_view> knownBits = {
184 for (
auto [bit, token] : knownBits) {
185 if ((routeFlags & bit) != 0) {
187 routeFlags =
static_cast<RouteFlags>(routeFlags & ~bit);
192 join =
AsHex{routeFlags};
Helper class to convert a number to hexadecimal format, for use with stream insertion operators.
@ FACE_PERSISTENCY_ON_DEMAND
face is on-demand
@ FACE_PERSISTENCY_PERSISTENT
face is persistent
@ FACE_PERSISTENCY_PERMANENT
face is permanent
@ FACE_SCOPE_LOCAL
face is local
@ FACE_SCOPE_NON_LOCAL
face is non-local
@ ROUTE_FLAG_CHILD_INHERIT
@ LINK_TYPE_AD_HOC
link is ad hoc
@ LINK_TYPE_MULTI_ACCESS
link is multi-access
@ LINK_TYPE_POINT_TO_POINT
link is point-to-point
@ FACE_EVENT_DOWN
face went DOWN (from UP state)
@ FACE_EVENT_CREATED
face was created
@ FACE_EVENT_UP
face went UP (from DOWN state)
@ FACE_EVENT_DESTROYED
face was destroyed
Contains classes and functions related to the NFD Management protocol.
std::istream & operator>>(std::istream &is, RouteOrigin &routeOrigin)
Extract RouteOrigin from stream.
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
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.