encoding: move MAX_NDN_PACKET_SIZE constant
refs #2099
Change-Id: Ia52e32084ee7382c55d6ccc7ce71812c1854ba7f
diff --git a/src/common.hpp b/src/common.hpp
index f5b9e03..7fae571 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -65,8 +65,6 @@
namespace ndn {
-const size_t MAX_NDN_PACKET_SIZE = 8800;
-
/** \brief the namespace contains smart pointers
* \deprecated use std:: directly
*/
diff --git a/src/encoding/tlv.hpp b/src/encoding/tlv.hpp
index d74323b..c1c9b99 100644
--- a/src/encoding/tlv.hpp
+++ b/src/encoding/tlv.hpp
@@ -32,11 +32,21 @@
namespace ndn {
+/** @brief practical limit of network layer packet size
+ *
+ * If a packet is longer than this size, library and application MAY drop it.
+ */
+const size_t MAX_NDN_PACKET_SIZE = 8800;
+
/**
* @brief Namespace defining NDN-TLV related constants and procedures
*/
namespace tlv {
+/** @brief represents an error in TLV encoding or decoding
+ *
+ * Element::Error SHOULD inherit from this Error class.
+ */
class Error : public std::runtime_error
{
public:
@@ -273,9 +283,9 @@
template<>
inline bool
-readVarNumber<std::istream_iterator<uint8_t> >(std::istream_iterator<uint8_t>& begin,
- const std::istream_iterator<uint8_t>& end,
- uint64_t& value)
+readVarNumber<std::istream_iterator<uint8_t>>(std::istream_iterator<uint8_t>& begin,
+ const std::istream_iterator<uint8_t>& end,
+ uint64_t& value)
{
if (begin == end)
return false;
@@ -540,7 +550,6 @@
} // namespace tlv
-
} // namespace ndn
#endif // NDN_ENCODING_TLV_HPP
diff --git a/src/face.cpp b/src/face.cpp
index 66e61bf..cf2d1e4 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -24,8 +24,8 @@
#include "face.hpp"
#include "detail/face-impl.hpp"
+#include "encoding/tlv.hpp"
#include "security/key-chain.hpp"
-
#include "util/time.hpp"
#include "util/random.hpp"