More debug
diff --git a/examples/interest-header-example.cc b/examples/interest-header-example.cc
index a93da9a..080e5a5 100644
--- a/examples/interest-header-example.cc
+++ b/examples/interest-header-example.cc
@@ -1,3 +1,21 @@
+/* -*- 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
+ *
+ */
#include "ns3/test.h"
#include "ns3/annotated-topology-reader.h"
#include "ns3/ccnx-interest-header.h"
@@ -19,54 +37,54 @@
int
main (int argc, char *argv[])
{
- LogComponentEnable ("InterestHeaderExample", LOG_ALL);
- LogComponentEnable ("Packet", LOG_ALL);
+ // LogComponentEnable ("InterestHeaderExample", LOG_ALL);
+ // LogComponentEnable ("Packet", LOG_ALL);
- NS_LOG_INFO ("Test started");
+ NS_LOG_INFO ("Test started");
- Packet::EnablePrinting ();
- Packet::EnableChecking ();
- Packet packet (0);
+ Packet::EnablePrinting ();
+ Packet::EnableChecking ();
+ Packet packet (0);
- CcnxInterestHeader interestHeader;
+ CcnxInterestHeader interestHeader;
- Ptr<CcnxNameComponents> testname = Create<CcnxNameComponents> ();
- (*testname) ("first") ("second");
- interestHeader.SetName(testname);
+ Ptr<CcnxNameComponents> testname = Create<CcnxNameComponents> ();
+ (*testname) ("first") ("second");
+ interestHeader.SetName(testname);
- uint32_t minSuffixComponents = 20;
- interestHeader.SetMinSuffixComponents(minSuffixComponents);
+ uint32_t minSuffixComponents = 20;
+ interestHeader.SetMinSuffixComponents(minSuffixComponents);
- uint32_t maxSuffixComponents = 40;
- interestHeader.SetMaxSuffixComponents(maxSuffixComponents);
+ uint32_t maxSuffixComponents = 40;
+ interestHeader.SetMaxSuffixComponents(maxSuffixComponents);
- Time lifetime = Seconds(661777) + MicroSeconds(1234);
- interestHeader.SetInterestLifetime(lifetime);
+ Time lifetime = Seconds(661777) + MicroSeconds(1234);
+ interestHeader.SetInterestLifetime(lifetime);
- bool child = true;
- interestHeader.SetChildSelector(child);
+ bool child = true;
+ interestHeader.SetChildSelector(child);
- Ptr<CcnxNameComponents> exclude = Create<CcnxNameComponents> ();
- (*exclude) ("exclude1") ("exclude2");
- interestHeader.SetExclude(exclude);
+ Ptr<CcnxNameComponents> exclude = Create<CcnxNameComponents> ();
+ (*exclude) ("exclude1") ("exclude2");
+ interestHeader.SetExclude(exclude);
- UniformVariable random(1, std::numeric_limits<uint32_t>::max ());
- uint32_t randomNonce = static_cast<uint32_t> (random.GetValue());
- interestHeader.SetNonce(randomNonce);
+ UniformVariable random(1, std::numeric_limits<uint32_t>::max ());
+ uint32_t randomNonce = static_cast<uint32_t> (random.GetValue());
+ interestHeader.SetNonce(randomNonce);
- interestHeader.SetNack(true);
- interestHeader.SetCongested(true);
- NS_LOG_INFO ("Source: \n" << interestHeader);
+ interestHeader.SetNack(true);
+ interestHeader.SetCongested(true);
+ NS_LOG_INFO ("Source: \n" << interestHeader);
- packet.AddHeader (interestHeader);
- NS_LOG_INFO ("Deserialized packet: " << packet);
+ packet.AddHeader (interestHeader);
+ NS_LOG_INFO ("Deserialized packet: " << packet);
- NS_LOG_INFO ("Removing and deserializing individual headers");
+ NS_LOG_INFO ("Removing and deserializing individual headers");
- CcnxInterestHeader target;
- packet.RemoveHeader (target);
+ CcnxInterestHeader target;
+ packet.RemoveHeader (target);
- NS_LOG_INFO ("Target: \n" << target);
+ // NS_LOG_INFO ("Target: \n" << target);
- return 0;
+ return 0;
}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-base-tag.h b/helper/ccnb-parser/syntax-tree/ccnb-parser-base-tag.h
index 6b7fe76..604ebce 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-base-tag.h
+++ b/helper/ccnb-parser/syntax-tree/ccnb-parser-base-tag.h
@@ -40,6 +40,9 @@
std::list<Ptr<Block> > m_attrs; ///< \brief List of attributes, associated with this tag
std::list<Ptr<Block> > m_nestedTags; ///< \brief List of nested tags
+public:
+ virtual ~BaseTag () { }
+
protected:
/**
* \brief Default constructor
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc b/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
index 74807d3..09bf96a 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
+++ b/helper/ccnb-parser/syntax-tree/ccnb-parser-block.cc
@@ -28,6 +28,10 @@
#include "ccnb-parser-dattr.h"
#include "ccnb-parser-ext.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("CcnbParserBlock");
+
namespace ns3 {
namespace CcnbParser {
@@ -40,6 +44,8 @@
Ptr<Block> Block::ParseBlock (Buffer::Iterator &start)
{
+ NS_LOG_DEBUG (">");
+
// std::cout << "<< pos: " << counter << "\n";
uint32_t value = 0;
@@ -57,7 +63,7 @@
value <<= 4;
value += ( (byte&(~CCN_TT_HBIT)) >> 3);
-
+
/**
* Huh. After fighting with NS-3, it became apparent that Create<T>(...) construct
* doesn't work with references. Just simply doesn't work. wtf?
@@ -83,5 +89,10 @@
}
}
+Block::~Block ()
+{
+ NS_LOG_DEBUG ("<");
+}
+
}
}
diff --git a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.h b/helper/ccnb-parser/syntax-tree/ccnb-parser-block.h
index 59ccf02..a188597 100644
--- a/helper/ccnb-parser/syntax-tree/ccnb-parser-block.h
+++ b/helper/ccnb-parser/syntax-tree/ccnb-parser-block.h
@@ -56,6 +56,8 @@
*/
static Ptr<Block>
ParseBlock (Buffer::Iterator &start);
+
+ virtual ~Block ();
virtual void accept( VoidNoArguVisitor &v ) = 0;
virtual void accept( VoidVisitor &v, boost::any param ) = 0;
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc b/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
index 992fae5..65ec4ee 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
+++ b/helper/ccnb-parser/visitors/ccnb-parser-interest-visitor.cc
@@ -34,6 +34,10 @@
#include <boost/foreach.hpp>
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("CcnbParserInterestVisitor");
+
namespace ns3 {
namespace CcnbParser {
@@ -50,10 +54,12 @@
static NonceVisitor nonceVisitor;
CcnxInterestHeader &interest = *(boost::any_cast<CcnxInterestHeader*> (param));
-
+
switch (n.m_dtag)
{
case CCN_DTAG_Interest:
+ NS_LOG_DEBUG ("Interest");
+
// process nested blocks
BOOST_FOREACH (Ptr<Block> block, n.m_nestedTags)
{
@@ -62,6 +68,8 @@
break;
case CCN_DTAG_Name:
{
+ NS_LOG_DEBUG ("Name");
+
// process name components
Ptr<CcnxNameComponents> name = Create<CcnxNameComponents> ();
@@ -73,6 +81,7 @@
break;
}
case CCN_DTAG_MinSuffixComponents:
+ NS_LOG_DEBUG ("MinSuffixComponents");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
interest.SetMinSuffixComponents (
@@ -82,6 +91,7 @@
)));
break;
case CCN_DTAG_MaxSuffixComponents:
+ NS_LOG_DEBUG ("MaxSuffixComponents");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
interest.SetMaxSuffixComponents (
@@ -92,6 +102,7 @@
break;
case CCN_DTAG_Exclude:
{
+ NS_LOG_DEBUG ("Exclude");
// process exclude components
Ptr<CcnxNameComponents> exclude = Create<CcnxNameComponents> ();
@@ -103,6 +114,7 @@
break;
}
case CCN_DTAG_ChildSelector:
+ NS_LOG_DEBUG ("ChildSelector");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
@@ -113,6 +125,7 @@
)));
break;
case CCN_DTAG_AnswerOriginKind:
+ NS_LOG_DEBUG ("AnswerOriginKind");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
interest.SetAnswerOriginKind (
@@ -122,6 +135,7 @@
)));
break;
case CCN_DTAG_Scope:
+ NS_LOG_DEBUG ("Scope");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
interest.SetScope (
@@ -131,16 +145,18 @@
)));
break;
case CCN_DTAG_InterestLifetime:
+ NS_LOG_DEBUG ("InterestLifetime");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
interest.SetInterestLifetime (
boost::any_cast<Time> (
- (*n.m_nestedTags.begin())->accept(
- timestampVisitor
- )));
+ (*n.m_nestedTags.begin())->accept(
+ timestampVisitor
+ )));
break;
case CCN_DTAG_Nonce:
+ NS_LOG_DEBUG ("Nonce");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
@@ -153,6 +169,7 @@
case NDN_DTAG_Nack:
+ NS_LOG_DEBUG ("Nack");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
@@ -162,6 +179,7 @@
break;
case NDN_DTAG_Congested:
+ NS_LOG_DEBUG ("Congested");
if (n.m_nestedTags.size()!=1) // should be exactly one UDATA inside this tag
throw CcnbDecodingException ();
diff --git a/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.cc b/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.cc
index 22965aa..ea4ab00 100644
--- a/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.cc
+++ b/helper/ccnb-parser/visitors/ccnb-parser-timestamp-visitor.cc
@@ -44,7 +44,6 @@
}
uint8_t combo = start[n.m_blobSize-2]; // 4 most significant bits hold 4 least significant bits of number of seconds
seconds = (seconds << 4) | (combo >> 4);
- std::cout << std::hex << (int) start[n.m_blobSize-2] << "\n";
nanoseconds = combo & 0x0F; /*00001111*/ // 4 least significant bits hold 4 most significant bits of number of
nanoseconds = (nanoseconds << 8) | start[n.m_blobSize-1];