model+ndn.cxx+apps: New application template (CallbackBasedApp) that can be used to prototype NS-3 applications in python
The current code allows simulating in python using ApiFace (passed basic tests)
Refs #1005 (http://redmine.named-data.net/)
diff --git a/model/ndn-content-object.cc b/model/ndn-content-object.cc
index 582ebc9..81d92f0 100644
--- a/model/ndn-content-object.cc
+++ b/model/ndn-content-object.cc
@@ -35,6 +35,10 @@
, m_payload (payload)
, m_wire (0)
{
+ if (m_payload == 0) // just in case
+ {
+ m_payload = Create<Packet> ();
+ }
}
ContentObject::ContentObject (const ContentObject &other)
diff --git a/model/ndn-content-object.h b/model/ndn-content-object.h
index f586c15..6fa60dd 100644
--- a/model/ndn-content-object.h
+++ b/model/ndn-content-object.h
@@ -22,57 +22,19 @@
#ifndef _NDN_CONTENT_OBJECT_HEADER_H_
#define _NDN_CONTENT_OBJECT_HEADER_H_
-#include "ns3/integer.h"
-#include "ns3/header.h"
#include "ns3/simple-ref-count.h"
-#include "ns3/trailer.h"
#include "ns3/nstime.h"
#include "ns3/packet.h"
+#include "ns3/ptr.h"
-#include <string>
-#include <vector>
-#include <list>
-
-#include "ndn-name.h"
+#include <ns3/ndn-name.h>
namespace ns3 {
namespace ndn {
/**
- * ContentObject header
- *
- * Only few important fields are actually implemented in the simulation
- *
- * @see http://ndnsim.net/new-packet-formats.html
- *
- * Optimized and simplified formatting of Interest packets
- *
- * ContentObject ::= Signature
- * Name
- * Content
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
- * ~ ~
- * ~ Signature ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
- * ~ ~
- * ~ Name ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Length | |
- * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
- * ~ ~
- * ~ Content ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
+ * @ingroup Ndn
+ * @brief ContentObject header
*/
class ContentObject : public SimpleRefCount<ContentObject>
{
diff --git a/model/ndn-face.cc b/model/ndn-face.cc
index 5f8d75c..3681ffb 100644
--- a/model/ndn-face.cc
+++ b/model/ndn-face.cc
@@ -121,7 +121,7 @@
bool
Face::SendInterest (Ptr<const Interest> interest)
{
- NS_LOG_FUNCTION (this << interest);
+ NS_LOG_FUNCTION (this << boost::cref (*this) << interest->GetName ());
if (!IsUp ())
{
diff --git a/model/ndn-interest.cc b/model/ndn-interest.cc
index ffcaa0d..134cd01 100644
--- a/model/ndn-interest.cc
+++ b/model/ndn-interest.cc
@@ -38,6 +38,10 @@
, m_payload (payload)
, m_wire (0)
{
+ if (m_payload == 0) // just in case
+ {
+ m_payload = Create<Packet> ();
+ }
}
Interest::Interest (const Interest &interest)
diff --git a/model/ndn-interest.h b/model/ndn-interest.h
index 32dfcd8..d0959a9 100644
--- a/model/ndn-interest.h
+++ b/model/ndn-interest.h
@@ -22,17 +22,12 @@
#ifndef _NDN_INTEREST_HEADER_H_
#define _NDN_INTEREST_HEADER_H_
-#include "ns3/integer.h"
-#include "ns3/header.h"
#include "ns3/simple-ref-count.h"
#include "ns3/nstime.h"
#include "ns3/packet.h"
+#include "ns3/ptr.h"
-#include <string>
-#include <vector>
-#include <list>
-
-#include "ndn-name.h"
+#include <ns3/ndn-name.h>
namespace ns3 {
diff --git a/model/ndn-name.cc b/model/ndn-name.cc
index 083d3d8..60d1b82 100644
--- a/model/ndn-name.cc
+++ b/model/ndn-name.cc
@@ -38,13 +38,13 @@
{
}
-Name::Name (const std::list<boost::reference_wrapper<const std::string> > &components)
-{
- BOOST_FOREACH (const boost::reference_wrapper<const std::string> &component, components)
- {
- Add (component.get ());
- }
-}
+// Name::Name (const std::list<boost::reference_wrapper<const std::string> > &components)
+// {
+// BOOST_FOREACH (const boost::reference_wrapper<const std::string> &component, components)
+// {
+// Add (component.get ());
+// }
+// }
Name::Name (const std::list<std::string> &components)
{
diff --git a/model/ndn-name.h b/model/ndn-name.h
index d69a75e..3eb2021 100644
--- a/model/ndn-name.h
+++ b/model/ndn-name.h
@@ -58,12 +58,12 @@
*/
Name ();
- /**
- * \brief Constructor
- * Creates a prefix from a list of strings where every string represents a prefix component
- * @param[in] components A list of strings
- */
- Name (const std::list<boost::reference_wrapper<const std::string> > &components);
+ // /**
+ // * \brief Constructor
+ // * Creates a prefix from a list of strings where every string represents a prefix component
+ // * @param[in] components A list of strings
+ // */
+ // Name (const std::list<boost::reference_wrapper<const std::string> > &components);
/**
* \brief Constructor
diff --git a/model/wire/ndnsim.h b/model/wire/ndnsim.h
index c42e532..b46dba9 100644
--- a/model/wire/ndnsim.h
+++ b/model/wire/ndnsim.h
@@ -91,6 +91,40 @@
Ptr<ndn::Interest> m_interest;
};
+/**
+ * @brief Routines to serialize/deserialize Data packet in ndnSIM format
+ *
+ * Only few important fields are actually implemented in the simulation
+ *
+ * @see http://ndnsim.net/new-packet-formats.html
+ *
+ * ContentObject ::= Signature
+ * Name
+ * Content
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
+ * ~ ~
+ * ~ Signature ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ * ~ ~
+ * ~ Name ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length | |
+ * |-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ * ~ ~
+ * ~ Content ~
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ */
class Data : public Header
{
public: