ccnx: small extensions
Change-Id: Ib6755980e1cb86d45ca682d359c95d058dc70a92
diff --git a/ccnx/ccnx-common.h b/ccnx/ccnx-common.h
index c78970b..579128f 100644
--- a/ccnx/ccnx-common.h
+++ b/ccnx/ccnx-common.h
@@ -116,6 +116,20 @@
}
template<class Msg>
+boost::shared_ptr<Msg>
+deserializeMsg (const void *buf, size_t length)
+{
+ boost::shared_ptr<Msg> retval (new Msg ());
+ if (!retval->ParseFromArray (buf, length))
+ {
+ // to indicate an error
+ return boost::shared_ptr<Msg> ();
+ }
+ return retval;
+}
+
+
+template<class Msg>
BytesPtr
serializeGZipMsg(const Msg &msg)
{