First step of refactoring code (ccnx prefix => ndn prefix)
diff --git a/apps/ccnx-app.cc b/apps/ccnx-app.cc
deleted file mode 100644
index 59da17c..0000000
--- a/apps/ccnx-app.cc
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- 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
- *
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- */
-
-#include "ccnx-app.h"
-#include "ns3/log.h"
-#include "ns3/assert.h"
-#include "ns3/packet.h"
-
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
-#include "ns3/ccnx.h"
-#include "ns3/ccnx-fib.h"
-#include "ns3/ccnx-app-face.h"
-#include "ns3/ccnx-forwarding-strategy.h"
-
-NS_LOG_COMPONENT_DEFINE ("CcnxApp");
-
-namespace ns3
-{
-
-NS_OBJECT_ENSURE_REGISTERED (CcnxApp);
-
-TypeId
-CcnxApp::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::CcnxApp")
- .SetGroupName ("Ccnx")
- .SetParent<Application> ()
- .AddConstructor<CcnxApp> ()
-
- .AddTraceSource ("ReceivedInterests", "ReceivedInterests",
- MakeTraceSourceAccessor (&CcnxApp::m_receivedInterests))
-
- .AddTraceSource ("ReceivedNacks", "ReceivedNacks",
- MakeTraceSourceAccessor (&CcnxApp::m_receivedNacks))
-
- .AddTraceSource ("ReceivedContentObjects", "ReceivedContentObjects",
- MakeTraceSourceAccessor (&CcnxApp::m_receivedContentObjects))
-
- .AddTraceSource ("TransmittedInterests", "TransmittedInterests",
- MakeTraceSourceAccessor (&CcnxApp::m_transmittedInterests))
-
- .AddTraceSource ("TransmittedContentObjects", "TransmittedContentObjects",
- MakeTraceSourceAccessor (&CcnxApp::m_transmittedContentObjects))
- ;
- return tid;
-}
-
-CcnxApp::CcnxApp ()
- : m_protocolHandler (0)
- , m_active (false)
- , m_face (0)
-{
-}
-
-CcnxApp::~CcnxApp ()
-{
-}
-
-void
-CcnxApp::DoDispose (void)
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- // Unfortunately, this causes SEGFAULT
- // The best reason I see is that apps are freed after ccnx stack is removed
- // StopApplication ();
- Application::DoDispose ();
-}
-
-void
-CcnxApp::RegisterProtocolHandler (ProtocolHandler handler)
-{
- m_protocolHandler = handler;
-}
-
-void
-CcnxApp::OnInterest (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet)
-{
- NS_LOG_FUNCTION (this << interest);
- m_receivedInterests (interest, this, m_face);
-}
-
-void
-CcnxApp::OnNack (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet)
-{
- NS_LOG_FUNCTION (this << interest);
- m_receivedNacks (interest, this, m_face);
-}
-
-void
-CcnxApp::OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
- Ptr<Packet> payload)
-{
- NS_LOG_FUNCTION (this << contentObject << payload);
- m_receivedContentObjects (contentObject, payload, this, m_face);
-}
-
-// Application Methods
-void
-CcnxApp::StartApplication () // Called at time specified by Start
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- NS_ASSERT (m_active != true);
- m_active = true;
-
- NS_ASSERT_MSG (GetNode ()->GetObject<Ccnx> () != 0,
- "Ccnx stack should be installed on the node " << GetNode ());
-
- // step 1. Create a face
- m_face = CreateObject<CcnxAppFace> (/*Ptr<CcnxApp> (this)*/this);
-
- // step 2. Add face to the CCNx stack
- GetNode ()->GetObject<Ccnx> ()->AddFace (m_face);
-
- // step 3. Enable face
- m_face->SetUp (true);
-}
-
-void
-CcnxApp::StopApplication () // Called at time specified by Stop
-{
- NS_LOG_FUNCTION_NOARGS ();
-
- if (!m_active) return; //don't assert here, just return
-
- NS_ASSERT (GetNode ()->GetObject<Ccnx> () != 0);
-
- m_active = false;
-
- // step 1. Disable face
- m_face->SetUp (false);
-
- // step 2. Remove face from CCNx stack
- GetNode ()->GetObject<Ccnx> ()->RemoveFace (m_face);
- GetNode ()->GetObject<CcnxFib> ()->RemoveFromAll (m_face);
- GetNode ()->GetObject<CcnxForwardingStrategy> ()->RemoveFace (m_face); // notify that face is removed
-
- // step 3. Destroy face
- NS_ASSERT_MSG (m_face->GetReferenceCount ()==1,
- "At this point, nobody else should have referenced this face, but we have "
- << m_face->GetReferenceCount () << " references");
- m_face = 0;
-}
-
-}
diff --git a/apps/ndn-app.cc b/apps/ndn-app.cc
new file mode 100644
index 0000000..54ea5c6
--- /dev/null
+++ b/apps/ndn-app.cc
@@ -0,0 +1,164 @@
+/* -*- 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
+ *
+ * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "ndn-app.h"
+#include "ns3/log.h"
+#include "ns3/assert.h"
+#include "ns3/packet.h"
+
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
+#include "ns3/ndn.h"
+#include "ns3/ndn-fib.h"
+#include "ns3/ndn-app-face.h"
+#include "ns3/ndn-forwarding-strategy.h"
+
+NS_LOG_COMPONENT_DEFINE ("NdnApp");
+
+namespace ns3
+{
+
+NS_OBJECT_ENSURE_REGISTERED (NdnApp);
+
+TypeId
+NdnApp::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::NdnApp")
+ .SetGroupName ("Ndn")
+ .SetParent<Application> ()
+ .AddConstructor<NdnApp> ()
+
+ .AddTraceSource ("ReceivedInterests", "ReceivedInterests",
+ MakeTraceSourceAccessor (&NdnApp::m_receivedInterests))
+
+ .AddTraceSource ("ReceivedNacks", "ReceivedNacks",
+ MakeTraceSourceAccessor (&NdnApp::m_receivedNacks))
+
+ .AddTraceSource ("ReceivedContentObjects", "ReceivedContentObjects",
+ MakeTraceSourceAccessor (&NdnApp::m_receivedContentObjects))
+
+ .AddTraceSource ("TransmittedInterests", "TransmittedInterests",
+ MakeTraceSourceAccessor (&NdnApp::m_transmittedInterests))
+
+ .AddTraceSource ("TransmittedContentObjects", "TransmittedContentObjects",
+ MakeTraceSourceAccessor (&NdnApp::m_transmittedContentObjects))
+ ;
+ return tid;
+}
+
+NdnApp::NdnApp ()
+ : m_protocolHandler (0)
+ , m_active (false)
+ , m_face (0)
+{
+}
+
+NdnApp::~NdnApp ()
+{
+}
+
+void
+NdnApp::DoDispose (void)
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
+ // Unfortunately, this causes SEGFAULT
+ // The best reason I see is that apps are freed after ndn stack is removed
+ // StopApplication ();
+ Application::DoDispose ();
+}
+
+void
+NdnApp::RegisterProtocolHandler (ProtocolHandler handler)
+{
+ m_protocolHandler = handler;
+}
+
+void
+NdnApp::OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet)
+{
+ NS_LOG_FUNCTION (this << interest);
+ m_receivedInterests (interest, this, m_face);
+}
+
+void
+NdnApp::OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet)
+{
+ NS_LOG_FUNCTION (this << interest);
+ m_receivedNacks (interest, this, m_face);
+}
+
+void
+NdnApp::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
+ Ptr<Packet> payload)
+{
+ NS_LOG_FUNCTION (this << contentObject << payload);
+ m_receivedContentObjects (contentObject, payload, this, m_face);
+}
+
+// Application Methods
+void
+NdnApp::StartApplication () // Called at time specified by Start
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
+ NS_ASSERT (m_active != true);
+ m_active = true;
+
+ NS_ASSERT_MSG (GetNode ()->GetObject<Ndn> () != 0,
+ "Ndn stack should be installed on the node " << GetNode ());
+
+ // step 1. Create a face
+ m_face = CreateObject<NdnAppFace> (/*Ptr<NdnApp> (this)*/this);
+
+ // step 2. Add face to the Ndn stack
+ GetNode ()->GetObject<Ndn> ()->AddFace (m_face);
+
+ // step 3. Enable face
+ m_face->SetUp (true);
+}
+
+void
+NdnApp::StopApplication () // Called at time specified by Stop
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
+ if (!m_active) return; //don't assert here, just return
+
+ NS_ASSERT (GetNode ()->GetObject<Ndn> () != 0);
+
+ m_active = false;
+
+ // step 1. Disable face
+ m_face->SetUp (false);
+
+ // step 2. Remove face from Ndn stack
+ GetNode ()->GetObject<Ndn> ()->RemoveFace (m_face);
+ GetNode ()->GetObject<NdnFib> ()->RemoveFromAll (m_face);
+ GetNode ()->GetObject<NdnForwardingStrategy> ()->RemoveFace (m_face); // notify that face is removed
+
+ // step 3. Destroy face
+ NS_ASSERT_MSG (m_face->GetReferenceCount ()==1,
+ "At this point, nobody else should have referenced this face, but we have "
+ << m_face->GetReferenceCount () << " references");
+ m_face = 0;
+}
+
+}
diff --git a/apps/ccnx-app.h b/apps/ndn-app.h
similarity index 62%
rename from apps/ccnx-app.h
rename to apps/ndn-app.h
index 56093f9..c152ff2 100644
--- a/apps/ccnx-app.h
+++ b/apps/ndn-app.h
@@ -18,8 +18,8 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef CCNX_APP_H
-#define CCNX_APP_H
+#ifndef NDN_APP_H
+#define NDN_APP_H
#include "ns3/application.h"
#include "ns3/ptr.h"
@@ -30,21 +30,21 @@
{
class Packet;
-class CcnxInterestHeader;
-class CcnxContentObjectHeader;
-class CcnxFace;
+class NdnInterestHeader;
+class NdnContentObjectHeader;
+class NdnFace;
/**
- * @ingroup ccnx
- * @brief Base class that all CCNx applications should be derived from.
+ * @ingroup ndn
+ * @brief Base class that all Ndn applications should be derived from.
*
* The class implements virtual calls onInterest, onNack, and onContentObject
*/
-class CcnxApp: public Application
+class NdnApp: public Application
{
public:
/**
- * @brief A callback to pass packets to underlying CCNx protocol
+ * @brief A callback to pass packets to underlying Ndn protocol
*/
typedef Callback<bool, const Ptr<const Packet>&> ProtocolHandler;
@@ -53,8 +53,8 @@
/**
* @brief Default constructor
*/
- CcnxApp ();
- virtual ~CcnxApp ();
+ NdnApp ();
+ virtual ~NdnApp ();
/**
* @brief Register lower layer callback (to send interests from the application)
@@ -69,14 +69,14 @@
* may be useful to get packet tags
*/
virtual void
- OnInterest (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet);
+ OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
/**
* @brief Method that will be called every time new NACK arrives
* @param interest Interest header
*/
virtual void
- OnNack (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet);
+ OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
/**
* @brief Method that will be called every time new ContentObject arrives
@@ -84,7 +84,7 @@
* @param payload payload (potentially virtual) of the ContentObject packet (may include packet tags of original packet)
*/
virtual void
- OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+ OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
Ptr<Packet> payload);
protected:
@@ -102,27 +102,27 @@
StopApplication (); ///< @brief Called at time specified by Stop
protected:
- ProtocolHandler m_protocolHandler; ///< @brief A callback to pass packets to underlying CCNx protocol
+ ProtocolHandler m_protocolHandler; ///< @brief A callback to pass packets to underlying Ndn protocol
bool m_active; ///< @brief Flag to indicate that application is active (set by StartApplication and StopApplication)
- Ptr<CcnxFace> m_face; ///< @brief automatically created application face through which application communicates
+ Ptr<NdnFace> m_face; ///< @brief automatically created application face through which application communicates
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<CcnxApp>, Ptr<CcnxFace> > m_receivedInterests; ///< @brief App-level trace of received Interests
+ TracedCallback<Ptr<const NdnInterestHeader>,
+ Ptr<NdnApp>, Ptr<NdnFace> > m_receivedInterests; ///< @brief App-level trace of received Interests
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<CcnxApp>, Ptr<CcnxFace> > m_receivedNacks; ///< @brief App-level trace of received NACKs
+ TracedCallback<Ptr<const NdnInterestHeader>,
+ Ptr<NdnApp>, Ptr<NdnFace> > m_receivedNacks; ///< @brief App-level trace of received NACKs
- TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
- Ptr<CcnxApp>, Ptr<CcnxFace> > m_receivedContentObjects; ///< @brief App-level trace of received Data
+ TracedCallback<Ptr<const NdnContentObjectHeader>, Ptr<const Packet>,
+ Ptr<NdnApp>, Ptr<NdnFace> > m_receivedContentObjects; ///< @brief App-level trace of received Data
- TracedCallback<Ptr<const CcnxInterestHeader>,
- Ptr<CcnxApp>, Ptr<CcnxFace> > m_transmittedInterests; ///< @brief App-level trace of transmitted Interests
+ TracedCallback<Ptr<const NdnInterestHeader>,
+ Ptr<NdnApp>, Ptr<NdnFace> > m_transmittedInterests; ///< @brief App-level trace of transmitted Interests
- TracedCallback<Ptr<const CcnxContentObjectHeader>, Ptr<const Packet>,
- Ptr<CcnxApp>, Ptr<CcnxFace> > m_transmittedContentObjects; ///< @brief App-level trace of transmitted Data
+ TracedCallback<Ptr<const NdnContentObjectHeader>, Ptr<const Packet>,
+ Ptr<NdnApp>, Ptr<NdnFace> > m_transmittedContentObjects; ///< @brief App-level trace of transmitted Data
};
} // namespace ns3
-#endif // CCNX_APP_H
+#endif // NDN_APP_H
diff --git a/apps/ccnx-consumer-batches.cc b/apps/ndn-consumer-batches.cc
similarity index 72%
rename from apps/ccnx-consumer-batches.cc
rename to apps/ndn-consumer-batches.cc
index 30bdb15..c7de149 100644
--- a/apps/ccnx-consumer-batches.cc
+++ b/apps/ndn-consumer-batches.cc
@@ -18,7 +18,7 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnx-consumer-batches.h"
+#include "ndn-consumer-batches.h"
#include "ns3/ptr.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
@@ -29,47 +29,47 @@
#include "ns3/double.h"
#include "ns3/batches.h"
-NS_LOG_COMPONENT_DEFINE ("CcnxConsumerBatches");
+NS_LOG_COMPONENT_DEFINE ("NdnConsumerBatches");
namespace ns3
{
-NS_OBJECT_ENSURE_REGISTERED (CcnxConsumerBatches);
+NS_OBJECT_ENSURE_REGISTERED (NdnConsumerBatches);
TypeId
-CcnxConsumerBatches::GetTypeId (void)
+NdnConsumerBatches::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CcnxConsumerBatches")
- .SetGroupName ("Ccnx")
- .SetParent<CcnxConsumer> ()
- .AddConstructor<CcnxConsumerBatches> ()
+ static TypeId tid = TypeId ("ns3::NdnConsumerBatches")
+ .SetGroupName ("Ndn")
+ .SetParent<NdnConsumer> ()
+ .AddConstructor<NdnConsumerBatches> ()
.AddAttribute ("Batches", "Batches to schedule. Should be vector, containing pairs of time and amount",
// TypeId::ATTR_SET,
StringValue (""),
- MakeBatchesAccessor (&CcnxConsumerBatches::GetBatch, &CcnxConsumerBatches::SetBatch),
+ MakeBatchesAccessor (&NdnConsumerBatches::GetBatch, &NdnConsumerBatches::SetBatch),
MakeBatchesChecker ())
;
return tid;
}
-CcnxConsumerBatches::CcnxConsumerBatches ()
+NdnConsumerBatches::NdnConsumerBatches ()
{
}
void
-CcnxConsumerBatches::SetBatch (const Batches &batches)
+NdnConsumerBatches::SetBatch (const Batches &batches)
{
// std::cout << "Batches: " << batches << "\n";
for (Batches::const_iterator i = batches.begin (); i != batches.end (); i++)
{
- Simulator::Schedule (i->get<0> (), &CcnxConsumerBatches::AddBatch, this, i->get<1> ());
+ Simulator::Schedule (i->get<0> (), &NdnConsumerBatches::AddBatch, this, i->get<1> ());
}
}
void
-CcnxConsumerBatches::AddBatch (uint32_t amount)
+NdnConsumerBatches::AddBatch (uint32_t amount)
{
// std::cout << Simulator::Now () << " adding batch of " << amount << "\n";
m_seqMax += amount;
@@ -78,10 +78,10 @@
}
void
-CcnxConsumerBatches::ScheduleNextPacket ()
+NdnConsumerBatches::ScheduleNextPacket ()
{
if (!m_sendEvent.IsRunning ())
- m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &CcnxConsumer::SendPacket, this);
+ m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &NdnConsumer::SendPacket, this);
}
///////////////////////////////////////////////////
diff --git a/apps/ccnx-consumer-batches.h b/apps/ndn-consumer-batches.h
similarity index 74%
rename from apps/ccnx-consumer-batches.h
rename to apps/ndn-consumer-batches.h
index 36d7643..f177551 100644
--- a/apps/ccnx-consumer-batches.h
+++ b/apps/ndn-consumer-batches.h
@@ -18,10 +18,10 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef CCNX_CONSUMER_BATCHES_H
-#define CCNX_CONSUMER_BATCHES_H
+#ifndef NDN_CONSUMER_BATCHES_H
+#define NDN_CONSUMER_BATCHES_H
-#include "ccnx-consumer.h"
+#include "ndn-consumer.h"
#include "ns3/traced-value.h"
#include "ns3/batches.h"
@@ -29,10 +29,10 @@
{
/**
- * @ingroup ccnx
- * \brief CCNx application for sending out Interest packets in batches
+ * @ingroup ndn
+ * \brief Ndn application for sending out Interest packets in batches
*/
-class CcnxConsumerBatches: public CcnxConsumer
+class NdnConsumerBatches: public NdnConsumer
{
public:
static TypeId GetTypeId ();
@@ -40,17 +40,17 @@
/**
* \brief Default constructor
*/
- CcnxConsumerBatches ();
+ NdnConsumerBatches ();
- // From CcnxApp
+ // From NdnApp
// virtual void
- // OnInterest (const Ptr<const CcnxInterestHeader> &interest);
+ // OnInterest (const Ptr<const NdnInterestHeader> &interest);
// virtual void
- // OnNack (const Ptr<const CcnxInterestHeader> &interest);
+ // OnNack (const Ptr<const NdnInterestHeader> &interest);
// virtual void
- // OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+ // OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
// const Ptr<const Packet> &payload);
// virtual void
@@ -67,7 +67,7 @@
AddBatch (uint32_t amount);
protected:
/**
- * \brief Constructs the Interest packet and sends it using a callback to the underlying CCNx protocol
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn protocol
*/
virtual void
ScheduleNextPacket ();
diff --git a/apps/ccnx-consumer-cbr.cc b/apps/ndn-consumer-cbr.cc
similarity index 69%
rename from apps/ccnx-consumer-cbr.cc
rename to apps/ndn-consumer-cbr.cc
index b399d05..ef52ef5 100644
--- a/apps/ccnx-consumer-cbr.cc
+++ b/apps/ndn-consumer-cbr.cc
@@ -18,7 +18,7 @@
* Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
*/
-#include "ccnx-consumer-cbr.h"
+#include "ndn-consumer-cbr.h"
#include "ns3/ptr.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
@@ -29,40 +29,40 @@
#include "ns3/uinteger.h"
#include "ns3/double.h"
-#include "ns3/ccnx.h"
-#include "ns3/ccnx-app-face.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
+#include "ns3/ndn.h"
+#include "ns3/ndn-app-face.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
-NS_LOG_COMPONENT_DEFINE ("CcnxConsumerCbr");
+NS_LOG_COMPONENT_DEFINE ("NdnConsumerCbr");
namespace ns3
{
-NS_OBJECT_ENSURE_REGISTERED (CcnxConsumerCbr);
+NS_OBJECT_ENSURE_REGISTERED (NdnConsumerCbr);
TypeId
-CcnxConsumerCbr::GetTypeId (void)
+NdnConsumerCbr::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CcnxConsumerCbr")
- .SetGroupName ("Ccnx")
- .SetParent<CcnxConsumer> ()
- .AddConstructor<CcnxConsumerCbr> ()
+ static TypeId tid = TypeId ("ns3::NdnConsumerCbr")
+ .SetGroupName ("Ndn")
+ .SetParent<NdnConsumer> ()
+ .AddConstructor<NdnConsumerCbr> ()
.AddAttribute ("Frequency", "Frequency of interest packets",
StringValue ("1.0"),
- MakeDoubleAccessor (&CcnxConsumerCbr::m_frequency),
+ MakeDoubleAccessor (&NdnConsumerCbr::m_frequency),
MakeDoubleChecker<double> ())
.AddAttribute ("Randomize", "Type of send time randomization: none (default), uniform, exponential",
StringValue ("none"),
- MakeStringAccessor (&CcnxConsumerCbr::SetRandomize, &CcnxConsumerCbr::GetRandomize),
+ MakeStringAccessor (&NdnConsumerCbr::SetRandomize, &NdnConsumerCbr::GetRandomize),
MakeStringChecker ())
;
return tid;
}
-CcnxConsumerCbr::CcnxConsumerCbr ()
+NdnConsumerCbr::NdnConsumerCbr ()
: m_frequency (1.0)
, m_firstTime (true)
, m_random (0)
@@ -71,14 +71,14 @@
m_seqMax = std::numeric_limits<uint32_t>::max ();
}
-CcnxConsumerCbr::~CcnxConsumerCbr ()
+NdnConsumerCbr::~NdnConsumerCbr ()
{
if (m_random)
delete m_random;
}
void
-CcnxConsumerCbr::ScheduleNextPacket ()
+NdnConsumerCbr::ScheduleNextPacket ()
{
// double mean = 8.0 * m_payloadSize / m_desiredRate.GetBitRate ();
// std::cout << "next: " << Simulator::Now().ToDouble(Time::S) + mean << "s\n";
@@ -86,7 +86,7 @@
if (m_firstTime)
{
m_sendEvent = Simulator::Schedule (Seconds (0.0),
- &CcnxConsumer::SendPacket, this);
+ &NdnConsumer::SendPacket, this);
m_firstTime = false;
}
else if (!m_sendEvent.IsRunning ())
@@ -95,11 +95,11 @@
Seconds(1.0 / m_frequency)
:
Seconds(m_random->GetValue ()),
- &CcnxConsumer::SendPacket, this);
+ &NdnConsumer::SendPacket, this);
}
void
-CcnxConsumerCbr::SetRandomize (const std::string &value)
+NdnConsumerCbr::SetRandomize (const std::string &value)
{
if (m_random)
delete m_random;
@@ -119,7 +119,7 @@
}
std::string
-CcnxConsumerCbr::GetRandomize () const
+NdnConsumerCbr::GetRandomize () const
{
return m_randomType;
}
@@ -130,16 +130,16 @@
///////////////////////////////////////////////////
// void
-// CcnxConsumer::OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+// NdnConsumer::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
// const Ptr<const Packet> &payload)
// {
-// CcnxConsumer::OnContentObject (contentObject, payload); // tracing inside
+// NdnConsumer::OnContentObject (contentObject, payload); // tracing inside
// }
// void
-// CcnxConsumer::OnNack (const Ptr<const CcnxInterestHeader> &interest)
+// NdnConsumer::OnNack (const Ptr<const NdnInterestHeader> &interest)
// {
-// CcnxConsumer::OnNack (interest); // tracing inside
+// NdnConsumer::OnNack (interest); // tracing inside
// }
} // namespace ns3
diff --git a/apps/ccnx-consumer-cbr.h b/apps/ndn-consumer-cbr.h
similarity index 78%
rename from apps/ccnx-consumer-cbr.h
rename to apps/ndn-consumer-cbr.h
index 6490fc8..6916d7a 100644
--- a/apps/ccnx-consumer-cbr.h
+++ b/apps/ndn-consumer-cbr.h
@@ -19,19 +19,19 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef CCNX_CONSUMER_CBR_H
-#define CCNX_CONSUMER_CBR_H
+#ifndef NDN_CONSUMER_CBR_H
+#define NDN_CONSUMER_CBR_H
-#include "ccnx-consumer.h"
+#include "ndn-consumer.h"
namespace ns3
{
/**
- * @ingroup ccnx
- * \brief CCNx application for sending out Interest packets at a "constant" rate (Poisson process)
+ * @ingroup ndn
+ * \brief Ndn application for sending out Interest packets at a "constant" rate (Poisson process)
*/
-class CcnxConsumerCbr: public CcnxConsumer
+class NdnConsumerCbr: public NdnConsumer
{
public:
static TypeId GetTypeId ();
@@ -40,23 +40,23 @@
* \brief Default constructor
* Sets up randomizer function and packet sequence number
*/
- CcnxConsumerCbr ();
- virtual ~CcnxConsumerCbr ();
+ NdnConsumerCbr ();
+ virtual ~NdnConsumerCbr ();
- // From CcnxApp
+ // From NdnApp
// virtual void
- // OnInterest (const Ptr<const CcnxInterestHeader> &interest);
+ // OnInterest (const Ptr<const NdnInterestHeader> &interest);
// virtual void
- // OnNack (const Ptr<const CcnxInterestHeader> &interest);
+ // OnNack (const Ptr<const NdnInterestHeader> &interest);
// virtual void
- // OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+ // OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
// const Ptr<const Packet> &payload);
protected:
/**
- * \brief Constructs the Interest packet and sends it using a callback to the underlying CCNx protocol
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn protocol
*/
virtual void
ScheduleNextPacket ();
diff --git a/apps/ccnx-consumer-window.cc b/apps/ndn-consumer-window.cc
similarity index 67%
rename from apps/ccnx-consumer-window.cc
rename to apps/ndn-consumer-window.cc
index 8b3890d..242456a 100644
--- a/apps/ccnx-consumer-window.cc
+++ b/apps/ndn-consumer-window.cc
@@ -18,7 +18,7 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnx-consumer-window.h"
+#include "ndn-consumer-window.h"
#include "ns3/ptr.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
@@ -28,78 +28,78 @@
#include "ns3/uinteger.h"
#include "ns3/double.h"
-NS_LOG_COMPONENT_DEFINE ("CcnxConsumerWindow");
+NS_LOG_COMPONENT_DEFINE ("NdnConsumerWindow");
namespace ns3
{
-NS_OBJECT_ENSURE_REGISTERED (CcnxConsumerWindow);
+NS_OBJECT_ENSURE_REGISTERED (NdnConsumerWindow);
TypeId
-CcnxConsumerWindow::GetTypeId (void)
+NdnConsumerWindow::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CcnxConsumerWindow")
- .SetGroupName ("Ccnx")
- .SetParent<CcnxConsumer> ()
- .AddConstructor<CcnxConsumerWindow> ()
+ static TypeId tid = TypeId ("ns3::NdnConsumerWindow")
+ .SetGroupName ("Ndn")
+ .SetParent<NdnConsumer> ()
+ .AddConstructor<NdnConsumerWindow> ()
.AddAttribute ("Window", "Initial size of the window",
StringValue ("1"),
- MakeUintegerAccessor (&CcnxConsumerWindow::GetWindow, &CcnxConsumerWindow::SetWindow),
+ MakeUintegerAccessor (&NdnConsumerWindow::GetWindow, &NdnConsumerWindow::SetWindow),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("PayloadSize", "Average size of content object size (to calculate interest generation rate)",
UintegerValue (1040),
- MakeUintegerAccessor (&CcnxConsumerWindow::GetPayloadSize, &CcnxConsumerWindow::SetPayloadSize),
+ MakeUintegerAccessor (&NdnConsumerWindow::GetPayloadSize, &NdnConsumerWindow::SetPayloadSize),
MakeUintegerChecker<uint32_t>())
.AddAttribute ("Size", "Amount of data in megabytes to request (relies on PayloadSize parameter)",
DoubleValue (-1), // don't impose limit by default
- MakeDoubleAccessor (&CcnxConsumerWindow::GetMaxSize, &CcnxConsumerWindow::SetMaxSize),
+ MakeDoubleAccessor (&NdnConsumerWindow::GetMaxSize, &NdnConsumerWindow::SetMaxSize),
MakeDoubleChecker<double> ())
.AddTraceSource ("WindowTrace",
"Window that controls how many outstanding interests are allowed",
- MakeTraceSourceAccessor (&CcnxConsumerWindow::m_window))
+ MakeTraceSourceAccessor (&NdnConsumerWindow::m_window))
.AddTraceSource ("InFlight",
"Current number of outstanding interests",
- MakeTraceSourceAccessor (&CcnxConsumerWindow::m_window))
+ MakeTraceSourceAccessor (&NdnConsumerWindow::m_window))
;
return tid;
}
-CcnxConsumerWindow::CcnxConsumerWindow ()
+NdnConsumerWindow::NdnConsumerWindow ()
: m_payloadSize (1040)
, m_inFlight (0)
{
}
void
-CcnxConsumerWindow::SetWindow (uint32_t window)
+NdnConsumerWindow::SetWindow (uint32_t window)
{
m_window = window;
}
uint32_t
-CcnxConsumerWindow::GetWindow () const
+NdnConsumerWindow::GetWindow () const
{
return m_window;
}
uint32_t
-CcnxConsumerWindow::GetPayloadSize () const
+NdnConsumerWindow::GetPayloadSize () const
{
return m_payloadSize;
}
void
-CcnxConsumerWindow::SetPayloadSize (uint32_t payload)
+NdnConsumerWindow::SetPayloadSize (uint32_t payload)
{
m_payloadSize = payload;
}
double
-CcnxConsumerWindow::GetMaxSize () const
+NdnConsumerWindow::GetMaxSize () const
{
if (m_seqMax == 0)
return -1.0;
@@ -108,7 +108,7 @@
}
void
-CcnxConsumerWindow::SetMaxSize (double size)
+NdnConsumerWindow::SetMaxSize (double size)
{
m_maxSize = size;
if (m_maxSize < 0)
@@ -124,12 +124,12 @@
void
-CcnxConsumerWindow::ScheduleNextPacket ()
+NdnConsumerWindow::ScheduleNextPacket ()
{
if (m_window == static_cast<uint32_t> (0) || m_inFlight >= m_window)
{
if (!m_sendEvent.IsRunning ())
- m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &CcnxConsumer::SendPacket, this);
+ m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &NdnConsumer::SendPacket, this);
return;
}
@@ -137,7 +137,7 @@
if (!m_sendEvent.IsRunning ())
{
m_inFlight++;
- m_sendEvent = Simulator::ScheduleNow (&CcnxConsumer::SendPacket, this);
+ m_sendEvent = Simulator::ScheduleNow (&NdnConsumer::SendPacket, this);
}
}
@@ -146,10 +146,10 @@
///////////////////////////////////////////////////
void
-CcnxConsumerWindow::OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+NdnConsumerWindow::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
Ptr<Packet> payload)
{
- CcnxConsumer::OnContentObject (contentObject, payload);
+ NdnConsumer::OnContentObject (contentObject, payload);
m_window = m_window + 1;
@@ -158,9 +158,9 @@
}
void
-CcnxConsumerWindow::OnNack (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> payload)
+NdnConsumerWindow::OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> payload)
{
- CcnxConsumer::OnNack (interest, payload);
+ NdnConsumer::OnNack (interest, payload);
if (m_inFlight > static_cast<uint32_t> (0)) m_inFlight--;
if (m_window > static_cast<uint32_t> (0))
@@ -171,10 +171,10 @@
}
void
-CcnxConsumerWindow::OnTimeout (uint32_t sequenceNumber)
+NdnConsumerWindow::OnTimeout (uint32_t sequenceNumber)
{
if (m_inFlight > static_cast<uint32_t> (0)) m_inFlight--;
- CcnxConsumer::OnTimeout (sequenceNumber);
+ NdnConsumer::OnTimeout (sequenceNumber);
}
} // namespace ns3
diff --git a/apps/ccnx-consumer-window.h b/apps/ndn-consumer-window.h
similarity index 78%
rename from apps/ccnx-consumer-window.h
rename to apps/ndn-consumer-window.h
index cde300a..5d9adff 100644
--- a/apps/ccnx-consumer-window.h
+++ b/apps/ndn-consumer-window.h
@@ -19,23 +19,23 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef CCNX_CONSUMER_WINDOW_H
-#define CCNX_CONSUMER_WINDOW_H
+#ifndef NDN_CONSUMER_WINDOW_H
+#define NDN_CONSUMER_WINDOW_H
-#include "ccnx-consumer.h"
+#include "ndn-consumer.h"
#include "ns3/traced-value.h"
namespace ns3
{
/**
- * @ingroup ccnx
- * \brief CCNx application for sending out Interest packets (window-based)
+ * @ingroup ndn
+ * \brief Ndn application for sending out Interest packets (window-based)
*
* !!! ATTENTION !!! This is highly experimental and relies on experimental features of the simulator.
* Behavior may be unpredictable if used incorrectly.
*/
-class CcnxConsumerWindow: public CcnxConsumer
+class NdnConsumerWindow: public NdnConsumer
{
public:
static TypeId GetTypeId ();
@@ -43,17 +43,17 @@
/**
* \brief Default constructor
*/
- CcnxConsumerWindow ();
+ NdnConsumerWindow ();
- // From CcnxApp
+ // From NdnApp
// virtual void
- // OnInterest (const Ptr<const CcnxInterestHeader> &interest);
+ // OnInterest (const Ptr<const NdnInterestHeader> &interest);
virtual void
- OnNack (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> payload);
+ OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> payload);
virtual void
- OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+ OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
Ptr<Packet> payload);
virtual void
@@ -61,7 +61,7 @@
protected:
/**
- * \brief Constructs the Interest packet and sends it using a callback to the underlying CCNx protocol
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn protocol
*/
virtual void
ScheduleNextPacket ();
diff --git a/apps/ccnx-consumer.cc b/apps/ndn-consumer.cc
similarity index 78%
rename from apps/ccnx-consumer.cc
rename to apps/ndn-consumer.cc
index c9e6103..6d976fc 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ndn-consumer.cc
@@ -18,7 +18,7 @@
* Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
*/
-#include "ccnx-consumer.h"
+#include "ndn-consumer.h"
#include "ns3/ptr.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
@@ -29,10 +29,10 @@
#include "ns3/uinteger.h"
#include "ns3/double.h"
-#include "ns3/ccnx.h"
-#include "ns3/ccnx-app-face.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
+#include "ns3/ndn.h"
+#include "ns3/ndn-app-face.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
// #include "ns3/weights-path-stretch-tag.h"
#include <boost/ref.hpp>
@@ -44,63 +44,63 @@
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("CcnxConsumer");
+NS_LOG_COMPONENT_DEFINE ("NdnConsumer");
namespace ns3
{
-NS_OBJECT_ENSURE_REGISTERED (CcnxConsumer);
+NS_OBJECT_ENSURE_REGISTERED (NdnConsumer);
TypeId
-CcnxConsumer::GetTypeId (void)
+NdnConsumer::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CcnxConsumer")
- .SetGroupName ("Ccnx")
- .SetParent<CcnxApp> ()
+ static TypeId tid = TypeId ("ns3::NdnConsumer")
+ .SetGroupName ("Ndn")
+ .SetParent<NdnApp> ()
.AddAttribute ("StartSeq", "Initial sequence number",
IntegerValue (0),
- MakeIntegerAccessor(&CcnxConsumer::m_seq),
+ MakeIntegerAccessor(&NdnConsumer::m_seq),
MakeIntegerChecker<int32_t>())
- .AddAttribute ("Prefix","CcnxName of the Interest",
+ .AddAttribute ("Prefix","NdnName of the Interest",
StringValue ("/"),
- MakeCcnxNameComponentsAccessor (&CcnxConsumer::m_interestName),
- MakeCcnxNameComponentsChecker ())
+ MakeNdnNameComponentsAccessor (&NdnConsumer::m_interestName),
+ MakeNdnNameComponentsChecker ())
.AddAttribute ("LifeTime", "LifeTime for interest packet",
StringValue ("2s"),
- MakeTimeAccessor (&CcnxConsumer::m_interestLifeTime),
+ MakeTimeAccessor (&NdnConsumer::m_interestLifeTime),
MakeTimeChecker ())
.AddAttribute ("MinSuffixComponents", "MinSuffixComponents",
IntegerValue(-1),
- MakeIntegerAccessor(&CcnxConsumer::m_minSuffixComponents),
+ MakeIntegerAccessor(&NdnConsumer::m_minSuffixComponents),
MakeIntegerChecker<int32_t>())
.AddAttribute ("MaxSuffixComponents", "MaxSuffixComponents",
IntegerValue(-1),
- MakeIntegerAccessor(&CcnxConsumer::m_maxSuffixComponents),
+ MakeIntegerAccessor(&NdnConsumer::m_maxSuffixComponents),
MakeIntegerChecker<int32_t>())
.AddAttribute ("ChildSelector", "ChildSelector",
BooleanValue(false),
- MakeBooleanAccessor(&CcnxConsumer::m_childSelector),
+ MakeBooleanAccessor(&NdnConsumer::m_childSelector),
MakeBooleanChecker())
- .AddAttribute ("Exclude", "only simple name matching is supported (use CcnxNameComponents)",
- CcnxNameComponentsValue (),
- MakeCcnxNameComponentsAccessor (&CcnxConsumer::m_exclude),
- MakeCcnxNameComponentsChecker ())
+ .AddAttribute ("Exclude", "only simple name matching is supported (use NdnNameComponents)",
+ NdnNameComponentsValue (),
+ MakeNdnNameComponentsAccessor (&NdnConsumer::m_exclude),
+ MakeNdnNameComponentsChecker ())
.AddAttribute ("RetxTimer",
"Timeout defining how frequent retransmission timeouts should be checked",
StringValue ("50ms"),
- MakeTimeAccessor (&CcnxConsumer::GetRetxTimer, &CcnxConsumer::SetRetxTimer),
+ MakeTimeAccessor (&NdnConsumer::GetRetxTimer, &NdnConsumer::SetRetxTimer),
MakeTimeChecker ())
.AddTraceSource ("PathWeightsTrace", "PathWeightsTrace",
- MakeTraceSourceAccessor (&CcnxConsumer::m_pathWeightsTrace))
+ MakeTraceSourceAccessor (&NdnConsumer::m_pathWeightsTrace))
;
return tid;
}
-CcnxConsumer::CcnxConsumer ()
+NdnConsumer::NdnConsumer ()
: m_rand (0, std::numeric_limits<uint32_t>::max ())
, m_seq (0)
, m_seqMax (0) // don't request anything
@@ -111,7 +111,7 @@
}
void
-CcnxConsumer::SetRetxTimer (Time retxTimer)
+NdnConsumer::SetRetxTimer (Time retxTimer)
{
m_retxTimer = retxTimer;
if (m_retxEvent.IsRunning ())
@@ -119,17 +119,17 @@
// schedule even with new timeout
m_retxEvent = Simulator::Schedule (m_retxTimer,
- &CcnxConsumer::CheckRetxTimeout, this);
+ &NdnConsumer::CheckRetxTimeout, this);
}
Time
-CcnxConsumer::GetRetxTimer () const
+NdnConsumer::GetRetxTimer () const
{
return m_retxTimer;
}
void
-CcnxConsumer::CheckRetxTimeout ()
+NdnConsumer::CheckRetxTimeout ()
{
Time now = Simulator::Now ();
@@ -150,23 +150,23 @@
}
m_retxEvent = Simulator::Schedule (m_retxTimer,
- &CcnxConsumer::CheckRetxTimeout, this);
+ &NdnConsumer::CheckRetxTimeout, this);
}
// Application Methods
void
-CcnxConsumer::StartApplication () // Called at time specified by Start
+NdnConsumer::StartApplication () // Called at time specified by Start
{
NS_LOG_FUNCTION_NOARGS ();
// do base stuff
- CcnxApp::StartApplication ();
+ NdnApp::StartApplication ();
ScheduleNextPacket ();
}
void
-CcnxConsumer::StopApplication () // Called at time specified by Stop
+NdnConsumer::StopApplication () // Called at time specified by Stop
{
NS_LOG_FUNCTION_NOARGS ();
@@ -174,11 +174,11 @@
Simulator::Cancel (m_sendEvent);
// cleanup base stuff
- CcnxApp::StopApplication ();
+ NdnApp::StopApplication ();
}
void
-CcnxConsumer::SendPacket ()
+NdnConsumer::SendPacket ()
{
if (!m_active) return;
@@ -220,18 +220,18 @@
// std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << seq << "\n";
//
- Ptr<CcnxNameComponents> nameWithSequence = Create<CcnxNameComponents> (m_interestName);
+ Ptr<NdnNameComponents> nameWithSequence = Create<NdnNameComponents> (m_interestName);
(*nameWithSequence) (seq);
//
- CcnxInterestHeader interestHeader;
+ NdnInterestHeader interestHeader;
interestHeader.SetNonce (m_rand.GetValue ());
interestHeader.SetName (nameWithSequence);
interestHeader.SetInterestLifetime (m_interestLifeTime);
interestHeader.SetChildSelector (m_childSelector);
if (m_exclude.size ()>0)
{
- interestHeader.SetExclude (Create<CcnxNameComponents> (m_exclude));
+ interestHeader.SetExclude (Create<NdnNameComponents> (m_exclude));
}
interestHeader.SetMaxSuffixComponents (m_maxSuffixComponents);
interestHeader.SetMinSuffixComponents (m_minSuffixComponents);
@@ -261,12 +261,12 @@
void
-CcnxConsumer::OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+NdnConsumer::OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
Ptr<Packet> payload)
{
if (!m_active) return;
- CcnxApp::OnContentObject (contentObject, payload); // tracing inside
+ NdnApp::OnContentObject (contentObject, payload); // tracing inside
NS_LOG_FUNCTION (this << contentObject << payload);
@@ -300,11 +300,11 @@
}
void
-CcnxConsumer::OnNack (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> origPacket)
+NdnConsumer::OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> origPacket)
{
if (!m_active) return;
- CcnxApp::OnNack (interest, origPacket); // tracing inside
+ NdnApp::OnNack (interest, origPacket); // tracing inside
NS_LOG_DEBUG ("Nack type: " << interest->GetNack ());
@@ -325,7 +325,7 @@
}
void
-CcnxConsumer::OnTimeout (uint32_t sequenceNumber)
+NdnConsumer::OnTimeout (uint32_t sequenceNumber)
{
// std::cout << Simulator::Now () << ", TO: " << sequenceNumber << ", current RTO: " << m_rtt->RetransmitTimeout ().ToDouble (Time::S) << "s\n";
diff --git a/apps/ccnx-consumer.h b/apps/ndn-consumer.h
similarity index 84%
rename from apps/ccnx-consumer.h
rename to apps/ndn-consumer.h
index dacc586..0bc7f70 100644
--- a/apps/ccnx-consumer.h
+++ b/apps/ndn-consumer.h
@@ -19,12 +19,12 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef CCNX_CONSUMER_H
-#define CCNX_CONSUMER_H
+#ifndef NDN_CONSUMER_H
+#define NDN_CONSUMER_H
-#include "ccnx-app.h"
+#include "ndn-app.h"
#include "ns3/random-variable.h"
-#include "ns3/ccnx-name-components.h"
+#include "ns3/ndn-name-components.h"
#include "ns3/nstime.h"
#include "ns3/data-rate.h"
#include "../../internet/model/rtt-estimator.h"
@@ -41,10 +41,10 @@
{
/**
- * @ingroup ccnx
- * \brief CCNx application for sending out Interest packets
+ * @ingroup ndn
+ * \brief Ndn application for sending out Interest packets
*/
-class CcnxConsumer: public CcnxApp
+class NdnConsumer: public NdnApp
{
public:
static TypeId GetTypeId ();
@@ -53,18 +53,18 @@
* \brief Default constructor
* Sets up randomizer function and packet sequence number
*/
- CcnxConsumer ();
- virtual ~CcnxConsumer () {};
+ NdnConsumer ();
+ virtual ~NdnConsumer () {};
- // From CcnxApp
+ // From NdnApp
// virtual void
- // OnInterest (const Ptr<const CcnxInterestHeader> &interest);
+ // OnInterest (const Ptr<const NdnInterestHeader> &interest);
virtual void
- OnNack (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet);
+ OnNack (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
virtual void
- OnContentObject (const Ptr<const CcnxContentObjectHeader> &contentObject,
+ OnContentObject (const Ptr<const NdnContentObjectHeader> &contentObject,
Ptr<Packet> payload);
/**
@@ -81,7 +81,7 @@
SendPacket ();
protected:
- // from CcnxApp
+ // from NdnApp
virtual void
StartApplication ();
@@ -89,7 +89,7 @@
StopApplication ();
/**
- * \brief Constructs the Interest packet and sends it using a callback to the underlying CCNx protocol
+ * \brief Constructs the Interest packet and sends it using a callback to the underlying Ndn protocol
*/
virtual void
ScheduleNextPacket () = 0;
@@ -126,12 +126,12 @@
Ptr<RttEstimator> m_rtt; ///< @brief RTT estimator
Time m_offTime; ///< \brief Time interval between packets
- CcnxNameComponents m_interestName; ///< \brief CcnxName of the Interest (use CcnxNameComponents)
+ NdnNameComponents m_interestName; ///< \brief NdnName of the Interest (use NdnNameComponents)
Time m_interestLifeTime; ///< \brief LifeTime for interest packet
- int32_t m_minSuffixComponents; ///< \brief MinSuffixComponents. See CcnxInterestHeader for more information
- int32_t m_maxSuffixComponents; ///< \brief MaxSuffixComponents. See CcnxInterestHeader for more information
- bool m_childSelector; ///< \brief ChildSelector. See CcnxInterestHeader for more information
- CcnxNameComponents m_exclude; ///< \brief Exclude. See CcnxInterestHeader for more information
+ int32_t m_minSuffixComponents; ///< \brief MinSuffixComponents. See NdnInterestHeader for more information
+ int32_t m_maxSuffixComponents; ///< \brief MaxSuffixComponents. See NdnInterestHeader for more information
+ bool m_childSelector; ///< \brief ChildSelector. See NdnInterestHeader for more information
+ NdnNameComponents m_exclude; ///< \brief Exclude. See NdnInterestHeader for more information
/// @cond include_hidden
/**
diff --git a/apps/ccnx-producer.cc b/apps/ndn-producer.cc
similarity index 64%
rename from apps/ccnx-producer.cc
rename to apps/ndn-producer.cc
index 8b57513..541d6d8 100644
--- a/apps/ccnx-producer.cc
+++ b/apps/ndn-producer.cc
@@ -19,107 +19,107 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "ccnx-producer.h"
+#include "ndn-producer.h"
#include "ns3/log.h"
-#include "ns3/ccnx-interest-header.h"
-#include "ns3/ccnx-content-object-header.h"
+#include "ns3/ndn-interest-header.h"
+#include "ns3/ndn-content-object-header.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/packet.h"
#include "ns3/simulator.h"
-#include "ns3/ccnx-app-face.h"
-#include "ns3/ccnx-fib.h"
-// #include "../model/ccnx-fib-impl.h"
+#include "ns3/ndn-app-face.h"
+#include "ns3/ndn-fib.h"
+// #include "../model/ndn-fib-impl.h"
#include <boost/ref.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
namespace ll = boost::lambda;
-NS_LOG_COMPONENT_DEFINE ("CcnxProducer");
+NS_LOG_COMPONENT_DEFINE ("NdnProducer");
namespace ns3
{
-NS_OBJECT_ENSURE_REGISTERED (CcnxProducer);
+NS_OBJECT_ENSURE_REGISTERED (NdnProducer);
TypeId
-CcnxProducer::GetTypeId (void)
+NdnProducer::GetTypeId (void)
{
- static TypeId tid = TypeId ("ns3::CcnxProducer")
- .SetGroupName ("Ccnx")
- .SetParent<CcnxApp> ()
- .AddConstructor<CcnxProducer> ()
+ static TypeId tid = TypeId ("ns3::NdnProducer")
+ .SetGroupName ("Ndn")
+ .SetParent<NdnApp> ()
+ .AddConstructor<NdnProducer> ()
.AddAttribute ("Prefix","Prefix, for which producer has the data",
StringValue ("/"),
- MakeCcnxNameComponentsAccessor (&CcnxProducer::m_prefix),
- MakeCcnxNameComponentsChecker ())
+ MakeNdnNameComponentsAccessor (&NdnProducer::m_prefix),
+ MakeNdnNameComponentsChecker ())
.AddAttribute ("PayloadSize", "Virtual payload size for Content packets",
UintegerValue (1024),
- MakeUintegerAccessor(&CcnxProducer::m_virtualPayloadSize),
+ MakeUintegerAccessor(&NdnProducer::m_virtualPayloadSize),
MakeUintegerChecker<uint32_t>())
// optional attributes
.AddAttribute ("SignatureBits", "SignatureBits field",
UintegerValue (0),
- MakeUintegerAccessor(&CcnxProducer::m_signatureBits),
+ MakeUintegerAccessor(&NdnProducer::m_signatureBits),
MakeUintegerChecker<uint32_t> ())
;
return tid;
}
-CcnxProducer::CcnxProducer ()
+NdnProducer::NdnProducer ()
{
// NS_LOG_FUNCTION_NOARGS ();
}
// inherited from Application base class.
void
-CcnxProducer::StartApplication ()
+NdnProducer::StartApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
- NS_ASSERT (GetNode ()->GetObject<CcnxFib> () != 0);
+ NS_ASSERT (GetNode ()->GetObject<NdnFib> () != 0);
- CcnxApp::StartApplication ();
+ NdnApp::StartApplication ();
NS_LOG_DEBUG ("NodeID: " << GetNode ()->GetId ());
- Ptr<CcnxFib> fib = GetNode ()->GetObject<CcnxFib> ();
+ Ptr<NdnFib> fib = GetNode ()->GetObject<NdnFib> ();
- Ptr<CcnxFibEntry> fibEntry = fib->Add (m_prefix, m_face, 0);
+ Ptr<NdnFibEntry> fibEntry = fib->Add (m_prefix, m_face, 0);
- fibEntry->UpdateStatus (m_face, CcnxFibFaceMetric::NDN_FIB_GREEN);
+ fibEntry->UpdateStatus (m_face, NdnFibFaceMetric::NDN_FIB_GREEN);
// // make face green, so it will be used primarily
- // StaticCast<CcnxFibImpl> (fib)->modify (fibEntry,
- // ll::bind (&CcnxFibEntry::UpdateStatus,
- // ll::_1, m_face, CcnxFibFaceMetric::NDN_FIB_GREEN));
+ // StaticCast<NdnFibImpl> (fib)->modify (fibEntry,
+ // ll::bind (&NdnFibEntry::UpdateStatus,
+ // ll::_1, m_face, NdnFibFaceMetric::NDN_FIB_GREEN));
}
void
-CcnxProducer::StopApplication ()
+NdnProducer::StopApplication ()
{
NS_LOG_FUNCTION_NOARGS ();
- NS_ASSERT (GetNode ()->GetObject<CcnxFib> () != 0);
+ NS_ASSERT (GetNode ()->GetObject<NdnFib> () != 0);
- CcnxApp::StopApplication ();
+ NdnApp::StopApplication ();
}
void
-CcnxProducer::OnInterest (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> origPacket)
+NdnProducer::OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> origPacket)
{
- CcnxApp::OnInterest (interest, origPacket); // tracing inside
+ NdnApp::OnInterest (interest, origPacket); // tracing inside
NS_LOG_FUNCTION (this << interest);
if (!m_active) return;
- static CcnxContentObjectTail tail;
- Ptr<CcnxContentObjectHeader> header = Create<CcnxContentObjectHeader> ();
- header->SetName (Create<CcnxNameComponents> (interest->GetName ()));
+ static NdnContentObjectTail tail;
+ Ptr<NdnContentObjectHeader> header = Create<NdnContentObjectHeader> ();
+ header->SetName (Create<NdnNameComponents> (interest->GetName ()));
header->GetSignedInfo ().SetTimestamp (Simulator::Now ());
header->GetSignature ().SetSignatureBits (m_signatureBits);
diff --git a/apps/ccnx-producer.h b/apps/ndn-producer.h
similarity index 79%
rename from apps/ccnx-producer.h
rename to apps/ndn-producer.h
index 4b54d79..4b0e079 100644
--- a/apps/ccnx-producer.h
+++ b/apps/ndn-producer.h
@@ -19,14 +19,14 @@
* Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#ifndef CCNX_PRODUCER_H
-#define CCNX_PRODUCER_H
+#ifndef NDN_PRODUCER_H
+#define NDN_PRODUCER_H
-#include "ccnx-app.h"
+#include "ndn-app.h"
#include "ns3/ptr.h"
-#include "ns3/ccnx-name-components.h"
-#include "ns3/ccnx-content-object-header.h"
+#include "ns3/ndn-name-components.h"
+#include "ns3/ndn-content-object-header.h"
namespace ns3
{
@@ -39,16 +39,16 @@
* size and name same as in Interest.cation, which replying every incoming Interest
* with Data packet with a specified size and name same as in Interest.
*/
-class CcnxProducer : public CcnxApp
+class NdnProducer : public NdnApp
{
public:
static TypeId
GetTypeId (void);
- CcnxProducer ();
+ NdnProducer ();
- // inherited from CcnxApp
- void OnInterest (const Ptr<const CcnxInterestHeader> &interest, Ptr<Packet> packet);
+ // inherited from NdnApp
+ void OnInterest (const Ptr<const NdnInterestHeader> &interest, Ptr<Packet> packet);
protected:
// inherited from Application base class.
@@ -59,13 +59,13 @@
StopApplication (); // Called at time specified by Stop
private:
- CcnxNameComponents m_prefix;
+ NdnNameComponents m_prefix;
uint32_t m_virtualPayloadSize;
uint32_t m_signatureBits;
- // CcnxContentObjectHeader::SignedInfo m_signedInfo;
+ // NdnContentObjectHeader::SignedInfo m_signedInfo;
};
}
-#endif // CCNX_PRODUCER_H
+#endif // NDN_PRODUCER_H