encoding+mgmt: fix definition of INVALID_FACE_ID
Change-Id: I220b183a6f1d007d2c71fcb6491a2c4a487b7673
Refs: #3172
diff --git a/src/mgmt/nfd/control-command.cpp b/src/mgmt/nfd/control-command.cpp
index 2a6eda7..96bba6c 100644
--- a/src/mgmt/nfd/control-command.cpp
+++ b/src/mgmt/nfd/control-command.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -82,13 +82,11 @@
bool isPresent = presentFields[i];
if (m_required[i]) {
if (!isPresent) {
- BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is required but "
- "missing"));
+ BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is required but missing"));
}
}
else if (isPresent && !m_optional[i]) {
- BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is forbidden but "
- "present"));
+ BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is forbidden but present"));
}
}
}
@@ -111,8 +109,6 @@
void
FaceCreateCommand::applyDefaultsToRequest(ControlParameters& parameters) const
{
- parameters.setFaceId(0);
-
if (!parameters.hasFacePersistency()) {
parameters.setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT);
}
@@ -133,8 +129,8 @@
{
this->ControlCommand::validateResponse(parameters);
- if (parameters.getFaceId() == 0) {
- BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ if (parameters.getFaceId() == INVALID_FACE_ID) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
@@ -175,8 +171,8 @@
{
this->ControlCommand::validateResponse(parameters);
- if (parameters.getFaceId() == 0) {
- BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ if (parameters.getFaceId() == INVALID_FACE_ID) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
@@ -193,8 +189,8 @@
{
this->ControlCommand::validateRequest(parameters);
- if (parameters.getFaceId() == 0) {
- BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ if (parameters.getFaceId() == INVALID_FACE_ID) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
@@ -271,8 +267,8 @@
{
this->ControlCommand::validateResponse(parameters);
- if (parameters.getFaceId() == 0) {
- BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ if (parameters.getFaceId() == INVALID_FACE_ID) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
@@ -300,8 +296,8 @@
{
this->ControlCommand::validateResponse(parameters);
- if (parameters.getFaceId() == 0) {
- BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ if (parameters.getFaceId() == INVALID_FACE_ID) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
@@ -379,8 +375,8 @@
{
this->ControlCommand::validateResponse(parameters);
- if (parameters.getFaceId() == 0) {
- BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ if (parameters.getFaceId() == INVALID_FACE_ID) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
@@ -413,8 +409,8 @@
{
this->ControlCommand::validateResponse(parameters);
- if (parameters.getFaceId() == 0) {
- BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ if (parameters.getFaceId() == INVALID_FACE_ID) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid"));
}
}
diff --git a/src/mgmt/nfd/face-traits.hpp b/src/mgmt/nfd/face-traits.hpp
index e88e1bc..dee973c 100644
--- a/src/mgmt/nfd/face-traits.hpp
+++ b/src/mgmt/nfd/face-traits.hpp
@@ -47,7 +47,7 @@
};
FaceTraits()
- : m_faceId(0)
+ : m_faceId(INVALID_FACE_ID)
, m_faceScope(FACE_SCOPE_NON_LOCAL)
, m_facePersistency(FACE_PERSISTENCY_PERSISTENT)
, m_linkType(LINK_TYPE_POINT_TO_POINT)
diff --git a/src/mgmt/nfd/fib-entry.cpp b/src/mgmt/nfd/fib-entry.cpp
index ad10054..e3633aa 100644
--- a/src/mgmt/nfd/fib-entry.cpp
+++ b/src/mgmt/nfd/fib-entry.cpp
@@ -34,7 +34,7 @@
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FibEntry>));
NextHopRecord::NextHopRecord()
- : m_faceId(0) // INVALID_FACEID
+ : m_faceId(INVALID_FACE_ID)
, m_cost(0)
{
}
diff --git a/src/mgmt/nfd/rib-entry.cpp b/src/mgmt/nfd/rib-entry.cpp
index d47d316..d8293d5 100644
--- a/src/mgmt/nfd/rib-entry.cpp
+++ b/src/mgmt/nfd/rib-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -42,7 +42,7 @@
const time::milliseconds Route::INFINITE_EXPIRATION_PERIOD(time::milliseconds::max());
Route::Route()
- : m_faceId(0)
+ : m_faceId(INVALID_FACE_ID)
, m_origin(0)
, m_cost(0)
, m_flags(ROUTE_FLAG_CHILD_INHERIT)