25 #include <boost/algorithm/string.hpp> 26 #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 static_assert(std::numeric_limits<std::underlying_type_t<RouteOrigin>>::max() <=
125 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<std::underlying_type_t<RouteOrigin>>::min() &&
135 v <= std::numeric_limits<std::underlying_type_t<RouteOrigin>>::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> knownBits = {
184 for (
const auto& pair : knownBits) {
187 std::tie(bit, token) = pair;
189 if ((routeFlags & bit) != 0) {
191 routeFlags =
static_cast<RouteFlags>(routeFlags & ~bit);
196 join =
AsHex{routeFlags};
std::istream & operator>>(std::istream &is, RouteOrigin &routeOrigin)
extract RouteOrigin from stream
Helper class to convert a number to hexadecimal format, for use with stream insertion operators...
face went UP (from DOWN state)
ostream_joiner< std::decay_t< DelimT >, CharT, Traits > make_ostream_joiner(std::basic_ostream< CharT, Traits > &os, DelimT &&delimiter)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
face went DOWN (from UP state)