encoding: add route origin for self-learning
Change-Id: I2f652ac889095ee9bb7c752e715cfecb41459fa4
refs: #4279
diff --git a/src/encoding/nfd-constants.cpp b/src/encoding/nfd-constants.cpp
index 0de5fe2..5c3189a 100644
--- a/src/encoding/nfd-constants.cpp
+++ b/src/encoding/nfd-constants.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -115,6 +115,8 @@
routeOrigin = ROUTE_ORIGIN_AUTOCONF;
else if (iequals(s, "nlsr"))
routeOrigin = ROUTE_ORIGIN_NLSR;
+ else if (iequals(s, "selflearning"))
+ routeOrigin = ROUTE_ORIGIN_SELFLEARNING;
else if (iequals(s, "static"))
routeOrigin = ROUTE_ORIGIN_STATIC;
else {
@@ -158,6 +160,8 @@
return os << "autoconf";
case ROUTE_ORIGIN_NLSR:
return os << "nlsr";
+ case ROUTE_ORIGIN_SELFLEARNING:
+ return os << "selflearning";
case ROUTE_ORIGIN_STATIC:
return os << "static";
}
diff --git a/src/encoding/nfd-constants.hpp b/src/encoding/nfd-constants.hpp
index 01e8c2b..6cc2c59 100644
--- a/src/encoding/nfd-constants.hpp
+++ b/src/encoding/nfd-constants.hpp
@@ -97,13 +97,14 @@
/** \ingroup management
*/
enum RouteOrigin : uint16_t {
- ROUTE_ORIGIN_NONE = std::numeric_limits<uint16_t>::max(),
- ROUTE_ORIGIN_APP = 0,
- ROUTE_ORIGIN_AUTOREG = 64,
- ROUTE_ORIGIN_CLIENT = 65,
- ROUTE_ORIGIN_AUTOCONF = 66,
- ROUTE_ORIGIN_NLSR = 128,
- ROUTE_ORIGIN_STATIC = 255,
+ ROUTE_ORIGIN_NONE = std::numeric_limits<uint16_t>::max(),
+ ROUTE_ORIGIN_APP = 0,
+ ROUTE_ORIGIN_AUTOREG = 64,
+ ROUTE_ORIGIN_CLIENT = 65,
+ ROUTE_ORIGIN_AUTOCONF = 66,
+ ROUTE_ORIGIN_NLSR = 128,
+ ROUTE_ORIGIN_SELFLEARNING = 129,
+ ROUTE_ORIGIN_STATIC = 255,
};
/** \brief extract RouteOrigin from stream
diff --git a/tests/unit-tests/encoding/nfd-constants.t.cpp b/tests/unit-tests/encoding/nfd-constants.t.cpp
index 9a354fa..c2149a1 100644
--- a/tests/unit-tests/encoding/nfd-constants.t.cpp
+++ b/tests/unit-tests/encoding/nfd-constants.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -96,6 +96,7 @@
expectSuccess("Client", ROUTE_ORIGIN_CLIENT);
expectSuccess("AutoConf", ROUTE_ORIGIN_AUTOCONF);
expectSuccess("NLSR", ROUTE_ORIGIN_NLSR);
+ expectSuccess("SelfLearning", ROUTE_ORIGIN_SELFLEARNING);
expectSuccess("static", ROUTE_ORIGIN_STATIC);
expectSuccess("27", static_cast<RouteOrigin>(27));
@@ -118,6 +119,7 @@
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(ROUTE_ORIGIN_CLIENT), "client");
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(ROUTE_ORIGIN_AUTOCONF), "autoconf");
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(ROUTE_ORIGIN_NLSR), "nlsr");
+ BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(ROUTE_ORIGIN_SELFLEARNING), "selflearning");
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(ROUTE_ORIGIN_STATIC), "static");
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(static_cast<RouteOrigin>(27)), "27");
}