Added decodeInterest.
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
index e56673b..5789394 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
@@ -6,7 +6,8 @@
#include <stdexcept>
#include "../c/encoding/BinaryXMLName.h"
-#include "../Name.hpp"
+#include "../c/encoding/BinaryXMLInterest.h"
+#include "../Interest.hpp"
#include "BinaryXMLEncoder.hpp"
#include "BinaryXMLWireFormat.hpp"
@@ -42,4 +43,17 @@
name.set(nameStruct);
}
+void BinaryXMLWireFormat::decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength)
+{
+ struct ndn_NameComponent components[100];
+ struct ndn_Interest interestStruct;
+ ndn_Interest_init(&interestStruct, components, sizeof(components) / sizeof(components[0]));
+
+ char *error;
+ if (error = ndn_decodeBinaryXMLInterest(&interestStruct, (unsigned char *)input, inputLength))
+ throw std::runtime_error(error);
+
+ interest.set(interestStruct);
+}
+
}
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
index e6d7c8a..418a2ba 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
@@ -18,7 +18,7 @@
virtual void decodeName(Name &name, const unsigned char *input, unsigned int inputLength);
//virtual void encodeInterest(Interest &interest, std::vector<unsigned char> &output);
- //virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
+ virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
static BinaryXMLWireFormat &instance() { return instance_; }