model-wire: Fixing compliance with CCNb format regarding Content tag

Previously, content didn't contain a proper BLOB tag

Refs #1020 (http://redmine.named-data.net/issues/1020)
diff --git a/model/wire/ccnb/ccnb-parser/syntax-tree/block.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/block.cc
index 67882a9..ac0d285 100644
--- a/model/wire/ccnb/ccnb-parser/syntax-tree/block.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/block.cc
@@ -46,7 +46,7 @@
 
 // int Block::counter = 0;
 
-Ptr<Block> Block::ParseBlock (Buffer::Iterator &start)
+Ptr<Block> Block::ParseBlock (Buffer::Iterator &start, bool dontParseBlock)
 {
   // std::cout << "<< pos: " << counter << "\n";
   uint32_t value = 0;
@@ -62,6 +62,11 @@
     }
   if (start.IsEnd())
     CcnbDecodingException ();
+
+  if (dontParseBlock)
+    {
+      return 0;
+    }
   
   value <<= 4;
   value += ( (byte&(~CCN_TT_HBIT)) >> 3);
diff --git a/model/wire/ccnb/ccnb-parser/syntax-tree/block.h b/model/wire/ccnb/ccnb-parser/syntax-tree/block.h
index caf227f..dcaadaf 100644
--- a/model/wire/ccnb/ccnb-parser/syntax-tree/block.h
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/block.h
@@ -53,11 +53,13 @@
    * \brief Parsing stream (recursively) and creating a parsed BLOCK
    * object
    *
-   * \param start buffer iterator pointing to the start position for parsing 
+   * \param start buffer iterator pointing to the start position for parsing
+   * \param dontParseBlock parameter to indicate whether the block should not be parsed, just length
+   *                       of the block should be consumed (e.g., in case of "cheating" with content of Data packets)
    * \returns parsed ccnb-encoded block, that could contain more block inside
    */
   static Ptr<Block>
-  ParseBlock (Buffer::Iterator &start);
+  ParseBlock (Buffer::Iterator &start, bool dontParseBlock = false);
 
   virtual ~Block ();
   
diff --git a/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.cc b/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.cc
index b7af79b..3095747 100644
--- a/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.cc
+++ b/model/wire/ccnb/ccnb-parser/syntax-tree/dtag.cc
@@ -40,7 +40,10 @@
    * buffer
    */
   if (dtag == CCN_DTAG_Content)
-    return; // hack #1. Do not process nesting block for <Content>
+    {
+      Block::ParseBlock (start, true); // process length field and ignore it
+      return; // hack #1. Do not process nesting block for <Content>
+    }
   
   // parse attributes until first nested block reached
   while (!start.IsEnd () && BufferIteratorPeekU8 (start)!=CCN_CLOSE)
diff --git a/model/wire/ccnb/wire-ccnb-data.cc b/model/wire/ccnb/wire-ccnb-data.cc
index 0770c3d..e625e06 100644
--- a/model/wire/ccnb/wire-ccnb-data.cc
+++ b/model/wire/ccnb/wire-ccnb-data.cc
@@ -246,6 +246,10 @@
 
   Ccnb::AppendBlockHeader (start, CcnbParser::CCN_DTAG_Content, CcnbParser::CCN_DTAG); // <Content>
 
+  uint32_t payloadSize = m_data->GetPayload ()->GetSize ();
+  if (payloadSize > 0)
+    Ccnb::AppendBlockHeader (start, payloadSize, CcnbParser::CCN_BLOB);
+
   // there are no closing tags !!!
   // The closing tag is handled by ContentObjectTail
 }
@@ -319,6 +323,10 @@
 
   written += Ccnb::EstimateBlockHeader (CcnbParser::CCN_DTAG_Content); // <Content>
 
+  uint32_t payloadSize = m_data->GetPayload ()->GetSize ();
+  if (payloadSize > 0)
+    written += Ccnb::EstimateBlockHeader (payloadSize);
+
   // there are no closing tags !!!
   // The closing tag is handled by ContentObjectTail
   return written;