Finalizing packet serialization. Set boost requirement (module will not be compiled without boost)
diff --git a/model/ccnx-content-object-header.cc b/model/ccnx-content-object-header.cc
index 46a1554..a3852a2 100644
--- a/model/ccnx-content-object-header.cc
+++ b/model/ccnx-content-object-header.cc
@@ -22,6 +22,7 @@
#include "ccnx-content-object-header.h"
#include "ns3/log.h"
+#include "ns3/ccnx-coding-helper.h"
NS_LOG_COMPONENT_DEFINE ("CcnxContentObjectHeader");
@@ -60,19 +61,22 @@
uint32_t
CcnxContentObjectHeader::GetSerializedSize (void) const
{
- return 0;
+ // Unfortunately, two serializations are required, unless we can pre-calculate header length... which is not trivial
+ Buffer tmp;
+
+ return CcnxCodingHelper::Serialize (tmp.Begin(), *this);
}
void
CcnxContentObjectHeader::Serialize (Buffer::Iterator start) const
{
- return;
+ CcnxCodingHelper::Serialize (start, *this);
}
uint32_t
CcnxContentObjectHeader::Deserialize (Buffer::Iterator start)
{
- return 0;
+ return 0; // the most complicated part is here
}
TypeId
diff --git a/model/ccnx-interest-header.cc b/model/ccnx-interest-header.cc
index 627946c..cab33ea 100644
--- a/model/ccnx-interest-header.cc
+++ b/model/ccnx-interest-header.cc
@@ -26,6 +26,7 @@
#include "ccnx-interest-header.h"
#include "ns3/log.h"
+#include "ns3/ccnx-coding-helper.h"
NS_LOG_COMPONENT_DEFINE ("CcnxInterestHeader");
@@ -167,19 +168,22 @@
uint32_t
CcnxInterestHeader::GetSerializedSize (void) const
{
- return 0;
+ // unfortunately, 2 serialization required...
+ Buffer tmp;
+
+ return CcnxCodingHelper::Serialize (tmp.Begin(), *this);
}
void
CcnxInterestHeader::Serialize (Buffer::Iterator start) const
{
- return;
+ CcnxCodingHelper::Serialize (start, *this);
}
uint32_t
CcnxInterestHeader::Deserialize (Buffer::Iterator start)
{
- return 0;
+ return 0; // the most complicated part is here
}
TypeId
@@ -191,7 +195,23 @@
void
CcnxInterestHeader::Print (std::ostream &os) const
{
- os << "Interest: " << *m_name;
+ os << "<Interest><Name>" << *m_name << "</Name>";
+ if (m_minSuffixComponents>=0)
+ os << "<MinSuffixComponents>" << m_minSuffixComponents << "</MinSuffixComponents>";
+ if (m_maxSuffixComponents>=0)
+ os << "<MaxSuffixComponents>" << m_maxSuffixComponents << "</MaxSuffixComponents>";
+ if (m_exclude->size()>0)
+ os << "<Exclude>" << *m_exclude << "</Exclude>";
+ if (m_childSelector)
+ os << "<ChildSelector />";
+ if (m_answerOriginKind)
+ os << "<AnswerOriginKind />";
+ if (m_scope>=0)
+ os << "<Scope>" << m_scope << "</Scope>";
+ if (!m_interestLifetime.IsZero())
+ os << "<InterestLifetime>" << m_interestLifetime << "</InterestLifetime>";
+ if (m_nonce>0)
+ os << "<Nonce>" << m_nonce << "</Nonce>";
}
}
diff --git a/model/name-components.cc b/model/name-components.cc
index 55e57c4..e1af1ee 100644
--- a/model/name-components.cc
+++ b/model/name-components.cc
@@ -20,9 +20,6 @@
#include "name-components.h"
-#include "ns3/ccn.h"
-#include "ns3/ccn_charbuf.h"
-
#include <iostream>
using namespace std;
@@ -49,6 +46,13 @@
// ccn_charbuf_destroy(&m_value);
}
+const std::list<std::string> &
+Components::GetComponents () const
+{
+ return m_prefix;
+}
+
+
// const ccn_charbuf*
// Components::GetName () const
// {
diff --git a/model/name-components.h b/model/name-components.h
index 8c124f8..d9b3f0a 100644
--- a/model/name-components.h
+++ b/model/name-components.h
@@ -37,6 +37,9 @@
~Components ();
Components& operator () (const std::string &s);
+
+ const std::list<std::string> &
+ GetComponents () const;
// virtual uint32_t
// GetSerializedSize (void) const;