Solving a couple of bugs resulting from the packet format changes. Code compiles, but haven't fully tested yet
diff --git a/model/cs/content-store-impl.h b/model/cs/content-store-impl.h
index 66ce27c..1281495 100644
--- a/model/cs/content-store-impl.h
+++ b/model/cs/content-store-impl.h
@@ -23,8 +23,8 @@
#include "ndn-content-store.h"
#include "ns3/packet.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include <boost/foreach.hpp>
#include "../../utils/trie/trie-with-policy.h"
diff --git a/model/cs/ndn-content-store.cc b/model/cs/ndn-content-store.cc
index bfd4926..90a5699 100644
--- a/model/cs/ndn-content-store.cc
+++ b/model/cs/ndn-content-store.cc
@@ -24,8 +24,8 @@
#include "ns3/log.h"
#include "ns3/packet.h"
#include "ns3/ndn-name-components.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
NS_LOG_COMPONENT_DEFINE ("ndn.cs.ContentStore");
diff --git a/model/fib/ndn-fib-impl.cc b/model/fib/ndn-fib-impl.cc
index fd12c68..30004b5 100644
--- a/model/fib/ndn-fib-impl.cc
+++ b/model/fib/ndn-fib-impl.cc
@@ -21,7 +21,7 @@
#include "ndn-fib-impl.h"
#include "ns3/ndn-face.h"
-#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-interest.h"
#include "ns3/node.h"
#include "ns3/assert.h"
diff --git a/model/fw/best-route.cc b/model/fw/best-route.cc
index 046d7a2..03400b7 100644
--- a/model/fw/best-route.cc
+++ b/model/fw/best-route.cc
@@ -21,7 +21,7 @@
#include "best-route.h"
-#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-interest.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-pit-entry.h"
diff --git a/model/fw/flooding.cc b/model/fw/flooding.cc
index b4e94a8..80b863a 100644
--- a/model/fw/flooding.cc
+++ b/model/fw/flooding.cc
@@ -21,7 +21,7 @@
#include "flooding.h"
-#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-interest.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-pit-entry.h"
diff --git a/model/fw/green-yellow-red.cc b/model/fw/green-yellow-red.cc
index 3351cda..52acc68 100644
--- a/model/fw/green-yellow-red.cc
+++ b/model/fw/green-yellow-red.cc
@@ -23,8 +23,8 @@
#include "ns3/ndn-pit.h"
#include "ns3/ndn-pit-entry.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-fib.h"
#include "ns3/ndn-content-store.h"
diff --git a/model/fw/nacks.cc b/model/fw/nacks.cc
index 511b022..4e7894a 100644
--- a/model/fw/nacks.cc
+++ b/model/fw/nacks.cc
@@ -22,8 +22,8 @@
#include "ns3/ndn-pit.h"
#include "ns3/ndn-pit-entry.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-fib.h"
#include "ns3/ndn-content-store.h"
diff --git a/model/fw/ndn-forwarding-strategy.cc b/model/fw/ndn-forwarding-strategy.cc
index 770613b..390bdd1 100644
--- a/model/fw/ndn-forwarding-strategy.cc
+++ b/model/fw/ndn-forwarding-strategy.cc
@@ -23,8 +23,8 @@
#include "ns3/ndn-pit.h"
#include "ns3/ndn-pit-entry.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-fib.h"
#include "ns3/ndn-content-store.h"
diff --git a/model/fw/per-fib-limits.cc b/model/fw/per-fib-limits.cc
index 3b60cf5..3ec4f57 100644
--- a/model/fw/per-fib-limits.cc
+++ b/model/fw/per-fib-limits.cc
@@ -22,8 +22,8 @@
#include "per-out-face-limits.h"
#include "ns3/ndn-l3-protocol.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "best-route.h"
#include "flooding.h"
diff --git a/model/fw/per-out-face-limits.cc b/model/fw/per-out-face-limits.cc
index 5591739..41ca598 100644
--- a/model/fw/per-out-face-limits.cc
+++ b/model/fw/per-out-face-limits.cc
@@ -21,8 +21,8 @@
#include "per-out-face-limits.h"
#include "ns3/ndn-l3-protocol.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "best-route.h"
#include "flooding.h"
diff --git a/model/fw/smart-flooding.cc b/model/fw/smart-flooding.cc
index 8a1d367..3777739 100644
--- a/model/fw/smart-flooding.cc
+++ b/model/fw/smart-flooding.cc
@@ -20,7 +20,7 @@
#include "smart-flooding.h"
-#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-interest.h"
#include "ns3/ndn-pit.h"
#include "ns3/ndn-pit-entry.h"
diff --git a/model/ndn-app-face.cc b/model/ndn-app-face.cc
index 538b10c..e735b9a 100644
--- a/model/ndn-app-face.cc
+++ b/model/ndn-app-face.cc
@@ -31,8 +31,8 @@
#include "ns3/ndn-header-helper.h"
#include "ns3/ndn-app.h"
-#include "ndn-interest-header.h"
-#include "ndn-content-object-header.h"
+#include "ndn-interest.h"
+#include "ndn-content-object.h"
NS_LOG_COMPONENT_DEFINE ("ndn.AppFace");
@@ -101,7 +101,7 @@
HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
switch (type)
{
- case HeaderHelper::INTEREST:
+ case HeaderHelper::INTEREST_NDNSIM:
{
Ptr<InterestHeader> header = Create<InterestHeader> ();
p->RemoveHeader (*header);
@@ -113,7 +113,7 @@
break;
}
- case HeaderHelper::CONTENT_OBJECT:
+ case HeaderHelper::CONTENT_OBJECT_NDNSIM:
{
static ContentObjectTail tail;
Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
@@ -123,6 +123,9 @@
break;
}
+ default:
+ NS_FATAL_ERROR ("ccnb support is currently broken");
+ break;
}
return true;
diff --git a/model/ndn-content-object-header.cc b/model/ndn-content-object.cc
similarity index 97%
rename from model/ndn-content-object-header.cc
rename to model/ndn-content-object.cc
index 3688a89..30a19de 100644
--- a/model/ndn-content-object-header.cc
+++ b/model/ndn-content-object.cc
@@ -19,7 +19,7 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ndn-content-object-header.h"
+#include "ndn-content-object.h"
#include "ns3/log.h"
@@ -119,7 +119,7 @@
throw new ContentObjectHeaderException ();
m_name = Create<NameComponents> ();
- uint32_t offset = m_name->Deserialize (start);
+ uint32_t offset = m_name->Deserialize (i);
i.Next (offset);
if (i.ReadU16 () != (2 + 4 + 2 + 2 + (2 + 0))) // content length
diff --git a/model/ndn-content-object-header.h b/model/ndn-content-object.h
similarity index 100%
rename from model/ndn-content-object-header.h
rename to model/ndn-content-object.h
diff --git a/model/ndn-interest-header.cc b/model/ndn-interest.cc
similarity index 96%
rename from model/ndn-interest-header.cc
rename to model/ndn-interest.cc
index f128821..dae23ab 100644
--- a/model/ndn-interest-header.cc
+++ b/model/ndn-interest.cc
@@ -18,7 +18,7 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ndn-interest-header.h"
+#include "ndn-interest.h"
#include "ns3/log.h"
#include "ns3/unused.h"
@@ -180,12 +180,14 @@
if (i.ReadU8 () != 0x00)
throw new InterestHeaderException ();
+ m_nonce = i.ReadU32 ();
m_scope = i.ReadU8 ();
m_nackType = i.ReadU8 ();
+
m_interestLifetime = Seconds (i.ReadU16 ());
m_name = Create<NameComponents> ();
- uint32_t offset = m_name->Deserialize (start);
+ uint32_t offset = m_name->Deserialize (i);
i.Next (offset);
i.ReadU16 ();
@@ -194,7 +196,6 @@
NS_ASSERT (GetSerializedSize () == (i.GetDistanceFrom (start)));
return i.GetDistanceFrom (start);
- // return DecodingHelper::Deserialize (start, *this); // \todo Debugging is necessary
}
TypeId
diff --git a/model/ndn-interest-header.h b/model/ndn-interest.h
similarity index 100%
rename from model/ndn-interest-header.h
rename to model/ndn-interest.h
diff --git a/model/ndn-l3-protocol.cc b/model/ndn-l3-protocol.cc
index 850f84f..b0957c5 100644
--- a/model/ndn-l3-protocol.cc
+++ b/model/ndn-l3-protocol.cc
@@ -34,8 +34,8 @@
#include "ns3/ndn-header-helper.h"
#include "ns3/ndn-pit.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "ns3/ndn-face.h"
#include "ns3/ndn-forwarding-strategy.h"
@@ -258,7 +258,7 @@
HeaderHelper::Type type = HeaderHelper::GetNdnHeaderType (p);
switch (type)
{
- case HeaderHelper::INTEREST:
+ case HeaderHelper::INTEREST_NDNSIM:
{
s_interestCounter ++;
Ptr<InterestHeader> header = Create<InterestHeader> ();
@@ -274,7 +274,7 @@
// OnInterest (face, header, p/*original packet*/);
break;
}
- case HeaderHelper::CONTENT_OBJECT:
+ case HeaderHelper::CONTENT_OBJECT_NDNSIM:
{
s_dataCounter ++;
Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
@@ -288,6 +288,10 @@
m_forwardingStrategy->OnData (face, header, packet/*payload*/, p/*original packet*/);
break;
}
+ case HeaderHelper::INTEREST_CCNB:
+ case HeaderHelper::CONTENT_OBJECT_CCNB:
+ NS_FATAL_ERROR ("ccnb support is broken in this implementation");
+ break;
}
// exception will be thrown if packet is not recognized
diff --git a/model/ndn-name-components.cc b/model/ndn-name-components.cc
index 6e44b12..4a7965d 100644
--- a/model/ndn-name-components.cc
+++ b/model/ndn-name-components.cc
@@ -109,6 +109,7 @@
NameComponents::GetSerializedSize () const
{
size_t nameSerializedSize = 2;
+
for (std::list<std::string>::const_iterator i = this->begin ();
i != this->end ();
i++)
diff --git a/model/pit/ndn-pit-entry.cc b/model/pit/ndn-pit-entry.cc
index 0a06ed2..77c7578 100644
--- a/model/pit/ndn-pit-entry.cc
+++ b/model/pit/ndn-pit-entry.cc
@@ -22,7 +22,7 @@
#include "ns3/ndn-fib.h"
#include "ns3/ndn-name-components.h"
-#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-interest.h"
#include "ns3/simulator.h"
#include "ns3/log.h"
diff --git a/model/pit/ndn-pit-impl.cc b/model/pit/ndn-pit-impl.cc
index 04acd0f..29b029f 100644
--- a/model/pit/ndn-pit-impl.cc
+++ b/model/pit/ndn-pit-impl.cc
@@ -20,8 +20,8 @@
#include "ndn-pit-impl.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "ns3/ndn-forwarding-strategy.h"
#include "../../utils/trie/empty-policy.h"
diff --git a/model/pit/ndn-pit.cc b/model/pit/ndn-pit.cc
index 48a1747..ad8f4a2 100644
--- a/model/pit/ndn-pit.cc
+++ b/model/pit/ndn-pit.cc
@@ -20,8 +20,8 @@
#include "ndn-pit.h"
-#include "ns3/ndn-interest-header.h"
-#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn-interest.h"
+#include "ns3/ndn-content-object.h"
#include "ns3/log.h"
#include "ns3/string.h"