Adding support of more fields in ContentObject

All big fields (digest, signature, etc.) are represented with 32-bit
integers. Should be enough for simulation purposes.

Also. This commit contains a number of code reorganizations, so the code
may not work...
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-content-object-visitor.cc b/helper/ccnb-parser/visitors/ccnb-parser-content-object-visitor.cc
deleted file mode 100644
index 94732f7..0000000
--- a/helper/ccnb-parser/visitors/ccnb-parser-content-object-visitor.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ccnb-parser-content-object-visitor.h"
-#include "ccnb-parser-name-components-visitor.h"
-#include "ccnb-parser-non-negative-integer-visitor.h"
-#include "ccnb-parser-timestamp-visitor.h"
-
-#include "../syntax-tree/ccnb-parser-block.h"
-#include "../syntax-tree/ccnb-parser-dtag.h"
-
-#include "ns3/ccnx-name-components.h"
-#include "ns3/assert.h"
-#include "ns3/log.h"
-
-#include "ns3/ccnx-content-object-header.h"
-
-#include <boost/foreach.hpp>
-
-NS_LOG_COMPONENT_DEFINE ("CcnbParserContentObjectVisitor");
-
-namespace ns3 {
-namespace CcnbParser {
-
-// We don't really care about any other fields
-void
-ContentObjectVisitor::visit (Dtag &n, boost::any param/*should be CcnxContentObjectHeader* */)
-{
-  // uint32_t n.m_dtag;
-  // std::list<Ptr<Block> > n.m_nestedBlocks;
-  static NameComponentsVisitor nameComponentsVisitor;
-  static NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
-  static TimestampVisitor          timestampVisitor;
-  
-  CcnxContentObjectHeader &contentObject = *(boost::any_cast<CcnxContentObjectHeader*> (param));
-  
-  switch (n.m_dtag)
-    {
-    case CCN_DTAG_ContentObject:
-      // process nested blocks
-      BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
-        {
-          block->accept (*this, param);
-        }
-      break;
-    case CCN_DTAG_Name:
-      {
-        // process name components
-        Ptr<CcnxNameComponents> name = Create<CcnxNameComponents> ();
-        
-        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
-          {
-            block->accept (nameComponentsVisitor, &(*name));
-          }
-        contentObject.SetName (name);
-        break;
-      }
-
-    case CCN_DTAG_Signature: // ignoring
-      break;
-
-    case CCN_DTAG_SignedInfo:
-      // process nested blocks
-      BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
-        {
-          block->accept (*this, param);
-        }      
-      break;
-      
-    case CCN_DTAG_Timestamp:
-      NS_LOG_DEBUG ("Timestamp");
-      if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
-        throw CcnbDecodingException ();
-
-      contentObject.SetTimestamp (
-               boost::any_cast<Time> (
-                                      (*n.m_nestedTags.begin())->accept(
-                                                                        timestampVisitor
-                                                                        )));
-      break;
-
-    case CCN_DTAG_FreshnessSeconds:
-      NS_LOG_DEBUG ("FreshnessSeconds");
-      
-      if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
-        throw CcnbDecodingException ();
-      contentObject.SetFreshness (
-          Seconds (
-               boost::any_cast<uint32_t> (
-                                          (*n.m_nestedTags.begin())->accept(
-                                                                           nonNegativeIntegerVisitor
-                                                                           ))));
-      
-      break;
-      
-    case CCN_DTAG_Content: // !!! HACK
-      // This hack was necessary for memory optimizations (i.e., content is virtual payload)
-      NS_ASSERT_MSG (n.m_nestedTags.size() == 0, "Parser should have stopped just after processing <Content> tag");
-      break;
-      
-    default: // ignore all other stuff
-      break;
-    }
-}
-
-} // namespace CcnbParser
-} // namespace ns3
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-content-object-visitor.h b/helper/ccnb-parser/visitors/ccnb-parser-content-object-visitor.h
deleted file mode 100644
index ae6fe9b..0000000
--- a/helper/ccnb-parser/visitors/ccnb-parser-content-object-visitor.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2011 University of California, Los Angeles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#ifndef _CCNB_PARSER_CONTENT_OBJECT_VISITOR_H_
-#define _CCNB_PARSER_CONTENT_OBJECT_VISITOR_H_
-
-#include "ccnb-parser-void-depth-first-visitor.h"
-
-namespace ns3 {
-namespace CcnbParser {
-
-/**
- * \ingroup ccnx-ccnb
- * \brief Visitor that fills fields in CcnxContentObjectHeader
- *
- * Usage example:
- * \code
- *   Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
- *   Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
- *   ContentObjectVisitor visitor;
- *   root->accept (visitor, *header); 
- * \endcode
- */
-class ContentObjectVisitor : public VoidDepthFirstVisitor
-{
-public:
-  virtual void visit (Dtag &n, boost::any param/*should be CcnxContentObjectHeader* */);
-};
-
-}
-}
-
-#endif // _CCNB_PARSER_CONTENT_OBJECT_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.cc b/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.cc
similarity index 79%
copy from helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.cc
copy to helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.cc
index 0102b0a..34608b1 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.cc
+++ b/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.cc
@@ -18,24 +18,29 @@
  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
 
-#include "ccnb-parser-nonce-visitor.h"
+#include "ccnb-parser-content-type-visitor.h"
 #include "../syntax-tree/ccnb-parser-blob.h"
 
 namespace ns3 {
 namespace CcnbParser {
 
 boost::any
-NonceVisitor::visit (Blob &n) 
+ContentTypeVisitor::visit (Blob &n) 
 {
   // Buffer n.m_blob;
-  if (n.m_blobSize < 4)
+  if (n.m_blobSize != 3)
     throw CcnbDecodingException ();
-     
-  return boost::any (*(reinterpret_cast<uint32_t*> (n.m_blob)));
+
+  uint32_t type =
+    (n.m_blob [0] << 16) |
+    (n.m_blob [1] << 8 ) |
+    (n.m_blob [2]      );
+    
+  return boost::any (type);
 }
 
 boost::any
-NonceVisitor::visit (Udata &n)
+ContentTypeVisitor::visit (Udata &n)
 {
   // std::string n.m_udata;
   throw CcnbDecodingException ();
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.h b/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h
similarity index 87%
rename from helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.h
rename to helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h
index c4912aa..0c3cc6c 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.h
+++ b/helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h
@@ -18,8 +18,8 @@
  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
 
-#ifndef _CCNB_PARSER_NONCE_VISITOR_H_
-#define _CCNB_PARSER_NONCE_VISITOR_H_
+#ifndef _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
+#define _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
 
 #include "ccnb-parser-no-argu-depth-first-visitor.h"
 
@@ -35,7 +35,7 @@
  *
  * Will return empty boost::any() if called on anything except BLOB block
  */
-class NonceVisitor : public NoArguDepthFirstVisitor
+class ContentTypeVisitor : public NoArguDepthFirstVisitor
 {
 public:
   virtual boost::any visit (Blob &n); 
@@ -45,4 +45,4 @@
 }
 }
 
-#endif // _CCNB_PARSER_NONCE_VISITOR_H_
+#endif // _CCNB_PARSER_CONTENT_TYPE_VISITOR_H_
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc b/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
index b7ccaba..ff219f0 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
+++ b/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
@@ -32,7 +32,7 @@
 #include "ccnb-parser-name-components-visitor.h"
 #include "ccnb-parser-non-negative-integer-visitor.h"
 #include "ccnb-parser-timestamp-visitor.h"
-#include "ccnb-parser-nonce-visitor.h"
+#include "ccnb-parser-uint32t-blob-visitor.h"
 
 #include <boost/foreach.hpp>
 
@@ -53,7 +53,7 @@
   static NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
   static NameComponentsVisitor     nameComponentsVisitor;
   static TimestampVisitor          timestampVisitor;
-  static NonceVisitor              nonceVisitor;
+  static Uint32tBlobVisitor        nonceVisitor;
   
   CcnxInterestHeader &interest = *(boost::any_cast<CcnxInterestHeader*> (param));
 
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.cc b/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.cc
similarity index 90%
rename from helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.cc
rename to helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.cc
index 0102b0a..fbeee6e 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.cc
+++ b/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.cc
@@ -18,14 +18,14 @@
  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
 
-#include "ccnb-parser-nonce-visitor.h"
+#include "ccnb-parser-uint32t-blob-visitor.h"
 #include "../syntax-tree/ccnb-parser-blob.h"
 
 namespace ns3 {
 namespace CcnbParser {
 
 boost::any
-NonceVisitor::visit (Blob &n) 
+Uint32tBlobVisitor::visit (Blob &n) 
 {
   // Buffer n.m_blob;
   if (n.m_blobSize < 4)
@@ -35,7 +35,7 @@
 }
 
 boost::any
-NonceVisitor::visit (Udata &n)
+Uint32tBlobVisitor::visit (Udata &n)
 {
   // std::string n.m_udata;
   throw CcnbDecodingException ();
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.h b/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h
similarity index 87%
copy from helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.h
copy to helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h
index c4912aa..e06273f 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-nonce-visitor.h
+++ b/helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h
@@ -18,8 +18,8 @@
  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
  */
 
-#ifndef _CCNB_PARSER_NONCE_VISITOR_H_
-#define _CCNB_PARSER_NONCE_VISITOR_H_
+#ifndef _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
+#define _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
 
 #include "ccnb-parser-no-argu-depth-first-visitor.h"
 
@@ -35,7 +35,7 @@
  *
  * Will return empty boost::any() if called on anything except BLOB block
  */
-class NonceVisitor : public NoArguDepthFirstVisitor
+class Uint32tBlobVisitor : public NoArguDepthFirstVisitor
 {
 public:
   virtual boost::any visit (Blob &n); 
@@ -45,4 +45,4 @@
 }
 }
 
-#endif // _CCNB_PARSER_NONCE_VISITOR_H_
+#endif // _CCNB_PARSER_UINT32T_BLOB_VISITOR_H_
diff --git a/helper/ccnx-decoding-helper.cc b/helper/ccnx-decoding-helper.cc
index ee3f084..6d1d7c8 100644
--- a/helper/ccnx-decoding-helper.cc
+++ b/helper/ccnx-decoding-helper.cc
@@ -21,10 +21,8 @@
 #include "ccnx-decoding-helper.h"
 
 #include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
 
 #include "ccnb-parser/visitors/ccnb-parser-interest-visitor.h"
-#include "ccnb-parser/visitors/ccnb-parser-content-object-visitor.h"
 
 #include "ccnb-parser/syntax-tree/ccnb-parser-block.h"
 #include "ccnb-parser/syntax-tree/ccnb-parser-dtag.h"
@@ -47,16 +45,16 @@
   return i.GetDistanceFrom (start);
 }
 
-size_t
-CcnxDecodingHelper::Deserialize (Buffer::Iterator start, CcnxContentObjectHeader &contentObject)
-{
-  static CcnbParser::ContentObjectVisitor contentObjectVisitor;
+// size_t
+// CcnxDecodingHelper::Deserialize (Buffer::Iterator start, CcnxContentObjectHeader &contentObject)
+// {
+//   static CcnbParser::ContentObjectVisitor contentObjectVisitor;
 
-  Buffer::Iterator i = start;
-  Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
-  root->accept (contentObjectVisitor, &contentObject);
+//   Buffer::Iterator i = start;
+//   Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
+//   root->accept (contentObjectVisitor, &contentObject);
 
-  return i.GetDistanceFrom (start);
-}
+//   return i.GetDistanceFrom (start);
+// }
 
 } // namespace ns3
diff --git a/helper/ccnx-encoding-helper.cc b/helper/ccnx-encoding-helper.cc
index 538524c..acb3966 100644
--- a/helper/ccnx-encoding-helper.cc
+++ b/helper/ccnx-encoding-helper.cc
@@ -84,9 +84,7 @@
   if (interest.GetNonce()>0)
     {
       uint32_t nonce = interest.GetNonce();
-      written += AppendTaggedBlob (start, CcnbParser::CCN_DTAG_Nonce,
-                                   reinterpret_cast<const uint8_t*>(&nonce),
-                                   sizeof(nonce));
+      written += AppendTaggedBlob (start, CcnbParser::CCN_DTAG_Nonce, nonce);
     }
     
   if (interest.GetNack ()>0)
@@ -168,102 +166,6 @@
   return written;
 }
 
-size_t
-CcnxEncodingHelper::Serialize (Buffer::Iterator start, const CcnxContentObjectHeader &contentObject)
-{
-  size_t written = 0;
-  written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_ContentObject, CcnbParser::CCN_DTAG); // <ContentObject>
-
-  // fake signature
-  written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Signature, CcnbParser::CCN_DTAG); // <Signature>
-  // Signature ::= DigestAlgorithm? 
-  //               Witness?         
-  //               SignatureBits   
-  written += AppendTaggedBlob (start, CcnbParser::CCN_DTAG_SignatureBits, 0, 0);      // <SignatureBits />
-  written += AppendCloser (start);                                    // </Signature>  
-
-  written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Name, CcnbParser::CCN_DTAG);    // <Name>
-  written += AppendNameComponents (start, contentObject.GetName()); //   <Component>...</Component>...
-  written += AppendCloser (start);                                  // </Name>  
-
-  // fake signature
-  written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_SignedInfo, CcnbParser::CCN_DTAG); // <SignedInfo>
-  // SignedInfo ::= PublisherPublicKeyDigest
-  //                Timestamp
-  //                Type?
-  //                FreshnessSeconds?
-  //                FinalBlockID?
-  //                KeyLocator?
-  if (!contentObject.GetTimestamp ().IsZero())
-    {
-      written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Timestamp, CcnbParser::CCN_DTAG);
-      written += AppendTimestampBlob (start, contentObject.GetTimestamp ());
-      written += AppendCloser (start);
-    }
-  if (contentObject.GetFreshness () >= Seconds(0))
-    {
-      written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_FreshnessSeconds, CcnbParser::CCN_DTAG);
-      written += AppendNumber (start, contentObject.GetFreshness ().ToInteger (Time::S));
-      written += AppendCloser (start);
-    }
-  
-  written += AppendTaggedBlob (start, CcnbParser::CCN_DTAG_PublisherPublicKeyDigest, 0, 0); // <PublisherPublicKeyDigest />
-  written += AppendCloser (start);                                     // </SignedInfo>
-
-  written += AppendBlockHeader (start, CcnbParser::CCN_DTAG_Content, CcnbParser::CCN_DTAG); // <Content>
-
-  // there are no closing tags !!!
-  return written;
-}
-
-size_t
-CcnxEncodingHelper::GetSerializedSize (const CcnxContentObjectHeader &contentObject)
-{
-  size_t written = 0;
-  written += EstimateBlockHeader (CcnbParser::CCN_DTAG_ContentObject); // <ContentObject>
-
-  // fake signature
-  written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Signature); // <Signature>
-  // Signature ::= DigestAlgorithm? 
-  //               Witness?         
-  //               SignatureBits   
-  written += EstimateTaggedBlob (CcnbParser::CCN_DTAG_SignatureBits, 0);      // <SignatureBits />
-  written += 1;                                    // </Signature>  
-
-  written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Name);    // <Name>
-  written += EstimateNameComponents (contentObject.GetName()); //   <Component>...</Component>...
-  written += 1;                                  // </Name>  
-
-  // fake signature
-  written += EstimateBlockHeader (CcnbParser::CCN_DTAG_SignedInfo); // <SignedInfo>
-  // SignedInfo ::= PublisherPublicKeyDigest
-  //                Timestamp
-  //                Type?
-  //                FreshnessSeconds?
-  //                FinalBlockID?
-  //                KeyLocator?
-  if (!contentObject.GetTimestamp ().IsZero())
-    {
-      written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Timestamp);
-      written += EstimateTimestampBlob (contentObject.GetTimestamp ());
-      written += 1;
-    }
-  if (contentObject.GetFreshness () >= Seconds(0))
-    {
-      written += EstimateBlockHeader (CcnbParser::CCN_DTAG_FreshnessSeconds);
-      written += EstimateNumber (contentObject.GetFreshness ().ToInteger (Time::S));
-      written += 1;
-    }
-
-  written += EstimateTaggedBlob (CcnbParser::CCN_DTAG_PublisherPublicKeyDigest, 0); // <PublisherPublicKeyDigest />
-  written += 1;                                     // </SignedInfo>
-
-  written += EstimateBlockHeader (CcnbParser::CCN_DTAG_Content); // <Content>
-
-  // there are no closing tags !!!
-  return written;
-}
-
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
@@ -423,6 +325,26 @@
     return EstimateBlockHeader (dtag) + 1;
 }
 
+size_t
+CcnxEncodingHelper::AppendString (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
+                                  const std::string &string)
+{
+  size_t written = AppendBlockHeader (start, dtag, CcnbParser::CCN_DTAG);
+  {
+    written += AppendBlockHeader (start, string.size (), CcnbParser::CCN_UDATA);
+    start.Write (reinterpret_cast<const uint8_t*> (string.c_str ()), string.size ());
+    written += string.size ();
+  }
+  written += AppendCloser (start);
+
+  return written;
+}
+
+size_t
+CcnxEncodingHelper::EstimateString (CcnbParser::ccn_dtag dtag, const std::string &string)
+{
+  return EstimateBlockHeader (dtag) + EstimateBlockHeader (string.size ()) + string.size () + 1;
+}
 
 
 } // namespace ns3
diff --git a/helper/ccnx-encoding-helper.h b/helper/ccnx-encoding-helper.h
index e4fe45d..65b3b6a 100644
--- a/helper/ccnx-encoding-helper.h
+++ b/helper/ccnx-encoding-helper.h
@@ -58,14 +58,8 @@
    */
   static size_t
   GetSerializedSize (const CcnxInterestHeader &interest);
-
-  static size_t
-  Serialize (Buffer::Iterator start, const CcnxContentObjectHeader &contentObject);
-
-  static size_t
-  GetSerializedSize (const CcnxContentObjectHeader &contentObject);
   
-private:
+public:
   static size_t
   AppendBlockHeader (Buffer::Iterator &start, size_t value, CcnbParser::ccn_tt block_type);
 
@@ -120,8 +114,51 @@
   
   static size_t
   EstimateTaggedBlob (CcnbParser::ccn_dtag dtag, size_t size);
+
+  /**
+   * Append value as a tagged BLOB (templated version)
+   *
+   * This is a ccnb-encoded element with containing the BLOB as content
+   *
+   * Data will be reinterpret_cast<const uint8_t*> and size will be obtained using sizeof
+   *
+   * @param start start iterator of  the buffer to append to.
+   * @param dtag is the element's dtab
+   * @param data a value to add
+   *
+   * @returns written length
+   */
+  template<class T>
+  static inline size_t
+  AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag, const T &data);
+
+  /**
+   * Append a tagged string (should be a valid UTF-8 coded string)
+   *
+   * This is a ccnb-encoded element with containing UDATA as content
+   *
+   * @param start start iterator of  the buffer to append to.
+   * @param dtag is the element's dtab
+   * @param string UTF-8 string to be written
+   *
+   * @returns written length
+   */
+  static size_t
+  AppendString (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag,
+                const std::string &string);
+
+  static size_t
+  EstimateString (CcnbParser::ccn_dtag dtag, const std::string &string);
 };
 
+
+template<class T>
+size_t
+CcnxEncodingHelper::AppendTaggedBlob (Buffer::Iterator &start, CcnbParser::ccn_dtag dtag, const T &data)
+{
+  return AppendTaggedBlob (start, dtag, reinterpret_cast<const uint8_t*> (&data), sizeof (data));
+}
+
 } // namespace ns3
 
 #endif // _CCNX_ENCODING_HELPER_H_
diff --git a/model/ccnx-content-object-header.cc b/model/ccnx-content-object-header.cc
index d858e04..05220f5 100644
--- a/model/ccnx-content-object-header.cc
+++ b/model/ccnx-content-object-header.cc
@@ -25,11 +25,29 @@
 #include "../helper/ccnx-encoding-helper.h"
 #include "../helper/ccnx-decoding-helper.h"
 
+#include "../helper/ccnb-parser/ccnb-parser-common.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-void-depth-first-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-name-components-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-non-negative-integer-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-string-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-uint32t-blob-visitor.h"
+#include "../helper/ccnb-parser/visitors/ccnb-parser-content-type-visitor.h"
+
+#include "../helper/ccnb-parser/syntax-tree/ccnb-parser-block.h"
+#include "../helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.h"
+
+#include <boost/foreach.hpp>
+
 NS_LOG_COMPONENT_DEFINE ("CcnxContentObjectHeader");
 
+using namespace ns3::CcnbParser;
+
 namespace ns3
 {
 
+const std::string CcnxContentObjectHeader::Signature::DefaultDigestAlgorithm = "2.16.840.1.101.3.4.2.1";
+
 NS_OBJECT_ENSURE_REGISTERED (CcnxContentObjectHeader);
 NS_OBJECT_ENSURE_REGISTERED (CcnxContentObjectTail);
 
@@ -61,48 +79,324 @@
   return *m_name;
 }
 
-void
-CcnxContentObjectHeader::SetTimestamp (const Time &timestamp)
-{
-  m_signedInfo.m_timestamp = timestamp;
-}
+#define CCNB CcnxEncodingHelper // just to simplify writing
 
-Time
-CcnxContentObjectHeader::GetTimestamp () const
-{
-  return m_signedInfo.m_timestamp;
-}
-
-void
-CcnxContentObjectHeader::SetFreshness (const Time &freshness)
-{
-  m_signedInfo.m_freshness = freshness;
-}
-
-Time
-CcnxContentObjectHeader::GetFreshness () const
-{
-  return m_signedInfo.m_freshness;
-}
-
-
-uint32_t
-CcnxContentObjectHeader::GetSerializedSize (void) const
-{
-  // unfortunately, we don't know exact header size in advance
-  return CcnxEncodingHelper::GetSerializedSize (*this);
-}
-    
 void
 CcnxContentObjectHeader::Serialize (Buffer::Iterator start) const
 {
-  CcnxEncodingHelper::Serialize (start, *this);
+  size_t written = 0;
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_ContentObject, CcnbParser::CCN_DTAG); // <ContentObject>
+
+  // fake signature
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Signature, CcnbParser::CCN_DTAG); // <Signature>
+  // Signature ::= √DigestAlgorithm? 
+  //               Witness?         
+  //               √SignatureBits
+  if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
+    {
+      written += CCNB::AppendString (start, CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
+    }
+  written += CCNB::AppendTaggedBlob (start, CCN_DTAG_SignatureBits, GetSignature ().GetSignatureBits ()); // <SignatureBits />
+  written += CCNB::AppendCloser (start);                                    // </Signature>  
+
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Name, CCN_DTAG);    // <Name>
+  written += CCNB::AppendNameComponents (start, GetName()); //   <Component>...</Component>...
+  written += CCNB::AppendCloser (start);                                  // </Name>  
+
+  // fake signature
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_SignedInfo, CCN_DTAG); // <SignedInfo>
+  // SignedInfo ::= √PublisherPublicKeyDigest
+  //                √Timestamp
+  //                √Type?
+  //                √FreshnessSeconds?
+  //                FinalBlockID?
+  //                KeyLocator?
+  written += CCNB::AppendTaggedBlob (start, CCN_DTAG_PublisherPublicKeyDigest,         // <PublisherPublicKeyDigest>...
+                                     GetSignedInfo ().GetPublisherPublicKeyDigest ());
+  
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Timestamp, CCN_DTAG);            // <Timestamp>...
+  written += CCNB::AppendTimestampBlob (start, GetSignedInfo ().GetTimestamp ());
+  written += CCNB::AppendCloser (start);
+
+  if (GetSignedInfo ().GetContentType () != DATA)
+    {
+      uint8_t type[3];
+      type[0] = (GetSignedInfo ().GetContentType () >> 16) & 0xFF;
+      type[1] = (GetSignedInfo ().GetContentType () >> 8 ) & 0xFF;
+      type[2] = (GetSignedInfo ().GetContentType ()      ) & 0xFF;
+      
+      written += CCNB::AppendTaggedBlob (start, CCN_DTAG_Type, type, 3);
+    }
+  if (GetSignedInfo ().GetFreshness () >= Seconds(0))
+    {
+      written += CCNB::AppendBlockHeader (start, CCN_DTAG_FreshnessSeconds, CCN_DTAG);
+      written += CCNB::AppendNumber (start, GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
+      written += CCNB::AppendCloser (start);
+    }
+  if (GetSignedInfo ().GetKeyLocator ()->size () > 0)
+    {
+      written += CCNB::AppendBlockHeader (start, CCN_DTAG_KeyLocator, CCN_DTAG); // <KeyLocator>
+      {
+        written += CCNB::AppendBlockHeader (start, CCN_DTAG_KeyName, CCN_DTAG);    // <KeyName>
+        {
+          written += CCNB::AppendBlockHeader (start, CCN_DTAG_Name, CCN_DTAG);       // <Name>
+          written += CCNB::AppendNameComponents (start, GetName());                  //   <Component>...</Component>...
+          written += CCNB::AppendCloser (start);                                     // </Name>
+        }
+        written += CCNB::AppendCloser (start);                                     // </KeyName>
+      }
+      written += CCNB::AppendCloser (start);                                     // </KeyLocator>
+    }
+  
+  written += CCNB::AppendCloser (start);                                     // </SignedInfo>
+
+  written += CCNB::AppendBlockHeader (start, CCN_DTAG_Content, CCN_DTAG); // <Content>
+
+  // there are no closing tags !!!
+  // The closing tag is handled by CcnxContentObjectTail
 }
 
 uint32_t
+CcnxContentObjectHeader::GetSerializedSize () const
+{
+  size_t written = 0;
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_ContentObject); // <ContentObject>
+
+  // fake signature
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Signature); // <Signature>
+  // Signature ::= DigestAlgorithm? 
+  //               Witness?         
+  //               SignatureBits   
+  if (GetSignature ().GetDigestAlgorithm () != Signature::DefaultDigestAlgorithm)
+    {
+      written += CCNB::EstimateString (CCN_DTAG_DigestAlgorithm, GetSignature ().GetDigestAlgorithm ());
+    }
+  written += CCNB::EstimateTaggedBlob (CCN_DTAG_SignatureBits,
+                                       sizeof (GetSignature ().GetSignatureBits ()));      // <SignatureBits />
+  written += 1;                                    // </Signature>  
+
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Name);    // <Name>
+  written += CCNB::EstimateNameComponents (GetName()); //   <Component>...</Component>...
+  written += 1;                                  // </Name>  
+
+  // fake signature
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_SignedInfo); // <SignedInfo>
+  // SignedInfo ::= √PublisherPublicKeyDigest
+  //                √Timestamp
+  //                √Type?
+  //                √FreshnessSeconds?
+  //                FinalBlockID?
+  //                KeyLocator?
+  
+  written += CCNB::EstimateTaggedBlob (CCN_DTAG_PublisherPublicKeyDigest,                          // <PublisherPublicKeyDigest>...
+                                       sizeof (GetSignedInfo ().GetPublisherPublicKeyDigest ()));
+  
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Timestamp);                  // <Timestamp>...
+  written += CCNB::EstimateTimestampBlob (GetSignedInfo ().GetTimestamp ());
+  written += 1;
+
+  if (GetSignedInfo ().GetContentType () != DATA)
+    {
+      written += CCNB::EstimateTaggedBlob (CCN_DTAG_Type, 3);
+    }
+  if (GetSignedInfo ().GetFreshness () >= Seconds(0))
+    {
+      written += CCNB::EstimateBlockHeader (CCN_DTAG_FreshnessSeconds);
+      written += CCNB::EstimateNumber (GetSignedInfo ().GetFreshness ().ToInteger (Time::S));
+      written += 1;
+    }
+
+  if (GetSignedInfo ().GetKeyLocator ()->size () > 0)
+    {
+      written += CCNB::EstimateBlockHeader (CCN_DTAG_KeyLocator); // <KeyLocator>
+      {
+        written += CCNB::EstimateBlockHeader (CCN_DTAG_KeyName);    // <KeyName>
+        {
+          written += CCNB::EstimateBlockHeader (CCN_DTAG_Name);       // <Name>
+          written += CCNB::EstimateNameComponents (GetName());        //   <Component>...</Component>...
+          written += 1;                                               // </Name>
+        }
+        written += 1;                                               // </KeyName>
+      }
+      written += 1;                                               // </KeyLocator>
+    }
+  
+  written += 1; // </SignedInfo>
+
+  written += CCNB::EstimateBlockHeader (CCN_DTAG_Content); // <Content>
+
+  // there are no closing tags !!!
+  // The closing tag is handled by CcnxContentObjectTail
+  return written;
+}
+#undef CCNB
+
+class ContentObjectVisitor : public VoidDepthFirstVisitor
+{
+public:
+  virtual void visit (Dtag &n, boost::any param/*should be CcnxContentObjectHeader* */)
+  {
+    // uint32_t n.m_dtag;
+    // std::list<Ptr<Block> > n.m_nestedBlocks;
+    static NameComponentsVisitor nameComponentsVisitor;
+    static NonNegativeIntegerVisitor nonNegativeIntegerVisitor;
+    static TimestampVisitor          timestampVisitor;
+    static StringVisitor     stringVisitor;
+    static Uint32tBlobVisitor uint32tBlobVisitor;
+    static ContentTypeVisitor contentTypeVisitor;
+  
+    CcnxContentObjectHeader &contentObject = *(boost::any_cast<CcnxContentObjectHeader*> (param));
+  
+    switch (n.m_dtag)
+      {
+      case CCN_DTAG_ContentObject:
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }
+        break;
+      case CCN_DTAG_Name:
+        {
+          // process name components
+          Ptr<CcnxNameComponents> name = Create<CcnxNameComponents> ();
+        
+          BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+            {
+              block->accept (nameComponentsVisitor, &(*name));
+            }
+          contentObject.SetName (name);
+          break;
+        }
+
+      case CCN_DTAG_Signature: 
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }      
+        break;
+
+      case CCN_DTAG_DigestAlgorithm:
+        NS_LOG_DEBUG ("DigestAlgorithm");
+        if (n.m_nestedTags.size ()!=1) // should be exactly one UDATA inside this tag
+          throw CcnbDecodingException ();
+        
+        contentObject.GetSignature ().SetDigestAlgorithm
+          (boost::any_cast<std::string> ((*n.m_nestedTags.begin())->accept
+                                         (stringVisitor)));
+        break;
+
+      case CCN_DTAG_SignatureBits:
+        NS_LOG_DEBUG ("SignatureBits");
+        if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignature ().SetSignatureBits
+          (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                      (uint32tBlobVisitor)));
+        break;
+
+      case CCN_DTAG_SignedInfo:
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }      
+        break;
+      
+      case CCN_DTAG_PublisherPublicKeyDigest:
+        NS_LOG_DEBUG ("PublisherPublicKeyDigest");
+        if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignedInfo ().SetPublisherPublicKeyDigest
+          (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                      (uint32tBlobVisitor)));
+        break;
+
+      case CCN_DTAG_Timestamp:
+        NS_LOG_DEBUG ("Timestamp");
+        if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignedInfo ().SetTimestamp
+          (boost::any_cast<Time> ((*n.m_nestedTags.begin())->accept
+                                  (timestampVisitor)));
+        break;
+
+      case CCN_DTAG_Type:
+        NS_LOG_DEBUG ("Type");
+        if (n.m_nestedTags.size ()!=1) // should be only one nested tag
+          throw CcnbDecodingException ();
+
+        contentObject.GetSignedInfo ().SetContentType
+          (static_cast<CcnxContentObjectHeader::ContentType>
+           (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                       (contentTypeVisitor))));
+        break;
+        
+      case CCN_DTAG_FreshnessSeconds:
+        NS_LOG_DEBUG ("FreshnessSeconds");
+      
+        if (n.m_nestedTags.size()!=1) // should be exactly one nested tag
+          throw CcnbDecodingException ();
+        
+        contentObject.GetSignedInfo ().SetFreshness
+          (Seconds
+           (boost::any_cast<uint32_t> ((*n.m_nestedTags.begin())->accept
+                                       (nonNegativeIntegerVisitor))));
+        break;
+      
+      case CCN_DTAG_KeyLocator:
+        // process nested blocks
+        BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
+          {
+            block->accept (*this, param);
+          }      
+        break;
+
+      case CCN_DTAG_KeyName:
+        {
+          if (n.m_nestedTags.size ()!=1) // should be exactly one nested tag
+            throw CcnbDecodingException ();
+
+          Ptr<BaseTag> nameTag = DynamicCast<BaseTag>(n.m_nestedTags.front ());
+          if (nameTag == 0)
+            throw CcnbDecodingException ();
+
+          // process name components
+          Ptr<CcnxNameComponents> name = Create<CcnxNameComponents> ();
+        
+          BOOST_FOREACH (Ptr<Block> block, nameTag->m_nestedTags)
+            {
+              block->accept (nameComponentsVisitor, &(*name));
+            }
+          contentObject.GetSignedInfo ().SetKeyLocator (name);
+          break;
+        }
+
+      case CCN_DTAG_Content: // !!! HACK
+        // This hack was necessary for memory optimizations (i.e., content is virtual payload)
+        NS_ASSERT_MSG (n.m_nestedTags.size() == 0, "Parser should have stopped just after processing <Content> tag");
+        break;
+      
+      default: // ignore all other stuff
+        break;
+      }
+  }
+};
+
+uint32_t
 CcnxContentObjectHeader::Deserialize (Buffer::Iterator start)
 {
-  return CcnxDecodingHelper::Deserialize (start, *this); // \todo Debugging is necessary
+  static ContentObjectVisitor contentObjectVisitor;
+
+  Buffer::Iterator i = start;
+  Ptr<CcnbParser::Block> root = CcnbParser::Block::ParseBlock (i);
+  root->accept (contentObjectVisitor, this);
+
+  return i.GetDistanceFrom (start);
 }
   
 TypeId
@@ -176,5 +470,79 @@
 
   return 2;
 }
-  
+
+///////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////
+
+CcnxContentObjectHeader::SignedInfo::SignedInfo ()
+  : m_publisherPublicKeyDigest (0)
+  // ,  m_timestamp
+  , m_type (DATA)
+  // , m_freshness
+  // , FinalBlockID
+  // , KeyLocator
+{
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetPublisherPublicKeyDigest (uint32_t digest)
+{
+  m_publisherPublicKeyDigest = digest;
+}
+
+uint32_t
+CcnxContentObjectHeader::SignedInfo::GetPublisherPublicKeyDigest () const
+{
+  return m_publisherPublicKeyDigest;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetTimestamp (const Time &timestamp)
+{
+  m_timestamp = timestamp;
+}
+
+Time
+CcnxContentObjectHeader::SignedInfo::GetTimestamp () const
+{
+  return m_timestamp;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetContentType (CcnxContentObjectHeader::ContentType type)
+{
+  m_type = type;
+}
+
+CcnxContentObjectHeader::ContentType
+CcnxContentObjectHeader::SignedInfo::GetContentType () const
+{
+  return m_type;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetFreshness (const Time &freshness)
+{
+  m_freshness = freshness;
+}
+
+Time
+CcnxContentObjectHeader::SignedInfo::GetFreshness () const
+{
+  return m_freshness;
+}
+
+void
+CcnxContentObjectHeader::SignedInfo::SetKeyLocator (Ptr<const CcnxNameComponents> keyLocator)
+{
+  m_keyLocator = keyLocator;
+}
+
+Ptr<const CcnxNameComponents>
+CcnxContentObjectHeader::SignedInfo::GetKeyLocator () const
+{
+  return m_keyLocator;
+}
+
 } // namespace ns3
diff --git a/model/ccnx-content-object-header.h b/model/ccnx-content-object-header.h
index 26e8333..a7bad01 100644
--- a/model/ccnx-content-object-header.h
+++ b/model/ccnx-content-object-header.h
@@ -51,10 +51,158 @@
  * "<ContentObject><Signature>..</Signature><Name>...</Name><SignedInfo>...</SignedInfo><Content>"
  * 
  */
-  
 class CcnxContentObjectHeader : public SimpleRefCount<CcnxContentObjectHeader,Header>
 {
 public:
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  /**
+   * @brief Class representing Signature section of the content object
+   */
+  class Signature
+  {
+  public:
+    /**
+     * @brief Default constructor. Creates a fake-type signature
+     */
+    inline Signature ();
+
+    inline const std::string &
+    GetDigestAlgorithm () const;
+
+    inline void
+    SetDigestAlgorithm (const std::string &digestAlgorithm);
+
+    inline uint32_t
+    GetSignatureBits () const;
+
+    inline void
+    SetSignatureBits (uint32_t signatureBits);
+
+    static const std::string DefaultDigestAlgorithm; // = "2.16.840.1.101.3.4.2.1";
+    
+  private:
+    std::string m_digestAlgorithm; // if value is `2.16.840.1.101.3.4.2.1`, then SHA-256 (not supported)
+                                   // in NS-3 value `99.0` represents a fake digest
+    // Witness // not used in NS-3
+    uint32_t m_signatureBits; // in NS-3 a fake signature is a just 32-bits
+  };
+  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+
+  enum ContentType
+    {
+      DATA = 0x0C04C0, // default value. If ContentObject is type of DATA, then ContentType tag will be omitted
+      ENCR = 0x10D091,
+      GONE = 0x18E344,
+      KEY  = 0x28463F,
+      LINK = 0x2C834A,
+      NACK = 0x34008A
+    };
+
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+
+  /**
+   * @brief Class representing SignedInfo section of the content object
+   */
+  class SignedInfo
+  {
+  public:
+    /**
+     * @brief Default constructor
+     */
+    SignedInfo (); 
+    
+    /**
+     * @brief Set PublisherPublicKey digest
+     * @param digest a fake 32-bit digest is supported
+     */
+    void
+    SetPublisherPublicKeyDigest (uint32_t digest);
+
+    /**
+     * @brief Get PublisherPublicKey digest
+     */
+    uint32_t
+    GetPublisherPublicKeyDigest () const;
+
+    /**
+     * @brief Set content object timestamp
+     * @param timestamp timestamp
+     */
+    void
+    SetTimestamp (const Time &timestamp);
+
+    /**
+     * @brief Get timestamp of the content object
+     */
+    Time
+    GetTimestamp () const;
+
+    /**
+     * @brief Set ContentObject type
+     * @param type type of the content object
+     */
+    void
+    SetContentType (ContentType type);
+
+    /**
+     * @brief Get ContentObject type
+     */
+    ContentType
+    GetContentType () const;
+    
+    /**
+     * @brief Set freshness of the content object
+     * @param freshness Freshness, 0s means infinity
+     */
+    void
+    SetFreshness (const Time &freshness);
+
+    /**
+     * @brief Get freshness of the content object
+     */
+    Time
+    GetFreshness () const;
+
+    /**
+     * @brief Set key locator
+     * @param keyLocator name of the key
+     *
+     * Note that only <KeyName> option for the key locator is supported
+     */
+    void
+    SetKeyLocator (Ptr<const CcnxNameComponents> keyLocator);
+
+    /**
+     * @brief Get key locator
+     *
+     * Note that only <KeyName> option for the key locator is supported
+     */
+    Ptr<const CcnxNameComponents>
+    GetKeyLocator () const;
+    
+  private:
+    uint32_t m_publisherPublicKeyDigest; // fake publisher key digest
+    Time m_timestamp;
+    ContentType m_type;
+    Time m_freshness;
+    // FinalBlockID
+    Ptr<const CcnxNameComponents> m_keyLocator; // support only <KeyName> option for KeyLocator
+  };
+
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+  ////////////////////////////////////////////////////////////////////////////  
+
   /**
    * Constructor
    *
@@ -63,33 +211,42 @@
   CcnxContentObjectHeader ();
 
   /**
-   * \brief Set interest name
+   * \brief Set content object name
    *
-   * Sets name of the interest. For example, SetName( CcnxNameComponents("prefix")("postfix") );
+   * Sets name of the content object. For example, SetName( CcnxNameComponents("prefix")("postfix") );
    **/
   void
   SetName (const Ptr<CcnxNameComponents> &name);
 
+  /**
+   * @brief Get name of the content object
+   */
   const CcnxNameComponents&
   GetName () const;
 
-  // void
-  // SetSignature ();
+  /**
+   * @brief Get editable reference to content object's Signature
+   */
+  inline Signature &
+  GetSignature ();
 
-  // ?
-  // GetSignature () const;
+  /**
+   * @brief Get read-only reference to content object's Signature
+   */
+  inline const Signature &
+  GetSignature () const;
 
-  void
-  SetTimestamp (const Time &timestamp);
+  /**
+   * @brief Get editable reference to content object's SignedInfo
+   */
+  inline SignedInfo &
+  GetSignedInfo ();
 
-  Time
-  GetTimestamp () const;
-  
-  void
-  SetFreshness (const Time &freshness);
-
-  Time
-  GetFreshness () const;
+  /**
+   * @brief Get read-only reference to content object's SignedInfo
+   */
+  inline const SignedInfo &
+  GetSignedInfo () const;
   
   //////////////////////////////////////////////////////////////////
   
@@ -99,19 +256,9 @@
   virtual uint32_t GetSerializedSize (void) const;
   virtual void Serialize (Buffer::Iterator start) const;
   virtual uint32_t Deserialize (Buffer::Iterator start);
-
-  struct SignedInfo
-  {
-    // PublisherPublicKeyDigest
-    Time m_timestamp;
-    // Type (ContentType)
-    Time m_freshness;
-    // FinalBlockID
-    // KeyLocator
-  };
   
 private:
-  // m_signature;
+  Signature  m_signature;
   Ptr<CcnxNameComponents> m_name;
   SignedInfo m_signedInfo;
 };
@@ -134,8 +281,64 @@
   virtual uint32_t Deserialize (Buffer::Iterator start);
 };
 
+
+CcnxContentObjectHeader::Signature::Signature ()
+  : m_digestAlgorithm ("99.0")
+  , m_signatureBits (0)
+{
+}
+
+const std::string &
+CcnxContentObjectHeader::Signature::GetDigestAlgorithm () const
+{
+  return m_digestAlgorithm;
+}
+
+void
+CcnxContentObjectHeader::Signature::SetDigestAlgorithm (const std::string &digestAlgorithm)
+{
+  m_digestAlgorithm = digestAlgorithm;
+}
+
+uint32_t
+CcnxContentObjectHeader::Signature::GetSignatureBits () const
+{
+  return m_signatureBits;
+}
+
+inline void
+CcnxContentObjectHeader::Signature::SetSignatureBits (uint32_t signature)
+{
+  m_signatureBits = signature;
+}
+
+
+CcnxContentObjectHeader::Signature &
+CcnxContentObjectHeader::GetSignature ()
+{
+  return m_signature;
+}
+
+const CcnxContentObjectHeader::Signature &
+CcnxContentObjectHeader::GetSignature () const
+{
+  return m_signature;
+}
+
+CcnxContentObjectHeader::SignedInfo &
+CcnxContentObjectHeader::GetSignedInfo ()
+{
+  return m_signedInfo;
+}
+
+const CcnxContentObjectHeader::SignedInfo &
+CcnxContentObjectHeader::GetSignedInfo () const
+{
+  return m_signedInfo;
+}
+
 class CcnxContentObjectHeaderException {};
-  
+
 } // namespace ns3
 
 #endif // _CCNX_CONTENT_OBJECT_HEADER_H_