rib: limit route prefix length in rib/register command
refs #4262
Change-Id: I567934419f6872cb0f5a823400f53014b9c6e85e
diff --git a/daemon/table/fib.hpp b/daemon/table/fib.hpp
index fc5439f..ac864e8 100644
--- a/daemon/table/fib.hpp
+++ b/daemon/table/fib.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,8 @@
#include "fib-entry.hpp"
#include "name-tree.hpp"
+#include "core/fib-max-depth.hpp"
+
#include <boost/range/adaptor/transformed.hpp>
namespace nfd {
@@ -82,6 +84,17 @@
findExactMatch(const Name& prefix);
public: // mutation
+ /** \brief Maximum number of components in a FIB entry prefix.
+ *
+ * This constant is currently advisory, but will become mandatory later.
+ */
+ static constexpr size_t
+ getMaxDepth()
+ {
+ static_assert(FIB_MAX_DEPTH == NameTree::getMaxDepth(), "");
+ return FIB_MAX_DEPTH;
+ }
+
/** \brief inserts a FIB entry for prefix
*
* If an entry for exact same prefix exists, that entry is returned.