face: NDNLP partial message store
refs #1208
Change-Id: Ie10d590ebd2e3631c884a7b6b2d5ffce2758ab4d
diff --git a/daemon/face/ndnlp-parse.hpp b/daemon/face/ndnlp-parse.hpp
new file mode 100644
index 0000000..2790569
--- /dev/null
+++ b/daemon/face/ndnlp-parse.hpp
@@ -0,0 +1,52 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_FACE_NDNLP_PARSE_HPP
+#define NFD_FACE_NDNLP_PARSE_HPP
+
+#include "common.hpp"
+#include "ndnlp-tlv.hpp"
+
+namespace nfd {
+namespace ndnlp {
+
+struct ParseError : public std::runtime_error
+{
+ ParseError(const std::string& what)
+ : std::runtime_error(what)
+ {
+ }
+};
+
+/** \brief represents a NdnlpData packet
+ *
+ * NdnlpData ::= NDNLP-DATA-TYPE TLV-LENGTH
+ * NdnlpSequence
+ * NdnlpFragIndex?
+ * NdnlpFragCount?
+ * NdnlpPayload
+ */
+class NdnlpData
+{
+public:
+ /** \brief parse a NdnlpData packet
+ *
+ * \exception ParseError packet is malformated
+ */
+ void
+ wireDecode(const Block& wire);
+
+public:
+ uint64_t m_seq;
+ uint16_t m_fragIndex;
+ uint16_t m_fragCount;
+ Block m_payload;
+};
+
+} // namespace ndnlp
+} // namespace nfd
+
+#endif // NFD_FACE_NDNLP_PARSE_HPP