ContentObject and Interest serialization and deserialization seem to
work normal now. Debug examples added to examples/ folder (they
probably should become a part of test suite).
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.cc b/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.cc
index 8d9ecf7..0fdea06 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.cc
+++ b/helper/ccnb-parser/syntax-tree/ccnb-parser-dtag.cc
@@ -29,7 +29,7 @@
Dtag::Dtag (Buffer::Iterator &start, uint32_t dtag)
{
m_dtag = dtag;
-
+ // std::cout << m_dtag << ", position: " << Block::counter << "\n";
/**
* Hack
*
@@ -66,10 +66,21 @@
m_nestedTags.push_back (Block::ParseBlock (start));
}
+
+ // hack #3. Stop processing when last tag was <ContentObject>
+ if (m_dtag == CCN_DTAG_ContentObject && // we are in <ContentObject>
+ DynamicCast<Dtag> (m_nestedTags.back())!=0 && // last block is DTAG
+ DynamicCast<Dtag> (m_nestedTags.back())->m_dtag == CCN_DTAG_Content)
+ {
+ return;
+ }
+
if (start.IsEnd ())
throw CcnbDecodingException ();
start.ReadU8 (); // read CCN_CLOSE
+ // std::cout << "closer, position = " << Block::counter << "\n";
+ // Block::counter ++;
}
}