Slight update of packet format: adding overall packet length to the
common header
diff --git a/model/ndn-content-object.cc b/model/ndn-content-object.cc
index d9926ef..052cd4a 100644
--- a/model/ndn-content-object.cc
+++ b/model/ndn-content-object.cc
@@ -114,7 +114,8 @@
uint32_t
ContentObject::GetSerializedSize () const
{
- uint32_t size = 2 + ((2 + 2) + (m_name->GetSerializedSize ()) + (2 + 2 + 4 + 2 + 2 + (2 + 0)));
+ uint32_t size = 1 + 1 + 2 +
+ ((2 + 2) + (m_name->GetSerializedSize ()) + (2 + 2 + 4 + 2 + 2 + (2 + 0)));
if (m_signature != 0)
size += 4;
@@ -127,7 +128,8 @@
{
start.WriteU8 (0x80); // version
start.WriteU8 (0x01); // packet type
-
+ start.WriteU16 (GetSerializedSize () - 4); // length
+
if (m_signature != 0)
{
start.WriteU16 (6); // signature length
@@ -169,6 +171,8 @@
if (i.ReadU8 () != 0x01)
throw new ContentObjectException ();
+ i.ReadU16 (); // length
+
uint32_t signatureLength = i.ReadU16 ();
if (signatureLength == 6)
{